From ebce4330a49a5d55906838a9a0e3cbc3eb0a16b1 Mon Sep 17 00:00:00 2001 From: Massimiliano Calandrelli Date: Fri, 27 Sep 2019 15:26:19 +0200 Subject: [PATCH 01/33] ... --- example/astx/ast.bnf | 2 +- example/astx/ast/ast.go | 2 +- example/astx/ast_test.go | 6 +- example/astx/errors/errors.go | 2 +- example/astx/lexer/acttab.go | 2 +- example/astx/lexer/lexer.go | 2 +- example/astx/lexer/transitiontable.go | 0 example/astx/parser/action.go | 0 example/astx/parser/actiontable.go | 0 example/astx/parser/gototable.go | 0 example/astx/parser/parser.go | 4 +- example/astx/parser/productionstable.go | 2 +- example/astx/token/token.go | 0 example/astx/util/litconv.go | 0 example/astx/util/rune.go | 0 example/bools/ast/ast.go | 4 +- example/bools/errors/errors.go | 2 +- example/bools/example.bnf | 2 +- example/bools/example_test.go | 6 +- example/bools/lexer/acttab.go | 2 +- example/bools/lexer/lexer.go | 2 +- example/bools/lexer/transitiontable.go | 0 example/bools/parser/action.go | 0 example/bools/parser/actiontable.go | 0 example/bools/parser/gototable.go | 0 example/bools/parser/parser.go | 4 +- example/bools/parser/productionstable.go | 2 +- example/bools/token/token.go | 0 example/bools/util/litconv.go | 0 example/bools/util/rune.go | 0 example/calc/calc.bnf | 4 +- example/calc/calc_test.go | 4 +- example/calc/errors/errors.go | 2 +- example/calc/lexer/acttab.go | 2 +- example/calc/lexer/lexer.go | 2 +- example/calc/lexer/transitiontable.go | 0 example/calc/parser/action.go | 0 example/calc/parser/actiontable.go | 0 example/calc/parser/gototable.go | 0 example/calc/parser/parser.go | 4 +- example/calc/parser/productionstable.go | 4 +- example/calc/token/token.go | 0 example/calc/util/litconv.go | 0 example/calc/util/rune.go | 0 example/ctx/Makefile | 2 + example/ctx/ast/ast.go | 31 + example/ctx/ctx.bnf | 33 + example/ctx/ctx_test.go | 38 + example/ctx/doc.go | 1 + example/ctx/errors/errors.go | 56 + example/ctx/lexer/acttab.go | 51 + example/ctx/lexer/lexer.go | 126 + example/ctx/lexer/transitiontable.go | 109 + example/ctx/parser/action.go | 51 + example/ctx/parser/actiontable.go | 54 + example/ctx/parser/gototable.go | 38 + example/ctx/parser/parser.go | 216 + example/ctx/parser/productionstable.go | 63 + example/ctx/token/token.go | 72 + example/ctx/util/litconv.go | 108 + example/ctx/util/rune.go | 39 + example/errorrecovery/ast/ast.go | 2 +- example/errorrecovery/er.bnf | 2 +- example/errorrecovery/er_test.go | 8 +- example/errorrecovery/errors/errors.go | 2 +- example/errorrecovery/lexer/acttab.go | 2 +- example/errorrecovery/lexer/lexer.go | 2 +- .../errorrecovery/lexer/transitiontable.go | 0 example/errorrecovery/parser/action.go | 0 example/errorrecovery/parser/actiontable.go | 0 example/errorrecovery/parser/gototable.go | 0 example/errorrecovery/parser/parser.go | 4 +- .../errorrecovery/parser/productionstable.go | 2 +- example/errorrecovery/parser/symbols.go | 0 example/errorrecovery/token/token.go | 0 example/errorrecovery/util/litconv.go | 0 example/errorrecovery/util/rune.go | 0 example/mail/lexer/acttab.go | 2 +- example/mail/lexer/lexer.go | 2 +- example/mail/lexer/transitiontable.go | 0 example/mail/parser_test.go | 4 +- example/mail/token/token.go | 0 example/mail/util/litconv.go | 0 example/mail/util/rune.go | 0 example/nolexer/errors/errors.go | 2 +- example/nolexer/nolexer.bnf | 2 +- example/nolexer/nolexer_test.go | 4 +- example/nolexer/parser/action.go | 0 example/nolexer/parser/actiontable.go | 0 example/nolexer/parser/gototable.go | 0 example/nolexer/parser/parser.go | 4 +- example/nolexer/parser/productionstable.go | 2 +- example/nolexer/scanner/scanner.go | 2 +- example/nolexer/token/token.go | 0 example/nolexer/util/litconv.go | 0 example/nolexer/util/rune.go | 0 example/rr/errors/errors.go | 2 +- example/rr/lexer/acttab.go | 2 +- example/rr/lexer/lexer.go | 2 +- example/rr/lexer/transitiontable.go | 0 example/rr/parser/action.go | 0 example/rr/parser/actiontable.go | 0 example/rr/parser/gototable.go | 0 example/rr/parser/parser.go | 4 +- example/rr/parser/productionstable.go | 0 example/rr/rr_test.go | 4 +- example/rr/token/token.go | 0 example/rr/util/litconv.go | 0 example/rr/util/rune.go | 0 example/sr/ast/ast.go | 2 +- example/sr/errors/errors.go | 2 +- example/sr/lexer/acttab.go | 2 +- example/sr/lexer/lexer.go | 2 +- example/sr/lexer/transitiontable.go | 0 example/sr/parser/action.go | 0 example/sr/parser/actiontable.go | 0 example/sr/parser/gototable.go | 0 example/sr/parser/parser.go | 4 +- example/sr/parser/productionstable.go | 2 +- example/sr/sr.bnf | 2 +- example/sr/sr_test.go | 6 +- example/sr/token/token.go | 0 example/sr/util/litconv.go | 0 example/sr/util/rune.go | 0 internal/ast/fileheader.go | 4 +- internal/ast/lexcharlit.go | 18 +- internal/ast/lexcharrange.go | 20 +- internal/ast/lexignoredtokdef.go | 2 +- internal/ast/leximport.go | 2 +- internal/ast/lexregdef.go | 2 +- internal/ast/lexregdefid.go | 2 +- internal/ast/lextokdef.go | 2 +- internal/ast/sdthlp.go | 42 + internal/ast/syntaxbody.go | 4 +- internal/ast/syntaxprod.go | 2 +- internal/ast/syntaxprodid.go | 2 +- internal/ast/syntaxstringlit.go | 2 +- internal/ast/syntaxtokid.go | 2 +- internal/frontend | 1 + internal/frontend_ext/errors/errors.go | 56 + internal/frontend_ext/lexer/acttab.go | 467 ++ internal/frontend_ext/lexer/lexer.go | 221 + .../frontend_ext/lexer/transitiontable.go | 1315 ++++++ internal/frontend_ext/parser/action.go | 51 + internal/frontend_ext/parser/actiontable.go | 4130 +++++++++++++++++ internal/frontend_ext/parser/gototable.go | 2659 +++++++++++ internal/frontend_ext/parser/parser.go | 216 + .../frontend_ext/parser/productionstable.go | 443 ++ internal/frontend_ext/token/token.go | 112 + internal/frontend_ext/util/litconv.go | 108 + internal/frontend_ext/util/rune.go | 39 + .../errors/errors.go | 2 +- .../parser/parser.go | 4 +- .../parser/parser_ut.go | 4 +- .../parser/tables.go | 2 +- .../parser/tables_uncompressed.go | 2 +- .../scanner/scanner.go | 4 +- .../scanner/scanner_test.go | 2 +- .../token/token.go | 0 .../token/tokens.go | 0 internal/lexer/gen/golang/acttab.go | 6 +- internal/lexer/gen/golang/asciitable.go | 4 +- internal/lexer/gen/golang/chrranges.go | 2 +- internal/lexer/gen/golang/gen.go | 6 +- internal/lexer/gen/golang/imports.go | 2 +- internal/lexer/gen/golang/lexer.go | 59 +- internal/lexer/gen/golang/transtab.go | 4 +- internal/lexer/items/charrange.go | 2 +- internal/lexer/items/disjunctrangeset.go | 54 +- internal/lexer/items/disjunctrangeset_test.go | 29 +- internal/lexer/items/item.go | 6 +- internal/lexer/items/item_test.go | 2 +- internal/lexer/items/itemlist.go | 4 +- internal/lexer/items/itempos.go | 2 +- internal/lexer/items/itempos_test.go | 2 +- internal/lexer/items/itemset.go | 4 +- internal/lexer/items/itemsets.go | 4 +- internal/lexer/items/testutils_test.go | 8 +- internal/lexer/symbols/charlitsymbols.go | 2 +- internal/lexer/symbols/charrangesymbols.go | 2 +- internal/lexer/symbols/symbols.go | 2 +- internal/parser/first/first.go | 4 +- internal/parser/gen/gen.go | 12 +- internal/parser/gen/golang/action.go | 2 +- internal/parser/gen/golang/actiontable.go | 10 +- internal/parser/gen/golang/errors.go | 2 +- internal/parser/gen/golang/gototable.go | 6 +- internal/parser/gen/golang/parser.go | 17 +- .../parser/gen/golang/productionstable.go | 18 +- internal/parser/lr1/items/item.go | 4 +- internal/parser/lr1/items/itemset.go | 8 +- internal/parser/lr1/items/itemsets.go | 6 +- internal/parser/lr1/items/rowconflicts.go | 2 +- internal/parser/lr1/items/testdata_test.go | 8 +- internal/parser/symbols/symbols.go | 2 +- internal/test/t1/errors/errors.go | 2 +- internal/test/t1/lexer/acttab.go | 2 +- internal/test/t1/lexer/lexer.go | 2 +- internal/test/t1/lexer/transitiontable.go | 0 internal/test/t1/parser/action.go | 0 internal/test/t1/parser/actiontable.go | 0 internal/test/t1/parser/gototable.go | 0 internal/test/t1/parser/parser.go | 4 +- internal/test/t1/parser/productionstable.go | 0 internal/test/t1/t1_test.go | 6 +- internal/test/t1/token/token.go | 0 internal/test/t1/util/litconv.go | 0 internal/test/t1/util/rune.go | 0 internal/token/gen/gen.go | 4 +- internal/token/gen/golang/token.go | 14 +- internal/util/gen/gen.go | 2 +- internal/util/gen/golang/litconv.go | 2 +- internal/util/gen/golang/rune.go | 2 +- main.go | 76 +- spec/gocc2.ebnf | 152 +- 215 files changed, 11476 insertions(+), 283 deletions(-) mode change 100755 => 100644 example/astx/errors/errors.go mode change 100755 => 100644 example/astx/lexer/acttab.go mode change 100755 => 100644 example/astx/lexer/lexer.go mode change 100755 => 100644 example/astx/lexer/transitiontable.go mode change 100755 => 100644 example/astx/parser/action.go mode change 100755 => 100644 example/astx/parser/actiontable.go mode change 100755 => 100644 example/astx/parser/gototable.go mode change 100755 => 100644 example/astx/parser/parser.go mode change 100755 => 100644 example/astx/parser/productionstable.go mode change 100755 => 100644 example/astx/token/token.go mode change 100755 => 100644 example/astx/util/litconv.go mode change 100755 => 100644 example/astx/util/rune.go mode change 100755 => 100644 example/bools/errors/errors.go mode change 100755 => 100644 example/bools/lexer/acttab.go mode change 100755 => 100644 example/bools/lexer/lexer.go mode change 100755 => 100644 example/bools/lexer/transitiontable.go mode change 100755 => 100644 example/bools/parser/action.go mode change 100755 => 100644 example/bools/parser/actiontable.go mode change 100755 => 100644 example/bools/parser/gototable.go mode change 100755 => 100644 example/bools/parser/parser.go mode change 100755 => 100644 example/bools/parser/productionstable.go mode change 100755 => 100644 example/bools/token/token.go mode change 100755 => 100644 example/bools/util/litconv.go mode change 100755 => 100644 example/bools/util/rune.go mode change 100755 => 100644 example/calc/errors/errors.go mode change 100755 => 100644 example/calc/lexer/acttab.go mode change 100755 => 100644 example/calc/lexer/lexer.go mode change 100755 => 100644 example/calc/lexer/transitiontable.go mode change 100755 => 100644 example/calc/parser/action.go mode change 100755 => 100644 example/calc/parser/actiontable.go mode change 100755 => 100644 example/calc/parser/gototable.go mode change 100755 => 100644 example/calc/parser/parser.go mode change 100755 => 100644 example/calc/parser/productionstable.go mode change 100755 => 100644 example/calc/token/token.go mode change 100755 => 100644 example/calc/util/litconv.go mode change 100755 => 100644 example/calc/util/rune.go create mode 100644 example/ctx/Makefile create mode 100644 example/ctx/ast/ast.go create mode 100644 example/ctx/ctx.bnf create mode 100644 example/ctx/ctx_test.go create mode 100644 example/ctx/doc.go create mode 100644 example/ctx/errors/errors.go create mode 100644 example/ctx/lexer/acttab.go create mode 100644 example/ctx/lexer/lexer.go create mode 100644 example/ctx/lexer/transitiontable.go create mode 100644 example/ctx/parser/action.go create mode 100644 example/ctx/parser/actiontable.go create mode 100644 example/ctx/parser/gototable.go create mode 100644 example/ctx/parser/parser.go create mode 100644 example/ctx/parser/productionstable.go create mode 100644 example/ctx/token/token.go create mode 100644 example/ctx/util/litconv.go create mode 100644 example/ctx/util/rune.go mode change 100755 => 100644 example/errorrecovery/errors/errors.go mode change 100755 => 100644 example/errorrecovery/lexer/acttab.go mode change 100755 => 100644 example/errorrecovery/lexer/lexer.go mode change 100755 => 100644 example/errorrecovery/lexer/transitiontable.go mode change 100755 => 100644 example/errorrecovery/parser/action.go mode change 100755 => 100644 example/errorrecovery/parser/actiontable.go mode change 100755 => 100644 example/errorrecovery/parser/gototable.go mode change 100755 => 100644 example/errorrecovery/parser/parser.go mode change 100755 => 100644 example/errorrecovery/parser/productionstable.go mode change 100755 => 100644 example/errorrecovery/parser/symbols.go mode change 100755 => 100644 example/errorrecovery/token/token.go mode change 100755 => 100644 example/errorrecovery/util/litconv.go mode change 100755 => 100644 example/errorrecovery/util/rune.go mode change 100755 => 100644 example/mail/lexer/acttab.go mode change 100755 => 100644 example/mail/lexer/lexer.go mode change 100755 => 100644 example/mail/lexer/transitiontable.go mode change 100755 => 100644 example/mail/token/token.go mode change 100755 => 100644 example/mail/util/litconv.go mode change 100755 => 100644 example/mail/util/rune.go mode change 100755 => 100644 example/nolexer/errors/errors.go mode change 100755 => 100644 example/nolexer/parser/action.go mode change 100755 => 100644 example/nolexer/parser/actiontable.go mode change 100755 => 100644 example/nolexer/parser/gototable.go mode change 100755 => 100644 example/nolexer/parser/parser.go mode change 100755 => 100644 example/nolexer/parser/productionstable.go mode change 100755 => 100644 example/nolexer/token/token.go mode change 100755 => 100644 example/nolexer/util/litconv.go mode change 100755 => 100644 example/nolexer/util/rune.go mode change 100755 => 100644 example/rr/errors/errors.go mode change 100755 => 100644 example/rr/lexer/acttab.go mode change 100755 => 100644 example/rr/lexer/lexer.go mode change 100755 => 100644 example/rr/lexer/transitiontable.go mode change 100755 => 100644 example/rr/parser/action.go mode change 100755 => 100644 example/rr/parser/actiontable.go mode change 100755 => 100644 example/rr/parser/gototable.go mode change 100755 => 100644 example/rr/parser/parser.go mode change 100755 => 100644 example/rr/parser/productionstable.go mode change 100755 => 100644 example/rr/token/token.go mode change 100755 => 100644 example/rr/util/litconv.go mode change 100755 => 100644 example/rr/util/rune.go mode change 100755 => 100644 example/sr/errors/errors.go mode change 100755 => 100644 example/sr/lexer/acttab.go mode change 100755 => 100644 example/sr/lexer/lexer.go mode change 100755 => 100644 example/sr/lexer/transitiontable.go mode change 100755 => 100644 example/sr/parser/action.go mode change 100755 => 100644 example/sr/parser/actiontable.go mode change 100755 => 100644 example/sr/parser/gototable.go mode change 100755 => 100644 example/sr/parser/parser.go mode change 100755 => 100644 example/sr/parser/productionstable.go mode change 100755 => 100644 example/sr/token/token.go mode change 100755 => 100644 example/sr/util/litconv.go mode change 100755 => 100644 example/sr/util/rune.go create mode 100644 internal/ast/sdthlp.go create mode 120000 internal/frontend create mode 100644 internal/frontend_ext/errors/errors.go create mode 100644 internal/frontend_ext/lexer/acttab.go create mode 100644 internal/frontend_ext/lexer/lexer.go create mode 100644 internal/frontend_ext/lexer/transitiontable.go create mode 100644 internal/frontend_ext/parser/action.go create mode 100644 internal/frontend_ext/parser/actiontable.go create mode 100644 internal/frontend_ext/parser/gototable.go create mode 100644 internal/frontend_ext/parser/parser.go create mode 100644 internal/frontend_ext/parser/productionstable.go create mode 100644 internal/frontend_ext/token/token.go create mode 100644 internal/frontend_ext/util/litconv.go create mode 100644 internal/frontend_ext/util/rune.go rename internal/{frontend => frontend_orig}/errors/errors.go (88%) rename internal/{frontend => frontend_orig}/parser/parser.go (97%) rename internal/{frontend => frontend_orig}/parser/parser_ut.go (96%) rename internal/{frontend => frontend_orig}/parser/tables.go (99%) rename internal/{frontend => frontend_orig}/parser/tables_uncompressed.go (99%) rename internal/{frontend => frontend_orig}/scanner/scanner.go (99%) rename internal/{frontend => frontend_orig}/scanner/scanner_test.go (97%) rename internal/{frontend => frontend_orig}/token/token.go (100%) rename internal/{frontend => frontend_orig}/token/tokens.go (100%) mode change 100755 => 100644 internal/test/t1/errors/errors.go mode change 100755 => 100644 internal/test/t1/lexer/acttab.go mode change 100755 => 100644 internal/test/t1/lexer/lexer.go mode change 100755 => 100644 internal/test/t1/lexer/transitiontable.go mode change 100755 => 100644 internal/test/t1/parser/action.go mode change 100755 => 100644 internal/test/t1/parser/actiontable.go mode change 100755 => 100644 internal/test/t1/parser/gototable.go mode change 100755 => 100644 internal/test/t1/parser/parser.go mode change 100755 => 100644 internal/test/t1/parser/productionstable.go mode change 100755 => 100644 internal/test/t1/token/token.go mode change 100755 => 100644 internal/test/t1/util/litconv.go mode change 100755 => 100644 internal/test/t1/util/rune.go diff --git a/example/astx/ast.bnf b/example/astx/ast.bnf index d5d77fb1..01698006 100644 --- a/example/astx/ast.bnf +++ b/example/astx/ast.bnf @@ -12,7 +12,7 @@ id : (_letter | '_') {_idchar} ; /* Syntax elements */ -<< import "github.com/goccmack/gocc/example/astx/ast" >> +<< import "github.com/maxcalandrelli/gocc/example/astx/ast" >> StmtList : Stmt << ast.NewStmtList($0) >> diff --git a/example/astx/ast/ast.go b/example/astx/ast/ast.go index de638d91..268ed2f0 100644 --- a/example/astx/ast/ast.go +++ b/example/astx/ast/ast.go @@ -1,7 +1,7 @@ package ast import ( - "github.com/goccmack/gocc/example/astx/token" + "github.com/maxcalandrelli/gocc/example/astx/token" ) type ( diff --git a/example/astx/ast_test.go b/example/astx/ast_test.go index 7f13766b..c7844fdd 100644 --- a/example/astx/ast_test.go +++ b/example/astx/ast_test.go @@ -4,9 +4,9 @@ import ( "fmt" "testing" - "github.com/goccmack/gocc/example/astx/ast" - "github.com/goccmack/gocc/example/astx/lexer" - "github.com/goccmack/gocc/example/astx/parser" + "github.com/maxcalandrelli/gocc/example/astx/ast" + "github.com/maxcalandrelli/gocc/example/astx/lexer" + "github.com/maxcalandrelli/gocc/example/astx/parser" ) func TestPass(t *testing.T) { diff --git a/example/astx/errors/errors.go b/example/astx/errors/errors.go old mode 100755 new mode 100644 index 640214b0..5aad6b75 --- a/example/astx/errors/errors.go +++ b/example/astx/errors/errors.go @@ -6,7 +6,7 @@ import ( "fmt" "strings" - "github.com/goccmack/gocc/example/astx/token" + "github.com/maxcalandrelli/gocc/example/astx/token" ) type ErrorSymbol interface { diff --git a/example/astx/lexer/acttab.go b/example/astx/lexer/acttab.go old mode 100755 new mode 100644 index 6f9994fb..c43f5d24 --- a/example/astx/lexer/acttab.go +++ b/example/astx/lexer/acttab.go @@ -5,7 +5,7 @@ package lexer import ( "fmt" - "github.com/goccmack/gocc/example/astx/token" + "github.com/maxcalandrelli/gocc/example/astx/token" ) type ActionTable [NumStates]ActionRow diff --git a/example/astx/lexer/lexer.go b/example/astx/lexer/lexer.go old mode 100755 new mode 100644 index acc0bda1..41f924a0 --- a/example/astx/lexer/lexer.go +++ b/example/astx/lexer/lexer.go @@ -6,7 +6,7 @@ import ( "io/ioutil" "unicode/utf8" - "github.com/goccmack/gocc/example/astx/token" + "github.com/maxcalandrelli/gocc/example/astx/token" ) const ( diff --git a/example/astx/lexer/transitiontable.go b/example/astx/lexer/transitiontable.go old mode 100755 new mode 100644 diff --git a/example/astx/parser/action.go b/example/astx/parser/action.go old mode 100755 new mode 100644 diff --git a/example/astx/parser/actiontable.go b/example/astx/parser/actiontable.go old mode 100755 new mode 100644 diff --git a/example/astx/parser/gototable.go b/example/astx/parser/gototable.go old mode 100755 new mode 100644 diff --git a/example/astx/parser/parser.go b/example/astx/parser/parser.go old mode 100755 new mode 100644 index e02ff1f9..589aa2c2 --- a/example/astx/parser/parser.go +++ b/example/astx/parser/parser.go @@ -6,8 +6,8 @@ import ( "fmt" "strings" - parseError "github.com/goccmack/gocc/example/astx/errors" - "github.com/goccmack/gocc/example/astx/token" + parseError "github.com/maxcalandrelli/gocc/example/astx/errors" + "github.com/maxcalandrelli/gocc/example/astx/token" ) const ( diff --git a/example/astx/parser/productionstable.go b/example/astx/parser/productionstable.go old mode 100755 new mode 100644 index 7ee72c4e..1b603b16 --- a/example/astx/parser/productionstable.go +++ b/example/astx/parser/productionstable.go @@ -2,7 +2,7 @@ package parser -import "github.com/goccmack/gocc/example/astx/ast" +import "github.com/maxcalandrelli/gocc/example/astx/ast" type ( //TODO: change type and variable names to be consistent with other tables diff --git a/example/astx/token/token.go b/example/astx/token/token.go old mode 100755 new mode 100644 diff --git a/example/astx/util/litconv.go b/example/astx/util/litconv.go old mode 100755 new mode 100644 diff --git a/example/astx/util/rune.go b/example/astx/util/rune.go old mode 100755 new mode 100644 diff --git a/example/bools/ast/ast.go b/example/bools/ast/ast.go index ac4e6b00..b7ebfb9d 100644 --- a/example/bools/ast/ast.go +++ b/example/bools/ast/ast.go @@ -18,8 +18,8 @@ import ( "strconv" "strings" - "github.com/goccmack/gocc/example/bools/token" - "github.com/goccmack/gocc/example/bools/util" + "github.com/maxcalandrelli/gocc/example/bools/token" + "github.com/maxcalandrelli/gocc/example/bools/util" ) type Attrib interface{} diff --git a/example/bools/errors/errors.go b/example/bools/errors/errors.go old mode 100755 new mode 100644 index f5b52772..5ddaa2db --- a/example/bools/errors/errors.go +++ b/example/bools/errors/errors.go @@ -6,7 +6,7 @@ import ( "fmt" "strings" - "github.com/goccmack/gocc/example/bools/token" + "github.com/maxcalandrelli/gocc/example/bools/token" ) type ErrorSymbol interface { diff --git a/example/bools/example.bnf b/example/bools/example.bnf index b800d3f9..f020ed1a 100644 --- a/example/bools/example.bnf +++ b/example/bools/example.bnf @@ -20,7 +20,7 @@ string_lit : '"' {.} '"' ; !whitespace : ' ' | '\t' | '\n' | '\r' ; -<> +<> BoolExpr : BoolExpr1 << $0, nil >> diff --git a/example/bools/example_test.go b/example/bools/example_test.go index 64a16345..374d0eaf 100644 --- a/example/bools/example_test.go +++ b/example/bools/example_test.go @@ -17,9 +17,9 @@ package example import ( "testing" - "github.com/goccmack/gocc/example/bools/ast" - "github.com/goccmack/gocc/example/bools/lexer" - "github.com/goccmack/gocc/example/bools/parser" + "github.com/maxcalandrelli/gocc/example/bools/ast" + "github.com/maxcalandrelli/gocc/example/bools/lexer" + "github.com/maxcalandrelli/gocc/example/bools/parser" ) func testEval(t *testing.T, exampleStr string, output bool) { diff --git a/example/bools/lexer/acttab.go b/example/bools/lexer/acttab.go old mode 100755 new mode 100644 index 0ad87756..e70d0168 --- a/example/bools/lexer/acttab.go +++ b/example/bools/lexer/acttab.go @@ -5,7 +5,7 @@ package lexer import ( "fmt" - "github.com/goccmack/gocc/example/bools/token" + "github.com/maxcalandrelli/gocc/example/bools/token" ) type ActionTable [NumStates]ActionRow diff --git a/example/bools/lexer/lexer.go b/example/bools/lexer/lexer.go old mode 100755 new mode 100644 index 7a9808e9..55efb5c6 --- a/example/bools/lexer/lexer.go +++ b/example/bools/lexer/lexer.go @@ -6,7 +6,7 @@ import ( "io/ioutil" "unicode/utf8" - "github.com/goccmack/gocc/example/bools/token" + "github.com/maxcalandrelli/gocc/example/bools/token" ) const ( diff --git a/example/bools/lexer/transitiontable.go b/example/bools/lexer/transitiontable.go old mode 100755 new mode 100644 diff --git a/example/bools/parser/action.go b/example/bools/parser/action.go old mode 100755 new mode 100644 diff --git a/example/bools/parser/actiontable.go b/example/bools/parser/actiontable.go old mode 100755 new mode 100644 diff --git a/example/bools/parser/gototable.go b/example/bools/parser/gototable.go old mode 100755 new mode 100644 diff --git a/example/bools/parser/parser.go b/example/bools/parser/parser.go old mode 100755 new mode 100644 index e2074579..baba1de0 --- a/example/bools/parser/parser.go +++ b/example/bools/parser/parser.go @@ -6,8 +6,8 @@ import ( "fmt" "strings" - parseError "github.com/goccmack/gocc/example/bools/errors" - "github.com/goccmack/gocc/example/bools/token" + parseError "github.com/maxcalandrelli/gocc/example/bools/errors" + "github.com/maxcalandrelli/gocc/example/bools/token" ) const ( diff --git a/example/bools/parser/productionstable.go b/example/bools/parser/productionstable.go old mode 100755 new mode 100644 index 70d32f6a..994b10b8 --- a/example/bools/parser/productionstable.go +++ b/example/bools/parser/productionstable.go @@ -3,7 +3,7 @@ package parser import ( - "github.com/goccmack/gocc/example/bools/ast" + "github.com/maxcalandrelli/gocc/example/bools/ast" ) type ( diff --git a/example/bools/token/token.go b/example/bools/token/token.go old mode 100755 new mode 100644 diff --git a/example/bools/util/litconv.go b/example/bools/util/litconv.go old mode 100755 new mode 100644 diff --git a/example/bools/util/rune.go b/example/bools/util/rune.go old mode 100755 new mode 100644 diff --git a/example/calc/calc.bnf b/example/calc/calc.bnf index d9469b05..345ca13e 100644 --- a/example/calc/calc.bnf +++ b/example/calc/calc.bnf @@ -10,8 +10,8 @@ int64 : '1'-'9' {_digit} ; << import( - "github.com/goccmack/gocc/example/calc/token" - "github.com/goccmack/gocc/example/calc/util" + "github.com/maxcalandrelli/gocc/example/calc/token" + "github.com/maxcalandrelli/gocc/example/calc/util" ) >> diff --git a/example/calc/calc_test.go b/example/calc/calc_test.go index cc0288f4..13c5eb6c 100644 --- a/example/calc/calc_test.go +++ b/example/calc/calc_test.go @@ -3,8 +3,8 @@ package calc import ( "testing" - "github.com/goccmack/gocc/example/calc/lexer" - "github.com/goccmack/gocc/example/calc/parser" + "github.com/maxcalandrelli/gocc/example/calc/lexer" + "github.com/maxcalandrelli/gocc/example/calc/parser" ) type TI struct { diff --git a/example/calc/errors/errors.go b/example/calc/errors/errors.go old mode 100755 new mode 100644 index 44b2ffc7..4ade5796 --- a/example/calc/errors/errors.go +++ b/example/calc/errors/errors.go @@ -6,7 +6,7 @@ import ( "fmt" "strings" - "github.com/goccmack/gocc/example/calc/token" + "github.com/maxcalandrelli/gocc/example/calc/token" ) type ErrorSymbol interface { diff --git a/example/calc/lexer/acttab.go b/example/calc/lexer/acttab.go old mode 100755 new mode 100644 index 1068fb15..67a021e4 --- a/example/calc/lexer/acttab.go +++ b/example/calc/lexer/acttab.go @@ -5,7 +5,7 @@ package lexer import ( "fmt" - "github.com/goccmack/gocc/example/calc/token" + "github.com/maxcalandrelli/gocc/example/calc/token" ) type ActionTable [NumStates]ActionRow diff --git a/example/calc/lexer/lexer.go b/example/calc/lexer/lexer.go old mode 100755 new mode 100644 index 44fabe83..51ec617d --- a/example/calc/lexer/lexer.go +++ b/example/calc/lexer/lexer.go @@ -6,7 +6,7 @@ import ( "io/ioutil" "unicode/utf8" - "github.com/goccmack/gocc/example/calc/token" + "github.com/maxcalandrelli/gocc/example/calc/token" ) const ( diff --git a/example/calc/lexer/transitiontable.go b/example/calc/lexer/transitiontable.go old mode 100755 new mode 100644 diff --git a/example/calc/parser/action.go b/example/calc/parser/action.go old mode 100755 new mode 100644 diff --git a/example/calc/parser/actiontable.go b/example/calc/parser/actiontable.go old mode 100755 new mode 100644 diff --git a/example/calc/parser/gototable.go b/example/calc/parser/gototable.go old mode 100755 new mode 100644 diff --git a/example/calc/parser/parser.go b/example/calc/parser/parser.go old mode 100755 new mode 100644 index dd2ca3e4..96906ab5 --- a/example/calc/parser/parser.go +++ b/example/calc/parser/parser.go @@ -6,8 +6,8 @@ import ( "fmt" "strings" - parseError "github.com/goccmack/gocc/example/calc/errors" - "github.com/goccmack/gocc/example/calc/token" + parseError "github.com/maxcalandrelli/gocc/example/calc/errors" + "github.com/maxcalandrelli/gocc/example/calc/token" ) const ( diff --git a/example/calc/parser/productionstable.go b/example/calc/parser/productionstable.go old mode 100755 new mode 100644 index cb7194ae..e3d38815 --- a/example/calc/parser/productionstable.go +++ b/example/calc/parser/productionstable.go @@ -3,8 +3,8 @@ package parser import ( - "github.com/goccmack/gocc/example/calc/token" - "github.com/goccmack/gocc/example/calc/util" + "github.com/maxcalandrelli/gocc/example/calc/token" + "github.com/maxcalandrelli/gocc/example/calc/util" ) type ( diff --git a/example/calc/token/token.go b/example/calc/token/token.go old mode 100755 new mode 100644 diff --git a/example/calc/util/litconv.go b/example/calc/util/litconv.go old mode 100755 new mode 100644 diff --git a/example/calc/util/rune.go b/example/calc/util/rune.go old mode 100755 new mode 100644 diff --git a/example/ctx/Makefile b/example/ctx/Makefile new file mode 100644 index 00000000..1006c07e --- /dev/null +++ b/example/ctx/Makefile @@ -0,0 +1,2 @@ +regenerate: + gocc ctx.bnf diff --git a/example/ctx/ast/ast.go b/example/ctx/ast/ast.go new file mode 100644 index 00000000..06ae99bf --- /dev/null +++ b/example/ctx/ast/ast.go @@ -0,0 +1,31 @@ +package ast + +import ( + "fmt" + + calc_lexer "github.com/maxcalandrelli/gocc/example/calc/lexer" + calc_parser "github.com/maxcalandrelli/gocc/example/calc/parser" + "github.com/maxcalandrelli/gocc/example/ctx/token" +) + +type ( + StmtList []Stmt + Stmt string +) + +func NewStmtList(stmt interface{}) (StmtList, error) { + return StmtList{stmt.(Stmt)}, nil +} + +func AppendStmt(stmtList, stmt interface{}) (StmtList, error) { + return append(stmtList.(StmtList), stmt.(Stmt)), nil +} + +func NewStmt(stmtList interface{}) (Stmt, error) { + return Stmt(stmtList.(*token.Token).Lit), nil +} + +func Calc(verb interface{}) (Stmt, error) { + calc_parser.NewParser().Parse(calc_lexer.NewLexer()) + return fmt.Sprintf("%s ") +} diff --git a/example/ctx/ctx.bnf b/example/ctx/ctx.bnf new file mode 100644 index 00000000..29abacc5 --- /dev/null +++ b/example/ctx/ctx.bnf @@ -0,0 +1,33 @@ +/* Lexical elements */ + +_letter : 'a'-'z' | 'A'-'Z' ; + +_digit : '0'-'9' ; + +_idchar : _letter | _digit | '_' ; + +id : (_letter | '_') {_idchar} ; + +!whitespace : ' ' | '\t' | '\n' | '\r' ; + +/* Syntax elements */ + +<< + import ( + "github.com/maxcalandrelli/gocc/example/ctx/ast" + "github.com/maxcalandrelli/gocc/example/ctx/ast" + ) +>> + +StmtList : + Stmt << ast.NewStmtList($0) >> + | StmtList Stmt << ast.AppendStmt($0, $1) >> +; + +Stmt : + id << ast.NewStmt($0) >> + | + "calc" + << ast.Calc($0) >> + +; diff --git a/example/ctx/ctx_test.go b/example/ctx/ctx_test.go new file mode 100644 index 00000000..f7162b46 --- /dev/null +++ b/example/ctx/ctx_test.go @@ -0,0 +1,38 @@ +package ctx + +import ( + "fmt" + "testing" + + "github.com/maxcalandrelli/gocc/example/astx/ast" + "github.com/maxcalandrelli/gocc/example/astx/lexer" + "github.com/maxcalandrelli/gocc/example/astx/parser" +) + +func TestPass(t *testing.T) { + sml, err := test([]byte("a b c 12 * 6 + 4 d e f")) + if err != nil { + t.Fatal(err.Error()) + } + fmt.Printf("output: %s\n", sml) +} + +func TestFail(t *testing.T) { + _, err := test([]byte("a b 22c d e f")) + if err == nil { + t.Fatal("expected parse error") + } else { + fmt.Printf("Parsing failed as expected: %v\n", err) + } +} + +func test(src []byte) (astree ast.StmtList, err error) { + fmt.Printf("input: %s\n", src) + s := lexer.NewLexer(src) + p := parser.NewParser() + a, err := p.Parse(s) + if err == nil { + astree = a.(ast.StmtList) + } + return +} diff --git a/example/ctx/doc.go b/example/ctx/doc.go new file mode 100644 index 00000000..d061274b --- /dev/null +++ b/example/ctx/doc.go @@ -0,0 +1 @@ +package ctx diff --git a/example/ctx/errors/errors.go b/example/ctx/errors/errors.go new file mode 100644 index 00000000..5aad6b75 --- /dev/null +++ b/example/ctx/errors/errors.go @@ -0,0 +1,56 @@ +// Code generated by gocc; DO NOT EDIT. + +package errors + +import ( + "fmt" + "strings" + + "github.com/maxcalandrelli/gocc/example/astx/token" +) + +type ErrorSymbol interface { +} + +type Error struct { + Err error + ErrorToken *token.Token + ErrorSymbols []ErrorSymbol + ExpectedTokens []string + StackTop int +} + +func (e *Error) String() string { + w := new(strings.Builder) + fmt.Fprintf(w, "Error") + if e.Err != nil { + fmt.Fprintf(w, " %s\n", e.Err) + } else { + fmt.Fprintf(w, "\n") + } + fmt.Fprintf(w, "Token: type=%d, lit=%s\n", e.ErrorToken.Type, e.ErrorToken.Lit) + fmt.Fprintf(w, "Pos: offset=%d, line=%d, column=%d\n", e.ErrorToken.Pos.Offset, e.ErrorToken.Pos.Line, e.ErrorToken.Pos.Column) + fmt.Fprintf(w, "Expected one of: ") + for _, sym := range e.ExpectedTokens { + fmt.Fprintf(w, "%s ", sym) + } + fmt.Fprintf(w, "ErrorSymbol:\n") + for _, sym := range e.ErrorSymbols { + fmt.Fprintf(w, "%v\n", sym) + } + return w.String() +} + +func (e *Error) Error() string { + w := new(strings.Builder) + fmt.Fprintf(w, "Error in S%d: %s, %s", e.StackTop, token.TokMap.TokenString(e.ErrorToken), e.ErrorToken.Pos.String()) + if e.Err != nil { + fmt.Fprintf(w, ": %+v", e.Err) + } else { + fmt.Fprintf(w, ", expected one of: ") + for _, expected := range e.ExpectedTokens { + fmt.Fprintf(w, "%s ", expected) + } + } + return w.String() +} diff --git a/example/ctx/lexer/acttab.go b/example/ctx/lexer/acttab.go new file mode 100644 index 00000000..c43f5d24 --- /dev/null +++ b/example/ctx/lexer/acttab.go @@ -0,0 +1,51 @@ +// Code generated by gocc; DO NOT EDIT. + +package lexer + +import ( + "fmt" + + "github.com/maxcalandrelli/gocc/example/astx/token" +) + +type ActionTable [NumStates]ActionRow + +type ActionRow struct { + Accept token.Type + Ignore string +} + +func (a ActionRow) String() string { + return fmt.Sprintf("Accept=%d, Ignore=%s", a.Accept, a.Ignore) +} + +var ActTab = ActionTable{ + ActionRow{ // S0 + Accept: 0, + Ignore: "", + }, + ActionRow{ // S1 + Accept: -1, + Ignore: "!whitespace", + }, + ActionRow{ // S2 + Accept: 2, + Ignore: "", + }, + ActionRow{ // S3 + Accept: 2, + Ignore: "", + }, + ActionRow{ // S4 + Accept: 2, + Ignore: "", + }, + ActionRow{ // S5 + Accept: 2, + Ignore: "", + }, + ActionRow{ // S6 + Accept: 2, + Ignore: "", + }, +} diff --git a/example/ctx/lexer/lexer.go b/example/ctx/lexer/lexer.go new file mode 100644 index 00000000..41f924a0 --- /dev/null +++ b/example/ctx/lexer/lexer.go @@ -0,0 +1,126 @@ +// Code generated by gocc; DO NOT EDIT. + +package lexer + +import ( + "io/ioutil" + "unicode/utf8" + + "github.com/maxcalandrelli/gocc/example/astx/token" +) + +const ( + NoState = -1 + NumStates = 7 + NumSymbols = 10 +) + +type Lexer struct { + src []byte + pos int + line int + column int +} + +func NewLexer(src []byte) *Lexer { + lexer := &Lexer{ + src: src, + pos: 0, + line: 1, + column: 1, + } + return lexer +} + +func NewLexerFile(fpath string) (*Lexer, error) { + src, err := ioutil.ReadFile(fpath) + if err != nil { + return nil, err + } + return NewLexer(src), nil +} + +func (l *Lexer) Scan() (tok *token.Token) { + tok = new(token.Token) + if l.pos >= len(l.src) { + tok.Type = token.EOF + tok.Pos.Offset, tok.Pos.Line, tok.Pos.Column = l.pos, l.line, l.column + return + } + start, startLine, startColumn, end := l.pos, l.line, l.column, 0 + tok.Type = token.INVALID + state, rune1, size := 0, rune(-1), 0 + for state != -1 { + if l.pos >= len(l.src) { + rune1 = -1 + } else { + rune1, size = utf8.DecodeRune(l.src[l.pos:]) + l.pos += size + } + + nextState := -1 + if rune1 != -1 { + nextState = TransTab[state](rune1) + } + state = nextState + + if state != -1 { + + switch rune1 { + case '\n': + l.line++ + l.column = 1 + case '\r': + l.column = 1 + case '\t': + l.column += 4 + default: + l.column++ + } + + switch { + case ActTab[state].Accept != -1: + tok.Type = ActTab[state].Accept + end = l.pos + case ActTab[state].Ignore != "": + start, startLine, startColumn = l.pos, l.line, l.column + state = 0 + if start >= len(l.src) { + tok.Type = token.EOF + } + + } + } else { + if tok.Type == token.INVALID { + end = l.pos + } + } + } + if end > start { + l.pos = end + tok.Lit = l.src[start:end] + } else { + tok.Lit = []byte{} + } + tok.Pos.Offset, tok.Pos.Line, tok.Pos.Column = start, startLine, startColumn + + return +} + +func (l *Lexer) Reset() { + l.pos = 0 +} + +/* +Lexer symbols: +0: '_' +1: '_' +2: ' ' +3: '\t' +4: '\n' +5: '\r' +6: 'a'-'z' +7: 'A'-'Z' +8: '0'-'9' +9: . +*/ diff --git a/example/ctx/lexer/transitiontable.go b/example/ctx/lexer/transitiontable.go new file mode 100644 index 00000000..50dd04da --- /dev/null +++ b/example/ctx/lexer/transitiontable.go @@ -0,0 +1,109 @@ +// Code generated by gocc; DO NOT EDIT. + +package lexer + +/* +Let s be the current state +Let r be the current input rune +transitionTable[s](r) returns the next state. +*/ +type TransitionTable [NumStates]func(rune) int + +var TransTab = TransitionTable{ + // S0 + func(r rune) int { + switch { + case r == 9: // ['\t','\t'] + return 1 + case r == 10: // ['\n','\n'] + return 1 + case r == 13: // ['\r','\r'] + return 1 + case r == 32: // [' ',' '] + return 1 + case 65 <= r && r <= 90: // ['A','Z'] + return 2 + case r == 95: // ['_','_'] + return 3 + case 97 <= r && r <= 122: // ['a','z'] + return 2 + } + return NoState + }, + // S1 + func(r rune) int { + switch { + } + return NoState + }, + // S2 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 4 + case 65 <= r && r <= 90: // ['A','Z'] + return 5 + case r == 95: // ['_','_'] + return 6 + case 97 <= r && r <= 122: // ['a','z'] + return 5 + } + return NoState + }, + // S3 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 4 + case 65 <= r && r <= 90: // ['A','Z'] + return 5 + case r == 95: // ['_','_'] + return 6 + case 97 <= r && r <= 122: // ['a','z'] + return 5 + } + return NoState + }, + // S4 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 4 + case 65 <= r && r <= 90: // ['A','Z'] + return 5 + case r == 95: // ['_','_'] + return 6 + case 97 <= r && r <= 122: // ['a','z'] + return 5 + } + return NoState + }, + // S5 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 4 + case 65 <= r && r <= 90: // ['A','Z'] + return 5 + case r == 95: // ['_','_'] + return 6 + case 97 <= r && r <= 122: // ['a','z'] + return 5 + } + return NoState + }, + // S6 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 4 + case 65 <= r && r <= 90: // ['A','Z'] + return 5 + case r == 95: // ['_','_'] + return 6 + case 97 <= r && r <= 122: // ['a','z'] + return 5 + } + return NoState + }, +} diff --git a/example/ctx/parser/action.go b/example/ctx/parser/action.go new file mode 100644 index 00000000..54bc55e9 --- /dev/null +++ b/example/ctx/parser/action.go @@ -0,0 +1,51 @@ +// Code generated by gocc; DO NOT EDIT. + +package parser + +import ( + "fmt" +) + +type action interface { + act() + String() string +} + +type ( + accept bool + shift int // value is next state index + reduce int // value is production index +) + +func (this accept) act() {} +func (this shift) act() {} +func (this reduce) act() {} + +func (this accept) Equal(that action) bool { + if _, ok := that.(accept); ok { + return true + } + return false +} + +func (this reduce) Equal(that action) bool { + that1, ok := that.(reduce) + if !ok { + return false + } + return this == that1 +} + +func (this shift) Equal(that action) bool { + that1, ok := that.(shift) + if !ok { + return false + } + return this == that1 +} + +func (this accept) String() string { return "accept(0)" } +func (this shift) String() string { return fmt.Sprintf("shift:%d", this) } +func (this reduce) String() string { + return fmt.Sprintf("reduce:%d(%s)", this, productionsTable[this].String) +} diff --git a/example/ctx/parser/actiontable.go b/example/ctx/parser/actiontable.go new file mode 100644 index 00000000..5a87c2d9 --- /dev/null +++ b/example/ctx/parser/actiontable.go @@ -0,0 +1,54 @@ +// Code generated by gocc; DO NOT EDIT. + +package parser + +type ( + actionTable [numStates]actionRow + actionRow struct { + canRecover bool + actions [numSymbols]action + } +) + +var actionTab = actionTable{ + actionRow{ // S0 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + shift(3), // id + }, + }, + actionRow{ // S1 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + accept(true), // $ + shift(3), // id + }, + }, + actionRow{ // S2 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + reduce(1), // $, reduce: StmtList + reduce(1), // id, reduce: StmtList + }, + }, + actionRow{ // S3 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + reduce(3), // $, reduce: Stmt + reduce(3), // id, reduce: Stmt + }, + }, + actionRow{ // S4 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + reduce(2), // $, reduce: StmtList + reduce(2), // id, reduce: StmtList + }, + }, +} diff --git a/example/ctx/parser/gototable.go b/example/ctx/parser/gototable.go new file mode 100644 index 00000000..365a4be8 --- /dev/null +++ b/example/ctx/parser/gototable.go @@ -0,0 +1,38 @@ +// Code generated by gocc; DO NOT EDIT. + +package parser + +const numNTSymbols = 3 + +type ( + gotoTable [numStates]gotoRow + gotoRow [numNTSymbols]int +) + +var gotoTab = gotoTable{ + gotoRow{ // S0 + -1, // S' + 1, // StmtList + 2, // Stmt + }, + gotoRow{ // S1 + -1, // S' + -1, // StmtList + 4, // Stmt + }, + gotoRow{ // S2 + -1, // S' + -1, // StmtList + -1, // Stmt + }, + gotoRow{ // S3 + -1, // S' + -1, // StmtList + -1, // Stmt + }, + gotoRow{ // S4 + -1, // S' + -1, // StmtList + -1, // Stmt + }, +} diff --git a/example/ctx/parser/parser.go b/example/ctx/parser/parser.go new file mode 100644 index 00000000..589aa2c2 --- /dev/null +++ b/example/ctx/parser/parser.go @@ -0,0 +1,216 @@ +// Code generated by gocc; DO NOT EDIT. + +package parser + +import ( + "fmt" + "strings" + + parseError "github.com/maxcalandrelli/gocc/example/astx/errors" + "github.com/maxcalandrelli/gocc/example/astx/token" +) + +const ( + numProductions = 4 + numStates = 5 + numSymbols = 6 +) + +// Stack + +type stack struct { + state []int + attrib []Attrib +} + +const iNITIAL_STACK_SIZE = 100 + +func newStack() *stack { + return &stack{ + state: make([]int, 0, iNITIAL_STACK_SIZE), + attrib: make([]Attrib, 0, iNITIAL_STACK_SIZE), + } +} + +func (s *stack) reset() { + s.state = s.state[:0] + s.attrib = s.attrib[:0] +} + +func (s *stack) push(state int, a Attrib) { + s.state = append(s.state, state) + s.attrib = append(s.attrib, a) +} + +func (s *stack) top() int { + return s.state[len(s.state)-1] +} + +func (s *stack) peek(pos int) int { + return s.state[pos] +} + +func (s *stack) topIndex() int { + return len(s.state) - 1 +} + +func (s *stack) popN(items int) []Attrib { + lo, hi := len(s.state)-items, len(s.state) + + attrib := s.attrib[lo:hi] + + s.state = s.state[:lo] + s.attrib = s.attrib[:lo] + + return attrib +} + +func (s *stack) String() string { + w := new(strings.Builder) + fmt.Fprintf(w, "stack:\n") + for i, st := range s.state { + fmt.Fprintf(w, "\t%d: %d , ", i, st) + if s.attrib[i] == nil { + fmt.Fprintf(w, "nil") + } else { + switch attr := s.attrib[i].(type) { + case *token.Token: + fmt.Fprintf(w, "%s", attr.Lit) + default: + fmt.Fprintf(w, "%v", attr) + } + } + fmt.Fprintf(w, "\n") + } + return w.String() +} + +// Parser + +type Parser struct { + stack *stack + nextToken *token.Token + pos int +} + +type Scanner interface { + Scan() (tok *token.Token) +} + +func NewParser() *Parser { + p := &Parser{stack: newStack()} + p.Reset() + return p +} + +func (p *Parser) Reset() { + p.stack.reset() + p.stack.push(0, nil) +} + +func (p *Parser) Error(err error, scanner Scanner) (recovered bool, errorAttrib *parseError.Error) { + errorAttrib = &parseError.Error{ + Err: err, + ErrorToken: p.nextToken, + ErrorSymbols: p.popNonRecoveryStates(), + ExpectedTokens: make([]string, 0, 8), + } + for t, action := range actionTab[p.stack.top()].actions { + if action != nil { + errorAttrib.ExpectedTokens = append(errorAttrib.ExpectedTokens, token.TokMap.Id(token.Type(t))) + } + } + + if action := actionTab[p.stack.top()].actions[token.TokMap.Type("error")]; action != nil { + p.stack.push(int(action.(shift)), errorAttrib) // action can only be shift + } else { + return + } + + if action := actionTab[p.stack.top()].actions[p.nextToken.Type]; action != nil { + recovered = true + } + for !recovered && p.nextToken.Type != token.EOF { + p.nextToken = scanner.Scan() + if action := actionTab[p.stack.top()].actions[p.nextToken.Type]; action != nil { + recovered = true + } + } + + return +} + +func (p *Parser) popNonRecoveryStates() (removedAttribs []parseError.ErrorSymbol) { + if rs, ok := p.firstRecoveryState(); ok { + errorSymbols := p.stack.popN(p.stack.topIndex() - rs) + removedAttribs = make([]parseError.ErrorSymbol, len(errorSymbols)) + for i, e := range errorSymbols { + removedAttribs[i] = e + } + } else { + removedAttribs = []parseError.ErrorSymbol{} + } + return +} + +// recoveryState points to the highest state on the stack, which can recover +func (p *Parser) firstRecoveryState() (recoveryState int, canRecover bool) { + recoveryState, canRecover = p.stack.topIndex(), actionTab[p.stack.top()].canRecover + for recoveryState > 0 && !canRecover { + recoveryState-- + canRecover = actionTab[p.stack.peek(recoveryState)].canRecover + } + return +} + +func (p *Parser) newError(err error) error { + e := &parseError.Error{ + Err: err, + StackTop: p.stack.top(), + ErrorToken: p.nextToken, + } + actRow := actionTab[p.stack.top()] + for i, t := range actRow.actions { + if t != nil { + e.ExpectedTokens = append(e.ExpectedTokens, token.TokMap.Id(token.Type(i))) + } + } + return e +} + +func (p *Parser) Parse(scanner Scanner) (res interface{}, err error) { + p.Reset() + p.nextToken = scanner.Scan() + for acc := false; !acc; { + action := actionTab[p.stack.top()].actions[p.nextToken.Type] + if action == nil { + if recovered, errAttrib := p.Error(nil, scanner); !recovered { + p.nextToken = errAttrib.ErrorToken + return nil, p.newError(nil) + } + if action = actionTab[p.stack.top()].actions[p.nextToken.Type]; action == nil { + panic("Error recovery led to invalid action") + } + } + + switch act := action.(type) { + case accept: + res = p.stack.popN(1)[0] + acc = true + case shift: + p.stack.push(int(act), p.nextToken) + p.nextToken = scanner.Scan() + case reduce: + prod := productionsTable[int(act)] + attrib, err := prod.ReduceFunc(p.stack.popN(prod.NumSymbols)) + if err != nil { + return nil, p.newError(err) + } else { + p.stack.push(gotoTab[p.stack.top()][prod.NTType], attrib) + } + default: + panic("unknown action: " + action.String()) + } + } + return res, nil +} diff --git a/example/ctx/parser/productionstable.go b/example/ctx/parser/productionstable.go new file mode 100644 index 00000000..1b603b16 --- /dev/null +++ b/example/ctx/parser/productionstable.go @@ -0,0 +1,63 @@ +// Code generated by gocc; DO NOT EDIT. + +package parser + +import "github.com/maxcalandrelli/gocc/example/astx/ast" + +type ( + //TODO: change type and variable names to be consistent with other tables + ProdTab [numProductions]ProdTabEntry + ProdTabEntry struct { + String string + Id string + NTType int + Index int + NumSymbols int + ReduceFunc func([]Attrib) (Attrib, error) + } + Attrib interface { + } +) + +var productionsTable = ProdTab{ + ProdTabEntry{ + String: `S' : StmtList << >>`, + Id: "S'", + NTType: 0, + Index: 0, + NumSymbols: 1, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return X[0], nil + }, + }, + ProdTabEntry{ + String: `StmtList : Stmt << ast.NewStmtList(X[0]) >>`, + Id: "StmtList", + NTType: 1, + Index: 1, + NumSymbols: 1, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewStmtList(X[0]) + }, + }, + ProdTabEntry{ + String: `StmtList : StmtList Stmt << ast.AppendStmt(X[0], X[1]) >>`, + Id: "StmtList", + NTType: 1, + Index: 2, + NumSymbols: 2, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.AppendStmt(X[0], X[1]) + }, + }, + ProdTabEntry{ + String: `Stmt : id << ast.NewStmt(X[0]) >>`, + Id: "Stmt", + NTType: 2, + Index: 3, + NumSymbols: 1, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewStmt(X[0]) + }, + }, +} diff --git a/example/ctx/token/token.go b/example/ctx/token/token.go new file mode 100644 index 00000000..501b01ac --- /dev/null +++ b/example/ctx/token/token.go @@ -0,0 +1,72 @@ +// Code generated by gocc; DO NOT EDIT. + +package token + +import ( + "fmt" +) + +type Token struct { + Type + Lit []byte + Pos +} + +type Type int + +const ( + INVALID Type = iota + EOF +) + +type Pos struct { + Offset int + Line int + Column int +} + +func (p Pos) String() string { + return fmt.Sprintf("Pos(offset=%d, line=%d, column=%d)", p.Offset, p.Line, p.Column) +} + +type TokenMap struct { + typeMap []string + idMap map[string]Type +} + +func (m TokenMap) Id(tok Type) string { + if int(tok) < len(m.typeMap) { + return m.typeMap[tok] + } + return "unknown" +} + +func (m TokenMap) Type(tok string) Type { + if typ, exist := m.idMap[tok]; exist { + return typ + } + return INVALID +} + +func (m TokenMap) TokenString(tok *Token) string { + //TODO: refactor to print pos & token string properly + return fmt.Sprintf("%s(%d,%s)", m.Id(tok.Type), tok.Type, tok.Lit) +} + +func (m TokenMap) StringType(typ Type) string { + return fmt.Sprintf("%s(%d)", m.Id(typ), typ) +} + +var TokMap = TokenMap{ + typeMap: []string{ + "INVALID", + "$", + "id", + }, + + idMap: map[string]Type{ + "INVALID": 0, + "$": 1, + "id": 2, + }, +} diff --git a/example/ctx/util/litconv.go b/example/ctx/util/litconv.go new file mode 100644 index 00000000..1aeb6166 --- /dev/null +++ b/example/ctx/util/litconv.go @@ -0,0 +1,108 @@ +// Code generated by gocc; DO NOT EDIT. + +package util + +import ( + "fmt" + "strconv" + "unicode" + "unicode/utf8" +) + +/* Interface */ + +/* +Convert the literal value of a scanned token to rune +*/ +func RuneValue(lit []byte) rune { + if lit[1] == '\\' { + return escapeCharVal(lit) + } + r, size := utf8.DecodeRune(lit[1:]) + if size != len(lit)-2 { + panic(fmt.Sprintf("Error decoding rune. Lit: %s, rune: %d, size%d\n", lit, r, size)) + } + return r +} + +/* +Convert the literal value of a scanned token to int64 +*/ +func IntValue(lit []byte) (int64, error) { + return strconv.ParseInt(string(lit), 10, 64) +} + +/* +Convert the literal value of a scanned token to uint64 +*/ +func UintValue(lit []byte) (uint64, error) { + return strconv.ParseUint(string(lit), 10, 64) +} + +/* Util */ + +func escapeCharVal(lit []byte) rune { + var i, base, max uint32 + offset := 2 + switch lit[offset] { + case 'a': + return '\a' + case 'b': + return '\b' + case 'f': + return '\f' + case 'n': + return '\n' + case 'r': + return '\r' + case 't': + return '\t' + case 'v': + return '\v' + case '\\': + return '\\' + case '\'': + return '\'' + case '0', '1', '2', '3', '4', '5', '6', '7': + i, base, max = 3, 8, 255 + case 'x': + i, base, max = 2, 16, 255 + offset++ + case 'u': + i, base, max = 4, 16, unicode.MaxRune + offset++ + case 'U': + i, base, max = 8, 16, unicode.MaxRune + offset++ + default: + panic(fmt.Sprintf("Error decoding character literal: %s\n", lit)) + } + + var x uint32 + for ; i > 0 && offset < len(lit)-1; i-- { + ch, size := utf8.DecodeRune(lit[offset:]) + offset += size + d := uint32(digitVal(ch)) + if d >= base { + panic(fmt.Sprintf("charVal(%s): illegal character (%c) in escape sequence. size=%d, offset=%d", lit, ch, size, offset)) + } + x = x*base + d + } + if x > max || 0xD800 <= x && x < 0xE000 { + panic(fmt.Sprintf("Error decoding escape char value. Lit:%s, offset:%d, escape sequence is invalid Unicode code point\n", lit, offset)) + } + + return rune(x) +} + +func digitVal(ch rune) int { + switch { + case '0' <= ch && ch <= '9': + return int(ch) - '0' + case 'a' <= ch && ch <= 'f': + return int(ch) - 'a' + 10 + case 'A' <= ch && ch <= 'F': + return int(ch) - 'A' + 10 + } + return 16 // larger than any legal digit val +} diff --git a/example/ctx/util/rune.go b/example/ctx/util/rune.go new file mode 100644 index 00000000..bd8523a4 --- /dev/null +++ b/example/ctx/util/rune.go @@ -0,0 +1,39 @@ +// Code generated by gocc; DO NOT EDIT. + +package util + +import ( + "fmt" +) + +func RuneToString(r rune) string { + if r >= 0x20 && r < 0x7f { + return fmt.Sprintf("'%c'", r) + } + switch r { + case 0x07: + return "'\\a'" + case 0x08: + return "'\\b'" + case 0x0C: + return "'\\f'" + case 0x0A: + return "'\\n'" + case 0x0D: + return "'\\r'" + case 0x09: + return "'\\t'" + case 0x0b: + return "'\\v'" + case 0x5c: + return "'\\\\\\'" + case 0x27: + return "'\\''" + case 0x22: + return "'\\\"'" + } + if r < 0x10000 { + return fmt.Sprintf("\\u%04x", r) + } + return fmt.Sprintf("\\U%08x", r) +} diff --git a/example/errorrecovery/ast/ast.go b/example/errorrecovery/ast/ast.go index df23f297..d93fd66a 100644 --- a/example/errorrecovery/ast/ast.go +++ b/example/errorrecovery/ast/ast.go @@ -1,7 +1,7 @@ package ast import ( - "github.com/goccmack/gocc/example/errorrecovery/token" + "github.com/maxcalandrelli/gocc/example/errorrecovery/token" ) type ( diff --git a/example/errorrecovery/er.bnf b/example/errorrecovery/er.bnf index 47ec84b6..f3aea36c 100644 --- a/example/errorrecovery/er.bnf +++ b/example/errorrecovery/er.bnf @@ -12,7 +12,7 @@ id : (_letter | '_') {_idchar} ; /* Syntax elements */ -<< import "github.com/goccmack/gocc/example/errorrecovery/ast" >> +<< import "github.com/maxcalandrelli/gocc/example/errorrecovery/ast" >> StmtList : Stmt << ast.NewStmtList($0) >> diff --git a/example/errorrecovery/er_test.go b/example/errorrecovery/er_test.go index 8af87bb3..c0780374 100644 --- a/example/errorrecovery/er_test.go +++ b/example/errorrecovery/er_test.go @@ -4,10 +4,10 @@ import ( "fmt" "testing" - "github.com/goccmack/gocc/example/errorrecovery/ast" - "github.com/goccmack/gocc/example/errorrecovery/errors" - "github.com/goccmack/gocc/example/errorrecovery/lexer" - "github.com/goccmack/gocc/example/errorrecovery/parser" + "github.com/maxcalandrelli/gocc/example/errorrecovery/ast" + "github.com/maxcalandrelli/gocc/example/errorrecovery/errors" + "github.com/maxcalandrelli/gocc/example/errorrecovery/lexer" + "github.com/maxcalandrelli/gocc/example/errorrecovery/parser" ) func TestFail(t *testing.T) { diff --git a/example/errorrecovery/errors/errors.go b/example/errorrecovery/errors/errors.go old mode 100755 new mode 100644 index bd6f871a..080d53c1 --- a/example/errorrecovery/errors/errors.go +++ b/example/errorrecovery/errors/errors.go @@ -6,7 +6,7 @@ import ( "fmt" "strings" - "github.com/goccmack/gocc/example/errorrecovery/token" + "github.com/maxcalandrelli/gocc/example/errorrecovery/token" ) type ErrorSymbol interface { diff --git a/example/errorrecovery/lexer/acttab.go b/example/errorrecovery/lexer/acttab.go old mode 100755 new mode 100644 index 833036b1..b52bf53a --- a/example/errorrecovery/lexer/acttab.go +++ b/example/errorrecovery/lexer/acttab.go @@ -5,7 +5,7 @@ package lexer import ( "fmt" - "github.com/goccmack/gocc/example/errorrecovery/token" + "github.com/maxcalandrelli/gocc/example/errorrecovery/token" ) type ActionTable [NumStates]ActionRow diff --git a/example/errorrecovery/lexer/lexer.go b/example/errorrecovery/lexer/lexer.go old mode 100755 new mode 100644 index ea5244fb..9fcf2aa1 --- a/example/errorrecovery/lexer/lexer.go +++ b/example/errorrecovery/lexer/lexer.go @@ -6,7 +6,7 @@ import ( "io/ioutil" "unicode/utf8" - "github.com/goccmack/gocc/example/errorrecovery/token" + "github.com/maxcalandrelli/gocc/example/errorrecovery/token" ) const ( diff --git a/example/errorrecovery/lexer/transitiontable.go b/example/errorrecovery/lexer/transitiontable.go old mode 100755 new mode 100644 diff --git a/example/errorrecovery/parser/action.go b/example/errorrecovery/parser/action.go old mode 100755 new mode 100644 diff --git a/example/errorrecovery/parser/actiontable.go b/example/errorrecovery/parser/actiontable.go old mode 100755 new mode 100644 diff --git a/example/errorrecovery/parser/gototable.go b/example/errorrecovery/parser/gototable.go old mode 100755 new mode 100644 diff --git a/example/errorrecovery/parser/parser.go b/example/errorrecovery/parser/parser.go old mode 100755 new mode 100644 index 1b50bcb6..1fac0920 --- a/example/errorrecovery/parser/parser.go +++ b/example/errorrecovery/parser/parser.go @@ -6,8 +6,8 @@ import ( "fmt" "strings" - parseError "github.com/goccmack/gocc/example/errorrecovery/errors" - "github.com/goccmack/gocc/example/errorrecovery/token" + parseError "github.com/maxcalandrelli/gocc/example/errorrecovery/errors" + "github.com/maxcalandrelli/gocc/example/errorrecovery/token" ) const ( diff --git a/example/errorrecovery/parser/productionstable.go b/example/errorrecovery/parser/productionstable.go old mode 100755 new mode 100644 index e4b8ddb6..0c73061c --- a/example/errorrecovery/parser/productionstable.go +++ b/example/errorrecovery/parser/productionstable.go @@ -2,7 +2,7 @@ package parser -import "github.com/goccmack/gocc/example/errorrecovery/ast" +import "github.com/maxcalandrelli/gocc/example/errorrecovery/ast" type ( //TODO: change type and variable names to be consistent with other tables diff --git a/example/errorrecovery/parser/symbols.go b/example/errorrecovery/parser/symbols.go old mode 100755 new mode 100644 diff --git a/example/errorrecovery/token/token.go b/example/errorrecovery/token/token.go old mode 100755 new mode 100644 diff --git a/example/errorrecovery/util/litconv.go b/example/errorrecovery/util/litconv.go old mode 100755 new mode 100644 diff --git a/example/errorrecovery/util/rune.go b/example/errorrecovery/util/rune.go old mode 100755 new mode 100644 diff --git a/example/mail/lexer/acttab.go b/example/mail/lexer/acttab.go old mode 100755 new mode 100644 index 18794c88..86e27dc3 --- a/example/mail/lexer/acttab.go +++ b/example/mail/lexer/acttab.go @@ -5,7 +5,7 @@ package lexer import ( "fmt" - "github.com/goccmack/gocc/example/mail/token" + "github.com/maxcalandrelli/gocc/example/mail/token" ) type ActionTable [NumStates]ActionRow diff --git a/example/mail/lexer/lexer.go b/example/mail/lexer/lexer.go old mode 100755 new mode 100644 index c5109165..f07b285a --- a/example/mail/lexer/lexer.go +++ b/example/mail/lexer/lexer.go @@ -6,7 +6,7 @@ import ( "io/ioutil" "unicode/utf8" - "github.com/goccmack/gocc/example/mail/token" + "github.com/maxcalandrelli/gocc/example/mail/token" ) const ( diff --git a/example/mail/lexer/transitiontable.go b/example/mail/lexer/transitiontable.go old mode 100755 new mode 100644 diff --git a/example/mail/parser_test.go b/example/mail/parser_test.go index 581b7f6e..b6c53596 100644 --- a/example/mail/parser_test.go +++ b/example/mail/parser_test.go @@ -3,8 +3,8 @@ package mail import ( "testing" - "github.com/goccmack/gocc/example/mail/lexer" - "github.com/goccmack/gocc/example/mail/token" + "github.com/maxcalandrelli/gocc/example/mail/lexer" + "github.com/maxcalandrelli/gocc/example/mail/token" ) var testData1 = map[string]bool{ diff --git a/example/mail/token/token.go b/example/mail/token/token.go old mode 100755 new mode 100644 diff --git a/example/mail/util/litconv.go b/example/mail/util/litconv.go old mode 100755 new mode 100644 diff --git a/example/mail/util/rune.go b/example/mail/util/rune.go old mode 100755 new mode 100644 diff --git a/example/nolexer/errors/errors.go b/example/nolexer/errors/errors.go old mode 100755 new mode 100644 index f57f2f03..089c0156 --- a/example/nolexer/errors/errors.go +++ b/example/nolexer/errors/errors.go @@ -6,7 +6,7 @@ import ( "fmt" "strings" - "github.com/goccmack/gocc/example/nolexer/token" + "github.com/maxcalandrelli/gocc/example/nolexer/token" ) type ErrorSymbol interface { diff --git a/example/nolexer/nolexer.bnf b/example/nolexer/nolexer.bnf index bf5e1f08..a0117c08 100644 --- a/example/nolexer/nolexer.bnf +++ b/example/nolexer/nolexer.bnf @@ -2,7 +2,7 @@ import ( "fmt" - "github.com/goccmack/gocc/example/nolexer/token" + "github.com/maxcalandrelli/gocc/example/nolexer/token" ) >> diff --git a/example/nolexer/nolexer_test.go b/example/nolexer/nolexer_test.go index 1504ae14..4a2065a5 100644 --- a/example/nolexer/nolexer_test.go +++ b/example/nolexer/nolexer_test.go @@ -3,8 +3,8 @@ package nolexer import ( "testing" - "github.com/goccmack/gocc/example/nolexer/parser" - "github.com/goccmack/gocc/example/nolexer/scanner" + "github.com/maxcalandrelli/gocc/example/nolexer/parser" + "github.com/maxcalandrelli/gocc/example/nolexer/scanner" ) func Test1(t *testing.T) { diff --git a/example/nolexer/parser/action.go b/example/nolexer/parser/action.go old mode 100755 new mode 100644 diff --git a/example/nolexer/parser/actiontable.go b/example/nolexer/parser/actiontable.go old mode 100755 new mode 100644 diff --git a/example/nolexer/parser/gototable.go b/example/nolexer/parser/gototable.go old mode 100755 new mode 100644 diff --git a/example/nolexer/parser/parser.go b/example/nolexer/parser/parser.go old mode 100755 new mode 100644 index 3d8f0a76..e482fc7e --- a/example/nolexer/parser/parser.go +++ b/example/nolexer/parser/parser.go @@ -6,8 +6,8 @@ import ( "fmt" "strings" - parseError "github.com/goccmack/gocc/example/nolexer/errors" - "github.com/goccmack/gocc/example/nolexer/token" + parseError "github.com/maxcalandrelli/gocc/example/nolexer/errors" + "github.com/maxcalandrelli/gocc/example/nolexer/token" ) const ( diff --git a/example/nolexer/parser/productionstable.go b/example/nolexer/parser/productionstable.go old mode 100755 new mode 100644 index ea99a9ef..cdab8012 --- a/example/nolexer/parser/productionstable.go +++ b/example/nolexer/parser/productionstable.go @@ -5,7 +5,7 @@ package parser import ( "fmt" - "github.com/goccmack/gocc/example/nolexer/token" + "github.com/maxcalandrelli/gocc/example/nolexer/token" ) type ( diff --git a/example/nolexer/scanner/scanner.go b/example/nolexer/scanner/scanner.go index 2fe46fd8..5c2a90e8 100644 --- a/example/nolexer/scanner/scanner.go +++ b/example/nolexer/scanner/scanner.go @@ -1,7 +1,7 @@ package scanner import ( - "github.com/goccmack/gocc/example/nolexer/token" + "github.com/maxcalandrelli/gocc/example/nolexer/token" ) type Scanner struct { diff --git a/example/nolexer/token/token.go b/example/nolexer/token/token.go old mode 100755 new mode 100644 diff --git a/example/nolexer/util/litconv.go b/example/nolexer/util/litconv.go old mode 100755 new mode 100644 diff --git a/example/nolexer/util/rune.go b/example/nolexer/util/rune.go old mode 100755 new mode 100644 diff --git a/example/rr/errors/errors.go b/example/rr/errors/errors.go old mode 100755 new mode 100644 index 998d3b3f..3c4e6e52 --- a/example/rr/errors/errors.go +++ b/example/rr/errors/errors.go @@ -6,7 +6,7 @@ import ( "fmt" "strings" - "github.com/goccmack/gocc/example/rr/token" + "github.com/maxcalandrelli/gocc/example/rr/token" ) type ErrorSymbol interface { diff --git a/example/rr/lexer/acttab.go b/example/rr/lexer/acttab.go old mode 100755 new mode 100644 index c02f6b59..158ec859 --- a/example/rr/lexer/acttab.go +++ b/example/rr/lexer/acttab.go @@ -5,7 +5,7 @@ package lexer import ( "fmt" - "github.com/goccmack/gocc/example/rr/token" + "github.com/maxcalandrelli/gocc/example/rr/token" ) type ActionTable [NumStates]ActionRow diff --git a/example/rr/lexer/lexer.go b/example/rr/lexer/lexer.go old mode 100755 new mode 100644 index 68f06ea0..381c57f5 --- a/example/rr/lexer/lexer.go +++ b/example/rr/lexer/lexer.go @@ -6,7 +6,7 @@ import ( "io/ioutil" "unicode/utf8" - "github.com/goccmack/gocc/example/rr/token" + "github.com/maxcalandrelli/gocc/example/rr/token" ) const ( diff --git a/example/rr/lexer/transitiontable.go b/example/rr/lexer/transitiontable.go old mode 100755 new mode 100644 diff --git a/example/rr/parser/action.go b/example/rr/parser/action.go old mode 100755 new mode 100644 diff --git a/example/rr/parser/actiontable.go b/example/rr/parser/actiontable.go old mode 100755 new mode 100644 diff --git a/example/rr/parser/gototable.go b/example/rr/parser/gototable.go old mode 100755 new mode 100644 diff --git a/example/rr/parser/parser.go b/example/rr/parser/parser.go old mode 100755 new mode 100644 index bab4383a..b4cc2dc7 --- a/example/rr/parser/parser.go +++ b/example/rr/parser/parser.go @@ -6,8 +6,8 @@ import ( "fmt" "strings" - parseError "github.com/goccmack/gocc/example/rr/errors" - "github.com/goccmack/gocc/example/rr/token" + parseError "github.com/maxcalandrelli/gocc/example/rr/errors" + "github.com/maxcalandrelli/gocc/example/rr/token" ) const ( diff --git a/example/rr/parser/productionstable.go b/example/rr/parser/productionstable.go old mode 100755 new mode 100644 diff --git a/example/rr/rr_test.go b/example/rr/rr_test.go index ce6d7ab9..50a3cd0b 100644 --- a/example/rr/rr_test.go +++ b/example/rr/rr_test.go @@ -18,8 +18,8 @@ import ( "fmt" "testing" - "github.com/goccmack/gocc/example/rr/lexer" - "github.com/goccmack/gocc/example/rr/parser" + "github.com/maxcalandrelli/gocc/example/rr/lexer" + "github.com/maxcalandrelli/gocc/example/rr/parser" ) func parse(src string) (ast string, err error) { diff --git a/example/rr/token/token.go b/example/rr/token/token.go old mode 100755 new mode 100644 diff --git a/example/rr/util/litconv.go b/example/rr/util/litconv.go old mode 100755 new mode 100644 diff --git a/example/rr/util/rune.go b/example/rr/util/rune.go old mode 100755 new mode 100644 diff --git a/example/sr/ast/ast.go b/example/sr/ast/ast.go index b7472982..7344c3f2 100644 --- a/example/sr/ast/ast.go +++ b/example/sr/ast/ast.go @@ -1,7 +1,7 @@ package ast import ( - "github.com/goccmack/gocc/example/sr/token" + "github.com/maxcalandrelli/gocc/example/sr/token" ) type ( diff --git a/example/sr/errors/errors.go b/example/sr/errors/errors.go old mode 100755 new mode 100644 index 7567b55c..215ea08c --- a/example/sr/errors/errors.go +++ b/example/sr/errors/errors.go @@ -6,7 +6,7 @@ import ( "fmt" "strings" - "github.com/goccmack/gocc/example/sr/token" + "github.com/maxcalandrelli/gocc/example/sr/token" ) type ErrorSymbol interface { diff --git a/example/sr/lexer/acttab.go b/example/sr/lexer/acttab.go old mode 100755 new mode 100644 index 860bcbf1..fb4f352d --- a/example/sr/lexer/acttab.go +++ b/example/sr/lexer/acttab.go @@ -5,7 +5,7 @@ package lexer import ( "fmt" - "github.com/goccmack/gocc/example/sr/token" + "github.com/maxcalandrelli/gocc/example/sr/token" ) type ActionTable [NumStates]ActionRow diff --git a/example/sr/lexer/lexer.go b/example/sr/lexer/lexer.go old mode 100755 new mode 100644 index 65849251..569bf840 --- a/example/sr/lexer/lexer.go +++ b/example/sr/lexer/lexer.go @@ -6,7 +6,7 @@ import ( "io/ioutil" "unicode/utf8" - "github.com/goccmack/gocc/example/sr/token" + "github.com/maxcalandrelli/gocc/example/sr/token" ) const ( diff --git a/example/sr/lexer/transitiontable.go b/example/sr/lexer/transitiontable.go old mode 100755 new mode 100644 diff --git a/example/sr/parser/action.go b/example/sr/parser/action.go old mode 100755 new mode 100644 diff --git a/example/sr/parser/actiontable.go b/example/sr/parser/actiontable.go old mode 100755 new mode 100644 diff --git a/example/sr/parser/gototable.go b/example/sr/parser/gototable.go old mode 100755 new mode 100644 diff --git a/example/sr/parser/parser.go b/example/sr/parser/parser.go old mode 100755 new mode 100644 index 5bbc8063..3a90e7c9 --- a/example/sr/parser/parser.go +++ b/example/sr/parser/parser.go @@ -6,8 +6,8 @@ import ( "fmt" "strings" - parseError "github.com/goccmack/gocc/example/sr/errors" - "github.com/goccmack/gocc/example/sr/token" + parseError "github.com/maxcalandrelli/gocc/example/sr/errors" + "github.com/maxcalandrelli/gocc/example/sr/token" ) const ( diff --git a/example/sr/parser/productionstable.go b/example/sr/parser/productionstable.go old mode 100755 new mode 100644 index 602f53ec..0d89cbb6 --- a/example/sr/parser/productionstable.go +++ b/example/sr/parser/productionstable.go @@ -2,7 +2,7 @@ package parser -import "github.com/goccmack/gocc/example/sr/ast" +import "github.com/maxcalandrelli/gocc/example/sr/ast" type ( //TODO: change type and variable names to be consistent with other tables diff --git a/example/sr/sr.bnf b/example/sr/sr.bnf index 7228fc3b..ff9fbcef 100644 --- a/example/sr/sr.bnf +++ b/example/sr/sr.bnf @@ -26,7 +26,7 @@ id : (_letter | '_') {_idchar} ; /* Syntax elements */ -<< import "github.com/goccmack/gocc/example/sr/ast" >> +<< import "github.com/maxcalandrelli/gocc/example/sr/ast" >> Stmt : "if" id "then" Stmt << ast.NewIf($1, $3), nil >> diff --git a/example/sr/sr_test.go b/example/sr/sr_test.go index 461b8d12..19a88ea4 100644 --- a/example/sr/sr_test.go +++ b/example/sr/sr_test.go @@ -3,9 +3,9 @@ package sr import ( "testing" - "github.com/goccmack/gocc/example/sr/ast" - "github.com/goccmack/gocc/example/sr/lexer" - "github.com/goccmack/gocc/example/sr/parser" + "github.com/maxcalandrelli/gocc/example/sr/ast" + "github.com/maxcalandrelli/gocc/example/sr/lexer" + "github.com/maxcalandrelli/gocc/example/sr/parser" ) func parse(src string) (stmt ast.Stmt, err error) { diff --git a/example/sr/token/token.go b/example/sr/token/token.go old mode 100755 new mode 100644 diff --git a/example/sr/util/litconv.go b/example/sr/util/litconv.go old mode 100755 new mode 100644 diff --git a/example/sr/util/rune.go b/example/sr/util/rune.go old mode 100755 new mode 100644 diff --git a/internal/ast/fileheader.go b/internal/ast/fileheader.go index bde65038..5c3c97c5 100644 --- a/internal/ast/fileheader.go +++ b/internal/ast/fileheader.go @@ -17,7 +17,7 @@ package ast import ( "fmt" - "github.com/goccmack/gocc/internal/frontend/token" + "github.com/maxcalandrelli/gocc/internal/frontend/token" ) type FileHeader struct { @@ -27,7 +27,7 @@ type FileHeader struct { func NewFileHeader(sdtLit interface{}) (*FileHeader, error) { sh := &FileHeader{ - SDTLit: sdtLit.(*token.Token).SDTVal(), + SDTLit: SDTVal(sdtLit.(*token.Token)), } sh.str = fmt.Sprintf("<< %s >>", sh.SDTLit) return sh, nil diff --git a/internal/ast/lexcharlit.go b/internal/ast/lexcharlit.go index ba0c42f9..964e0b0a 100644 --- a/internal/ast/lexcharlit.go +++ b/internal/ast/lexcharlit.go @@ -15,27 +15,29 @@ package ast import ( - "github.com/goccmack/gocc/internal/frontend/token" - "github.com/goccmack/gocc/internal/util" + "github.com/maxcalandrelli/gocc/internal/frontend/token" + "github.com/maxcalandrelli/gocc/internal/util" ) type LexCharLit struct { - Val rune - Lit []byte - s string + Val rune + Lit []byte + s string + Negate bool } -func NewLexCharLit(tok interface{}) (*LexCharLit, error) { - return newLexCharLit(tok), nil +func NewLexCharLit(tok interface{}, negate bool) (*LexCharLit, error) { + return newLexCharLit(tok, negate), nil } -func newLexCharLit(tok interface{}) *LexCharLit { +func newLexCharLit(tok interface{}, negate bool) *LexCharLit { c := new(LexCharLit) t := tok.(*token.Token) c.Val = util.LitToRune(t.Lit) c.Lit = t.Lit c.s = util.RuneToString(c.Val) + c.Negate = negate return c } diff --git a/internal/ast/lexcharrange.go b/internal/ast/lexcharrange.go index ee736ec3..1707540d 100644 --- a/internal/ast/lexcharrange.go +++ b/internal/ast/lexcharrange.go @@ -19,17 +19,23 @@ import ( ) type LexCharRange struct { - From *LexCharLit - To *LexCharLit - s string + From *LexCharLit + To *LexCharLit + s string + Negate bool } -func NewLexCharRange(from, to interface{}) (*LexCharRange, error) { +func NewLexCharRange(from, to interface{}, negate bool) (*LexCharRange, error) { cr := &LexCharRange{ - From: newLexCharLit(from), - To: newLexCharLit(to), + From: newLexCharLit(from, negate), + To: newLexCharLit(to, negate), + Negate: negate, + } + if cr.From.Val > cr.To.Val { + t := cr.From + cr.From = cr.To + cr.To = t } - return cr, nil } diff --git a/internal/ast/lexignoredtokdef.go b/internal/ast/lexignoredtokdef.go index d667f3b2..b9c9919c 100644 --- a/internal/ast/lexignoredtokdef.go +++ b/internal/ast/lexignoredtokdef.go @@ -18,7 +18,7 @@ import ( "fmt" "strings" - "github.com/goccmack/gocc/internal/frontend/token" + "github.com/maxcalandrelli/gocc/internal/frontend/token" ) type LexIgnoredTokDef struct { diff --git a/internal/ast/leximport.go b/internal/ast/leximport.go index 055879ec..235cb2b4 100644 --- a/internal/ast/leximport.go +++ b/internal/ast/leximport.go @@ -17,7 +17,7 @@ package ast import ( "fmt" - "github.com/goccmack/gocc/internal/frontend/token" + "github.com/maxcalandrelli/gocc/internal/frontend/token" ) type LexImport struct { diff --git a/internal/ast/lexregdef.go b/internal/ast/lexregdef.go index 48855428..069496d5 100644 --- a/internal/ast/lexregdef.go +++ b/internal/ast/lexregdef.go @@ -18,7 +18,7 @@ import ( "fmt" "strings" - "github.com/goccmack/gocc/internal/frontend/token" + "github.com/maxcalandrelli/gocc/internal/frontend/token" ) type LexRegDef struct { diff --git a/internal/ast/lexregdefid.go b/internal/ast/lexregdefid.go index a3a518fa..e07b4b6b 100644 --- a/internal/ast/lexregdefid.go +++ b/internal/ast/lexregdefid.go @@ -15,7 +15,7 @@ package ast import ( - "github.com/goccmack/gocc/internal/frontend/token" + "github.com/maxcalandrelli/gocc/internal/frontend/token" ) type LexRegDefId struct { diff --git a/internal/ast/lextokdef.go b/internal/ast/lextokdef.go index 45a229d4..61f8f7c5 100644 --- a/internal/ast/lextokdef.go +++ b/internal/ast/lextokdef.go @@ -19,7 +19,7 @@ import ( "fmt" "strings" - "github.com/goccmack/gocc/internal/frontend/token" + "github.com/maxcalandrelli/gocc/internal/frontend/token" ) type LexTokDef struct { diff --git a/internal/ast/sdthlp.go b/internal/ast/sdthlp.go new file mode 100644 index 00000000..97fa6a69 --- /dev/null +++ b/internal/ast/sdthlp.go @@ -0,0 +1,42 @@ +// +// Syntax Directed Translation helper +// + +package ast + +import ( + "regexp" + "strings" + + "github.com/maxcalandrelli/gocc/internal/frontend/token" +) + +func SDTVal(T *token.Token) string { + sdt := string(T.Lit) + rex, err := regexp.Compile("\\$[0-9]+") + if err != nil { + panic(err) + } + idx := rex.FindAllStringIndex(sdt, -1) + res := "" + if len(idx) <= 0 { + res = sdt + } else { + for i, loc := range idx { + if loc[0] > 0 { + if i > 0 { + res += sdt[idx[i-1][1]:loc[0]] + } else { + res += sdt[0:loc[0]] + } + } + res += "X[" + res += sdt[loc[0]+1 : loc[1]] + res += "]" + } + if idx[len(idx)-1][1] < len(sdt) { + res += sdt[idx[len(idx)-1][1]:] + } + } + return strings.TrimSpace(res[2 : len(res)-2]) +} diff --git a/internal/ast/syntaxbody.go b/internal/ast/syntaxbody.go index 90609d1a..9aaa08c2 100644 --- a/internal/ast/syntaxbody.go +++ b/internal/ast/syntaxbody.go @@ -17,7 +17,7 @@ package ast import ( "fmt" - "github.com/goccmack/gocc/internal/frontend/token" + "github.com/maxcalandrelli/gocc/internal/frontend/token" ) type SyntaxBody struct { @@ -34,7 +34,7 @@ func NewSyntaxBody(symbols, sdtLit interface{}) (*SyntaxBody, error) { syntaxBody.Symbols = symbols.(SyntaxSymbols) } if sdtLit != nil { - syntaxBody.SDT = sdtLit.(*token.Token).SDTVal() + syntaxBody.SDT = SDTVal(sdtLit.(*token.Token)) } return syntaxBody, nil } diff --git a/internal/ast/syntaxprod.go b/internal/ast/syntaxprod.go index ed255225..ca377b6e 100644 --- a/internal/ast/syntaxprod.go +++ b/internal/ast/syntaxprod.go @@ -17,7 +17,7 @@ package ast import ( "fmt" - "github.com/goccmack/gocc/internal/frontend/token" + "github.com/maxcalandrelli/gocc/internal/frontend/token" ) type SyntaxProd struct { diff --git a/internal/ast/syntaxprodid.go b/internal/ast/syntaxprodid.go index 59b6980b..4b08d425 100644 --- a/internal/ast/syntaxprodid.go +++ b/internal/ast/syntaxprodid.go @@ -15,7 +15,7 @@ package ast import ( - "github.com/goccmack/gocc/internal/frontend/token" + "github.com/maxcalandrelli/gocc/internal/frontend/token" ) // Id or name of a grammar(syntax) production diff --git a/internal/ast/syntaxstringlit.go b/internal/ast/syntaxstringlit.go index fd2d1383..950e0322 100644 --- a/internal/ast/syntaxstringlit.go +++ b/internal/ast/syntaxstringlit.go @@ -17,7 +17,7 @@ package ast import ( "fmt" - "github.com/goccmack/gocc/internal/frontend/token" + "github.com/maxcalandrelli/gocc/internal/frontend/token" ) type SyntaxStringLit string diff --git a/internal/ast/syntaxtokid.go b/internal/ast/syntaxtokid.go index 4d6f75eb..80e89588 100644 --- a/internal/ast/syntaxtokid.go +++ b/internal/ast/syntaxtokid.go @@ -15,7 +15,7 @@ package ast import ( - "github.com/goccmack/gocc/internal/frontend/token" + "github.com/maxcalandrelli/gocc/internal/frontend/token" ) type SyntaxTokId string diff --git a/internal/frontend b/internal/frontend new file mode 120000 index 00000000..5158712d --- /dev/null +++ b/internal/frontend @@ -0,0 +1 @@ +frontend_ext \ No newline at end of file diff --git a/internal/frontend_ext/errors/errors.go b/internal/frontend_ext/errors/errors.go new file mode 100644 index 00000000..36fecb76 --- /dev/null +++ b/internal/frontend_ext/errors/errors.go @@ -0,0 +1,56 @@ +// Code generated by gocc; DO NOT EDIT. + +package errors + +import ( + "fmt" + "strings" + + "github.com/maxcalandrelli/gocc/internal/frontend/token" +) + +type ErrorSymbol interface { +} + +type Error struct { + Err error + ErrorToken *token.Token + ErrorSymbols []ErrorSymbol + ExpectedTokens []string + StackTop int +} + +func (e *Error) String() string { + w := new(strings.Builder) + fmt.Fprintf(w, "Error") + if e.Err != nil { + fmt.Fprintf(w, " %s\n", e.Err) + } else { + fmt.Fprintf(w, "\n") + } + fmt.Fprintf(w, "Token: type=%d, lit=%s\n", e.ErrorToken.Type, e.ErrorToken.Lit) + fmt.Fprintf(w, "Pos: offset=%d, line=%d, column=%d\n", e.ErrorToken.Pos.Offset, e.ErrorToken.Pos.Line, e.ErrorToken.Pos.Column) + fmt.Fprintf(w, "Expected one of: ") + for _, sym := range e.ExpectedTokens { + fmt.Fprintf(w, "%s ", sym) + } + fmt.Fprintf(w, "ErrorSymbol:\n") + for _, sym := range e.ErrorSymbols { + fmt.Fprintf(w, "%v\n", sym) + } + return w.String() +} + +func (e *Error) Error() string { + w := new(strings.Builder) + fmt.Fprintf(w, "Error in S%d: %s, %s", e.StackTop, token.TokMap.TokenString(e.ErrorToken), e.ErrorToken.Pos.String()) + if e.Err != nil { + fmt.Fprintf(w, ": %+v", e.Err) + } else { + fmt.Fprintf(w, ", expected one of: ") + for _, expected := range e.ExpectedTokens { + fmt.Fprintf(w, "%s ", expected) + } + } + return w.String() +} diff --git a/internal/frontend_ext/lexer/acttab.go b/internal/frontend_ext/lexer/acttab.go new file mode 100644 index 00000000..ad36db37 --- /dev/null +++ b/internal/frontend_ext/lexer/acttab.go @@ -0,0 +1,467 @@ +// Code generated by gocc; DO NOT EDIT. + +package lexer + +import ( + "fmt" + + "github.com/maxcalandrelli/gocc/internal/frontend/token" +) + +type ActionTable [NumStates]ActionRow + +type ActionRow struct { + Accept token.Type + Ignore string +} + +func (a ActionRow) String() string { + return fmt.Sprintf("Accept=%d, Ignore=%s", a.Accept, a.Ignore) +} + +var ActTab = ActionTable{ + ActionRow{ // S0 + Accept: 0, + Ignore: "", + }, + ActionRow{ // S1 + Accept: -1, + Ignore: "!whitespace", + }, + ActionRow{ // S2 + Accept: 0, + Ignore: "", + }, + ActionRow{ // S3 + Accept: 0, + Ignore: "", + }, + ActionRow{ // S4 + Accept: 0, + Ignore: "", + }, + ActionRow{ // S5 + Accept: 12, + Ignore: "", + }, + ActionRow{ // S6 + Accept: 13, + Ignore: "", + }, + ActionRow{ // S7 + Accept: 11, + Ignore: "", + }, + ActionRow{ // S8 + Accept: 8, + Ignore: "", + }, + ActionRow{ // S9 + Accept: 0, + Ignore: "", + }, + ActionRow{ // S10 + Accept: 3, + Ignore: "", + }, + ActionRow{ // S11 + Accept: 4, + Ignore: "", + }, + ActionRow{ // S12 + Accept: 0, + Ignore: "", + }, + ActionRow{ // S13 + Accept: 19, + Ignore: "", + }, + ActionRow{ // S14 + Accept: 14, + Ignore: "", + }, + ActionRow{ // S15 + Accept: 15, + Ignore: "", + }, + ActionRow{ // S16 + Accept: 5, + Ignore: "", + }, + ActionRow{ // S17 + Accept: 0, + Ignore: "", + }, + ActionRow{ // S18 + Accept: 2, + Ignore: "", + }, + ActionRow{ // S19 + Accept: 2, + Ignore: "", + }, + ActionRow{ // S20 + Accept: 16, + Ignore: "", + }, + ActionRow{ // S21 + Accept: 7, + Ignore: "", + }, + ActionRow{ // S22 + Accept: 17, + Ignore: "", + }, + ActionRow{ // S23 + Accept: 10, + Ignore: "", + }, + ActionRow{ // S24 + Accept: 6, + Ignore: "", + }, + ActionRow{ // S25 + Accept: 22, + Ignore: "", + }, + ActionRow{ // S26 + Accept: 0, + Ignore: "", + }, + ActionRow{ // S27 + Accept: 0, + Ignore: "", + }, + ActionRow{ // S28 + Accept: 0, + Ignore: "", + }, + ActionRow{ // S29 + Accept: 0, + Ignore: "", + }, + ActionRow{ // S30 + Accept: 0, + Ignore: "", + }, + ActionRow{ // S31 + Accept: 0, + Ignore: "", + }, + ActionRow{ // S32 + Accept: 0, + Ignore: "", + }, + ActionRow{ // S33 + Accept: 0, + Ignore: "", + }, + ActionRow{ // S34 + Accept: 19, + Ignore: "", + }, + ActionRow{ // S35 + Accept: 19, + Ignore: "", + }, + ActionRow{ // S36 + Accept: 19, + Ignore: "", + }, + ActionRow{ // S37 + Accept: 0, + Ignore: "", + }, + ActionRow{ // S38 + Accept: 5, + Ignore: "", + }, + ActionRow{ // S39 + Accept: 5, + Ignore: "", + }, + ActionRow{ // S40 + Accept: 5, + Ignore: "", + }, + ActionRow{ // S41 + Accept: 22, + Ignore: "", + }, + ActionRow{ // S42 + Accept: 0, + Ignore: "", + }, + ActionRow{ // S43 + Accept: 2, + Ignore: "", + }, + ActionRow{ // S44 + Accept: 2, + Ignore: "", + }, + ActionRow{ // S45 + Accept: 2, + Ignore: "", + }, + ActionRow{ // S46 + Accept: 2, + Ignore: "", + }, + ActionRow{ // S47 + Accept: 2, + Ignore: "", + }, + ActionRow{ // S48 + Accept: 0, + Ignore: "", + }, + ActionRow{ // S49 + Accept: 6, + Ignore: "", + }, + ActionRow{ // S50 + Accept: 6, + Ignore: "", + }, + ActionRow{ // S51 + Accept: 6, + Ignore: "", + }, + ActionRow{ // S52 + Accept: 0, + Ignore: "", + }, + ActionRow{ // S53 + Accept: 0, + Ignore: "", + }, + ActionRow{ // S54 + Accept: 0, + Ignore: "", + }, + ActionRow{ // S55 + Accept: 0, + Ignore: "", + }, + ActionRow{ // S56 + Accept: 0, + Ignore: "", + }, + ActionRow{ // S57 + Accept: 0, + Ignore: "", + }, + ActionRow{ // S58 + Accept: 0, + Ignore: "", + }, + ActionRow{ // S59 + Accept: 0, + Ignore: "", + }, + ActionRow{ // S60 + Accept: 0, + Ignore: "", + }, + ActionRow{ // S61 + Accept: 0, + Ignore: "", + }, + ActionRow{ // S62 + Accept: 9, + Ignore: "", + }, + ActionRow{ // S63 + Accept: 0, + Ignore: "", + }, + ActionRow{ // S64 + Accept: -1, + Ignore: "!comment", + }, + ActionRow{ // S65 + Accept: 0, + Ignore: "", + }, + ActionRow{ // S66 + Accept: 19, + Ignore: "", + }, + ActionRow{ // S67 + Accept: 5, + Ignore: "", + }, + ActionRow{ // S68 + Accept: 2, + Ignore: "", + }, + ActionRow{ // S69 + Accept: 2, + Ignore: "", + }, + ActionRow{ // S70 + Accept: 2, + Ignore: "", + }, + ActionRow{ // S71 + Accept: 6, + Ignore: "", + }, + ActionRow{ // S72 + Accept: 0, + Ignore: "", + }, + ActionRow{ // S73 + Accept: 0, + Ignore: "", + }, + ActionRow{ // S74 + Accept: 0, + Ignore: "", + }, + ActionRow{ // S75 + Accept: 0, + Ignore: "", + }, + ActionRow{ // S76 + Accept: 0, + Ignore: "", + }, + ActionRow{ // S77 + Accept: 0, + Ignore: "", + }, + ActionRow{ // S78 + Accept: 0, + Ignore: "", + }, + ActionRow{ // S79 + Accept: 0, + Ignore: "", + }, + ActionRow{ // S80 + Accept: -1, + Ignore: "!comment", + }, + ActionRow{ // S81 + Accept: 0, + Ignore: "", + }, + ActionRow{ // S82 + Accept: 2, + Ignore: "", + }, + ActionRow{ // S83 + Accept: 2, + Ignore: "", + }, + ActionRow{ // S84 + Accept: 0, + Ignore: "", + }, + ActionRow{ // S85 + Accept: 0, + Ignore: "", + }, + ActionRow{ // S86 + Accept: 0, + Ignore: "", + }, + ActionRow{ // S87 + Accept: 0, + Ignore: "", + }, + ActionRow{ // S88 + Accept: 0, + Ignore: "", + }, + ActionRow{ // S89 + Accept: 0, + Ignore: "", + }, + ActionRow{ // S90 + Accept: 0, + Ignore: "", + }, + ActionRow{ // S91 + Accept: 0, + Ignore: "", + }, + ActionRow{ // S92 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S93 + Accept: 21, + Ignore: "", + }, + ActionRow{ // S94 + Accept: 20, + Ignore: "", + }, + ActionRow{ // S95 + Accept: 0, + Ignore: "", + }, + ActionRow{ // S96 + Accept: 0, + Ignore: "", + }, + ActionRow{ // S97 + Accept: 0, + Ignore: "", + }, + ActionRow{ // S98 + Accept: 0, + Ignore: "", + }, + ActionRow{ // S99 + Accept: 0, + Ignore: "", + }, + ActionRow{ // S100 + Accept: 0, + Ignore: "", + }, + ActionRow{ // S101 + Accept: 0, + Ignore: "", + }, + ActionRow{ // S102 + Accept: 0, + Ignore: "", + }, + ActionRow{ // S103 + Accept: 0, + Ignore: "", + }, + ActionRow{ // S104 + Accept: 0, + Ignore: "", + }, + ActionRow{ // S105 + Accept: 0, + Ignore: "", + }, + ActionRow{ // S106 + Accept: 0, + Ignore: "", + }, + ActionRow{ // S107 + Accept: 0, + Ignore: "", + }, + ActionRow{ // S108 + Accept: 0, + Ignore: "", + }, + ActionRow{ // S109 + Accept: 0, + Ignore: "", + }, + ActionRow{ // S110 + Accept: 0, + Ignore: "", + }, +} diff --git a/internal/frontend_ext/lexer/lexer.go b/internal/frontend_ext/lexer/lexer.go new file mode 100644 index 00000000..785a899c --- /dev/null +++ b/internal/frontend_ext/lexer/lexer.go @@ -0,0 +1,221 @@ +// Code generated by gocc; DO NOT EDIT. + +package lexer + +import ( + "io/ioutil" + "unicode/utf8" + + "github.com/maxcalandrelli/gocc/internal/frontend/token" +) + +const ( + NoState = -1 + NumStates = 111 + NumSymbols = 78 +) + +type Position struct { + pos int + line int + column int +} + +type Lexer struct { + Position + src []byte +} + +func NewLexer(src []byte) *Lexer { + lexer := &Lexer{ src: src } + lexer.Position.Reset() + return lexer +} + +func NewLexerFile(fpath string) (*Lexer, error) { + src, err := ioutil.ReadFile(fpath) + if err != nil { + return nil, err + } + return NewLexer(src), nil +} + +func (l *Lexer) Scan() (tok *token.Token) { + tok = new(token.Token) + if l.pos >= len(l.src) { + tok.Type = token.EOF + tok.Pos.Offset, tok.Pos.Line, tok.Pos.Column = l.pos, l.line, l.column + return + } + start, startLine, startColumn, end := l.pos, l.line, l.column, 0 + tok.Type = token.INVALID + state, rune1, size := 0, rune(-1), 0 + for state != -1 { + if l.pos >= len(l.src) { + rune1 = -1 + } else { + rune1, size = utf8.DecodeRune(l.src[l.pos:]) + l.pos += size + } + + nextState := -1 + if rune1 != -1 { + nextState = TransTab[state](rune1) + } + state = nextState + + if state != -1 { + + switch rune1 { + case '\n': + l.line++ + l.column = 1 + case '\r': + l.column = 1 + case '\t': + l.column += 4 + default: + l.column++ + } + + switch { + case ActTab[state].Accept != -1: + tok.Type = ActTab[state].Accept + end = l.pos + case ActTab[state].Ignore != "": + start, startLine, startColumn = l.pos, l.line, l.column + state = 0 + if start >= len(l.src) { + tok.Type = token.EOF + } + + } + } else { + if tok.Type == token.INVALID { + end = l.pos + } + } + } + if end > start { + l.pos = end + tok.Lit = l.src[start:end] + } else { + tok.Lit = []byte{} + } + tok.Pos.Offset, tok.Pos.Line, tok.Pos.Column = start, startLine, startColumn + + return +} + +func (l *Lexer) Reset() { + l.Position.Reset() +} + +func (l *Lexer) Reposition(p Position) { + l.Position = p +} + +func (l Lexer) CurrentPosition() Position { + return l.Position +} + + +func (p Position) Offset() int { + return p.pos +} + +func (p Position) Line() int { + return p.line +} + +func (p Position) Column() int { + return p.column +} + +func (p *Position) Reset() { + p.pos = 0 + p.line = 1 + p.column = 1 +} + +/* +Lexer symbols: +0: '_' +1: '!' +2: ''' +3: ''' +4: '<' +5: '<' +6: '>' +7: '>' +8: ':' +9: ';' +10: '|' +11: '.' +12: '~' +13: '-' +14: '(' +15: ')' +16: '[' +17: ']' +18: '{' +19: '}' +20: 'e' +21: 'r' +22: 'r' +23: 'o' +24: 'r' +25: 'e' +26: 'm' +27: 'p' +28: 't' +29: 'y' +30: '/' +31: '/' +32: '\n' +33: '/' +34: '*' +35: '*' +36: '*' +37: '/' +38: '_' +39: '0' +40: '9' +41: '\' +42: 'u' +43: '\' +44: 'U' +45: '\' +46: 'a' +47: 'b' +48: 'f' +49: 'n' +50: 'r' +51: 't' +52: 'v' +53: '\' +54: ''' +55: '"' +56: '\' +57: '\' +58: 'x' +59: '`' +60: '`' +61: '"' +62: '"' +63: ' ' +64: '\t' +65: '\n' +66: '\r' +67: 'a'-'z' +68: 'A'-'Z' +69: '0'-'7' +70: '0'-'9' +71: 'A'-'F' +72: 'a'-'f' +73: '0'-'9' +74: 'A'-'F' +75: 'a'-'z' +76: 'g'-'z' +77: . +*/ diff --git a/internal/frontend_ext/lexer/transitiontable.go b/internal/frontend_ext/lexer/transitiontable.go new file mode 100644 index 00000000..6c25c7e6 --- /dev/null +++ b/internal/frontend_ext/lexer/transitiontable.go @@ -0,0 +1,1315 @@ +// Code generated by gocc; DO NOT EDIT. + +package lexer + +/* +Let s be the current state +Let r be the current input rune +transitionTable[s](r) returns the next state. +*/ +type TransitionTable [NumStates]func(rune) int + +var TransTab = TransitionTable{ + // S0 + func(r rune) int { + switch { + case r == 9: // ['\t','\t'] + return 1 + case r == 10: // ['\n','\n'] + return 1 + case r == 13: // ['\r','\r'] + return 1 + case r == 32: // [' ',' '] + return 1 + case r == 33: // ['!','!'] + return 2 + case r == 34: // ['"','"'] + return 3 + case r == 39: // [''','''] + return 4 + case r == 40: // ['(','('] + return 5 + case r == 41: // [')',')'] + return 6 + case r == 45: // ['-','-'] + return 7 + case r == 46: // ['.','.'] + return 8 + case r == 47: // ['/','/'] + return 9 + case r == 58: // [':',':'] + return 10 + case r == 59: // [';',';'] + return 11 + case r == 60: // ['<','<'] + return 12 + case 65 <= r && r <= 90: // ['A','Z'] + return 13 + case r == 91: // ['[','['] + return 14 + case r == 93: // [']',']'] + return 15 + case r == 95: // ['_','_'] + return 16 + case r == 96: // ['`','`'] + return 17 + case 97 <= r && r <= 100: // ['a','d'] + return 18 + case r == 101: // ['e','e'] + return 19 + case 102 <= r && r <= 122: // ['f','z'] + return 18 + case r == 123: // ['{','{'] + return 20 + case r == 124: // ['|','|'] + return 21 + case r == 125: // ['}','}'] + return 22 + case r == 126: // ['~','~'] + return 23 + } + return NoState + }, + // S1 + func(r rune) int { + switch { + } + return NoState + }, + // S2 + func(r rune) int { + switch { + case 97 <= r && r <= 122: // ['a','z'] + return 24 + } + return NoState + }, + // S3 + func(r rune) int { + switch { + case r == 34: // ['"','"'] + return 25 + case r == 92: // ['\','\'] + return 26 + default: + return 27 + } + }, + // S4 + func(r rune) int { + switch { + case r == 92: // ['\','\'] + return 28 + default: + return 29 + } + }, + // S5 + func(r rune) int { + switch { + } + return NoState + }, + // S6 + func(r rune) int { + switch { + } + return NoState + }, + // S7 + func(r rune) int { + switch { + } + return NoState + }, + // S8 + func(r rune) int { + switch { + } + return NoState + }, + // S9 + func(r rune) int { + switch { + case r == 42: // ['*','*'] + return 30 + case r == 47: // ['/','/'] + return 31 + } + return NoState + }, + // S10 + func(r rune) int { + switch { + } + return NoState + }, + // S11 + func(r rune) int { + switch { + } + return NoState + }, + // S12 + func(r rune) int { + switch { + case r == 60: // ['<','<'] + return 32 + } + return NoState + }, + // S13 + func(r rune) int { + switch { + case r == 48: // ['0','0'] + return 33 + case 65 <= r && r <= 90: // ['A','Z'] + return 34 + case r == 95: // ['_','_'] + return 35 + case 97 <= r && r <= 122: // ['a','z'] + return 36 + } + return NoState + }, + // S14 + func(r rune) int { + switch { + } + return NoState + }, + // S15 + func(r rune) int { + switch { + } + return NoState + }, + // S16 + func(r rune) int { + switch { + case r == 48: // ['0','0'] + return 37 + case 65 <= r && r <= 90: // ['A','Z'] + return 38 + case r == 95: // ['_','_'] + return 39 + case 97 <= r && r <= 122: // ['a','z'] + return 40 + } + return NoState + }, + // S17 + func(r rune) int { + switch { + case r == 96: // ['`','`'] + return 41 + default: + return 17 + } + }, + // S18 + func(r rune) int { + switch { + case r == 48: // ['0','0'] + return 42 + case 65 <= r && r <= 90: // ['A','Z'] + return 43 + case r == 95: // ['_','_'] + return 44 + case 97 <= r && r <= 122: // ['a','z'] + return 45 + } + return NoState + }, + // S19 + func(r rune) int { + switch { + case r == 48: // ['0','0'] + return 42 + case 65 <= r && r <= 90: // ['A','Z'] + return 43 + case r == 95: // ['_','_'] + return 44 + case 97 <= r && r <= 108: // ['a','l'] + return 45 + case r == 109: // ['m','m'] + return 46 + case 110 <= r && r <= 113: // ['n','q'] + return 45 + case r == 114: // ['r','r'] + return 47 + case 115 <= r && r <= 122: // ['s','z'] + return 45 + } + return NoState + }, + // S20 + func(r rune) int { + switch { + } + return NoState + }, + // S21 + func(r rune) int { + switch { + } + return NoState + }, + // S22 + func(r rune) int { + switch { + } + return NoState + }, + // S23 + func(r rune) int { + switch { + } + return NoState + }, + // S24 + func(r rune) int { + switch { + case r == 48: // ['0','0'] + return 48 + case 65 <= r && r <= 90: // ['A','Z'] + return 49 + case r == 95: // ['_','_'] + return 50 + case 97 <= r && r <= 122: // ['a','z'] + return 51 + } + return NoState + }, + // S25 + func(r rune) int { + switch { + } + return NoState + }, + // S26 + func(r rune) int { + switch { + case r == 34: // ['"','"'] + return 52 + case r == 39: // [''','''] + return 52 + case 48 <= r && r <= 55: // ['0','7'] + return 53 + case r == 85: // ['U','U'] + return 54 + case r == 92: // ['\','\'] + return 52 + case r == 97: // ['a','a'] + return 52 + case r == 98: // ['b','b'] + return 52 + case r == 102: // ['f','f'] + return 52 + case r == 110: // ['n','n'] + return 52 + case r == 114: // ['r','r'] + return 52 + case r == 116: // ['t','t'] + return 52 + case r == 117: // ['u','u'] + return 55 + case r == 118: // ['v','v'] + return 52 + case r == 120: // ['x','x'] + return 56 + } + return NoState + }, + // S27 + func(r rune) int { + switch { + case r == 34: // ['"','"'] + return 25 + case r == 92: // ['\','\'] + return 26 + default: + return 27 + } + }, + // S28 + func(r rune) int { + switch { + case r == 34: // ['"','"'] + return 57 + case r == 39: // [''','''] + return 57 + case 48 <= r && r <= 55: // ['0','7'] + return 58 + case r == 85: // ['U','U'] + return 59 + case r == 92: // ['\','\'] + return 57 + case r == 97: // ['a','a'] + return 57 + case r == 98: // ['b','b'] + return 57 + case r == 102: // ['f','f'] + return 57 + case r == 110: // ['n','n'] + return 57 + case r == 114: // ['r','r'] + return 57 + case r == 116: // ['t','t'] + return 57 + case r == 117: // ['u','u'] + return 60 + case r == 118: // ['v','v'] + return 57 + case r == 120: // ['x','x'] + return 61 + } + return NoState + }, + // S29 + func(r rune) int { + switch { + case r == 39: // [''','''] + return 62 + } + return NoState + }, + // S30 + func(r rune) int { + switch { + case r == 42: // ['*','*'] + return 63 + default: + return 30 + } + }, + // S31 + func(r rune) int { + switch { + case r == 10: // ['\n','\n'] + return 64 + default: + return 31 + } + }, + // S32 + func(r rune) int { + switch { + default: + return 65 + } + }, + // S33 + func(r rune) int { + switch { + case r == 57: // ['9','9'] + return 66 + } + return NoState + }, + // S34 + func(r rune) int { + switch { + case r == 48: // ['0','0'] + return 33 + case 65 <= r && r <= 90: // ['A','Z'] + return 34 + case r == 95: // ['_','_'] + return 35 + case 97 <= r && r <= 122: // ['a','z'] + return 36 + } + return NoState + }, + // S35 + func(r rune) int { + switch { + case r == 48: // ['0','0'] + return 33 + case 65 <= r && r <= 90: // ['A','Z'] + return 34 + case r == 95: // ['_','_'] + return 35 + case 97 <= r && r <= 122: // ['a','z'] + return 36 + } + return NoState + }, + // S36 + func(r rune) int { + switch { + case r == 48: // ['0','0'] + return 33 + case 65 <= r && r <= 90: // ['A','Z'] + return 34 + case r == 95: // ['_','_'] + return 35 + case 97 <= r && r <= 122: // ['a','z'] + return 36 + } + return NoState + }, + // S37 + func(r rune) int { + switch { + case r == 57: // ['9','9'] + return 67 + } + return NoState + }, + // S38 + func(r rune) int { + switch { + case r == 48: // ['0','0'] + return 37 + case 65 <= r && r <= 90: // ['A','Z'] + return 38 + case r == 95: // ['_','_'] + return 39 + case 97 <= r && r <= 122: // ['a','z'] + return 40 + } + return NoState + }, + // S39 + func(r rune) int { + switch { + case r == 48: // ['0','0'] + return 37 + case 65 <= r && r <= 90: // ['A','Z'] + return 38 + case r == 95: // ['_','_'] + return 39 + case 97 <= r && r <= 122: // ['a','z'] + return 40 + } + return NoState + }, + // S40 + func(r rune) int { + switch { + case r == 48: // ['0','0'] + return 37 + case 65 <= r && r <= 90: // ['A','Z'] + return 38 + case r == 95: // ['_','_'] + return 39 + case 97 <= r && r <= 122: // ['a','z'] + return 40 + } + return NoState + }, + // S41 + func(r rune) int { + switch { + } + return NoState + }, + // S42 + func(r rune) int { + switch { + case r == 57: // ['9','9'] + return 68 + } + return NoState + }, + // S43 + func(r rune) int { + switch { + case r == 48: // ['0','0'] + return 42 + case 65 <= r && r <= 90: // ['A','Z'] + return 43 + case r == 95: // ['_','_'] + return 44 + case 97 <= r && r <= 122: // ['a','z'] + return 45 + } + return NoState + }, + // S44 + func(r rune) int { + switch { + case r == 48: // ['0','0'] + return 42 + case 65 <= r && r <= 90: // ['A','Z'] + return 43 + case r == 95: // ['_','_'] + return 44 + case 97 <= r && r <= 122: // ['a','z'] + return 45 + } + return NoState + }, + // S45 + func(r rune) int { + switch { + case r == 48: // ['0','0'] + return 42 + case 65 <= r && r <= 90: // ['A','Z'] + return 43 + case r == 95: // ['_','_'] + return 44 + case 97 <= r && r <= 122: // ['a','z'] + return 45 + } + return NoState + }, + // S46 + func(r rune) int { + switch { + case r == 48: // ['0','0'] + return 42 + case 65 <= r && r <= 90: // ['A','Z'] + return 43 + case r == 95: // ['_','_'] + return 44 + case 97 <= r && r <= 111: // ['a','o'] + return 45 + case r == 112: // ['p','p'] + return 69 + case 113 <= r && r <= 122: // ['q','z'] + return 45 + } + return NoState + }, + // S47 + func(r rune) int { + switch { + case r == 48: // ['0','0'] + return 42 + case 65 <= r && r <= 90: // ['A','Z'] + return 43 + case r == 95: // ['_','_'] + return 44 + case 97 <= r && r <= 113: // ['a','q'] + return 45 + case r == 114: // ['r','r'] + return 70 + case 115 <= r && r <= 122: // ['s','z'] + return 45 + } + return NoState + }, + // S48 + func(r rune) int { + switch { + case r == 57: // ['9','9'] + return 71 + } + return NoState + }, + // S49 + func(r rune) int { + switch { + case r == 48: // ['0','0'] + return 48 + case 65 <= r && r <= 90: // ['A','Z'] + return 49 + case r == 95: // ['_','_'] + return 50 + case 97 <= r && r <= 122: // ['a','z'] + return 51 + } + return NoState + }, + // S50 + func(r rune) int { + switch { + case r == 48: // ['0','0'] + return 48 + case 65 <= r && r <= 90: // ['A','Z'] + return 49 + case r == 95: // ['_','_'] + return 50 + case 97 <= r && r <= 122: // ['a','z'] + return 51 + } + return NoState + }, + // S51 + func(r rune) int { + switch { + case r == 48: // ['0','0'] + return 48 + case 65 <= r && r <= 90: // ['A','Z'] + return 49 + case r == 95: // ['_','_'] + return 50 + case 97 <= r && r <= 122: // ['a','z'] + return 51 + } + return NoState + }, + // S52 + func(r rune) int { + switch { + case r == 34: // ['"','"'] + return 25 + case r == 92: // ['\','\'] + return 26 + default: + return 27 + } + }, + // S53 + func(r rune) int { + switch { + case 48 <= r && r <= 55: // ['0','7'] + return 72 + } + return NoState + }, + // S54 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 73 + case 65 <= r && r <= 70: // ['A','F'] + return 73 + case 97 <= r && r <= 102: // ['a','f'] + return 73 + } + return NoState + }, + // S55 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 74 + case 65 <= r && r <= 70: // ['A','F'] + return 74 + case 97 <= r && r <= 102: // ['a','f'] + return 74 + } + return NoState + }, + // S56 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 75 + case 65 <= r && r <= 70: // ['A','F'] + return 75 + case 97 <= r && r <= 102: // ['a','f'] + return 75 + } + return NoState + }, + // S57 + func(r rune) int { + switch { + case r == 39: // [''','''] + return 62 + } + return NoState + }, + // S58 + func(r rune) int { + switch { + case 48 <= r && r <= 55: // ['0','7'] + return 76 + } + return NoState + }, + // S59 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 77 + case 65 <= r && r <= 70: // ['A','F'] + return 77 + case 97 <= r && r <= 102: // ['a','f'] + return 77 + } + return NoState + }, + // S60 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 78 + case 65 <= r && r <= 70: // ['A','F'] + return 78 + case 97 <= r && r <= 102: // ['a','f'] + return 78 + } + return NoState + }, + // S61 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 79 + case 65 <= r && r <= 70: // ['A','F'] + return 79 + case 97 <= r && r <= 102: // ['a','f'] + return 79 + } + return NoState + }, + // S62 + func(r rune) int { + switch { + } + return NoState + }, + // S63 + func(r rune) int { + switch { + case r == 42: // ['*','*'] + return 63 + case r == 47: // ['/','/'] + return 80 + default: + return 30 + } + }, + // S64 + func(r rune) int { + switch { + } + return NoState + }, + // S65 + func(r rune) int { + switch { + case r == 62: // ['>','>'] + return 81 + default: + return 65 + } + }, + // S66 + func(r rune) int { + switch { + case r == 48: // ['0','0'] + return 33 + case 65 <= r && r <= 90: // ['A','Z'] + return 34 + case r == 95: // ['_','_'] + return 35 + case 97 <= r && r <= 122: // ['a','z'] + return 36 + } + return NoState + }, + // S67 + func(r rune) int { + switch { + case r == 48: // ['0','0'] + return 37 + case 65 <= r && r <= 90: // ['A','Z'] + return 38 + case r == 95: // ['_','_'] + return 39 + case 97 <= r && r <= 122: // ['a','z'] + return 40 + } + return NoState + }, + // S68 + func(r rune) int { + switch { + case r == 48: // ['0','0'] + return 42 + case 65 <= r && r <= 90: // ['A','Z'] + return 43 + case r == 95: // ['_','_'] + return 44 + case 97 <= r && r <= 122: // ['a','z'] + return 45 + } + return NoState + }, + // S69 + func(r rune) int { + switch { + case r == 48: // ['0','0'] + return 42 + case 65 <= r && r <= 90: // ['A','Z'] + return 43 + case r == 95: // ['_','_'] + return 44 + case 97 <= r && r <= 115: // ['a','s'] + return 45 + case r == 116: // ['t','t'] + return 82 + case 117 <= r && r <= 122: // ['u','z'] + return 45 + } + return NoState + }, + // S70 + func(r rune) int { + switch { + case r == 48: // ['0','0'] + return 42 + case 65 <= r && r <= 90: // ['A','Z'] + return 43 + case r == 95: // ['_','_'] + return 44 + case 97 <= r && r <= 110: // ['a','n'] + return 45 + case r == 111: // ['o','o'] + return 83 + case 112 <= r && r <= 122: // ['p','z'] + return 45 + } + return NoState + }, + // S71 + func(r rune) int { + switch { + case r == 48: // ['0','0'] + return 48 + case 65 <= r && r <= 90: // ['A','Z'] + return 49 + case r == 95: // ['_','_'] + return 50 + case 97 <= r && r <= 122: // ['a','z'] + return 51 + } + return NoState + }, + // S72 + func(r rune) int { + switch { + case 48 <= r && r <= 55: // ['0','7'] + return 84 + } + return NoState + }, + // S73 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 85 + case 65 <= r && r <= 70: // ['A','F'] + return 85 + case 97 <= r && r <= 102: // ['a','f'] + return 85 + } + return NoState + }, + // S74 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 86 + case 65 <= r && r <= 70: // ['A','F'] + return 86 + case 97 <= r && r <= 102: // ['a','f'] + return 86 + } + return NoState + }, + // S75 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 87 + case 65 <= r && r <= 70: // ['A','F'] + return 87 + case 97 <= r && r <= 102: // ['a','f'] + return 87 + } + return NoState + }, + // S76 + func(r rune) int { + switch { + case 48 <= r && r <= 55: // ['0','7'] + return 88 + } + return NoState + }, + // S77 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 89 + case 65 <= r && r <= 70: // ['A','F'] + return 89 + case 97 <= r && r <= 102: // ['a','f'] + return 89 + } + return NoState + }, + // S78 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 90 + case 65 <= r && r <= 70: // ['A','F'] + return 90 + case 97 <= r && r <= 102: // ['a','f'] + return 90 + } + return NoState + }, + // S79 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 91 + case 65 <= r && r <= 70: // ['A','F'] + return 91 + case 97 <= r && r <= 102: // ['a','f'] + return 91 + } + return NoState + }, + // S80 + func(r rune) int { + switch { + } + return NoState + }, + // S81 + func(r rune) int { + switch { + case r == 62: // ['>','>'] + return 92 + } + return NoState + }, + // S82 + func(r rune) int { + switch { + case r == 48: // ['0','0'] + return 42 + case 65 <= r && r <= 90: // ['A','Z'] + return 43 + case r == 95: // ['_','_'] + return 44 + case 97 <= r && r <= 120: // ['a','x'] + return 45 + case r == 121: // ['y','y'] + return 93 + case r == 122: // ['z','z'] + return 45 + } + return NoState + }, + // S83 + func(r rune) int { + switch { + case r == 48: // ['0','0'] + return 42 + case 65 <= r && r <= 90: // ['A','Z'] + return 43 + case r == 95: // ['_','_'] + return 44 + case 97 <= r && r <= 113: // ['a','q'] + return 45 + case r == 114: // ['r','r'] + return 94 + case 115 <= r && r <= 122: // ['s','z'] + return 45 + } + return NoState + }, + // S84 + func(r rune) int { + switch { + case r == 34: // ['"','"'] + return 25 + case r == 92: // ['\','\'] + return 26 + default: + return 27 + } + }, + // S85 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 95 + case 65 <= r && r <= 70: // ['A','F'] + return 95 + case 97 <= r && r <= 102: // ['a','f'] + return 95 + } + return NoState + }, + // S86 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 96 + case 65 <= r && r <= 70: // ['A','F'] + return 96 + case 97 <= r && r <= 102: // ['a','f'] + return 96 + } + return NoState + }, + // S87 + func(r rune) int { + switch { + case r == 34: // ['"','"'] + return 25 + case r == 92: // ['\','\'] + return 26 + default: + return 27 + } + }, + // S88 + func(r rune) int { + switch { + case r == 39: // [''','''] + return 62 + } + return NoState + }, + // S89 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 97 + case 65 <= r && r <= 70: // ['A','F'] + return 97 + case 97 <= r && r <= 102: // ['a','f'] + return 97 + } + return NoState + }, + // S90 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 98 + case 65 <= r && r <= 70: // ['A','F'] + return 98 + case 97 <= r && r <= 102: // ['a','f'] + return 98 + } + return NoState + }, + // S91 + func(r rune) int { + switch { + case r == 39: // [''','''] + return 62 + } + return NoState + }, + // S92 + func(r rune) int { + switch { + } + return NoState + }, + // S93 + func(r rune) int { + switch { + case r == 48: // ['0','0'] + return 42 + case 65 <= r && r <= 90: // ['A','Z'] + return 43 + case r == 95: // ['_','_'] + return 44 + case 97 <= r && r <= 122: // ['a','z'] + return 45 + } + return NoState + }, + // S94 + func(r rune) int { + switch { + case r == 48: // ['0','0'] + return 42 + case 65 <= r && r <= 90: // ['A','Z'] + return 43 + case r == 95: // ['_','_'] + return 44 + case 97 <= r && r <= 122: // ['a','z'] + return 45 + } + return NoState + }, + // S95 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 99 + case 65 <= r && r <= 70: // ['A','F'] + return 99 + case 97 <= r && r <= 102: // ['a','f'] + return 99 + } + return NoState + }, + // S96 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 100 + case 65 <= r && r <= 70: // ['A','F'] + return 100 + case 97 <= r && r <= 102: // ['a','f'] + return 100 + } + return NoState + }, + // S97 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 101 + case 65 <= r && r <= 70: // ['A','F'] + return 101 + case 97 <= r && r <= 102: // ['a','f'] + return 101 + } + return NoState + }, + // S98 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 102 + case 65 <= r && r <= 70: // ['A','F'] + return 102 + case 97 <= r && r <= 102: // ['a','f'] + return 102 + } + return NoState + }, + // S99 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 103 + case 65 <= r && r <= 70: // ['A','F'] + return 103 + case 97 <= r && r <= 102: // ['a','f'] + return 103 + } + return NoState + }, + // S100 + func(r rune) int { + switch { + case r == 34: // ['"','"'] + return 25 + case r == 92: // ['\','\'] + return 26 + default: + return 27 + } + }, + // S101 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 104 + case 65 <= r && r <= 70: // ['A','F'] + return 104 + case 97 <= r && r <= 102: // ['a','f'] + return 104 + } + return NoState + }, + // S102 + func(r rune) int { + switch { + case r == 39: // [''','''] + return 62 + } + return NoState + }, + // S103 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 105 + case 65 <= r && r <= 70: // ['A','F'] + return 105 + case 97 <= r && r <= 102: // ['a','f'] + return 105 + } + return NoState + }, + // S104 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 106 + case 65 <= r && r <= 70: // ['A','F'] + return 106 + case 97 <= r && r <= 102: // ['a','f'] + return 106 + } + return NoState + }, + // S105 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 107 + case 65 <= r && r <= 70: // ['A','F'] + return 107 + case 97 <= r && r <= 102: // ['a','f'] + return 107 + } + return NoState + }, + // S106 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 108 + case 65 <= r && r <= 70: // ['A','F'] + return 108 + case 97 <= r && r <= 102: // ['a','f'] + return 108 + } + return NoState + }, + // S107 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 109 + case 65 <= r && r <= 70: // ['A','F'] + return 109 + case 97 <= r && r <= 102: // ['a','f'] + return 109 + } + return NoState + }, + // S108 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 110 + case 65 <= r && r <= 70: // ['A','F'] + return 110 + case 97 <= r && r <= 102: // ['a','f'] + return 110 + } + return NoState + }, + // S109 + func(r rune) int { + switch { + case r == 34: // ['"','"'] + return 25 + case r == 92: // ['\','\'] + return 26 + default: + return 27 + } + }, + // S110 + func(r rune) int { + switch { + case r == 39: // [''','''] + return 62 + } + return NoState + }, +} diff --git a/internal/frontend_ext/parser/action.go b/internal/frontend_ext/parser/action.go new file mode 100644 index 00000000..54bc55e9 --- /dev/null +++ b/internal/frontend_ext/parser/action.go @@ -0,0 +1,51 @@ +// Code generated by gocc; DO NOT EDIT. + +package parser + +import ( + "fmt" +) + +type action interface { + act() + String() string +} + +type ( + accept bool + shift int // value is next state index + reduce int // value is production index +) + +func (this accept) act() {} +func (this shift) act() {} +func (this reduce) act() {} + +func (this accept) Equal(that action) bool { + if _, ok := that.(accept); ok { + return true + } + return false +} + +func (this reduce) Equal(that action) bool { + that1, ok := that.(reduce) + if !ok { + return false + } + return this == that1 +} + +func (this shift) Equal(that action) bool { + that1, ok := that.(shift) + if !ok { + return false + } + return this == that1 +} + +func (this accept) String() string { return "accept(0)" } +func (this shift) String() string { return fmt.Sprintf("shift:%d", this) } +func (this reduce) String() string { + return fmt.Sprintf("reduce:%d(%s)", this, productionsTable[this].String) +} diff --git a/internal/frontend_ext/parser/actiontable.go b/internal/frontend_ext/parser/actiontable.go new file mode 100644 index 00000000..47662403 --- /dev/null +++ b/internal/frontend_ext/parser/actiontable.go @@ -0,0 +1,4130 @@ +// Code generated by gocc; DO NOT EDIT. + +package parser + +type ( + actionTable [numStates]actionRow + actionRow struct { + canRecover bool + actions [numSymbols]action + } +) + +var actionTab = actionTable{ + actionRow{ // S0 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + shift(6), // tokId + nil, // : + nil, // ; + shift(7), // regDefId + shift(8), // ignoredTokId + nil, // | + nil, // . + nil, // char_lit + nil, // ~ + nil, // - + nil, // ( + nil, // ) + nil, // [ + nil, // ] + nil, // { + nil, // } + shift(11), // g_sdt_lit + shift(13), // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S1 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + accept(true), // $ + nil, // tokId + nil, // : + nil, // ; + nil, // regDefId + nil, // ignoredTokId + nil, // | + nil, // . + nil, // char_lit + nil, // ~ + nil, // - + nil, // ( + nil, // ) + nil, // [ + nil, // ] + nil, // { + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S2 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + reduce(2), // $, reduce: Grammar + nil, // tokId + nil, // : + nil, // ; + nil, // regDefId + nil, // ignoredTokId + nil, // | + nil, // . + nil, // char_lit + nil, // ~ + nil, // - + nil, // ( + nil, // ) + nil, // [ + nil, // ] + nil, // { + nil, // } + shift(11), // g_sdt_lit + shift(13), // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S3 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + reduce(3), // $, reduce: Grammar + nil, // tokId + nil, // : + nil, // ; + nil, // regDefId + nil, // ignoredTokId + nil, // | + nil, // . + nil, // char_lit + nil, // ~ + nil, // - + nil, // ( + nil, // ) + nil, // [ + nil, // ] + nil, // { + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S4 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + reduce(4), // $, reduce: LexicalPart + shift(6), // tokId + nil, // : + nil, // ; + shift(7), // regDefId + shift(8), // ignoredTokId + nil, // | + nil, // . + nil, // char_lit + nil, // ~ + nil, // - + nil, // ( + nil, // ) + nil, // [ + nil, // ] + nil, // { + nil, // } + reduce(4), // g_sdt_lit, reduce: LexicalPart + reduce(4), // prodId, reduce: LexicalPart + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S5 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + reduce(5), // $, reduce: LexProductions + reduce(5), // tokId, reduce: LexProductions + nil, // : + nil, // ; + reduce(5), // regDefId, reduce: LexProductions + reduce(5), // ignoredTokId, reduce: LexProductions + nil, // | + nil, // . + nil, // char_lit + nil, // ~ + nil, // - + nil, // ( + nil, // ) + nil, // [ + nil, // ] + nil, // { + nil, // } + reduce(5), // g_sdt_lit, reduce: LexProductions + reduce(5), // prodId, reduce: LexProductions + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S6 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + shift(16), // : + nil, // ; + nil, // regDefId + nil, // ignoredTokId + nil, // | + nil, // . + nil, // char_lit + nil, // ~ + nil, // - + nil, // ( + nil, // ) + nil, // [ + nil, // ] + nil, // { + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S7 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + shift(17), // : + nil, // ; + nil, // regDefId + nil, // ignoredTokId + nil, // | + nil, // . + nil, // char_lit + nil, // ~ + nil, // - + nil, // ( + nil, // ) + nil, // [ + nil, // ] + nil, // { + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S8 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + shift(18), // : + nil, // ; + nil, // regDefId + nil, // ignoredTokId + nil, // | + nil, // . + nil, // char_lit + nil, // ~ + nil, // - + nil, // ( + nil, // ) + nil, // [ + nil, // ] + nil, // { + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S9 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + nil, // regDefId + nil, // ignoredTokId + nil, // | + nil, // . + nil, // char_lit + nil, // ~ + nil, // - + nil, // ( + nil, // ) + nil, // [ + nil, // ] + nil, // { + nil, // } + nil, // g_sdt_lit + shift(13), // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S10 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + reduce(24), // $, reduce: SyntaxPart + nil, // tokId + nil, // : + nil, // ; + nil, // regDefId + nil, // ignoredTokId + nil, // | + nil, // . + nil, // char_lit + nil, // ~ + nil, // - + nil, // ( + nil, // ) + nil, // [ + nil, // ] + nil, // { + nil, // } + nil, // g_sdt_lit + shift(13), // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S11 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + nil, // regDefId + nil, // ignoredTokId + nil, // | + nil, // . + nil, // char_lit + nil, // ~ + nil, // - + nil, // ( + nil, // ) + nil, // [ + nil, // ] + nil, // { + nil, // } + nil, // g_sdt_lit + reduce(25), // prodId, reduce: FileHeader + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S12 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + reduce(26), // $, reduce: SyntaxProdList + nil, // tokId + nil, // : + nil, // ; + nil, // regDefId + nil, // ignoredTokId + nil, // | + nil, // . + nil, // char_lit + nil, // ~ + nil, // - + nil, // ( + nil, // ) + nil, // [ + nil, // ] + nil, // { + nil, // } + nil, // g_sdt_lit + reduce(26), // prodId, reduce: SyntaxProdList + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S13 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + shift(21), // : + nil, // ; + nil, // regDefId + nil, // ignoredTokId + nil, // | + nil, // . + nil, // char_lit + nil, // ~ + nil, // - + nil, // ( + nil, // ) + nil, // [ + nil, // ] + nil, // { + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S14 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + reduce(1), // $, reduce: Grammar + nil, // tokId + nil, // : + nil, // ; + nil, // regDefId + nil, // ignoredTokId + nil, // | + nil, // . + nil, // char_lit + nil, // ~ + nil, // - + nil, // ( + nil, // ) + nil, // [ + nil, // ] + nil, // { + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S15 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + reduce(6), // $, reduce: LexProductions + reduce(6), // tokId, reduce: LexProductions + nil, // : + nil, // ; + reduce(6), // regDefId, reduce: LexProductions + reduce(6), // ignoredTokId, reduce: LexProductions + nil, // | + nil, // . + nil, // char_lit + nil, // ~ + nil, // - + nil, // ( + nil, // ) + nil, // [ + nil, // ] + nil, // { + nil, // } + reduce(6), // g_sdt_lit, reduce: LexProductions + reduce(6), // prodId, reduce: LexProductions + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S16 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + shift(23), // regDefId + nil, // ignoredTokId + nil, // | + shift(26), // . + shift(27), // char_lit + shift(28), // ~ + nil, // - + shift(29), // ( + nil, // ) + shift(30), // [ + nil, // ] + shift(31), // { + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S17 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + shift(23), // regDefId + nil, // ignoredTokId + nil, // | + shift(26), // . + shift(27), // char_lit + shift(28), // ~ + nil, // - + shift(29), // ( + nil, // ) + shift(30), // [ + nil, // ] + shift(31), // { + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S18 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + shift(23), // regDefId + nil, // ignoredTokId + nil, // | + shift(26), // . + shift(27), // char_lit + shift(28), // ~ + nil, // - + shift(29), // ( + nil, // ) + shift(30), // [ + nil, // ] + shift(31), // { + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S19 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + reduce(23), // $, reduce: SyntaxPart + nil, // tokId + nil, // : + nil, // ; + nil, // regDefId + nil, // ignoredTokId + nil, // | + nil, // . + nil, // char_lit + nil, // ~ + nil, // - + nil, // ( + nil, // ) + nil, // [ + nil, // ] + nil, // { + nil, // } + nil, // g_sdt_lit + shift(13), // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S20 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + reduce(27), // $, reduce: SyntaxProdList + nil, // tokId + nil, // : + nil, // ; + nil, // regDefId + nil, // ignoredTokId + nil, // | + nil, // . + nil, // char_lit + nil, // ~ + nil, // - + nil, // ( + nil, // ) + nil, // [ + nil, // ] + nil, // { + nil, // } + nil, // g_sdt_lit + reduce(27), // prodId, reduce: SyntaxProdList + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S21 + canRecover: true, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + shift(34), // tokId + nil, // : + reduce(36), // ;, reduce: SyntaxBody + nil, // regDefId + nil, // ignoredTokId + reduce(36), // |, reduce: SyntaxBody + nil, // . + nil, // char_lit + nil, // ~ + nil, // - + nil, // ( + nil, // ) + nil, // [ + nil, // ] + nil, // { + nil, // } + nil, // g_sdt_lit + shift(35), // prodId + shift(39), // error + nil, // empty + shift(41), // string_lit + }, + }, + actionRow{ // S22 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + shift(42), // ; + nil, // regDefId + nil, // ignoredTokId + shift(43), // | + nil, // . + nil, // char_lit + nil, // ~ + nil, // - + nil, // ( + nil, // ) + nil, // [ + nil, // ] + nil, // { + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S23 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + reduce(19), // ;, reduce: LexTerm + reduce(19), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(19), // |, reduce: LexTerm + reduce(19), // ., reduce: LexTerm + reduce(19), // char_lit, reduce: LexTerm + reduce(19), // ~, reduce: LexTerm + nil, // - + reduce(19), // (, reduce: LexTerm + nil, // ) + reduce(19), // [, reduce: LexTerm + nil, // ] + reduce(19), // {, reduce: LexTerm + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S24 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + reduce(10), // ;, reduce: LexPattern + shift(23), // regDefId + nil, // ignoredTokId + reduce(10), // |, reduce: LexPattern + shift(26), // . + shift(27), // char_lit + shift(28), // ~ + nil, // - + shift(29), // ( + nil, // ) + shift(30), // [ + nil, // ] + shift(31), // { + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S25 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + reduce(12), // ;, reduce: LexAlt + reduce(12), // regDefId, reduce: LexAlt + nil, // ignoredTokId + reduce(12), // |, reduce: LexAlt + reduce(12), // ., reduce: LexAlt + reduce(12), // char_lit, reduce: LexAlt + reduce(12), // ~, reduce: LexAlt + nil, // - + reduce(12), // (, reduce: LexAlt + nil, // ) + reduce(12), // [, reduce: LexAlt + nil, // ] + reduce(12), // {, reduce: LexAlt + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S26 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + reduce(14), // ;, reduce: LexTerm + reduce(14), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(14), // |, reduce: LexTerm + reduce(14), // ., reduce: LexTerm + reduce(14), // char_lit, reduce: LexTerm + reduce(14), // ~, reduce: LexTerm + nil, // - + reduce(14), // (, reduce: LexTerm + nil, // ) + reduce(14), // [, reduce: LexTerm + nil, // ] + reduce(14), // {, reduce: LexTerm + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S27 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + reduce(15), // ;, reduce: LexTerm + reduce(15), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(15), // |, reduce: LexTerm + reduce(15), // ., reduce: LexTerm + reduce(15), // char_lit, reduce: LexTerm + reduce(15), // ~, reduce: LexTerm + shift(45), // - + reduce(15), // (, reduce: LexTerm + nil, // ) + reduce(15), // [, reduce: LexTerm + nil, // ] + reduce(15), // {, reduce: LexTerm + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S28 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + nil, // regDefId + nil, // ignoredTokId + nil, // | + nil, // . + shift(46), // char_lit + nil, // ~ + nil, // - + shift(47), // ( + nil, // ) + nil, // [ + nil, // ] + nil, // { + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S29 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + shift(49), // regDefId + nil, // ignoredTokId + nil, // | + shift(52), // . + shift(53), // char_lit + shift(54), // ~ + nil, // - + shift(55), // ( + nil, // ) + shift(56), // [ + nil, // ] + shift(57), // { + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S30 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + shift(59), // regDefId + nil, // ignoredTokId + nil, // | + shift(62), // . + shift(63), // char_lit + shift(64), // ~ + nil, // - + shift(65), // ( + nil, // ) + shift(66), // [ + nil, // ] + shift(67), // { + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S31 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + shift(69), // regDefId + nil, // ignoredTokId + nil, // | + shift(72), // . + shift(73), // char_lit + shift(74), // ~ + nil, // - + shift(75), // ( + nil, // ) + shift(76), // [ + nil, // ] + shift(77), // { + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S32 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + shift(78), // ; + nil, // regDefId + nil, // ignoredTokId + shift(43), // | + nil, // . + nil, // char_lit + nil, // ~ + nil, // - + nil, // ( + nil, // ) + nil, // [ + nil, // ] + nil, // { + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S33 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + shift(79), // ; + nil, // regDefId + nil, // ignoredTokId + shift(43), // | + nil, // . + nil, // char_lit + nil, // ~ + nil, // - + nil, // ( + nil, // ) + nil, // [ + nil, // ] + nil, // { + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S34 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + reduce(40), // tokId, reduce: Symbol + nil, // : + reduce(40), // ;, reduce: Symbol + nil, // regDefId + nil, // ignoredTokId + reduce(40), // |, reduce: Symbol + nil, // . + nil, // char_lit + nil, // ~ + nil, // - + nil, // ( + nil, // ) + nil, // [ + nil, // ] + nil, // { + nil, // } + reduce(40), // g_sdt_lit, reduce: Symbol + reduce(40), // prodId, reduce: Symbol + nil, // error + nil, // empty + reduce(40), // string_lit, reduce: Symbol + }, + }, + actionRow{ // S35 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + reduce(39), // tokId, reduce: Symbol + nil, // : + reduce(39), // ;, reduce: Symbol + nil, // regDefId + nil, // ignoredTokId + reduce(39), // |, reduce: Symbol + nil, // . + nil, // char_lit + nil, // ~ + nil, // - + nil, // ( + nil, // ) + nil, // [ + nil, // ] + nil, // { + nil, // } + reduce(39), // g_sdt_lit, reduce: Symbol + reduce(39), // prodId, reduce: Symbol + nil, // error + nil, // empty + reduce(39), // string_lit, reduce: Symbol + }, + }, + actionRow{ // S36 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + shift(80), // ; + nil, // regDefId + nil, // ignoredTokId + shift(81), // | + nil, // . + nil, // char_lit + nil, // ~ + nil, // - + nil, // ( + nil, // ) + nil, // [ + nil, // ] + nil, // { + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S37 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + reduce(29), // ;, reduce: Alternatives + nil, // regDefId + nil, // ignoredTokId + reduce(29), // |, reduce: Alternatives + nil, // . + nil, // char_lit + nil, // ~ + nil, // - + nil, // ( + nil, // ) + nil, // [ + nil, // ] + nil, // { + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S38 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + shift(34), // tokId + nil, // : + reduce(31), // ;, reduce: SyntaxBody + nil, // regDefId + nil, // ignoredTokId + reduce(31), // |, reduce: SyntaxBody + nil, // . + nil, // char_lit + nil, // ~ + nil, // - + nil, // ( + nil, // ) + nil, // [ + nil, // ] + nil, // { + nil, // } + shift(82), // g_sdt_lit + shift(35), // prodId + nil, // error + nil, // empty + shift(41), // string_lit + }, + }, + actionRow{ // S39 + canRecover: true, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + shift(34), // tokId + nil, // : + reduce(33), // ;, reduce: SyntaxBody + nil, // regDefId + nil, // ignoredTokId + reduce(33), // |, reduce: SyntaxBody + nil, // . + nil, // char_lit + nil, // ~ + nil, // - + nil, // ( + nil, // ) + nil, // [ + nil, // ] + nil, // { + nil, // } + nil, // g_sdt_lit + shift(35), // prodId + nil, // error + nil, // empty + shift(41), // string_lit + }, + }, + actionRow{ // S40 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + reduce(37), // tokId, reduce: Symbols + nil, // : + reduce(37), // ;, reduce: Symbols + nil, // regDefId + nil, // ignoredTokId + reduce(37), // |, reduce: Symbols + nil, // . + nil, // char_lit + nil, // ~ + nil, // - + nil, // ( + nil, // ) + nil, // [ + nil, // ] + nil, // { + nil, // } + reduce(37), // g_sdt_lit, reduce: Symbols + reduce(37), // prodId, reduce: Symbols + nil, // error + nil, // empty + reduce(37), // string_lit, reduce: Symbols + }, + }, + actionRow{ // S41 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + reduce(41), // tokId, reduce: Symbol + nil, // : + reduce(41), // ;, reduce: Symbol + nil, // regDefId + nil, // ignoredTokId + reduce(41), // |, reduce: Symbol + nil, // . + nil, // char_lit + nil, // ~ + nil, // - + nil, // ( + nil, // ) + nil, // [ + nil, // ] + nil, // { + nil, // } + reduce(41), // g_sdt_lit, reduce: Symbol + reduce(41), // prodId, reduce: Symbol + nil, // error + nil, // empty + reduce(41), // string_lit, reduce: Symbol + }, + }, + actionRow{ // S42 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + reduce(7), // $, reduce: LexProduction + reduce(7), // tokId, reduce: LexProduction + nil, // : + nil, // ; + reduce(7), // regDefId, reduce: LexProduction + reduce(7), // ignoredTokId, reduce: LexProduction + nil, // | + nil, // . + nil, // char_lit + nil, // ~ + nil, // - + nil, // ( + nil, // ) + nil, // [ + nil, // ] + nil, // { + nil, // } + reduce(7), // g_sdt_lit, reduce: LexProduction + reduce(7), // prodId, reduce: LexProduction + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S43 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + shift(23), // regDefId + nil, // ignoredTokId + nil, // | + shift(26), // . + shift(27), // char_lit + shift(28), // ~ + nil, // - + shift(29), // ( + nil, // ) + shift(30), // [ + nil, // ] + shift(31), // { + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S44 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + reduce(13), // ;, reduce: LexAlt + reduce(13), // regDefId, reduce: LexAlt + nil, // ignoredTokId + reduce(13), // |, reduce: LexAlt + reduce(13), // ., reduce: LexAlt + reduce(13), // char_lit, reduce: LexAlt + reduce(13), // ~, reduce: LexAlt + nil, // - + reduce(13), // (, reduce: LexAlt + nil, // ) + reduce(13), // [, reduce: LexAlt + nil, // ] + reduce(13), // {, reduce: LexAlt + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S45 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + nil, // regDefId + nil, // ignoredTokId + nil, // | + nil, // . + shift(86), // char_lit + nil, // ~ + nil, // - + nil, // ( + nil, // ) + nil, // [ + nil, // ] + nil, // { + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S46 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + reduce(16), // ;, reduce: LexTerm + reduce(16), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(16), // |, reduce: LexTerm + reduce(16), // ., reduce: LexTerm + reduce(16), // char_lit, reduce: LexTerm + reduce(16), // ~, reduce: LexTerm + nil, // - + reduce(16), // (, reduce: LexTerm + nil, // ) + reduce(16), // [, reduce: LexTerm + nil, // ] + reduce(16), // {, reduce: LexTerm + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S47 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + nil, // regDefId + nil, // ignoredTokId + nil, // | + nil, // . + shift(87), // char_lit + nil, // ~ + nil, // - + nil, // ( + nil, // ) + nil, // [ + nil, // ] + nil, // { + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S48 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + nil, // regDefId + nil, // ignoredTokId + shift(88), // | + nil, // . + nil, // char_lit + nil, // ~ + nil, // - + nil, // ( + shift(89), // ) + nil, // [ + nil, // ] + nil, // { + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S49 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + reduce(19), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(19), // |, reduce: LexTerm + reduce(19), // ., reduce: LexTerm + reduce(19), // char_lit, reduce: LexTerm + reduce(19), // ~, reduce: LexTerm + nil, // - + reduce(19), // (, reduce: LexTerm + reduce(19), // ), reduce: LexTerm + reduce(19), // [, reduce: LexTerm + nil, // ] + reduce(19), // {, reduce: LexTerm + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S50 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + shift(49), // regDefId + nil, // ignoredTokId + reduce(10), // |, reduce: LexPattern + shift(52), // . + shift(53), // char_lit + shift(54), // ~ + nil, // - + shift(55), // ( + reduce(10), // ), reduce: LexPattern + shift(56), // [ + nil, // ] + shift(57), // { + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S51 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + reduce(12), // regDefId, reduce: LexAlt + nil, // ignoredTokId + reduce(12), // |, reduce: LexAlt + reduce(12), // ., reduce: LexAlt + reduce(12), // char_lit, reduce: LexAlt + reduce(12), // ~, reduce: LexAlt + nil, // - + reduce(12), // (, reduce: LexAlt + reduce(12), // ), reduce: LexAlt + reduce(12), // [, reduce: LexAlt + nil, // ] + reduce(12), // {, reduce: LexAlt + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S52 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + reduce(14), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(14), // |, reduce: LexTerm + reduce(14), // ., reduce: LexTerm + reduce(14), // char_lit, reduce: LexTerm + reduce(14), // ~, reduce: LexTerm + nil, // - + reduce(14), // (, reduce: LexTerm + reduce(14), // ), reduce: LexTerm + reduce(14), // [, reduce: LexTerm + nil, // ] + reduce(14), // {, reduce: LexTerm + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S53 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + reduce(15), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(15), // |, reduce: LexTerm + reduce(15), // ., reduce: LexTerm + reduce(15), // char_lit, reduce: LexTerm + reduce(15), // ~, reduce: LexTerm + shift(91), // - + reduce(15), // (, reduce: LexTerm + reduce(15), // ), reduce: LexTerm + reduce(15), // [, reduce: LexTerm + nil, // ] + reduce(15), // {, reduce: LexTerm + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S54 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + nil, // regDefId + nil, // ignoredTokId + nil, // | + nil, // . + shift(92), // char_lit + nil, // ~ + nil, // - + shift(93), // ( + nil, // ) + nil, // [ + nil, // ] + nil, // { + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S55 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + shift(49), // regDefId + nil, // ignoredTokId + nil, // | + shift(52), // . + shift(53), // char_lit + shift(54), // ~ + nil, // - + shift(55), // ( + nil, // ) + shift(56), // [ + nil, // ] + shift(57), // { + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S56 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + shift(59), // regDefId + nil, // ignoredTokId + nil, // | + shift(62), // . + shift(63), // char_lit + shift(64), // ~ + nil, // - + shift(65), // ( + nil, // ) + shift(66), // [ + nil, // ] + shift(67), // { + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S57 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + shift(69), // regDefId + nil, // ignoredTokId + nil, // | + shift(72), // . + shift(73), // char_lit + shift(74), // ~ + nil, // - + shift(75), // ( + nil, // ) + shift(76), // [ + nil, // ] + shift(77), // { + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S58 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + nil, // regDefId + nil, // ignoredTokId + shift(97), // | + nil, // . + nil, // char_lit + nil, // ~ + nil, // - + nil, // ( + nil, // ) + nil, // [ + shift(98), // ] + nil, // { + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S59 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + reduce(19), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(19), // |, reduce: LexTerm + reduce(19), // ., reduce: LexTerm + reduce(19), // char_lit, reduce: LexTerm + reduce(19), // ~, reduce: LexTerm + nil, // - + reduce(19), // (, reduce: LexTerm + nil, // ) + reduce(19), // [, reduce: LexTerm + reduce(19), // ], reduce: LexTerm + reduce(19), // {, reduce: LexTerm + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S60 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + shift(59), // regDefId + nil, // ignoredTokId + reduce(10), // |, reduce: LexPattern + shift(62), // . + shift(63), // char_lit + shift(64), // ~ + nil, // - + shift(65), // ( + nil, // ) + shift(66), // [ + reduce(10), // ], reduce: LexPattern + shift(67), // { + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S61 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + reduce(12), // regDefId, reduce: LexAlt + nil, // ignoredTokId + reduce(12), // |, reduce: LexAlt + reduce(12), // ., reduce: LexAlt + reduce(12), // char_lit, reduce: LexAlt + reduce(12), // ~, reduce: LexAlt + nil, // - + reduce(12), // (, reduce: LexAlt + nil, // ) + reduce(12), // [, reduce: LexAlt + reduce(12), // ], reduce: LexAlt + reduce(12), // {, reduce: LexAlt + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S62 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + reduce(14), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(14), // |, reduce: LexTerm + reduce(14), // ., reduce: LexTerm + reduce(14), // char_lit, reduce: LexTerm + reduce(14), // ~, reduce: LexTerm + nil, // - + reduce(14), // (, reduce: LexTerm + nil, // ) + reduce(14), // [, reduce: LexTerm + reduce(14), // ], reduce: LexTerm + reduce(14), // {, reduce: LexTerm + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S63 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + reduce(15), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(15), // |, reduce: LexTerm + reduce(15), // ., reduce: LexTerm + reduce(15), // char_lit, reduce: LexTerm + reduce(15), // ~, reduce: LexTerm + shift(100), // - + reduce(15), // (, reduce: LexTerm + nil, // ) + reduce(15), // [, reduce: LexTerm + reduce(15), // ], reduce: LexTerm + reduce(15), // {, reduce: LexTerm + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S64 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + nil, // regDefId + nil, // ignoredTokId + nil, // | + nil, // . + shift(101), // char_lit + nil, // ~ + nil, // - + shift(102), // ( + nil, // ) + nil, // [ + nil, // ] + nil, // { + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S65 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + shift(49), // regDefId + nil, // ignoredTokId + nil, // | + shift(52), // . + shift(53), // char_lit + shift(54), // ~ + nil, // - + shift(55), // ( + nil, // ) + shift(56), // [ + nil, // ] + shift(57), // { + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S66 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + shift(59), // regDefId + nil, // ignoredTokId + nil, // | + shift(62), // . + shift(63), // char_lit + shift(64), // ~ + nil, // - + shift(65), // ( + nil, // ) + shift(66), // [ + nil, // ] + shift(67), // { + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S67 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + shift(69), // regDefId + nil, // ignoredTokId + nil, // | + shift(72), // . + shift(73), // char_lit + shift(74), // ~ + nil, // - + shift(75), // ( + nil, // ) + shift(76), // [ + nil, // ] + shift(77), // { + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S68 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + nil, // regDefId + nil, // ignoredTokId + shift(106), // | + nil, // . + nil, // char_lit + nil, // ~ + nil, // - + nil, // ( + nil, // ) + nil, // [ + nil, // ] + nil, // { + shift(107), // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S69 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + reduce(19), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(19), // |, reduce: LexTerm + reduce(19), // ., reduce: LexTerm + reduce(19), // char_lit, reduce: LexTerm + reduce(19), // ~, reduce: LexTerm + nil, // - + reduce(19), // (, reduce: LexTerm + nil, // ) + reduce(19), // [, reduce: LexTerm + nil, // ] + reduce(19), // {, reduce: LexTerm + reduce(19), // }, reduce: LexTerm + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S70 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + shift(69), // regDefId + nil, // ignoredTokId + reduce(10), // |, reduce: LexPattern + shift(72), // . + shift(73), // char_lit + shift(74), // ~ + nil, // - + shift(75), // ( + nil, // ) + shift(76), // [ + nil, // ] + shift(77), // { + reduce(10), // }, reduce: LexPattern + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S71 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + reduce(12), // regDefId, reduce: LexAlt + nil, // ignoredTokId + reduce(12), // |, reduce: LexAlt + reduce(12), // ., reduce: LexAlt + reduce(12), // char_lit, reduce: LexAlt + reduce(12), // ~, reduce: LexAlt + nil, // - + reduce(12), // (, reduce: LexAlt + nil, // ) + reduce(12), // [, reduce: LexAlt + nil, // ] + reduce(12), // {, reduce: LexAlt + reduce(12), // }, reduce: LexAlt + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S72 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + reduce(14), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(14), // |, reduce: LexTerm + reduce(14), // ., reduce: LexTerm + reduce(14), // char_lit, reduce: LexTerm + reduce(14), // ~, reduce: LexTerm + nil, // - + reduce(14), // (, reduce: LexTerm + nil, // ) + reduce(14), // [, reduce: LexTerm + nil, // ] + reduce(14), // {, reduce: LexTerm + reduce(14), // }, reduce: LexTerm + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S73 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + reduce(15), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(15), // |, reduce: LexTerm + reduce(15), // ., reduce: LexTerm + reduce(15), // char_lit, reduce: LexTerm + reduce(15), // ~, reduce: LexTerm + shift(109), // - + reduce(15), // (, reduce: LexTerm + nil, // ) + reduce(15), // [, reduce: LexTerm + nil, // ] + reduce(15), // {, reduce: LexTerm + reduce(15), // }, reduce: LexTerm + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S74 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + nil, // regDefId + nil, // ignoredTokId + nil, // | + nil, // . + shift(110), // char_lit + nil, // ~ + nil, // - + shift(111), // ( + nil, // ) + nil, // [ + nil, // ] + nil, // { + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S75 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + shift(49), // regDefId + nil, // ignoredTokId + nil, // | + shift(52), // . + shift(53), // char_lit + shift(54), // ~ + nil, // - + shift(55), // ( + nil, // ) + shift(56), // [ + nil, // ] + shift(57), // { + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S76 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + shift(59), // regDefId + nil, // ignoredTokId + nil, // | + shift(62), // . + shift(63), // char_lit + shift(64), // ~ + nil, // - + shift(65), // ( + nil, // ) + shift(66), // [ + nil, // ] + shift(67), // { + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S77 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + shift(69), // regDefId + nil, // ignoredTokId + nil, // | + shift(72), // . + shift(73), // char_lit + shift(74), // ~ + nil, // - + shift(75), // ( + nil, // ) + shift(76), // [ + nil, // ] + shift(77), // { + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S78 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + reduce(8), // $, reduce: LexProduction + reduce(8), // tokId, reduce: LexProduction + nil, // : + nil, // ; + reduce(8), // regDefId, reduce: LexProduction + reduce(8), // ignoredTokId, reduce: LexProduction + nil, // | + nil, // . + nil, // char_lit + nil, // ~ + nil, // - + nil, // ( + nil, // ) + nil, // [ + nil, // ] + nil, // { + nil, // } + reduce(8), // g_sdt_lit, reduce: LexProduction + reduce(8), // prodId, reduce: LexProduction + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S79 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + reduce(9), // $, reduce: LexProduction + reduce(9), // tokId, reduce: LexProduction + nil, // : + nil, // ; + reduce(9), // regDefId, reduce: LexProduction + reduce(9), // ignoredTokId, reduce: LexProduction + nil, // | + nil, // . + nil, // char_lit + nil, // ~ + nil, // - + nil, // ( + nil, // ) + nil, // [ + nil, // ] + nil, // { + nil, // } + reduce(9), // g_sdt_lit, reduce: LexProduction + reduce(9), // prodId, reduce: LexProduction + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S80 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + reduce(28), // $, reduce: SyntaxProduction + nil, // tokId + nil, // : + nil, // ; + nil, // regDefId + nil, // ignoredTokId + nil, // | + nil, // . + nil, // char_lit + nil, // ~ + nil, // - + nil, // ( + nil, // ) + nil, // [ + nil, // ] + nil, // { + nil, // } + nil, // g_sdt_lit + reduce(28), // prodId, reduce: SyntaxProduction + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S81 + canRecover: true, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + shift(34), // tokId + nil, // : + reduce(36), // ;, reduce: SyntaxBody + nil, // regDefId + nil, // ignoredTokId + reduce(36), // |, reduce: SyntaxBody + nil, // . + nil, // char_lit + nil, // ~ + nil, // - + nil, // ( + nil, // ) + nil, // [ + nil, // ] + nil, // { + nil, // } + nil, // g_sdt_lit + shift(35), // prodId + shift(39), // error + nil, // empty + shift(41), // string_lit + }, + }, + actionRow{ // S82 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + reduce(32), // ;, reduce: SyntaxBody + nil, // regDefId + nil, // ignoredTokId + reduce(32), // |, reduce: SyntaxBody + nil, // . + nil, // char_lit + nil, // ~ + nil, // - + nil, // ( + nil, // ) + nil, // [ + nil, // ] + nil, // { + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S83 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + reduce(38), // tokId, reduce: Symbols + nil, // : + reduce(38), // ;, reduce: Symbols + nil, // regDefId + nil, // ignoredTokId + reduce(38), // |, reduce: Symbols + nil, // . + nil, // char_lit + nil, // ~ + nil, // - + nil, // ( + nil, // ) + nil, // [ + nil, // ] + nil, // { + nil, // } + reduce(38), // g_sdt_lit, reduce: Symbols + reduce(38), // prodId, reduce: Symbols + nil, // error + nil, // empty + reduce(38), // string_lit, reduce: Symbols + }, + }, + actionRow{ // S84 + canRecover: true, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + shift(34), // tokId + nil, // : + reduce(34), // ;, reduce: SyntaxBody + nil, // regDefId + nil, // ignoredTokId + reduce(34), // |, reduce: SyntaxBody + nil, // . + nil, // char_lit + nil, // ~ + nil, // - + nil, // ( + nil, // ) + nil, // [ + nil, // ] + nil, // { + nil, // } + shift(116), // g_sdt_lit + shift(35), // prodId + nil, // error + nil, // empty + shift(41), // string_lit + }, + }, + actionRow{ // S85 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + reduce(11), // ;, reduce: LexPattern + shift(23), // regDefId + nil, // ignoredTokId + reduce(11), // |, reduce: LexPattern + shift(26), // . + shift(27), // char_lit + shift(28), // ~ + nil, // - + shift(29), // ( + nil, // ) + shift(30), // [ + nil, // ] + shift(31), // { + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S86 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + reduce(17), // ;, reduce: LexTerm + reduce(17), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(17), // |, reduce: LexTerm + reduce(17), // ., reduce: LexTerm + reduce(17), // char_lit, reduce: LexTerm + reduce(17), // ~, reduce: LexTerm + nil, // - + reduce(17), // (, reduce: LexTerm + nil, // ) + reduce(17), // [, reduce: LexTerm + nil, // ] + reduce(17), // {, reduce: LexTerm + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S87 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + nil, // regDefId + nil, // ignoredTokId + nil, // | + nil, // . + nil, // char_lit + nil, // ~ + shift(117), // - + nil, // ( + nil, // ) + nil, // [ + nil, // ] + nil, // { + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S88 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + shift(49), // regDefId + nil, // ignoredTokId + nil, // | + shift(52), // . + shift(53), // char_lit + shift(54), // ~ + nil, // - + shift(55), // ( + nil, // ) + shift(56), // [ + nil, // ] + shift(57), // { + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S89 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + reduce(22), // ;, reduce: LexTerm + reduce(22), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(22), // |, reduce: LexTerm + reduce(22), // ., reduce: LexTerm + reduce(22), // char_lit, reduce: LexTerm + reduce(22), // ~, reduce: LexTerm + nil, // - + reduce(22), // (, reduce: LexTerm + nil, // ) + reduce(22), // [, reduce: LexTerm + nil, // ] + reduce(22), // {, reduce: LexTerm + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S90 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + reduce(13), // regDefId, reduce: LexAlt + nil, // ignoredTokId + reduce(13), // |, reduce: LexAlt + reduce(13), // ., reduce: LexAlt + reduce(13), // char_lit, reduce: LexAlt + reduce(13), // ~, reduce: LexAlt + nil, // - + reduce(13), // (, reduce: LexAlt + reduce(13), // ), reduce: LexAlt + reduce(13), // [, reduce: LexAlt + nil, // ] + reduce(13), // {, reduce: LexAlt + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S91 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + nil, // regDefId + nil, // ignoredTokId + nil, // | + nil, // . + shift(119), // char_lit + nil, // ~ + nil, // - + nil, // ( + nil, // ) + nil, // [ + nil, // ] + nil, // { + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S92 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + reduce(16), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(16), // |, reduce: LexTerm + reduce(16), // ., reduce: LexTerm + reduce(16), // char_lit, reduce: LexTerm + reduce(16), // ~, reduce: LexTerm + nil, // - + reduce(16), // (, reduce: LexTerm + reduce(16), // ), reduce: LexTerm + reduce(16), // [, reduce: LexTerm + nil, // ] + reduce(16), // {, reduce: LexTerm + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S93 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + nil, // regDefId + nil, // ignoredTokId + nil, // | + nil, // . + shift(120), // char_lit + nil, // ~ + nil, // - + nil, // ( + nil, // ) + nil, // [ + nil, // ] + nil, // { + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S94 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + nil, // regDefId + nil, // ignoredTokId + shift(88), // | + nil, // . + nil, // char_lit + nil, // ~ + nil, // - + nil, // ( + shift(121), // ) + nil, // [ + nil, // ] + nil, // { + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S95 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + nil, // regDefId + nil, // ignoredTokId + shift(97), // | + nil, // . + nil, // char_lit + nil, // ~ + nil, // - + nil, // ( + nil, // ) + nil, // [ + shift(122), // ] + nil, // { + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S96 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + nil, // regDefId + nil, // ignoredTokId + shift(106), // | + nil, // . + nil, // char_lit + nil, // ~ + nil, // - + nil, // ( + nil, // ) + nil, // [ + nil, // ] + nil, // { + shift(123), // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S97 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + shift(59), // regDefId + nil, // ignoredTokId + nil, // | + shift(62), // . + shift(63), // char_lit + shift(64), // ~ + nil, // - + shift(65), // ( + nil, // ) + shift(66), // [ + nil, // ] + shift(67), // { + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S98 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + reduce(20), // ;, reduce: LexTerm + reduce(20), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(20), // |, reduce: LexTerm + reduce(20), // ., reduce: LexTerm + reduce(20), // char_lit, reduce: LexTerm + reduce(20), // ~, reduce: LexTerm + nil, // - + reduce(20), // (, reduce: LexTerm + nil, // ) + reduce(20), // [, reduce: LexTerm + nil, // ] + reduce(20), // {, reduce: LexTerm + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S99 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + reduce(13), // regDefId, reduce: LexAlt + nil, // ignoredTokId + reduce(13), // |, reduce: LexAlt + reduce(13), // ., reduce: LexAlt + reduce(13), // char_lit, reduce: LexAlt + reduce(13), // ~, reduce: LexAlt + nil, // - + reduce(13), // (, reduce: LexAlt + nil, // ) + reduce(13), // [, reduce: LexAlt + reduce(13), // ], reduce: LexAlt + reduce(13), // {, reduce: LexAlt + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S100 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + nil, // regDefId + nil, // ignoredTokId + nil, // | + nil, // . + shift(125), // char_lit + nil, // ~ + nil, // - + nil, // ( + nil, // ) + nil, // [ + nil, // ] + nil, // { + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S101 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + reduce(16), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(16), // |, reduce: LexTerm + reduce(16), // ., reduce: LexTerm + reduce(16), // char_lit, reduce: LexTerm + reduce(16), // ~, reduce: LexTerm + nil, // - + reduce(16), // (, reduce: LexTerm + nil, // ) + reduce(16), // [, reduce: LexTerm + reduce(16), // ], reduce: LexTerm + reduce(16), // {, reduce: LexTerm + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S102 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + nil, // regDefId + nil, // ignoredTokId + nil, // | + nil, // . + shift(126), // char_lit + nil, // ~ + nil, // - + nil, // ( + nil, // ) + nil, // [ + nil, // ] + nil, // { + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S103 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + nil, // regDefId + nil, // ignoredTokId + shift(88), // | + nil, // . + nil, // char_lit + nil, // ~ + nil, // - + nil, // ( + shift(127), // ) + nil, // [ + nil, // ] + nil, // { + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S104 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + nil, // regDefId + nil, // ignoredTokId + shift(97), // | + nil, // . + nil, // char_lit + nil, // ~ + nil, // - + nil, // ( + nil, // ) + nil, // [ + shift(128), // ] + nil, // { + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S105 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + nil, // regDefId + nil, // ignoredTokId + shift(106), // | + nil, // . + nil, // char_lit + nil, // ~ + nil, // - + nil, // ( + nil, // ) + nil, // [ + nil, // ] + nil, // { + shift(129), // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S106 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + shift(69), // regDefId + nil, // ignoredTokId + nil, // | + shift(72), // . + shift(73), // char_lit + shift(74), // ~ + nil, // - + shift(75), // ( + nil, // ) + shift(76), // [ + nil, // ] + shift(77), // { + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S107 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + reduce(21), // ;, reduce: LexTerm + reduce(21), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(21), // |, reduce: LexTerm + reduce(21), // ., reduce: LexTerm + reduce(21), // char_lit, reduce: LexTerm + reduce(21), // ~, reduce: LexTerm + nil, // - + reduce(21), // (, reduce: LexTerm + nil, // ) + reduce(21), // [, reduce: LexTerm + nil, // ] + reduce(21), // {, reduce: LexTerm + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S108 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + reduce(13), // regDefId, reduce: LexAlt + nil, // ignoredTokId + reduce(13), // |, reduce: LexAlt + reduce(13), // ., reduce: LexAlt + reduce(13), // char_lit, reduce: LexAlt + reduce(13), // ~, reduce: LexAlt + nil, // - + reduce(13), // (, reduce: LexAlt + nil, // ) + reduce(13), // [, reduce: LexAlt + nil, // ] + reduce(13), // {, reduce: LexAlt + reduce(13), // }, reduce: LexAlt + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S109 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + nil, // regDefId + nil, // ignoredTokId + nil, // | + nil, // . + shift(131), // char_lit + nil, // ~ + nil, // - + nil, // ( + nil, // ) + nil, // [ + nil, // ] + nil, // { + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S110 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + reduce(16), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(16), // |, reduce: LexTerm + reduce(16), // ., reduce: LexTerm + reduce(16), // char_lit, reduce: LexTerm + reduce(16), // ~, reduce: LexTerm + nil, // - + reduce(16), // (, reduce: LexTerm + nil, // ) + reduce(16), // [, reduce: LexTerm + nil, // ] + reduce(16), // {, reduce: LexTerm + reduce(16), // }, reduce: LexTerm + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S111 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + nil, // regDefId + nil, // ignoredTokId + nil, // | + nil, // . + shift(132), // char_lit + nil, // ~ + nil, // - + nil, // ( + nil, // ) + nil, // [ + nil, // ] + nil, // { + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S112 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + nil, // regDefId + nil, // ignoredTokId + shift(88), // | + nil, // . + nil, // char_lit + nil, // ~ + nil, // - + nil, // ( + shift(133), // ) + nil, // [ + nil, // ] + nil, // { + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S113 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + nil, // regDefId + nil, // ignoredTokId + shift(97), // | + nil, // . + nil, // char_lit + nil, // ~ + nil, // - + nil, // ( + nil, // ) + nil, // [ + shift(134), // ] + nil, // { + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S114 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + nil, // regDefId + nil, // ignoredTokId + shift(106), // | + nil, // . + nil, // char_lit + nil, // ~ + nil, // - + nil, // ( + nil, // ) + nil, // [ + nil, // ] + nil, // { + shift(135), // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S115 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + reduce(30), // ;, reduce: Alternatives + nil, // regDefId + nil, // ignoredTokId + reduce(30), // |, reduce: Alternatives + nil, // . + nil, // char_lit + nil, // ~ + nil, // - + nil, // ( + nil, // ) + nil, // [ + nil, // ] + nil, // { + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S116 + canRecover: true, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + reduce(35), // ;, reduce: SyntaxBody + nil, // regDefId + nil, // ignoredTokId + reduce(35), // |, reduce: SyntaxBody + nil, // . + nil, // char_lit + nil, // ~ + nil, // - + nil, // ( + nil, // ) + nil, // [ + nil, // ] + nil, // { + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S117 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + nil, // regDefId + nil, // ignoredTokId + nil, // | + nil, // . + shift(136), // char_lit + nil, // ~ + nil, // - + nil, // ( + nil, // ) + nil, // [ + nil, // ] + nil, // { + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S118 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + shift(49), // regDefId + nil, // ignoredTokId + reduce(11), // |, reduce: LexPattern + shift(52), // . + shift(53), // char_lit + shift(54), // ~ + nil, // - + shift(55), // ( + reduce(11), // ), reduce: LexPattern + shift(56), // [ + nil, // ] + shift(57), // { + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S119 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + reduce(17), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(17), // |, reduce: LexTerm + reduce(17), // ., reduce: LexTerm + reduce(17), // char_lit, reduce: LexTerm + reduce(17), // ~, reduce: LexTerm + nil, // - + reduce(17), // (, reduce: LexTerm + reduce(17), // ), reduce: LexTerm + reduce(17), // [, reduce: LexTerm + nil, // ] + reduce(17), // {, reduce: LexTerm + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S120 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + nil, // regDefId + nil, // ignoredTokId + nil, // | + nil, // . + nil, // char_lit + nil, // ~ + shift(137), // - + nil, // ( + nil, // ) + nil, // [ + nil, // ] + nil, // { + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S121 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + reduce(22), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(22), // |, reduce: LexTerm + reduce(22), // ., reduce: LexTerm + reduce(22), // char_lit, reduce: LexTerm + reduce(22), // ~, reduce: LexTerm + nil, // - + reduce(22), // (, reduce: LexTerm + reduce(22), // ), reduce: LexTerm + reduce(22), // [, reduce: LexTerm + nil, // ] + reduce(22), // {, reduce: LexTerm + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S122 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + reduce(20), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(20), // |, reduce: LexTerm + reduce(20), // ., reduce: LexTerm + reduce(20), // char_lit, reduce: LexTerm + reduce(20), // ~, reduce: LexTerm + nil, // - + reduce(20), // (, reduce: LexTerm + reduce(20), // ), reduce: LexTerm + reduce(20), // [, reduce: LexTerm + nil, // ] + reduce(20), // {, reduce: LexTerm + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S123 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + reduce(21), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(21), // |, reduce: LexTerm + reduce(21), // ., reduce: LexTerm + reduce(21), // char_lit, reduce: LexTerm + reduce(21), // ~, reduce: LexTerm + nil, // - + reduce(21), // (, reduce: LexTerm + reduce(21), // ), reduce: LexTerm + reduce(21), // [, reduce: LexTerm + nil, // ] + reduce(21), // {, reduce: LexTerm + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S124 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + shift(59), // regDefId + nil, // ignoredTokId + reduce(11), // |, reduce: LexPattern + shift(62), // . + shift(63), // char_lit + shift(64), // ~ + nil, // - + shift(65), // ( + nil, // ) + shift(66), // [ + reduce(11), // ], reduce: LexPattern + shift(67), // { + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S125 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + reduce(17), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(17), // |, reduce: LexTerm + reduce(17), // ., reduce: LexTerm + reduce(17), // char_lit, reduce: LexTerm + reduce(17), // ~, reduce: LexTerm + nil, // - + reduce(17), // (, reduce: LexTerm + nil, // ) + reduce(17), // [, reduce: LexTerm + reduce(17), // ], reduce: LexTerm + reduce(17), // {, reduce: LexTerm + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S126 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + nil, // regDefId + nil, // ignoredTokId + nil, // | + nil, // . + nil, // char_lit + nil, // ~ + shift(138), // - + nil, // ( + nil, // ) + nil, // [ + nil, // ] + nil, // { + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S127 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + reduce(22), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(22), // |, reduce: LexTerm + reduce(22), // ., reduce: LexTerm + reduce(22), // char_lit, reduce: LexTerm + reduce(22), // ~, reduce: LexTerm + nil, // - + reduce(22), // (, reduce: LexTerm + nil, // ) + reduce(22), // [, reduce: LexTerm + reduce(22), // ], reduce: LexTerm + reduce(22), // {, reduce: LexTerm + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S128 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + reduce(20), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(20), // |, reduce: LexTerm + reduce(20), // ., reduce: LexTerm + reduce(20), // char_lit, reduce: LexTerm + reduce(20), // ~, reduce: LexTerm + nil, // - + reduce(20), // (, reduce: LexTerm + nil, // ) + reduce(20), // [, reduce: LexTerm + reduce(20), // ], reduce: LexTerm + reduce(20), // {, reduce: LexTerm + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S129 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + reduce(21), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(21), // |, reduce: LexTerm + reduce(21), // ., reduce: LexTerm + reduce(21), // char_lit, reduce: LexTerm + reduce(21), // ~, reduce: LexTerm + nil, // - + reduce(21), // (, reduce: LexTerm + nil, // ) + reduce(21), // [, reduce: LexTerm + reduce(21), // ], reduce: LexTerm + reduce(21), // {, reduce: LexTerm + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S130 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + shift(69), // regDefId + nil, // ignoredTokId + reduce(11), // |, reduce: LexPattern + shift(72), // . + shift(73), // char_lit + shift(74), // ~ + nil, // - + shift(75), // ( + nil, // ) + shift(76), // [ + nil, // ] + shift(77), // { + reduce(11), // }, reduce: LexPattern + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S131 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + reduce(17), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(17), // |, reduce: LexTerm + reduce(17), // ., reduce: LexTerm + reduce(17), // char_lit, reduce: LexTerm + reduce(17), // ~, reduce: LexTerm + nil, // - + reduce(17), // (, reduce: LexTerm + nil, // ) + reduce(17), // [, reduce: LexTerm + nil, // ] + reduce(17), // {, reduce: LexTerm + reduce(17), // }, reduce: LexTerm + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S132 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + nil, // regDefId + nil, // ignoredTokId + nil, // | + nil, // . + nil, // char_lit + nil, // ~ + shift(139), // - + nil, // ( + nil, // ) + nil, // [ + nil, // ] + nil, // { + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S133 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + reduce(22), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(22), // |, reduce: LexTerm + reduce(22), // ., reduce: LexTerm + reduce(22), // char_lit, reduce: LexTerm + reduce(22), // ~, reduce: LexTerm + nil, // - + reduce(22), // (, reduce: LexTerm + nil, // ) + reduce(22), // [, reduce: LexTerm + nil, // ] + reduce(22), // {, reduce: LexTerm + reduce(22), // }, reduce: LexTerm + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S134 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + reduce(20), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(20), // |, reduce: LexTerm + reduce(20), // ., reduce: LexTerm + reduce(20), // char_lit, reduce: LexTerm + reduce(20), // ~, reduce: LexTerm + nil, // - + reduce(20), // (, reduce: LexTerm + nil, // ) + reduce(20), // [, reduce: LexTerm + nil, // ] + reduce(20), // {, reduce: LexTerm + reduce(20), // }, reduce: LexTerm + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S135 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + reduce(21), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(21), // |, reduce: LexTerm + reduce(21), // ., reduce: LexTerm + reduce(21), // char_lit, reduce: LexTerm + reduce(21), // ~, reduce: LexTerm + nil, // - + reduce(21), // (, reduce: LexTerm + nil, // ) + reduce(21), // [, reduce: LexTerm + nil, // ] + reduce(21), // {, reduce: LexTerm + reduce(21), // }, reduce: LexTerm + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S136 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + nil, // regDefId + nil, // ignoredTokId + nil, // | + nil, // . + nil, // char_lit + nil, // ~ + nil, // - + nil, // ( + shift(140), // ) + nil, // [ + nil, // ] + nil, // { + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S137 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + nil, // regDefId + nil, // ignoredTokId + nil, // | + nil, // . + shift(141), // char_lit + nil, // ~ + nil, // - + nil, // ( + nil, // ) + nil, // [ + nil, // ] + nil, // { + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S138 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + nil, // regDefId + nil, // ignoredTokId + nil, // | + nil, // . + shift(142), // char_lit + nil, // ~ + nil, // - + nil, // ( + nil, // ) + nil, // [ + nil, // ] + nil, // { + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S139 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + nil, // regDefId + nil, // ignoredTokId + nil, // | + nil, // . + shift(143), // char_lit + nil, // ~ + nil, // - + nil, // ( + nil, // ) + nil, // [ + nil, // ] + nil, // { + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S140 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + reduce(18), // ;, reduce: LexTerm + reduce(18), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(18), // |, reduce: LexTerm + reduce(18), // ., reduce: LexTerm + reduce(18), // char_lit, reduce: LexTerm + reduce(18), // ~, reduce: LexTerm + nil, // - + reduce(18), // (, reduce: LexTerm + nil, // ) + reduce(18), // [, reduce: LexTerm + nil, // ] + reduce(18), // {, reduce: LexTerm + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S141 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + nil, // regDefId + nil, // ignoredTokId + nil, // | + nil, // . + nil, // char_lit + nil, // ~ + nil, // - + nil, // ( + shift(144), // ) + nil, // [ + nil, // ] + nil, // { + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S142 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + nil, // regDefId + nil, // ignoredTokId + nil, // | + nil, // . + nil, // char_lit + nil, // ~ + nil, // - + nil, // ( + shift(145), // ) + nil, // [ + nil, // ] + nil, // { + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S143 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + nil, // regDefId + nil, // ignoredTokId + nil, // | + nil, // . + nil, // char_lit + nil, // ~ + nil, // - + nil, // ( + shift(146), // ) + nil, // [ + nil, // ] + nil, // { + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S144 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + reduce(18), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(18), // |, reduce: LexTerm + reduce(18), // ., reduce: LexTerm + reduce(18), // char_lit, reduce: LexTerm + reduce(18), // ~, reduce: LexTerm + nil, // - + reduce(18), // (, reduce: LexTerm + reduce(18), // ), reduce: LexTerm + reduce(18), // [, reduce: LexTerm + nil, // ] + reduce(18), // {, reduce: LexTerm + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S145 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + reduce(18), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(18), // |, reduce: LexTerm + reduce(18), // ., reduce: LexTerm + reduce(18), // char_lit, reduce: LexTerm + reduce(18), // ~, reduce: LexTerm + nil, // - + reduce(18), // (, reduce: LexTerm + nil, // ) + reduce(18), // [, reduce: LexTerm + reduce(18), // ], reduce: LexTerm + reduce(18), // {, reduce: LexTerm + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, + actionRow{ // S146 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + nil, // $ + nil, // tokId + nil, // : + nil, // ; + reduce(18), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(18), // |, reduce: LexTerm + reduce(18), // ., reduce: LexTerm + reduce(18), // char_lit, reduce: LexTerm + reduce(18), // ~, reduce: LexTerm + nil, // - + reduce(18), // (, reduce: LexTerm + nil, // ) + reduce(18), // [, reduce: LexTerm + nil, // ] + reduce(18), // {, reduce: LexTerm + reduce(18), // }, reduce: LexTerm + nil, // g_sdt_lit + nil, // prodId + nil, // error + nil, // empty + nil, // string_lit + }, + }, +} diff --git a/internal/frontend_ext/parser/gototable.go b/internal/frontend_ext/parser/gototable.go new file mode 100644 index 00000000..c6ab4087 --- /dev/null +++ b/internal/frontend_ext/parser/gototable.go @@ -0,0 +1,2659 @@ +// Code generated by gocc; DO NOT EDIT. + +package parser + +const numNTSymbols = 16 + +type ( + gotoTable [numStates]gotoRow + gotoRow [numNTSymbols]int +) + +var gotoTab = gotoTable{ + gotoRow{ // S0 + -1, // S' + 1, // Grammar + 2, // LexicalPart + 4, // LexProductions + 5, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + 3, // SyntaxPart + 9, // FileHeader + 10, // SyntaxProdList + 12, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S1 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S2 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + 14, // SyntaxPart + 9, // FileHeader + 10, // SyntaxProdList + 12, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S3 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S4 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + 15, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S5 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S6 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S7 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S8 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S9 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + 19, // SyntaxProdList + 12, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S10 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + 20, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S11 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S12 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S13 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S14 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S15 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S16 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + 22, // LexPattern + 24, // LexAlt + 25, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S17 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + 32, // LexPattern + 24, // LexAlt + 25, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S18 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + 33, // LexPattern + 24, // LexAlt + 25, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S19 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + 20, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S20 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S21 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + 36, // Alternatives + 37, // SyntaxBody + 38, // Symbols + 40, // Symbol + }, + gotoRow{ // S22 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S23 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S24 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + 44, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S25 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S26 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S27 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S28 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S29 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + 48, // LexPattern + 50, // LexAlt + 51, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S30 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + 58, // LexPattern + 60, // LexAlt + 61, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S31 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + 68, // LexPattern + 70, // LexAlt + 71, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S32 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S33 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S34 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S35 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S36 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S37 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S38 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + 83, // Symbol + }, + gotoRow{ // S39 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + 84, // Symbols + 40, // Symbol + }, + gotoRow{ // S40 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S41 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S42 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S43 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + 85, // LexAlt + 25, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S44 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S45 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S46 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S47 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S48 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S49 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S50 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + 90, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S51 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S52 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S53 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S54 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S55 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + 94, // LexPattern + 50, // LexAlt + 51, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S56 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + 95, // LexPattern + 60, // LexAlt + 61, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S57 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + 96, // LexPattern + 70, // LexAlt + 71, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S58 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S59 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S60 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + 99, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S61 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S62 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S63 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S64 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S65 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + 103, // LexPattern + 50, // LexAlt + 51, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S66 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + 104, // LexPattern + 60, // LexAlt + 61, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S67 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + 105, // LexPattern + 70, // LexAlt + 71, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S68 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S69 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S70 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + 108, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S71 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S72 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S73 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S74 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S75 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + 112, // LexPattern + 50, // LexAlt + 51, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S76 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + 113, // LexPattern + 60, // LexAlt + 61, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S77 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + 114, // LexPattern + 70, // LexAlt + 71, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S78 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S79 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S80 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S81 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + 115, // SyntaxBody + 38, // Symbols + 40, // Symbol + }, + gotoRow{ // S82 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S83 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S84 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + 83, // Symbol + }, + gotoRow{ // S85 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + 44, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S86 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S87 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S88 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + 118, // LexAlt + 51, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S89 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S90 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S91 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S92 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S93 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S94 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S95 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S96 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S97 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + 124, // LexAlt + 61, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S98 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S99 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S100 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S101 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S102 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S103 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S104 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S105 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S106 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + 130, // LexAlt + 71, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S107 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S108 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S109 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S110 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S111 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S112 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S113 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S114 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S115 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S116 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S117 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S118 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + 90, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S119 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S120 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S121 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S122 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S123 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S124 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + 99, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S125 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S126 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S127 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S128 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S129 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S130 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + 108, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S131 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S132 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S133 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S134 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S135 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S136 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S137 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S138 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S139 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S140 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S141 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S142 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S143 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S144 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S145 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, + gotoRow{ // S146 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + }, +} diff --git a/internal/frontend_ext/parser/parser.go b/internal/frontend_ext/parser/parser.go new file mode 100644 index 00000000..a810d488 --- /dev/null +++ b/internal/frontend_ext/parser/parser.go @@ -0,0 +1,216 @@ +// Code generated by gocc; DO NOT EDIT. + +package parser + +import ( + "fmt" + "strings" + + parseError "github.com/maxcalandrelli/gocc/internal/frontend/errors" + "github.com/maxcalandrelli/gocc/internal/frontend/token" +) + +const ( + numProductions = 42 + numStates = 147 + numSymbols = 39 +) + +// Stack + +type stack struct { + state []int + attrib []Attrib +} + +const iNITIAL_STACK_SIZE = 100 + +func newStack() *stack { + return &stack{ + state: make([]int, 0, iNITIAL_STACK_SIZE), + attrib: make([]Attrib, 0, iNITIAL_STACK_SIZE), + } +} + +func (s *stack) reset() { + s.state = s.state[:0] + s.attrib = s.attrib[:0] +} + +func (s *stack) push(state int, a Attrib) { + s.state = append(s.state, state) + s.attrib = append(s.attrib, a) +} + +func (s *stack) top() int { + return s.state[len(s.state)-1] +} + +func (s *stack) peek(pos int) int { + return s.state[pos] +} + +func (s *stack) topIndex() int { + return len(s.state) - 1 +} + +func (s *stack) popN(items int) []Attrib { + lo, hi := len(s.state)-items, len(s.state) + + attrib := s.attrib[lo:hi] + + s.state = s.state[:lo] + s.attrib = s.attrib[:lo] + + return attrib +} + +func (s *stack) String() string { + w := new(strings.Builder) + fmt.Fprintf(w, "stack:\n") + for i, st := range s.state { + fmt.Fprintf(w, "\t%d: %d , ", i, st) + if s.attrib[i] == nil { + fmt.Fprintf(w, "nil") + } else { + switch attr := s.attrib[i].(type) { + case *token.Token: + fmt.Fprintf(w, "%s", attr.Lit) + default: + fmt.Fprintf(w, "%v", attr) + } + } + fmt.Fprintf(w, "\n") + } + return w.String() +} + +// Parser + +type Parser struct { + stack *stack + nextToken *token.Token + pos int +} + +type Scanner interface { + Scan() (tok *token.Token) +} + +func NewParser() *Parser { + p := &Parser{stack: newStack()} + p.Reset() + return p +} + +func (p *Parser) Reset() { + p.stack.reset() + p.stack.push(0, nil) +} + +func (p *Parser) Error(err error, scanner Scanner) (recovered bool, errorAttrib *parseError.Error) { + errorAttrib = &parseError.Error{ + Err: err, + ErrorToken: p.nextToken, + ErrorSymbols: p.popNonRecoveryStates(), + ExpectedTokens: make([]string, 0, 8), + } + for t, action := range actionTab[p.stack.top()].actions { + if action != nil { + errorAttrib.ExpectedTokens = append(errorAttrib.ExpectedTokens, token.TokMap.Id(token.Type(t))) + } + } + + if action := actionTab[p.stack.top()].actions[token.TokMap.Type("error")]; action != nil { + p.stack.push(int(action.(shift)), errorAttrib) // action can only be shift + } else { + return + } + + if action := actionTab[p.stack.top()].actions[p.nextToken.Type]; action != nil { + recovered = true + } + for !recovered && p.nextToken.Type != token.EOF { + p.nextToken = scanner.Scan() + if action := actionTab[p.stack.top()].actions[p.nextToken.Type]; action != nil { + recovered = true + } + } + + return +} + +func (p *Parser) popNonRecoveryStates() (removedAttribs []parseError.ErrorSymbol) { + if rs, ok := p.firstRecoveryState(); ok { + errorSymbols := p.stack.popN(p.stack.topIndex() - rs) + removedAttribs = make([]parseError.ErrorSymbol, len(errorSymbols)) + for i, e := range errorSymbols { + removedAttribs[i] = e + } + } else { + removedAttribs = []parseError.ErrorSymbol{} + } + return +} + +// recoveryState points to the highest state on the stack, which can recover +func (p *Parser) firstRecoveryState() (recoveryState int, canRecover bool) { + recoveryState, canRecover = p.stack.topIndex(), actionTab[p.stack.top()].canRecover + for recoveryState > 0 && !canRecover { + recoveryState-- + canRecover = actionTab[p.stack.peek(recoveryState)].canRecover + } + return +} + +func (p *Parser) newError(err error) error { + e := &parseError.Error{ + Err: err, + StackTop: p.stack.top(), + ErrorToken: p.nextToken, + } + actRow := actionTab[p.stack.top()] + for i, t := range actRow.actions { + if t != nil { + e.ExpectedTokens = append(e.ExpectedTokens, token.TokMap.Id(token.Type(i))) + } + } + return e +} + +func (p *Parser) Parse(scanner Scanner) (res interface{}, err error) { + p.Reset() + p.nextToken = scanner.Scan() + for acc := false; !acc; { + action := actionTab[p.stack.top()].actions[p.nextToken.Type] + if action == nil { + if recovered, errAttrib := p.Error(nil, scanner); !recovered { + p.nextToken = errAttrib.ErrorToken + return nil, p.newError(nil) + } + if action = actionTab[p.stack.top()].actions[p.nextToken.Type]; action == nil { + panic("Error recovery led to invalid action") + } + } + + switch act := action.(type) { + case accept: + res = p.stack.popN(1)[0] + acc = true + case shift: + p.stack.push(int(act), p.nextToken) + p.nextToken = scanner.Scan() + case reduce: + prod := productionsTable[int(act)] + attrib, err := prod.ReduceFunc(p.stack.popN(prod.NumSymbols)) + if err != nil { + return nil, p.newError(err) + } else { + p.stack.push(gotoTab[p.stack.top()][prod.NTType], attrib) + } + default: + panic("unknown action: " + action.String()) + } + } + return res, nil +} diff --git a/internal/frontend_ext/parser/productionstable.go b/internal/frontend_ext/parser/productionstable.go new file mode 100644 index 00000000..a53e8aae --- /dev/null +++ b/internal/frontend_ext/parser/productionstable.go @@ -0,0 +1,443 @@ +// Code generated by gocc; DO NOT EDIT. + +package parser + +import "github.com/maxcalandrelli/gocc/internal/ast" + +type ( + //TODO: change type and variable names to be consistent with other tables + ProdTab [numProductions]ProdTabEntry + ProdTabEntry struct { + String string + Id string + NTType int + Index int + NumSymbols int + ReduceFunc func([]Attrib) (Attrib, error) + } + Attrib interface { + } +) + +var productionsTable = ProdTab{ + ProdTabEntry{ + String: `S' : Grammar << >>`, + Id: "S'", + NTType: 0, + Index: 0, + NumSymbols: 1, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return X[0], nil + }, + }, + ProdTabEntry{ + String: `Grammar : LexicalPart SyntaxPart << ast.NewGrammar(X[0], X[1]) >>`, + Id: "Grammar", + NTType: 1, + Index: 1, + NumSymbols: 2, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewGrammar(X[0], X[1]) + }, + }, + ProdTabEntry{ + String: `Grammar : LexicalPart << ast.NewGrammar(X[0], nil) >>`, + Id: "Grammar", + NTType: 1, + Index: 2, + NumSymbols: 1, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewGrammar(X[0], nil) + }, + }, + ProdTabEntry{ + String: `Grammar : SyntaxPart << ast.NewGrammar(nil, X[0]) >>`, + Id: "Grammar", + NTType: 1, + Index: 3, + NumSymbols: 1, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewGrammar(nil, X[0]) + }, + }, + ProdTabEntry{ + String: `LexicalPart : LexProductions << ast.NewLexPart(nil, nil, X[0]) >>`, + Id: "LexicalPart", + NTType: 2, + Index: 4, + NumSymbols: 1, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewLexPart(nil, nil, X[0]) + }, + }, + ProdTabEntry{ + String: `LexProductions : LexProduction << ast.NewLexProductions(X[0]) >>`, + Id: "LexProductions", + NTType: 3, + Index: 5, + NumSymbols: 1, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewLexProductions(X[0]) + }, + }, + ProdTabEntry{ + String: `LexProductions : LexProductions LexProduction << ast.AppendLexProduction(X[0], X[1]) >>`, + Id: "LexProductions", + NTType: 3, + Index: 6, + NumSymbols: 2, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.AppendLexProduction(X[0], X[1]) + }, + }, + ProdTabEntry{ + String: `LexProduction : tokId ":" LexPattern ";" << ast.NewLexTokDef(X[0], X[2]) >>`, + Id: "LexProduction", + NTType: 4, + Index: 7, + NumSymbols: 4, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewLexTokDef(X[0], X[2]) + }, + }, + ProdTabEntry{ + String: `LexProduction : regDefId ":" LexPattern ";" << ast.NewLexRegDef(X[0], X[2]) >>`, + Id: "LexProduction", + NTType: 4, + Index: 8, + NumSymbols: 4, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewLexRegDef(X[0], X[2]) + }, + }, + ProdTabEntry{ + String: `LexProduction : ignoredTokId ":" LexPattern ";" << ast.NewLexIgnoredTokDef(X[0], X[2]) >>`, + Id: "LexProduction", + NTType: 4, + Index: 9, + NumSymbols: 4, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewLexIgnoredTokDef(X[0], X[2]) + }, + }, + ProdTabEntry{ + String: `LexPattern : LexAlt << ast.NewLexPattern(X[0]) >>`, + Id: "LexPattern", + NTType: 5, + Index: 10, + NumSymbols: 1, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewLexPattern(X[0]) + }, + }, + ProdTabEntry{ + String: `LexPattern : LexPattern "|" LexAlt << ast.AppendLexAlt(X[0], X[2]) >>`, + Id: "LexPattern", + NTType: 5, + Index: 11, + NumSymbols: 3, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.AppendLexAlt(X[0], X[2]) + }, + }, + ProdTabEntry{ + String: `LexAlt : LexTerm << ast.NewLexAlt(X[0]) >>`, + Id: "LexAlt", + NTType: 6, + Index: 12, + NumSymbols: 1, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewLexAlt(X[0]) + }, + }, + ProdTabEntry{ + String: `LexAlt : LexAlt LexTerm << ast.AppendLexTerm(X[0], X[1]) >>`, + Id: "LexAlt", + NTType: 6, + Index: 13, + NumSymbols: 2, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.AppendLexTerm(X[0], X[1]) + }, + }, + ProdTabEntry{ + String: `LexTerm : "." << ast.LexDOT, nil >>`, + Id: "LexTerm", + NTType: 7, + Index: 14, + NumSymbols: 1, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.LexDOT, nil + }, + }, + ProdTabEntry{ + String: `LexTerm : char_lit << ast.NewLexCharLit(X[0], false) >>`, + Id: "LexTerm", + NTType: 7, + Index: 15, + NumSymbols: 1, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewLexCharLit(X[0], false) + }, + }, + ProdTabEntry{ + String: `LexTerm : "~" char_lit << ast.NewLexCharLit(X[0], true) >>`, + Id: "LexTerm", + NTType: 7, + Index: 16, + NumSymbols: 2, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewLexCharLit(X[0], true) + }, + }, + ProdTabEntry{ + String: `LexTerm : char_lit "-" char_lit << ast.NewLexCharRange(X[0], X[2], false) >>`, + Id: "LexTerm", + NTType: 7, + Index: 17, + NumSymbols: 3, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewLexCharRange(X[0], X[2], false) + }, + }, + ProdTabEntry{ + String: `LexTerm : "~" "(" char_lit "-" char_lit ")" << ast.NewLexCharRange(X[2], X[4], true) >>`, + Id: "LexTerm", + NTType: 7, + Index: 18, + NumSymbols: 6, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewLexCharRange(X[2], X[4], true) + }, + }, + ProdTabEntry{ + String: `LexTerm : regDefId << ast.NewLexRegDefId(X[0]) >>`, + Id: "LexTerm", + NTType: 7, + Index: 19, + NumSymbols: 1, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewLexRegDefId(X[0]) + }, + }, + ProdTabEntry{ + String: `LexTerm : "[" LexPattern "]" << ast.NewLexOptPattern(X[1]) >>`, + Id: "LexTerm", + NTType: 7, + Index: 20, + NumSymbols: 3, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewLexOptPattern(X[1]) + }, + }, + ProdTabEntry{ + String: `LexTerm : "{" LexPattern "}" << ast.NewLexRepPattern(X[1]) >>`, + Id: "LexTerm", + NTType: 7, + Index: 21, + NumSymbols: 3, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewLexRepPattern(X[1]) + }, + }, + ProdTabEntry{ + String: `LexTerm : "(" LexPattern ")" << ast.NewLexGroupPattern(X[1]) >>`, + Id: "LexTerm", + NTType: 7, + Index: 22, + NumSymbols: 3, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewLexGroupPattern(X[1]) + }, + }, + ProdTabEntry{ + String: `SyntaxPart : FileHeader SyntaxProdList << ast.NewSyntaxPart(X[0], X[1]) >>`, + Id: "SyntaxPart", + NTType: 8, + Index: 23, + NumSymbols: 2, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewSyntaxPart(X[0], X[1]) + }, + }, + ProdTabEntry{ + String: `SyntaxPart : SyntaxProdList << ast.NewSyntaxPart(nil, X[0]) >>`, + Id: "SyntaxPart", + NTType: 8, + Index: 24, + NumSymbols: 1, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewSyntaxPart(nil, X[0]) + }, + }, + ProdTabEntry{ + String: `FileHeader : g_sdt_lit << ast.NewFileHeader(X[0]) >>`, + Id: "FileHeader", + NTType: 9, + Index: 25, + NumSymbols: 1, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewFileHeader(X[0]) + }, + }, + ProdTabEntry{ + String: `SyntaxProdList : SyntaxProduction << ast.NewSyntaxProdList(X[0]) >>`, + Id: "SyntaxProdList", + NTType: 10, + Index: 26, + NumSymbols: 1, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewSyntaxProdList(X[0]) + }, + }, + ProdTabEntry{ + String: `SyntaxProdList : SyntaxProdList SyntaxProduction << ast.AddSyntaxProds(X[0], X[1]) >>`, + Id: "SyntaxProdList", + NTType: 10, + Index: 27, + NumSymbols: 2, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.AddSyntaxProds(X[0], X[1]) + }, + }, + ProdTabEntry{ + String: `SyntaxProduction : prodId ":" Alternatives ";" << ast.NewSyntaxProd(X[0], X[2]) >>`, + Id: "SyntaxProduction", + NTType: 11, + Index: 28, + NumSymbols: 4, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewSyntaxProd(X[0], X[2]) + }, + }, + ProdTabEntry{ + String: `Alternatives : SyntaxBody << ast.NewSyntaxAlts(X[0]) >>`, + Id: "Alternatives", + NTType: 12, + Index: 29, + NumSymbols: 1, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewSyntaxAlts(X[0]) + }, + }, + ProdTabEntry{ + String: `Alternatives : Alternatives "|" SyntaxBody << ast.AddSyntaxAlt(X[0], X[2]) >>`, + Id: "Alternatives", + NTType: 12, + Index: 30, + NumSymbols: 3, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.AddSyntaxAlt(X[0], X[2]) + }, + }, + ProdTabEntry{ + String: `SyntaxBody : Symbols << ast.NewSyntaxBody(X[0], nil) >>`, + Id: "SyntaxBody", + NTType: 13, + Index: 31, + NumSymbols: 1, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewSyntaxBody(X[0], nil) + }, + }, + ProdTabEntry{ + String: `SyntaxBody : Symbols g_sdt_lit << ast.NewSyntaxBody(X[0], X[1]) >>`, + Id: "SyntaxBody", + NTType: 13, + Index: 32, + NumSymbols: 2, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewSyntaxBody(X[0], X[1]) + }, + }, + ProdTabEntry{ + String: `SyntaxBody : "error" << ast.NewErrorBody(nil, nil) >>`, + Id: "SyntaxBody", + NTType: 13, + Index: 33, + NumSymbols: 1, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewErrorBody(nil, nil) + }, + }, + ProdTabEntry{ + String: `SyntaxBody : "error" Symbols << ast.NewErrorBody(X[1], nil) >>`, + Id: "SyntaxBody", + NTType: 13, + Index: 34, + NumSymbols: 2, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewErrorBody(X[1], nil) + }, + }, + ProdTabEntry{ + String: `SyntaxBody : "error" Symbols g_sdt_lit << ast.NewErrorBody(X[1], X[2]) >>`, + Id: "SyntaxBody", + NTType: 13, + Index: 35, + NumSymbols: 3, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewErrorBody(X[1], X[2]) + }, + }, + ProdTabEntry{ + String: `SyntaxBody : "empty" << ast.NewEmptyBody() >>`, + Id: "SyntaxBody", + NTType: 13, + Index: 36, + NumSymbols: 0, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewEmptyBody() + }, + }, + ProdTabEntry{ + String: `Symbols : Symbol << ast.NewSyntaxSymbols(X[0]) >>`, + Id: "Symbols", + NTType: 14, + Index: 37, + NumSymbols: 1, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewSyntaxSymbols(X[0]) + }, + }, + ProdTabEntry{ + String: `Symbols : Symbols Symbol << ast.AddSyntaxSymbol(X[0], X[1]) >>`, + Id: "Symbols", + NTType: 14, + Index: 38, + NumSymbols: 2, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.AddSyntaxSymbol(X[0], X[1]) + }, + }, + ProdTabEntry{ + String: `Symbol : prodId << ast.NewSyntaxProdId(X[0]) >>`, + Id: "Symbol", + NTType: 15, + Index: 39, + NumSymbols: 1, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewSyntaxProdId(X[0]) + }, + }, + ProdTabEntry{ + String: `Symbol : tokId << ast.NewTokId(X[0]) >>`, + Id: "Symbol", + NTType: 15, + Index: 40, + NumSymbols: 1, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewTokId(X[0]) + }, + }, + ProdTabEntry{ + String: `Symbol : string_lit << ast.NewStringLit(X[0]) >>`, + Id: "Symbol", + NTType: 15, + Index: 41, + NumSymbols: 1, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewStringLit(X[0]) + }, + }, +} diff --git a/internal/frontend_ext/token/token.go b/internal/frontend_ext/token/token.go new file mode 100644 index 00000000..86cf3dee --- /dev/null +++ b/internal/frontend_ext/token/token.go @@ -0,0 +1,112 @@ +// Code generated by gocc; DO NOT EDIT. + +package token + +import ( + "fmt" +) + +type Token struct { + Type + Lit []byte + Pos +} + +type Type int + +const ( + INVALID Type = iota + EOF +) + +type Pos struct { + Offset int + Line int + Column int +} + +func (p Pos) String() string { + return fmt.Sprintf("Pos(offset=%d, line=%d, column=%d)", p.Offset, p.Line, p.Column) +} + +type TokenMap struct { + typeMap []string + idMap map[string]Type +} + +func (m TokenMap) Id(tok Type) string { + if int(tok) < len(m.typeMap) { + return m.typeMap[tok] + } + return "unknown" +} + +func (m TokenMap) Type(tok string) Type { + if typ, exist := m.idMap[tok]; exist { + return typ + } + return INVALID +} + +func (m TokenMap) TokenString(tok *Token) string { + //TODO: refactor to print pos & token string properly + return fmt.Sprintf("%s(%d,%s)", m.Id(tok.Type), tok.Type, tok.Lit) +} + +func (m TokenMap) StringType(typ Type) string { + return fmt.Sprintf("%s(%d)", m.Id(typ), typ) +} + +var TokMap = TokenMap{ + typeMap: []string{ + "INVALID", + "$", + "tokId", + ":", + ";", + "regDefId", + "ignoredTokId", + "|", + ".", + "char_lit", + "~", + "-", + "(", + ")", + "[", + "]", + "{", + "}", + "g_sdt_lit", + "prodId", + "error", + "empty", + "string_lit", + }, + + idMap: map[string]Type{ + "INVALID": 0, + "$": 1, + "tokId": 2, + ":": 3, + ";": 4, + "regDefId": 5, + "ignoredTokId": 6, + "|": 7, + ".": 8, + "char_lit": 9, + "~": 10, + "-": 11, + "(": 12, + ")": 13, + "[": 14, + "]": 15, + "{": 16, + "}": 17, + "g_sdt_lit": 18, + "prodId": 19, + "error": 20, + "empty": 21, + "string_lit": 22, + }, +} diff --git a/internal/frontend_ext/util/litconv.go b/internal/frontend_ext/util/litconv.go new file mode 100644 index 00000000..1aeb6166 --- /dev/null +++ b/internal/frontend_ext/util/litconv.go @@ -0,0 +1,108 @@ +// Code generated by gocc; DO NOT EDIT. + +package util + +import ( + "fmt" + "strconv" + "unicode" + "unicode/utf8" +) + +/* Interface */ + +/* +Convert the literal value of a scanned token to rune +*/ +func RuneValue(lit []byte) rune { + if lit[1] == '\\' { + return escapeCharVal(lit) + } + r, size := utf8.DecodeRune(lit[1:]) + if size != len(lit)-2 { + panic(fmt.Sprintf("Error decoding rune. Lit: %s, rune: %d, size%d\n", lit, r, size)) + } + return r +} + +/* +Convert the literal value of a scanned token to int64 +*/ +func IntValue(lit []byte) (int64, error) { + return strconv.ParseInt(string(lit), 10, 64) +} + +/* +Convert the literal value of a scanned token to uint64 +*/ +func UintValue(lit []byte) (uint64, error) { + return strconv.ParseUint(string(lit), 10, 64) +} + +/* Util */ + +func escapeCharVal(lit []byte) rune { + var i, base, max uint32 + offset := 2 + switch lit[offset] { + case 'a': + return '\a' + case 'b': + return '\b' + case 'f': + return '\f' + case 'n': + return '\n' + case 'r': + return '\r' + case 't': + return '\t' + case 'v': + return '\v' + case '\\': + return '\\' + case '\'': + return '\'' + case '0', '1', '2', '3', '4', '5', '6', '7': + i, base, max = 3, 8, 255 + case 'x': + i, base, max = 2, 16, 255 + offset++ + case 'u': + i, base, max = 4, 16, unicode.MaxRune + offset++ + case 'U': + i, base, max = 8, 16, unicode.MaxRune + offset++ + default: + panic(fmt.Sprintf("Error decoding character literal: %s\n", lit)) + } + + var x uint32 + for ; i > 0 && offset < len(lit)-1; i-- { + ch, size := utf8.DecodeRune(lit[offset:]) + offset += size + d := uint32(digitVal(ch)) + if d >= base { + panic(fmt.Sprintf("charVal(%s): illegal character (%c) in escape sequence. size=%d, offset=%d", lit, ch, size, offset)) + } + x = x*base + d + } + if x > max || 0xD800 <= x && x < 0xE000 { + panic(fmt.Sprintf("Error decoding escape char value. Lit:%s, offset:%d, escape sequence is invalid Unicode code point\n", lit, offset)) + } + + return rune(x) +} + +func digitVal(ch rune) int { + switch { + case '0' <= ch && ch <= '9': + return int(ch) - '0' + case 'a' <= ch && ch <= 'f': + return int(ch) - 'a' + 10 + case 'A' <= ch && ch <= 'F': + return int(ch) - 'A' + 10 + } + return 16 // larger than any legal digit val +} diff --git a/internal/frontend_ext/util/rune.go b/internal/frontend_ext/util/rune.go new file mode 100644 index 00000000..bd8523a4 --- /dev/null +++ b/internal/frontend_ext/util/rune.go @@ -0,0 +1,39 @@ +// Code generated by gocc; DO NOT EDIT. + +package util + +import ( + "fmt" +) + +func RuneToString(r rune) string { + if r >= 0x20 && r < 0x7f { + return fmt.Sprintf("'%c'", r) + } + switch r { + case 0x07: + return "'\\a'" + case 0x08: + return "'\\b'" + case 0x0C: + return "'\\f'" + case 0x0A: + return "'\\n'" + case 0x0D: + return "'\\r'" + case 0x09: + return "'\\t'" + case 0x0b: + return "'\\v'" + case 0x5c: + return "'\\\\\\'" + case 0x27: + return "'\\''" + case 0x22: + return "'\\\"'" + } + if r < 0x10000 { + return fmt.Sprintf("\\u%04x", r) + } + return fmt.Sprintf("\\U%08x", r) +} diff --git a/internal/frontend/errors/errors.go b/internal/frontend_orig/errors/errors.go similarity index 88% rename from internal/frontend/errors/errors.go rename to internal/frontend_orig/errors/errors.go index 7e7f7321..5720d5c0 100644 --- a/internal/frontend/errors/errors.go +++ b/internal/frontend_orig/errors/errors.go @@ -1,6 +1,6 @@ package errors -import "github.com/goccmack/gocc/internal/frontend/token" +import "github.com/maxcalandrelli/gocc/internal/frontend/token" type ErrorSymbol interface { } diff --git a/internal/frontend/parser/parser.go b/internal/frontend_orig/parser/parser.go similarity index 97% rename from internal/frontend/parser/parser.go rename to internal/frontend_orig/parser/parser.go index 4d03962e..31deb083 100644 --- a/internal/frontend/parser/parser.go +++ b/internal/frontend_orig/parser/parser.go @@ -6,9 +6,9 @@ import ( "strconv" ) -import errs "github.com/goccmack/gocc/internal/frontend/errors" +import errs "github.com/maxcalandrelli/gocc/internal/frontend/errors" -import "github.com/goccmack/gocc/internal/frontend/token" +import "github.com/maxcalandrelli/gocc/internal/frontend/token" type ( ActionTab []*ActionRow diff --git a/internal/frontend/parser/parser_ut.go b/internal/frontend_orig/parser/parser_ut.go similarity index 96% rename from internal/frontend/parser/parser_ut.go rename to internal/frontend_orig/parser/parser_ut.go index ddd3dc1d..82076b0a 100644 --- a/internal/frontend/parser/parser_ut.go +++ b/internal/frontend_orig/parser/parser_ut.go @@ -5,9 +5,9 @@ import ( "strconv" ) -import errs "github.com/goccmack/gocc/internal/frontend/errors" +import errs "github.com/maxcalandrelli/gocc/internal/frontend/errors" -import "github.com/goccmack/gocc/internal/frontend/token" +import "github.com/maxcalandrelli/gocc/internal/frontend/token" // ParserUTab diff --git a/internal/frontend/parser/tables.go b/internal/frontend_orig/parser/tables.go similarity index 99% rename from internal/frontend/parser/tables.go rename to internal/frontend_orig/parser/tables.go index 1e3bfc83..c9e6fcc7 100644 --- a/internal/frontend/parser/tables.go +++ b/internal/frontend_orig/parser/tables.go @@ -1,6 +1,6 @@ package parser -import "github.com/goccmack/gocc/internal/ast" +import "github.com/maxcalandrelli/gocc/internal/ast" var ProductionsTable = ProdTab{ // [0] diff --git a/internal/frontend/parser/tables_uncompressed.go b/internal/frontend_orig/parser/tables_uncompressed.go similarity index 99% rename from internal/frontend/parser/tables_uncompressed.go rename to internal/frontend_orig/parser/tables_uncompressed.go index 0e9aa778..755ca6a8 100644 --- a/internal/frontend/parser/tables_uncompressed.go +++ b/internal/frontend_orig/parser/tables_uncompressed.go @@ -1,6 +1,6 @@ package parser -import "github.com/goccmack/gocc/internal/ast" +import "github.com/maxcalandrelli/gocc/internal/ast" const ( NUM_STATES = 120 diff --git a/internal/frontend/scanner/scanner.go b/internal/frontend_orig/scanner/scanner.go similarity index 99% rename from internal/frontend/scanner/scanner.go rename to internal/frontend_orig/scanner/scanner.go index cd5d3c72..0489d443 100644 --- a/internal/frontend/scanner/scanner.go +++ b/internal/frontend_orig/scanner/scanner.go @@ -14,7 +14,7 @@ import ( "unicode" "unicode/utf8" ) -import "github.com/goccmack/gocc/internal/frontend/token" +import "github.com/maxcalandrelli/gocc/internal/frontend/token" // A Scanner holds the scanner's internal state while processing // a given text. It can be allocated as part of another data @@ -533,6 +533,8 @@ scanAgain: } case '.': tok = S.tokenMap.Type(".") + case '~': + tok = S.tokenMap.Type("~") default: S.error(pos, "illegal character "+charString(ch)) } diff --git a/internal/frontend/scanner/scanner_test.go b/internal/frontend_orig/scanner/scanner_test.go similarity index 97% rename from internal/frontend/scanner/scanner_test.go rename to internal/frontend_orig/scanner/scanner_test.go index 57d86f79..2fffde8d 100644 --- a/internal/frontend/scanner/scanner_test.go +++ b/internal/frontend_orig/scanner/scanner_test.go @@ -4,7 +4,7 @@ import ( "fmt" "testing" - "github.com/goccmack/gocc/internal/frontend/token" + "github.com/maxcalandrelli/gocc/internal/frontend/token" ) type testRecord struct { diff --git a/internal/frontend/token/token.go b/internal/frontend_orig/token/token.go similarity index 100% rename from internal/frontend/token/token.go rename to internal/frontend_orig/token/token.go diff --git a/internal/frontend/token/tokens.go b/internal/frontend_orig/token/tokens.go similarity index 100% rename from internal/frontend/token/tokens.go rename to internal/frontend_orig/token/tokens.go diff --git a/internal/lexer/gen/golang/acttab.go b/internal/lexer/gen/golang/acttab.go index b68cc937..5ba95348 100644 --- a/internal/lexer/gen/golang/acttab.go +++ b/internal/lexer/gen/golang/acttab.go @@ -19,9 +19,9 @@ import ( "path" "text/template" - "github.com/goccmack/gocc/internal/io" - "github.com/goccmack/gocc/internal/lexer/items" - "github.com/goccmack/gocc/internal/token" + "github.com/maxcalandrelli/gocc/internal/io" + "github.com/maxcalandrelli/gocc/internal/lexer/items" + "github.com/maxcalandrelli/gocc/internal/token" ) func genActionTable(pkg, outDir string, itemsets *items.ItemSets, tokMap *token.TokenMap) { diff --git a/internal/lexer/gen/golang/asciitable.go b/internal/lexer/gen/golang/asciitable.go index 8ddf2639..bb52e93a 100644 --- a/internal/lexer/gen/golang/asciitable.go +++ b/internal/lexer/gen/golang/asciitable.go @@ -19,8 +19,8 @@ import ( "path" "text/template" - "github.com/goccmack/gocc/internal/io" - "github.com/goccmack/gocc/internal/lexer/symbols" + "github.com/maxcalandrelli/gocc/internal/io" + "github.com/maxcalandrelli/gocc/internal/lexer/symbols" ) func genAsciiTable(outDir string, symbols *symbols.Symbols) { diff --git a/internal/lexer/gen/golang/chrranges.go b/internal/lexer/gen/golang/chrranges.go index 6a9f9232..fc1dfc4a 100644 --- a/internal/lexer/gen/golang/chrranges.go +++ b/internal/lexer/gen/golang/chrranges.go @@ -15,7 +15,7 @@ package golang import ( - "github.com/goccmack/gocc/internal/lexer/symbols" + "github.com/maxcalandrelli/gocc/internal/lexer/symbols" ) type CharRange struct { diff --git a/internal/lexer/gen/golang/gen.go b/internal/lexer/gen/golang/gen.go index 00009454..bfabfc4f 100644 --- a/internal/lexer/gen/golang/gen.go +++ b/internal/lexer/gen/golang/gen.go @@ -15,9 +15,9 @@ package golang import ( - "github.com/goccmack/gocc/internal/config" - "github.com/goccmack/gocc/internal/lexer/items" - "github.com/goccmack/gocc/internal/token" + "github.com/maxcalandrelli/gocc/internal/config" + "github.com/maxcalandrelli/gocc/internal/lexer/items" + "github.com/maxcalandrelli/gocc/internal/token" ) func Gen(pkg, outDir string, header string, itemsets *items.ItemSets, tokMap *token.TokenMap, cfg config.Config) { diff --git a/internal/lexer/gen/golang/imports.go b/internal/lexer/gen/golang/imports.go index 49d9cf50..57b5a1c3 100644 --- a/internal/lexer/gen/golang/imports.go +++ b/internal/lexer/gen/golang/imports.go @@ -15,7 +15,7 @@ package golang import ( - "github.com/goccmack/gocc/internal/lexer/symbols" + "github.com/maxcalandrelli/gocc/internal/lexer/symbols" ) type importType struct { diff --git a/internal/lexer/gen/golang/lexer.go b/internal/lexer/gen/golang/lexer.go index 0a1eec68..295741e1 100644 --- a/internal/lexer/gen/golang/lexer.go +++ b/internal/lexer/gen/golang/lexer.go @@ -19,9 +19,9 @@ import ( "path" "text/template" - "github.com/goccmack/gocc/internal/config" - "github.com/goccmack/gocc/internal/io" - "github.com/goccmack/gocc/internal/lexer/items" + "github.com/maxcalandrelli/gocc/internal/config" + "github.com/maxcalandrelli/gocc/internal/io" + "github.com/maxcalandrelli/gocc/internal/lexer/items" ) func genLexer(pkg, outDir string, itemsets *items.ItemSets, cfg config.Config) { @@ -79,20 +79,20 @@ const ( NumSymbols = {{.NumSymbols}} ) -type Lexer struct { - src []byte +type Position struct { pos int line int column int } +type Lexer struct { + Position + src []byte +} + func NewLexer(src []byte) *Lexer { - lexer := &Lexer{ - src: src, - pos: 0, - line: 1, - column: 1, - } + lexer := &Lexer{ src: src } + lexer.Position.Reset() return lexer } @@ -189,7 +189,42 @@ func (l *Lexer) Scan() (tok *token.Token) { } func (l *Lexer) Reset() { - l.pos = 0 + l.Position.Reset() +} + +func (l *Lexer) Reposition(p Position) { + l.Position = p +} + +func (l Lexer) CurrentPosition() Position { + return l.Position +} + +func (l Lexer) Source() []byte { + return l.src +} + +func (l Lexer) Remaining() []byte { + return l.src[l.pos:] +} + + +func (p Position) Offset() int { + return p.pos +} + +func (p Position) Line() int { + return p.line +} + +func (p Position) Column() int { + return p.column +} + +func (p *Position) Reset() { + p.pos = 0 + p.line = 1 + p.column = 1 } /* diff --git a/internal/lexer/gen/golang/transtab.go b/internal/lexer/gen/golang/transtab.go index 9f536d8d..c2195e29 100644 --- a/internal/lexer/gen/golang/transtab.go +++ b/internal/lexer/gen/golang/transtab.go @@ -20,8 +20,8 @@ import ( "path" "text/template" - "github.com/goccmack/gocc/internal/io" - "github.com/goccmack/gocc/internal/lexer/items" + "github.com/maxcalandrelli/gocc/internal/io" + "github.com/maxcalandrelli/gocc/internal/lexer/items" ) func genTransitionTable(pkg, outDir, header string, itemSets *items.ItemSets) { diff --git a/internal/lexer/items/charrange.go b/internal/lexer/items/charrange.go index e0ed391b..63c51a98 100644 --- a/internal/lexer/items/charrange.go +++ b/internal/lexer/items/charrange.go @@ -17,7 +17,7 @@ package items import ( "fmt" - "github.com/goccmack/gocc/internal/util" + "github.com/maxcalandrelli/gocc/internal/util" ) type CharRange struct { diff --git a/internal/lexer/items/disjunctrangeset.go b/internal/lexer/items/disjunctrangeset.go index c897782a..8dbd3f56 100644 --- a/internal/lexer/items/disjunctrangeset.go +++ b/internal/lexer/items/disjunctrangeset.go @@ -18,7 +18,7 @@ import ( "fmt" "strings" - "github.com/goccmack/gocc/internal/ast" + "github.com/maxcalandrelli/gocc/internal/ast" ) // set is kept sorted @@ -37,9 +37,17 @@ func NewDisjunctRangeSet() *DisjunctRangeSet { func (this *DisjunctRangeSet) AddLexTNode(sym ast.LexTNode) { switch s := sym.(type) { case *ast.LexCharRange: - this.AddRange(s.From.Val, s.To.Val) + if s.Negate { + this.SubtractRange(s.From.Val, s.To.Val) + } else { + this.AddRange(s.From.Val, s.To.Val) + } case *ast.LexCharLit: - this.AddRange(s.Val, s.Val) + if s.Negate { + this.SubtractRange(s.Val, s.Val) + } else { + this.AddRange(s.Val, s.Val) + } case *ast.LexDot: this.MatchAny = true case *ast.LexRegDefId: @@ -129,6 +137,46 @@ func (this *DisjunctRangeSet) AddRange(from, to rune) { } } +func (this *DisjunctRangeSet) subtractRange(index int, from, to rune) int { + //fmt.Printf("subtracting <%c-%c> at index %d<%c-%c>\n", from, to, index, this.set[index].From, this.set[index].To) + rng := this.set[index] + if to >= from && to >= rng.From { + if from > rng.To || to < rng.From { + return index + 1 + } + if from < rng.From { + return this.subtractRange(index, rng.From, to) + } + if to > rng.To { + this.subtractRange(index, from, rng.To) + return this.subtractRange(index+1, rng.To+1, to) + } + // + // from >= rng.to && to <= rng.to + // + //fmt.Printf("actually deleting range <%c-%c> at index %d<%c-%c>\n", from, to, index, this.set[index].From, this.set[index].To) + switch { + case from == rng.From && to == rng.To: + copy(this.set[index:], this.set[index+1:]) + this.set = this.set[:len(this.set)-1] + case from == rng.From: + this.set[index].From = to + 1 + case to == rng.To: + this.set[index].To = from - 1 + default: + this.set[index].From = this.set[index].From + this.set[index].To = from - 1 + this.AddRange(to+1, rng.To) + } + } + return len(this.set) +} + +func (this *DisjunctRangeSet) SubtractRange(from, to rune) { + for index := 0; index < len(this.set); index = this.subtractRange(index, from, to) { + } +} + func (this *DisjunctRangeSet) Range(i int) CharRange { return this.set[i] } diff --git a/internal/lexer/items/disjunctrangeset_test.go b/internal/lexer/items/disjunctrangeset_test.go index f5f42865..d4562481 100644 --- a/internal/lexer/items/disjunctrangeset_test.go +++ b/internal/lexer/items/disjunctrangeset_test.go @@ -18,7 +18,7 @@ import ( // "fmt" "testing" - "github.com/goccmack/gocc/internal/ast" + "github.com/maxcalandrelli/gocc/internal/ast" // "unicode" ) @@ -412,3 +412,30 @@ func TestDisjunctSets14(t *testing.T) { t.Fatalf("len(set.set) == %d", len(set.set)) } } + +func TestDisjunctSets15(t *testing.T) { + set := NewDisjunctRangeSet() + subtract := func(a, b rune) { + t.Logf("current set: %s; subtracting <%c-%c>\n", set.String(), a, b) + set.SubtractRange(a, b) + t.Logf("resulting set: %s\n", set.String()) + } + set.AddRange('D', 'F') + set.AddRange('J', 'L') + set.AddRange('Q', 'Z') + set.AddRange('5', '8') + set.AddRange('a', 'z') + subtract('0', '4') + subtract('A', 'D') + subtract('E', 'M') + subtract('S', '^') + subtract('K', 'C') + subtract('c', 'f') + subtract('w', 'w') + set.AddLexTNode(ast.LexDOT) + expect := "{['5','8'], ['J','L'], ['Q','R'], ['a','b'], ['g','v'], ['x','z']}" + if expect != set.String() { + t.Fatalf("expected set: %s\n", expect) + t.Fatalf("actual set: %s\n", set.String()) + } +} diff --git a/internal/lexer/items/item.go b/internal/lexer/items/item.go index 1d4634d7..02dfc5cb 100644 --- a/internal/lexer/items/item.go +++ b/internal/lexer/items/item.go @@ -20,9 +20,9 @@ import ( "io" "strings" - "github.com/goccmack/gocc/internal/ast" - "github.com/goccmack/gocc/internal/lexer/symbols" - "github.com/goccmack/gocc/internal/util" + "github.com/maxcalandrelli/gocc/internal/ast" + "github.com/maxcalandrelli/gocc/internal/lexer/symbols" + "github.com/maxcalandrelli/gocc/internal/util" ) type Item struct { diff --git a/internal/lexer/items/item_test.go b/internal/lexer/items/item_test.go index 685b6347..4c2680b7 100644 --- a/internal/lexer/items/item_test.go +++ b/internal/lexer/items/item_test.go @@ -18,7 +18,7 @@ import ( "fmt" "testing" - "github.com/goccmack/gocc/internal/lexer/symbols" + "github.com/maxcalandrelli/gocc/internal/lexer/symbols" ) /* diff --git a/internal/lexer/items/itemlist.go b/internal/lexer/items/itemlist.go index 5f3caf11..ede7a52f 100644 --- a/internal/lexer/items/itemlist.go +++ b/internal/lexer/items/itemlist.go @@ -19,8 +19,8 @@ import ( "fmt" "strings" - "github.com/goccmack/gocc/internal/ast" - "github.com/goccmack/gocc/internal/lexer/symbols" + "github.com/maxcalandrelli/gocc/internal/ast" + "github.com/maxcalandrelli/gocc/internal/lexer/symbols" ) // Each Itemset element is a ItemList diff --git a/internal/lexer/items/itempos.go b/internal/lexer/items/itempos.go index 3d955039..b0129eb1 100644 --- a/internal/lexer/items/itempos.go +++ b/internal/lexer/items/itempos.go @@ -18,7 +18,7 @@ import ( "fmt" "strings" - "github.com/goccmack/gocc/internal/ast" + "github.com/maxcalandrelli/gocc/internal/ast" ) type itemPos struct { diff --git a/internal/lexer/items/itempos_test.go b/internal/lexer/items/itempos_test.go index ae672e96..537656f0 100644 --- a/internal/lexer/items/itempos_test.go +++ b/internal/lexer/items/itempos_test.go @@ -16,7 +16,7 @@ package items import ( // "fmt" - // "github.com/goccmack/gocc/internal/ast" + // "github.com/maxcalandrelli/gocc/internal/ast" "testing" ) diff --git a/internal/lexer/items/itemset.go b/internal/lexer/items/itemset.go index 15b62f98..4c1b82ae 100644 --- a/internal/lexer/items/itemset.go +++ b/internal/lexer/items/itemset.go @@ -18,8 +18,8 @@ import ( "fmt" "strings" - "github.com/goccmack/gocc/internal/ast" - "github.com/goccmack/gocc/internal/lexer/symbols" + "github.com/maxcalandrelli/gocc/internal/ast" + "github.com/maxcalandrelli/gocc/internal/lexer/symbols" ) /* diff --git a/internal/lexer/items/itemsets.go b/internal/lexer/items/itemsets.go index b461bdff..919cef7f 100644 --- a/internal/lexer/items/itemsets.go +++ b/internal/lexer/items/itemsets.go @@ -18,8 +18,8 @@ import ( "fmt" "strings" - "github.com/goccmack/gocc/internal/ast" - "github.com/goccmack/gocc/internal/lexer/symbols" + "github.com/maxcalandrelli/gocc/internal/ast" + "github.com/maxcalandrelli/gocc/internal/lexer/symbols" ) type ItemSets struct { diff --git a/internal/lexer/items/testutils_test.go b/internal/lexer/items/testutils_test.go index debb62c6..de0e7312 100644 --- a/internal/lexer/items/testutils_test.go +++ b/internal/lexer/items/testutils_test.go @@ -18,10 +18,10 @@ import ( "fmt" "testing" - "github.com/goccmack/gocc/internal/ast" - "github.com/goccmack/gocc/internal/frontend/parser" - "github.com/goccmack/gocc/internal/frontend/scanner" - "github.com/goccmack/gocc/internal/frontend/token" + "github.com/maxcalandrelli/gocc/internal/ast" + "github.com/maxcalandrelli/gocc/internal/frontend/parser" + "github.com/maxcalandrelli/gocc/internal/frontend/scanner" + "github.com/maxcalandrelli/gocc/internal/frontend/token" ) func findSet(sets *ItemSets, items []string) *ItemSet { diff --git a/internal/lexer/symbols/charlitsymbols.go b/internal/lexer/symbols/charlitsymbols.go index f9d98da2..5819ab59 100644 --- a/internal/lexer/symbols/charlitsymbols.go +++ b/internal/lexer/symbols/charlitsymbols.go @@ -15,7 +15,7 @@ package symbols import ( - "github.com/goccmack/gocc/internal/ast" + "github.com/maxcalandrelli/gocc/internal/ast" ) // key: string of symbols - string(ast.CharLit.Lit). E.g.: "'a'" diff --git a/internal/lexer/symbols/charrangesymbols.go b/internal/lexer/symbols/charrangesymbols.go index fe43e039..163dea92 100644 --- a/internal/lexer/symbols/charrangesymbols.go +++ b/internal/lexer/symbols/charrangesymbols.go @@ -15,7 +15,7 @@ package symbols import ( - "github.com/goccmack/gocc/internal/ast" + "github.com/maxcalandrelli/gocc/internal/ast" ) // key: string of range, e.g.: 'a'-'z' diff --git a/internal/lexer/symbols/symbols.go b/internal/lexer/symbols/symbols.go index 1be7679c..fb1ff574 100644 --- a/internal/lexer/symbols/symbols.go +++ b/internal/lexer/symbols/symbols.go @@ -18,7 +18,7 @@ import ( "fmt" "strings" - "github.com/goccmack/gocc/internal/ast" + "github.com/maxcalandrelli/gocc/internal/ast" ) type Symbols struct { diff --git a/internal/parser/first/first.go b/internal/parser/first/first.go index 8b6c1379..2455e0db 100644 --- a/internal/parser/first/first.go +++ b/internal/parser/first/first.go @@ -18,8 +18,8 @@ import ( "fmt" "strings" - "github.com/goccmack/gocc/internal/ast" - "github.com/goccmack/gocc/internal/parser/symbols" + "github.com/maxcalandrelli/gocc/internal/ast" + "github.com/maxcalandrelli/gocc/internal/parser/symbols" ) /* diff --git a/internal/parser/gen/gen.go b/internal/parser/gen/gen.go index 1ab300ab..0d632984 100644 --- a/internal/parser/gen/gen.go +++ b/internal/parser/gen/gen.go @@ -18,12 +18,12 @@ This package controls the generation of all parser-related code. package gen import ( - "github.com/goccmack/gocc/internal/ast" - "github.com/goccmack/gocc/internal/config" - "github.com/goccmack/gocc/internal/parser/gen/golang" - "github.com/goccmack/gocc/internal/parser/lr1/items" - "github.com/goccmack/gocc/internal/parser/symbols" - "github.com/goccmack/gocc/internal/token" + "github.com/maxcalandrelli/gocc/internal/ast" + "github.com/maxcalandrelli/gocc/internal/config" + "github.com/maxcalandrelli/gocc/internal/parser/gen/golang" + "github.com/maxcalandrelli/gocc/internal/parser/lr1/items" + "github.com/maxcalandrelli/gocc/internal/parser/symbols" + "github.com/maxcalandrelli/gocc/internal/token" ) func Gen(pkg, outDir, header string, prods ast.SyntaxProdList, symbols *symbols.Symbols, diff --git a/internal/parser/gen/golang/action.go b/internal/parser/gen/golang/action.go index 020bf58b..afc86816 100644 --- a/internal/parser/gen/golang/action.go +++ b/internal/parser/gen/golang/action.go @@ -17,7 +17,7 @@ package golang import ( "path" - "github.com/goccmack/gocc/internal/io" + "github.com/maxcalandrelli/gocc/internal/io" ) func GenAction(outDir string) { diff --git a/internal/parser/gen/golang/actiontable.go b/internal/parser/gen/golang/actiontable.go index feb11c01..2fcc16b9 100644 --- a/internal/parser/gen/golang/actiontable.go +++ b/internal/parser/gen/golang/actiontable.go @@ -21,11 +21,11 @@ import ( "path" "text/template" - "github.com/goccmack/gocc/internal/ast" - "github.com/goccmack/gocc/internal/io" - "github.com/goccmack/gocc/internal/parser/lr1/action" - "github.com/goccmack/gocc/internal/parser/lr1/items" - "github.com/goccmack/gocc/internal/token" + "github.com/maxcalandrelli/gocc/internal/ast" + "github.com/maxcalandrelli/gocc/internal/io" + "github.com/maxcalandrelli/gocc/internal/parser/lr1/action" + "github.com/maxcalandrelli/gocc/internal/parser/lr1/items" + "github.com/maxcalandrelli/gocc/internal/token" ) func GenActionTable(outDir string, prods ast.SyntaxProdList, itemSets *items.ItemSets, tokMap *token.TokenMap, zip bool) map[int]items.RowConflicts { diff --git a/internal/parser/gen/golang/errors.go b/internal/parser/gen/golang/errors.go index 965ba7cc..449020b6 100644 --- a/internal/parser/gen/golang/errors.go +++ b/internal/parser/gen/golang/errors.go @@ -18,7 +18,7 @@ import ( "path" "text/template" - "github.com/goccmack/gocc/internal/io" + "github.com/maxcalandrelli/gocc/internal/io" ) func GenErrors(pkg, outDir string) { diff --git a/internal/parser/gen/golang/gototable.go b/internal/parser/gen/golang/gototable.go index a4af8b93..57010eb2 100644 --- a/internal/parser/gen/golang/gototable.go +++ b/internal/parser/gen/golang/gototable.go @@ -22,9 +22,9 @@ import ( "path" "text/template" - "github.com/goccmack/gocc/internal/io" - "github.com/goccmack/gocc/internal/parser/lr1/items" - "github.com/goccmack/gocc/internal/parser/symbols" + "github.com/maxcalandrelli/gocc/internal/io" + "github.com/maxcalandrelli/gocc/internal/parser/lr1/items" + "github.com/maxcalandrelli/gocc/internal/parser/symbols" ) type gotoTableData struct { diff --git a/internal/parser/gen/golang/parser.go b/internal/parser/gen/golang/parser.go index f417cd44..0d09d1da 100644 --- a/internal/parser/gen/golang/parser.go +++ b/internal/parser/gen/golang/parser.go @@ -19,11 +19,11 @@ import ( "path" "text/template" - "github.com/goccmack/gocc/internal/ast" - "github.com/goccmack/gocc/internal/config" - "github.com/goccmack/gocc/internal/io" - "github.com/goccmack/gocc/internal/parser/lr1/items" - "github.com/goccmack/gocc/internal/parser/symbols" + "github.com/maxcalandrelli/gocc/internal/ast" + "github.com/maxcalandrelli/gocc/internal/config" + "github.com/maxcalandrelli/gocc/internal/io" + "github.com/maxcalandrelli/gocc/internal/parser/lr1/items" + "github.com/maxcalandrelli/gocc/internal/parser/symbols" ) func GenParser(pkg, outDir string, prods ast.SyntaxProdList, itemSets *items.ItemSets, symbols *symbols.Symbols, cfg config.Config) { @@ -149,9 +149,10 @@ func (s *stack) String() string { // Parser type Parser struct { - stack *stack - nextToken *token.Token - pos int + stack *stack + nextToken *token.Token + pos int + UserContext interface{} } type Scanner interface { diff --git a/internal/parser/gen/golang/productionstable.go b/internal/parser/gen/golang/productionstable.go index cbcce7a4..92b15e63 100644 --- a/internal/parser/gen/golang/productionstable.go +++ b/internal/parser/gen/golang/productionstable.go @@ -20,11 +20,11 @@ import ( "path" "text/template" - "github.com/goccmack/gocc/internal/ast" - "github.com/goccmack/gocc/internal/io" - "github.com/goccmack/gocc/internal/parser/lr1/items" - "github.com/goccmack/gocc/internal/parser/symbols" - "github.com/goccmack/gocc/internal/token" + "github.com/maxcalandrelli/gocc/internal/ast" + "github.com/maxcalandrelli/gocc/internal/io" + "github.com/maxcalandrelli/gocc/internal/parser/lr1/items" + "github.com/maxcalandrelli/gocc/internal/parser/symbols" + "github.com/maxcalandrelli/gocc/internal/token" ) func GenProductionsTable(pkg, outDir, header string, prods ast.SyntaxProdList, symbols *symbols.Symbols, @@ -69,6 +69,7 @@ func getProdsTab(header string, prods ast.SyntaxProdList, symbols *symbols.Symbo data.ProdTab[i].ReduceFunc = "return X[0], nil" } } + data.TokenImport= path.Join(pkg, "token"), return data } @@ -84,6 +85,7 @@ type prodTabEntry struct { NTType int NumSymbols int ReduceFunc string + TokenImport string } const prodsTabSrc = ` @@ -93,6 +95,12 @@ package parser {{.Header}} +import ( + "{{.TokenImport}}" +) + + + type ( //TODO: change type and variable names to be consistent with other tables ProdTab [numProductions]ProdTabEntry diff --git a/internal/parser/lr1/items/item.go b/internal/parser/lr1/items/item.go index e0349cd2..e496db02 100644 --- a/internal/parser/lr1/items/item.go +++ b/internal/parser/lr1/items/item.go @@ -18,8 +18,8 @@ import ( "fmt" "strings" - "github.com/goccmack/gocc/internal/ast" - "github.com/goccmack/gocc/internal/parser/lr1/action" + "github.com/maxcalandrelli/gocc/internal/ast" + "github.com/maxcalandrelli/gocc/internal/parser/lr1/action" ) //An LR1 Item. diff --git a/internal/parser/lr1/items/itemset.go b/internal/parser/lr1/items/itemset.go index 44b3c109..5c76ca95 100644 --- a/internal/parser/lr1/items/itemset.go +++ b/internal/parser/lr1/items/itemset.go @@ -19,10 +19,10 @@ import ( "sort" "strings" - "github.com/goccmack/gocc/internal/ast" - "github.com/goccmack/gocc/internal/parser/first" - "github.com/goccmack/gocc/internal/parser/lr1/action" - "github.com/goccmack/gocc/internal/parser/symbols" + "github.com/maxcalandrelli/gocc/internal/ast" + "github.com/maxcalandrelli/gocc/internal/parser/first" + "github.com/maxcalandrelli/gocc/internal/parser/lr1/action" + "github.com/maxcalandrelli/gocc/internal/parser/symbols" ) type ItemSet struct { diff --git a/internal/parser/lr1/items/itemsets.go b/internal/parser/lr1/items/itemsets.go index 21e593ce..0ba64d68 100644 --- a/internal/parser/lr1/items/itemsets.go +++ b/internal/parser/lr1/items/itemsets.go @@ -18,9 +18,9 @@ import ( "fmt" "strings" - "github.com/goccmack/gocc/internal/ast" - "github.com/goccmack/gocc/internal/parser/first" - "github.com/goccmack/gocc/internal/parser/symbols" + "github.com/maxcalandrelli/gocc/internal/ast" + "github.com/maxcalandrelli/gocc/internal/parser/first" + "github.com/maxcalandrelli/gocc/internal/parser/symbols" ) //A list of a list of Items. diff --git a/internal/parser/lr1/items/rowconflicts.go b/internal/parser/lr1/items/rowconflicts.go index 2a6ca010..b5697b00 100644 --- a/internal/parser/lr1/items/rowconflicts.go +++ b/internal/parser/lr1/items/rowconflicts.go @@ -15,7 +15,7 @@ package items import ( - "github.com/goccmack/gocc/internal/parser/lr1/action" + "github.com/maxcalandrelli/gocc/internal/parser/lr1/action" ) /* diff --git a/internal/parser/lr1/items/testdata_test.go b/internal/parser/lr1/items/testdata_test.go index 692c6bb1..4ac4b9a0 100644 --- a/internal/parser/lr1/items/testdata_test.go +++ b/internal/parser/lr1/items/testdata_test.go @@ -17,10 +17,10 @@ package items import ( "testing" - "github.com/goccmack/gocc/internal/ast" - "github.com/goccmack/gocc/internal/frontend/parser" - "github.com/goccmack/gocc/internal/frontend/scanner" - "github.com/goccmack/gocc/internal/frontend/token" + "github.com/maxcalandrelli/gocc/internal/ast" + "github.com/maxcalandrelli/gocc/internal/frontend/parser" + "github.com/maxcalandrelli/gocc/internal/frontend/scanner" + "github.com/maxcalandrelli/gocc/internal/frontend/token" ) const G1 = ` diff --git a/internal/parser/symbols/symbols.go b/internal/parser/symbols/symbols.go index 518f268c..887d61de 100644 --- a/internal/parser/symbols/symbols.go +++ b/internal/parser/symbols/symbols.go @@ -21,7 +21,7 @@ import ( "fmt" "strings" - "github.com/goccmack/gocc/internal/ast" + "github.com/maxcalandrelli/gocc/internal/ast" ) type Symbols struct { diff --git a/internal/test/t1/errors/errors.go b/internal/test/t1/errors/errors.go old mode 100755 new mode 100644 index baa0603d..9d595821 --- a/internal/test/t1/errors/errors.go +++ b/internal/test/t1/errors/errors.go @@ -6,7 +6,7 @@ import ( "fmt" "strings" - "github.com/goccmack/gocc/internal/test/t1/token" + "github.com/maxcalandrelli/gocc/internal/test/t1/token" ) type ErrorSymbol interface { diff --git a/internal/test/t1/lexer/acttab.go b/internal/test/t1/lexer/acttab.go old mode 100755 new mode 100644 index 8e2fcd2c..668b985d --- a/internal/test/t1/lexer/acttab.go +++ b/internal/test/t1/lexer/acttab.go @@ -5,7 +5,7 @@ package lexer import ( "fmt" - "github.com/goccmack/gocc/internal/test/t1/token" + "github.com/maxcalandrelli/gocc/internal/test/t1/token" ) type ActionTable [NumStates]ActionRow diff --git a/internal/test/t1/lexer/lexer.go b/internal/test/t1/lexer/lexer.go old mode 100755 new mode 100644 index 27ea8ec0..7687ed75 --- a/internal/test/t1/lexer/lexer.go +++ b/internal/test/t1/lexer/lexer.go @@ -6,7 +6,7 @@ import ( "io/ioutil" "unicode/utf8" - "github.com/goccmack/gocc/internal/test/t1/token" + "github.com/maxcalandrelli/gocc/internal/test/t1/token" ) const ( diff --git a/internal/test/t1/lexer/transitiontable.go b/internal/test/t1/lexer/transitiontable.go old mode 100755 new mode 100644 diff --git a/internal/test/t1/parser/action.go b/internal/test/t1/parser/action.go old mode 100755 new mode 100644 diff --git a/internal/test/t1/parser/actiontable.go b/internal/test/t1/parser/actiontable.go old mode 100755 new mode 100644 diff --git a/internal/test/t1/parser/gototable.go b/internal/test/t1/parser/gototable.go old mode 100755 new mode 100644 diff --git a/internal/test/t1/parser/parser.go b/internal/test/t1/parser/parser.go old mode 100755 new mode 100644 index c30faef3..9f35838c --- a/internal/test/t1/parser/parser.go +++ b/internal/test/t1/parser/parser.go @@ -6,8 +6,8 @@ import ( "fmt" "strings" - parseError "github.com/goccmack/gocc/internal/test/t1/errors" - "github.com/goccmack/gocc/internal/test/t1/token" + parseError "github.com/maxcalandrelli/gocc/internal/test/t1/errors" + "github.com/maxcalandrelli/gocc/internal/test/t1/token" ) const ( diff --git a/internal/test/t1/parser/productionstable.go b/internal/test/t1/parser/productionstable.go old mode 100755 new mode 100644 diff --git a/internal/test/t1/t1_test.go b/internal/test/t1/t1_test.go index 2371d78e..9574b302 100644 --- a/internal/test/t1/t1_test.go +++ b/internal/test/t1/t1_test.go @@ -3,9 +3,9 @@ package t1 import ( "testing" - "github.com/goccmack/gocc/internal/test/t1/errors" - "github.com/goccmack/gocc/internal/test/t1/lexer" - "github.com/goccmack/gocc/internal/test/t1/parser" + "github.com/maxcalandrelli/gocc/internal/test/t1/errors" + "github.com/maxcalandrelli/gocc/internal/test/t1/lexer" + "github.com/maxcalandrelli/gocc/internal/test/t1/parser" ) func Test1(t *testing.T) { diff --git a/internal/test/t1/token/token.go b/internal/test/t1/token/token.go old mode 100755 new mode 100644 diff --git a/internal/test/t1/util/litconv.go b/internal/test/t1/util/litconv.go old mode 100755 new mode 100644 diff --git a/internal/test/t1/util/rune.go b/internal/test/t1/util/rune.go old mode 100755 new mode 100644 diff --git a/internal/token/gen/gen.go b/internal/token/gen/gen.go index eb7f2781..f237eeed 100644 --- a/internal/token/gen/gen.go +++ b/internal/token/gen/gen.go @@ -15,8 +15,8 @@ package gen import ( - "github.com/goccmack/gocc/internal/token" - "github.com/goccmack/gocc/internal/token/gen/golang" + "github.com/maxcalandrelli/gocc/internal/token" + "github.com/maxcalandrelli/gocc/internal/token/gen/golang" ) func Gen(pkg, outdir string, tokenMap *token.TokenMap) { diff --git a/internal/token/gen/golang/token.go b/internal/token/gen/golang/token.go index 86fd2981..b5a603b3 100644 --- a/internal/token/gen/golang/token.go +++ b/internal/token/gen/golang/token.go @@ -21,8 +21,8 @@ import ( "path" "text/template" - "github.com/goccmack/gocc/internal/io" - "github.com/goccmack/gocc/internal/token" + "github.com/maxcalandrelli/gocc/internal/io" + "github.com/maxcalandrelli/gocc/internal/token" ) func GenToken(pkg, outdir string, tokMap *token.TokenMap) { @@ -63,10 +63,18 @@ import ( "fmt" ) +type UserContext interface {} + +type ParseContext struct { + Remaining []byte +} + type Token struct { Type - Lit []byte + Lit []byte Pos + Context *ParseContext + User UserContext } type Type int diff --git a/internal/util/gen/gen.go b/internal/util/gen/gen.go index 39732005..6a179024 100644 --- a/internal/util/gen/gen.go +++ b/internal/util/gen/gen.go @@ -1,7 +1,7 @@ package gen import ( - "github.com/goccmack/gocc/internal/util/gen/golang" + "github.com/maxcalandrelli/gocc/internal/util/gen/golang" ) func Gen(outDir string) { diff --git a/internal/util/gen/golang/litconv.go b/internal/util/gen/golang/litconv.go index c5f859ad..b78d36c6 100644 --- a/internal/util/gen/golang/litconv.go +++ b/internal/util/gen/golang/litconv.go @@ -3,7 +3,7 @@ package golang import ( "path" - "github.com/goccmack/gocc/internal/io" + "github.com/maxcalandrelli/gocc/internal/io" ) func GenLitConv(outDir string) { diff --git a/internal/util/gen/golang/rune.go b/internal/util/gen/golang/rune.go index 4561801c..cf814b56 100644 --- a/internal/util/gen/golang/rune.go +++ b/internal/util/gen/golang/rune.go @@ -3,7 +3,7 @@ package golang import ( "path" - "github.com/goccmack/gocc/internal/io" + "github.com/maxcalandrelli/gocc/internal/io" ) func GenRune(outDir string) { diff --git a/main.go b/main.go index 83e6a26c..53eded8b 100644 --- a/main.go +++ b/main.go @@ -13,7 +13,34 @@ // limitations under the License. //Gocc is LR1 parser generator for go written in go. The generator uses a BNF with very easy to use SDT rules. -//Please see https://github.com/goccmack/gocc/ for more documentation. +//Please see https://github.com/maxcalandrelli/gocc/ for more documentation. + +/* + Modified by: Massimiliano Calandrelli + + Changes: + changed all go files using import from + https://github.com/maxcalandrelli/gocc + to import from + https://github.com/maxcalandrelli/gocc + use original gocc (https://github.com/maxcalandrelli/gocc) to reproduce + the initial (handwritten?) parser + added file internal/ast/sdthlp.go + changed file spec/gocc.bnf + add negative char and char ranges to lexer + changed file internal/lexer/items/disjunctrangeset.go + changed file internal/ast/lexcharlit.go + changed file internal/ast/lexcharrange.go + added support for a simple form of context-sensitive parsing by + providing the ability to store/restore scanner position and invoke + a different lexer/parser pair while scanning + changed template for token generation in internal/lexer/gen/token.go + changed template for lexer generation in internal/lexer/gen/lexer.go + changed template for parser generation in internal/lexer/gen/parse.go + changed template for parser generation in internal/lexer/gen/productionstable.go + +*/ + package main import ( @@ -25,22 +52,22 @@ import ( "path" "strings" - "github.com/goccmack/gocc/internal/ast" - "github.com/goccmack/gocc/internal/config" - "github.com/goccmack/gocc/internal/frontend/parser" - "github.com/goccmack/gocc/internal/frontend/scanner" - "github.com/goccmack/gocc/internal/frontend/token" - "github.com/goccmack/gocc/internal/io" - genLexer "github.com/goccmack/gocc/internal/lexer/gen/golang" - lexItems "github.com/goccmack/gocc/internal/lexer/items" - "github.com/goccmack/gocc/internal/parser/first" - genParser "github.com/goccmack/gocc/internal/parser/gen" - lr1Action "github.com/goccmack/gocc/internal/parser/lr1/action" - lr1Items "github.com/goccmack/gocc/internal/parser/lr1/items" - "github.com/goccmack/gocc/internal/parser/symbols" - outToken "github.com/goccmack/gocc/internal/token" - genToken "github.com/goccmack/gocc/internal/token/gen" - genUtil "github.com/goccmack/gocc/internal/util/gen" + "github.com/maxcalandrelli/gocc/internal/ast" + "github.com/maxcalandrelli/gocc/internal/config" + "github.com/maxcalandrelli/gocc/internal/frontend/lexer" + "github.com/maxcalandrelli/gocc/internal/frontend/parser" + _ "github.com/maxcalandrelli/gocc/internal/frontend/token" + "github.com/maxcalandrelli/gocc/internal/io" + genLexer "github.com/maxcalandrelli/gocc/internal/lexer/gen/golang" + lexItems "github.com/maxcalandrelli/gocc/internal/lexer/items" + "github.com/maxcalandrelli/gocc/internal/parser/first" + genParser "github.com/maxcalandrelli/gocc/internal/parser/gen" + lr1Action "github.com/maxcalandrelli/gocc/internal/parser/lr1/action" + lr1Items "github.com/maxcalandrelli/gocc/internal/parser/lr1/items" + "github.com/maxcalandrelli/gocc/internal/parser/symbols" + outToken "github.com/maxcalandrelli/gocc/internal/token" + genToken "github.com/maxcalandrelli/gocc/internal/token/gen" + genUtil "github.com/maxcalandrelli/gocc/internal/util/gen" ) func main() { @@ -59,16 +86,21 @@ func main() { flag.Usage() } - scanner := &scanner.Scanner{} + /* + scanner := &scanner.Scanner{} + scanner.Init(srcBuffer, token.FRONTENDTokens) + + parser := parser.NewParser(parser.ActionTable, parser.GotoTable, parser.ProductionsTable, token.FRONTENDTokens) + */ + srcBuffer, err := ioutil.ReadFile(cfg.SourceFile()) if err != nil { fmt.Println(err) os.Exit(1) } - - scanner.Init(srcBuffer, token.FRONTENDTokens) - parser := parser.NewParser(parser.ActionTable, parser.GotoTable, parser.ProductionsTable, token.FRONTENDTokens) - grammar, err := parser.Parse(scanner) + scanner := lexer.NewLexer(srcBuffer) + p := parser.NewParser() + grammar, err := p.Parse(scanner) if err != nil { fmt.Printf("Parse error: %s\n", err) os.Exit(1) diff --git a/spec/gocc2.ebnf b/spec/gocc2.ebnf index e9ada3e8..ad40ccab 100644 --- a/spec/gocc2.ebnf +++ b/spec/gocc2.ebnf @@ -12,9 +12,116 @@ // See the License for the specific language governing permissions and // limitations under the License. + +!comment : _lineComment | _blockComment ; +_lineComment : '/' '/' {.} '\n' ; +_blockComment : '/' '*' {. | '*'} '*' '/' ; +!whitespace : ' ' | '\t' | '\n' | '\r' ; + +tokId : _tokId ; + +_tokId : _lowcase {_id_char} ; + +_lowcase : 'a'-'z' ; + +_id_char : _upcase | _lowcase | '_' | _digit ; + +_upcase : 'A'-'Z' ; + +_digit : '0' '9' ; + +regDefId : '_' {_id_char} ; + +ignoredTokId : '!' _tokId ; + +char_lit : '\'' (_unicode_value | _byte_value) '\'' ; + +_unicode_value + : . // Any UTF-8 character literal + | _little_u_value + | _big_u_value + | _escaped_char + ; + +_byte_value + : _octal_byte_value + | _hex_byte_value + ; + +_little_u_value + : '\\' 'u' _hex_digit _hex_digit _hex_digit _hex_digit + ; + +_big_u_value + : '\\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit + _hex_digit _hex_digit _hex_digit _hex_digit + ; + +_escaped_char + : '\\' ( 'a' | 'b' | 'f' | 'n' | 'r' | 't' | 'v' | '\\' | '\'' | '"' ) + ; + +_octal_byte_value + : '\\' _octal_digit _octal_digit _octal_digit + ; + +_hex_byte_value + : '\\' 'x' _hex_digit _hex_digit + ; + +_octal_digit + : '0' - '7' + ; + +_hex_digit + : '0' - '9' + | 'A' - 'F' + | 'a' - 'f' + ; + + +_hex_digit_alt + : '0' - '9' + | 'A' - 'F' + | 'a' - 'z' + | ~ ( 'g' - 'z') + ; + +prodId + : _upcase {_id_char} + ; + +g_sdt_lit + : '<' '<' . {.} '>' '>' + ; + + +string_lit + : _raw_string + | _interpreted_string + ; + +_raw_string + : '`' {.} '`' + ; + +_interpreted_string + : '"' { _unicode_value | _byte_value } '"' + ; + + + + + + + + + + + /*** Syntactic items ***/ -<< import "github.com/goccmack/gocc/internal/ast" >> +<< import "github.com/maxcalandrelli/gocc/internal/ast" >> Grammar : LexicalPart SyntaxPart << ast.NewGrammar($0, $1) >> | LexicalPart << ast.NewGrammar($0, nil) >> @@ -43,15 +150,17 @@ LexAlt : LexTerm << ast.NewLexAlt($0) >> ; LexTerm : "." << ast.LexDOT, nil >> - | char_lit << ast.NewLexCharLit($0) >> - | char_lit "-" char_lit << ast.NewLexCharRange($0, $2) >> + | char_lit << ast.NewLexCharLit($0, false) >> + | "~" char_lit << ast.NewLexCharLit($0, true) >> + | char_lit "-" char_lit << ast.NewLexCharRange($0, $2, false) >> + | "~" "(" char_lit "-" char_lit ")" << ast.NewLexCharRange($2, $4, true) >> | regDefId << ast.NewLexRegDefId($0) >> | "[" LexPattern "]" << ast.NewLexOptPattern($1) >> | "{" LexPattern "}" << ast.NewLexRepPattern($1) >> - | "(" LexPattern ")" << ast.NewLexGroupPattern($1) >> + | "(" LexPattern ")" << ast.NewLexGroupPattern($1) >> ; -SyntaxPart : FileHeader SyntaxProdList << ast.NewSyntaxPart($0, $1) >> +SyntaxPart : FileHeader SyntaxProdList << ast.NewSyntaxPart($0, $1) >> | SyntaxProdList << ast.NewSyntaxPart(nil, $0) >> ; @@ -86,36 +195,3 @@ Symbol : prodId << ast.NewSyntaxProdId($0) >> | string_lit << ast.NewStringLit($0) >> ; -/******** -Lexical items -The basic unit of input to the lexical analyser is a UTF-8 encoded Unicode code point, defined as: - -_unicode_char : < any Unicode code point > . - -_letter : 'A' ... 'Z' | 'a' ... 'z' | '_' ; - -_digit : '0' ... '9' ; - -char : "'" ( _unicode_value | _byte_value ) "'" ; - -_unicode_value : _unicode_char | _little_u_value | _big_u_value | _escaped_char ; -_byte_value : _octal_byte_value | _hex_byte_value ; -_octal_byte_value : `\` _octal_digit _octal_digit _octal_digit ; -_hex_byte_value : `\` "x" _hex_digit _hex_digit ; -_little_u_value : `\` "u" _hex_digit _hex_digit _hex_digit _hex_digit ; -_big_u_value : `\` "U" _hex_digit _hex_digit _hex_digit _hex_digit - _hex_digit _hex_digit _hex_digit _hex_digit ; -_escaped_char : `\` ( "a" | "b" | "f" | "n" | "r" | "t" | "v" | `\` | `'` | `"` ) ; - -id : _letter (_letter | _digit)* ; - -string : _raw_string | _interpreted_string ; -_raw_string : "`" _unicode_char* "`" ; -_interpreted_string : `"` ( _unicode_value | byte_value )* `"` ; - -g_sdt_lit : '<' '<' _unicode_char+ '>' '>' -**********/ - -/*** TODO: *** -1. Handle reserved words correctly so that user cannot write reserved words in his grammar. E.g.: string_lit, prodId, etc. -***/ From f5e49f758632ba6e2634a886ece5c459485a0b06 Mon Sep 17 00:00:00 2001 From: Massimiliano Calandrelli Date: Fri, 4 Oct 2019 13:29:03 +0200 Subject: [PATCH 02/33] ... --- .gitignore | 4 +- internal/ast/fileheader.go | 4 +- internal/ast/grammar.go | 7 +- internal/ast/lexcharlit.go | 13 +- internal/ast/lexcharrange.go | 6 +- internal/ast/lexignoredtokdef.go | 4 +- internal/ast/leximport.go | 6 +- internal/ast/lexregdef.go | 4 +- internal/ast/lexregdefid.go | 6 +- internal/ast/lextokdef.go | 4 +- internal/ast/reconcile.go | 9 + internal/ast/sdthlp.go | 5 +- internal/ast/syntaxalts.go | 7 + internal/ast/syntaxbody.go | 116 +- internal/ast/syntaxempty.go | 17 +- internal/ast/syntaxeof.go | 15 +- internal/ast/syntaxerror.go | 17 +- internal/ast/syntaxpart.go | 2 +- internal/ast/syntaxprod.go | 5 +- internal/ast/syntaxprodid.go | 15 +- internal/ast/syntaxstringlit.go | 17 +- internal/ast/syntaxsymbol.go | 7 + internal/ast/syntaxsymbols.go | 13 + internal/ast/syntaxtokid.go | 15 +- internal/config/config.go | 102 +- internal/fe2/LR1_sets.txt | 5250 +++++++++++++++++ .../{frontend_ext => fe2}/errors/errors.go | 2 +- internal/fe2/first.txt | 106 + .../{frontend_ext => fe2}/lexer/acttab.go | 78 +- internal/{frontend_ext => fe2}/lexer/lexer.go | 110 +- .../lexer/transitiontable.go | 852 +-- internal/fe2/lexer_sets.txt | 1875 ++++++ .../{frontend_ext => fe2}/parser/action.go | 0 .../parser/actiontable.go | 2842 +++++---- .../{frontend_ext => fe2}/parser/gototable.go | 740 ++- .../{frontend_ext => fe2}/parser/parser.go | 17 +- .../parser/productionstable.go | 108 +- internal/fe2/terminals.txt | 25 + internal/{frontend_ext => fe2}/token/token.go | 36 +- .../{frontend_ext => fe2}/util/litconv.go | 0 internal/{frontend_ext => fe2}/util/rune.go | 0 internal/frontend | 1 - .../errors/errors.go | 0 .../parser/parser.go | 4 +- .../parser/parser_ut.go | 4 +- .../parser/tables.go | 0 .../parser/tables_uncompressed.go | 0 .../scanner/scanner.go | 4 +- .../scanner/scanner_test.go | 0 .../token/token.go | 6 +- .../token/tokens.go | 8 +- internal/parser/first/first.go | 14 +- .../parser/gen/golang/productionstable.go | 19 +- internal/parser/lr1/items/item.go | 14 +- internal/parser/lr1/items/itemsets.go | 4 +- internal/parser/symbols/symbols.go | 6 +- internal/test/t1/parser/parser.go | 4 +- main.go | 36 +- spec/gocc2.ebnf | 322 +- spec/test.bnf | 21 + stock/main.go | 175 + 61 files changed, 10910 insertions(+), 2193 deletions(-) create mode 100644 internal/ast/reconcile.go create mode 100644 internal/fe2/LR1_sets.txt rename internal/{frontend_ext => fe2}/errors/errors.go (95%) create mode 100644 internal/fe2/first.txt rename internal/{frontend_ext => fe2}/lexer/acttab.go (97%) rename internal/{frontend_ext => fe2}/lexer/lexer.go (80%) rename internal/{frontend_ext => fe2}/lexer/transitiontable.go (87%) create mode 100644 internal/fe2/lexer_sets.txt rename internal/{frontend_ext => fe2}/parser/action.go (100%) rename internal/{frontend_ext => fe2}/parser/actiontable.go (74%) rename internal/{frontend_ext => fe2}/parser/gototable.go (83%) rename internal/{frontend_ext => fe2}/parser/parser.go (94%) rename internal/{frontend_ext => fe2}/parser/productionstable.go (82%) create mode 100644 internal/fe2/terminals.txt rename internal/{frontend_ext => fe2}/token/token.go (80%) rename internal/{frontend_ext => fe2}/util/litconv.go (100%) rename internal/{frontend_ext => fe2}/util/rune.go (100%) delete mode 120000 internal/frontend rename internal/{frontend_orig => frontend}/errors/errors.go (100%) rename internal/{frontend_orig => frontend}/parser/parser.go (97%) rename internal/{frontend_orig => frontend}/parser/parser_ut.go (97%) rename internal/{frontend_orig => frontend}/parser/tables.go (100%) rename internal/{frontend_orig => frontend}/parser/tables_uncompressed.go (100%) rename internal/{frontend_orig => frontend}/scanner/scanner.go (99%) rename internal/{frontend_orig => frontend}/scanner/scanner_test.go (100%) rename internal/{frontend_orig => frontend}/token/token.go (97%) rename internal/{frontend_orig => frontend}/token/tokens.go (68%) create mode 100644 spec/test.bnf create mode 100644 stock/main.go diff --git a/.gitignore b/.gitignore index db00234a..ff265a63 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ gocc -sm_* \ No newline at end of file +sm_* +build/ + diff --git a/internal/ast/fileheader.go b/internal/ast/fileheader.go index 5c3c97c5..a7a8ee84 100644 --- a/internal/ast/fileheader.go +++ b/internal/ast/fileheader.go @@ -16,8 +16,6 @@ package ast import ( "fmt" - - "github.com/maxcalandrelli/gocc/internal/frontend/token" ) type FileHeader struct { @@ -27,7 +25,7 @@ type FileHeader struct { func NewFileHeader(sdtLit interface{}) (*FileHeader, error) { sh := &FileHeader{ - SDTLit: SDTVal(sdtLit.(*token.Token)), + SDTLit: SDTVal(getString(sdtLit)), } sh.str = fmt.Sprintf("<< %s >>", sh.SDTLit) return sh, nil diff --git a/internal/ast/grammar.go b/internal/ast/grammar.go index 2a886855..8dada5bc 100644 --- a/internal/ast/grammar.go +++ b/internal/ast/grammar.go @@ -18,6 +18,8 @@ import ( "errors" "fmt" "os" + + "github.com/maxcalandrelli/gocc/internal/config" ) type Grammar struct { @@ -56,7 +58,7 @@ func consistent(g *Grammar) (err error) { defs[tok.id] = true } for _, prod := range g.SyntaxPart.ProdList { - if len(prod.Body.Symbols) == 0 { + if prod.Body.Missing() { return fmt.Errorf("empty production alternative: Maybe you are missing the \"empty\" keyword in %q", prod) } defs[prod.Id] = true @@ -77,7 +79,8 @@ func consistent(g *Grammar) (err error) { } for s, in := range used { if _, ok := defs[s]; !ok { - if s == "empty" || s == "error" { + switch s { + case config.SYMBOL_EMPTY, config.SYMBOL_ERROR: continue } if s[0] >= 'A' && s[0] <= 'Z' { diff --git a/internal/ast/lexcharlit.go b/internal/ast/lexcharlit.go index 964e0b0a..e6f332bd 100644 --- a/internal/ast/lexcharlit.go +++ b/internal/ast/lexcharlit.go @@ -15,7 +15,6 @@ package ast import ( - "github.com/maxcalandrelli/gocc/internal/frontend/token" "github.com/maxcalandrelli/gocc/internal/util" ) @@ -26,16 +25,20 @@ type LexCharLit struct { Negate bool } -func NewLexCharLit(tok interface{}, negate bool) (*LexCharLit, error) { +func NewLexCharLit(tok interface{}) (*LexCharLit, error) { + return newLexCharLit(tok, false), nil +} + +func NewLexCharLitExt(tok interface{}, negate bool) (*LexCharLit, error) { return newLexCharLit(tok, negate), nil } func newLexCharLit(tok interface{}, negate bool) *LexCharLit { c := new(LexCharLit) - t := tok.(*token.Token) + lit := []byte(getString(tok)) - c.Val = util.LitToRune(t.Lit) - c.Lit = t.Lit + c.Val = util.LitToRune(lit) + c.Lit = lit c.s = util.RuneToString(c.Val) c.Negate = negate diff --git a/internal/ast/lexcharrange.go b/internal/ast/lexcharrange.go index 1707540d..0e5fbb65 100644 --- a/internal/ast/lexcharrange.go +++ b/internal/ast/lexcharrange.go @@ -25,7 +25,11 @@ type LexCharRange struct { Negate bool } -func NewLexCharRange(from, to interface{}, negate bool) (*LexCharRange, error) { +func NewLexCharRange(from, to interface{}) (*LexCharRange, error) { + return NewLexCharRangeExt(from, to, false) +} + +func NewLexCharRangeExt(from, to interface{}, negate bool) (*LexCharRange, error) { cr := &LexCharRange{ From: newLexCharLit(from, negate), To: newLexCharLit(to, negate), diff --git a/internal/ast/lexignoredtokdef.go b/internal/ast/lexignoredtokdef.go index b9c9919c..015c95f9 100644 --- a/internal/ast/lexignoredtokdef.go +++ b/internal/ast/lexignoredtokdef.go @@ -17,8 +17,6 @@ package ast import ( "fmt" "strings" - - "github.com/maxcalandrelli/gocc/internal/frontend/token" ) type LexIgnoredTokDef struct { @@ -28,7 +26,7 @@ type LexIgnoredTokDef struct { func NewLexIgnoredTokDef(tokId, lexPattern interface{}) (*LexIgnoredTokDef, error) { tokDef := &LexIgnoredTokDef{ - id: string(tokId.(*token.Token).Lit), + id: getString(tokId), pattern: lexPattern.(*LexPattern), } return tokDef, nil diff --git a/internal/ast/leximport.go b/internal/ast/leximport.go index 235cb2b4..61a2ee1f 100644 --- a/internal/ast/leximport.go +++ b/internal/ast/leximport.go @@ -16,8 +16,6 @@ package ast import ( "fmt" - - "github.com/maxcalandrelli/gocc/internal/frontend/token" ) type LexImport struct { @@ -27,7 +25,7 @@ type LexImport struct { func NewLexImport(regDefId, extFunc interface{}) (*LexImport, error) { return &LexImport{ - Id: string(regDefId.(*token.Token).Lit), + Id: getString(regDefId), ExtFunc: getExtFunc(extFunc), }, nil } @@ -41,6 +39,6 @@ func (this *LexImport) String() string { } func getExtFunc(strLit interface{}) string { - lit := strLit.(*token.Token).Lit + lit := getString(strLit) return string(lit[1 : len(lit)-1]) } diff --git a/internal/ast/lexregdef.go b/internal/ast/lexregdef.go index 069496d5..d320352e 100644 --- a/internal/ast/lexregdef.go +++ b/internal/ast/lexregdef.go @@ -17,8 +17,6 @@ package ast import ( "fmt" "strings" - - "github.com/maxcalandrelli/gocc/internal/frontend/token" ) type LexRegDef struct { @@ -28,7 +26,7 @@ type LexRegDef struct { func NewLexRegDef(regDefId, lexPattern interface{}) (*LexRegDef, error) { regDef := &LexRegDef{ - id: string(regDefId.(*token.Token).Lit), + id: getString(regDefId), pattern: lexPattern.(*LexPattern), } return regDef, nil diff --git a/internal/ast/lexregdefid.go b/internal/ast/lexregdefid.go index e07b4b6b..5b94e7f8 100644 --- a/internal/ast/lexregdefid.go +++ b/internal/ast/lexregdefid.go @@ -14,17 +14,13 @@ package ast -import ( - "github.com/maxcalandrelli/gocc/internal/frontend/token" -) - type LexRegDefId struct { Id string } func NewLexRegDefId(regDefId interface{}) (*LexRegDefId, error) { return &LexRegDefId{ - Id: string(regDefId.(*token.Token).Lit), + Id: getString(regDefId), }, nil } diff --git a/internal/ast/lextokdef.go b/internal/ast/lextokdef.go index 61f8f7c5..ff7d2b22 100644 --- a/internal/ast/lextokdef.go +++ b/internal/ast/lextokdef.go @@ -18,8 +18,6 @@ import ( "bytes" "fmt" "strings" - - "github.com/maxcalandrelli/gocc/internal/frontend/token" ) type LexTokDef struct { @@ -29,7 +27,7 @@ type LexTokDef struct { func NewLexTokDef(tokId, lexPattern interface{}) (*LexTokDef, error) { tokDef := &LexTokDef{ - id: string(tokId.(*token.Token).Lit), + id: getString(tokId), pattern: lexPattern.(*LexPattern), } return tokDef, nil diff --git a/internal/ast/reconcile.go b/internal/ast/reconcile.go new file mode 100644 index 00000000..8356704c --- /dev/null +++ b/internal/ast/reconcile.go @@ -0,0 +1,9 @@ +package ast + +var ( + StringGetter func(interface{}) string +) + +func getString(v interface{}) string { + return StringGetter(v) +} diff --git a/internal/ast/sdthlp.go b/internal/ast/sdthlp.go index 97fa6a69..be8102f8 100644 --- a/internal/ast/sdthlp.go +++ b/internal/ast/sdthlp.go @@ -7,12 +7,9 @@ package ast import ( "regexp" "strings" - - "github.com/maxcalandrelli/gocc/internal/frontend/token" ) -func SDTVal(T *token.Token) string { - sdt := string(T.Lit) +func SDTVal(sdt string) string { rex, err := regexp.Compile("\\$[0-9]+") if err != nil { panic(err) diff --git a/internal/ast/syntaxalts.go b/internal/ast/syntaxalts.go index 69ebf026..316ce46e 100644 --- a/internal/ast/syntaxalts.go +++ b/internal/ast/syntaxalts.go @@ -14,12 +14,19 @@ package ast +import ( + "fmt" +) + type SyntaxAlts []*SyntaxBody +type stringer fmt.GoStringer func NewSyntaxAlts(body interface{}) (SyntaxAlts, error) { + //fmt.Printf(" NewFirstAlt(%v)\n", body) return SyntaxAlts{(body.(*SyntaxBody))}, nil } func AddSyntaxAlt(alts, body interface{}) (SyntaxAlts, error) { + //fmt.Printf(" NewAlt(%v)\n", body) return append(alts.(SyntaxAlts), body.(*SyntaxBody)), nil } diff --git a/internal/ast/syntaxbody.go b/internal/ast/syntaxbody.go index 9aaa08c2..b68c58f5 100644 --- a/internal/ast/syntaxbody.go +++ b/internal/ast/syntaxbody.go @@ -16,17 +16,52 @@ package ast import ( "fmt" + "runtime/debug" - "github.com/maxcalandrelli/gocc/internal/frontend/token" + "github.com/maxcalandrelli/gocc/internal/config" ) type SyntaxBody struct { Error bool Symbols SyntaxSymbols SDT string + _x debug.GCStats +} + +func checkSymbols(symbols interface{}) interface{} { + if syms, _ := symbols.(SyntaxSymbols); syms != nil { + for i, s := range syms { + switch s.(type) { + case SyntaxEmpty: + syms[i] = emptySymbol + case SyntaxError: + syms[i] = errorSymbol + case SyntaxTokId: + switch s.SymbolString() { + case config.SYMBOL_EMPTY: + syms[i] = emptySymbol + case config.SYMBOL_ERROR: + syms[i] = errorSymbol + } + } + } + return syms + } + return symbols } func NewSyntaxBody(symbols, sdtLit interface{}) (*SyntaxBody, error) { + checkSymbols(symbols) + if syms, _ := symbols.(SyntaxSymbols); syms != nil { + for i, s := range syms { + switch { + case s.IsEpsilon(): + syms[i] = emptySymbol + case s.IsError(): + syms[i] = errorSymbol + } + } + } syntaxBody := &SyntaxBody{ Error: false, } @@ -34,25 +69,92 @@ func NewSyntaxBody(symbols, sdtLit interface{}) (*SyntaxBody, error) { syntaxBody.Symbols = symbols.(SyntaxSymbols) } if sdtLit != nil { - syntaxBody.SDT = SDTVal(sdtLit.(*token.Token)) + syntaxBody.SDT = SDTVal(getString(sdtLit)) + } + if symbols == nil { + return nil, fmt.Errorf("empty production alternative!") + } + if s, _ := symbols.(SyntaxSymbols); len(s) > 0 && s[0] == emptySymbol { + //fmt.Printf(" NewBody(Empty) Symbols=%#v(%s)\n", syntaxBody.Symbols, syntaxBody.Symbols.String()) + } else if s, _ := symbols.(SyntaxSymbols); len(s) > 0 && s[0] == errorSymbol { + //fmt.Printf(" NewBody(Error) Symbols=%#v(%s)\n", syntaxBody.Symbols, syntaxBody.Symbols.String()) + } else { + //fmt.Printf(" NewBody() Symbols=%#v(%s)\n", syntaxBody.Symbols, syntaxBody.Symbols.String()) + } + return syntaxBody, nil +} + +func NewSyntaxBodyGen(symbols, sdtLit interface{}) (*SyntaxBody, error) { + checkSymbols(symbols) + syntaxBody := &SyntaxBody{ + Error: false, + } + if symbols != nil { + syntaxBody.Symbols = symbols.(SyntaxSymbols) + } + if sdtLit != nil { + syntaxBody.SDT = SDTVal(getString(sdtLit)) + } + if symbols == nil { + return nil, fmt.Errorf("empty production alternative!") + } + if s, _ := symbols.(SyntaxSymbols); len(s) > 0 && s[0] == emptySymbol { + //fmt.Printf(" NewBodyGen(Empty) Symbols=%#v(%s)\n", syntaxBody.Symbols, syntaxBody.Symbols.String()) + } else if s, _ := symbols.(SyntaxSymbols); len(s) > 0 && s[0] == errorSymbol { + //fmt.Printf(" NewBodyGen(Error) Symbols=%#v(%s)\n", syntaxBody.Symbols, syntaxBody.Symbols.String()) + } else { + //fmt.Printf(" NewBodyGen() Symbols=%#v(%s)\n", syntaxBody.Symbols, syntaxBody.Symbols.String()) } return syntaxBody, nil } func NewErrorBody(symbols, sdtLit interface{}) (*SyntaxBody, error) { - body, _ := NewSyntaxBody(symbols, sdtLit) - body.Error = true - return body, nil + if symbols == nil { + return nil, fmt.Errorf("empty production alternative") + } else { + symbols.(SyntaxSymbols)[0] = errorSymbol + } + //fmt.Printf(" NewErrorBody()\n") + if body, err := NewSyntaxBody(symbols, sdtLit); err != nil { + return nil, err + } else { + body.Error = true + return body, nil + } +} + +func NewErrorBodyGen(symbols, sdtLit interface{}) (*SyntaxBody, error) { + syms, _ := symbols.(SyntaxSymbols) + if syms == nil { + syms = SyntaxSymbols{} + } + //fmt.Printf(" NewErrorBodyGen()\n") + if body, err := NewSyntaxBodyGen(append(SyntaxSymbols{errorSymbol}, syms...), sdtLit); err != nil { + return nil, err + } else { + body.Error = true + return body, nil + } } func NewEmptyBody() (*SyntaxBody, error) { - return NewSyntaxBody(nil, nil) + //fmt.Printf(" NewEmptyBody()\n") + return NewSyntaxBody(SyntaxSymbols{emptySymbol}, nil) } -func (this *SyntaxBody) Empty() bool { +func NewEmptyBodyGen() (*SyntaxBody, error) { + //fmt.Printf(" NewEmptyBodyGen()\n") + return NewSyntaxBodyGen(SyntaxSymbols{emptySymbol}, nil) +} + +func (this *SyntaxBody) Missing() bool { return len(this.Symbols) == 0 } +func (this *SyntaxBody) Empty() bool { + return len(this.Symbols) == 1 && (this.Symbols[0] == emptySymbol) +} + func (this *SyntaxBody) String() string { return fmt.Sprintf("%s\t<< %s >>", this.Symbols.String(), this.SDT) } diff --git a/internal/ast/syntaxempty.go b/internal/ast/syntaxempty.go index 80d78c66..094bef89 100644 --- a/internal/ast/syntaxempty.go +++ b/internal/ast/syntaxempty.go @@ -14,14 +14,23 @@ package ast -type SyntaxEmpty int +import ( + "github.com/maxcalandrelli/gocc/internal/config" +) -const EMPTY SyntaxEmpty = 0 +type SyntaxEmpty struct { + string + StdSyntaxSymbol +} + +var emptySymbol = SyntaxEmpty{config.SYMBOL_EMPTY, StdSyntaxSymbol{}} func (SyntaxEmpty) SymbolString() string { - return "empty" + return emptySymbol.string } func (SyntaxEmpty) String() string { - return "empty" + return emptySymbol.string } + +func (SyntaxEmpty) IsEpsilon() bool { return true } diff --git a/internal/ast/syntaxeof.go b/internal/ast/syntaxeof.go index 7aeb6918..60a28a00 100644 --- a/internal/ast/syntaxeof.go +++ b/internal/ast/syntaxeof.go @@ -14,14 +14,21 @@ package ast -type SyntaxEof int +import ( + "github.com/maxcalandrelli/gocc/internal/config" +) -var EOF SyntaxEof = 0 +type SyntaxEof struct { + string + StdSyntaxSymbol +} + +var eofSymbol = SyntaxEof{config.SYMBOL_EOF, StdSyntaxSymbol{}} func (SyntaxEof) SymbolsString() string { - return "$" + return eofSymbol.string } func (SyntaxEof) String() string { - return "$" + return eofSymbol.string } diff --git a/internal/ast/syntaxerror.go b/internal/ast/syntaxerror.go index f653132f..7c08ec70 100644 --- a/internal/ast/syntaxerror.go +++ b/internal/ast/syntaxerror.go @@ -14,14 +14,23 @@ package ast -type SyntaxError int +import ( + "github.com/maxcalandrelli/gocc/internal/config" +) -const errorConst = SyntaxError(-1) +type SyntaxError struct { + string + StdSyntaxSymbol +} + +var errorSymbol = SyntaxError{config.SYMBOL_ERROR, StdSyntaxSymbol{}} func (SyntaxError) SymbolString() string { - return "error" + return errorSymbol.string } func (SyntaxError) String() string { - return "error" + return errorSymbol.string } + +func (SyntaxError) IsError() bool { return true } diff --git a/internal/ast/syntaxpart.go b/internal/ast/syntaxpart.go index cdb88b43..b23d70e8 100644 --- a/internal/ast/syntaxpart.go +++ b/internal/ast/syntaxpart.go @@ -37,7 +37,7 @@ func (this *SyntaxPart) augment() *SyntaxPart { startProd := &SyntaxProd{ Id: "S'", Body: &SyntaxBody{ - Symbols: []SyntaxSymbol{SyntaxProdId(this.ProdList[0].Id)}, + Symbols: []SyntaxSymbol{SyntaxProdId{this.ProdList[0].Id, StdSyntaxSymbol{}}}, }, } newProdList := SyntaxProdList{startProd} diff --git a/internal/ast/syntaxprod.go b/internal/ast/syntaxprod.go index ca377b6e..0f62107b 100644 --- a/internal/ast/syntaxprod.go +++ b/internal/ast/syntaxprod.go @@ -16,8 +16,6 @@ package ast import ( "fmt" - - "github.com/maxcalandrelli/gocc/internal/frontend/token" ) type SyntaxProd struct { @@ -26,7 +24,7 @@ type SyntaxProd struct { } func NewSyntaxProd(prodId, alts interface{}) ([]*SyntaxProd, error) { - pid := string(prodId.(*token.Token).Lit) + pid := getString(prodId) alts1 := alts.(SyntaxAlts) prods := make([]*SyntaxProd, len(alts1)) for i, body := range alts1 { @@ -35,6 +33,7 @@ func NewSyntaxProd(prodId, alts interface{}) ([]*SyntaxProd, error) { Body: body, } } + //fmt.Printf(" NewProd(%s)\n----------------\n", pid) return prods, nil } diff --git a/internal/ast/syntaxprodid.go b/internal/ast/syntaxprodid.go index 4b08d425..53fa1172 100644 --- a/internal/ast/syntaxprodid.go +++ b/internal/ast/syntaxprodid.go @@ -14,21 +14,20 @@ package ast -import ( - "github.com/maxcalandrelli/gocc/internal/frontend/token" -) - // Id or name of a grammar(syntax) production -type SyntaxProdId string +type SyntaxProdId struct { + string + StdSyntaxSymbol +} func NewSyntaxProdId(tok interface{}) (SyntaxProdId, error) { - return SyntaxProdId(string(tok.(*token.Token).Lit)), nil + return SyntaxProdId{getString(tok), StdSyntaxSymbol{}}, nil } func (this SyntaxProdId) SymbolString() string { - return string(this) + return this.string } func (this SyntaxProdId) String() string { - return string(this) + return this.string } diff --git a/internal/ast/syntaxstringlit.go b/internal/ast/syntaxstringlit.go index 950e0322..edc34c50 100644 --- a/internal/ast/syntaxstringlit.go +++ b/internal/ast/syntaxstringlit.go @@ -16,25 +16,26 @@ package ast import ( "fmt" - - "github.com/maxcalandrelli/gocc/internal/frontend/token" ) -type SyntaxStringLit string +type SyntaxStringLit struct { + string + StdSyntaxSymbol +} func NewStringLit(tok interface{}) (SyntaxStringLit, error) { - lit := tok.(*token.Token).Lit - return SyntaxStringLit(lit[1 : len(lit)-1]), nil + lit := getString(tok) + return SyntaxStringLit{lit[1 : len(lit)-1], StdSyntaxSymbol{}}, nil } func (this SyntaxStringLit) SymbolString() string { - return string(this) + return this.string } func (this SyntaxStringLit) String() string { - return fmt.Sprintf("\"%s\"", string(this)) + return fmt.Sprintf("\"%s\"", this.string) } func (this SyntaxStringLit) Bytes() []byte { - return []byte(this) + return []byte(this.string) } diff --git a/internal/ast/syntaxsymbol.go b/internal/ast/syntaxsymbol.go index 01571ee5..25b361f6 100644 --- a/internal/ast/syntaxsymbol.go +++ b/internal/ast/syntaxsymbol.go @@ -20,9 +20,16 @@ All syntax symbols are types of string type SyntaxSymbol interface { SymbolString() string String() string + IsError() bool + IsEpsilon() bool gSymbol() } +type StdSyntaxSymbol struct{} + +func (StdSyntaxSymbol) IsError() bool { return false } +func (StdSyntaxSymbol) IsEpsilon() bool { return false } + func (SyntaxEmpty) gSymbol() {} func (SyntaxEof) gSymbol() {} func (SyntaxError) gSymbol() {} diff --git a/internal/ast/syntaxsymbols.go b/internal/ast/syntaxsymbols.go index fcb8d84c..40a0a7f8 100644 --- a/internal/ast/syntaxsymbols.go +++ b/internal/ast/syntaxsymbols.go @@ -17,6 +17,8 @@ package ast import ( "fmt" "strings" + + "github.com/maxcalandrelli/gocc/internal/config" ) type SyntaxSymbols []SyntaxSymbol @@ -39,3 +41,14 @@ func (this SyntaxSymbols) String() string { } return w.String() } + +func NewSyntaxSymbolsFromToken(tok interface{}) (SyntaxSymbols, error) { + switch getString(tok) { + case config.SYMBOL_EMPTY: + return SyntaxSymbols{emptySymbol}, nil + case config.SYMBOL_ERROR: + return SyntaxSymbols{errorSymbol}, nil + } + sym, err := NewStringLit(tok) + return SyntaxSymbols{sym}, err +} diff --git a/internal/ast/syntaxtokid.go b/internal/ast/syntaxtokid.go index 80e89588..3b83d121 100644 --- a/internal/ast/syntaxtokid.go +++ b/internal/ast/syntaxtokid.go @@ -14,20 +14,19 @@ package ast -import ( - "github.com/maxcalandrelli/gocc/internal/frontend/token" -) - -type SyntaxTokId string +type SyntaxTokId struct { + string + StdSyntaxSymbol +} func NewTokId(tokId interface{}) (SyntaxTokId, error) { - return SyntaxTokId(string(tokId.(*token.Token).Lit)), nil + return SyntaxTokId{getString(tokId), StdSyntaxSymbol{}}, nil } func (this SyntaxTokId) SymbolString() string { - return string(this) + return this.string } func (this SyntaxTokId) String() string { - return string(this) + return this.string } diff --git a/internal/config/config.go b/internal/config/config.go index 26d1b88b..30713f68 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -25,45 +25,64 @@ import ( "strings" ) -type Config interface { - Help() bool - Verbose() bool - Zip() bool - AllowUnreachable() bool - AutoResolveLRConf() bool - SourceFile() string - OutDir() string - - NoLexer() bool - DebugLexer() bool - DebugParser() bool - - ErrorsDir() string - ParserDir() string - ScannerDir() string - TokenDir() string - - ProjectName() string - Package() string - - PrintParams() -} - -type ConfigRecord struct { - workingDir string - - allowUnreachable *bool - autoResolveLRConf *bool - debugLexer *bool - debugParser *bool - help *bool - noLexer *bool - outDir string - pkg string - srcFile string - verbose *bool - zip *bool -} +const ( + DISPLAY_SYMBOL_EMPTY = "ε" + DISPLAY_SYMBOL_ERROR = "λ(λάθος)" + DISPLAY_SYMBOL_INVALID = "ά(άκυρος)" + DISPLAY_SYMBOL_EOF = "Ω" + SYMBOL_EMPTY = "empty" + SYMBOL_ERROR = "error" + SYMBOL_INVALID = "" + SYMBOL_EOF = "Ω" +) + +type ( + Config interface { + Help() bool + Verbose() bool + Zip() bool + AllowUnreachable() bool + AutoResolveLRConf() bool + SourceFile() string + OutDir() string + + NoLexer() bool + DebugLexer() bool + DebugParser() bool + StockCompiler() bool + + ErrorsDir() string + ParserDir() string + ScannerDir() string + TokenDir() string + + ProjectName() string + Package() string + + PrintParams() + } + + ConfigRecord struct { + workingDir string + + allowUnreachable *bool + autoResolveLRConf *bool + debugLexer *bool + debugParser *bool + help *bool + noLexer *bool + outDir string + pkg string + srcFile string + verbose *bool + zip *bool + stockCompiler *bool + } +) + +var ( + CurrentConfiguration Config +) func New() (Config, error) { wd, err := os.Getwd() @@ -115,6 +134,10 @@ func (this *ConfigRecord) DebugParser() bool { return *this.debugParser } +func (this *ConfigRecord) StockCompiler() bool { + return *this.stockCompiler +} + func (this *ConfigRecord) SourceFile() string { return this.srcFile } @@ -174,6 +197,7 @@ func (this *ConfigRecord) getFlags() error { this.allowUnreachable = flag.Bool("u", false, "allow unreachable productions") this.verbose = flag.Bool("v", false, "verbose") this.zip = flag.Bool("zip", false, "zip the actiontable and gototable (experimental)") + this.stockCompiler = flag.Bool("stock", false, "use the stock compiler from original gocc") flag.Parse() if *this.noLexer && *this.debugLexer { diff --git a/internal/fe2/LR1_sets.txt b/internal/fe2/LR1_sets.txt new file mode 100644 index 00000000..61c25ed4 --- /dev/null +++ b/internal/fe2/LR1_sets.txt @@ -0,0 +1,5250 @@ +S0{ + S' : •Grammar «Ω» + Grammar : •LexicalPart SyntaxPart «Ω» + Grammar : •LexicalPart «Ω» + Grammar : •SyntaxPart «Ω» + LexicalPart : •LexProductions «g_sdt_lit» + LexicalPart : •LexProductions «prodId» + LexicalPart : •LexProductions «Ω» + SyntaxPart : •FileHeader SyntaxProdList «Ω» + SyntaxPart : •SyntaxProdList «Ω» + LexProductions : •LexProduction «g_sdt_lit» + LexProductions : •LexProductions LexProduction «g_sdt_lit» + LexProductions : •LexProduction «prodId» + LexProductions : •LexProductions LexProduction «prodId» + LexProductions : •LexProduction «Ω» + LexProductions : •LexProductions LexProduction «Ω» + FileHeader : •g_sdt_lit «prodId» + SyntaxProdList : •SyntaxProduction «Ω» + SyntaxProdList : •SyntaxProdList SyntaxProduction «Ω» + LexProduction : •tokId : LexPattern ; «g_sdt_lit» + LexProduction : •regDefId : LexPattern ; «g_sdt_lit» + LexProduction : •ignoredTokId : LexPattern ; «g_sdt_lit» + LexProductions : •LexProduction «ignoredTokId» + LexProductions : •LexProduction «regDefId» + LexProductions : •LexProduction «tokId» + LexProductions : •LexProductions LexProduction «ignoredTokId» + LexProductions : •LexProductions LexProduction «regDefId» + LexProductions : •LexProductions LexProduction «tokId» + LexProduction : •tokId : LexPattern ; «prodId» + LexProduction : •regDefId : LexPattern ; «prodId» + LexProduction : •ignoredTokId : LexPattern ; «prodId» + LexProduction : •tokId : LexPattern ; «Ω» + LexProduction : •regDefId : LexPattern ; «Ω» + LexProduction : •ignoredTokId : LexPattern ; «Ω» + SyntaxProduction : •prodId : Alternatives ; «Ω» + SyntaxProdList : •SyntaxProduction «prodId» + SyntaxProdList : •SyntaxProdList SyntaxProduction «prodId» + LexProduction : •tokId : LexPattern ; «ignoredTokId» + LexProduction : •regDefId : LexPattern ; «ignoredTokId» + LexProduction : •ignoredTokId : LexPattern ; «ignoredTokId» + LexProduction : •tokId : LexPattern ; «regDefId» + LexProduction : •regDefId : LexPattern ; «regDefId» + LexProduction : •ignoredTokId : LexPattern ; «regDefId» + LexProduction : •tokId : LexPattern ; «tokId» + LexProduction : •regDefId : LexPattern ; «tokId» + LexProduction : •ignoredTokId : LexPattern ; «tokId» + SyntaxProduction : •prodId : Alternatives ; «prodId» +} +Transitions: + Grammar -> 1 + LexicalPart -> 2 + SyntaxPart -> 3 + LexProductions -> 4 + LexProduction -> 5 + tokId -> 6 + regDefId -> 7 + ignoredTokId -> 8 + FileHeader -> 9 + SyntaxProdList -> 10 + g_sdt_lit -> 11 + SyntaxProduction -> 12 + prodId -> 13 + + +S1{ + S' : Grammar• «Ω» +} +Transitions: + + +S2{ + Grammar : LexicalPart •SyntaxPart «Ω» + Grammar : LexicalPart• «Ω» + SyntaxPart : •FileHeader SyntaxProdList «Ω» + SyntaxPart : •SyntaxProdList «Ω» + FileHeader : •g_sdt_lit «prodId» + SyntaxProdList : •SyntaxProduction «Ω» + SyntaxProdList : •SyntaxProdList SyntaxProduction «Ω» + SyntaxProduction : •prodId : Alternatives ; «Ω» + SyntaxProdList : •SyntaxProduction «prodId» + SyntaxProdList : •SyntaxProdList SyntaxProduction «prodId» + SyntaxProduction : •prodId : Alternatives ; «prodId» +} +Transitions: + FileHeader -> 9 + SyntaxProdList -> 10 + g_sdt_lit -> 11 + SyntaxProduction -> 12 + prodId -> 13 + SyntaxPart -> 14 + + +S3{ + Grammar : SyntaxPart• «Ω» +} +Transitions: + + +S4{ + LexicalPart : LexProductions• «g_sdt_lit» + LexicalPart : LexProductions• «prodId» + LexicalPart : LexProductions• «Ω» + LexProductions : LexProductions •LexProduction «g_sdt_lit» + LexProductions : LexProductions •LexProduction «prodId» + LexProductions : LexProductions •LexProduction «Ω» + LexProductions : LexProductions •LexProduction «ignoredTokId» + LexProductions : LexProductions •LexProduction «regDefId» + LexProductions : LexProductions •LexProduction «tokId» + LexProduction : •tokId : LexPattern ; «g_sdt_lit» + LexProduction : •regDefId : LexPattern ; «g_sdt_lit» + LexProduction : •ignoredTokId : LexPattern ; «g_sdt_lit» + LexProduction : •tokId : LexPattern ; «prodId» + LexProduction : •regDefId : LexPattern ; «prodId» + LexProduction : •ignoredTokId : LexPattern ; «prodId» + LexProduction : •tokId : LexPattern ; «Ω» + LexProduction : •regDefId : LexPattern ; «Ω» + LexProduction : •ignoredTokId : LexPattern ; «Ω» + LexProduction : •tokId : LexPattern ; «ignoredTokId» + LexProduction : •regDefId : LexPattern ; «ignoredTokId» + LexProduction : •ignoredTokId : LexPattern ; «ignoredTokId» + LexProduction : •tokId : LexPattern ; «regDefId» + LexProduction : •regDefId : LexPattern ; «regDefId» + LexProduction : •ignoredTokId : LexPattern ; «regDefId» + LexProduction : •tokId : LexPattern ; «tokId» + LexProduction : •regDefId : LexPattern ; «tokId» + LexProduction : •ignoredTokId : LexPattern ; «tokId» +} +Transitions: + tokId -> 6 + regDefId -> 7 + ignoredTokId -> 8 + LexProduction -> 15 + + +S5{ + LexProductions : LexProduction• «g_sdt_lit» + LexProductions : LexProduction• «prodId» + LexProductions : LexProduction• «Ω» + LexProductions : LexProduction• «ignoredTokId» + LexProductions : LexProduction• «regDefId» + LexProductions : LexProduction• «tokId» +} +Transitions: + + +S6{ + LexProduction : tokId •: LexPattern ; «g_sdt_lit» + LexProduction : tokId •: LexPattern ; «prodId» + LexProduction : tokId •: LexPattern ; «Ω» + LexProduction : tokId •: LexPattern ; «ignoredTokId» + LexProduction : tokId •: LexPattern ; «regDefId» + LexProduction : tokId •: LexPattern ; «tokId» +} +Transitions: + : -> 16 + + +S7{ + LexProduction : regDefId •: LexPattern ; «g_sdt_lit» + LexProduction : regDefId •: LexPattern ; «prodId» + LexProduction : regDefId •: LexPattern ; «Ω» + LexProduction : regDefId •: LexPattern ; «ignoredTokId» + LexProduction : regDefId •: LexPattern ; «regDefId» + LexProduction : regDefId •: LexPattern ; «tokId» +} +Transitions: + : -> 17 + + +S8{ + LexProduction : ignoredTokId •: LexPattern ; «g_sdt_lit» + LexProduction : ignoredTokId •: LexPattern ; «prodId» + LexProduction : ignoredTokId •: LexPattern ; «Ω» + LexProduction : ignoredTokId •: LexPattern ; «ignoredTokId» + LexProduction : ignoredTokId •: LexPattern ; «regDefId» + LexProduction : ignoredTokId •: LexPattern ; «tokId» +} +Transitions: + : -> 18 + + +S9{ + SyntaxPart : FileHeader •SyntaxProdList «Ω» + SyntaxProdList : •SyntaxProduction «Ω» + SyntaxProdList : •SyntaxProdList SyntaxProduction «Ω» + SyntaxProduction : •prodId : Alternatives ; «Ω» + SyntaxProdList : •SyntaxProduction «prodId» + SyntaxProdList : •SyntaxProdList SyntaxProduction «prodId» + SyntaxProduction : •prodId : Alternatives ; «prodId» +} +Transitions: + SyntaxProduction -> 12 + prodId -> 13 + SyntaxProdList -> 19 + + +S10{ + SyntaxPart : SyntaxProdList• «Ω» + SyntaxProdList : SyntaxProdList •SyntaxProduction «Ω» + SyntaxProdList : SyntaxProdList •SyntaxProduction «prodId» + SyntaxProduction : •prodId : Alternatives ; «Ω» + SyntaxProduction : •prodId : Alternatives ; «prodId» +} +Transitions: + prodId -> 13 + SyntaxProduction -> 20 + + +S11{ + FileHeader : g_sdt_lit• «prodId» +} +Transitions: + + +S12{ + SyntaxProdList : SyntaxProduction• «Ω» + SyntaxProdList : SyntaxProduction• «prodId» +} +Transitions: + + +S13{ + SyntaxProduction : prodId •: Alternatives ; «Ω» + SyntaxProduction : prodId •: Alternatives ; «prodId» +} +Transitions: + : -> 21 + + +S14{ + Grammar : LexicalPart SyntaxPart• «Ω» +} +Transitions: + + +S15{ + LexProductions : LexProductions LexProduction• «g_sdt_lit» + LexProductions : LexProductions LexProduction• «prodId» + LexProductions : LexProductions LexProduction• «Ω» + LexProductions : LexProductions LexProduction• «ignoredTokId» + LexProductions : LexProductions LexProduction• «regDefId» + LexProductions : LexProductions LexProduction• «tokId» +} +Transitions: + + +S16{ + LexProduction : tokId : •LexPattern ; «g_sdt_lit» + LexProduction : tokId : •LexPattern ; «prodId» + LexProduction : tokId : •LexPattern ; «Ω» + LexProduction : tokId : •LexPattern ; «ignoredTokId» + LexProduction : tokId : •LexPattern ; «regDefId» + LexProduction : tokId : •LexPattern ; «tokId» + LexPattern : •LexAlt «;» + LexPattern : •LexPattern | LexAlt «;» + LexAlt : •LexTerm «;» + LexAlt : •LexAlt LexTerm «;» + LexPattern : •LexAlt «|» + LexPattern : •LexPattern | LexAlt «|» + LexTerm : •. «;» + LexTerm : •char_lit «;» + LexTerm : •char_lit - char_lit «;» + LexTerm : •~ char_lit «;» + LexTerm : •~ ( char_lit - char_lit ) «;» + LexTerm : •regDefId «;» + LexTerm : •[ LexPattern ] «;» + LexTerm : •{ LexPattern } «;» + LexTerm : •( LexPattern ) «;» + LexAlt : •LexTerm «(» + LexAlt : •LexTerm «.» + LexAlt : •LexTerm «[» + LexAlt : •LexTerm «char_lit» + LexAlt : •LexTerm «regDefId» + LexAlt : •LexTerm «{» + LexAlt : •LexTerm «~» + LexAlt : •LexAlt LexTerm «(» + LexAlt : •LexAlt LexTerm «.» + LexAlt : •LexAlt LexTerm «[» + LexAlt : •LexAlt LexTerm «char_lit» + LexAlt : •LexAlt LexTerm «regDefId» + LexAlt : •LexAlt LexTerm «{» + LexAlt : •LexAlt LexTerm «~» + LexAlt : •LexTerm «|» + LexAlt : •LexAlt LexTerm «|» + LexTerm : •. «(» + LexTerm : •char_lit «(» + LexTerm : •char_lit - char_lit «(» + LexTerm : •~ char_lit «(» + LexTerm : •~ ( char_lit - char_lit ) «(» + LexTerm : •regDefId «(» + LexTerm : •[ LexPattern ] «(» + LexTerm : •{ LexPattern } «(» + LexTerm : •( LexPattern ) «(» + LexTerm : •. «.» + LexTerm : •char_lit «.» + LexTerm : •char_lit - char_lit «.» + LexTerm : •~ char_lit «.» + LexTerm : •~ ( char_lit - char_lit ) «.» + LexTerm : •regDefId «.» + LexTerm : •[ LexPattern ] «.» + LexTerm : •{ LexPattern } «.» + LexTerm : •( LexPattern ) «.» + LexTerm : •. «[» + LexTerm : •char_lit «[» + LexTerm : •char_lit - char_lit «[» + LexTerm : •~ char_lit «[» + LexTerm : •~ ( char_lit - char_lit ) «[» + LexTerm : •regDefId «[» + LexTerm : •[ LexPattern ] «[» + LexTerm : •{ LexPattern } «[» + LexTerm : •( LexPattern ) «[» + LexTerm : •. «char_lit» + LexTerm : •char_lit «char_lit» + LexTerm : •char_lit - char_lit «char_lit» + LexTerm : •~ char_lit «char_lit» + LexTerm : •~ ( char_lit - char_lit ) «char_lit» + LexTerm : •regDefId «char_lit» + LexTerm : •[ LexPattern ] «char_lit» + LexTerm : •{ LexPattern } «char_lit» + LexTerm : •( LexPattern ) «char_lit» + LexTerm : •. «regDefId» + LexTerm : •char_lit «regDefId» + LexTerm : •char_lit - char_lit «regDefId» + LexTerm : •~ char_lit «regDefId» + LexTerm : •~ ( char_lit - char_lit ) «regDefId» + LexTerm : •regDefId «regDefId» + LexTerm : •[ LexPattern ] «regDefId» + LexTerm : •{ LexPattern } «regDefId» + LexTerm : •( LexPattern ) «regDefId» + LexTerm : •. «{» + LexTerm : •char_lit «{» + LexTerm : •char_lit - char_lit «{» + LexTerm : •~ char_lit «{» + LexTerm : •~ ( char_lit - char_lit ) «{» + LexTerm : •regDefId «{» + LexTerm : •[ LexPattern ] «{» + LexTerm : •{ LexPattern } «{» + LexTerm : •( LexPattern ) «{» + LexTerm : •. «~» + LexTerm : •char_lit «~» + LexTerm : •char_lit - char_lit «~» + LexTerm : •~ char_lit «~» + LexTerm : •~ ( char_lit - char_lit ) «~» + LexTerm : •regDefId «~» + LexTerm : •[ LexPattern ] «~» + LexTerm : •{ LexPattern } «~» + LexTerm : •( LexPattern ) «~» + LexTerm : •. «|» + LexTerm : •char_lit «|» + LexTerm : •char_lit - char_lit «|» + LexTerm : •~ char_lit «|» + LexTerm : •~ ( char_lit - char_lit ) «|» + LexTerm : •regDefId «|» + LexTerm : •[ LexPattern ] «|» + LexTerm : •{ LexPattern } «|» + LexTerm : •( LexPattern ) «|» +} +Transitions: + LexPattern -> 22 + regDefId -> 23 + LexAlt -> 24 + LexTerm -> 25 + . -> 26 + char_lit -> 27 + ~ -> 28 + ( -> 29 + [ -> 30 + { -> 31 + + +S17{ + LexProduction : regDefId : •LexPattern ; «g_sdt_lit» + LexProduction : regDefId : •LexPattern ; «prodId» + LexProduction : regDefId : •LexPattern ; «Ω» + LexProduction : regDefId : •LexPattern ; «ignoredTokId» + LexProduction : regDefId : •LexPattern ; «regDefId» + LexProduction : regDefId : •LexPattern ; «tokId» + LexPattern : •LexAlt «;» + LexPattern : •LexPattern | LexAlt «;» + LexAlt : •LexTerm «;» + LexAlt : •LexAlt LexTerm «;» + LexPattern : •LexAlt «|» + LexPattern : •LexPattern | LexAlt «|» + LexTerm : •. «;» + LexTerm : •char_lit «;» + LexTerm : •char_lit - char_lit «;» + LexTerm : •~ char_lit «;» + LexTerm : •~ ( char_lit - char_lit ) «;» + LexTerm : •regDefId «;» + LexTerm : •[ LexPattern ] «;» + LexTerm : •{ LexPattern } «;» + LexTerm : •( LexPattern ) «;» + LexAlt : •LexTerm «(» + LexAlt : •LexTerm «.» + LexAlt : •LexTerm «[» + LexAlt : •LexTerm «char_lit» + LexAlt : •LexTerm «regDefId» + LexAlt : •LexTerm «{» + LexAlt : •LexTerm «~» + LexAlt : •LexAlt LexTerm «(» + LexAlt : •LexAlt LexTerm «.» + LexAlt : •LexAlt LexTerm «[» + LexAlt : •LexAlt LexTerm «char_lit» + LexAlt : •LexAlt LexTerm «regDefId» + LexAlt : •LexAlt LexTerm «{» + LexAlt : •LexAlt LexTerm «~» + LexAlt : •LexTerm «|» + LexAlt : •LexAlt LexTerm «|» + LexTerm : •. «(» + LexTerm : •char_lit «(» + LexTerm : •char_lit - char_lit «(» + LexTerm : •~ char_lit «(» + LexTerm : •~ ( char_lit - char_lit ) «(» + LexTerm : •regDefId «(» + LexTerm : •[ LexPattern ] «(» + LexTerm : •{ LexPattern } «(» + LexTerm : •( LexPattern ) «(» + LexTerm : •. «.» + LexTerm : •char_lit «.» + LexTerm : •char_lit - char_lit «.» + LexTerm : •~ char_lit «.» + LexTerm : •~ ( char_lit - char_lit ) «.» + LexTerm : •regDefId «.» + LexTerm : •[ LexPattern ] «.» + LexTerm : •{ LexPattern } «.» + LexTerm : •( LexPattern ) «.» + LexTerm : •. «[» + LexTerm : •char_lit «[» + LexTerm : •char_lit - char_lit «[» + LexTerm : •~ char_lit «[» + LexTerm : •~ ( char_lit - char_lit ) «[» + LexTerm : •regDefId «[» + LexTerm : •[ LexPattern ] «[» + LexTerm : •{ LexPattern } «[» + LexTerm : •( LexPattern ) «[» + LexTerm : •. «char_lit» + LexTerm : •char_lit «char_lit» + LexTerm : •char_lit - char_lit «char_lit» + LexTerm : •~ char_lit «char_lit» + LexTerm : •~ ( char_lit - char_lit ) «char_lit» + LexTerm : •regDefId «char_lit» + LexTerm : •[ LexPattern ] «char_lit» + LexTerm : •{ LexPattern } «char_lit» + LexTerm : •( LexPattern ) «char_lit» + LexTerm : •. «regDefId» + LexTerm : •char_lit «regDefId» + LexTerm : •char_lit - char_lit «regDefId» + LexTerm : •~ char_lit «regDefId» + LexTerm : •~ ( char_lit - char_lit ) «regDefId» + LexTerm : •regDefId «regDefId» + LexTerm : •[ LexPattern ] «regDefId» + LexTerm : •{ LexPattern } «regDefId» + LexTerm : •( LexPattern ) «regDefId» + LexTerm : •. «{» + LexTerm : •char_lit «{» + LexTerm : •char_lit - char_lit «{» + LexTerm : •~ char_lit «{» + LexTerm : •~ ( char_lit - char_lit ) «{» + LexTerm : •regDefId «{» + LexTerm : •[ LexPattern ] «{» + LexTerm : •{ LexPattern } «{» + LexTerm : •( LexPattern ) «{» + LexTerm : •. «~» + LexTerm : •char_lit «~» + LexTerm : •char_lit - char_lit «~» + LexTerm : •~ char_lit «~» + LexTerm : •~ ( char_lit - char_lit ) «~» + LexTerm : •regDefId «~» + LexTerm : •[ LexPattern ] «~» + LexTerm : •{ LexPattern } «~» + LexTerm : •( LexPattern ) «~» + LexTerm : •. «|» + LexTerm : •char_lit «|» + LexTerm : •char_lit - char_lit «|» + LexTerm : •~ char_lit «|» + LexTerm : •~ ( char_lit - char_lit ) «|» + LexTerm : •regDefId «|» + LexTerm : •[ LexPattern ] «|» + LexTerm : •{ LexPattern } «|» + LexTerm : •( LexPattern ) «|» +} +Transitions: + regDefId -> 23 + LexAlt -> 24 + LexTerm -> 25 + . -> 26 + char_lit -> 27 + ~ -> 28 + ( -> 29 + [ -> 30 + { -> 31 + LexPattern -> 32 + + +S18{ + LexProduction : ignoredTokId : •LexPattern ; «g_sdt_lit» + LexProduction : ignoredTokId : •LexPattern ; «prodId» + LexProduction : ignoredTokId : •LexPattern ; «Ω» + LexProduction : ignoredTokId : •LexPattern ; «ignoredTokId» + LexProduction : ignoredTokId : •LexPattern ; «regDefId» + LexProduction : ignoredTokId : •LexPattern ; «tokId» + LexPattern : •LexAlt «;» + LexPattern : •LexPattern | LexAlt «;» + LexAlt : •LexTerm «;» + LexAlt : •LexAlt LexTerm «;» + LexPattern : •LexAlt «|» + LexPattern : •LexPattern | LexAlt «|» + LexTerm : •. «;» + LexTerm : •char_lit «;» + LexTerm : •char_lit - char_lit «;» + LexTerm : •~ char_lit «;» + LexTerm : •~ ( char_lit - char_lit ) «;» + LexTerm : •regDefId «;» + LexTerm : •[ LexPattern ] «;» + LexTerm : •{ LexPattern } «;» + LexTerm : •( LexPattern ) «;» + LexAlt : •LexTerm «(» + LexAlt : •LexTerm «.» + LexAlt : •LexTerm «[» + LexAlt : •LexTerm «char_lit» + LexAlt : •LexTerm «regDefId» + LexAlt : •LexTerm «{» + LexAlt : •LexTerm «~» + LexAlt : •LexAlt LexTerm «(» + LexAlt : •LexAlt LexTerm «.» + LexAlt : •LexAlt LexTerm «[» + LexAlt : •LexAlt LexTerm «char_lit» + LexAlt : •LexAlt LexTerm «regDefId» + LexAlt : •LexAlt LexTerm «{» + LexAlt : •LexAlt LexTerm «~» + LexAlt : •LexTerm «|» + LexAlt : •LexAlt LexTerm «|» + LexTerm : •. «(» + LexTerm : •char_lit «(» + LexTerm : •char_lit - char_lit «(» + LexTerm : •~ char_lit «(» + LexTerm : •~ ( char_lit - char_lit ) «(» + LexTerm : •regDefId «(» + LexTerm : •[ LexPattern ] «(» + LexTerm : •{ LexPattern } «(» + LexTerm : •( LexPattern ) «(» + LexTerm : •. «.» + LexTerm : •char_lit «.» + LexTerm : •char_lit - char_lit «.» + LexTerm : •~ char_lit «.» + LexTerm : •~ ( char_lit - char_lit ) «.» + LexTerm : •regDefId «.» + LexTerm : •[ LexPattern ] «.» + LexTerm : •{ LexPattern } «.» + LexTerm : •( LexPattern ) «.» + LexTerm : •. «[» + LexTerm : •char_lit «[» + LexTerm : •char_lit - char_lit «[» + LexTerm : •~ char_lit «[» + LexTerm : •~ ( char_lit - char_lit ) «[» + LexTerm : •regDefId «[» + LexTerm : •[ LexPattern ] «[» + LexTerm : •{ LexPattern } «[» + LexTerm : •( LexPattern ) «[» + LexTerm : •. «char_lit» + LexTerm : •char_lit «char_lit» + LexTerm : •char_lit - char_lit «char_lit» + LexTerm : •~ char_lit «char_lit» + LexTerm : •~ ( char_lit - char_lit ) «char_lit» + LexTerm : •regDefId «char_lit» + LexTerm : •[ LexPattern ] «char_lit» + LexTerm : •{ LexPattern } «char_lit» + LexTerm : •( LexPattern ) «char_lit» + LexTerm : •. «regDefId» + LexTerm : •char_lit «regDefId» + LexTerm : •char_lit - char_lit «regDefId» + LexTerm : •~ char_lit «regDefId» + LexTerm : •~ ( char_lit - char_lit ) «regDefId» + LexTerm : •regDefId «regDefId» + LexTerm : •[ LexPattern ] «regDefId» + LexTerm : •{ LexPattern } «regDefId» + LexTerm : •( LexPattern ) «regDefId» + LexTerm : •. «{» + LexTerm : •char_lit «{» + LexTerm : •char_lit - char_lit «{» + LexTerm : •~ char_lit «{» + LexTerm : •~ ( char_lit - char_lit ) «{» + LexTerm : •regDefId «{» + LexTerm : •[ LexPattern ] «{» + LexTerm : •{ LexPattern } «{» + LexTerm : •( LexPattern ) «{» + LexTerm : •. «~» + LexTerm : •char_lit «~» + LexTerm : •char_lit - char_lit «~» + LexTerm : •~ char_lit «~» + LexTerm : •~ ( char_lit - char_lit ) «~» + LexTerm : •regDefId «~» + LexTerm : •[ LexPattern ] «~» + LexTerm : •{ LexPattern } «~» + LexTerm : •( LexPattern ) «~» + LexTerm : •. «|» + LexTerm : •char_lit «|» + LexTerm : •char_lit - char_lit «|» + LexTerm : •~ char_lit «|» + LexTerm : •~ ( char_lit - char_lit ) «|» + LexTerm : •regDefId «|» + LexTerm : •[ LexPattern ] «|» + LexTerm : •{ LexPattern } «|» + LexTerm : •( LexPattern ) «|» +} +Transitions: + regDefId -> 23 + LexAlt -> 24 + LexTerm -> 25 + . -> 26 + char_lit -> 27 + ~ -> 28 + ( -> 29 + [ -> 30 + { -> 31 + LexPattern -> 33 + + +S19{ + SyntaxPart : FileHeader SyntaxProdList• «Ω» + SyntaxProdList : SyntaxProdList •SyntaxProduction «Ω» + SyntaxProdList : SyntaxProdList •SyntaxProduction «prodId» + SyntaxProduction : •prodId : Alternatives ; «Ω» + SyntaxProduction : •prodId : Alternatives ; «prodId» +} +Transitions: + prodId -> 13 + SyntaxProduction -> 20 + + +S20{ + SyntaxProdList : SyntaxProdList SyntaxProduction• «Ω» + SyntaxProdList : SyntaxProdList SyntaxProduction• «prodId» +} +Transitions: + + +S21{ + SyntaxProduction : prodId : •Alternatives ; «Ω» + SyntaxProduction : prodId : •Alternatives ; «prodId» + Alternatives : •SyntaxBody «;» + Alternatives : •Alternatives | SyntaxBody «;» + SyntaxBody : •Symbols «;» + SyntaxBody : •Symbols g_sdt_lit «;» + SyntaxBody : •ErrorSymbol «;» + SyntaxBody : •ErrorSymbol Symbols «;» + SyntaxBody : •ErrorSymbol Symbols g_sdt_lit «;» + SyntaxBody : •ErrorSymbol g_sdt_lit «;» + SyntaxBody : •EpsilonSymbol «;» + Alternatives : •SyntaxBody «|» + Alternatives : •Alternatives | SyntaxBody «|» + Symbols : •Symbol «;» + Symbols : •Symbols Symbol «;» + Symbols : •Symbol «g_sdt_lit» + Symbols : •Symbols Symbol «g_sdt_lit» + ErrorSymbol : •errore «;» + ErrorSymbol : •λ «;» + ErrorSymbol : •errore «prodId» + ErrorSymbol : •errore «string_lit» + ErrorSymbol : •errore «tokId» + ErrorSymbol : •λ «prodId» + ErrorSymbol : •λ «string_lit» + ErrorSymbol : •λ «tokId» + ErrorSymbol : •errore «g_sdt_lit» + ErrorSymbol : •λ «g_sdt_lit» + EpsilonSymbol : •empty «;» + EpsilonSymbol : •ε «;» + SyntaxBody : •Symbols «|» + SyntaxBody : •Symbols g_sdt_lit «|» + SyntaxBody : •ErrorSymbol «|» + SyntaxBody : •ErrorSymbol Symbols «|» + SyntaxBody : •ErrorSymbol Symbols g_sdt_lit «|» + SyntaxBody : •ErrorSymbol g_sdt_lit «|» + SyntaxBody : •EpsilonSymbol «|» + Symbol : •prodId «;» + Symbol : •tokId «;» + Symbol : •string_lit «;» + Symbols : •Symbol «prodId» + Symbols : •Symbol «string_lit» + Symbols : •Symbol «tokId» + Symbols : •Symbols Symbol «prodId» + Symbols : •Symbols Symbol «string_lit» + Symbols : •Symbols Symbol «tokId» + Symbol : •prodId «g_sdt_lit» + Symbol : •tokId «g_sdt_lit» + Symbol : •string_lit «g_sdt_lit» + Symbols : •Symbol «|» + Symbols : •Symbols Symbol «|» + ErrorSymbol : •errore «|» + ErrorSymbol : •λ «|» + EpsilonSymbol : •empty «|» + EpsilonSymbol : •ε «|» + Symbol : •prodId «prodId» + Symbol : •tokId «prodId» + Symbol : •string_lit «prodId» + Symbol : •prodId «string_lit» + Symbol : •tokId «string_lit» + Symbol : •string_lit «string_lit» + Symbol : •prodId «tokId» + Symbol : •tokId «tokId» + Symbol : •string_lit «tokId» + Symbol : •prodId «|» + Symbol : •tokId «|» + Symbol : •string_lit «|» +} +Transitions: + tokId -> 34 + prodId -> 35 + Alternatives -> 36 + SyntaxBody -> 37 + Symbols -> 38 + ErrorSymbol -> 39 + EpsilonSymbol -> 40 + Symbol -> 41 + string_lit -> 42 + errore -> 43 + λ -> 44 + empty -> 45 + ε -> 46 + + +S22{ + LexProduction : tokId : LexPattern •; «g_sdt_lit» + LexProduction : tokId : LexPattern •; «prodId» + LexProduction : tokId : LexPattern •; «Ω» + LexProduction : tokId : LexPattern •; «ignoredTokId» + LexProduction : tokId : LexPattern •; «regDefId» + LexProduction : tokId : LexPattern •; «tokId» + LexPattern : LexPattern •| LexAlt «;» + LexPattern : LexPattern •| LexAlt «|» +} +Transitions: + ; -> 47 + | -> 48 + + +S23{ + LexTerm : regDefId• «;» + LexTerm : regDefId• «(» + LexTerm : regDefId• «.» + LexTerm : regDefId• «[» + LexTerm : regDefId• «char_lit» + LexTerm : regDefId• «regDefId» + LexTerm : regDefId• «{» + LexTerm : regDefId• «~» + LexTerm : regDefId• «|» +} +Transitions: + + +S24{ + LexPattern : LexAlt• «;» + LexAlt : LexAlt •LexTerm «;» + LexPattern : LexAlt• «|» + LexAlt : LexAlt •LexTerm «(» + LexAlt : LexAlt •LexTerm «.» + LexAlt : LexAlt •LexTerm «[» + LexAlt : LexAlt •LexTerm «char_lit» + LexAlt : LexAlt •LexTerm «regDefId» + LexAlt : LexAlt •LexTerm «{» + LexAlt : LexAlt •LexTerm «~» + LexAlt : LexAlt •LexTerm «|» + LexTerm : •. «;» + LexTerm : •char_lit «;» + LexTerm : •char_lit - char_lit «;» + LexTerm : •~ char_lit «;» + LexTerm : •~ ( char_lit - char_lit ) «;» + LexTerm : •regDefId «;» + LexTerm : •[ LexPattern ] «;» + LexTerm : •{ LexPattern } «;» + LexTerm : •( LexPattern ) «;» + LexTerm : •. «(» + LexTerm : •char_lit «(» + LexTerm : •char_lit - char_lit «(» + LexTerm : •~ char_lit «(» + LexTerm : •~ ( char_lit - char_lit ) «(» + LexTerm : •regDefId «(» + LexTerm : •[ LexPattern ] «(» + LexTerm : •{ LexPattern } «(» + LexTerm : •( LexPattern ) «(» + LexTerm : •. «.» + LexTerm : •char_lit «.» + LexTerm : •char_lit - char_lit «.» + LexTerm : •~ char_lit «.» + LexTerm : •~ ( char_lit - char_lit ) «.» + LexTerm : •regDefId «.» + LexTerm : •[ LexPattern ] «.» + LexTerm : •{ LexPattern } «.» + LexTerm : •( LexPattern ) «.» + LexTerm : •. «[» + LexTerm : •char_lit «[» + LexTerm : •char_lit - char_lit «[» + LexTerm : •~ char_lit «[» + LexTerm : •~ ( char_lit - char_lit ) «[» + LexTerm : •regDefId «[» + LexTerm : •[ LexPattern ] «[» + LexTerm : •{ LexPattern } «[» + LexTerm : •( LexPattern ) «[» + LexTerm : •. «char_lit» + LexTerm : •char_lit «char_lit» + LexTerm : •char_lit - char_lit «char_lit» + LexTerm : •~ char_lit «char_lit» + LexTerm : •~ ( char_lit - char_lit ) «char_lit» + LexTerm : •regDefId «char_lit» + LexTerm : •[ LexPattern ] «char_lit» + LexTerm : •{ LexPattern } «char_lit» + LexTerm : •( LexPattern ) «char_lit» + LexTerm : •. «regDefId» + LexTerm : •char_lit «regDefId» + LexTerm : •char_lit - char_lit «regDefId» + LexTerm : •~ char_lit «regDefId» + LexTerm : •~ ( char_lit - char_lit ) «regDefId» + LexTerm : •regDefId «regDefId» + LexTerm : •[ LexPattern ] «regDefId» + LexTerm : •{ LexPattern } «regDefId» + LexTerm : •( LexPattern ) «regDefId» + LexTerm : •. «{» + LexTerm : •char_lit «{» + LexTerm : •char_lit - char_lit «{» + LexTerm : •~ char_lit «{» + LexTerm : •~ ( char_lit - char_lit ) «{» + LexTerm : •regDefId «{» + LexTerm : •[ LexPattern ] «{» + LexTerm : •{ LexPattern } «{» + LexTerm : •( LexPattern ) «{» + LexTerm : •. «~» + LexTerm : •char_lit «~» + LexTerm : •char_lit - char_lit «~» + LexTerm : •~ char_lit «~» + LexTerm : •~ ( char_lit - char_lit ) «~» + LexTerm : •regDefId «~» + LexTerm : •[ LexPattern ] «~» + LexTerm : •{ LexPattern } «~» + LexTerm : •( LexPattern ) «~» + LexTerm : •. «|» + LexTerm : •char_lit «|» + LexTerm : •char_lit - char_lit «|» + LexTerm : •~ char_lit «|» + LexTerm : •~ ( char_lit - char_lit ) «|» + LexTerm : •regDefId «|» + LexTerm : •[ LexPattern ] «|» + LexTerm : •{ LexPattern } «|» + LexTerm : •( LexPattern ) «|» +} +Transitions: + regDefId -> 23 + . -> 26 + char_lit -> 27 + ~ -> 28 + ( -> 29 + [ -> 30 + { -> 31 + LexTerm -> 49 + + +S25{ + LexAlt : LexTerm• «;» + LexAlt : LexTerm• «(» + LexAlt : LexTerm• «.» + LexAlt : LexTerm• «[» + LexAlt : LexTerm• «char_lit» + LexAlt : LexTerm• «regDefId» + LexAlt : LexTerm• «{» + LexAlt : LexTerm• «~» + LexAlt : LexTerm• «|» +} +Transitions: + + +S26{ + LexTerm : .• «;» + LexTerm : .• «(» + LexTerm : .• «.» + LexTerm : .• «[» + LexTerm : .• «char_lit» + LexTerm : .• «regDefId» + LexTerm : .• «{» + LexTerm : .• «~» + LexTerm : .• «|» +} +Transitions: + + +S27{ + LexTerm : char_lit• «;» + LexTerm : char_lit •- char_lit «;» + LexTerm : char_lit• «(» + LexTerm : char_lit •- char_lit «(» + LexTerm : char_lit• «.» + LexTerm : char_lit •- char_lit «.» + LexTerm : char_lit• «[» + LexTerm : char_lit •- char_lit «[» + LexTerm : char_lit• «char_lit» + LexTerm : char_lit •- char_lit «char_lit» + LexTerm : char_lit• «regDefId» + LexTerm : char_lit •- char_lit «regDefId» + LexTerm : char_lit• «{» + LexTerm : char_lit •- char_lit «{» + LexTerm : char_lit• «~» + LexTerm : char_lit •- char_lit «~» + LexTerm : char_lit• «|» + LexTerm : char_lit •- char_lit «|» +} +Transitions: + - -> 50 + + +S28{ + LexTerm : ~ •char_lit «;» + LexTerm : ~ •( char_lit - char_lit ) «;» + LexTerm : ~ •char_lit «(» + LexTerm : ~ •( char_lit - char_lit ) «(» + LexTerm : ~ •char_lit «.» + LexTerm : ~ •( char_lit - char_lit ) «.» + LexTerm : ~ •char_lit «[» + LexTerm : ~ •( char_lit - char_lit ) «[» + LexTerm : ~ •char_lit «char_lit» + LexTerm : ~ •( char_lit - char_lit ) «char_lit» + LexTerm : ~ •char_lit «regDefId» + LexTerm : ~ •( char_lit - char_lit ) «regDefId» + LexTerm : ~ •char_lit «{» + LexTerm : ~ •( char_lit - char_lit ) «{» + LexTerm : ~ •char_lit «~» + LexTerm : ~ •( char_lit - char_lit ) «~» + LexTerm : ~ •char_lit «|» + LexTerm : ~ •( char_lit - char_lit ) «|» +} +Transitions: + char_lit -> 51 + ( -> 52 + + +S29{ + LexTerm : ( •LexPattern ) «;» + LexTerm : ( •LexPattern ) «(» + LexTerm : ( •LexPattern ) «.» + LexTerm : ( •LexPattern ) «[» + LexTerm : ( •LexPattern ) «char_lit» + LexTerm : ( •LexPattern ) «regDefId» + LexTerm : ( •LexPattern ) «{» + LexTerm : ( •LexPattern ) «~» + LexTerm : ( •LexPattern ) «|» + LexPattern : •LexAlt «)» + LexPattern : •LexPattern | LexAlt «)» + LexAlt : •LexTerm «)» + LexAlt : •LexAlt LexTerm «)» + LexPattern : •LexAlt «|» + LexPattern : •LexPattern | LexAlt «|» + LexTerm : •. «)» + LexTerm : •char_lit «)» + LexTerm : •char_lit - char_lit «)» + LexTerm : •~ char_lit «)» + LexTerm : •~ ( char_lit - char_lit ) «)» + LexTerm : •regDefId «)» + LexTerm : •[ LexPattern ] «)» + LexTerm : •{ LexPattern } «)» + LexTerm : •( LexPattern ) «)» + LexAlt : •LexTerm «(» + LexAlt : •LexTerm «.» + LexAlt : •LexTerm «[» + LexAlt : •LexTerm «char_lit» + LexAlt : •LexTerm «regDefId» + LexAlt : •LexTerm «{» + LexAlt : •LexTerm «~» + LexAlt : •LexAlt LexTerm «(» + LexAlt : •LexAlt LexTerm «.» + LexAlt : •LexAlt LexTerm «[» + LexAlt : •LexAlt LexTerm «char_lit» + LexAlt : •LexAlt LexTerm «regDefId» + LexAlt : •LexAlt LexTerm «{» + LexAlt : •LexAlt LexTerm «~» + LexAlt : •LexTerm «|» + LexAlt : •LexAlt LexTerm «|» + LexTerm : •. «(» + LexTerm : •char_lit «(» + LexTerm : •char_lit - char_lit «(» + LexTerm : •~ char_lit «(» + LexTerm : •~ ( char_lit - char_lit ) «(» + LexTerm : •regDefId «(» + LexTerm : •[ LexPattern ] «(» + LexTerm : •{ LexPattern } «(» + LexTerm : •( LexPattern ) «(» + LexTerm : •. «.» + LexTerm : •char_lit «.» + LexTerm : •char_lit - char_lit «.» + LexTerm : •~ char_lit «.» + LexTerm : •~ ( char_lit - char_lit ) «.» + LexTerm : •regDefId «.» + LexTerm : •[ LexPattern ] «.» + LexTerm : •{ LexPattern } «.» + LexTerm : •( LexPattern ) «.» + LexTerm : •. «[» + LexTerm : •char_lit «[» + LexTerm : •char_lit - char_lit «[» + LexTerm : •~ char_lit «[» + LexTerm : •~ ( char_lit - char_lit ) «[» + LexTerm : •regDefId «[» + LexTerm : •[ LexPattern ] «[» + LexTerm : •{ LexPattern } «[» + LexTerm : •( LexPattern ) «[» + LexTerm : •. «char_lit» + LexTerm : •char_lit «char_lit» + LexTerm : •char_lit - char_lit «char_lit» + LexTerm : •~ char_lit «char_lit» + LexTerm : •~ ( char_lit - char_lit ) «char_lit» + LexTerm : •regDefId «char_lit» + LexTerm : •[ LexPattern ] «char_lit» + LexTerm : •{ LexPattern } «char_lit» + LexTerm : •( LexPattern ) «char_lit» + LexTerm : •. «regDefId» + LexTerm : •char_lit «regDefId» + LexTerm : •char_lit - char_lit «regDefId» + LexTerm : •~ char_lit «regDefId» + LexTerm : •~ ( char_lit - char_lit ) «regDefId» + LexTerm : •regDefId «regDefId» + LexTerm : •[ LexPattern ] «regDefId» + LexTerm : •{ LexPattern } «regDefId» + LexTerm : •( LexPattern ) «regDefId» + LexTerm : •. «{» + LexTerm : •char_lit «{» + LexTerm : •char_lit - char_lit «{» + LexTerm : •~ char_lit «{» + LexTerm : •~ ( char_lit - char_lit ) «{» + LexTerm : •regDefId «{» + LexTerm : •[ LexPattern ] «{» + LexTerm : •{ LexPattern } «{» + LexTerm : •( LexPattern ) «{» + LexTerm : •. «~» + LexTerm : •char_lit «~» + LexTerm : •char_lit - char_lit «~» + LexTerm : •~ char_lit «~» + LexTerm : •~ ( char_lit - char_lit ) «~» + LexTerm : •regDefId «~» + LexTerm : •[ LexPattern ] «~» + LexTerm : •{ LexPattern } «~» + LexTerm : •( LexPattern ) «~» + LexTerm : •. «|» + LexTerm : •char_lit «|» + LexTerm : •char_lit - char_lit «|» + LexTerm : •~ char_lit «|» + LexTerm : •~ ( char_lit - char_lit ) «|» + LexTerm : •regDefId «|» + LexTerm : •[ LexPattern ] «|» + LexTerm : •{ LexPattern } «|» + LexTerm : •( LexPattern ) «|» +} +Transitions: + LexPattern -> 53 + regDefId -> 54 + LexAlt -> 55 + LexTerm -> 56 + . -> 57 + char_lit -> 58 + ~ -> 59 + ( -> 60 + [ -> 61 + { -> 62 + + +S30{ + LexTerm : [ •LexPattern ] «;» + LexTerm : [ •LexPattern ] «(» + LexTerm : [ •LexPattern ] «.» + LexTerm : [ •LexPattern ] «[» + LexTerm : [ •LexPattern ] «char_lit» + LexTerm : [ •LexPattern ] «regDefId» + LexTerm : [ •LexPattern ] «{» + LexTerm : [ •LexPattern ] «~» + LexTerm : [ •LexPattern ] «|» + LexPattern : •LexAlt «]» + LexPattern : •LexPattern | LexAlt «]» + LexAlt : •LexTerm «]» + LexAlt : •LexAlt LexTerm «]» + LexPattern : •LexAlt «|» + LexPattern : •LexPattern | LexAlt «|» + LexTerm : •. «]» + LexTerm : •char_lit «]» + LexTerm : •char_lit - char_lit «]» + LexTerm : •~ char_lit «]» + LexTerm : •~ ( char_lit - char_lit ) «]» + LexTerm : •regDefId «]» + LexTerm : •[ LexPattern ] «]» + LexTerm : •{ LexPattern } «]» + LexTerm : •( LexPattern ) «]» + LexAlt : •LexTerm «(» + LexAlt : •LexTerm «.» + LexAlt : •LexTerm «[» + LexAlt : •LexTerm «char_lit» + LexAlt : •LexTerm «regDefId» + LexAlt : •LexTerm «{» + LexAlt : •LexTerm «~» + LexAlt : •LexAlt LexTerm «(» + LexAlt : •LexAlt LexTerm «.» + LexAlt : •LexAlt LexTerm «[» + LexAlt : •LexAlt LexTerm «char_lit» + LexAlt : •LexAlt LexTerm «regDefId» + LexAlt : •LexAlt LexTerm «{» + LexAlt : •LexAlt LexTerm «~» + LexAlt : •LexTerm «|» + LexAlt : •LexAlt LexTerm «|» + LexTerm : •. «(» + LexTerm : •char_lit «(» + LexTerm : •char_lit - char_lit «(» + LexTerm : •~ char_lit «(» + LexTerm : •~ ( char_lit - char_lit ) «(» + LexTerm : •regDefId «(» + LexTerm : •[ LexPattern ] «(» + LexTerm : •{ LexPattern } «(» + LexTerm : •( LexPattern ) «(» + LexTerm : •. «.» + LexTerm : •char_lit «.» + LexTerm : •char_lit - char_lit «.» + LexTerm : •~ char_lit «.» + LexTerm : •~ ( char_lit - char_lit ) «.» + LexTerm : •regDefId «.» + LexTerm : •[ LexPattern ] «.» + LexTerm : •{ LexPattern } «.» + LexTerm : •( LexPattern ) «.» + LexTerm : •. «[» + LexTerm : •char_lit «[» + LexTerm : •char_lit - char_lit «[» + LexTerm : •~ char_lit «[» + LexTerm : •~ ( char_lit - char_lit ) «[» + LexTerm : •regDefId «[» + LexTerm : •[ LexPattern ] «[» + LexTerm : •{ LexPattern } «[» + LexTerm : •( LexPattern ) «[» + LexTerm : •. «char_lit» + LexTerm : •char_lit «char_lit» + LexTerm : •char_lit - char_lit «char_lit» + LexTerm : •~ char_lit «char_lit» + LexTerm : •~ ( char_lit - char_lit ) «char_lit» + LexTerm : •regDefId «char_lit» + LexTerm : •[ LexPattern ] «char_lit» + LexTerm : •{ LexPattern } «char_lit» + LexTerm : •( LexPattern ) «char_lit» + LexTerm : •. «regDefId» + LexTerm : •char_lit «regDefId» + LexTerm : •char_lit - char_lit «regDefId» + LexTerm : •~ char_lit «regDefId» + LexTerm : •~ ( char_lit - char_lit ) «regDefId» + LexTerm : •regDefId «regDefId» + LexTerm : •[ LexPattern ] «regDefId» + LexTerm : •{ LexPattern } «regDefId» + LexTerm : •( LexPattern ) «regDefId» + LexTerm : •. «{» + LexTerm : •char_lit «{» + LexTerm : •char_lit - char_lit «{» + LexTerm : •~ char_lit «{» + LexTerm : •~ ( char_lit - char_lit ) «{» + LexTerm : •regDefId «{» + LexTerm : •[ LexPattern ] «{» + LexTerm : •{ LexPattern } «{» + LexTerm : •( LexPattern ) «{» + LexTerm : •. «~» + LexTerm : •char_lit «~» + LexTerm : •char_lit - char_lit «~» + LexTerm : •~ char_lit «~» + LexTerm : •~ ( char_lit - char_lit ) «~» + LexTerm : •regDefId «~» + LexTerm : •[ LexPattern ] «~» + LexTerm : •{ LexPattern } «~» + LexTerm : •( LexPattern ) «~» + LexTerm : •. «|» + LexTerm : •char_lit «|» + LexTerm : •char_lit - char_lit «|» + LexTerm : •~ char_lit «|» + LexTerm : •~ ( char_lit - char_lit ) «|» + LexTerm : •regDefId «|» + LexTerm : •[ LexPattern ] «|» + LexTerm : •{ LexPattern } «|» + LexTerm : •( LexPattern ) «|» +} +Transitions: + LexPattern -> 63 + regDefId -> 64 + LexAlt -> 65 + LexTerm -> 66 + . -> 67 + char_lit -> 68 + ~ -> 69 + ( -> 70 + [ -> 71 + { -> 72 + + +S31{ + LexTerm : { •LexPattern } «;» + LexTerm : { •LexPattern } «(» + LexTerm : { •LexPattern } «.» + LexTerm : { •LexPattern } «[» + LexTerm : { •LexPattern } «char_lit» + LexTerm : { •LexPattern } «regDefId» + LexTerm : { •LexPattern } «{» + LexTerm : { •LexPattern } «~» + LexTerm : { •LexPattern } «|» + LexPattern : •LexAlt «}» + LexPattern : •LexPattern | LexAlt «}» + LexAlt : •LexTerm «}» + LexAlt : •LexAlt LexTerm «}» + LexPattern : •LexAlt «|» + LexPattern : •LexPattern | LexAlt «|» + LexTerm : •. «}» + LexTerm : •char_lit «}» + LexTerm : •char_lit - char_lit «}» + LexTerm : •~ char_lit «}» + LexTerm : •~ ( char_lit - char_lit ) «}» + LexTerm : •regDefId «}» + LexTerm : •[ LexPattern ] «}» + LexTerm : •{ LexPattern } «}» + LexTerm : •( LexPattern ) «}» + LexAlt : •LexTerm «(» + LexAlt : •LexTerm «.» + LexAlt : •LexTerm «[» + LexAlt : •LexTerm «char_lit» + LexAlt : •LexTerm «regDefId» + LexAlt : •LexTerm «{» + LexAlt : •LexTerm «~» + LexAlt : •LexAlt LexTerm «(» + LexAlt : •LexAlt LexTerm «.» + LexAlt : •LexAlt LexTerm «[» + LexAlt : •LexAlt LexTerm «char_lit» + LexAlt : •LexAlt LexTerm «regDefId» + LexAlt : •LexAlt LexTerm «{» + LexAlt : •LexAlt LexTerm «~» + LexAlt : •LexTerm «|» + LexAlt : •LexAlt LexTerm «|» + LexTerm : •. «(» + LexTerm : •char_lit «(» + LexTerm : •char_lit - char_lit «(» + LexTerm : •~ char_lit «(» + LexTerm : •~ ( char_lit - char_lit ) «(» + LexTerm : •regDefId «(» + LexTerm : •[ LexPattern ] «(» + LexTerm : •{ LexPattern } «(» + LexTerm : •( LexPattern ) «(» + LexTerm : •. «.» + LexTerm : •char_lit «.» + LexTerm : •char_lit - char_lit «.» + LexTerm : •~ char_lit «.» + LexTerm : •~ ( char_lit - char_lit ) «.» + LexTerm : •regDefId «.» + LexTerm : •[ LexPattern ] «.» + LexTerm : •{ LexPattern } «.» + LexTerm : •( LexPattern ) «.» + LexTerm : •. «[» + LexTerm : •char_lit «[» + LexTerm : •char_lit - char_lit «[» + LexTerm : •~ char_lit «[» + LexTerm : •~ ( char_lit - char_lit ) «[» + LexTerm : •regDefId «[» + LexTerm : •[ LexPattern ] «[» + LexTerm : •{ LexPattern } «[» + LexTerm : •( LexPattern ) «[» + LexTerm : •. «char_lit» + LexTerm : •char_lit «char_lit» + LexTerm : •char_lit - char_lit «char_lit» + LexTerm : •~ char_lit «char_lit» + LexTerm : •~ ( char_lit - char_lit ) «char_lit» + LexTerm : •regDefId «char_lit» + LexTerm : •[ LexPattern ] «char_lit» + LexTerm : •{ LexPattern } «char_lit» + LexTerm : •( LexPattern ) «char_lit» + LexTerm : •. «regDefId» + LexTerm : •char_lit «regDefId» + LexTerm : •char_lit - char_lit «regDefId» + LexTerm : •~ char_lit «regDefId» + LexTerm : •~ ( char_lit - char_lit ) «regDefId» + LexTerm : •regDefId «regDefId» + LexTerm : •[ LexPattern ] «regDefId» + LexTerm : •{ LexPattern } «regDefId» + LexTerm : •( LexPattern ) «regDefId» + LexTerm : •. «{» + LexTerm : •char_lit «{» + LexTerm : •char_lit - char_lit «{» + LexTerm : •~ char_lit «{» + LexTerm : •~ ( char_lit - char_lit ) «{» + LexTerm : •regDefId «{» + LexTerm : •[ LexPattern ] «{» + LexTerm : •{ LexPattern } «{» + LexTerm : •( LexPattern ) «{» + LexTerm : •. «~» + LexTerm : •char_lit «~» + LexTerm : •char_lit - char_lit «~» + LexTerm : •~ char_lit «~» + LexTerm : •~ ( char_lit - char_lit ) «~» + LexTerm : •regDefId «~» + LexTerm : •[ LexPattern ] «~» + LexTerm : •{ LexPattern } «~» + LexTerm : •( LexPattern ) «~» + LexTerm : •. «|» + LexTerm : •char_lit «|» + LexTerm : •char_lit - char_lit «|» + LexTerm : •~ char_lit «|» + LexTerm : •~ ( char_lit - char_lit ) «|» + LexTerm : •regDefId «|» + LexTerm : •[ LexPattern ] «|» + LexTerm : •{ LexPattern } «|» + LexTerm : •( LexPattern ) «|» +} +Transitions: + LexPattern -> 73 + regDefId -> 74 + LexAlt -> 75 + LexTerm -> 76 + . -> 77 + char_lit -> 78 + ~ -> 79 + ( -> 80 + [ -> 81 + { -> 82 + + +S32{ + LexProduction : regDefId : LexPattern •; «g_sdt_lit» + LexProduction : regDefId : LexPattern •; «prodId» + LexProduction : regDefId : LexPattern •; «Ω» + LexProduction : regDefId : LexPattern •; «ignoredTokId» + LexProduction : regDefId : LexPattern •; «regDefId» + LexProduction : regDefId : LexPattern •; «tokId» + LexPattern : LexPattern •| LexAlt «;» + LexPattern : LexPattern •| LexAlt «|» +} +Transitions: + | -> 48 + ; -> 83 + + +S33{ + LexProduction : ignoredTokId : LexPattern •; «g_sdt_lit» + LexProduction : ignoredTokId : LexPattern •; «prodId» + LexProduction : ignoredTokId : LexPattern •; «Ω» + LexProduction : ignoredTokId : LexPattern •; «ignoredTokId» + LexProduction : ignoredTokId : LexPattern •; «regDefId» + LexProduction : ignoredTokId : LexPattern •; «tokId» + LexPattern : LexPattern •| LexAlt «;» + LexPattern : LexPattern •| LexAlt «|» +} +Transitions: + | -> 48 + ; -> 84 + + +S34{ + Symbol : tokId• «;» + Symbol : tokId• «g_sdt_lit» + Symbol : tokId• «prodId» + Symbol : tokId• «string_lit» + Symbol : tokId• «tokId» + Symbol : tokId• «|» +} +Transitions: + + +S35{ + Symbol : prodId• «;» + Symbol : prodId• «g_sdt_lit» + Symbol : prodId• «prodId» + Symbol : prodId• «string_lit» + Symbol : prodId• «tokId» + Symbol : prodId• «|» +} +Transitions: + + +S36{ + SyntaxProduction : prodId : Alternatives •; «Ω» + SyntaxProduction : prodId : Alternatives •; «prodId» + Alternatives : Alternatives •| SyntaxBody «;» + Alternatives : Alternatives •| SyntaxBody «|» +} +Transitions: + ; -> 85 + | -> 86 + + +S37{ + Alternatives : SyntaxBody• «;» + Alternatives : SyntaxBody• «|» +} +Transitions: + + +S38{ + SyntaxBody : Symbols• «;» + SyntaxBody : Symbols •g_sdt_lit «;» + Symbols : Symbols •Symbol «;» + Symbols : Symbols •Symbol «g_sdt_lit» + SyntaxBody : Symbols• «|» + SyntaxBody : Symbols •g_sdt_lit «|» + Symbols : Symbols •Symbol «prodId» + Symbols : Symbols •Symbol «string_lit» + Symbols : Symbols •Symbol «tokId» + Symbols : Symbols •Symbol «|» + Symbol : •prodId «;» + Symbol : •tokId «;» + Symbol : •string_lit «;» + Symbol : •prodId «g_sdt_lit» + Symbol : •tokId «g_sdt_lit» + Symbol : •string_lit «g_sdt_lit» + Symbol : •prodId «prodId» + Symbol : •tokId «prodId» + Symbol : •string_lit «prodId» + Symbol : •prodId «string_lit» + Symbol : •tokId «string_lit» + Symbol : •string_lit «string_lit» + Symbol : •prodId «tokId» + Symbol : •tokId «tokId» + Symbol : •string_lit «tokId» + Symbol : •prodId «|» + Symbol : •tokId «|» + Symbol : •string_lit «|» +} +Transitions: + tokId -> 34 + prodId -> 35 + string_lit -> 42 + g_sdt_lit -> 87 + Symbol -> 88 + + +S39{ + SyntaxBody : ErrorSymbol• «;» + SyntaxBody : ErrorSymbol •Symbols «;» + SyntaxBody : ErrorSymbol •Symbols g_sdt_lit «;» + SyntaxBody : ErrorSymbol •g_sdt_lit «;» + SyntaxBody : ErrorSymbol• «|» + SyntaxBody : ErrorSymbol •Symbols «|» + SyntaxBody : ErrorSymbol •Symbols g_sdt_lit «|» + SyntaxBody : ErrorSymbol •g_sdt_lit «|» + Symbols : •Symbol «;» + Symbols : •Symbols Symbol «;» + Symbols : •Symbol «g_sdt_lit» + Symbols : •Symbols Symbol «g_sdt_lit» + Symbols : •Symbol «|» + Symbols : •Symbols Symbol «|» + Symbol : •prodId «;» + Symbol : •tokId «;» + Symbol : •string_lit «;» + Symbols : •Symbol «prodId» + Symbols : •Symbol «string_lit» + Symbols : •Symbol «tokId» + Symbols : •Symbols Symbol «prodId» + Symbols : •Symbols Symbol «string_lit» + Symbols : •Symbols Symbol «tokId» + Symbol : •prodId «g_sdt_lit» + Symbol : •tokId «g_sdt_lit» + Symbol : •string_lit «g_sdt_lit» + Symbol : •prodId «|» + Symbol : •tokId «|» + Symbol : •string_lit «|» + Symbol : •prodId «prodId» + Symbol : •tokId «prodId» + Symbol : •string_lit «prodId» + Symbol : •prodId «string_lit» + Symbol : •tokId «string_lit» + Symbol : •string_lit «string_lit» + Symbol : •prodId «tokId» + Symbol : •tokId «tokId» + Symbol : •string_lit «tokId» +} +Transitions: + tokId -> 34 + prodId -> 35 + Symbol -> 41 + string_lit -> 42 + g_sdt_lit -> 89 + Symbols -> 90 + + +S40{ + SyntaxBody : EpsilonSymbol• «;» + SyntaxBody : EpsilonSymbol• «|» +} +Transitions: + + +S41{ + Symbols : Symbol• «;» + Symbols : Symbol• «g_sdt_lit» + Symbols : Symbol• «prodId» + Symbols : Symbol• «string_lit» + Symbols : Symbol• «tokId» + Symbols : Symbol• «|» +} +Transitions: + + +S42{ + Symbol : string_lit• «;» + Symbol : string_lit• «g_sdt_lit» + Symbol : string_lit• «prodId» + Symbol : string_lit• «string_lit» + Symbol : string_lit• «tokId» + Symbol : string_lit• «|» +} +Transitions: + + +S43{ + ErrorSymbol : errore• «;» + ErrorSymbol : errore• «prodId» + ErrorSymbol : errore• «string_lit» + ErrorSymbol : errore• «tokId» + ErrorSymbol : errore• «g_sdt_lit» + ErrorSymbol : errore• «|» +} +Transitions: + + +S44{ + ErrorSymbol : λ• «;» + ErrorSymbol : λ• «prodId» + ErrorSymbol : λ• «string_lit» + ErrorSymbol : λ• «tokId» + ErrorSymbol : λ• «g_sdt_lit» + ErrorSymbol : λ• «|» +} +Transitions: + + +S45{ + EpsilonSymbol : empty• «;» + EpsilonSymbol : empty• «|» +} +Transitions: + + +S46{ + EpsilonSymbol : ε• «;» + EpsilonSymbol : ε• «|» +} +Transitions: + + +S47{ + LexProduction : tokId : LexPattern ;• «g_sdt_lit» + LexProduction : tokId : LexPattern ;• «prodId» + LexProduction : tokId : LexPattern ;• «Ω» + LexProduction : tokId : LexPattern ;• «ignoredTokId» + LexProduction : tokId : LexPattern ;• «regDefId» + LexProduction : tokId : LexPattern ;• «tokId» +} +Transitions: + + +S48{ + LexPattern : LexPattern | •LexAlt «;» + LexPattern : LexPattern | •LexAlt «|» + LexAlt : •LexTerm «;» + LexAlt : •LexAlt LexTerm «;» + LexAlt : •LexTerm «|» + LexAlt : •LexAlt LexTerm «|» + LexTerm : •. «;» + LexTerm : •char_lit «;» + LexTerm : •char_lit - char_lit «;» + LexTerm : •~ char_lit «;» + LexTerm : •~ ( char_lit - char_lit ) «;» + LexTerm : •regDefId «;» + LexTerm : •[ LexPattern ] «;» + LexTerm : •{ LexPattern } «;» + LexTerm : •( LexPattern ) «;» + LexAlt : •LexTerm «(» + LexAlt : •LexTerm «.» + LexAlt : •LexTerm «[» + LexAlt : •LexTerm «char_lit» + LexAlt : •LexTerm «regDefId» + LexAlt : •LexTerm «{» + LexAlt : •LexTerm «~» + LexAlt : •LexAlt LexTerm «(» + LexAlt : •LexAlt LexTerm «.» + LexAlt : •LexAlt LexTerm «[» + LexAlt : •LexAlt LexTerm «char_lit» + LexAlt : •LexAlt LexTerm «regDefId» + LexAlt : •LexAlt LexTerm «{» + LexAlt : •LexAlt LexTerm «~» + LexTerm : •. «|» + LexTerm : •char_lit «|» + LexTerm : •char_lit - char_lit «|» + LexTerm : •~ char_lit «|» + LexTerm : •~ ( char_lit - char_lit ) «|» + LexTerm : •regDefId «|» + LexTerm : •[ LexPattern ] «|» + LexTerm : •{ LexPattern } «|» + LexTerm : •( LexPattern ) «|» + LexTerm : •. «(» + LexTerm : •char_lit «(» + LexTerm : •char_lit - char_lit «(» + LexTerm : •~ char_lit «(» + LexTerm : •~ ( char_lit - char_lit ) «(» + LexTerm : •regDefId «(» + LexTerm : •[ LexPattern ] «(» + LexTerm : •{ LexPattern } «(» + LexTerm : •( LexPattern ) «(» + LexTerm : •. «.» + LexTerm : •char_lit «.» + LexTerm : •char_lit - char_lit «.» + LexTerm : •~ char_lit «.» + LexTerm : •~ ( char_lit - char_lit ) «.» + LexTerm : •regDefId «.» + LexTerm : •[ LexPattern ] «.» + LexTerm : •{ LexPattern } «.» + LexTerm : •( LexPattern ) «.» + LexTerm : •. «[» + LexTerm : •char_lit «[» + LexTerm : •char_lit - char_lit «[» + LexTerm : •~ char_lit «[» + LexTerm : •~ ( char_lit - char_lit ) «[» + LexTerm : •regDefId «[» + LexTerm : •[ LexPattern ] «[» + LexTerm : •{ LexPattern } «[» + LexTerm : •( LexPattern ) «[» + LexTerm : •. «char_lit» + LexTerm : •char_lit «char_lit» + LexTerm : •char_lit - char_lit «char_lit» + LexTerm : •~ char_lit «char_lit» + LexTerm : •~ ( char_lit - char_lit ) «char_lit» + LexTerm : •regDefId «char_lit» + LexTerm : •[ LexPattern ] «char_lit» + LexTerm : •{ LexPattern } «char_lit» + LexTerm : •( LexPattern ) «char_lit» + LexTerm : •. «regDefId» + LexTerm : •char_lit «regDefId» + LexTerm : •char_lit - char_lit «regDefId» + LexTerm : •~ char_lit «regDefId» + LexTerm : •~ ( char_lit - char_lit ) «regDefId» + LexTerm : •regDefId «regDefId» + LexTerm : •[ LexPattern ] «regDefId» + LexTerm : •{ LexPattern } «regDefId» + LexTerm : •( LexPattern ) «regDefId» + LexTerm : •. «{» + LexTerm : •char_lit «{» + LexTerm : •char_lit - char_lit «{» + LexTerm : •~ char_lit «{» + LexTerm : •~ ( char_lit - char_lit ) «{» + LexTerm : •regDefId «{» + LexTerm : •[ LexPattern ] «{» + LexTerm : •{ LexPattern } «{» + LexTerm : •( LexPattern ) «{» + LexTerm : •. «~» + LexTerm : •char_lit «~» + LexTerm : •char_lit - char_lit «~» + LexTerm : •~ char_lit «~» + LexTerm : •~ ( char_lit - char_lit ) «~» + LexTerm : •regDefId «~» + LexTerm : •[ LexPattern ] «~» + LexTerm : •{ LexPattern } «~» + LexTerm : •( LexPattern ) «~» +} +Transitions: + regDefId -> 23 + LexTerm -> 25 + . -> 26 + char_lit -> 27 + ~ -> 28 + ( -> 29 + [ -> 30 + { -> 31 + LexAlt -> 91 + + +S49{ + LexAlt : LexAlt LexTerm• «;» + LexAlt : LexAlt LexTerm• «(» + LexAlt : LexAlt LexTerm• «.» + LexAlt : LexAlt LexTerm• «[» + LexAlt : LexAlt LexTerm• «char_lit» + LexAlt : LexAlt LexTerm• «regDefId» + LexAlt : LexAlt LexTerm• «{» + LexAlt : LexAlt LexTerm• «~» + LexAlt : LexAlt LexTerm• «|» +} +Transitions: + + +S50{ + LexTerm : char_lit - •char_lit «;» + LexTerm : char_lit - •char_lit «(» + LexTerm : char_lit - •char_lit «.» + LexTerm : char_lit - •char_lit «[» + LexTerm : char_lit - •char_lit «char_lit» + LexTerm : char_lit - •char_lit «regDefId» + LexTerm : char_lit - •char_lit «{» + LexTerm : char_lit - •char_lit «~» + LexTerm : char_lit - •char_lit «|» +} +Transitions: + char_lit -> 92 + + +S51{ + LexTerm : ~ char_lit• «;» + LexTerm : ~ char_lit• «(» + LexTerm : ~ char_lit• «.» + LexTerm : ~ char_lit• «[» + LexTerm : ~ char_lit• «char_lit» + LexTerm : ~ char_lit• «regDefId» + LexTerm : ~ char_lit• «{» + LexTerm : ~ char_lit• «~» + LexTerm : ~ char_lit• «|» +} +Transitions: + + +S52{ + LexTerm : ~ ( •char_lit - char_lit ) «;» + LexTerm : ~ ( •char_lit - char_lit ) «(» + LexTerm : ~ ( •char_lit - char_lit ) «.» + LexTerm : ~ ( •char_lit - char_lit ) «[» + LexTerm : ~ ( •char_lit - char_lit ) «char_lit» + LexTerm : ~ ( •char_lit - char_lit ) «regDefId» + LexTerm : ~ ( •char_lit - char_lit ) «{» + LexTerm : ~ ( •char_lit - char_lit ) «~» + LexTerm : ~ ( •char_lit - char_lit ) «|» +} +Transitions: + char_lit -> 93 + + +S53{ + LexTerm : ( LexPattern •) «;» + LexTerm : ( LexPattern •) «(» + LexTerm : ( LexPattern •) «.» + LexTerm : ( LexPattern •) «[» + LexTerm : ( LexPattern •) «char_lit» + LexTerm : ( LexPattern •) «regDefId» + LexTerm : ( LexPattern •) «{» + LexTerm : ( LexPattern •) «~» + LexTerm : ( LexPattern •) «|» + LexPattern : LexPattern •| LexAlt «)» + LexPattern : LexPattern •| LexAlt «|» +} +Transitions: + | -> 94 + ) -> 95 + + +S54{ + LexTerm : regDefId• «)» + LexTerm : regDefId• «(» + LexTerm : regDefId• «.» + LexTerm : regDefId• «[» + LexTerm : regDefId• «char_lit» + LexTerm : regDefId• «regDefId» + LexTerm : regDefId• «{» + LexTerm : regDefId• «~» + LexTerm : regDefId• «|» +} +Transitions: + + +S55{ + LexPattern : LexAlt• «)» + LexAlt : LexAlt •LexTerm «)» + LexPattern : LexAlt• «|» + LexAlt : LexAlt •LexTerm «(» + LexAlt : LexAlt •LexTerm «.» + LexAlt : LexAlt •LexTerm «[» + LexAlt : LexAlt •LexTerm «char_lit» + LexAlt : LexAlt •LexTerm «regDefId» + LexAlt : LexAlt •LexTerm «{» + LexAlt : LexAlt •LexTerm «~» + LexAlt : LexAlt •LexTerm «|» + LexTerm : •. «)» + LexTerm : •char_lit «)» + LexTerm : •char_lit - char_lit «)» + LexTerm : •~ char_lit «)» + LexTerm : •~ ( char_lit - char_lit ) «)» + LexTerm : •regDefId «)» + LexTerm : •[ LexPattern ] «)» + LexTerm : •{ LexPattern } «)» + LexTerm : •( LexPattern ) «)» + LexTerm : •. «(» + LexTerm : •char_lit «(» + LexTerm : •char_lit - char_lit «(» + LexTerm : •~ char_lit «(» + LexTerm : •~ ( char_lit - char_lit ) «(» + LexTerm : •regDefId «(» + LexTerm : •[ LexPattern ] «(» + LexTerm : •{ LexPattern } «(» + LexTerm : •( LexPattern ) «(» + LexTerm : •. «.» + LexTerm : •char_lit «.» + LexTerm : •char_lit - char_lit «.» + LexTerm : •~ char_lit «.» + LexTerm : •~ ( char_lit - char_lit ) «.» + LexTerm : •regDefId «.» + LexTerm : •[ LexPattern ] «.» + LexTerm : •{ LexPattern } «.» + LexTerm : •( LexPattern ) «.» + LexTerm : •. «[» + LexTerm : •char_lit «[» + LexTerm : •char_lit - char_lit «[» + LexTerm : •~ char_lit «[» + LexTerm : •~ ( char_lit - char_lit ) «[» + LexTerm : •regDefId «[» + LexTerm : •[ LexPattern ] «[» + LexTerm : •{ LexPattern } «[» + LexTerm : •( LexPattern ) «[» + LexTerm : •. «char_lit» + LexTerm : •char_lit «char_lit» + LexTerm : •char_lit - char_lit «char_lit» + LexTerm : •~ char_lit «char_lit» + LexTerm : •~ ( char_lit - char_lit ) «char_lit» + LexTerm : •regDefId «char_lit» + LexTerm : •[ LexPattern ] «char_lit» + LexTerm : •{ LexPattern } «char_lit» + LexTerm : •( LexPattern ) «char_lit» + LexTerm : •. «regDefId» + LexTerm : •char_lit «regDefId» + LexTerm : •char_lit - char_lit «regDefId» + LexTerm : •~ char_lit «regDefId» + LexTerm : •~ ( char_lit - char_lit ) «regDefId» + LexTerm : •regDefId «regDefId» + LexTerm : •[ LexPattern ] «regDefId» + LexTerm : •{ LexPattern } «regDefId» + LexTerm : •( LexPattern ) «regDefId» + LexTerm : •. «{» + LexTerm : •char_lit «{» + LexTerm : •char_lit - char_lit «{» + LexTerm : •~ char_lit «{» + LexTerm : •~ ( char_lit - char_lit ) «{» + LexTerm : •regDefId «{» + LexTerm : •[ LexPattern ] «{» + LexTerm : •{ LexPattern } «{» + LexTerm : •( LexPattern ) «{» + LexTerm : •. «~» + LexTerm : •char_lit «~» + LexTerm : •char_lit - char_lit «~» + LexTerm : •~ char_lit «~» + LexTerm : •~ ( char_lit - char_lit ) «~» + LexTerm : •regDefId «~» + LexTerm : •[ LexPattern ] «~» + LexTerm : •{ LexPattern } «~» + LexTerm : •( LexPattern ) «~» + LexTerm : •. «|» + LexTerm : •char_lit «|» + LexTerm : •char_lit - char_lit «|» + LexTerm : •~ char_lit «|» + LexTerm : •~ ( char_lit - char_lit ) «|» + LexTerm : •regDefId «|» + LexTerm : •[ LexPattern ] «|» + LexTerm : •{ LexPattern } «|» + LexTerm : •( LexPattern ) «|» +} +Transitions: + regDefId -> 54 + . -> 57 + char_lit -> 58 + ~ -> 59 + ( -> 60 + [ -> 61 + { -> 62 + LexTerm -> 96 + + +S56{ + LexAlt : LexTerm• «)» + LexAlt : LexTerm• «(» + LexAlt : LexTerm• «.» + LexAlt : LexTerm• «[» + LexAlt : LexTerm• «char_lit» + LexAlt : LexTerm• «regDefId» + LexAlt : LexTerm• «{» + LexAlt : LexTerm• «~» + LexAlt : LexTerm• «|» +} +Transitions: + + +S57{ + LexTerm : .• «)» + LexTerm : .• «(» + LexTerm : .• «.» + LexTerm : .• «[» + LexTerm : .• «char_lit» + LexTerm : .• «regDefId» + LexTerm : .• «{» + LexTerm : .• «~» + LexTerm : .• «|» +} +Transitions: + + +S58{ + LexTerm : char_lit• «)» + LexTerm : char_lit •- char_lit «)» + LexTerm : char_lit• «(» + LexTerm : char_lit •- char_lit «(» + LexTerm : char_lit• «.» + LexTerm : char_lit •- char_lit «.» + LexTerm : char_lit• «[» + LexTerm : char_lit •- char_lit «[» + LexTerm : char_lit• «char_lit» + LexTerm : char_lit •- char_lit «char_lit» + LexTerm : char_lit• «regDefId» + LexTerm : char_lit •- char_lit «regDefId» + LexTerm : char_lit• «{» + LexTerm : char_lit •- char_lit «{» + LexTerm : char_lit• «~» + LexTerm : char_lit •- char_lit «~» + LexTerm : char_lit• «|» + LexTerm : char_lit •- char_lit «|» +} +Transitions: + - -> 97 + + +S59{ + LexTerm : ~ •char_lit «)» + LexTerm : ~ •( char_lit - char_lit ) «)» + LexTerm : ~ •char_lit «(» + LexTerm : ~ •( char_lit - char_lit ) «(» + LexTerm : ~ •char_lit «.» + LexTerm : ~ •( char_lit - char_lit ) «.» + LexTerm : ~ •char_lit «[» + LexTerm : ~ •( char_lit - char_lit ) «[» + LexTerm : ~ •char_lit «char_lit» + LexTerm : ~ •( char_lit - char_lit ) «char_lit» + LexTerm : ~ •char_lit «regDefId» + LexTerm : ~ •( char_lit - char_lit ) «regDefId» + LexTerm : ~ •char_lit «{» + LexTerm : ~ •( char_lit - char_lit ) «{» + LexTerm : ~ •char_lit «~» + LexTerm : ~ •( char_lit - char_lit ) «~» + LexTerm : ~ •char_lit «|» + LexTerm : ~ •( char_lit - char_lit ) «|» +} +Transitions: + char_lit -> 98 + ( -> 99 + + +S60{ + LexTerm : ( •LexPattern ) «)» + LexTerm : ( •LexPattern ) «(» + LexTerm : ( •LexPattern ) «.» + LexTerm : ( •LexPattern ) «[» + LexTerm : ( •LexPattern ) «char_lit» + LexTerm : ( •LexPattern ) «regDefId» + LexTerm : ( •LexPattern ) «{» + LexTerm : ( •LexPattern ) «~» + LexTerm : ( •LexPattern ) «|» + LexPattern : •LexAlt «)» + LexPattern : •LexPattern | LexAlt «)» + LexAlt : •LexTerm «)» + LexAlt : •LexAlt LexTerm «)» + LexPattern : •LexAlt «|» + LexPattern : •LexPattern | LexAlt «|» + LexTerm : •. «)» + LexTerm : •char_lit «)» + LexTerm : •char_lit - char_lit «)» + LexTerm : •~ char_lit «)» + LexTerm : •~ ( char_lit - char_lit ) «)» + LexTerm : •regDefId «)» + LexTerm : •[ LexPattern ] «)» + LexTerm : •{ LexPattern } «)» + LexTerm : •( LexPattern ) «)» + LexAlt : •LexTerm «(» + LexAlt : •LexTerm «.» + LexAlt : •LexTerm «[» + LexAlt : •LexTerm «char_lit» + LexAlt : •LexTerm «regDefId» + LexAlt : •LexTerm «{» + LexAlt : •LexTerm «~» + LexAlt : •LexAlt LexTerm «(» + LexAlt : •LexAlt LexTerm «.» + LexAlt : •LexAlt LexTerm «[» + LexAlt : •LexAlt LexTerm «char_lit» + LexAlt : •LexAlt LexTerm «regDefId» + LexAlt : •LexAlt LexTerm «{» + LexAlt : •LexAlt LexTerm «~» + LexAlt : •LexTerm «|» + LexAlt : •LexAlt LexTerm «|» + LexTerm : •. «(» + LexTerm : •char_lit «(» + LexTerm : •char_lit - char_lit «(» + LexTerm : •~ char_lit «(» + LexTerm : •~ ( char_lit - char_lit ) «(» + LexTerm : •regDefId «(» + LexTerm : •[ LexPattern ] «(» + LexTerm : •{ LexPattern } «(» + LexTerm : •( LexPattern ) «(» + LexTerm : •. «.» + LexTerm : •char_lit «.» + LexTerm : •char_lit - char_lit «.» + LexTerm : •~ char_lit «.» + LexTerm : •~ ( char_lit - char_lit ) «.» + LexTerm : •regDefId «.» + LexTerm : •[ LexPattern ] «.» + LexTerm : •{ LexPattern } «.» + LexTerm : •( LexPattern ) «.» + LexTerm : •. «[» + LexTerm : •char_lit «[» + LexTerm : •char_lit - char_lit «[» + LexTerm : •~ char_lit «[» + LexTerm : •~ ( char_lit - char_lit ) «[» + LexTerm : •regDefId «[» + LexTerm : •[ LexPattern ] «[» + LexTerm : •{ LexPattern } «[» + LexTerm : •( LexPattern ) «[» + LexTerm : •. «char_lit» + LexTerm : •char_lit «char_lit» + LexTerm : •char_lit - char_lit «char_lit» + LexTerm : •~ char_lit «char_lit» + LexTerm : •~ ( char_lit - char_lit ) «char_lit» + LexTerm : •regDefId «char_lit» + LexTerm : •[ LexPattern ] «char_lit» + LexTerm : •{ LexPattern } «char_lit» + LexTerm : •( LexPattern ) «char_lit» + LexTerm : •. «regDefId» + LexTerm : •char_lit «regDefId» + LexTerm : •char_lit - char_lit «regDefId» + LexTerm : •~ char_lit «regDefId» + LexTerm : •~ ( char_lit - char_lit ) «regDefId» + LexTerm : •regDefId «regDefId» + LexTerm : •[ LexPattern ] «regDefId» + LexTerm : •{ LexPattern } «regDefId» + LexTerm : •( LexPattern ) «regDefId» + LexTerm : •. «{» + LexTerm : •char_lit «{» + LexTerm : •char_lit - char_lit «{» + LexTerm : •~ char_lit «{» + LexTerm : •~ ( char_lit - char_lit ) «{» + LexTerm : •regDefId «{» + LexTerm : •[ LexPattern ] «{» + LexTerm : •{ LexPattern } «{» + LexTerm : •( LexPattern ) «{» + LexTerm : •. «~» + LexTerm : •char_lit «~» + LexTerm : •char_lit - char_lit «~» + LexTerm : •~ char_lit «~» + LexTerm : •~ ( char_lit - char_lit ) «~» + LexTerm : •regDefId «~» + LexTerm : •[ LexPattern ] «~» + LexTerm : •{ LexPattern } «~» + LexTerm : •( LexPattern ) «~» + LexTerm : •. «|» + LexTerm : •char_lit «|» + LexTerm : •char_lit - char_lit «|» + LexTerm : •~ char_lit «|» + LexTerm : •~ ( char_lit - char_lit ) «|» + LexTerm : •regDefId «|» + LexTerm : •[ LexPattern ] «|» + LexTerm : •{ LexPattern } «|» + LexTerm : •( LexPattern ) «|» +} +Transitions: + regDefId -> 54 + LexAlt -> 55 + LexTerm -> 56 + . -> 57 + char_lit -> 58 + ~ -> 59 + ( -> 60 + [ -> 61 + { -> 62 + LexPattern -> 100 + + +S61{ + LexTerm : [ •LexPattern ] «)» + LexTerm : [ •LexPattern ] «(» + LexTerm : [ •LexPattern ] «.» + LexTerm : [ •LexPattern ] «[» + LexTerm : [ •LexPattern ] «char_lit» + LexTerm : [ •LexPattern ] «regDefId» + LexTerm : [ •LexPattern ] «{» + LexTerm : [ •LexPattern ] «~» + LexTerm : [ •LexPattern ] «|» + LexPattern : •LexAlt «]» + LexPattern : •LexPattern | LexAlt «]» + LexAlt : •LexTerm «]» + LexAlt : •LexAlt LexTerm «]» + LexPattern : •LexAlt «|» + LexPattern : •LexPattern | LexAlt «|» + LexTerm : •. «]» + LexTerm : •char_lit «]» + LexTerm : •char_lit - char_lit «]» + LexTerm : •~ char_lit «]» + LexTerm : •~ ( char_lit - char_lit ) «]» + LexTerm : •regDefId «]» + LexTerm : •[ LexPattern ] «]» + LexTerm : •{ LexPattern } «]» + LexTerm : •( LexPattern ) «]» + LexAlt : •LexTerm «(» + LexAlt : •LexTerm «.» + LexAlt : •LexTerm «[» + LexAlt : •LexTerm «char_lit» + LexAlt : •LexTerm «regDefId» + LexAlt : •LexTerm «{» + LexAlt : •LexTerm «~» + LexAlt : •LexAlt LexTerm «(» + LexAlt : •LexAlt LexTerm «.» + LexAlt : •LexAlt LexTerm «[» + LexAlt : •LexAlt LexTerm «char_lit» + LexAlt : •LexAlt LexTerm «regDefId» + LexAlt : •LexAlt LexTerm «{» + LexAlt : •LexAlt LexTerm «~» + LexAlt : •LexTerm «|» + LexAlt : •LexAlt LexTerm «|» + LexTerm : •. «(» + LexTerm : •char_lit «(» + LexTerm : •char_lit - char_lit «(» + LexTerm : •~ char_lit «(» + LexTerm : •~ ( char_lit - char_lit ) «(» + LexTerm : •regDefId «(» + LexTerm : •[ LexPattern ] «(» + LexTerm : •{ LexPattern } «(» + LexTerm : •( LexPattern ) «(» + LexTerm : •. «.» + LexTerm : •char_lit «.» + LexTerm : •char_lit - char_lit «.» + LexTerm : •~ char_lit «.» + LexTerm : •~ ( char_lit - char_lit ) «.» + LexTerm : •regDefId «.» + LexTerm : •[ LexPattern ] «.» + LexTerm : •{ LexPattern } «.» + LexTerm : •( LexPattern ) «.» + LexTerm : •. «[» + LexTerm : •char_lit «[» + LexTerm : •char_lit - char_lit «[» + LexTerm : •~ char_lit «[» + LexTerm : •~ ( char_lit - char_lit ) «[» + LexTerm : •regDefId «[» + LexTerm : •[ LexPattern ] «[» + LexTerm : •{ LexPattern } «[» + LexTerm : •( LexPattern ) «[» + LexTerm : •. «char_lit» + LexTerm : •char_lit «char_lit» + LexTerm : •char_lit - char_lit «char_lit» + LexTerm : •~ char_lit «char_lit» + LexTerm : •~ ( char_lit - char_lit ) «char_lit» + LexTerm : •regDefId «char_lit» + LexTerm : •[ LexPattern ] «char_lit» + LexTerm : •{ LexPattern } «char_lit» + LexTerm : •( LexPattern ) «char_lit» + LexTerm : •. «regDefId» + LexTerm : •char_lit «regDefId» + LexTerm : •char_lit - char_lit «regDefId» + LexTerm : •~ char_lit «regDefId» + LexTerm : •~ ( char_lit - char_lit ) «regDefId» + LexTerm : •regDefId «regDefId» + LexTerm : •[ LexPattern ] «regDefId» + LexTerm : •{ LexPattern } «regDefId» + LexTerm : •( LexPattern ) «regDefId» + LexTerm : •. «{» + LexTerm : •char_lit «{» + LexTerm : •char_lit - char_lit «{» + LexTerm : •~ char_lit «{» + LexTerm : •~ ( char_lit - char_lit ) «{» + LexTerm : •regDefId «{» + LexTerm : •[ LexPattern ] «{» + LexTerm : •{ LexPattern } «{» + LexTerm : •( LexPattern ) «{» + LexTerm : •. «~» + LexTerm : •char_lit «~» + LexTerm : •char_lit - char_lit «~» + LexTerm : •~ char_lit «~» + LexTerm : •~ ( char_lit - char_lit ) «~» + LexTerm : •regDefId «~» + LexTerm : •[ LexPattern ] «~» + LexTerm : •{ LexPattern } «~» + LexTerm : •( LexPattern ) «~» + LexTerm : •. «|» + LexTerm : •char_lit «|» + LexTerm : •char_lit - char_lit «|» + LexTerm : •~ char_lit «|» + LexTerm : •~ ( char_lit - char_lit ) «|» + LexTerm : •regDefId «|» + LexTerm : •[ LexPattern ] «|» + LexTerm : •{ LexPattern } «|» + LexTerm : •( LexPattern ) «|» +} +Transitions: + regDefId -> 64 + LexAlt -> 65 + LexTerm -> 66 + . -> 67 + char_lit -> 68 + ~ -> 69 + ( -> 70 + [ -> 71 + { -> 72 + LexPattern -> 101 + + +S62{ + LexTerm : { •LexPattern } «)» + LexTerm : { •LexPattern } «(» + LexTerm : { •LexPattern } «.» + LexTerm : { •LexPattern } «[» + LexTerm : { •LexPattern } «char_lit» + LexTerm : { •LexPattern } «regDefId» + LexTerm : { •LexPattern } «{» + LexTerm : { •LexPattern } «~» + LexTerm : { •LexPattern } «|» + LexPattern : •LexAlt «}» + LexPattern : •LexPattern | LexAlt «}» + LexAlt : •LexTerm «}» + LexAlt : •LexAlt LexTerm «}» + LexPattern : •LexAlt «|» + LexPattern : •LexPattern | LexAlt «|» + LexTerm : •. «}» + LexTerm : •char_lit «}» + LexTerm : •char_lit - char_lit «}» + LexTerm : •~ char_lit «}» + LexTerm : •~ ( char_lit - char_lit ) «}» + LexTerm : •regDefId «}» + LexTerm : •[ LexPattern ] «}» + LexTerm : •{ LexPattern } «}» + LexTerm : •( LexPattern ) «}» + LexAlt : •LexTerm «(» + LexAlt : •LexTerm «.» + LexAlt : •LexTerm «[» + LexAlt : •LexTerm «char_lit» + LexAlt : •LexTerm «regDefId» + LexAlt : •LexTerm «{» + LexAlt : •LexTerm «~» + LexAlt : •LexAlt LexTerm «(» + LexAlt : •LexAlt LexTerm «.» + LexAlt : •LexAlt LexTerm «[» + LexAlt : •LexAlt LexTerm «char_lit» + LexAlt : •LexAlt LexTerm «regDefId» + LexAlt : •LexAlt LexTerm «{» + LexAlt : •LexAlt LexTerm «~» + LexAlt : •LexTerm «|» + LexAlt : •LexAlt LexTerm «|» + LexTerm : •. «(» + LexTerm : •char_lit «(» + LexTerm : •char_lit - char_lit «(» + LexTerm : •~ char_lit «(» + LexTerm : •~ ( char_lit - char_lit ) «(» + LexTerm : •regDefId «(» + LexTerm : •[ LexPattern ] «(» + LexTerm : •{ LexPattern } «(» + LexTerm : •( LexPattern ) «(» + LexTerm : •. «.» + LexTerm : •char_lit «.» + LexTerm : •char_lit - char_lit «.» + LexTerm : •~ char_lit «.» + LexTerm : •~ ( char_lit - char_lit ) «.» + LexTerm : •regDefId «.» + LexTerm : •[ LexPattern ] «.» + LexTerm : •{ LexPattern } «.» + LexTerm : •( LexPattern ) «.» + LexTerm : •. «[» + LexTerm : •char_lit «[» + LexTerm : •char_lit - char_lit «[» + LexTerm : •~ char_lit «[» + LexTerm : •~ ( char_lit - char_lit ) «[» + LexTerm : •regDefId «[» + LexTerm : •[ LexPattern ] «[» + LexTerm : •{ LexPattern } «[» + LexTerm : •( LexPattern ) «[» + LexTerm : •. «char_lit» + LexTerm : •char_lit «char_lit» + LexTerm : •char_lit - char_lit «char_lit» + LexTerm : •~ char_lit «char_lit» + LexTerm : •~ ( char_lit - char_lit ) «char_lit» + LexTerm : •regDefId «char_lit» + LexTerm : •[ LexPattern ] «char_lit» + LexTerm : •{ LexPattern } «char_lit» + LexTerm : •( LexPattern ) «char_lit» + LexTerm : •. «regDefId» + LexTerm : •char_lit «regDefId» + LexTerm : •char_lit - char_lit «regDefId» + LexTerm : •~ char_lit «regDefId» + LexTerm : •~ ( char_lit - char_lit ) «regDefId» + LexTerm : •regDefId «regDefId» + LexTerm : •[ LexPattern ] «regDefId» + LexTerm : •{ LexPattern } «regDefId» + LexTerm : •( LexPattern ) «regDefId» + LexTerm : •. «{» + LexTerm : •char_lit «{» + LexTerm : •char_lit - char_lit «{» + LexTerm : •~ char_lit «{» + LexTerm : •~ ( char_lit - char_lit ) «{» + LexTerm : •regDefId «{» + LexTerm : •[ LexPattern ] «{» + LexTerm : •{ LexPattern } «{» + LexTerm : •( LexPattern ) «{» + LexTerm : •. «~» + LexTerm : •char_lit «~» + LexTerm : •char_lit - char_lit «~» + LexTerm : •~ char_lit «~» + LexTerm : •~ ( char_lit - char_lit ) «~» + LexTerm : •regDefId «~» + LexTerm : •[ LexPattern ] «~» + LexTerm : •{ LexPattern } «~» + LexTerm : •( LexPattern ) «~» + LexTerm : •. «|» + LexTerm : •char_lit «|» + LexTerm : •char_lit - char_lit «|» + LexTerm : •~ char_lit «|» + LexTerm : •~ ( char_lit - char_lit ) «|» + LexTerm : •regDefId «|» + LexTerm : •[ LexPattern ] «|» + LexTerm : •{ LexPattern } «|» + LexTerm : •( LexPattern ) «|» +} +Transitions: + regDefId -> 74 + LexAlt -> 75 + LexTerm -> 76 + . -> 77 + char_lit -> 78 + ~ -> 79 + ( -> 80 + [ -> 81 + { -> 82 + LexPattern -> 102 + + +S63{ + LexTerm : [ LexPattern •] «;» + LexTerm : [ LexPattern •] «(» + LexTerm : [ LexPattern •] «.» + LexTerm : [ LexPattern •] «[» + LexTerm : [ LexPattern •] «char_lit» + LexTerm : [ LexPattern •] «regDefId» + LexTerm : [ LexPattern •] «{» + LexTerm : [ LexPattern •] «~» + LexTerm : [ LexPattern •] «|» + LexPattern : LexPattern •| LexAlt «]» + LexPattern : LexPattern •| LexAlt «|» +} +Transitions: + | -> 103 + ] -> 104 + + +S64{ + LexTerm : regDefId• «]» + LexTerm : regDefId• «(» + LexTerm : regDefId• «.» + LexTerm : regDefId• «[» + LexTerm : regDefId• «char_lit» + LexTerm : regDefId• «regDefId» + LexTerm : regDefId• «{» + LexTerm : regDefId• «~» + LexTerm : regDefId• «|» +} +Transitions: + + +S65{ + LexPattern : LexAlt• «]» + LexAlt : LexAlt •LexTerm «]» + LexPattern : LexAlt• «|» + LexAlt : LexAlt •LexTerm «(» + LexAlt : LexAlt •LexTerm «.» + LexAlt : LexAlt •LexTerm «[» + LexAlt : LexAlt •LexTerm «char_lit» + LexAlt : LexAlt •LexTerm «regDefId» + LexAlt : LexAlt •LexTerm «{» + LexAlt : LexAlt •LexTerm «~» + LexAlt : LexAlt •LexTerm «|» + LexTerm : •. «]» + LexTerm : •char_lit «]» + LexTerm : •char_lit - char_lit «]» + LexTerm : •~ char_lit «]» + LexTerm : •~ ( char_lit - char_lit ) «]» + LexTerm : •regDefId «]» + LexTerm : •[ LexPattern ] «]» + LexTerm : •{ LexPattern } «]» + LexTerm : •( LexPattern ) «]» + LexTerm : •. «(» + LexTerm : •char_lit «(» + LexTerm : •char_lit - char_lit «(» + LexTerm : •~ char_lit «(» + LexTerm : •~ ( char_lit - char_lit ) «(» + LexTerm : •regDefId «(» + LexTerm : •[ LexPattern ] «(» + LexTerm : •{ LexPattern } «(» + LexTerm : •( LexPattern ) «(» + LexTerm : •. «.» + LexTerm : •char_lit «.» + LexTerm : •char_lit - char_lit «.» + LexTerm : •~ char_lit «.» + LexTerm : •~ ( char_lit - char_lit ) «.» + LexTerm : •regDefId «.» + LexTerm : •[ LexPattern ] «.» + LexTerm : •{ LexPattern } «.» + LexTerm : •( LexPattern ) «.» + LexTerm : •. «[» + LexTerm : •char_lit «[» + LexTerm : •char_lit - char_lit «[» + LexTerm : •~ char_lit «[» + LexTerm : •~ ( char_lit - char_lit ) «[» + LexTerm : •regDefId «[» + LexTerm : •[ LexPattern ] «[» + LexTerm : •{ LexPattern } «[» + LexTerm : •( LexPattern ) «[» + LexTerm : •. «char_lit» + LexTerm : •char_lit «char_lit» + LexTerm : •char_lit - char_lit «char_lit» + LexTerm : •~ char_lit «char_lit» + LexTerm : •~ ( char_lit - char_lit ) «char_lit» + LexTerm : •regDefId «char_lit» + LexTerm : •[ LexPattern ] «char_lit» + LexTerm : •{ LexPattern } «char_lit» + LexTerm : •( LexPattern ) «char_lit» + LexTerm : •. «regDefId» + LexTerm : •char_lit «regDefId» + LexTerm : •char_lit - char_lit «regDefId» + LexTerm : •~ char_lit «regDefId» + LexTerm : •~ ( char_lit - char_lit ) «regDefId» + LexTerm : •regDefId «regDefId» + LexTerm : •[ LexPattern ] «regDefId» + LexTerm : •{ LexPattern } «regDefId» + LexTerm : •( LexPattern ) «regDefId» + LexTerm : •. «{» + LexTerm : •char_lit «{» + LexTerm : •char_lit - char_lit «{» + LexTerm : •~ char_lit «{» + LexTerm : •~ ( char_lit - char_lit ) «{» + LexTerm : •regDefId «{» + LexTerm : •[ LexPattern ] «{» + LexTerm : •{ LexPattern } «{» + LexTerm : •( LexPattern ) «{» + LexTerm : •. «~» + LexTerm : •char_lit «~» + LexTerm : •char_lit - char_lit «~» + LexTerm : •~ char_lit «~» + LexTerm : •~ ( char_lit - char_lit ) «~» + LexTerm : •regDefId «~» + LexTerm : •[ LexPattern ] «~» + LexTerm : •{ LexPattern } «~» + LexTerm : •( LexPattern ) «~» + LexTerm : •. «|» + LexTerm : •char_lit «|» + LexTerm : •char_lit - char_lit «|» + LexTerm : •~ char_lit «|» + LexTerm : •~ ( char_lit - char_lit ) «|» + LexTerm : •regDefId «|» + LexTerm : •[ LexPattern ] «|» + LexTerm : •{ LexPattern } «|» + LexTerm : •( LexPattern ) «|» +} +Transitions: + regDefId -> 64 + . -> 67 + char_lit -> 68 + ~ -> 69 + ( -> 70 + [ -> 71 + { -> 72 + LexTerm -> 105 + + +S66{ + LexAlt : LexTerm• «]» + LexAlt : LexTerm• «(» + LexAlt : LexTerm• «.» + LexAlt : LexTerm• «[» + LexAlt : LexTerm• «char_lit» + LexAlt : LexTerm• «regDefId» + LexAlt : LexTerm• «{» + LexAlt : LexTerm• «~» + LexAlt : LexTerm• «|» +} +Transitions: + + +S67{ + LexTerm : .• «]» + LexTerm : .• «(» + LexTerm : .• «.» + LexTerm : .• «[» + LexTerm : .• «char_lit» + LexTerm : .• «regDefId» + LexTerm : .• «{» + LexTerm : .• «~» + LexTerm : .• «|» +} +Transitions: + + +S68{ + LexTerm : char_lit• «]» + LexTerm : char_lit •- char_lit «]» + LexTerm : char_lit• «(» + LexTerm : char_lit •- char_lit «(» + LexTerm : char_lit• «.» + LexTerm : char_lit •- char_lit «.» + LexTerm : char_lit• «[» + LexTerm : char_lit •- char_lit «[» + LexTerm : char_lit• «char_lit» + LexTerm : char_lit •- char_lit «char_lit» + LexTerm : char_lit• «regDefId» + LexTerm : char_lit •- char_lit «regDefId» + LexTerm : char_lit• «{» + LexTerm : char_lit •- char_lit «{» + LexTerm : char_lit• «~» + LexTerm : char_lit •- char_lit «~» + LexTerm : char_lit• «|» + LexTerm : char_lit •- char_lit «|» +} +Transitions: + - -> 106 + + +S69{ + LexTerm : ~ •char_lit «]» + LexTerm : ~ •( char_lit - char_lit ) «]» + LexTerm : ~ •char_lit «(» + LexTerm : ~ •( char_lit - char_lit ) «(» + LexTerm : ~ •char_lit «.» + LexTerm : ~ •( char_lit - char_lit ) «.» + LexTerm : ~ •char_lit «[» + LexTerm : ~ •( char_lit - char_lit ) «[» + LexTerm : ~ •char_lit «char_lit» + LexTerm : ~ •( char_lit - char_lit ) «char_lit» + LexTerm : ~ •char_lit «regDefId» + LexTerm : ~ •( char_lit - char_lit ) «regDefId» + LexTerm : ~ •char_lit «{» + LexTerm : ~ •( char_lit - char_lit ) «{» + LexTerm : ~ •char_lit «~» + LexTerm : ~ •( char_lit - char_lit ) «~» + LexTerm : ~ •char_lit «|» + LexTerm : ~ •( char_lit - char_lit ) «|» +} +Transitions: + char_lit -> 107 + ( -> 108 + + +S70{ + LexTerm : ( •LexPattern ) «]» + LexTerm : ( •LexPattern ) «(» + LexTerm : ( •LexPattern ) «.» + LexTerm : ( •LexPattern ) «[» + LexTerm : ( •LexPattern ) «char_lit» + LexTerm : ( •LexPattern ) «regDefId» + LexTerm : ( •LexPattern ) «{» + LexTerm : ( •LexPattern ) «~» + LexTerm : ( •LexPattern ) «|» + LexPattern : •LexAlt «)» + LexPattern : •LexPattern | LexAlt «)» + LexAlt : •LexTerm «)» + LexAlt : •LexAlt LexTerm «)» + LexPattern : •LexAlt «|» + LexPattern : •LexPattern | LexAlt «|» + LexTerm : •. «)» + LexTerm : •char_lit «)» + LexTerm : •char_lit - char_lit «)» + LexTerm : •~ char_lit «)» + LexTerm : •~ ( char_lit - char_lit ) «)» + LexTerm : •regDefId «)» + LexTerm : •[ LexPattern ] «)» + LexTerm : •{ LexPattern } «)» + LexTerm : •( LexPattern ) «)» + LexAlt : •LexTerm «(» + LexAlt : •LexTerm «.» + LexAlt : •LexTerm «[» + LexAlt : •LexTerm «char_lit» + LexAlt : •LexTerm «regDefId» + LexAlt : •LexTerm «{» + LexAlt : •LexTerm «~» + LexAlt : •LexAlt LexTerm «(» + LexAlt : •LexAlt LexTerm «.» + LexAlt : •LexAlt LexTerm «[» + LexAlt : •LexAlt LexTerm «char_lit» + LexAlt : •LexAlt LexTerm «regDefId» + LexAlt : •LexAlt LexTerm «{» + LexAlt : •LexAlt LexTerm «~» + LexAlt : •LexTerm «|» + LexAlt : •LexAlt LexTerm «|» + LexTerm : •. «(» + LexTerm : •char_lit «(» + LexTerm : •char_lit - char_lit «(» + LexTerm : •~ char_lit «(» + LexTerm : •~ ( char_lit - char_lit ) «(» + LexTerm : •regDefId «(» + LexTerm : •[ LexPattern ] «(» + LexTerm : •{ LexPattern } «(» + LexTerm : •( LexPattern ) «(» + LexTerm : •. «.» + LexTerm : •char_lit «.» + LexTerm : •char_lit - char_lit «.» + LexTerm : •~ char_lit «.» + LexTerm : •~ ( char_lit - char_lit ) «.» + LexTerm : •regDefId «.» + LexTerm : •[ LexPattern ] «.» + LexTerm : •{ LexPattern } «.» + LexTerm : •( LexPattern ) «.» + LexTerm : •. «[» + LexTerm : •char_lit «[» + LexTerm : •char_lit - char_lit «[» + LexTerm : •~ char_lit «[» + LexTerm : •~ ( char_lit - char_lit ) «[» + LexTerm : •regDefId «[» + LexTerm : •[ LexPattern ] «[» + LexTerm : •{ LexPattern } «[» + LexTerm : •( LexPattern ) «[» + LexTerm : •. «char_lit» + LexTerm : •char_lit «char_lit» + LexTerm : •char_lit - char_lit «char_lit» + LexTerm : •~ char_lit «char_lit» + LexTerm : •~ ( char_lit - char_lit ) «char_lit» + LexTerm : •regDefId «char_lit» + LexTerm : •[ LexPattern ] «char_lit» + LexTerm : •{ LexPattern } «char_lit» + LexTerm : •( LexPattern ) «char_lit» + LexTerm : •. «regDefId» + LexTerm : •char_lit «regDefId» + LexTerm : •char_lit - char_lit «regDefId» + LexTerm : •~ char_lit «regDefId» + LexTerm : •~ ( char_lit - char_lit ) «regDefId» + LexTerm : •regDefId «regDefId» + LexTerm : •[ LexPattern ] «regDefId» + LexTerm : •{ LexPattern } «regDefId» + LexTerm : •( LexPattern ) «regDefId» + LexTerm : •. «{» + LexTerm : •char_lit «{» + LexTerm : •char_lit - char_lit «{» + LexTerm : •~ char_lit «{» + LexTerm : •~ ( char_lit - char_lit ) «{» + LexTerm : •regDefId «{» + LexTerm : •[ LexPattern ] «{» + LexTerm : •{ LexPattern } «{» + LexTerm : •( LexPattern ) «{» + LexTerm : •. «~» + LexTerm : •char_lit «~» + LexTerm : •char_lit - char_lit «~» + LexTerm : •~ char_lit «~» + LexTerm : •~ ( char_lit - char_lit ) «~» + LexTerm : •regDefId «~» + LexTerm : •[ LexPattern ] «~» + LexTerm : •{ LexPattern } «~» + LexTerm : •( LexPattern ) «~» + LexTerm : •. «|» + LexTerm : •char_lit «|» + LexTerm : •char_lit - char_lit «|» + LexTerm : •~ char_lit «|» + LexTerm : •~ ( char_lit - char_lit ) «|» + LexTerm : •regDefId «|» + LexTerm : •[ LexPattern ] «|» + LexTerm : •{ LexPattern } «|» + LexTerm : •( LexPattern ) «|» +} +Transitions: + regDefId -> 54 + LexAlt -> 55 + LexTerm -> 56 + . -> 57 + char_lit -> 58 + ~ -> 59 + ( -> 60 + [ -> 61 + { -> 62 + LexPattern -> 109 + + +S71{ + LexTerm : [ •LexPattern ] «]» + LexTerm : [ •LexPattern ] «(» + LexTerm : [ •LexPattern ] «.» + LexTerm : [ •LexPattern ] «[» + LexTerm : [ •LexPattern ] «char_lit» + LexTerm : [ •LexPattern ] «regDefId» + LexTerm : [ •LexPattern ] «{» + LexTerm : [ •LexPattern ] «~» + LexTerm : [ •LexPattern ] «|» + LexPattern : •LexAlt «]» + LexPattern : •LexPattern | LexAlt «]» + LexAlt : •LexTerm «]» + LexAlt : •LexAlt LexTerm «]» + LexPattern : •LexAlt «|» + LexPattern : •LexPattern | LexAlt «|» + LexTerm : •. «]» + LexTerm : •char_lit «]» + LexTerm : •char_lit - char_lit «]» + LexTerm : •~ char_lit «]» + LexTerm : •~ ( char_lit - char_lit ) «]» + LexTerm : •regDefId «]» + LexTerm : •[ LexPattern ] «]» + LexTerm : •{ LexPattern } «]» + LexTerm : •( LexPattern ) «]» + LexAlt : •LexTerm «(» + LexAlt : •LexTerm «.» + LexAlt : •LexTerm «[» + LexAlt : •LexTerm «char_lit» + LexAlt : •LexTerm «regDefId» + LexAlt : •LexTerm «{» + LexAlt : •LexTerm «~» + LexAlt : •LexAlt LexTerm «(» + LexAlt : •LexAlt LexTerm «.» + LexAlt : •LexAlt LexTerm «[» + LexAlt : •LexAlt LexTerm «char_lit» + LexAlt : •LexAlt LexTerm «regDefId» + LexAlt : •LexAlt LexTerm «{» + LexAlt : •LexAlt LexTerm «~» + LexAlt : •LexTerm «|» + LexAlt : •LexAlt LexTerm «|» + LexTerm : •. «(» + LexTerm : •char_lit «(» + LexTerm : •char_lit - char_lit «(» + LexTerm : •~ char_lit «(» + LexTerm : •~ ( char_lit - char_lit ) «(» + LexTerm : •regDefId «(» + LexTerm : •[ LexPattern ] «(» + LexTerm : •{ LexPattern } «(» + LexTerm : •( LexPattern ) «(» + LexTerm : •. «.» + LexTerm : •char_lit «.» + LexTerm : •char_lit - char_lit «.» + LexTerm : •~ char_lit «.» + LexTerm : •~ ( char_lit - char_lit ) «.» + LexTerm : •regDefId «.» + LexTerm : •[ LexPattern ] «.» + LexTerm : •{ LexPattern } «.» + LexTerm : •( LexPattern ) «.» + LexTerm : •. «[» + LexTerm : •char_lit «[» + LexTerm : •char_lit - char_lit «[» + LexTerm : •~ char_lit «[» + LexTerm : •~ ( char_lit - char_lit ) «[» + LexTerm : •regDefId «[» + LexTerm : •[ LexPattern ] «[» + LexTerm : •{ LexPattern } «[» + LexTerm : •( LexPattern ) «[» + LexTerm : •. «char_lit» + LexTerm : •char_lit «char_lit» + LexTerm : •char_lit - char_lit «char_lit» + LexTerm : •~ char_lit «char_lit» + LexTerm : •~ ( char_lit - char_lit ) «char_lit» + LexTerm : •regDefId «char_lit» + LexTerm : •[ LexPattern ] «char_lit» + LexTerm : •{ LexPattern } «char_lit» + LexTerm : •( LexPattern ) «char_lit» + LexTerm : •. «regDefId» + LexTerm : •char_lit «regDefId» + LexTerm : •char_lit - char_lit «regDefId» + LexTerm : •~ char_lit «regDefId» + LexTerm : •~ ( char_lit - char_lit ) «regDefId» + LexTerm : •regDefId «regDefId» + LexTerm : •[ LexPattern ] «regDefId» + LexTerm : •{ LexPattern } «regDefId» + LexTerm : •( LexPattern ) «regDefId» + LexTerm : •. «{» + LexTerm : •char_lit «{» + LexTerm : •char_lit - char_lit «{» + LexTerm : •~ char_lit «{» + LexTerm : •~ ( char_lit - char_lit ) «{» + LexTerm : •regDefId «{» + LexTerm : •[ LexPattern ] «{» + LexTerm : •{ LexPattern } «{» + LexTerm : •( LexPattern ) «{» + LexTerm : •. «~» + LexTerm : •char_lit «~» + LexTerm : •char_lit - char_lit «~» + LexTerm : •~ char_lit «~» + LexTerm : •~ ( char_lit - char_lit ) «~» + LexTerm : •regDefId «~» + LexTerm : •[ LexPattern ] «~» + LexTerm : •{ LexPattern } «~» + LexTerm : •( LexPattern ) «~» + LexTerm : •. «|» + LexTerm : •char_lit «|» + LexTerm : •char_lit - char_lit «|» + LexTerm : •~ char_lit «|» + LexTerm : •~ ( char_lit - char_lit ) «|» + LexTerm : •regDefId «|» + LexTerm : •[ LexPattern ] «|» + LexTerm : •{ LexPattern } «|» + LexTerm : •( LexPattern ) «|» +} +Transitions: + regDefId -> 64 + LexAlt -> 65 + LexTerm -> 66 + . -> 67 + char_lit -> 68 + ~ -> 69 + ( -> 70 + [ -> 71 + { -> 72 + LexPattern -> 110 + + +S72{ + LexTerm : { •LexPattern } «]» + LexTerm : { •LexPattern } «(» + LexTerm : { •LexPattern } «.» + LexTerm : { •LexPattern } «[» + LexTerm : { •LexPattern } «char_lit» + LexTerm : { •LexPattern } «regDefId» + LexTerm : { •LexPattern } «{» + LexTerm : { •LexPattern } «~» + LexTerm : { •LexPattern } «|» + LexPattern : •LexAlt «}» + LexPattern : •LexPattern | LexAlt «}» + LexAlt : •LexTerm «}» + LexAlt : •LexAlt LexTerm «}» + LexPattern : •LexAlt «|» + LexPattern : •LexPattern | LexAlt «|» + LexTerm : •. «}» + LexTerm : •char_lit «}» + LexTerm : •char_lit - char_lit «}» + LexTerm : •~ char_lit «}» + LexTerm : •~ ( char_lit - char_lit ) «}» + LexTerm : •regDefId «}» + LexTerm : •[ LexPattern ] «}» + LexTerm : •{ LexPattern } «}» + LexTerm : •( LexPattern ) «}» + LexAlt : •LexTerm «(» + LexAlt : •LexTerm «.» + LexAlt : •LexTerm «[» + LexAlt : •LexTerm «char_lit» + LexAlt : •LexTerm «regDefId» + LexAlt : •LexTerm «{» + LexAlt : •LexTerm «~» + LexAlt : •LexAlt LexTerm «(» + LexAlt : •LexAlt LexTerm «.» + LexAlt : •LexAlt LexTerm «[» + LexAlt : •LexAlt LexTerm «char_lit» + LexAlt : •LexAlt LexTerm «regDefId» + LexAlt : •LexAlt LexTerm «{» + LexAlt : •LexAlt LexTerm «~» + LexAlt : •LexTerm «|» + LexAlt : •LexAlt LexTerm «|» + LexTerm : •. «(» + LexTerm : •char_lit «(» + LexTerm : •char_lit - char_lit «(» + LexTerm : •~ char_lit «(» + LexTerm : •~ ( char_lit - char_lit ) «(» + LexTerm : •regDefId «(» + LexTerm : •[ LexPattern ] «(» + LexTerm : •{ LexPattern } «(» + LexTerm : •( LexPattern ) «(» + LexTerm : •. «.» + LexTerm : •char_lit «.» + LexTerm : •char_lit - char_lit «.» + LexTerm : •~ char_lit «.» + LexTerm : •~ ( char_lit - char_lit ) «.» + LexTerm : •regDefId «.» + LexTerm : •[ LexPattern ] «.» + LexTerm : •{ LexPattern } «.» + LexTerm : •( LexPattern ) «.» + LexTerm : •. «[» + LexTerm : •char_lit «[» + LexTerm : •char_lit - char_lit «[» + LexTerm : •~ char_lit «[» + LexTerm : •~ ( char_lit - char_lit ) «[» + LexTerm : •regDefId «[» + LexTerm : •[ LexPattern ] «[» + LexTerm : •{ LexPattern } «[» + LexTerm : •( LexPattern ) «[» + LexTerm : •. «char_lit» + LexTerm : •char_lit «char_lit» + LexTerm : •char_lit - char_lit «char_lit» + LexTerm : •~ char_lit «char_lit» + LexTerm : •~ ( char_lit - char_lit ) «char_lit» + LexTerm : •regDefId «char_lit» + LexTerm : •[ LexPattern ] «char_lit» + LexTerm : •{ LexPattern } «char_lit» + LexTerm : •( LexPattern ) «char_lit» + LexTerm : •. «regDefId» + LexTerm : •char_lit «regDefId» + LexTerm : •char_lit - char_lit «regDefId» + LexTerm : •~ char_lit «regDefId» + LexTerm : •~ ( char_lit - char_lit ) «regDefId» + LexTerm : •regDefId «regDefId» + LexTerm : •[ LexPattern ] «regDefId» + LexTerm : •{ LexPattern } «regDefId» + LexTerm : •( LexPattern ) «regDefId» + LexTerm : •. «{» + LexTerm : •char_lit «{» + LexTerm : •char_lit - char_lit «{» + LexTerm : •~ char_lit «{» + LexTerm : •~ ( char_lit - char_lit ) «{» + LexTerm : •regDefId «{» + LexTerm : •[ LexPattern ] «{» + LexTerm : •{ LexPattern } «{» + LexTerm : •( LexPattern ) «{» + LexTerm : •. «~» + LexTerm : •char_lit «~» + LexTerm : •char_lit - char_lit «~» + LexTerm : •~ char_lit «~» + LexTerm : •~ ( char_lit - char_lit ) «~» + LexTerm : •regDefId «~» + LexTerm : •[ LexPattern ] «~» + LexTerm : •{ LexPattern } «~» + LexTerm : •( LexPattern ) «~» + LexTerm : •. «|» + LexTerm : •char_lit «|» + LexTerm : •char_lit - char_lit «|» + LexTerm : •~ char_lit «|» + LexTerm : •~ ( char_lit - char_lit ) «|» + LexTerm : •regDefId «|» + LexTerm : •[ LexPattern ] «|» + LexTerm : •{ LexPattern } «|» + LexTerm : •( LexPattern ) «|» +} +Transitions: + regDefId -> 74 + LexAlt -> 75 + LexTerm -> 76 + . -> 77 + char_lit -> 78 + ~ -> 79 + ( -> 80 + [ -> 81 + { -> 82 + LexPattern -> 111 + + +S73{ + LexTerm : { LexPattern •} «;» + LexTerm : { LexPattern •} «(» + LexTerm : { LexPattern •} «.» + LexTerm : { LexPattern •} «[» + LexTerm : { LexPattern •} «char_lit» + LexTerm : { LexPattern •} «regDefId» + LexTerm : { LexPattern •} «{» + LexTerm : { LexPattern •} «~» + LexTerm : { LexPattern •} «|» + LexPattern : LexPattern •| LexAlt «}» + LexPattern : LexPattern •| LexAlt «|» +} +Transitions: + | -> 112 + } -> 113 + + +S74{ + LexTerm : regDefId• «}» + LexTerm : regDefId• «(» + LexTerm : regDefId• «.» + LexTerm : regDefId• «[» + LexTerm : regDefId• «char_lit» + LexTerm : regDefId• «regDefId» + LexTerm : regDefId• «{» + LexTerm : regDefId• «~» + LexTerm : regDefId• «|» +} +Transitions: + + +S75{ + LexPattern : LexAlt• «}» + LexAlt : LexAlt •LexTerm «}» + LexPattern : LexAlt• «|» + LexAlt : LexAlt •LexTerm «(» + LexAlt : LexAlt •LexTerm «.» + LexAlt : LexAlt •LexTerm «[» + LexAlt : LexAlt •LexTerm «char_lit» + LexAlt : LexAlt •LexTerm «regDefId» + LexAlt : LexAlt •LexTerm «{» + LexAlt : LexAlt •LexTerm «~» + LexAlt : LexAlt •LexTerm «|» + LexTerm : •. «}» + LexTerm : •char_lit «}» + LexTerm : •char_lit - char_lit «}» + LexTerm : •~ char_lit «}» + LexTerm : •~ ( char_lit - char_lit ) «}» + LexTerm : •regDefId «}» + LexTerm : •[ LexPattern ] «}» + LexTerm : •{ LexPattern } «}» + LexTerm : •( LexPattern ) «}» + LexTerm : •. «(» + LexTerm : •char_lit «(» + LexTerm : •char_lit - char_lit «(» + LexTerm : •~ char_lit «(» + LexTerm : •~ ( char_lit - char_lit ) «(» + LexTerm : •regDefId «(» + LexTerm : •[ LexPattern ] «(» + LexTerm : •{ LexPattern } «(» + LexTerm : •( LexPattern ) «(» + LexTerm : •. «.» + LexTerm : •char_lit «.» + LexTerm : •char_lit - char_lit «.» + LexTerm : •~ char_lit «.» + LexTerm : •~ ( char_lit - char_lit ) «.» + LexTerm : •regDefId «.» + LexTerm : •[ LexPattern ] «.» + LexTerm : •{ LexPattern } «.» + LexTerm : •( LexPattern ) «.» + LexTerm : •. «[» + LexTerm : •char_lit «[» + LexTerm : •char_lit - char_lit «[» + LexTerm : •~ char_lit «[» + LexTerm : •~ ( char_lit - char_lit ) «[» + LexTerm : •regDefId «[» + LexTerm : •[ LexPattern ] «[» + LexTerm : •{ LexPattern } «[» + LexTerm : •( LexPattern ) «[» + LexTerm : •. «char_lit» + LexTerm : •char_lit «char_lit» + LexTerm : •char_lit - char_lit «char_lit» + LexTerm : •~ char_lit «char_lit» + LexTerm : •~ ( char_lit - char_lit ) «char_lit» + LexTerm : •regDefId «char_lit» + LexTerm : •[ LexPattern ] «char_lit» + LexTerm : •{ LexPattern } «char_lit» + LexTerm : •( LexPattern ) «char_lit» + LexTerm : •. «regDefId» + LexTerm : •char_lit «regDefId» + LexTerm : •char_lit - char_lit «regDefId» + LexTerm : •~ char_lit «regDefId» + LexTerm : •~ ( char_lit - char_lit ) «regDefId» + LexTerm : •regDefId «regDefId» + LexTerm : •[ LexPattern ] «regDefId» + LexTerm : •{ LexPattern } «regDefId» + LexTerm : •( LexPattern ) «regDefId» + LexTerm : •. «{» + LexTerm : •char_lit «{» + LexTerm : •char_lit - char_lit «{» + LexTerm : •~ char_lit «{» + LexTerm : •~ ( char_lit - char_lit ) «{» + LexTerm : •regDefId «{» + LexTerm : •[ LexPattern ] «{» + LexTerm : •{ LexPattern } «{» + LexTerm : •( LexPattern ) «{» + LexTerm : •. «~» + LexTerm : •char_lit «~» + LexTerm : •char_lit - char_lit «~» + LexTerm : •~ char_lit «~» + LexTerm : •~ ( char_lit - char_lit ) «~» + LexTerm : •regDefId «~» + LexTerm : •[ LexPattern ] «~» + LexTerm : •{ LexPattern } «~» + LexTerm : •( LexPattern ) «~» + LexTerm : •. «|» + LexTerm : •char_lit «|» + LexTerm : •char_lit - char_lit «|» + LexTerm : •~ char_lit «|» + LexTerm : •~ ( char_lit - char_lit ) «|» + LexTerm : •regDefId «|» + LexTerm : •[ LexPattern ] «|» + LexTerm : •{ LexPattern } «|» + LexTerm : •( LexPattern ) «|» +} +Transitions: + regDefId -> 74 + . -> 77 + char_lit -> 78 + ~ -> 79 + ( -> 80 + [ -> 81 + { -> 82 + LexTerm -> 114 + + +S76{ + LexAlt : LexTerm• «}» + LexAlt : LexTerm• «(» + LexAlt : LexTerm• «.» + LexAlt : LexTerm• «[» + LexAlt : LexTerm• «char_lit» + LexAlt : LexTerm• «regDefId» + LexAlt : LexTerm• «{» + LexAlt : LexTerm• «~» + LexAlt : LexTerm• «|» +} +Transitions: + + +S77{ + LexTerm : .• «}» + LexTerm : .• «(» + LexTerm : .• «.» + LexTerm : .• «[» + LexTerm : .• «char_lit» + LexTerm : .• «regDefId» + LexTerm : .• «{» + LexTerm : .• «~» + LexTerm : .• «|» +} +Transitions: + + +S78{ + LexTerm : char_lit• «}» + LexTerm : char_lit •- char_lit «}» + LexTerm : char_lit• «(» + LexTerm : char_lit •- char_lit «(» + LexTerm : char_lit• «.» + LexTerm : char_lit •- char_lit «.» + LexTerm : char_lit• «[» + LexTerm : char_lit •- char_lit «[» + LexTerm : char_lit• «char_lit» + LexTerm : char_lit •- char_lit «char_lit» + LexTerm : char_lit• «regDefId» + LexTerm : char_lit •- char_lit «regDefId» + LexTerm : char_lit• «{» + LexTerm : char_lit •- char_lit «{» + LexTerm : char_lit• «~» + LexTerm : char_lit •- char_lit «~» + LexTerm : char_lit• «|» + LexTerm : char_lit •- char_lit «|» +} +Transitions: + - -> 115 + + +S79{ + LexTerm : ~ •char_lit «}» + LexTerm : ~ •( char_lit - char_lit ) «}» + LexTerm : ~ •char_lit «(» + LexTerm : ~ •( char_lit - char_lit ) «(» + LexTerm : ~ •char_lit «.» + LexTerm : ~ •( char_lit - char_lit ) «.» + LexTerm : ~ •char_lit «[» + LexTerm : ~ •( char_lit - char_lit ) «[» + LexTerm : ~ •char_lit «char_lit» + LexTerm : ~ •( char_lit - char_lit ) «char_lit» + LexTerm : ~ •char_lit «regDefId» + LexTerm : ~ •( char_lit - char_lit ) «regDefId» + LexTerm : ~ •char_lit «{» + LexTerm : ~ •( char_lit - char_lit ) «{» + LexTerm : ~ •char_lit «~» + LexTerm : ~ •( char_lit - char_lit ) «~» + LexTerm : ~ •char_lit «|» + LexTerm : ~ •( char_lit - char_lit ) «|» +} +Transitions: + char_lit -> 116 + ( -> 117 + + +S80{ + LexTerm : ( •LexPattern ) «}» + LexTerm : ( •LexPattern ) «(» + LexTerm : ( •LexPattern ) «.» + LexTerm : ( •LexPattern ) «[» + LexTerm : ( •LexPattern ) «char_lit» + LexTerm : ( •LexPattern ) «regDefId» + LexTerm : ( •LexPattern ) «{» + LexTerm : ( •LexPattern ) «~» + LexTerm : ( •LexPattern ) «|» + LexPattern : •LexAlt «)» + LexPattern : •LexPattern | LexAlt «)» + LexAlt : •LexTerm «)» + LexAlt : •LexAlt LexTerm «)» + LexPattern : •LexAlt «|» + LexPattern : •LexPattern | LexAlt «|» + LexTerm : •. «)» + LexTerm : •char_lit «)» + LexTerm : •char_lit - char_lit «)» + LexTerm : •~ char_lit «)» + LexTerm : •~ ( char_lit - char_lit ) «)» + LexTerm : •regDefId «)» + LexTerm : •[ LexPattern ] «)» + LexTerm : •{ LexPattern } «)» + LexTerm : •( LexPattern ) «)» + LexAlt : •LexTerm «(» + LexAlt : •LexTerm «.» + LexAlt : •LexTerm «[» + LexAlt : •LexTerm «char_lit» + LexAlt : •LexTerm «regDefId» + LexAlt : •LexTerm «{» + LexAlt : •LexTerm «~» + LexAlt : •LexAlt LexTerm «(» + LexAlt : •LexAlt LexTerm «.» + LexAlt : •LexAlt LexTerm «[» + LexAlt : •LexAlt LexTerm «char_lit» + LexAlt : •LexAlt LexTerm «regDefId» + LexAlt : •LexAlt LexTerm «{» + LexAlt : •LexAlt LexTerm «~» + LexAlt : •LexTerm «|» + LexAlt : •LexAlt LexTerm «|» + LexTerm : •. «(» + LexTerm : •char_lit «(» + LexTerm : •char_lit - char_lit «(» + LexTerm : •~ char_lit «(» + LexTerm : •~ ( char_lit - char_lit ) «(» + LexTerm : •regDefId «(» + LexTerm : •[ LexPattern ] «(» + LexTerm : •{ LexPattern } «(» + LexTerm : •( LexPattern ) «(» + LexTerm : •. «.» + LexTerm : •char_lit «.» + LexTerm : •char_lit - char_lit «.» + LexTerm : •~ char_lit «.» + LexTerm : •~ ( char_lit - char_lit ) «.» + LexTerm : •regDefId «.» + LexTerm : •[ LexPattern ] «.» + LexTerm : •{ LexPattern } «.» + LexTerm : •( LexPattern ) «.» + LexTerm : •. «[» + LexTerm : •char_lit «[» + LexTerm : •char_lit - char_lit «[» + LexTerm : •~ char_lit «[» + LexTerm : •~ ( char_lit - char_lit ) «[» + LexTerm : •regDefId «[» + LexTerm : •[ LexPattern ] «[» + LexTerm : •{ LexPattern } «[» + LexTerm : •( LexPattern ) «[» + LexTerm : •. «char_lit» + LexTerm : •char_lit «char_lit» + LexTerm : •char_lit - char_lit «char_lit» + LexTerm : •~ char_lit «char_lit» + LexTerm : •~ ( char_lit - char_lit ) «char_lit» + LexTerm : •regDefId «char_lit» + LexTerm : •[ LexPattern ] «char_lit» + LexTerm : •{ LexPattern } «char_lit» + LexTerm : •( LexPattern ) «char_lit» + LexTerm : •. «regDefId» + LexTerm : •char_lit «regDefId» + LexTerm : •char_lit - char_lit «regDefId» + LexTerm : •~ char_lit «regDefId» + LexTerm : •~ ( char_lit - char_lit ) «regDefId» + LexTerm : •regDefId «regDefId» + LexTerm : •[ LexPattern ] «regDefId» + LexTerm : •{ LexPattern } «regDefId» + LexTerm : •( LexPattern ) «regDefId» + LexTerm : •. «{» + LexTerm : •char_lit «{» + LexTerm : •char_lit - char_lit «{» + LexTerm : •~ char_lit «{» + LexTerm : •~ ( char_lit - char_lit ) «{» + LexTerm : •regDefId «{» + LexTerm : •[ LexPattern ] «{» + LexTerm : •{ LexPattern } «{» + LexTerm : •( LexPattern ) «{» + LexTerm : •. «~» + LexTerm : •char_lit «~» + LexTerm : •char_lit - char_lit «~» + LexTerm : •~ char_lit «~» + LexTerm : •~ ( char_lit - char_lit ) «~» + LexTerm : •regDefId «~» + LexTerm : •[ LexPattern ] «~» + LexTerm : •{ LexPattern } «~» + LexTerm : •( LexPattern ) «~» + LexTerm : •. «|» + LexTerm : •char_lit «|» + LexTerm : •char_lit - char_lit «|» + LexTerm : •~ char_lit «|» + LexTerm : •~ ( char_lit - char_lit ) «|» + LexTerm : •regDefId «|» + LexTerm : •[ LexPattern ] «|» + LexTerm : •{ LexPattern } «|» + LexTerm : •( LexPattern ) «|» +} +Transitions: + regDefId -> 54 + LexAlt -> 55 + LexTerm -> 56 + . -> 57 + char_lit -> 58 + ~ -> 59 + ( -> 60 + [ -> 61 + { -> 62 + LexPattern -> 118 + + +S81{ + LexTerm : [ •LexPattern ] «}» + LexTerm : [ •LexPattern ] «(» + LexTerm : [ •LexPattern ] «.» + LexTerm : [ •LexPattern ] «[» + LexTerm : [ •LexPattern ] «char_lit» + LexTerm : [ •LexPattern ] «regDefId» + LexTerm : [ •LexPattern ] «{» + LexTerm : [ •LexPattern ] «~» + LexTerm : [ •LexPattern ] «|» + LexPattern : •LexAlt «]» + LexPattern : •LexPattern | LexAlt «]» + LexAlt : •LexTerm «]» + LexAlt : •LexAlt LexTerm «]» + LexPattern : •LexAlt «|» + LexPattern : •LexPattern | LexAlt «|» + LexTerm : •. «]» + LexTerm : •char_lit «]» + LexTerm : •char_lit - char_lit «]» + LexTerm : •~ char_lit «]» + LexTerm : •~ ( char_lit - char_lit ) «]» + LexTerm : •regDefId «]» + LexTerm : •[ LexPattern ] «]» + LexTerm : •{ LexPattern } «]» + LexTerm : •( LexPattern ) «]» + LexAlt : •LexTerm «(» + LexAlt : •LexTerm «.» + LexAlt : •LexTerm «[» + LexAlt : •LexTerm «char_lit» + LexAlt : •LexTerm «regDefId» + LexAlt : •LexTerm «{» + LexAlt : •LexTerm «~» + LexAlt : •LexAlt LexTerm «(» + LexAlt : •LexAlt LexTerm «.» + LexAlt : •LexAlt LexTerm «[» + LexAlt : •LexAlt LexTerm «char_lit» + LexAlt : •LexAlt LexTerm «regDefId» + LexAlt : •LexAlt LexTerm «{» + LexAlt : •LexAlt LexTerm «~» + LexAlt : •LexTerm «|» + LexAlt : •LexAlt LexTerm «|» + LexTerm : •. «(» + LexTerm : •char_lit «(» + LexTerm : •char_lit - char_lit «(» + LexTerm : •~ char_lit «(» + LexTerm : •~ ( char_lit - char_lit ) «(» + LexTerm : •regDefId «(» + LexTerm : •[ LexPattern ] «(» + LexTerm : •{ LexPattern } «(» + LexTerm : •( LexPattern ) «(» + LexTerm : •. «.» + LexTerm : •char_lit «.» + LexTerm : •char_lit - char_lit «.» + LexTerm : •~ char_lit «.» + LexTerm : •~ ( char_lit - char_lit ) «.» + LexTerm : •regDefId «.» + LexTerm : •[ LexPattern ] «.» + LexTerm : •{ LexPattern } «.» + LexTerm : •( LexPattern ) «.» + LexTerm : •. «[» + LexTerm : •char_lit «[» + LexTerm : •char_lit - char_lit «[» + LexTerm : •~ char_lit «[» + LexTerm : •~ ( char_lit - char_lit ) «[» + LexTerm : •regDefId «[» + LexTerm : •[ LexPattern ] «[» + LexTerm : •{ LexPattern } «[» + LexTerm : •( LexPattern ) «[» + LexTerm : •. «char_lit» + LexTerm : •char_lit «char_lit» + LexTerm : •char_lit - char_lit «char_lit» + LexTerm : •~ char_lit «char_lit» + LexTerm : •~ ( char_lit - char_lit ) «char_lit» + LexTerm : •regDefId «char_lit» + LexTerm : •[ LexPattern ] «char_lit» + LexTerm : •{ LexPattern } «char_lit» + LexTerm : •( LexPattern ) «char_lit» + LexTerm : •. «regDefId» + LexTerm : •char_lit «regDefId» + LexTerm : •char_lit - char_lit «regDefId» + LexTerm : •~ char_lit «regDefId» + LexTerm : •~ ( char_lit - char_lit ) «regDefId» + LexTerm : •regDefId «regDefId» + LexTerm : •[ LexPattern ] «regDefId» + LexTerm : •{ LexPattern } «regDefId» + LexTerm : •( LexPattern ) «regDefId» + LexTerm : •. «{» + LexTerm : •char_lit «{» + LexTerm : •char_lit - char_lit «{» + LexTerm : •~ char_lit «{» + LexTerm : •~ ( char_lit - char_lit ) «{» + LexTerm : •regDefId «{» + LexTerm : •[ LexPattern ] «{» + LexTerm : •{ LexPattern } «{» + LexTerm : •( LexPattern ) «{» + LexTerm : •. «~» + LexTerm : •char_lit «~» + LexTerm : •char_lit - char_lit «~» + LexTerm : •~ char_lit «~» + LexTerm : •~ ( char_lit - char_lit ) «~» + LexTerm : •regDefId «~» + LexTerm : •[ LexPattern ] «~» + LexTerm : •{ LexPattern } «~» + LexTerm : •( LexPattern ) «~» + LexTerm : •. «|» + LexTerm : •char_lit «|» + LexTerm : •char_lit - char_lit «|» + LexTerm : •~ char_lit «|» + LexTerm : •~ ( char_lit - char_lit ) «|» + LexTerm : •regDefId «|» + LexTerm : •[ LexPattern ] «|» + LexTerm : •{ LexPattern } «|» + LexTerm : •( LexPattern ) «|» +} +Transitions: + regDefId -> 64 + LexAlt -> 65 + LexTerm -> 66 + . -> 67 + char_lit -> 68 + ~ -> 69 + ( -> 70 + [ -> 71 + { -> 72 + LexPattern -> 119 + + +S82{ + LexTerm : { •LexPattern } «}» + LexTerm : { •LexPattern } «(» + LexTerm : { •LexPattern } «.» + LexTerm : { •LexPattern } «[» + LexTerm : { •LexPattern } «char_lit» + LexTerm : { •LexPattern } «regDefId» + LexTerm : { •LexPattern } «{» + LexTerm : { •LexPattern } «~» + LexTerm : { •LexPattern } «|» + LexPattern : •LexAlt «}» + LexPattern : •LexPattern | LexAlt «}» + LexAlt : •LexTerm «}» + LexAlt : •LexAlt LexTerm «}» + LexPattern : •LexAlt «|» + LexPattern : •LexPattern | LexAlt «|» + LexTerm : •. «}» + LexTerm : •char_lit «}» + LexTerm : •char_lit - char_lit «}» + LexTerm : •~ char_lit «}» + LexTerm : •~ ( char_lit - char_lit ) «}» + LexTerm : •regDefId «}» + LexTerm : •[ LexPattern ] «}» + LexTerm : •{ LexPattern } «}» + LexTerm : •( LexPattern ) «}» + LexAlt : •LexTerm «(» + LexAlt : •LexTerm «.» + LexAlt : •LexTerm «[» + LexAlt : •LexTerm «char_lit» + LexAlt : •LexTerm «regDefId» + LexAlt : •LexTerm «{» + LexAlt : •LexTerm «~» + LexAlt : •LexAlt LexTerm «(» + LexAlt : •LexAlt LexTerm «.» + LexAlt : •LexAlt LexTerm «[» + LexAlt : •LexAlt LexTerm «char_lit» + LexAlt : •LexAlt LexTerm «regDefId» + LexAlt : •LexAlt LexTerm «{» + LexAlt : •LexAlt LexTerm «~» + LexAlt : •LexTerm «|» + LexAlt : •LexAlt LexTerm «|» + LexTerm : •. «(» + LexTerm : •char_lit «(» + LexTerm : •char_lit - char_lit «(» + LexTerm : •~ char_lit «(» + LexTerm : •~ ( char_lit - char_lit ) «(» + LexTerm : •regDefId «(» + LexTerm : •[ LexPattern ] «(» + LexTerm : •{ LexPattern } «(» + LexTerm : •( LexPattern ) «(» + LexTerm : •. «.» + LexTerm : •char_lit «.» + LexTerm : •char_lit - char_lit «.» + LexTerm : •~ char_lit «.» + LexTerm : •~ ( char_lit - char_lit ) «.» + LexTerm : •regDefId «.» + LexTerm : •[ LexPattern ] «.» + LexTerm : •{ LexPattern } «.» + LexTerm : •( LexPattern ) «.» + LexTerm : •. «[» + LexTerm : •char_lit «[» + LexTerm : •char_lit - char_lit «[» + LexTerm : •~ char_lit «[» + LexTerm : •~ ( char_lit - char_lit ) «[» + LexTerm : •regDefId «[» + LexTerm : •[ LexPattern ] «[» + LexTerm : •{ LexPattern } «[» + LexTerm : •( LexPattern ) «[» + LexTerm : •. «char_lit» + LexTerm : •char_lit «char_lit» + LexTerm : •char_lit - char_lit «char_lit» + LexTerm : •~ char_lit «char_lit» + LexTerm : •~ ( char_lit - char_lit ) «char_lit» + LexTerm : •regDefId «char_lit» + LexTerm : •[ LexPattern ] «char_lit» + LexTerm : •{ LexPattern } «char_lit» + LexTerm : •( LexPattern ) «char_lit» + LexTerm : •. «regDefId» + LexTerm : •char_lit «regDefId» + LexTerm : •char_lit - char_lit «regDefId» + LexTerm : •~ char_lit «regDefId» + LexTerm : •~ ( char_lit - char_lit ) «regDefId» + LexTerm : •regDefId «regDefId» + LexTerm : •[ LexPattern ] «regDefId» + LexTerm : •{ LexPattern } «regDefId» + LexTerm : •( LexPattern ) «regDefId» + LexTerm : •. «{» + LexTerm : •char_lit «{» + LexTerm : •char_lit - char_lit «{» + LexTerm : •~ char_lit «{» + LexTerm : •~ ( char_lit - char_lit ) «{» + LexTerm : •regDefId «{» + LexTerm : •[ LexPattern ] «{» + LexTerm : •{ LexPattern } «{» + LexTerm : •( LexPattern ) «{» + LexTerm : •. «~» + LexTerm : •char_lit «~» + LexTerm : •char_lit - char_lit «~» + LexTerm : •~ char_lit «~» + LexTerm : •~ ( char_lit - char_lit ) «~» + LexTerm : •regDefId «~» + LexTerm : •[ LexPattern ] «~» + LexTerm : •{ LexPattern } «~» + LexTerm : •( LexPattern ) «~» + LexTerm : •. «|» + LexTerm : •char_lit «|» + LexTerm : •char_lit - char_lit «|» + LexTerm : •~ char_lit «|» + LexTerm : •~ ( char_lit - char_lit ) «|» + LexTerm : •regDefId «|» + LexTerm : •[ LexPattern ] «|» + LexTerm : •{ LexPattern } «|» + LexTerm : •( LexPattern ) «|» +} +Transitions: + regDefId -> 74 + LexAlt -> 75 + LexTerm -> 76 + . -> 77 + char_lit -> 78 + ~ -> 79 + ( -> 80 + [ -> 81 + { -> 82 + LexPattern -> 120 + + +S83{ + LexProduction : regDefId : LexPattern ;• «g_sdt_lit» + LexProduction : regDefId : LexPattern ;• «prodId» + LexProduction : regDefId : LexPattern ;• «Ω» + LexProduction : regDefId : LexPattern ;• «ignoredTokId» + LexProduction : regDefId : LexPattern ;• «regDefId» + LexProduction : regDefId : LexPattern ;• «tokId» +} +Transitions: + + +S84{ + LexProduction : ignoredTokId : LexPattern ;• «g_sdt_lit» + LexProduction : ignoredTokId : LexPattern ;• «prodId» + LexProduction : ignoredTokId : LexPattern ;• «Ω» + LexProduction : ignoredTokId : LexPattern ;• «ignoredTokId» + LexProduction : ignoredTokId : LexPattern ;• «regDefId» + LexProduction : ignoredTokId : LexPattern ;• «tokId» +} +Transitions: + + +S85{ + SyntaxProduction : prodId : Alternatives ;• «Ω» + SyntaxProduction : prodId : Alternatives ;• «prodId» +} +Transitions: + + +S86{ + Alternatives : Alternatives | •SyntaxBody «;» + Alternatives : Alternatives | •SyntaxBody «|» + SyntaxBody : •Symbols «;» + SyntaxBody : •Symbols g_sdt_lit «;» + SyntaxBody : •ErrorSymbol «;» + SyntaxBody : •ErrorSymbol Symbols «;» + SyntaxBody : •ErrorSymbol Symbols g_sdt_lit «;» + SyntaxBody : •ErrorSymbol g_sdt_lit «;» + SyntaxBody : •EpsilonSymbol «;» + SyntaxBody : •Symbols «|» + SyntaxBody : •Symbols g_sdt_lit «|» + SyntaxBody : •ErrorSymbol «|» + SyntaxBody : •ErrorSymbol Symbols «|» + SyntaxBody : •ErrorSymbol Symbols g_sdt_lit «|» + SyntaxBody : •ErrorSymbol g_sdt_lit «|» + SyntaxBody : •EpsilonSymbol «|» + Symbols : •Symbol «;» + Symbols : •Symbols Symbol «;» + Symbols : •Symbol «g_sdt_lit» + Symbols : •Symbols Symbol «g_sdt_lit» + ErrorSymbol : •errore «;» + ErrorSymbol : •λ «;» + ErrorSymbol : •errore «prodId» + ErrorSymbol : •errore «string_lit» + ErrorSymbol : •errore «tokId» + ErrorSymbol : •λ «prodId» + ErrorSymbol : •λ «string_lit» + ErrorSymbol : •λ «tokId» + ErrorSymbol : •errore «g_sdt_lit» + ErrorSymbol : •λ «g_sdt_lit» + EpsilonSymbol : •empty «;» + EpsilonSymbol : •ε «;» + Symbols : •Symbol «|» + Symbols : •Symbols Symbol «|» + ErrorSymbol : •errore «|» + ErrorSymbol : •λ «|» + EpsilonSymbol : •empty «|» + EpsilonSymbol : •ε «|» + Symbol : •prodId «;» + Symbol : •tokId «;» + Symbol : •string_lit «;» + Symbols : •Symbol «prodId» + Symbols : •Symbol «string_lit» + Symbols : •Symbol «tokId» + Symbols : •Symbols Symbol «prodId» + Symbols : •Symbols Symbol «string_lit» + Symbols : •Symbols Symbol «tokId» + Symbol : •prodId «g_sdt_lit» + Symbol : •tokId «g_sdt_lit» + Symbol : •string_lit «g_sdt_lit» + Symbol : •prodId «|» + Symbol : •tokId «|» + Symbol : •string_lit «|» + Symbol : •prodId «prodId» + Symbol : •tokId «prodId» + Symbol : •string_lit «prodId» + Symbol : •prodId «string_lit» + Symbol : •tokId «string_lit» + Symbol : •string_lit «string_lit» + Symbol : •prodId «tokId» + Symbol : •tokId «tokId» + Symbol : •string_lit «tokId» +} +Transitions: + tokId -> 34 + prodId -> 35 + Symbols -> 38 + ErrorSymbol -> 39 + EpsilonSymbol -> 40 + Symbol -> 41 + string_lit -> 42 + errore -> 43 + λ -> 44 + empty -> 45 + ε -> 46 + SyntaxBody -> 121 + + +S87{ + SyntaxBody : Symbols g_sdt_lit• «;» + SyntaxBody : Symbols g_sdt_lit• «|» +} +Transitions: + + +S88{ + Symbols : Symbols Symbol• «;» + Symbols : Symbols Symbol• «g_sdt_lit» + Symbols : Symbols Symbol• «prodId» + Symbols : Symbols Symbol• «string_lit» + Symbols : Symbols Symbol• «tokId» + Symbols : Symbols Symbol• «|» +} +Transitions: + + +S89{ + SyntaxBody : ErrorSymbol g_sdt_lit• «;» + SyntaxBody : ErrorSymbol g_sdt_lit• «|» +} +Transitions: + + +S90{ + SyntaxBody : ErrorSymbol Symbols• «;» + SyntaxBody : ErrorSymbol Symbols •g_sdt_lit «;» + SyntaxBody : ErrorSymbol Symbols• «|» + SyntaxBody : ErrorSymbol Symbols •g_sdt_lit «|» + Symbols : Symbols •Symbol «;» + Symbols : Symbols •Symbol «g_sdt_lit» + Symbols : Symbols •Symbol «|» + Symbols : Symbols •Symbol «prodId» + Symbols : Symbols •Symbol «string_lit» + Symbols : Symbols •Symbol «tokId» + Symbol : •prodId «;» + Symbol : •tokId «;» + Symbol : •string_lit «;» + Symbol : •prodId «g_sdt_lit» + Symbol : •tokId «g_sdt_lit» + Symbol : •string_lit «g_sdt_lit» + Symbol : •prodId «|» + Symbol : •tokId «|» + Symbol : •string_lit «|» + Symbol : •prodId «prodId» + Symbol : •tokId «prodId» + Symbol : •string_lit «prodId» + Symbol : •prodId «string_lit» + Symbol : •tokId «string_lit» + Symbol : •string_lit «string_lit» + Symbol : •prodId «tokId» + Symbol : •tokId «tokId» + Symbol : •string_lit «tokId» +} +Transitions: + tokId -> 34 + prodId -> 35 + string_lit -> 42 + Symbol -> 88 + g_sdt_lit -> 122 + + +S91{ + LexPattern : LexPattern | LexAlt• «;» + LexPattern : LexPattern | LexAlt• «|» + LexAlt : LexAlt •LexTerm «;» + LexAlt : LexAlt •LexTerm «|» + LexAlt : LexAlt •LexTerm «(» + LexAlt : LexAlt •LexTerm «.» + LexAlt : LexAlt •LexTerm «[» + LexAlt : LexAlt •LexTerm «char_lit» + LexAlt : LexAlt •LexTerm «regDefId» + LexAlt : LexAlt •LexTerm «{» + LexAlt : LexAlt •LexTerm «~» + LexTerm : •. «;» + LexTerm : •char_lit «;» + LexTerm : •char_lit - char_lit «;» + LexTerm : •~ char_lit «;» + LexTerm : •~ ( char_lit - char_lit ) «;» + LexTerm : •regDefId «;» + LexTerm : •[ LexPattern ] «;» + LexTerm : •{ LexPattern } «;» + LexTerm : •( LexPattern ) «;» + LexTerm : •. «|» + LexTerm : •char_lit «|» + LexTerm : •char_lit - char_lit «|» + LexTerm : •~ char_lit «|» + LexTerm : •~ ( char_lit - char_lit ) «|» + LexTerm : •regDefId «|» + LexTerm : •[ LexPattern ] «|» + LexTerm : •{ LexPattern } «|» + LexTerm : •( LexPattern ) «|» + LexTerm : •. «(» + LexTerm : •char_lit «(» + LexTerm : •char_lit - char_lit «(» + LexTerm : •~ char_lit «(» + LexTerm : •~ ( char_lit - char_lit ) «(» + LexTerm : •regDefId «(» + LexTerm : •[ LexPattern ] «(» + LexTerm : •{ LexPattern } «(» + LexTerm : •( LexPattern ) «(» + LexTerm : •. «.» + LexTerm : •char_lit «.» + LexTerm : •char_lit - char_lit «.» + LexTerm : •~ char_lit «.» + LexTerm : •~ ( char_lit - char_lit ) «.» + LexTerm : •regDefId «.» + LexTerm : •[ LexPattern ] «.» + LexTerm : •{ LexPattern } «.» + LexTerm : •( LexPattern ) «.» + LexTerm : •. «[» + LexTerm : •char_lit «[» + LexTerm : •char_lit - char_lit «[» + LexTerm : •~ char_lit «[» + LexTerm : •~ ( char_lit - char_lit ) «[» + LexTerm : •regDefId «[» + LexTerm : •[ LexPattern ] «[» + LexTerm : •{ LexPattern } «[» + LexTerm : •( LexPattern ) «[» + LexTerm : •. «char_lit» + LexTerm : •char_lit «char_lit» + LexTerm : •char_lit - char_lit «char_lit» + LexTerm : •~ char_lit «char_lit» + LexTerm : •~ ( char_lit - char_lit ) «char_lit» + LexTerm : •regDefId «char_lit» + LexTerm : •[ LexPattern ] «char_lit» + LexTerm : •{ LexPattern } «char_lit» + LexTerm : •( LexPattern ) «char_lit» + LexTerm : •. «regDefId» + LexTerm : •char_lit «regDefId» + LexTerm : •char_lit - char_lit «regDefId» + LexTerm : •~ char_lit «regDefId» + LexTerm : •~ ( char_lit - char_lit ) «regDefId» + LexTerm : •regDefId «regDefId» + LexTerm : •[ LexPattern ] «regDefId» + LexTerm : •{ LexPattern } «regDefId» + LexTerm : •( LexPattern ) «regDefId» + LexTerm : •. «{» + LexTerm : •char_lit «{» + LexTerm : •char_lit - char_lit «{» + LexTerm : •~ char_lit «{» + LexTerm : •~ ( char_lit - char_lit ) «{» + LexTerm : •regDefId «{» + LexTerm : •[ LexPattern ] «{» + LexTerm : •{ LexPattern } «{» + LexTerm : •( LexPattern ) «{» + LexTerm : •. «~» + LexTerm : •char_lit «~» + LexTerm : •char_lit - char_lit «~» + LexTerm : •~ char_lit «~» + LexTerm : •~ ( char_lit - char_lit ) «~» + LexTerm : •regDefId «~» + LexTerm : •[ LexPattern ] «~» + LexTerm : •{ LexPattern } «~» + LexTerm : •( LexPattern ) «~» +} +Transitions: + regDefId -> 23 + . -> 26 + char_lit -> 27 + ~ -> 28 + ( -> 29 + [ -> 30 + { -> 31 + LexTerm -> 49 + + +S92{ + LexTerm : char_lit - char_lit• «;» + LexTerm : char_lit - char_lit• «(» + LexTerm : char_lit - char_lit• «.» + LexTerm : char_lit - char_lit• «[» + LexTerm : char_lit - char_lit• «char_lit» + LexTerm : char_lit - char_lit• «regDefId» + LexTerm : char_lit - char_lit• «{» + LexTerm : char_lit - char_lit• «~» + LexTerm : char_lit - char_lit• «|» +} +Transitions: + + +S93{ + LexTerm : ~ ( char_lit •- char_lit ) «;» + LexTerm : ~ ( char_lit •- char_lit ) «(» + LexTerm : ~ ( char_lit •- char_lit ) «.» + LexTerm : ~ ( char_lit •- char_lit ) «[» + LexTerm : ~ ( char_lit •- char_lit ) «char_lit» + LexTerm : ~ ( char_lit •- char_lit ) «regDefId» + LexTerm : ~ ( char_lit •- char_lit ) «{» + LexTerm : ~ ( char_lit •- char_lit ) «~» + LexTerm : ~ ( char_lit •- char_lit ) «|» +} +Transitions: + - -> 123 + + +S94{ + LexPattern : LexPattern | •LexAlt «)» + LexPattern : LexPattern | •LexAlt «|» + LexAlt : •LexTerm «)» + LexAlt : •LexAlt LexTerm «)» + LexAlt : •LexTerm «|» + LexAlt : •LexAlt LexTerm «|» + LexTerm : •. «)» + LexTerm : •char_lit «)» + LexTerm : •char_lit - char_lit «)» + LexTerm : •~ char_lit «)» + LexTerm : •~ ( char_lit - char_lit ) «)» + LexTerm : •regDefId «)» + LexTerm : •[ LexPattern ] «)» + LexTerm : •{ LexPattern } «)» + LexTerm : •( LexPattern ) «)» + LexAlt : •LexTerm «(» + LexAlt : •LexTerm «.» + LexAlt : •LexTerm «[» + LexAlt : •LexTerm «char_lit» + LexAlt : •LexTerm «regDefId» + LexAlt : •LexTerm «{» + LexAlt : •LexTerm «~» + LexAlt : •LexAlt LexTerm «(» + LexAlt : •LexAlt LexTerm «.» + LexAlt : •LexAlt LexTerm «[» + LexAlt : •LexAlt LexTerm «char_lit» + LexAlt : •LexAlt LexTerm «regDefId» + LexAlt : •LexAlt LexTerm «{» + LexAlt : •LexAlt LexTerm «~» + LexTerm : •. «|» + LexTerm : •char_lit «|» + LexTerm : •char_lit - char_lit «|» + LexTerm : •~ char_lit «|» + LexTerm : •~ ( char_lit - char_lit ) «|» + LexTerm : •regDefId «|» + LexTerm : •[ LexPattern ] «|» + LexTerm : •{ LexPattern } «|» + LexTerm : •( LexPattern ) «|» + LexTerm : •. «(» + LexTerm : •char_lit «(» + LexTerm : •char_lit - char_lit «(» + LexTerm : •~ char_lit «(» + LexTerm : •~ ( char_lit - char_lit ) «(» + LexTerm : •regDefId «(» + LexTerm : •[ LexPattern ] «(» + LexTerm : •{ LexPattern } «(» + LexTerm : •( LexPattern ) «(» + LexTerm : •. «.» + LexTerm : •char_lit «.» + LexTerm : •char_lit - char_lit «.» + LexTerm : •~ char_lit «.» + LexTerm : •~ ( char_lit - char_lit ) «.» + LexTerm : •regDefId «.» + LexTerm : •[ LexPattern ] «.» + LexTerm : •{ LexPattern } «.» + LexTerm : •( LexPattern ) «.» + LexTerm : •. «[» + LexTerm : •char_lit «[» + LexTerm : •char_lit - char_lit «[» + LexTerm : •~ char_lit «[» + LexTerm : •~ ( char_lit - char_lit ) «[» + LexTerm : •regDefId «[» + LexTerm : •[ LexPattern ] «[» + LexTerm : •{ LexPattern } «[» + LexTerm : •( LexPattern ) «[» + LexTerm : •. «char_lit» + LexTerm : •char_lit «char_lit» + LexTerm : •char_lit - char_lit «char_lit» + LexTerm : •~ char_lit «char_lit» + LexTerm : •~ ( char_lit - char_lit ) «char_lit» + LexTerm : •regDefId «char_lit» + LexTerm : •[ LexPattern ] «char_lit» + LexTerm : •{ LexPattern } «char_lit» + LexTerm : •( LexPattern ) «char_lit» + LexTerm : •. «regDefId» + LexTerm : •char_lit «regDefId» + LexTerm : •char_lit - char_lit «regDefId» + LexTerm : •~ char_lit «regDefId» + LexTerm : •~ ( char_lit - char_lit ) «regDefId» + LexTerm : •regDefId «regDefId» + LexTerm : •[ LexPattern ] «regDefId» + LexTerm : •{ LexPattern } «regDefId» + LexTerm : •( LexPattern ) «regDefId» + LexTerm : •. «{» + LexTerm : •char_lit «{» + LexTerm : •char_lit - char_lit «{» + LexTerm : •~ char_lit «{» + LexTerm : •~ ( char_lit - char_lit ) «{» + LexTerm : •regDefId «{» + LexTerm : •[ LexPattern ] «{» + LexTerm : •{ LexPattern } «{» + LexTerm : •( LexPattern ) «{» + LexTerm : •. «~» + LexTerm : •char_lit «~» + LexTerm : •char_lit - char_lit «~» + LexTerm : •~ char_lit «~» + LexTerm : •~ ( char_lit - char_lit ) «~» + LexTerm : •regDefId «~» + LexTerm : •[ LexPattern ] «~» + LexTerm : •{ LexPattern } «~» + LexTerm : •( LexPattern ) «~» +} +Transitions: + regDefId -> 54 + LexTerm -> 56 + . -> 57 + char_lit -> 58 + ~ -> 59 + ( -> 60 + [ -> 61 + { -> 62 + LexAlt -> 124 + + +S95{ + LexTerm : ( LexPattern )• «;» + LexTerm : ( LexPattern )• «(» + LexTerm : ( LexPattern )• «.» + LexTerm : ( LexPattern )• «[» + LexTerm : ( LexPattern )• «char_lit» + LexTerm : ( LexPattern )• «regDefId» + LexTerm : ( LexPattern )• «{» + LexTerm : ( LexPattern )• «~» + LexTerm : ( LexPattern )• «|» +} +Transitions: + + +S96{ + LexAlt : LexAlt LexTerm• «)» + LexAlt : LexAlt LexTerm• «(» + LexAlt : LexAlt LexTerm• «.» + LexAlt : LexAlt LexTerm• «[» + LexAlt : LexAlt LexTerm• «char_lit» + LexAlt : LexAlt LexTerm• «regDefId» + LexAlt : LexAlt LexTerm• «{» + LexAlt : LexAlt LexTerm• «~» + LexAlt : LexAlt LexTerm• «|» +} +Transitions: + + +S97{ + LexTerm : char_lit - •char_lit «)» + LexTerm : char_lit - •char_lit «(» + LexTerm : char_lit - •char_lit «.» + LexTerm : char_lit - •char_lit «[» + LexTerm : char_lit - •char_lit «char_lit» + LexTerm : char_lit - •char_lit «regDefId» + LexTerm : char_lit - •char_lit «{» + LexTerm : char_lit - •char_lit «~» + LexTerm : char_lit - •char_lit «|» +} +Transitions: + char_lit -> 125 + + +S98{ + LexTerm : ~ char_lit• «)» + LexTerm : ~ char_lit• «(» + LexTerm : ~ char_lit• «.» + LexTerm : ~ char_lit• «[» + LexTerm : ~ char_lit• «char_lit» + LexTerm : ~ char_lit• «regDefId» + LexTerm : ~ char_lit• «{» + LexTerm : ~ char_lit• «~» + LexTerm : ~ char_lit• «|» +} +Transitions: + + +S99{ + LexTerm : ~ ( •char_lit - char_lit ) «)» + LexTerm : ~ ( •char_lit - char_lit ) «(» + LexTerm : ~ ( •char_lit - char_lit ) «.» + LexTerm : ~ ( •char_lit - char_lit ) «[» + LexTerm : ~ ( •char_lit - char_lit ) «char_lit» + LexTerm : ~ ( •char_lit - char_lit ) «regDefId» + LexTerm : ~ ( •char_lit - char_lit ) «{» + LexTerm : ~ ( •char_lit - char_lit ) «~» + LexTerm : ~ ( •char_lit - char_lit ) «|» +} +Transitions: + char_lit -> 126 + + +S100{ + LexTerm : ( LexPattern •) «)» + LexTerm : ( LexPattern •) «(» + LexTerm : ( LexPattern •) «.» + LexTerm : ( LexPattern •) «[» + LexTerm : ( LexPattern •) «char_lit» + LexTerm : ( LexPattern •) «regDefId» + LexTerm : ( LexPattern •) «{» + LexTerm : ( LexPattern •) «~» + LexTerm : ( LexPattern •) «|» + LexPattern : LexPattern •| LexAlt «)» + LexPattern : LexPattern •| LexAlt «|» +} +Transitions: + | -> 94 + ) -> 127 + + +S101{ + LexTerm : [ LexPattern •] «)» + LexTerm : [ LexPattern •] «(» + LexTerm : [ LexPattern •] «.» + LexTerm : [ LexPattern •] «[» + LexTerm : [ LexPattern •] «char_lit» + LexTerm : [ LexPattern •] «regDefId» + LexTerm : [ LexPattern •] «{» + LexTerm : [ LexPattern •] «~» + LexTerm : [ LexPattern •] «|» + LexPattern : LexPattern •| LexAlt «]» + LexPattern : LexPattern •| LexAlt «|» +} +Transitions: + | -> 103 + ] -> 128 + + +S102{ + LexTerm : { LexPattern •} «)» + LexTerm : { LexPattern •} «(» + LexTerm : { LexPattern •} «.» + LexTerm : { LexPattern •} «[» + LexTerm : { LexPattern •} «char_lit» + LexTerm : { LexPattern •} «regDefId» + LexTerm : { LexPattern •} «{» + LexTerm : { LexPattern •} «~» + LexTerm : { LexPattern •} «|» + LexPattern : LexPattern •| LexAlt «}» + LexPattern : LexPattern •| LexAlt «|» +} +Transitions: + | -> 112 + } -> 129 + + +S103{ + LexPattern : LexPattern | •LexAlt «]» + LexPattern : LexPattern | •LexAlt «|» + LexAlt : •LexTerm «]» + LexAlt : •LexAlt LexTerm «]» + LexAlt : •LexTerm «|» + LexAlt : •LexAlt LexTerm «|» + LexTerm : •. «]» + LexTerm : •char_lit «]» + LexTerm : •char_lit - char_lit «]» + LexTerm : •~ char_lit «]» + LexTerm : •~ ( char_lit - char_lit ) «]» + LexTerm : •regDefId «]» + LexTerm : •[ LexPattern ] «]» + LexTerm : •{ LexPattern } «]» + LexTerm : •( LexPattern ) «]» + LexAlt : •LexTerm «(» + LexAlt : •LexTerm «.» + LexAlt : •LexTerm «[» + LexAlt : •LexTerm «char_lit» + LexAlt : •LexTerm «regDefId» + LexAlt : •LexTerm «{» + LexAlt : •LexTerm «~» + LexAlt : •LexAlt LexTerm «(» + LexAlt : •LexAlt LexTerm «.» + LexAlt : •LexAlt LexTerm «[» + LexAlt : •LexAlt LexTerm «char_lit» + LexAlt : •LexAlt LexTerm «regDefId» + LexAlt : •LexAlt LexTerm «{» + LexAlt : •LexAlt LexTerm «~» + LexTerm : •. «|» + LexTerm : •char_lit «|» + LexTerm : •char_lit - char_lit «|» + LexTerm : •~ char_lit «|» + LexTerm : •~ ( char_lit - char_lit ) «|» + LexTerm : •regDefId «|» + LexTerm : •[ LexPattern ] «|» + LexTerm : •{ LexPattern } «|» + LexTerm : •( LexPattern ) «|» + LexTerm : •. «(» + LexTerm : •char_lit «(» + LexTerm : •char_lit - char_lit «(» + LexTerm : •~ char_lit «(» + LexTerm : •~ ( char_lit - char_lit ) «(» + LexTerm : •regDefId «(» + LexTerm : •[ LexPattern ] «(» + LexTerm : •{ LexPattern } «(» + LexTerm : •( LexPattern ) «(» + LexTerm : •. «.» + LexTerm : •char_lit «.» + LexTerm : •char_lit - char_lit «.» + LexTerm : •~ char_lit «.» + LexTerm : •~ ( char_lit - char_lit ) «.» + LexTerm : •regDefId «.» + LexTerm : •[ LexPattern ] «.» + LexTerm : •{ LexPattern } «.» + LexTerm : •( LexPattern ) «.» + LexTerm : •. «[» + LexTerm : •char_lit «[» + LexTerm : •char_lit - char_lit «[» + LexTerm : •~ char_lit «[» + LexTerm : •~ ( char_lit - char_lit ) «[» + LexTerm : •regDefId «[» + LexTerm : •[ LexPattern ] «[» + LexTerm : •{ LexPattern } «[» + LexTerm : •( LexPattern ) «[» + LexTerm : •. «char_lit» + LexTerm : •char_lit «char_lit» + LexTerm : •char_lit - char_lit «char_lit» + LexTerm : •~ char_lit «char_lit» + LexTerm : •~ ( char_lit - char_lit ) «char_lit» + LexTerm : •regDefId «char_lit» + LexTerm : •[ LexPattern ] «char_lit» + LexTerm : •{ LexPattern } «char_lit» + LexTerm : •( LexPattern ) «char_lit» + LexTerm : •. «regDefId» + LexTerm : •char_lit «regDefId» + LexTerm : •char_lit - char_lit «regDefId» + LexTerm : •~ char_lit «regDefId» + LexTerm : •~ ( char_lit - char_lit ) «regDefId» + LexTerm : •regDefId «regDefId» + LexTerm : •[ LexPattern ] «regDefId» + LexTerm : •{ LexPattern } «regDefId» + LexTerm : •( LexPattern ) «regDefId» + LexTerm : •. «{» + LexTerm : •char_lit «{» + LexTerm : •char_lit - char_lit «{» + LexTerm : •~ char_lit «{» + LexTerm : •~ ( char_lit - char_lit ) «{» + LexTerm : •regDefId «{» + LexTerm : •[ LexPattern ] «{» + LexTerm : •{ LexPattern } «{» + LexTerm : •( LexPattern ) «{» + LexTerm : •. «~» + LexTerm : •char_lit «~» + LexTerm : •char_lit - char_lit «~» + LexTerm : •~ char_lit «~» + LexTerm : •~ ( char_lit - char_lit ) «~» + LexTerm : •regDefId «~» + LexTerm : •[ LexPattern ] «~» + LexTerm : •{ LexPattern } «~» + LexTerm : •( LexPattern ) «~» +} +Transitions: + regDefId -> 64 + LexTerm -> 66 + . -> 67 + char_lit -> 68 + ~ -> 69 + ( -> 70 + [ -> 71 + { -> 72 + LexAlt -> 130 + + +S104{ + LexTerm : [ LexPattern ]• «;» + LexTerm : [ LexPattern ]• «(» + LexTerm : [ LexPattern ]• «.» + LexTerm : [ LexPattern ]• «[» + LexTerm : [ LexPattern ]• «char_lit» + LexTerm : [ LexPattern ]• «regDefId» + LexTerm : [ LexPattern ]• «{» + LexTerm : [ LexPattern ]• «~» + LexTerm : [ LexPattern ]• «|» +} +Transitions: + + +S105{ + LexAlt : LexAlt LexTerm• «]» + LexAlt : LexAlt LexTerm• «(» + LexAlt : LexAlt LexTerm• «.» + LexAlt : LexAlt LexTerm• «[» + LexAlt : LexAlt LexTerm• «char_lit» + LexAlt : LexAlt LexTerm• «regDefId» + LexAlt : LexAlt LexTerm• «{» + LexAlt : LexAlt LexTerm• «~» + LexAlt : LexAlt LexTerm• «|» +} +Transitions: + + +S106{ + LexTerm : char_lit - •char_lit «]» + LexTerm : char_lit - •char_lit «(» + LexTerm : char_lit - •char_lit «.» + LexTerm : char_lit - •char_lit «[» + LexTerm : char_lit - •char_lit «char_lit» + LexTerm : char_lit - •char_lit «regDefId» + LexTerm : char_lit - •char_lit «{» + LexTerm : char_lit - •char_lit «~» + LexTerm : char_lit - •char_lit «|» +} +Transitions: + char_lit -> 131 + + +S107{ + LexTerm : ~ char_lit• «]» + LexTerm : ~ char_lit• «(» + LexTerm : ~ char_lit• «.» + LexTerm : ~ char_lit• «[» + LexTerm : ~ char_lit• «char_lit» + LexTerm : ~ char_lit• «regDefId» + LexTerm : ~ char_lit• «{» + LexTerm : ~ char_lit• «~» + LexTerm : ~ char_lit• «|» +} +Transitions: + + +S108{ + LexTerm : ~ ( •char_lit - char_lit ) «]» + LexTerm : ~ ( •char_lit - char_lit ) «(» + LexTerm : ~ ( •char_lit - char_lit ) «.» + LexTerm : ~ ( •char_lit - char_lit ) «[» + LexTerm : ~ ( •char_lit - char_lit ) «char_lit» + LexTerm : ~ ( •char_lit - char_lit ) «regDefId» + LexTerm : ~ ( •char_lit - char_lit ) «{» + LexTerm : ~ ( •char_lit - char_lit ) «~» + LexTerm : ~ ( •char_lit - char_lit ) «|» +} +Transitions: + char_lit -> 132 + + +S109{ + LexTerm : ( LexPattern •) «]» + LexTerm : ( LexPattern •) «(» + LexTerm : ( LexPattern •) «.» + LexTerm : ( LexPattern •) «[» + LexTerm : ( LexPattern •) «char_lit» + LexTerm : ( LexPattern •) «regDefId» + LexTerm : ( LexPattern •) «{» + LexTerm : ( LexPattern •) «~» + LexTerm : ( LexPattern •) «|» + LexPattern : LexPattern •| LexAlt «)» + LexPattern : LexPattern •| LexAlt «|» +} +Transitions: + | -> 94 + ) -> 133 + + +S110{ + LexTerm : [ LexPattern •] «]» + LexTerm : [ LexPattern •] «(» + LexTerm : [ LexPattern •] «.» + LexTerm : [ LexPattern •] «[» + LexTerm : [ LexPattern •] «char_lit» + LexTerm : [ LexPattern •] «regDefId» + LexTerm : [ LexPattern •] «{» + LexTerm : [ LexPattern •] «~» + LexTerm : [ LexPattern •] «|» + LexPattern : LexPattern •| LexAlt «]» + LexPattern : LexPattern •| LexAlt «|» +} +Transitions: + | -> 103 + ] -> 134 + + +S111{ + LexTerm : { LexPattern •} «]» + LexTerm : { LexPattern •} «(» + LexTerm : { LexPattern •} «.» + LexTerm : { LexPattern •} «[» + LexTerm : { LexPattern •} «char_lit» + LexTerm : { LexPattern •} «regDefId» + LexTerm : { LexPattern •} «{» + LexTerm : { LexPattern •} «~» + LexTerm : { LexPattern •} «|» + LexPattern : LexPattern •| LexAlt «}» + LexPattern : LexPattern •| LexAlt «|» +} +Transitions: + | -> 112 + } -> 135 + + +S112{ + LexPattern : LexPattern | •LexAlt «}» + LexPattern : LexPattern | •LexAlt «|» + LexAlt : •LexTerm «}» + LexAlt : •LexAlt LexTerm «}» + LexAlt : •LexTerm «|» + LexAlt : •LexAlt LexTerm «|» + LexTerm : •. «}» + LexTerm : •char_lit «}» + LexTerm : •char_lit - char_lit «}» + LexTerm : •~ char_lit «}» + LexTerm : •~ ( char_lit - char_lit ) «}» + LexTerm : •regDefId «}» + LexTerm : •[ LexPattern ] «}» + LexTerm : •{ LexPattern } «}» + LexTerm : •( LexPattern ) «}» + LexAlt : •LexTerm «(» + LexAlt : •LexTerm «.» + LexAlt : •LexTerm «[» + LexAlt : •LexTerm «char_lit» + LexAlt : •LexTerm «regDefId» + LexAlt : •LexTerm «{» + LexAlt : •LexTerm «~» + LexAlt : •LexAlt LexTerm «(» + LexAlt : •LexAlt LexTerm «.» + LexAlt : •LexAlt LexTerm «[» + LexAlt : •LexAlt LexTerm «char_lit» + LexAlt : •LexAlt LexTerm «regDefId» + LexAlt : •LexAlt LexTerm «{» + LexAlt : •LexAlt LexTerm «~» + LexTerm : •. «|» + LexTerm : •char_lit «|» + LexTerm : •char_lit - char_lit «|» + LexTerm : •~ char_lit «|» + LexTerm : •~ ( char_lit - char_lit ) «|» + LexTerm : •regDefId «|» + LexTerm : •[ LexPattern ] «|» + LexTerm : •{ LexPattern } «|» + LexTerm : •( LexPattern ) «|» + LexTerm : •. «(» + LexTerm : •char_lit «(» + LexTerm : •char_lit - char_lit «(» + LexTerm : •~ char_lit «(» + LexTerm : •~ ( char_lit - char_lit ) «(» + LexTerm : •regDefId «(» + LexTerm : •[ LexPattern ] «(» + LexTerm : •{ LexPattern } «(» + LexTerm : •( LexPattern ) «(» + LexTerm : •. «.» + LexTerm : •char_lit «.» + LexTerm : •char_lit - char_lit «.» + LexTerm : •~ char_lit «.» + LexTerm : •~ ( char_lit - char_lit ) «.» + LexTerm : •regDefId «.» + LexTerm : •[ LexPattern ] «.» + LexTerm : •{ LexPattern } «.» + LexTerm : •( LexPattern ) «.» + LexTerm : •. «[» + LexTerm : •char_lit «[» + LexTerm : •char_lit - char_lit «[» + LexTerm : •~ char_lit «[» + LexTerm : •~ ( char_lit - char_lit ) «[» + LexTerm : •regDefId «[» + LexTerm : •[ LexPattern ] «[» + LexTerm : •{ LexPattern } «[» + LexTerm : •( LexPattern ) «[» + LexTerm : •. «char_lit» + LexTerm : •char_lit «char_lit» + LexTerm : •char_lit - char_lit «char_lit» + LexTerm : •~ char_lit «char_lit» + LexTerm : •~ ( char_lit - char_lit ) «char_lit» + LexTerm : •regDefId «char_lit» + LexTerm : •[ LexPattern ] «char_lit» + LexTerm : •{ LexPattern } «char_lit» + LexTerm : •( LexPattern ) «char_lit» + LexTerm : •. «regDefId» + LexTerm : •char_lit «regDefId» + LexTerm : •char_lit - char_lit «regDefId» + LexTerm : •~ char_lit «regDefId» + LexTerm : •~ ( char_lit - char_lit ) «regDefId» + LexTerm : •regDefId «regDefId» + LexTerm : •[ LexPattern ] «regDefId» + LexTerm : •{ LexPattern } «regDefId» + LexTerm : •( LexPattern ) «regDefId» + LexTerm : •. «{» + LexTerm : •char_lit «{» + LexTerm : •char_lit - char_lit «{» + LexTerm : •~ char_lit «{» + LexTerm : •~ ( char_lit - char_lit ) «{» + LexTerm : •regDefId «{» + LexTerm : •[ LexPattern ] «{» + LexTerm : •{ LexPattern } «{» + LexTerm : •( LexPattern ) «{» + LexTerm : •. «~» + LexTerm : •char_lit «~» + LexTerm : •char_lit - char_lit «~» + LexTerm : •~ char_lit «~» + LexTerm : •~ ( char_lit - char_lit ) «~» + LexTerm : •regDefId «~» + LexTerm : •[ LexPattern ] «~» + LexTerm : •{ LexPattern } «~» + LexTerm : •( LexPattern ) «~» +} +Transitions: + regDefId -> 74 + LexTerm -> 76 + . -> 77 + char_lit -> 78 + ~ -> 79 + ( -> 80 + [ -> 81 + { -> 82 + LexAlt -> 136 + + +S113{ + LexTerm : { LexPattern }• «;» + LexTerm : { LexPattern }• «(» + LexTerm : { LexPattern }• «.» + LexTerm : { LexPattern }• «[» + LexTerm : { LexPattern }• «char_lit» + LexTerm : { LexPattern }• «regDefId» + LexTerm : { LexPattern }• «{» + LexTerm : { LexPattern }• «~» + LexTerm : { LexPattern }• «|» +} +Transitions: + + +S114{ + LexAlt : LexAlt LexTerm• «}» + LexAlt : LexAlt LexTerm• «(» + LexAlt : LexAlt LexTerm• «.» + LexAlt : LexAlt LexTerm• «[» + LexAlt : LexAlt LexTerm• «char_lit» + LexAlt : LexAlt LexTerm• «regDefId» + LexAlt : LexAlt LexTerm• «{» + LexAlt : LexAlt LexTerm• «~» + LexAlt : LexAlt LexTerm• «|» +} +Transitions: + + +S115{ + LexTerm : char_lit - •char_lit «}» + LexTerm : char_lit - •char_lit «(» + LexTerm : char_lit - •char_lit «.» + LexTerm : char_lit - •char_lit «[» + LexTerm : char_lit - •char_lit «char_lit» + LexTerm : char_lit - •char_lit «regDefId» + LexTerm : char_lit - •char_lit «{» + LexTerm : char_lit - •char_lit «~» + LexTerm : char_lit - •char_lit «|» +} +Transitions: + char_lit -> 137 + + +S116{ + LexTerm : ~ char_lit• «}» + LexTerm : ~ char_lit• «(» + LexTerm : ~ char_lit• «.» + LexTerm : ~ char_lit• «[» + LexTerm : ~ char_lit• «char_lit» + LexTerm : ~ char_lit• «regDefId» + LexTerm : ~ char_lit• «{» + LexTerm : ~ char_lit• «~» + LexTerm : ~ char_lit• «|» +} +Transitions: + + +S117{ + LexTerm : ~ ( •char_lit - char_lit ) «}» + LexTerm : ~ ( •char_lit - char_lit ) «(» + LexTerm : ~ ( •char_lit - char_lit ) «.» + LexTerm : ~ ( •char_lit - char_lit ) «[» + LexTerm : ~ ( •char_lit - char_lit ) «char_lit» + LexTerm : ~ ( •char_lit - char_lit ) «regDefId» + LexTerm : ~ ( •char_lit - char_lit ) «{» + LexTerm : ~ ( •char_lit - char_lit ) «~» + LexTerm : ~ ( •char_lit - char_lit ) «|» +} +Transitions: + char_lit -> 138 + + +S118{ + LexTerm : ( LexPattern •) «}» + LexTerm : ( LexPattern •) «(» + LexTerm : ( LexPattern •) «.» + LexTerm : ( LexPattern •) «[» + LexTerm : ( LexPattern •) «char_lit» + LexTerm : ( LexPattern •) «regDefId» + LexTerm : ( LexPattern •) «{» + LexTerm : ( LexPattern •) «~» + LexTerm : ( LexPattern •) «|» + LexPattern : LexPattern •| LexAlt «)» + LexPattern : LexPattern •| LexAlt «|» +} +Transitions: + | -> 94 + ) -> 139 + + +S119{ + LexTerm : [ LexPattern •] «}» + LexTerm : [ LexPattern •] «(» + LexTerm : [ LexPattern •] «.» + LexTerm : [ LexPattern •] «[» + LexTerm : [ LexPattern •] «char_lit» + LexTerm : [ LexPattern •] «regDefId» + LexTerm : [ LexPattern •] «{» + LexTerm : [ LexPattern •] «~» + LexTerm : [ LexPattern •] «|» + LexPattern : LexPattern •| LexAlt «]» + LexPattern : LexPattern •| LexAlt «|» +} +Transitions: + | -> 103 + ] -> 140 + + +S120{ + LexTerm : { LexPattern •} «}» + LexTerm : { LexPattern •} «(» + LexTerm : { LexPattern •} «.» + LexTerm : { LexPattern •} «[» + LexTerm : { LexPattern •} «char_lit» + LexTerm : { LexPattern •} «regDefId» + LexTerm : { LexPattern •} «{» + LexTerm : { LexPattern •} «~» + LexTerm : { LexPattern •} «|» + LexPattern : LexPattern •| LexAlt «}» + LexPattern : LexPattern •| LexAlt «|» +} +Transitions: + | -> 112 + } -> 141 + + +S121{ + Alternatives : Alternatives | SyntaxBody• «;» + Alternatives : Alternatives | SyntaxBody• «|» +} +Transitions: + + +S122{ + SyntaxBody : ErrorSymbol Symbols g_sdt_lit• «;» + SyntaxBody : ErrorSymbol Symbols g_sdt_lit• «|» +} +Transitions: + + +S123{ + LexTerm : ~ ( char_lit - •char_lit ) «;» + LexTerm : ~ ( char_lit - •char_lit ) «(» + LexTerm : ~ ( char_lit - •char_lit ) «.» + LexTerm : ~ ( char_lit - •char_lit ) «[» + LexTerm : ~ ( char_lit - •char_lit ) «char_lit» + LexTerm : ~ ( char_lit - •char_lit ) «regDefId» + LexTerm : ~ ( char_lit - •char_lit ) «{» + LexTerm : ~ ( char_lit - •char_lit ) «~» + LexTerm : ~ ( char_lit - •char_lit ) «|» +} +Transitions: + char_lit -> 142 + + +S124{ + LexPattern : LexPattern | LexAlt• «)» + LexPattern : LexPattern | LexAlt• «|» + LexAlt : LexAlt •LexTerm «)» + LexAlt : LexAlt •LexTerm «|» + LexAlt : LexAlt •LexTerm «(» + LexAlt : LexAlt •LexTerm «.» + LexAlt : LexAlt •LexTerm «[» + LexAlt : LexAlt •LexTerm «char_lit» + LexAlt : LexAlt •LexTerm «regDefId» + LexAlt : LexAlt •LexTerm «{» + LexAlt : LexAlt •LexTerm «~» + LexTerm : •. «)» + LexTerm : •char_lit «)» + LexTerm : •char_lit - char_lit «)» + LexTerm : •~ char_lit «)» + LexTerm : •~ ( char_lit - char_lit ) «)» + LexTerm : •regDefId «)» + LexTerm : •[ LexPattern ] «)» + LexTerm : •{ LexPattern } «)» + LexTerm : •( LexPattern ) «)» + LexTerm : •. «|» + LexTerm : •char_lit «|» + LexTerm : •char_lit - char_lit «|» + LexTerm : •~ char_lit «|» + LexTerm : •~ ( char_lit - char_lit ) «|» + LexTerm : •regDefId «|» + LexTerm : •[ LexPattern ] «|» + LexTerm : •{ LexPattern } «|» + LexTerm : •( LexPattern ) «|» + LexTerm : •. «(» + LexTerm : •char_lit «(» + LexTerm : •char_lit - char_lit «(» + LexTerm : •~ char_lit «(» + LexTerm : •~ ( char_lit - char_lit ) «(» + LexTerm : •regDefId «(» + LexTerm : •[ LexPattern ] «(» + LexTerm : •{ LexPattern } «(» + LexTerm : •( LexPattern ) «(» + LexTerm : •. «.» + LexTerm : •char_lit «.» + LexTerm : •char_lit - char_lit «.» + LexTerm : •~ char_lit «.» + LexTerm : •~ ( char_lit - char_lit ) «.» + LexTerm : •regDefId «.» + LexTerm : •[ LexPattern ] «.» + LexTerm : •{ LexPattern } «.» + LexTerm : •( LexPattern ) «.» + LexTerm : •. «[» + LexTerm : •char_lit «[» + LexTerm : •char_lit - char_lit «[» + LexTerm : •~ char_lit «[» + LexTerm : •~ ( char_lit - char_lit ) «[» + LexTerm : •regDefId «[» + LexTerm : •[ LexPattern ] «[» + LexTerm : •{ LexPattern } «[» + LexTerm : •( LexPattern ) «[» + LexTerm : •. «char_lit» + LexTerm : •char_lit «char_lit» + LexTerm : •char_lit - char_lit «char_lit» + LexTerm : •~ char_lit «char_lit» + LexTerm : •~ ( char_lit - char_lit ) «char_lit» + LexTerm : •regDefId «char_lit» + LexTerm : •[ LexPattern ] «char_lit» + LexTerm : •{ LexPattern } «char_lit» + LexTerm : •( LexPattern ) «char_lit» + LexTerm : •. «regDefId» + LexTerm : •char_lit «regDefId» + LexTerm : •char_lit - char_lit «regDefId» + LexTerm : •~ char_lit «regDefId» + LexTerm : •~ ( char_lit - char_lit ) «regDefId» + LexTerm : •regDefId «regDefId» + LexTerm : •[ LexPattern ] «regDefId» + LexTerm : •{ LexPattern } «regDefId» + LexTerm : •( LexPattern ) «regDefId» + LexTerm : •. «{» + LexTerm : •char_lit «{» + LexTerm : •char_lit - char_lit «{» + LexTerm : •~ char_lit «{» + LexTerm : •~ ( char_lit - char_lit ) «{» + LexTerm : •regDefId «{» + LexTerm : •[ LexPattern ] «{» + LexTerm : •{ LexPattern } «{» + LexTerm : •( LexPattern ) «{» + LexTerm : •. «~» + LexTerm : •char_lit «~» + LexTerm : •char_lit - char_lit «~» + LexTerm : •~ char_lit «~» + LexTerm : •~ ( char_lit - char_lit ) «~» + LexTerm : •regDefId «~» + LexTerm : •[ LexPattern ] «~» + LexTerm : •{ LexPattern } «~» + LexTerm : •( LexPattern ) «~» +} +Transitions: + regDefId -> 54 + . -> 57 + char_lit -> 58 + ~ -> 59 + ( -> 60 + [ -> 61 + { -> 62 + LexTerm -> 96 + + +S125{ + LexTerm : char_lit - char_lit• «)» + LexTerm : char_lit - char_lit• «(» + LexTerm : char_lit - char_lit• «.» + LexTerm : char_lit - char_lit• «[» + LexTerm : char_lit - char_lit• «char_lit» + LexTerm : char_lit - char_lit• «regDefId» + LexTerm : char_lit - char_lit• «{» + LexTerm : char_lit - char_lit• «~» + LexTerm : char_lit - char_lit• «|» +} +Transitions: + + +S126{ + LexTerm : ~ ( char_lit •- char_lit ) «)» + LexTerm : ~ ( char_lit •- char_lit ) «(» + LexTerm : ~ ( char_lit •- char_lit ) «.» + LexTerm : ~ ( char_lit •- char_lit ) «[» + LexTerm : ~ ( char_lit •- char_lit ) «char_lit» + LexTerm : ~ ( char_lit •- char_lit ) «regDefId» + LexTerm : ~ ( char_lit •- char_lit ) «{» + LexTerm : ~ ( char_lit •- char_lit ) «~» + LexTerm : ~ ( char_lit •- char_lit ) «|» +} +Transitions: + - -> 143 + + +S127{ + LexTerm : ( LexPattern )• «)» + LexTerm : ( LexPattern )• «(» + LexTerm : ( LexPattern )• «.» + LexTerm : ( LexPattern )• «[» + LexTerm : ( LexPattern )• «char_lit» + LexTerm : ( LexPattern )• «regDefId» + LexTerm : ( LexPattern )• «{» + LexTerm : ( LexPattern )• «~» + LexTerm : ( LexPattern )• «|» +} +Transitions: + + +S128{ + LexTerm : [ LexPattern ]• «)» + LexTerm : [ LexPattern ]• «(» + LexTerm : [ LexPattern ]• «.» + LexTerm : [ LexPattern ]• «[» + LexTerm : [ LexPattern ]• «char_lit» + LexTerm : [ LexPattern ]• «regDefId» + LexTerm : [ LexPattern ]• «{» + LexTerm : [ LexPattern ]• «~» + LexTerm : [ LexPattern ]• «|» +} +Transitions: + + +S129{ + LexTerm : { LexPattern }• «)» + LexTerm : { LexPattern }• «(» + LexTerm : { LexPattern }• «.» + LexTerm : { LexPattern }• «[» + LexTerm : { LexPattern }• «char_lit» + LexTerm : { LexPattern }• «regDefId» + LexTerm : { LexPattern }• «{» + LexTerm : { LexPattern }• «~» + LexTerm : { LexPattern }• «|» +} +Transitions: + + +S130{ + LexPattern : LexPattern | LexAlt• «]» + LexPattern : LexPattern | LexAlt• «|» + LexAlt : LexAlt •LexTerm «]» + LexAlt : LexAlt •LexTerm «|» + LexAlt : LexAlt •LexTerm «(» + LexAlt : LexAlt •LexTerm «.» + LexAlt : LexAlt •LexTerm «[» + LexAlt : LexAlt •LexTerm «char_lit» + LexAlt : LexAlt •LexTerm «regDefId» + LexAlt : LexAlt •LexTerm «{» + LexAlt : LexAlt •LexTerm «~» + LexTerm : •. «]» + LexTerm : •char_lit «]» + LexTerm : •char_lit - char_lit «]» + LexTerm : •~ char_lit «]» + LexTerm : •~ ( char_lit - char_lit ) «]» + LexTerm : •regDefId «]» + LexTerm : •[ LexPattern ] «]» + LexTerm : •{ LexPattern } «]» + LexTerm : •( LexPattern ) «]» + LexTerm : •. «|» + LexTerm : •char_lit «|» + LexTerm : •char_lit - char_lit «|» + LexTerm : •~ char_lit «|» + LexTerm : •~ ( char_lit - char_lit ) «|» + LexTerm : •regDefId «|» + LexTerm : •[ LexPattern ] «|» + LexTerm : •{ LexPattern } «|» + LexTerm : •( LexPattern ) «|» + LexTerm : •. «(» + LexTerm : •char_lit «(» + LexTerm : •char_lit - char_lit «(» + LexTerm : •~ char_lit «(» + LexTerm : •~ ( char_lit - char_lit ) «(» + LexTerm : •regDefId «(» + LexTerm : •[ LexPattern ] «(» + LexTerm : •{ LexPattern } «(» + LexTerm : •( LexPattern ) «(» + LexTerm : •. «.» + LexTerm : •char_lit «.» + LexTerm : •char_lit - char_lit «.» + LexTerm : •~ char_lit «.» + LexTerm : •~ ( char_lit - char_lit ) «.» + LexTerm : •regDefId «.» + LexTerm : •[ LexPattern ] «.» + LexTerm : •{ LexPattern } «.» + LexTerm : •( LexPattern ) «.» + LexTerm : •. «[» + LexTerm : •char_lit «[» + LexTerm : •char_lit - char_lit «[» + LexTerm : •~ char_lit «[» + LexTerm : •~ ( char_lit - char_lit ) «[» + LexTerm : •regDefId «[» + LexTerm : •[ LexPattern ] «[» + LexTerm : •{ LexPattern } «[» + LexTerm : •( LexPattern ) «[» + LexTerm : •. «char_lit» + LexTerm : •char_lit «char_lit» + LexTerm : •char_lit - char_lit «char_lit» + LexTerm : •~ char_lit «char_lit» + LexTerm : •~ ( char_lit - char_lit ) «char_lit» + LexTerm : •regDefId «char_lit» + LexTerm : •[ LexPattern ] «char_lit» + LexTerm : •{ LexPattern } «char_lit» + LexTerm : •( LexPattern ) «char_lit» + LexTerm : •. «regDefId» + LexTerm : •char_lit «regDefId» + LexTerm : •char_lit - char_lit «regDefId» + LexTerm : •~ char_lit «regDefId» + LexTerm : •~ ( char_lit - char_lit ) «regDefId» + LexTerm : •regDefId «regDefId» + LexTerm : •[ LexPattern ] «regDefId» + LexTerm : •{ LexPattern } «regDefId» + LexTerm : •( LexPattern ) «regDefId» + LexTerm : •. «{» + LexTerm : •char_lit «{» + LexTerm : •char_lit - char_lit «{» + LexTerm : •~ char_lit «{» + LexTerm : •~ ( char_lit - char_lit ) «{» + LexTerm : •regDefId «{» + LexTerm : •[ LexPattern ] «{» + LexTerm : •{ LexPattern } «{» + LexTerm : •( LexPattern ) «{» + LexTerm : •. «~» + LexTerm : •char_lit «~» + LexTerm : •char_lit - char_lit «~» + LexTerm : •~ char_lit «~» + LexTerm : •~ ( char_lit - char_lit ) «~» + LexTerm : •regDefId «~» + LexTerm : •[ LexPattern ] «~» + LexTerm : •{ LexPattern } «~» + LexTerm : •( LexPattern ) «~» +} +Transitions: + regDefId -> 64 + . -> 67 + char_lit -> 68 + ~ -> 69 + ( -> 70 + [ -> 71 + { -> 72 + LexTerm -> 105 + + +S131{ + LexTerm : char_lit - char_lit• «]» + LexTerm : char_lit - char_lit• «(» + LexTerm : char_lit - char_lit• «.» + LexTerm : char_lit - char_lit• «[» + LexTerm : char_lit - char_lit• «char_lit» + LexTerm : char_lit - char_lit• «regDefId» + LexTerm : char_lit - char_lit• «{» + LexTerm : char_lit - char_lit• «~» + LexTerm : char_lit - char_lit• «|» +} +Transitions: + + +S132{ + LexTerm : ~ ( char_lit •- char_lit ) «]» + LexTerm : ~ ( char_lit •- char_lit ) «(» + LexTerm : ~ ( char_lit •- char_lit ) «.» + LexTerm : ~ ( char_lit •- char_lit ) «[» + LexTerm : ~ ( char_lit •- char_lit ) «char_lit» + LexTerm : ~ ( char_lit •- char_lit ) «regDefId» + LexTerm : ~ ( char_lit •- char_lit ) «{» + LexTerm : ~ ( char_lit •- char_lit ) «~» + LexTerm : ~ ( char_lit •- char_lit ) «|» +} +Transitions: + - -> 144 + + +S133{ + LexTerm : ( LexPattern )• «]» + LexTerm : ( LexPattern )• «(» + LexTerm : ( LexPattern )• «.» + LexTerm : ( LexPattern )• «[» + LexTerm : ( LexPattern )• «char_lit» + LexTerm : ( LexPattern )• «regDefId» + LexTerm : ( LexPattern )• «{» + LexTerm : ( LexPattern )• «~» + LexTerm : ( LexPattern )• «|» +} +Transitions: + + +S134{ + LexTerm : [ LexPattern ]• «]» + LexTerm : [ LexPattern ]• «(» + LexTerm : [ LexPattern ]• «.» + LexTerm : [ LexPattern ]• «[» + LexTerm : [ LexPattern ]• «char_lit» + LexTerm : [ LexPattern ]• «regDefId» + LexTerm : [ LexPattern ]• «{» + LexTerm : [ LexPattern ]• «~» + LexTerm : [ LexPattern ]• «|» +} +Transitions: + + +S135{ + LexTerm : { LexPattern }• «]» + LexTerm : { LexPattern }• «(» + LexTerm : { LexPattern }• «.» + LexTerm : { LexPattern }• «[» + LexTerm : { LexPattern }• «char_lit» + LexTerm : { LexPattern }• «regDefId» + LexTerm : { LexPattern }• «{» + LexTerm : { LexPattern }• «~» + LexTerm : { LexPattern }• «|» +} +Transitions: + + +S136{ + LexPattern : LexPattern | LexAlt• «}» + LexPattern : LexPattern | LexAlt• «|» + LexAlt : LexAlt •LexTerm «}» + LexAlt : LexAlt •LexTerm «|» + LexAlt : LexAlt •LexTerm «(» + LexAlt : LexAlt •LexTerm «.» + LexAlt : LexAlt •LexTerm «[» + LexAlt : LexAlt •LexTerm «char_lit» + LexAlt : LexAlt •LexTerm «regDefId» + LexAlt : LexAlt •LexTerm «{» + LexAlt : LexAlt •LexTerm «~» + LexTerm : •. «}» + LexTerm : •char_lit «}» + LexTerm : •char_lit - char_lit «}» + LexTerm : •~ char_lit «}» + LexTerm : •~ ( char_lit - char_lit ) «}» + LexTerm : •regDefId «}» + LexTerm : •[ LexPattern ] «}» + LexTerm : •{ LexPattern } «}» + LexTerm : •( LexPattern ) «}» + LexTerm : •. «|» + LexTerm : •char_lit «|» + LexTerm : •char_lit - char_lit «|» + LexTerm : •~ char_lit «|» + LexTerm : •~ ( char_lit - char_lit ) «|» + LexTerm : •regDefId «|» + LexTerm : •[ LexPattern ] «|» + LexTerm : •{ LexPattern } «|» + LexTerm : •( LexPattern ) «|» + LexTerm : •. «(» + LexTerm : •char_lit «(» + LexTerm : •char_lit - char_lit «(» + LexTerm : •~ char_lit «(» + LexTerm : •~ ( char_lit - char_lit ) «(» + LexTerm : •regDefId «(» + LexTerm : •[ LexPattern ] «(» + LexTerm : •{ LexPattern } «(» + LexTerm : •( LexPattern ) «(» + LexTerm : •. «.» + LexTerm : •char_lit «.» + LexTerm : •char_lit - char_lit «.» + LexTerm : •~ char_lit «.» + LexTerm : •~ ( char_lit - char_lit ) «.» + LexTerm : •regDefId «.» + LexTerm : •[ LexPattern ] «.» + LexTerm : •{ LexPattern } «.» + LexTerm : •( LexPattern ) «.» + LexTerm : •. «[» + LexTerm : •char_lit «[» + LexTerm : •char_lit - char_lit «[» + LexTerm : •~ char_lit «[» + LexTerm : •~ ( char_lit - char_lit ) «[» + LexTerm : •regDefId «[» + LexTerm : •[ LexPattern ] «[» + LexTerm : •{ LexPattern } «[» + LexTerm : •( LexPattern ) «[» + LexTerm : •. «char_lit» + LexTerm : •char_lit «char_lit» + LexTerm : •char_lit - char_lit «char_lit» + LexTerm : •~ char_lit «char_lit» + LexTerm : •~ ( char_lit - char_lit ) «char_lit» + LexTerm : •regDefId «char_lit» + LexTerm : •[ LexPattern ] «char_lit» + LexTerm : •{ LexPattern } «char_lit» + LexTerm : •( LexPattern ) «char_lit» + LexTerm : •. «regDefId» + LexTerm : •char_lit «regDefId» + LexTerm : •char_lit - char_lit «regDefId» + LexTerm : •~ char_lit «regDefId» + LexTerm : •~ ( char_lit - char_lit ) «regDefId» + LexTerm : •regDefId «regDefId» + LexTerm : •[ LexPattern ] «regDefId» + LexTerm : •{ LexPattern } «regDefId» + LexTerm : •( LexPattern ) «regDefId» + LexTerm : •. «{» + LexTerm : •char_lit «{» + LexTerm : •char_lit - char_lit «{» + LexTerm : •~ char_lit «{» + LexTerm : •~ ( char_lit - char_lit ) «{» + LexTerm : •regDefId «{» + LexTerm : •[ LexPattern ] «{» + LexTerm : •{ LexPattern } «{» + LexTerm : •( LexPattern ) «{» + LexTerm : •. «~» + LexTerm : •char_lit «~» + LexTerm : •char_lit - char_lit «~» + LexTerm : •~ char_lit «~» + LexTerm : •~ ( char_lit - char_lit ) «~» + LexTerm : •regDefId «~» + LexTerm : •[ LexPattern ] «~» + LexTerm : •{ LexPattern } «~» + LexTerm : •( LexPattern ) «~» +} +Transitions: + regDefId -> 74 + . -> 77 + char_lit -> 78 + ~ -> 79 + ( -> 80 + [ -> 81 + { -> 82 + LexTerm -> 114 + + +S137{ + LexTerm : char_lit - char_lit• «}» + LexTerm : char_lit - char_lit• «(» + LexTerm : char_lit - char_lit• «.» + LexTerm : char_lit - char_lit• «[» + LexTerm : char_lit - char_lit• «char_lit» + LexTerm : char_lit - char_lit• «regDefId» + LexTerm : char_lit - char_lit• «{» + LexTerm : char_lit - char_lit• «~» + LexTerm : char_lit - char_lit• «|» +} +Transitions: + + +S138{ + LexTerm : ~ ( char_lit •- char_lit ) «}» + LexTerm : ~ ( char_lit •- char_lit ) «(» + LexTerm : ~ ( char_lit •- char_lit ) «.» + LexTerm : ~ ( char_lit •- char_lit ) «[» + LexTerm : ~ ( char_lit •- char_lit ) «char_lit» + LexTerm : ~ ( char_lit •- char_lit ) «regDefId» + LexTerm : ~ ( char_lit •- char_lit ) «{» + LexTerm : ~ ( char_lit •- char_lit ) «~» + LexTerm : ~ ( char_lit •- char_lit ) «|» +} +Transitions: + - -> 145 + + +S139{ + LexTerm : ( LexPattern )• «}» + LexTerm : ( LexPattern )• «(» + LexTerm : ( LexPattern )• «.» + LexTerm : ( LexPattern )• «[» + LexTerm : ( LexPattern )• «char_lit» + LexTerm : ( LexPattern )• «regDefId» + LexTerm : ( LexPattern )• «{» + LexTerm : ( LexPattern )• «~» + LexTerm : ( LexPattern )• «|» +} +Transitions: + + +S140{ + LexTerm : [ LexPattern ]• «}» + LexTerm : [ LexPattern ]• «(» + LexTerm : [ LexPattern ]• «.» + LexTerm : [ LexPattern ]• «[» + LexTerm : [ LexPattern ]• «char_lit» + LexTerm : [ LexPattern ]• «regDefId» + LexTerm : [ LexPattern ]• «{» + LexTerm : [ LexPattern ]• «~» + LexTerm : [ LexPattern ]• «|» +} +Transitions: + + +S141{ + LexTerm : { LexPattern }• «}» + LexTerm : { LexPattern }• «(» + LexTerm : { LexPattern }• «.» + LexTerm : { LexPattern }• «[» + LexTerm : { LexPattern }• «char_lit» + LexTerm : { LexPattern }• «regDefId» + LexTerm : { LexPattern }• «{» + LexTerm : { LexPattern }• «~» + LexTerm : { LexPattern }• «|» +} +Transitions: + + +S142{ + LexTerm : ~ ( char_lit - char_lit •) «;» + LexTerm : ~ ( char_lit - char_lit •) «(» + LexTerm : ~ ( char_lit - char_lit •) «.» + LexTerm : ~ ( char_lit - char_lit •) «[» + LexTerm : ~ ( char_lit - char_lit •) «char_lit» + LexTerm : ~ ( char_lit - char_lit •) «regDefId» + LexTerm : ~ ( char_lit - char_lit •) «{» + LexTerm : ~ ( char_lit - char_lit •) «~» + LexTerm : ~ ( char_lit - char_lit •) «|» +} +Transitions: + ) -> 146 + + +S143{ + LexTerm : ~ ( char_lit - •char_lit ) «)» + LexTerm : ~ ( char_lit - •char_lit ) «(» + LexTerm : ~ ( char_lit - •char_lit ) «.» + LexTerm : ~ ( char_lit - •char_lit ) «[» + LexTerm : ~ ( char_lit - •char_lit ) «char_lit» + LexTerm : ~ ( char_lit - •char_lit ) «regDefId» + LexTerm : ~ ( char_lit - •char_lit ) «{» + LexTerm : ~ ( char_lit - •char_lit ) «~» + LexTerm : ~ ( char_lit - •char_lit ) «|» +} +Transitions: + char_lit -> 147 + + +S144{ + LexTerm : ~ ( char_lit - •char_lit ) «]» + LexTerm : ~ ( char_lit - •char_lit ) «(» + LexTerm : ~ ( char_lit - •char_lit ) «.» + LexTerm : ~ ( char_lit - •char_lit ) «[» + LexTerm : ~ ( char_lit - •char_lit ) «char_lit» + LexTerm : ~ ( char_lit - •char_lit ) «regDefId» + LexTerm : ~ ( char_lit - •char_lit ) «{» + LexTerm : ~ ( char_lit - •char_lit ) «~» + LexTerm : ~ ( char_lit - •char_lit ) «|» +} +Transitions: + char_lit -> 148 + + +S145{ + LexTerm : ~ ( char_lit - •char_lit ) «}» + LexTerm : ~ ( char_lit - •char_lit ) «(» + LexTerm : ~ ( char_lit - •char_lit ) «.» + LexTerm : ~ ( char_lit - •char_lit ) «[» + LexTerm : ~ ( char_lit - •char_lit ) «char_lit» + LexTerm : ~ ( char_lit - •char_lit ) «regDefId» + LexTerm : ~ ( char_lit - •char_lit ) «{» + LexTerm : ~ ( char_lit - •char_lit ) «~» + LexTerm : ~ ( char_lit - •char_lit ) «|» +} +Transitions: + char_lit -> 149 + + +S146{ + LexTerm : ~ ( char_lit - char_lit )• «;» + LexTerm : ~ ( char_lit - char_lit )• «(» + LexTerm : ~ ( char_lit - char_lit )• «.» + LexTerm : ~ ( char_lit - char_lit )• «[» + LexTerm : ~ ( char_lit - char_lit )• «char_lit» + LexTerm : ~ ( char_lit - char_lit )• «regDefId» + LexTerm : ~ ( char_lit - char_lit )• «{» + LexTerm : ~ ( char_lit - char_lit )• «~» + LexTerm : ~ ( char_lit - char_lit )• «|» +} +Transitions: + + +S147{ + LexTerm : ~ ( char_lit - char_lit •) «)» + LexTerm : ~ ( char_lit - char_lit •) «(» + LexTerm : ~ ( char_lit - char_lit •) «.» + LexTerm : ~ ( char_lit - char_lit •) «[» + LexTerm : ~ ( char_lit - char_lit •) «char_lit» + LexTerm : ~ ( char_lit - char_lit •) «regDefId» + LexTerm : ~ ( char_lit - char_lit •) «{» + LexTerm : ~ ( char_lit - char_lit •) «~» + LexTerm : ~ ( char_lit - char_lit •) «|» +} +Transitions: + ) -> 150 + + +S148{ + LexTerm : ~ ( char_lit - char_lit •) «]» + LexTerm : ~ ( char_lit - char_lit •) «(» + LexTerm : ~ ( char_lit - char_lit •) «.» + LexTerm : ~ ( char_lit - char_lit •) «[» + LexTerm : ~ ( char_lit - char_lit •) «char_lit» + LexTerm : ~ ( char_lit - char_lit •) «regDefId» + LexTerm : ~ ( char_lit - char_lit •) «{» + LexTerm : ~ ( char_lit - char_lit •) «~» + LexTerm : ~ ( char_lit - char_lit •) «|» +} +Transitions: + ) -> 151 + + +S149{ + LexTerm : ~ ( char_lit - char_lit •) «}» + LexTerm : ~ ( char_lit - char_lit •) «(» + LexTerm : ~ ( char_lit - char_lit •) «.» + LexTerm : ~ ( char_lit - char_lit •) «[» + LexTerm : ~ ( char_lit - char_lit •) «char_lit» + LexTerm : ~ ( char_lit - char_lit •) «regDefId» + LexTerm : ~ ( char_lit - char_lit •) «{» + LexTerm : ~ ( char_lit - char_lit •) «~» + LexTerm : ~ ( char_lit - char_lit •) «|» +} +Transitions: + ) -> 152 + + +S150{ + LexTerm : ~ ( char_lit - char_lit )• «)» + LexTerm : ~ ( char_lit - char_lit )• «(» + LexTerm : ~ ( char_lit - char_lit )• «.» + LexTerm : ~ ( char_lit - char_lit )• «[» + LexTerm : ~ ( char_lit - char_lit )• «char_lit» + LexTerm : ~ ( char_lit - char_lit )• «regDefId» + LexTerm : ~ ( char_lit - char_lit )• «{» + LexTerm : ~ ( char_lit - char_lit )• «~» + LexTerm : ~ ( char_lit - char_lit )• «|» +} +Transitions: + + +S151{ + LexTerm : ~ ( char_lit - char_lit )• «]» + LexTerm : ~ ( char_lit - char_lit )• «(» + LexTerm : ~ ( char_lit - char_lit )• «.» + LexTerm : ~ ( char_lit - char_lit )• «[» + LexTerm : ~ ( char_lit - char_lit )• «char_lit» + LexTerm : ~ ( char_lit - char_lit )• «regDefId» + LexTerm : ~ ( char_lit - char_lit )• «{» + LexTerm : ~ ( char_lit - char_lit )• «~» + LexTerm : ~ ( char_lit - char_lit )• «|» +} +Transitions: + + +S152{ + LexTerm : ~ ( char_lit - char_lit )• «}» + LexTerm : ~ ( char_lit - char_lit )• «(» + LexTerm : ~ ( char_lit - char_lit )• «.» + LexTerm : ~ ( char_lit - char_lit )• «[» + LexTerm : ~ ( char_lit - char_lit )• «char_lit» + LexTerm : ~ ( char_lit - char_lit )• «regDefId» + LexTerm : ~ ( char_lit - char_lit )• «{» + LexTerm : ~ ( char_lit - char_lit )• «~» + LexTerm : ~ ( char_lit - char_lit )• «|» +} +Transitions: + + diff --git a/internal/frontend_ext/errors/errors.go b/internal/fe2/errors/errors.go similarity index 95% rename from internal/frontend_ext/errors/errors.go rename to internal/fe2/errors/errors.go index 36fecb76..0a9b882f 100644 --- a/internal/frontend_ext/errors/errors.go +++ b/internal/fe2/errors/errors.go @@ -6,7 +6,7 @@ import ( "fmt" "strings" - "github.com/maxcalandrelli/gocc/internal/frontend/token" + "github.com/maxcalandrelli/gocc/internal/fe2/token" ) type ErrorSymbol interface { diff --git a/internal/fe2/first.txt b/internal/fe2/first.txt new file mode 100644 index 00000000..8def1809 --- /dev/null +++ b/internal/fe2/first.txt @@ -0,0 +1,106 @@ +S': { + g_sdt_lit + ignoredTokId + prodId + regDefId + tokId +} +Grammar: { + g_sdt_lit + ignoredTokId + prodId + regDefId + tokId +} +LexicalPart: { + ignoredTokId + regDefId + tokId +} +LexProductions: { + ignoredTokId + regDefId + tokId +} +LexProduction: { + ignoredTokId + regDefId + tokId +} +LexPattern: { + ( + . + [ + char_lit + regDefId + { + ~ +} +LexAlt: { + ( + . + [ + char_lit + regDefId + { + ~ +} +LexTerm: { + ( + . + [ + char_lit + regDefId + { + ~ +} +SyntaxPart: { + g_sdt_lit + prodId +} +FileHeader: { + g_sdt_lit +} +SyntaxProdList: { + prodId +} +SyntaxProduction: { + prodId +} +Alternatives: { + empty + errore + prodId + string_lit + tokId + | + ε + λ +} +SyntaxBody: { + empty + errore + prodId + string_lit + tokId + ε + λ +} +Symbols: { + prodId + string_lit + tokId +} +Symbol: { + prodId + string_lit + tokId +} +ErrorSymbol: { + errore + λ +} +EpsilonSymbol: { + empty + ε +} diff --git a/internal/frontend_ext/lexer/acttab.go b/internal/fe2/lexer/acttab.go similarity index 97% rename from internal/frontend_ext/lexer/acttab.go rename to internal/fe2/lexer/acttab.go index ad36db37..d3688e3c 100644 --- a/internal/frontend_ext/lexer/acttab.go +++ b/internal/fe2/lexer/acttab.go @@ -5,7 +5,7 @@ package lexer import ( "fmt" - "github.com/maxcalandrelli/gocc/internal/frontend/token" + "github.com/maxcalandrelli/gocc/internal/fe2/token" ) type ActionTable [NumStates]ActionRow @@ -49,7 +49,7 @@ var ActTab = ActionTable{ Ignore: "", }, ActionRow{ // S7 - Accept: 11, + Accept: 10, Ignore: "", }, ActionRow{ // S8 @@ -113,11 +113,11 @@ var ActTab = ActionTable{ Ignore: "", }, ActionRow{ // S23 - Accept: 10, + Accept: 11, Ignore: "", }, ActionRow{ // S24 - Accept: 6, + Accept: 24, Ignore: "", }, ActionRow{ // S25 @@ -125,11 +125,11 @@ var ActTab = ActionTable{ Ignore: "", }, ActionRow{ // S26 - Accept: 0, + Accept: 6, Ignore: "", }, ActionRow{ // S27 - Accept: 0, + Accept: 20, Ignore: "", }, ActionRow{ // S28 @@ -157,7 +157,7 @@ var ActTab = ActionTable{ Ignore: "", }, ActionRow{ // S34 - Accept: 19, + Accept: 0, Ignore: "", }, ActionRow{ // S35 @@ -169,11 +169,11 @@ var ActTab = ActionTable{ Ignore: "", }, ActionRow{ // S37 - Accept: 0, + Accept: 19, Ignore: "", }, ActionRow{ // S38 - Accept: 5, + Accept: 19, Ignore: "", }, ActionRow{ // S39 @@ -185,15 +185,15 @@ var ActTab = ActionTable{ Ignore: "", }, ActionRow{ // S41 - Accept: 22, + Accept: 5, Ignore: "", }, ActionRow{ // S42 - Accept: 0, + Accept: 5, Ignore: "", }, ActionRow{ // S43 - Accept: 2, + Accept: 20, Ignore: "", }, ActionRow{ // S44 @@ -213,11 +213,11 @@ var ActTab = ActionTable{ Ignore: "", }, ActionRow{ // S48 - Accept: 0, + Accept: 2, Ignore: "", }, ActionRow{ // S49 - Accept: 6, + Accept: 2, Ignore: "", }, ActionRow{ // S50 @@ -229,11 +229,11 @@ var ActTab = ActionTable{ Ignore: "", }, ActionRow{ // S52 - Accept: 0, + Accept: 6, Ignore: "", }, ActionRow{ // S53 - Accept: 0, + Accept: 6, Ignore: "", }, ActionRow{ // S54 @@ -269,7 +269,7 @@ var ActTab = ActionTable{ Ignore: "", }, ActionRow{ // S62 - Accept: 9, + Accept: 0, Ignore: "", }, ActionRow{ // S63 @@ -277,19 +277,19 @@ var ActTab = ActionTable{ Ignore: "", }, ActionRow{ // S64 - Accept: -1, - Ignore: "!comment", + Accept: 9, + Ignore: "", }, ActionRow{ // S65 Accept: 0, Ignore: "", }, ActionRow{ // S66 - Accept: 19, - Ignore: "", + Accept: -1, + Ignore: "!comment", }, ActionRow{ // S67 - Accept: 5, + Accept: 0, Ignore: "", }, ActionRow{ // S68 @@ -301,11 +301,11 @@ var ActTab = ActionTable{ Ignore: "", }, ActionRow{ // S70 - Accept: 2, + Accept: 0, Ignore: "", }, ActionRow{ // S71 - Accept: 6, + Accept: 0, Ignore: "", }, ActionRow{ // S72 @@ -333,27 +333,27 @@ var ActTab = ActionTable{ Ignore: "", }, ActionRow{ // S78 - Accept: 0, - Ignore: "", + Accept: -1, + Ignore: "!comment", }, ActionRow{ // S79 Accept: 0, Ignore: "", }, ActionRow{ // S80 - Accept: -1, - Ignore: "!comment", + Accept: 2, + Ignore: "", }, ActionRow{ // S81 - Accept: 0, + Accept: 2, Ignore: "", }, ActionRow{ // S82 - Accept: 2, + Accept: 0, Ignore: "", }, ActionRow{ // S83 - Accept: 2, + Accept: 0, Ignore: "", }, ActionRow{ // S84 @@ -381,23 +381,23 @@ var ActTab = ActionTable{ Ignore: "", }, ActionRow{ // S90 - Accept: 0, + Accept: 18, Ignore: "", }, ActionRow{ // S91 - Accept: 0, + Accept: 23, Ignore: "", }, ActionRow{ // S92 - Accept: 18, + Accept: 2, Ignore: "", }, ActionRow{ // S93 - Accept: 21, + Accept: 0, Ignore: "", }, ActionRow{ // S94 - Accept: 20, + Accept: 0, Ignore: "", }, ActionRow{ // S95 @@ -409,7 +409,7 @@ var ActTab = ActionTable{ Ignore: "", }, ActionRow{ // S97 - Accept: 0, + Accept: 21, Ignore: "", }, ActionRow{ // S98 @@ -460,8 +460,4 @@ var ActTab = ActionTable{ Accept: 0, Ignore: "", }, - ActionRow{ // S110 - Accept: 0, - Ignore: "", - }, } diff --git a/internal/frontend_ext/lexer/lexer.go b/internal/fe2/lexer/lexer.go similarity index 80% rename from internal/frontend_ext/lexer/lexer.go rename to internal/fe2/lexer/lexer.go index 785a899c..949214af 100644 --- a/internal/frontend_ext/lexer/lexer.go +++ b/internal/fe2/lexer/lexer.go @@ -6,13 +6,13 @@ import ( "io/ioutil" "unicode/utf8" - "github.com/maxcalandrelli/gocc/internal/frontend/token" + "github.com/maxcalandrelli/gocc/internal/fe2/token" ) const ( NoState = -1 - NumStates = 111 - NumSymbols = 78 + NumStates = 110 + NumSymbols = 76 ) type Position struct { @@ -119,6 +119,14 @@ func (l Lexer) CurrentPosition() Position { return l.Position } +func (l Lexer) Source() []byte { + return l.src +} + +func (l Lexer) Remaining() []byte { + return l.src[l.pos:] +} + func (p Position) Offset() int { return p.pos @@ -152,8 +160,8 @@ Lexer symbols: 9: ';' 10: '|' 11: '.' -12: '~' -13: '-' +12: '-' +13: '~' 14: '(' 15: ')' 16: '[' @@ -166,56 +174,54 @@ Lexer symbols: 23: 'o' 24: 'r' 25: 'e' -26: 'm' -27: 'p' -28: 't' -29: 'y' -30: '/' -31: '/' -32: '\n' +26: \u03bb +27: 'e' +28: 'm' +29: 'p' +30: 't' +31: 'y' +32: \u03b5 33: '/' -34: '*' -35: '*' -36: '*' -37: '/' -38: '_' -39: '0' -40: '9' -41: '\' -42: 'u' -43: '\' -44: 'U' -45: '\' -46: 'a' -47: 'b' -48: 'f' -49: 'n' -50: 'r' -51: 't' -52: 'v' -53: '\' -54: ''' -55: '"' -56: '\' +34: '/' +35: '\n' +36: '/' +37: '*' +38: '*' +39: '*' +40: '/' +41: '_' +42: '\' +43: 'u' +44: '\' +45: 'U' +46: '\' +47: 'a' +48: 'b' +49: 'f' +50: 'n' +51: 'r' +52: 't' +53: 'v' +54: '\' +55: ''' +56: '"' 57: '\' -58: 'x' -59: '`' +58: '\' +59: 'x' 60: '`' -61: '"' +61: '`' 62: '"' -63: ' ' -64: '\t' -65: '\n' -66: '\r' -67: 'a'-'z' -68: 'A'-'Z' -69: '0'-'7' +63: '"' +64: ' ' +65: '\t' +66: '\n' +67: '\r' +68: 'a'-'z' +69: 'A'-'Z' 70: '0'-'9' -71: 'A'-'F' -72: 'a'-'f' -73: '0'-'9' -74: 'A'-'F' -75: 'a'-'z' -76: 'g'-'z' -77: . +71: '0'-'7' +72: '0'-'9' +73: 'A'-'F' +74: 'a'-'f' +75: . */ diff --git a/internal/frontend_ext/lexer/transitiontable.go b/internal/fe2/lexer/transitiontable.go similarity index 87% rename from internal/frontend_ext/lexer/transitiontable.go rename to internal/fe2/lexer/transitiontable.go index 6c25c7e6..1b458438 100644 --- a/internal/frontend_ext/lexer/transitiontable.go +++ b/internal/fe2/lexer/transitiontable.go @@ -67,6 +67,10 @@ var TransTab = TransitionTable{ return 22 case r == 126: // ['~','~'] return 23 + case r == 949: // [\u03b5,\u03b5] + return 24 + case r == 955: // [\u03bb,\u03bb] + return 25 } return NoState }, @@ -80,7 +84,7 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 97 <= r && r <= 122: // ['a','z'] - return 24 + return 26 } return NoState }, @@ -88,20 +92,20 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case r == 34: // ['"','"'] - return 25 + return 27 case r == 92: // ['\','\'] - return 26 + return 28 default: - return 27 + return 29 } }, // S4 func(r rune) int { switch { case r == 92: // ['\','\'] - return 28 + return 30 default: - return 29 + return 31 } }, // S5 @@ -132,9 +136,9 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case r == 42: // ['*','*'] - return 30 + return 32 case r == 47: // ['/','/'] - return 31 + return 33 } return NoState }, @@ -154,21 +158,21 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case r == 60: // ['<','<'] - return 32 + return 34 } return NoState }, // S13 func(r rune) int { switch { - case r == 48: // ['0','0'] - return 33 + case 48 <= r && r <= 57: // ['0','9'] + return 35 case 65 <= r && r <= 90: // ['A','Z'] - return 34 + return 36 case r == 95: // ['_','_'] - return 35 + return 37 case 97 <= r && r <= 122: // ['a','z'] - return 36 + return 38 } return NoState }, @@ -187,14 +191,14 @@ var TransTab = TransitionTable{ // S16 func(r rune) int { switch { - case r == 48: // ['0','0'] - return 37 + case 48 <= r && r <= 57: // ['0','9'] + return 39 case 65 <= r && r <= 90: // ['A','Z'] - return 38 + return 40 case r == 95: // ['_','_'] - return 39 + return 41 case 97 <= r && r <= 122: // ['a','z'] - return 40 + return 42 } return NoState }, @@ -202,7 +206,7 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case r == 96: // ['`','`'] - return 41 + return 43 default: return 17 } @@ -210,36 +214,36 @@ var TransTab = TransitionTable{ // S18 func(r rune) int { switch { - case r == 48: // ['0','0'] - return 42 + case 48 <= r && r <= 57: // ['0','9'] + return 44 case 65 <= r && r <= 90: // ['A','Z'] - return 43 + return 45 case r == 95: // ['_','_'] - return 44 + return 46 case 97 <= r && r <= 122: // ['a','z'] - return 45 + return 47 } return NoState }, // S19 func(r rune) int { switch { - case r == 48: // ['0','0'] - return 42 + case 48 <= r && r <= 57: // ['0','9'] + return 44 case 65 <= r && r <= 90: // ['A','Z'] - return 43 + return 45 case r == 95: // ['_','_'] - return 44 + return 46 case 97 <= r && r <= 108: // ['a','l'] - return 45 + return 47 case r == 109: // ['m','m'] - return 46 + return 48 case 110 <= r && r <= 113: // ['n','q'] - return 45 - case r == 114: // ['r','r'] return 47 + case r == 114: // ['r','r'] + return 49 case 115 <= r && r <= 122: // ['s','z'] - return 45 + return 47 } return NoState }, @@ -270,501 +274,520 @@ var TransTab = TransitionTable{ // S24 func(r rune) int { switch { - case r == 48: // ['0','0'] - return 48 + } + return NoState + }, + // S25 + func(r rune) int { + switch { + } + return NoState + }, + // S26 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 50 case 65 <= r && r <= 90: // ['A','Z'] - return 49 + return 51 case r == 95: // ['_','_'] - return 50 + return 52 case 97 <= r && r <= 122: // ['a','z'] - return 51 + return 53 } return NoState }, - // S25 + // S27 func(r rune) int { switch { } return NoState }, - // S26 + // S28 func(r rune) int { switch { case r == 34: // ['"','"'] - return 52 + return 54 case r == 39: // [''','''] - return 52 + return 54 case 48 <= r && r <= 55: // ['0','7'] - return 53 + return 55 case r == 85: // ['U','U'] - return 54 + return 56 case r == 92: // ['\','\'] - return 52 + return 54 case r == 97: // ['a','a'] - return 52 + return 54 case r == 98: // ['b','b'] - return 52 + return 54 case r == 102: // ['f','f'] - return 52 + return 54 case r == 110: // ['n','n'] - return 52 + return 54 case r == 114: // ['r','r'] - return 52 + return 54 case r == 116: // ['t','t'] - return 52 + return 54 case r == 117: // ['u','u'] - return 55 + return 57 case r == 118: // ['v','v'] - return 52 + return 54 case r == 120: // ['x','x'] - return 56 + return 58 } return NoState }, - // S27 + // S29 func(r rune) int { switch { case r == 34: // ['"','"'] - return 25 + return 27 case r == 92: // ['\','\'] - return 26 + return 28 default: - return 27 + return 29 } }, - // S28 + // S30 func(r rune) int { switch { case r == 34: // ['"','"'] - return 57 + return 59 case r == 39: // [''','''] - return 57 + return 59 case 48 <= r && r <= 55: // ['0','7'] - return 58 + return 60 case r == 85: // ['U','U'] - return 59 + return 61 case r == 92: // ['\','\'] - return 57 + return 59 case r == 97: // ['a','a'] - return 57 + return 59 case r == 98: // ['b','b'] - return 57 + return 59 case r == 102: // ['f','f'] - return 57 + return 59 case r == 110: // ['n','n'] - return 57 + return 59 case r == 114: // ['r','r'] - return 57 + return 59 case r == 116: // ['t','t'] - return 57 + return 59 case r == 117: // ['u','u'] - return 60 + return 62 case r == 118: // ['v','v'] - return 57 + return 59 case r == 120: // ['x','x'] - return 61 - } - return NoState - }, - // S29 - func(r rune) int { - switch { - case r == 39: // [''','''] - return 62 - } - return NoState - }, - // S30 - func(r rune) int { - switch { - case r == 42: // ['*','*'] return 63 - default: - return 30 } + return NoState }, // S31 func(r rune) int { switch { - case r == 10: // ['\n','\n'] + case r == 39: // [''','''] return 64 - default: - return 31 } + return NoState }, // S32 func(r rune) int { switch { - default: + case r == 42: // ['*','*'] return 65 + default: + return 32 } }, // S33 func(r rune) int { switch { - case r == 57: // ['9','9'] + case r == 10: // ['\n','\n'] return 66 + default: + return 33 } - return NoState }, // S34 func(r rune) int { switch { - case r == 48: // ['0','0'] - return 33 - case 65 <= r && r <= 90: // ['A','Z'] - return 34 - case r == 95: // ['_','_'] - return 35 - case 97 <= r && r <= 122: // ['a','z'] - return 36 + default: + return 67 } - return NoState }, // S35 func(r rune) int { switch { - case r == 48: // ['0','0'] - return 33 + case 48 <= r && r <= 57: // ['0','9'] + return 35 case 65 <= r && r <= 90: // ['A','Z'] - return 34 + return 36 case r == 95: // ['_','_'] - return 35 + return 37 case 97 <= r && r <= 122: // ['a','z'] - return 36 + return 38 } return NoState }, // S36 func(r rune) int { switch { - case r == 48: // ['0','0'] - return 33 + case 48 <= r && r <= 57: // ['0','9'] + return 35 case 65 <= r && r <= 90: // ['A','Z'] - return 34 + return 36 case r == 95: // ['_','_'] - return 35 + return 37 case 97 <= r && r <= 122: // ['a','z'] - return 36 + return 38 } return NoState }, // S37 func(r rune) int { switch { - case r == 57: // ['9','9'] - return 67 + case 48 <= r && r <= 57: // ['0','9'] + return 35 + case 65 <= r && r <= 90: // ['A','Z'] + return 36 + case r == 95: // ['_','_'] + return 37 + case 97 <= r && r <= 122: // ['a','z'] + return 38 } return NoState }, // S38 func(r rune) int { switch { - case r == 48: // ['0','0'] - return 37 + case 48 <= r && r <= 57: // ['0','9'] + return 35 case 65 <= r && r <= 90: // ['A','Z'] - return 38 + return 36 case r == 95: // ['_','_'] - return 39 + return 37 case 97 <= r && r <= 122: // ['a','z'] - return 40 + return 38 } return NoState }, // S39 func(r rune) int { switch { - case r == 48: // ['0','0'] - return 37 + case 48 <= r && r <= 57: // ['0','9'] + return 39 case 65 <= r && r <= 90: // ['A','Z'] - return 38 + return 40 case r == 95: // ['_','_'] - return 39 + return 41 case 97 <= r && r <= 122: // ['a','z'] - return 40 + return 42 } return NoState }, // S40 func(r rune) int { switch { - case r == 48: // ['0','0'] - return 37 + case 48 <= r && r <= 57: // ['0','9'] + return 39 case 65 <= r && r <= 90: // ['A','Z'] - return 38 + return 40 case r == 95: // ['_','_'] - return 39 + return 41 case 97 <= r && r <= 122: // ['a','z'] - return 40 + return 42 } return NoState }, // S41 func(r rune) int { switch { + case 48 <= r && r <= 57: // ['0','9'] + return 39 + case 65 <= r && r <= 90: // ['A','Z'] + return 40 + case r == 95: // ['_','_'] + return 41 + case 97 <= r && r <= 122: // ['a','z'] + return 42 } return NoState }, - // S42 - func(r rune) int { - switch { - case r == 57: // ['9','9'] - return 68 - } - return NoState - }, - // S43 + // S42 func(r rune) int { switch { - case r == 48: // ['0','0'] - return 42 + case 48 <= r && r <= 57: // ['0','9'] + return 39 case 65 <= r && r <= 90: // ['A','Z'] - return 43 + return 40 case r == 95: // ['_','_'] - return 44 + return 41 case 97 <= r && r <= 122: // ['a','z'] - return 45 + return 42 + } + return NoState + }, + // S43 + func(r rune) int { + switch { } return NoState }, // S44 func(r rune) int { switch { - case r == 48: // ['0','0'] - return 42 + case 48 <= r && r <= 57: // ['0','9'] + return 44 case 65 <= r && r <= 90: // ['A','Z'] - return 43 + return 45 case r == 95: // ['_','_'] - return 44 + return 46 case 97 <= r && r <= 122: // ['a','z'] - return 45 + return 47 } return NoState }, // S45 func(r rune) int { switch { - case r == 48: // ['0','0'] - return 42 + case 48 <= r && r <= 57: // ['0','9'] + return 44 case 65 <= r && r <= 90: // ['A','Z'] - return 43 + return 45 case r == 95: // ['_','_'] - return 44 + return 46 case 97 <= r && r <= 122: // ['a','z'] - return 45 + return 47 } return NoState }, // S46 func(r rune) int { switch { - case r == 48: // ['0','0'] - return 42 + case 48 <= r && r <= 57: // ['0','9'] + return 44 case 65 <= r && r <= 90: // ['A','Z'] - return 43 + return 45 + case r == 95: // ['_','_'] + return 46 + case 97 <= r && r <= 122: // ['a','z'] + return 47 + } + return NoState + }, + // S47 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 45 case r == 95: // ['_','_'] + return 46 + case 97 <= r && r <= 122: // ['a','z'] + return 47 + } + return NoState + }, + // S48 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] return 44 - case 97 <= r && r <= 111: // ['a','o'] + case 65 <= r && r <= 90: // ['A','Z'] return 45 + case r == 95: // ['_','_'] + return 46 + case 97 <= r && r <= 111: // ['a','o'] + return 47 case r == 112: // ['p','p'] - return 69 + return 68 case 113 <= r && r <= 122: // ['q','z'] - return 45 + return 47 } return NoState }, - // S47 + // S49 func(r rune) int { switch { - case r == 48: // ['0','0'] - return 42 + case 48 <= r && r <= 57: // ['0','9'] + return 44 case 65 <= r && r <= 90: // ['A','Z'] - return 43 + return 45 case r == 95: // ['_','_'] - return 44 + return 46 case 97 <= r && r <= 113: // ['a','q'] - return 45 + return 47 case r == 114: // ['r','r'] - return 70 + return 69 case 115 <= r && r <= 122: // ['s','z'] - return 45 + return 47 } return NoState }, - // S48 + // S50 func(r rune) int { switch { - case r == 57: // ['9','9'] - return 71 + case 48 <= r && r <= 57: // ['0','9'] + return 50 + case 65 <= r && r <= 90: // ['A','Z'] + return 51 + case r == 95: // ['_','_'] + return 52 + case 97 <= r && r <= 122: // ['a','z'] + return 53 } return NoState }, - // S49 + // S51 func(r rune) int { switch { - case r == 48: // ['0','0'] - return 48 + case 48 <= r && r <= 57: // ['0','9'] + return 50 case 65 <= r && r <= 90: // ['A','Z'] - return 49 + return 51 case r == 95: // ['_','_'] - return 50 + return 52 case 97 <= r && r <= 122: // ['a','z'] - return 51 + return 53 } return NoState }, - // S50 + // S52 func(r rune) int { switch { - case r == 48: // ['0','0'] - return 48 + case 48 <= r && r <= 57: // ['0','9'] + return 50 case 65 <= r && r <= 90: // ['A','Z'] - return 49 + return 51 case r == 95: // ['_','_'] - return 50 + return 52 case 97 <= r && r <= 122: // ['a','z'] - return 51 + return 53 } return NoState }, - // S51 + // S53 func(r rune) int { switch { - case r == 48: // ['0','0'] - return 48 + case 48 <= r && r <= 57: // ['0','9'] + return 50 case 65 <= r && r <= 90: // ['A','Z'] - return 49 + return 51 case r == 95: // ['_','_'] - return 50 + return 52 case 97 <= r && r <= 122: // ['a','z'] - return 51 + return 53 } return NoState }, - // S52 + // S54 func(r rune) int { switch { case r == 34: // ['"','"'] - return 25 + return 27 case r == 92: // ['\','\'] - return 26 + return 28 default: - return 27 + return 29 } }, - // S53 + // S55 func(r rune) int { switch { case 48 <= r && r <= 55: // ['0','7'] - return 72 + return 70 } return NoState }, - // S54 + // S56 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 73 + return 71 case 65 <= r && r <= 70: // ['A','F'] - return 73 + return 71 case 97 <= r && r <= 102: // ['a','f'] - return 73 + return 71 } return NoState }, - // S55 + // S57 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 74 + return 72 case 65 <= r && r <= 70: // ['A','F'] - return 74 + return 72 case 97 <= r && r <= 102: // ['a','f'] - return 74 + return 72 } return NoState }, - // S56 + // S58 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 75 + return 73 case 65 <= r && r <= 70: // ['A','F'] - return 75 + return 73 case 97 <= r && r <= 102: // ['a','f'] - return 75 + return 73 } return NoState }, - // S57 + // S59 func(r rune) int { switch { case r == 39: // [''','''] - return 62 + return 64 } return NoState }, - // S58 + // S60 func(r rune) int { switch { case 48 <= r && r <= 55: // ['0','7'] - return 76 + return 74 } return NoState }, - // S59 + // S61 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 77 + return 75 case 65 <= r && r <= 70: // ['A','F'] - return 77 + return 75 case 97 <= r && r <= 102: // ['a','f'] - return 77 + return 75 } return NoState }, - // S60 + // S62 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 78 + return 76 case 65 <= r && r <= 70: // ['A','F'] - return 78 + return 76 case 97 <= r && r <= 102: // ['a','f'] - return 78 + return 76 } return NoState }, - // S61 + // S63 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 79 + return 77 case 65 <= r && r <= 70: // ['A','F'] - return 79 + return 77 case 97 <= r && r <= 102: // ['a','f'] - return 79 - } - return NoState - }, - // S62 - func(r rune) int { - switch { + return 77 } return NoState }, - // S63 - func(r rune) int { - switch { - case r == 42: // ['*','*'] - return 63 - case r == 47: // ['/','/'] - return 80 - default: - return 30 - } - }, // S64 func(r rune) int { switch { @@ -774,108 +797,93 @@ var TransTab = TransitionTable{ // S65 func(r rune) int { switch { - case r == 62: // ['>','>'] - return 81 - default: + case r == 42: // ['*','*'] return 65 + case r == 47: // ['/','/'] + return 78 + default: + return 32 } }, // S66 func(r rune) int { switch { - case r == 48: // ['0','0'] - return 33 - case 65 <= r && r <= 90: // ['A','Z'] - return 34 - case r == 95: // ['_','_'] - return 35 - case 97 <= r && r <= 122: // ['a','z'] - return 36 } return NoState }, // S67 func(r rune) int { switch { - case r == 48: // ['0','0'] - return 37 - case 65 <= r && r <= 90: // ['A','Z'] - return 38 - case r == 95: // ['_','_'] - return 39 - case 97 <= r && r <= 122: // ['a','z'] - return 40 + case r == 62: // ['>','>'] + return 79 + default: + return 67 } - return NoState }, // S68 func(r rune) int { switch { - case r == 48: // ['0','0'] - return 42 - case 65 <= r && r <= 90: // ['A','Z'] - return 43 - case r == 95: // ['_','_'] + case 48 <= r && r <= 57: // ['0','9'] return 44 - case 97 <= r && r <= 122: // ['a','z'] - return 45 - } - return NoState - }, - // S69 - func(r rune) int { - switch { - case r == 48: // ['0','0'] - return 42 case 65 <= r && r <= 90: // ['A','Z'] - return 43 + return 45 case r == 95: // ['_','_'] - return 44 + return 46 case 97 <= r && r <= 115: // ['a','s'] - return 45 + return 47 case r == 116: // ['t','t'] - return 82 + return 80 case 117 <= r && r <= 122: // ['u','z'] - return 45 + return 47 } return NoState }, - // S70 + // S69 func(r rune) int { switch { - case r == 48: // ['0','0'] - return 42 + case 48 <= r && r <= 57: // ['0','9'] + return 44 case 65 <= r && r <= 90: // ['A','Z'] - return 43 + return 45 case r == 95: // ['_','_'] - return 44 + return 46 case 97 <= r && r <= 110: // ['a','n'] - return 45 + return 47 case r == 111: // ['o','o'] - return 83 + return 81 case 112 <= r && r <= 122: // ['p','z'] - return 45 + return 47 + } + return NoState + }, + // S70 + func(r rune) int { + switch { + case 48 <= r && r <= 55: // ['0','7'] + return 82 } return NoState }, // S71 func(r rune) int { switch { - case r == 48: // ['0','0'] - return 48 - case 65 <= r && r <= 90: // ['A','Z'] - return 49 - case r == 95: // ['_','_'] - return 50 - case 97 <= r && r <= 122: // ['a','z'] - return 51 + case 48 <= r && r <= 57: // ['0','9'] + return 83 + case 65 <= r && r <= 70: // ['A','F'] + return 83 + case 97 <= r && r <= 102: // ['a','f'] + return 83 } return NoState }, // S72 func(r rune) int { switch { - case 48 <= r && r <= 55: // ['0','7'] + case 48 <= r && r <= 57: // ['0','9'] + return 84 + case 65 <= r && r <= 70: // ['A','F'] + return 84 + case 97 <= r && r <= 102: // ['a','f'] return 84 } return NoState @@ -895,11 +903,7 @@ var TransTab = TransitionTable{ // S74 func(r rune) int { switch { - case 48 <= r && r <= 57: // ['0','9'] - return 86 - case 65 <= r && r <= 70: // ['A','F'] - return 86 - case 97 <= r && r <= 102: // ['a','f'] + case 48 <= r && r <= 55: // ['0','7'] return 86 } return NoState @@ -919,7 +923,11 @@ var TransTab = TransitionTable{ // S76 func(r rune) int { switch { - case 48 <= r && r <= 55: // ['0','7'] + case 48 <= r && r <= 57: // ['0','9'] + return 88 + case 65 <= r && r <= 70: // ['A','F'] + return 88 + case 97 <= r && r <= 102: // ['a','f'] return 88 } return NoState @@ -939,198 +947,190 @@ var TransTab = TransitionTable{ // S78 func(r rune) int { switch { - case 48 <= r && r <= 57: // ['0','9'] - return 90 - case 65 <= r && r <= 70: // ['A','F'] - return 90 - case 97 <= r && r <= 102: // ['a','f'] - return 90 } return NoState }, // S79 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 91 - case 65 <= r && r <= 70: // ['A','F'] - return 91 - case 97 <= r && r <= 102: // ['a','f'] - return 91 - } - return NoState - }, - // S80 - func(r rune) int { - switch { - } - return NoState - }, - // S81 func(r rune) int { switch { case r == 62: // ['>','>'] - return 92 + return 90 } return NoState }, - // S82 + // S80 func(r rune) int { switch { - case r == 48: // ['0','0'] - return 42 + case 48 <= r && r <= 57: // ['0','9'] + return 44 case 65 <= r && r <= 90: // ['A','Z'] - return 43 + return 45 case r == 95: // ['_','_'] - return 44 + return 46 case 97 <= r && r <= 120: // ['a','x'] - return 45 + return 47 case r == 121: // ['y','y'] - return 93 + return 91 case r == 122: // ['z','z'] - return 45 + return 47 } return NoState }, - // S83 + // S81 func(r rune) int { switch { - case r == 48: // ['0','0'] - return 42 + case 48 <= r && r <= 57: // ['0','9'] + return 44 case 65 <= r && r <= 90: // ['A','Z'] - return 43 + return 45 case r == 95: // ['_','_'] - return 44 + return 46 case 97 <= r && r <= 113: // ['a','q'] - return 45 + return 47 case r == 114: // ['r','r'] - return 94 + return 92 case 115 <= r && r <= 122: // ['s','z'] - return 45 + return 47 } return NoState }, - // S84 + // S82 func(r rune) int { switch { case r == 34: // ['"','"'] - return 25 + return 27 case r == 92: // ['\','\'] - return 26 + return 28 default: - return 27 + return 29 } }, - // S85 + // S83 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 95 + return 93 case 65 <= r && r <= 70: // ['A','F'] - return 95 + return 93 case 97 <= r && r <= 102: // ['a','f'] - return 95 + return 93 } return NoState }, - // S86 + // S84 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 96 + return 94 case 65 <= r && r <= 70: // ['A','F'] - return 96 + return 94 case 97 <= r && r <= 102: // ['a','f'] - return 96 + return 94 } return NoState }, - // S87 + // S85 func(r rune) int { switch { case r == 34: // ['"','"'] - return 25 + return 27 case r == 92: // ['\','\'] - return 26 + return 28 default: - return 27 + return 29 } }, - // S88 + // S86 func(r rune) int { switch { case r == 39: // [''','''] - return 62 + return 64 } return NoState }, - // S89 + // S87 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 97 + return 95 case 65 <= r && r <= 70: // ['A','F'] - return 97 + return 95 case 97 <= r && r <= 102: // ['a','f'] - return 97 + return 95 } return NoState }, - // S90 + // S88 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 98 + return 96 case 65 <= r && r <= 70: // ['A','F'] - return 98 + return 96 case 97 <= r && r <= 102: // ['a','f'] - return 98 + return 96 } return NoState }, - // S91 + // S89 func(r rune) int { switch { case r == 39: // [''','''] - return 62 + return 64 } return NoState }, - // S92 + // S90 func(r rune) int { switch { } return NoState }, - // S93 + // S91 func(r rune) int { switch { - case r == 48: // ['0','0'] - return 42 + case 48 <= r && r <= 57: // ['0','9'] + return 44 case 65 <= r && r <= 90: // ['A','Z'] - return 43 + return 45 case r == 95: // ['_','_'] - return 44 + return 46 case 97 <= r && r <= 122: // ['a','z'] - return 45 + return 47 } return NoState }, - // S94 + // S92 func(r rune) int { switch { - case r == 48: // ['0','0'] - return 42 - case 65 <= r && r <= 90: // ['A','Z'] - return 43 - case r == 95: // ['_','_'] + case 48 <= r && r <= 57: // ['0','9'] return 44 - case 97 <= r && r <= 122: // ['a','z'] + case 65 <= r && r <= 90: // ['A','Z'] return 45 + case r == 95: // ['_','_'] + return 46 + case 97 <= r && r <= 100: // ['a','d'] + return 47 + case r == 101: // ['e','e'] + return 97 + case 102 <= r && r <= 122: // ['f','z'] + return 47 } return NoState }, - // S95 + // S93 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 98 + case 65 <= r && r <= 70: // ['A','F'] + return 98 + case 97 <= r && r <= 102: // ['a','f'] + return 98 + } + return NoState + }, + // S94 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] @@ -1142,7 +1142,7 @@ var TransTab = TransitionTable{ } return NoState }, - // S96 + // S95 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] @@ -1154,7 +1154,7 @@ var TransTab = TransitionTable{ } return NoState }, - // S97 + // S96 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] @@ -1166,6 +1166,20 @@ var TransTab = TransitionTable{ } return NoState }, + // S97 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 45 + case r == 95: // ['_','_'] + return 46 + case 97 <= r && r <= 122: // ['a','z'] + return 47 + } + return NoState + }, // S98 func(r rune) int { switch { @@ -1179,6 +1193,17 @@ var TransTab = TransitionTable{ return NoState }, // S99 + func(r rune) int { + switch { + case r == 34: // ['"','"'] + return 27 + case r == 92: // ['\','\'] + return 28 + default: + return 29 + } + }, + // S100 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] @@ -1190,18 +1215,15 @@ var TransTab = TransitionTable{ } return NoState }, - // S100 + // S101 func(r rune) int { switch { - case r == 34: // ['"','"'] - return 25 - case r == 92: // ['\','\'] - return 26 - default: - return 27 + case r == 39: // [''','''] + return 64 } + return NoState }, - // S101 + // S102 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] @@ -1213,14 +1235,6 @@ var TransTab = TransitionTable{ } return NoState }, - // S102 - func(r rune) int { - switch { - case r == 39: // [''','''] - return 62 - } - return NoState - }, // S103 func(r rune) int { switch { @@ -1282,33 +1296,21 @@ var TransTab = TransitionTable{ return NoState }, // S108 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 110 - case 65 <= r && r <= 70: // ['A','F'] - return 110 - case 97 <= r && r <= 102: // ['a','f'] - return 110 - } - return NoState - }, - // S109 func(r rune) int { switch { case r == 34: // ['"','"'] - return 25 + return 27 case r == 92: // ['\','\'] - return 26 + return 28 default: - return 27 + return 29 } }, - // S110 + // S109 func(r rune) int { switch { case r == 39: // [''','''] - return 62 + return 64 } return NoState }, diff --git a/internal/fe2/lexer_sets.txt b/internal/fe2/lexer_sets.txt new file mode 100644 index 00000000..ca376f8a --- /dev/null +++ b/internal/fe2/lexer_sets.txt @@ -0,0 +1,1875 @@ +Item sets: +S0{ + !comment : _lineComment | • _blockComment + !comment : • _lineComment | _blockComment + !whitespace : ' ' | '\t' | '\n' | • '\r' + !whitespace : ' ' | '\t' | • '\n' | '\r' + !whitespace : ' ' | • '\t' | '\n' | '\r' + !whitespace : • ' ' | '\t' | '\n' | '\r' + tokId : • _tokId + regDefId : • '_' {_id_char} + ignoredTokId : • '!' _tokId + char_lit : • ''' (_unicode_value | _byte_value) ''' + prodId : • _upcase {_id_char} + g_sdt_lit : • '<' '<' . {.} '>' '>' + string_lit : _raw_string | • _interpreted_string + string_lit : • _raw_string | _interpreted_string + : : • ':' + ; : • ';' + | : • '|' + . : • '.' + - : • '-' + ~ : • '~' + ( : • '(' + ) : • ')' + [ : • '[' + ] : • ']' + { : • '{' + } : • '}' + errore : • 'e' 'r' 'r' 'o' 'r' 'e' + λ : • \u03bb + empty : • 'e' 'm' 'p' 't' 'y' + ε : • \u03b5 + _blockComment : • '/' '*' {. | '*'} '*' '/' + _lineComment : • '/' '/' {.} '\n' + _tokId : • _lowcase {_id_char} + _upcase : • 'A'-'Z' + _interpreted_string : • '"' {_unicode_value | _byte_value} '"' + _raw_string : • '`' {.} '`' + _lowcase : • 'a'-'z' +} +Transitions: + ['\t','\t'] -> S1 + ['\n','\n'] -> S1 + ['\r','\r'] -> S1 + [' ',' '] -> S1 + ['!','!'] -> S2 + ['"','"'] -> S3 + [''','''] -> S4 + ['(','('] -> S5 + [')',')'] -> S6 + ['-','-'] -> S7 + ['.','.'] -> S8 + ['/','/'] -> S9 + [':',':'] -> S10 + [';',';'] -> S11 + ['<','<'] -> S12 + ['A','Z'] -> S13 + ['[','['] -> S14 + [']',']'] -> S15 + ['_','_'] -> S16 + ['`','`'] -> S17 + ['a','d'] -> S18 + ['e','e'] -> S19 + ['f','z'] -> S18 + ['{','{'] -> S20 + ['|','|'] -> S21 + ['}','}'] -> S22 + ['~','~'] -> S23 + [\u03b5,\u03b5] -> S24 + [\u03bb,\u03bb] -> S25 +Action: nil +Symbols classes: {['\t','\t'], ['\n','\n'], ['\r','\r'], [' ',' '], ['!','!'], ['"','"'], [''','''], ['(','('], [')',')'], ['-','-'], ['.','.'], ['/','/'], [':',':'], [';',';'], ['<','<'], ['A','Z'], ['[','['], [']',']'], ['_','_'], ['`','`'], ['a','d'], ['e','e'], ['f','z'], ['{','{'], ['|','|'], ['}','}'], ['~','~'], [\u03b5,\u03b5], [\u03bb,\u03bb]} + +S1{ + !whitespace : (' ' | '\t' | '\n' | '\r') • +} +Transitions: +Action: Ignore("!whitespace") +Symbols classes: {} + +S2{ + ignoredTokId : '!' • _tokId + _tokId : • _lowcase {_id_char} + _lowcase : • 'a'-'z' +} +Transitions: + ['a','z'] -> S26 +Action: nil +Symbols classes: {['a','z']} + +S3{ + _interpreted_string : '"' {_unicode_value | _byte_value} • '"' + _interpreted_string : '"' {_unicode_value | • _byte_value} '"' + _interpreted_string : '"' {• _unicode_value | _byte_value} '"' + string_lit : _raw_string | • _interpreted_string + _byte_value : _octal_byte_value | • _hex_byte_value + _byte_value : • _octal_byte_value | _hex_byte_value + _unicode_value : . | _little_u_value | _big_u_value | • _escaped_char + _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char + _unicode_value : . | • _little_u_value | _big_u_value | _escaped_char + _unicode_value : • . | _little_u_value | _big_u_value | _escaped_char + _hex_byte_value : • '\' 'x' _hex_digit _hex_digit + _octal_byte_value : • '\' _octal_digit _octal_digit _octal_digit + _escaped_char : • '\' ('a' | 'b' | 'f' | 'n' | 'r' | 't' | 'v' | '\' | ''' | '"') + _big_u_value : • '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit + _little_u_value : • '\' 'u' _hex_digit _hex_digit _hex_digit _hex_digit +} +Transitions: + ['"','"'] -> S27 + ['\','\'] -> S28 +. -> S29 +Action: nil +Symbols classes: {['"','"'], ['\','\']} + +S4{ + char_lit : ''' (_unicode_value | • _byte_value) ''' + char_lit : ''' (• _unicode_value | _byte_value) ''' + _byte_value : _octal_byte_value | • _hex_byte_value + _byte_value : • _octal_byte_value | _hex_byte_value + _unicode_value : . | _little_u_value | _big_u_value | • _escaped_char + _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char + _unicode_value : . | • _little_u_value | _big_u_value | _escaped_char + _unicode_value : • . | _little_u_value | _big_u_value | _escaped_char + _hex_byte_value : • '\' 'x' _hex_digit _hex_digit + _octal_byte_value : • '\' _octal_digit _octal_digit _octal_digit + _escaped_char : • '\' ('a' | 'b' | 'f' | 'n' | 'r' | 't' | 'v' | '\' | ''' | '"') + _big_u_value : • '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit + _little_u_value : • '\' 'u' _hex_digit _hex_digit _hex_digit _hex_digit +} +Transitions: + ['\','\'] -> S30 +. -> S31 +Action: nil +Symbols classes: {['\','\']} + +S5{ + ( : '(' • +} +Transitions: +Action: Accept("(") +Symbols classes: {} + +S6{ + ) : ')' • +} +Transitions: +Action: Accept(")") +Symbols classes: {} + +S7{ + - : '-' • +} +Transitions: +Action: Accept("-") +Symbols classes: {} + +S8{ + . : '.' • +} +Transitions: +Action: Accept(".") +Symbols classes: {} + +S9{ + _blockComment : '/' • '*' {. | '*'} '*' '/' + _lineComment : '/' • '/' {.} '\n' + !comment : _lineComment | • _blockComment + !comment : • _lineComment | _blockComment +} +Transitions: + ['*','*'] -> S32 + ['/','/'] -> S33 +Action: nil +Symbols classes: {['*','*'], ['/','/']} + +S10{ + : : ':' • +} +Transitions: +Action: Accept(":") +Symbols classes: {} + +S11{ + ; : ';' • +} +Transitions: +Action: Accept(";") +Symbols classes: {} + +S12{ + g_sdt_lit : '<' • '<' . {.} '>' '>' +} +Transitions: + ['<','<'] -> S34 +Action: nil +Symbols classes: {['<','<']} + +S13{ + _upcase : 'A'-'Z' • + prodId : _upcase {_id_char} • + prodId : _upcase {• _id_char} + _id_char : _upcase | _lowcase | '_' | • _digit + _id_char : _upcase | _lowcase | • '_' | _digit + _id_char : _upcase | • _lowcase | '_' | _digit + _id_char : • _upcase | _lowcase | '_' | _digit + _digit : • '0'-'9' + _lowcase : • 'a'-'z' + _upcase : • 'A'-'Z' +} +Transitions: + ['0','9'] -> S35 + ['A','Z'] -> S36 + ['_','_'] -> S37 + ['a','z'] -> S38 +Action: Accept("prodId") +Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} + +S14{ + [ : '[' • +} +Transitions: +Action: Accept("[") +Symbols classes: {} + +S15{ + ] : ']' • +} +Transitions: +Action: Accept("]") +Symbols classes: {} + +S16{ + regDefId : '_' {_id_char} • + regDefId : '_' {• _id_char} + _id_char : _upcase | _lowcase | '_' | • _digit + _id_char : _upcase | _lowcase | • '_' | _digit + _id_char : _upcase | • _lowcase | '_' | _digit + _id_char : • _upcase | _lowcase | '_' | _digit + _digit : • '0'-'9' + _lowcase : • 'a'-'z' + _upcase : • 'A'-'Z' +} +Transitions: + ['0','9'] -> S39 + ['A','Z'] -> S40 + ['_','_'] -> S41 + ['a','z'] -> S42 +Action: Accept("regDefId") +Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} + +S17{ + _raw_string : '`' {.} • '`' + _raw_string : '`' {• .} '`' + string_lit : • _raw_string | _interpreted_string +} +Transitions: + ['`','`'] -> S43 +. -> S17 +Action: nil +Symbols classes: {['`','`']} + +S18{ + _lowcase : 'a'-'z' • + _tokId : _lowcase {_id_char} • + _tokId : _lowcase {• _id_char} + tokId : _tokId • + tokId : • _tokId + _id_char : _upcase | _lowcase | '_' | • _digit + _id_char : _upcase | _lowcase | • '_' | _digit + _id_char : _upcase | • _lowcase | '_' | _digit + _id_char : • _upcase | _lowcase | '_' | _digit + _digit : • '0'-'9' + _lowcase : • 'a'-'z' + _upcase : • 'A'-'Z' +} +Transitions: + ['0','9'] -> S44 + ['A','Z'] -> S45 + ['_','_'] -> S46 + ['a','z'] -> S47 +Action: Accept("tokId") +Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} + +S19{ + errore : 'e' • 'r' 'r' 'o' 'r' 'e' + empty : 'e' • 'm' 'p' 't' 'y' + _lowcase : 'a'-'z' • + _tokId : _lowcase {_id_char} • + _tokId : _lowcase {• _id_char} + tokId : _tokId • + tokId : • _tokId + _id_char : _upcase | _lowcase | '_' | • _digit + _id_char : _upcase | _lowcase | • '_' | _digit + _id_char : _upcase | • _lowcase | '_' | _digit + _id_char : • _upcase | _lowcase | '_' | _digit + _digit : • '0'-'9' + _lowcase : • 'a'-'z' + _upcase : • 'A'-'Z' +} +Transitions: + ['0','9'] -> S44 + ['A','Z'] -> S45 + ['_','_'] -> S46 + ['a','l'] -> S47 + ['m','m'] -> S48 + ['n','q'] -> S47 + ['r','r'] -> S49 + ['s','z'] -> S47 +Action: Accept("tokId") +Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','l'], ['m','m'], ['n','q'], ['r','r'], ['s','z']} + +S20{ + { : '{' • +} +Transitions: +Action: Accept("{") +Symbols classes: {} + +S21{ + | : '|' • +} +Transitions: +Action: Accept("|") +Symbols classes: {} + +S22{ + } : '}' • +} +Transitions: +Action: Accept("}") +Symbols classes: {} + +S23{ + ~ : '~' • +} +Transitions: +Action: Accept("~") +Symbols classes: {} + +S24{ + ε : \u03b5 • +} +Transitions: +Action: Accept("ε") +Symbols classes: {} + +S25{ + λ : \u03bb • +} +Transitions: +Action: Accept("λ") +Symbols classes: {} + +S26{ + _lowcase : 'a'-'z' • + _tokId : _lowcase {_id_char} • + _tokId : _lowcase {• _id_char} + ignoredTokId : '!' _tokId • + ignoredTokId : '!' • _tokId + _id_char : _upcase | _lowcase | '_' | • _digit + _id_char : _upcase | _lowcase | • '_' | _digit + _id_char : _upcase | • _lowcase | '_' | _digit + _id_char : • _upcase | _lowcase | '_' | _digit + _digit : • '0'-'9' + _lowcase : • 'a'-'z' + _upcase : • 'A'-'Z' +} +Transitions: + ['0','9'] -> S50 + ['A','Z'] -> S51 + ['_','_'] -> S52 + ['a','z'] -> S53 +Action: Accept("ignoredTokId") +Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} + +S27{ + _interpreted_string : '"' {_unicode_value | _byte_value} '"' • + string_lit : (_raw_string | _interpreted_string) • +} +Transitions: +Action: Accept("string_lit") +Symbols classes: {} + +S28{ + _hex_byte_value : '\' • 'x' _hex_digit _hex_digit + _octal_byte_value : '\' • _octal_digit _octal_digit _octal_digit + _escaped_char : '\' ('a' | 'b' | 'f' | 'n' | 'r' | 't' | 'v' | '\' | ''' | • '"') + _escaped_char : '\' ('a' | 'b' | 'f' | 'n' | 'r' | 't' | 'v' | '\' | • ''' | '"') + _escaped_char : '\' ('a' | 'b' | 'f' | 'n' | 'r' | 't' | 'v' | • '\' | ''' | '"') + _escaped_char : '\' ('a' | 'b' | 'f' | 'n' | 'r' | 't' | • 'v' | '\' | ''' | '"') + _escaped_char : '\' ('a' | 'b' | 'f' | 'n' | 'r' | • 't' | 'v' | '\' | ''' | '"') + _escaped_char : '\' ('a' | 'b' | 'f' | 'n' | • 'r' | 't' | 'v' | '\' | ''' | '"') + _escaped_char : '\' ('a' | 'b' | 'f' | • 'n' | 'r' | 't' | 'v' | '\' | ''' | '"') + _escaped_char : '\' ('a' | 'b' | • 'f' | 'n' | 'r' | 't' | 'v' | '\' | ''' | '"') + _escaped_char : '\' ('a' | • 'b' | 'f' | 'n' | 'r' | 't' | 'v' | '\' | ''' | '"') + _escaped_char : '\' (• 'a' | 'b' | 'f' | 'n' | 'r' | 't' | 'v' | '\' | ''' | '"') + _big_u_value : '\' • 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit + _little_u_value : '\' • 'u' _hex_digit _hex_digit _hex_digit _hex_digit + _byte_value : _octal_byte_value | • _hex_byte_value + _byte_value : • _octal_byte_value | _hex_byte_value + _unicode_value : . | _little_u_value | _big_u_value | • _escaped_char + _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char + _unicode_value : . | • _little_u_value | _big_u_value | _escaped_char + _interpreted_string : '"' {_unicode_value | • _byte_value} '"' + _interpreted_string : '"' {• _unicode_value | _byte_value} '"' + string_lit : _raw_string | • _interpreted_string + _octal_digit : • '0'-'7' +} +Transitions: + ['"','"'] -> S54 + [''','''] -> S54 + ['0','7'] -> S55 + ['U','U'] -> S56 + ['\','\'] -> S54 + ['a','a'] -> S54 + ['b','b'] -> S54 + ['f','f'] -> S54 + ['n','n'] -> S54 + ['r','r'] -> S54 + ['t','t'] -> S54 + ['u','u'] -> S57 + ['v','v'] -> S54 + ['x','x'] -> S58 +Action: nil +Symbols classes: {['"','"'], [''','''], ['0','7'], ['U','U'], ['\','\'], ['a','a'], ['b','b'], ['f','f'], ['n','n'], ['r','r'], ['t','t'], ['u','u'], ['v','v'], ['x','x']} + +S29{ + _unicode_value : (. | _little_u_value | _big_u_value | _escaped_char) • + _interpreted_string : '"' {_unicode_value | _byte_value} • '"' + _interpreted_string : '"' {_unicode_value | • _byte_value} '"' + _interpreted_string : '"' {• _unicode_value | _byte_value} '"' + string_lit : _raw_string | • _interpreted_string + _byte_value : _octal_byte_value | • _hex_byte_value + _byte_value : • _octal_byte_value | _hex_byte_value + _unicode_value : . | _little_u_value | _big_u_value | • _escaped_char + _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char + _unicode_value : . | • _little_u_value | _big_u_value | _escaped_char + _unicode_value : • . | _little_u_value | _big_u_value | _escaped_char + _hex_byte_value : • '\' 'x' _hex_digit _hex_digit + _octal_byte_value : • '\' _octal_digit _octal_digit _octal_digit + _escaped_char : • '\' ('a' | 'b' | 'f' | 'n' | 'r' | 't' | 'v' | '\' | ''' | '"') + _big_u_value : • '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit + _little_u_value : • '\' 'u' _hex_digit _hex_digit _hex_digit _hex_digit +} +Transitions: + ['"','"'] -> S27 + ['\','\'] -> S28 +. -> S29 +Action: nil +Symbols classes: {['"','"'], ['\','\']} + +S30{ + _hex_byte_value : '\' • 'x' _hex_digit _hex_digit + _octal_byte_value : '\' • _octal_digit _octal_digit _octal_digit + _escaped_char : '\' ('a' | 'b' | 'f' | 'n' | 'r' | 't' | 'v' | '\' | ''' | • '"') + _escaped_char : '\' ('a' | 'b' | 'f' | 'n' | 'r' | 't' | 'v' | '\' | • ''' | '"') + _escaped_char : '\' ('a' | 'b' | 'f' | 'n' | 'r' | 't' | 'v' | • '\' | ''' | '"') + _escaped_char : '\' ('a' | 'b' | 'f' | 'n' | 'r' | 't' | • 'v' | '\' | ''' | '"') + _escaped_char : '\' ('a' | 'b' | 'f' | 'n' | 'r' | • 't' | 'v' | '\' | ''' | '"') + _escaped_char : '\' ('a' | 'b' | 'f' | 'n' | • 'r' | 't' | 'v' | '\' | ''' | '"') + _escaped_char : '\' ('a' | 'b' | 'f' | • 'n' | 'r' | 't' | 'v' | '\' | ''' | '"') + _escaped_char : '\' ('a' | 'b' | • 'f' | 'n' | 'r' | 't' | 'v' | '\' | ''' | '"') + _escaped_char : '\' ('a' | • 'b' | 'f' | 'n' | 'r' | 't' | 'v' | '\' | ''' | '"') + _escaped_char : '\' (• 'a' | 'b' | 'f' | 'n' | 'r' | 't' | 'v' | '\' | ''' | '"') + _big_u_value : '\' • 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit + _little_u_value : '\' • 'u' _hex_digit _hex_digit _hex_digit _hex_digit + _byte_value : _octal_byte_value | • _hex_byte_value + _byte_value : • _octal_byte_value | _hex_byte_value + _unicode_value : . | _little_u_value | _big_u_value | • _escaped_char + _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char + _unicode_value : . | • _little_u_value | _big_u_value | _escaped_char + char_lit : ''' (_unicode_value | • _byte_value) ''' + char_lit : ''' (• _unicode_value | _byte_value) ''' + _octal_digit : • '0'-'7' +} +Transitions: + ['"','"'] -> S59 + [''','''] -> S59 + ['0','7'] -> S60 + ['U','U'] -> S61 + ['\','\'] -> S59 + ['a','a'] -> S59 + ['b','b'] -> S59 + ['f','f'] -> S59 + ['n','n'] -> S59 + ['r','r'] -> S59 + ['t','t'] -> S59 + ['u','u'] -> S62 + ['v','v'] -> S59 + ['x','x'] -> S63 +Action: nil +Symbols classes: {['"','"'], [''','''], ['0','7'], ['U','U'], ['\','\'], ['a','a'], ['b','b'], ['f','f'], ['n','n'], ['r','r'], ['t','t'], ['u','u'], ['v','v'], ['x','x']} + +S31{ + _unicode_value : (. | _little_u_value | _big_u_value | _escaped_char) • + char_lit : ''' (_unicode_value | _byte_value) • ''' +} +Transitions: + [''','''] -> S64 +Action: nil +Symbols classes: {[''',''']} + +S32{ + _blockComment : '/' '*' {. | '*'} • '*' '/' + _blockComment : '/' '*' {. | • '*'} '*' '/' + _blockComment : '/' '*' {• . | '*'} '*' '/' + !comment : _lineComment | • _blockComment +} +Transitions: + ['*','*'] -> S65 +. -> S32 +Action: nil +Symbols classes: {['*','*']} + +S33{ + _lineComment : '/' '/' {.} • '\n' + _lineComment : '/' '/' {• .} '\n' + !comment : • _lineComment | _blockComment +} +Transitions: + ['\n','\n'] -> S66 +. -> S33 +Action: nil +Symbols classes: {['\n','\n']} + +S34{ + g_sdt_lit : '<' '<' • . {.} '>' '>' +} +Transitions: +. -> S67 +Action: nil +Symbols classes: {} + +S35{ + _digit : '0'-'9' • + _id_char : (_upcase | _lowcase | '_' | _digit) • + prodId : _upcase {_id_char} • + prodId : _upcase {• _id_char} + _id_char : _upcase | _lowcase | '_' | • _digit + _id_char : _upcase | _lowcase | • '_' | _digit + _id_char : _upcase | • _lowcase | '_' | _digit + _id_char : • _upcase | _lowcase | '_' | _digit + _digit : • '0'-'9' + _lowcase : • 'a'-'z' + _upcase : • 'A'-'Z' +} +Transitions: + ['0','9'] -> S35 + ['A','Z'] -> S36 + ['_','_'] -> S37 + ['a','z'] -> S38 +Action: Accept("prodId") +Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} + +S36{ + _upcase : 'A'-'Z' • + _id_char : (_upcase | _lowcase | '_' | _digit) • + prodId : _upcase {_id_char} • + prodId : _upcase {• _id_char} + _id_char : _upcase | _lowcase | '_' | • _digit + _id_char : _upcase | _lowcase | • '_' | _digit + _id_char : _upcase | • _lowcase | '_' | _digit + _id_char : • _upcase | _lowcase | '_' | _digit + _digit : • '0'-'9' + _lowcase : • 'a'-'z' + _upcase : • 'A'-'Z' +} +Transitions: + ['0','9'] -> S35 + ['A','Z'] -> S36 + ['_','_'] -> S37 + ['a','z'] -> S38 +Action: Accept("prodId") +Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} + +S37{ + _id_char : (_upcase | _lowcase | '_' | _digit) • + prodId : _upcase {_id_char} • + prodId : _upcase {• _id_char} + _id_char : _upcase | _lowcase | '_' | • _digit + _id_char : _upcase | _lowcase | • '_' | _digit + _id_char : _upcase | • _lowcase | '_' | _digit + _id_char : • _upcase | _lowcase | '_' | _digit + _digit : • '0'-'9' + _lowcase : • 'a'-'z' + _upcase : • 'A'-'Z' +} +Transitions: + ['0','9'] -> S35 + ['A','Z'] -> S36 + ['_','_'] -> S37 + ['a','z'] -> S38 +Action: Accept("prodId") +Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} + +S38{ + _lowcase : 'a'-'z' • + _id_char : (_upcase | _lowcase | '_' | _digit) • + prodId : _upcase {_id_char} • + prodId : _upcase {• _id_char} + _id_char : _upcase | _lowcase | '_' | • _digit + _id_char : _upcase | _lowcase | • '_' | _digit + _id_char : _upcase | • _lowcase | '_' | _digit + _id_char : • _upcase | _lowcase | '_' | _digit + _digit : • '0'-'9' + _lowcase : • 'a'-'z' + _upcase : • 'A'-'Z' +} +Transitions: + ['0','9'] -> S35 + ['A','Z'] -> S36 + ['_','_'] -> S37 + ['a','z'] -> S38 +Action: Accept("prodId") +Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} + +S39{ + _digit : '0'-'9' • + _id_char : (_upcase | _lowcase | '_' | _digit) • + regDefId : '_' {_id_char} • + regDefId : '_' {• _id_char} + _id_char : _upcase | _lowcase | '_' | • _digit + _id_char : _upcase | _lowcase | • '_' | _digit + _id_char : _upcase | • _lowcase | '_' | _digit + _id_char : • _upcase | _lowcase | '_' | _digit + _digit : • '0'-'9' + _lowcase : • 'a'-'z' + _upcase : • 'A'-'Z' +} +Transitions: + ['0','9'] -> S39 + ['A','Z'] -> S40 + ['_','_'] -> S41 + ['a','z'] -> S42 +Action: Accept("regDefId") +Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} + +S40{ + _upcase : 'A'-'Z' • + _id_char : (_upcase | _lowcase | '_' | _digit) • + regDefId : '_' {_id_char} • + regDefId : '_' {• _id_char} + _id_char : _upcase | _lowcase | '_' | • _digit + _id_char : _upcase | _lowcase | • '_' | _digit + _id_char : _upcase | • _lowcase | '_' | _digit + _id_char : • _upcase | _lowcase | '_' | _digit + _digit : • '0'-'9' + _lowcase : • 'a'-'z' + _upcase : • 'A'-'Z' +} +Transitions: + ['0','9'] -> S39 + ['A','Z'] -> S40 + ['_','_'] -> S41 + ['a','z'] -> S42 +Action: Accept("regDefId") +Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} + +S41{ + _id_char : (_upcase | _lowcase | '_' | _digit) • + regDefId : '_' {_id_char} • + regDefId : '_' {• _id_char} + _id_char : _upcase | _lowcase | '_' | • _digit + _id_char : _upcase | _lowcase | • '_' | _digit + _id_char : _upcase | • _lowcase | '_' | _digit + _id_char : • _upcase | _lowcase | '_' | _digit + _digit : • '0'-'9' + _lowcase : • 'a'-'z' + _upcase : • 'A'-'Z' +} +Transitions: + ['0','9'] -> S39 + ['A','Z'] -> S40 + ['_','_'] -> S41 + ['a','z'] -> S42 +Action: Accept("regDefId") +Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} + +S42{ + _lowcase : 'a'-'z' • + _id_char : (_upcase | _lowcase | '_' | _digit) • + regDefId : '_' {_id_char} • + regDefId : '_' {• _id_char} + _id_char : _upcase | _lowcase | '_' | • _digit + _id_char : _upcase | _lowcase | • '_' | _digit + _id_char : _upcase | • _lowcase | '_' | _digit + _id_char : • _upcase | _lowcase | '_' | _digit + _digit : • '0'-'9' + _lowcase : • 'a'-'z' + _upcase : • 'A'-'Z' +} +Transitions: + ['0','9'] -> S39 + ['A','Z'] -> S40 + ['_','_'] -> S41 + ['a','z'] -> S42 +Action: Accept("regDefId") +Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} + +S43{ + _raw_string : '`' {.} '`' • + string_lit : (_raw_string | _interpreted_string) • +} +Transitions: +Action: Accept("string_lit") +Symbols classes: {} + +S44{ + _digit : '0'-'9' • + _id_char : (_upcase | _lowcase | '_' | _digit) • + _tokId : _lowcase {_id_char} • + _tokId : _lowcase {• _id_char} + tokId : _tokId • + tokId : • _tokId + _id_char : _upcase | _lowcase | '_' | • _digit + _id_char : _upcase | _lowcase | • '_' | _digit + _id_char : _upcase | • _lowcase | '_' | _digit + _id_char : • _upcase | _lowcase | '_' | _digit + _digit : • '0'-'9' + _lowcase : • 'a'-'z' + _upcase : • 'A'-'Z' +} +Transitions: + ['0','9'] -> S44 + ['A','Z'] -> S45 + ['_','_'] -> S46 + ['a','z'] -> S47 +Action: Accept("tokId") +Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} + +S45{ + _upcase : 'A'-'Z' • + _id_char : (_upcase | _lowcase | '_' | _digit) • + _tokId : _lowcase {_id_char} • + _tokId : _lowcase {• _id_char} + tokId : _tokId • + tokId : • _tokId + _id_char : _upcase | _lowcase | '_' | • _digit + _id_char : _upcase | _lowcase | • '_' | _digit + _id_char : _upcase | • _lowcase | '_' | _digit + _id_char : • _upcase | _lowcase | '_' | _digit + _digit : • '0'-'9' + _lowcase : • 'a'-'z' + _upcase : • 'A'-'Z' +} +Transitions: + ['0','9'] -> S44 + ['A','Z'] -> S45 + ['_','_'] -> S46 + ['a','z'] -> S47 +Action: Accept("tokId") +Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} + +S46{ + _id_char : (_upcase | _lowcase | '_' | _digit) • + _tokId : _lowcase {_id_char} • + _tokId : _lowcase {• _id_char} + tokId : _tokId • + tokId : • _tokId + _id_char : _upcase | _lowcase | '_' | • _digit + _id_char : _upcase | _lowcase | • '_' | _digit + _id_char : _upcase | • _lowcase | '_' | _digit + _id_char : • _upcase | _lowcase | '_' | _digit + _digit : • '0'-'9' + _lowcase : • 'a'-'z' + _upcase : • 'A'-'Z' +} +Transitions: + ['0','9'] -> S44 + ['A','Z'] -> S45 + ['_','_'] -> S46 + ['a','z'] -> S47 +Action: Accept("tokId") +Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} + +S47{ + _lowcase : 'a'-'z' • + _id_char : (_upcase | _lowcase | '_' | _digit) • + _tokId : _lowcase {_id_char} • + _tokId : _lowcase {• _id_char} + tokId : _tokId • + tokId : • _tokId + _id_char : _upcase | _lowcase | '_' | • _digit + _id_char : _upcase | _lowcase | • '_' | _digit + _id_char : _upcase | • _lowcase | '_' | _digit + _id_char : • _upcase | _lowcase | '_' | _digit + _digit : • '0'-'9' + _lowcase : • 'a'-'z' + _upcase : • 'A'-'Z' +} +Transitions: + ['0','9'] -> S44 + ['A','Z'] -> S45 + ['_','_'] -> S46 + ['a','z'] -> S47 +Action: Accept("tokId") +Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} + +S48{ + empty : 'e' 'm' • 'p' 't' 'y' + _lowcase : 'a'-'z' • + _id_char : (_upcase | _lowcase | '_' | _digit) • + _tokId : _lowcase {_id_char} • + _tokId : _lowcase {• _id_char} + tokId : _tokId • + tokId : • _tokId + _id_char : _upcase | _lowcase | '_' | • _digit + _id_char : _upcase | _lowcase | • '_' | _digit + _id_char : _upcase | • _lowcase | '_' | _digit + _id_char : • _upcase | _lowcase | '_' | _digit + _digit : • '0'-'9' + _lowcase : • 'a'-'z' + _upcase : • 'A'-'Z' +} +Transitions: + ['0','9'] -> S44 + ['A','Z'] -> S45 + ['_','_'] -> S46 + ['a','o'] -> S47 + ['p','p'] -> S68 + ['q','z'] -> S47 +Action: Accept("tokId") +Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','o'], ['p','p'], ['q','z']} + +S49{ + errore : 'e' 'r' • 'r' 'o' 'r' 'e' + _lowcase : 'a'-'z' • + _id_char : (_upcase | _lowcase | '_' | _digit) • + _tokId : _lowcase {_id_char} • + _tokId : _lowcase {• _id_char} + tokId : _tokId • + tokId : • _tokId + _id_char : _upcase | _lowcase | '_' | • _digit + _id_char : _upcase | _lowcase | • '_' | _digit + _id_char : _upcase | • _lowcase | '_' | _digit + _id_char : • _upcase | _lowcase | '_' | _digit + _digit : • '0'-'9' + _lowcase : • 'a'-'z' + _upcase : • 'A'-'Z' +} +Transitions: + ['0','9'] -> S44 + ['A','Z'] -> S45 + ['_','_'] -> S46 + ['a','q'] -> S47 + ['r','r'] -> S69 + ['s','z'] -> S47 +Action: Accept("tokId") +Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','q'], ['r','r'], ['s','z']} + +S50{ + _digit : '0'-'9' • + _id_char : (_upcase | _lowcase | '_' | _digit) • + _tokId : _lowcase {_id_char} • + _tokId : _lowcase {• _id_char} + ignoredTokId : '!' _tokId • + ignoredTokId : '!' • _tokId + _id_char : _upcase | _lowcase | '_' | • _digit + _id_char : _upcase | _lowcase | • '_' | _digit + _id_char : _upcase | • _lowcase | '_' | _digit + _id_char : • _upcase | _lowcase | '_' | _digit + _digit : • '0'-'9' + _lowcase : • 'a'-'z' + _upcase : • 'A'-'Z' +} +Transitions: + ['0','9'] -> S50 + ['A','Z'] -> S51 + ['_','_'] -> S52 + ['a','z'] -> S53 +Action: Accept("ignoredTokId") +Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} + +S51{ + _upcase : 'A'-'Z' • + _id_char : (_upcase | _lowcase | '_' | _digit) • + _tokId : _lowcase {_id_char} • + _tokId : _lowcase {• _id_char} + ignoredTokId : '!' _tokId • + ignoredTokId : '!' • _tokId + _id_char : _upcase | _lowcase | '_' | • _digit + _id_char : _upcase | _lowcase | • '_' | _digit + _id_char : _upcase | • _lowcase | '_' | _digit + _id_char : • _upcase | _lowcase | '_' | _digit + _digit : • '0'-'9' + _lowcase : • 'a'-'z' + _upcase : • 'A'-'Z' +} +Transitions: + ['0','9'] -> S50 + ['A','Z'] -> S51 + ['_','_'] -> S52 + ['a','z'] -> S53 +Action: Accept("ignoredTokId") +Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} + +S52{ + _id_char : (_upcase | _lowcase | '_' | _digit) • + _tokId : _lowcase {_id_char} • + _tokId : _lowcase {• _id_char} + ignoredTokId : '!' _tokId • + ignoredTokId : '!' • _tokId + _id_char : _upcase | _lowcase | '_' | • _digit + _id_char : _upcase | _lowcase | • '_' | _digit + _id_char : _upcase | • _lowcase | '_' | _digit + _id_char : • _upcase | _lowcase | '_' | _digit + _digit : • '0'-'9' + _lowcase : • 'a'-'z' + _upcase : • 'A'-'Z' +} +Transitions: + ['0','9'] -> S50 + ['A','Z'] -> S51 + ['_','_'] -> S52 + ['a','z'] -> S53 +Action: Accept("ignoredTokId") +Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} + +S53{ + _lowcase : 'a'-'z' • + _id_char : (_upcase | _lowcase | '_' | _digit) • + _tokId : _lowcase {_id_char} • + _tokId : _lowcase {• _id_char} + ignoredTokId : '!' _tokId • + ignoredTokId : '!' • _tokId + _id_char : _upcase | _lowcase | '_' | • _digit + _id_char : _upcase | _lowcase | • '_' | _digit + _id_char : _upcase | • _lowcase | '_' | _digit + _id_char : • _upcase | _lowcase | '_' | _digit + _digit : • '0'-'9' + _lowcase : • 'a'-'z' + _upcase : • 'A'-'Z' +} +Transitions: + ['0','9'] -> S50 + ['A','Z'] -> S51 + ['_','_'] -> S52 + ['a','z'] -> S53 +Action: Accept("ignoredTokId") +Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} + +S54{ + _escaped_char : '\' ('a' | 'b' | 'f' | 'n' | 'r' | 't' | 'v' | '\' | ''' | '"') • + _unicode_value : (. | _little_u_value | _big_u_value | _escaped_char) • + _interpreted_string : '"' {_unicode_value | _byte_value} • '"' + _interpreted_string : '"' {_unicode_value | • _byte_value} '"' + _interpreted_string : '"' {• _unicode_value | _byte_value} '"' + string_lit : _raw_string | • _interpreted_string + _byte_value : _octal_byte_value | • _hex_byte_value + _byte_value : • _octal_byte_value | _hex_byte_value + _unicode_value : . | _little_u_value | _big_u_value | • _escaped_char + _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char + _unicode_value : . | • _little_u_value | _big_u_value | _escaped_char + _unicode_value : • . | _little_u_value | _big_u_value | _escaped_char + _hex_byte_value : • '\' 'x' _hex_digit _hex_digit + _octal_byte_value : • '\' _octal_digit _octal_digit _octal_digit + _escaped_char : • '\' ('a' | 'b' | 'f' | 'n' | 'r' | 't' | 'v' | '\' | ''' | '"') + _big_u_value : • '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit + _little_u_value : • '\' 'u' _hex_digit _hex_digit _hex_digit _hex_digit +} +Transitions: + ['"','"'] -> S27 + ['\','\'] -> S28 +. -> S29 +Action: nil +Symbols classes: {['"','"'], ['\','\']} + +S55{ + _octal_digit : '0'-'7' • + _octal_byte_value : '\' _octal_digit • _octal_digit _octal_digit + _byte_value : • _octal_byte_value | _hex_byte_value + _interpreted_string : '"' {_unicode_value | • _byte_value} '"' + string_lit : _raw_string | • _interpreted_string + _octal_digit : • '0'-'7' +} +Transitions: + ['0','7'] -> S70 +Action: nil +Symbols classes: {['0','7']} + +S56{ + _big_u_value : '\' 'U' • _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit + _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char + _interpreted_string : '"' {• _unicode_value | _byte_value} '"' + string_lit : _raw_string | • _interpreted_string + _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' + _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' + _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' +} +Transitions: + ['0','9'] -> S71 + ['A','F'] -> S71 + ['a','f'] -> S71 +Action: nil +Symbols classes: {['0','9'], ['A','F'], ['a','f']} + +S57{ + _little_u_value : '\' 'u' • _hex_digit _hex_digit _hex_digit _hex_digit + _unicode_value : . | • _little_u_value | _big_u_value | _escaped_char + _interpreted_string : '"' {• _unicode_value | _byte_value} '"' + string_lit : _raw_string | • _interpreted_string + _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' + _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' + _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' +} +Transitions: + ['0','9'] -> S72 + ['A','F'] -> S72 + ['a','f'] -> S72 +Action: nil +Symbols classes: {['0','9'], ['A','F'], ['a','f']} + +S58{ + _hex_byte_value : '\' 'x' • _hex_digit _hex_digit + _byte_value : _octal_byte_value | • _hex_byte_value + _interpreted_string : '"' {_unicode_value | • _byte_value} '"' + string_lit : _raw_string | • _interpreted_string + _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' + _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' + _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' +} +Transitions: + ['0','9'] -> S73 + ['A','F'] -> S73 + ['a','f'] -> S73 +Action: nil +Symbols classes: {['0','9'], ['A','F'], ['a','f']} + +S59{ + _escaped_char : '\' ('a' | 'b' | 'f' | 'n' | 'r' | 't' | 'v' | '\' | ''' | '"') • + _unicode_value : (. | _little_u_value | _big_u_value | _escaped_char) • + char_lit : ''' (_unicode_value | _byte_value) • ''' +} +Transitions: + [''','''] -> S64 +Action: nil +Symbols classes: {[''',''']} + +S60{ + _octal_digit : '0'-'7' • + _octal_byte_value : '\' _octal_digit • _octal_digit _octal_digit + _byte_value : • _octal_byte_value | _hex_byte_value + char_lit : ''' (_unicode_value | • _byte_value) ''' + _octal_digit : • '0'-'7' +} +Transitions: + ['0','7'] -> S74 +Action: nil +Symbols classes: {['0','7']} + +S61{ + _big_u_value : '\' 'U' • _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit + _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char + char_lit : ''' (• _unicode_value | _byte_value) ''' + _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' + _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' + _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' +} +Transitions: + ['0','9'] -> S75 + ['A','F'] -> S75 + ['a','f'] -> S75 +Action: nil +Symbols classes: {['0','9'], ['A','F'], ['a','f']} + +S62{ + _little_u_value : '\' 'u' • _hex_digit _hex_digit _hex_digit _hex_digit + _unicode_value : . | • _little_u_value | _big_u_value | _escaped_char + char_lit : ''' (• _unicode_value | _byte_value) ''' + _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' + _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' + _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' +} +Transitions: + ['0','9'] -> S76 + ['A','F'] -> S76 + ['a','f'] -> S76 +Action: nil +Symbols classes: {['0','9'], ['A','F'], ['a','f']} + +S63{ + _hex_byte_value : '\' 'x' • _hex_digit _hex_digit + _byte_value : _octal_byte_value | • _hex_byte_value + char_lit : ''' (_unicode_value | • _byte_value) ''' + _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' + _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' + _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' +} +Transitions: + ['0','9'] -> S77 + ['A','F'] -> S77 + ['a','f'] -> S77 +Action: nil +Symbols classes: {['0','9'], ['A','F'], ['a','f']} + +S64{ + char_lit : ''' (_unicode_value | _byte_value) ''' • +} +Transitions: +Action: Accept("char_lit") +Symbols classes: {} + +S65{ + _blockComment : '/' '*' {. | '*'} '*' • '/' + _blockComment : '/' '*' {. | '*'} • '*' '/' + _blockComment : '/' '*' {. | • '*'} '*' '/' + _blockComment : '/' '*' {• . | '*'} '*' '/' + !comment : _lineComment | • _blockComment +} +Transitions: + ['*','*'] -> S65 + ['/','/'] -> S78 +. -> S32 +Action: nil +Symbols classes: {['*','*'], ['/','/']} + +S66{ + _lineComment : '/' '/' {.} '\n' • + !comment : (_lineComment | _blockComment) • +} +Transitions: +Action: Ignore("!comment") +Symbols classes: {} + +S67{ + g_sdt_lit : '<' '<' . {.} • '>' '>' + g_sdt_lit : '<' '<' . {• .} '>' '>' +} +Transitions: + ['>','>'] -> S79 +. -> S67 +Action: nil +Symbols classes: {['>','>']} + +S68{ + empty : 'e' 'm' 'p' • 't' 'y' + _lowcase : 'a'-'z' • + _id_char : (_upcase | _lowcase | '_' | _digit) • + _tokId : _lowcase {_id_char} • + _tokId : _lowcase {• _id_char} + tokId : _tokId • + tokId : • _tokId + _id_char : _upcase | _lowcase | '_' | • _digit + _id_char : _upcase | _lowcase | • '_' | _digit + _id_char : _upcase | • _lowcase | '_' | _digit + _id_char : • _upcase | _lowcase | '_' | _digit + _digit : • '0'-'9' + _lowcase : • 'a'-'z' + _upcase : • 'A'-'Z' +} +Transitions: + ['0','9'] -> S44 + ['A','Z'] -> S45 + ['_','_'] -> S46 + ['a','s'] -> S47 + ['t','t'] -> S80 + ['u','z'] -> S47 +Action: Accept("tokId") +Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','s'], ['t','t'], ['u','z']} + +S69{ + errore : 'e' 'r' 'r' • 'o' 'r' 'e' + _lowcase : 'a'-'z' • + _id_char : (_upcase | _lowcase | '_' | _digit) • + _tokId : _lowcase {_id_char} • + _tokId : _lowcase {• _id_char} + tokId : _tokId • + tokId : • _tokId + _id_char : _upcase | _lowcase | '_' | • _digit + _id_char : _upcase | _lowcase | • '_' | _digit + _id_char : _upcase | • _lowcase | '_' | _digit + _id_char : • _upcase | _lowcase | '_' | _digit + _digit : • '0'-'9' + _lowcase : • 'a'-'z' + _upcase : • 'A'-'Z' +} +Transitions: + ['0','9'] -> S44 + ['A','Z'] -> S45 + ['_','_'] -> S46 + ['a','n'] -> S47 + ['o','o'] -> S81 + ['p','z'] -> S47 +Action: Accept("tokId") +Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','n'], ['o','o'], ['p','z']} + +S70{ + _octal_digit : '0'-'7' • + _octal_byte_value : '\' _octal_digit _octal_digit • _octal_digit + _byte_value : • _octal_byte_value | _hex_byte_value + _interpreted_string : '"' {_unicode_value | • _byte_value} '"' + string_lit : _raw_string | • _interpreted_string + _octal_digit : • '0'-'7' +} +Transitions: + ['0','7'] -> S82 +Action: nil +Symbols classes: {['0','7']} + +S71{ + _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • + _big_u_value : '\' 'U' _hex_digit • _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit + _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char + _interpreted_string : '"' {• _unicode_value | _byte_value} '"' + string_lit : _raw_string | • _interpreted_string + _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' + _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' + _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' +} +Transitions: + ['0','9'] -> S83 + ['A','F'] -> S83 + ['a','f'] -> S83 +Action: nil +Symbols classes: {['0','9'], ['A','F'], ['a','f']} + +S72{ + _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • + _little_u_value : '\' 'u' _hex_digit • _hex_digit _hex_digit _hex_digit + _unicode_value : . | • _little_u_value | _big_u_value | _escaped_char + _interpreted_string : '"' {• _unicode_value | _byte_value} '"' + string_lit : _raw_string | • _interpreted_string + _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' + _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' + _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' +} +Transitions: + ['0','9'] -> S84 + ['A','F'] -> S84 + ['a','f'] -> S84 +Action: nil +Symbols classes: {['0','9'], ['A','F'], ['a','f']} + +S73{ + _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • + _hex_byte_value : '\' 'x' _hex_digit • _hex_digit + _byte_value : _octal_byte_value | • _hex_byte_value + _interpreted_string : '"' {_unicode_value | • _byte_value} '"' + string_lit : _raw_string | • _interpreted_string + _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' + _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' + _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' +} +Transitions: + ['0','9'] -> S85 + ['A','F'] -> S85 + ['a','f'] -> S85 +Action: nil +Symbols classes: {['0','9'], ['A','F'], ['a','f']} + +S74{ + _octal_digit : '0'-'7' • + _octal_byte_value : '\' _octal_digit _octal_digit • _octal_digit + _byte_value : • _octal_byte_value | _hex_byte_value + char_lit : ''' (_unicode_value | • _byte_value) ''' + _octal_digit : • '0'-'7' +} +Transitions: + ['0','7'] -> S86 +Action: nil +Symbols classes: {['0','7']} + +S75{ + _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • + _big_u_value : '\' 'U' _hex_digit • _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit + _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char + char_lit : ''' (• _unicode_value | _byte_value) ''' + _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' + _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' + _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' +} +Transitions: + ['0','9'] -> S87 + ['A','F'] -> S87 + ['a','f'] -> S87 +Action: nil +Symbols classes: {['0','9'], ['A','F'], ['a','f']} + +S76{ + _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • + _little_u_value : '\' 'u' _hex_digit • _hex_digit _hex_digit _hex_digit + _unicode_value : . | • _little_u_value | _big_u_value | _escaped_char + char_lit : ''' (• _unicode_value | _byte_value) ''' + _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' + _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' + _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' +} +Transitions: + ['0','9'] -> S88 + ['A','F'] -> S88 + ['a','f'] -> S88 +Action: nil +Symbols classes: {['0','9'], ['A','F'], ['a','f']} + +S77{ + _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • + _hex_byte_value : '\' 'x' _hex_digit • _hex_digit + _byte_value : _octal_byte_value | • _hex_byte_value + char_lit : ''' (_unicode_value | • _byte_value) ''' + _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' + _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' + _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' +} +Transitions: + ['0','9'] -> S89 + ['A','F'] -> S89 + ['a','f'] -> S89 +Action: nil +Symbols classes: {['0','9'], ['A','F'], ['a','f']} + +S78{ + _blockComment : '/' '*' {. | '*'} '*' '/' • + !comment : (_lineComment | _blockComment) • +} +Transitions: +Action: Ignore("!comment") +Symbols classes: {} + +S79{ + g_sdt_lit : '<' '<' . {.} '>' • '>' +} +Transitions: + ['>','>'] -> S90 +Action: nil +Symbols classes: {['>','>']} + +S80{ + empty : 'e' 'm' 'p' 't' • 'y' + _lowcase : 'a'-'z' • + _id_char : (_upcase | _lowcase | '_' | _digit) • + _tokId : _lowcase {_id_char} • + _tokId : _lowcase {• _id_char} + tokId : _tokId • + tokId : • _tokId + _id_char : _upcase | _lowcase | '_' | • _digit + _id_char : _upcase | _lowcase | • '_' | _digit + _id_char : _upcase | • _lowcase | '_' | _digit + _id_char : • _upcase | _lowcase | '_' | _digit + _digit : • '0'-'9' + _lowcase : • 'a'-'z' + _upcase : • 'A'-'Z' +} +Transitions: + ['0','9'] -> S44 + ['A','Z'] -> S45 + ['_','_'] -> S46 + ['a','x'] -> S47 + ['y','y'] -> S91 + ['z','z'] -> S47 +Action: Accept("tokId") +Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','x'], ['y','y'], ['z','z']} + +S81{ + errore : 'e' 'r' 'r' 'o' • 'r' 'e' + _lowcase : 'a'-'z' • + _id_char : (_upcase | _lowcase | '_' | _digit) • + _tokId : _lowcase {_id_char} • + _tokId : _lowcase {• _id_char} + tokId : _tokId • + tokId : • _tokId + _id_char : _upcase | _lowcase | '_' | • _digit + _id_char : _upcase | _lowcase | • '_' | _digit + _id_char : _upcase | • _lowcase | '_' | _digit + _id_char : • _upcase | _lowcase | '_' | _digit + _digit : • '0'-'9' + _lowcase : • 'a'-'z' + _upcase : • 'A'-'Z' +} +Transitions: + ['0','9'] -> S44 + ['A','Z'] -> S45 + ['_','_'] -> S46 + ['a','q'] -> S47 + ['r','r'] -> S92 + ['s','z'] -> S47 +Action: Accept("tokId") +Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','q'], ['r','r'], ['s','z']} + +S82{ + _octal_digit : '0'-'7' • + _octal_byte_value : '\' _octal_digit _octal_digit _octal_digit • + _byte_value : (_octal_byte_value | _hex_byte_value) • + _interpreted_string : '"' {_unicode_value | _byte_value} • '"' + _interpreted_string : '"' {_unicode_value | • _byte_value} '"' + _interpreted_string : '"' {• _unicode_value | _byte_value} '"' + string_lit : _raw_string | • _interpreted_string + _byte_value : _octal_byte_value | • _hex_byte_value + _byte_value : • _octal_byte_value | _hex_byte_value + _unicode_value : . | _little_u_value | _big_u_value | • _escaped_char + _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char + _unicode_value : . | • _little_u_value | _big_u_value | _escaped_char + _unicode_value : • . | _little_u_value | _big_u_value | _escaped_char + _hex_byte_value : • '\' 'x' _hex_digit _hex_digit + _octal_byte_value : • '\' _octal_digit _octal_digit _octal_digit + _escaped_char : • '\' ('a' | 'b' | 'f' | 'n' | 'r' | 't' | 'v' | '\' | ''' | '"') + _big_u_value : • '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit + _little_u_value : • '\' 'u' _hex_digit _hex_digit _hex_digit _hex_digit +} +Transitions: + ['"','"'] -> S27 + ['\','\'] -> S28 +. -> S29 +Action: nil +Symbols classes: {['"','"'], ['\','\']} + +S83{ + _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • + _big_u_value : '\' 'U' _hex_digit _hex_digit • _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit + _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char + _interpreted_string : '"' {• _unicode_value | _byte_value} '"' + string_lit : _raw_string | • _interpreted_string + _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' + _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' + _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' +} +Transitions: + ['0','9'] -> S93 + ['A','F'] -> S93 + ['a','f'] -> S93 +Action: nil +Symbols classes: {['0','9'], ['A','F'], ['a','f']} + +S84{ + _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • + _little_u_value : '\' 'u' _hex_digit _hex_digit • _hex_digit _hex_digit + _unicode_value : . | • _little_u_value | _big_u_value | _escaped_char + _interpreted_string : '"' {• _unicode_value | _byte_value} '"' + string_lit : _raw_string | • _interpreted_string + _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' + _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' + _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' +} +Transitions: + ['0','9'] -> S94 + ['A','F'] -> S94 + ['a','f'] -> S94 +Action: nil +Symbols classes: {['0','9'], ['A','F'], ['a','f']} + +S85{ + _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • + _hex_byte_value : '\' 'x' _hex_digit _hex_digit • + _byte_value : (_octal_byte_value | _hex_byte_value) • + _interpreted_string : '"' {_unicode_value | _byte_value} • '"' + _interpreted_string : '"' {_unicode_value | • _byte_value} '"' + _interpreted_string : '"' {• _unicode_value | _byte_value} '"' + string_lit : _raw_string | • _interpreted_string + _byte_value : _octal_byte_value | • _hex_byte_value + _byte_value : • _octal_byte_value | _hex_byte_value + _unicode_value : . | _little_u_value | _big_u_value | • _escaped_char + _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char + _unicode_value : . | • _little_u_value | _big_u_value | _escaped_char + _unicode_value : • . | _little_u_value | _big_u_value | _escaped_char + _hex_byte_value : • '\' 'x' _hex_digit _hex_digit + _octal_byte_value : • '\' _octal_digit _octal_digit _octal_digit + _escaped_char : • '\' ('a' | 'b' | 'f' | 'n' | 'r' | 't' | 'v' | '\' | ''' | '"') + _big_u_value : • '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit + _little_u_value : • '\' 'u' _hex_digit _hex_digit _hex_digit _hex_digit +} +Transitions: + ['"','"'] -> S27 + ['\','\'] -> S28 +. -> S29 +Action: nil +Symbols classes: {['"','"'], ['\','\']} + +S86{ + _octal_digit : '0'-'7' • + _octal_byte_value : '\' _octal_digit _octal_digit _octal_digit • + _byte_value : (_octal_byte_value | _hex_byte_value) • + char_lit : ''' (_unicode_value | _byte_value) • ''' +} +Transitions: + [''','''] -> S64 +Action: nil +Symbols classes: {[''',''']} + +S87{ + _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • + _big_u_value : '\' 'U' _hex_digit _hex_digit • _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit + _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char + char_lit : ''' (• _unicode_value | _byte_value) ''' + _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' + _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' + _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' +} +Transitions: + ['0','9'] -> S95 + ['A','F'] -> S95 + ['a','f'] -> S95 +Action: nil +Symbols classes: {['0','9'], ['A','F'], ['a','f']} + +S88{ + _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • + _little_u_value : '\' 'u' _hex_digit _hex_digit • _hex_digit _hex_digit + _unicode_value : . | • _little_u_value | _big_u_value | _escaped_char + char_lit : ''' (• _unicode_value | _byte_value) ''' + _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' + _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' + _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' +} +Transitions: + ['0','9'] -> S96 + ['A','F'] -> S96 + ['a','f'] -> S96 +Action: nil +Symbols classes: {['0','9'], ['A','F'], ['a','f']} + +S89{ + _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • + _hex_byte_value : '\' 'x' _hex_digit _hex_digit • + _byte_value : (_octal_byte_value | _hex_byte_value) • + char_lit : ''' (_unicode_value | _byte_value) • ''' +} +Transitions: + [''','''] -> S64 +Action: nil +Symbols classes: {[''',''']} + +S90{ + g_sdt_lit : '<' '<' . {.} '>' '>' • +} +Transitions: +Action: Accept("g_sdt_lit") +Symbols classes: {} + +S91{ + empty : 'e' 'm' 'p' 't' 'y' • + _lowcase : 'a'-'z' • + _id_char : (_upcase | _lowcase | '_' | _digit) • + _tokId : _lowcase {_id_char} • + _tokId : _lowcase {• _id_char} + tokId : _tokId • + tokId : • _tokId + _id_char : _upcase | _lowcase | '_' | • _digit + _id_char : _upcase | _lowcase | • '_' | _digit + _id_char : _upcase | • _lowcase | '_' | _digit + _id_char : • _upcase | _lowcase | '_' | _digit + _digit : • '0'-'9' + _lowcase : • 'a'-'z' + _upcase : • 'A'-'Z' +} +Transitions: + ['0','9'] -> S44 + ['A','Z'] -> S45 + ['_','_'] -> S46 + ['a','z'] -> S47 +Action: Accept("empty") +Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} + +S92{ + errore : 'e' 'r' 'r' 'o' 'r' • 'e' + _lowcase : 'a'-'z' • + _id_char : (_upcase | _lowcase | '_' | _digit) • + _tokId : _lowcase {_id_char} • + _tokId : _lowcase {• _id_char} + tokId : _tokId • + tokId : • _tokId + _id_char : _upcase | _lowcase | '_' | • _digit + _id_char : _upcase | _lowcase | • '_' | _digit + _id_char : _upcase | • _lowcase | '_' | _digit + _id_char : • _upcase | _lowcase | '_' | _digit + _digit : • '0'-'9' + _lowcase : • 'a'-'z' + _upcase : • 'A'-'Z' +} +Transitions: + ['0','9'] -> S44 + ['A','Z'] -> S45 + ['_','_'] -> S46 + ['a','d'] -> S47 + ['e','e'] -> S97 + ['f','z'] -> S47 +Action: Accept("tokId") +Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','d'], ['e','e'], ['f','z']} + +S93{ + _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • + _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit • _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit + _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char + _interpreted_string : '"' {• _unicode_value | _byte_value} '"' + string_lit : _raw_string | • _interpreted_string + _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' + _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' + _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' +} +Transitions: + ['0','9'] -> S98 + ['A','F'] -> S98 + ['a','f'] -> S98 +Action: nil +Symbols classes: {['0','9'], ['A','F'], ['a','f']} + +S94{ + _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • + _little_u_value : '\' 'u' _hex_digit _hex_digit _hex_digit • _hex_digit + _unicode_value : . | • _little_u_value | _big_u_value | _escaped_char + _interpreted_string : '"' {• _unicode_value | _byte_value} '"' + string_lit : _raw_string | • _interpreted_string + _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' + _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' + _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' +} +Transitions: + ['0','9'] -> S99 + ['A','F'] -> S99 + ['a','f'] -> S99 +Action: nil +Symbols classes: {['0','9'], ['A','F'], ['a','f']} + +S95{ + _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • + _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit • _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit + _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char + char_lit : ''' (• _unicode_value | _byte_value) ''' + _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' + _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' + _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' +} +Transitions: + ['0','9'] -> S100 + ['A','F'] -> S100 + ['a','f'] -> S100 +Action: nil +Symbols classes: {['0','9'], ['A','F'], ['a','f']} + +S96{ + _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • + _little_u_value : '\' 'u' _hex_digit _hex_digit _hex_digit • _hex_digit + _unicode_value : . | • _little_u_value | _big_u_value | _escaped_char + char_lit : ''' (• _unicode_value | _byte_value) ''' + _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' + _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' + _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' +} +Transitions: + ['0','9'] -> S101 + ['A','F'] -> S101 + ['a','f'] -> S101 +Action: nil +Symbols classes: {['0','9'], ['A','F'], ['a','f']} + +S97{ + errore : 'e' 'r' 'r' 'o' 'r' 'e' • + _lowcase : 'a'-'z' • + _id_char : (_upcase | _lowcase | '_' | _digit) • + _tokId : _lowcase {_id_char} • + _tokId : _lowcase {• _id_char} + tokId : _tokId • + tokId : • _tokId + _id_char : _upcase | _lowcase | '_' | • _digit + _id_char : _upcase | _lowcase | • '_' | _digit + _id_char : _upcase | • _lowcase | '_' | _digit + _id_char : • _upcase | _lowcase | '_' | _digit + _digit : • '0'-'9' + _lowcase : • 'a'-'z' + _upcase : • 'A'-'Z' +} +Transitions: + ['0','9'] -> S44 + ['A','Z'] -> S45 + ['_','_'] -> S46 + ['a','z'] -> S47 +Action: Accept("errore") +Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} + +S98{ + _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • + _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit • _hex_digit _hex_digit _hex_digit _hex_digit + _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char + _interpreted_string : '"' {• _unicode_value | _byte_value} '"' + string_lit : _raw_string | • _interpreted_string + _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' + _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' + _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' +} +Transitions: + ['0','9'] -> S102 + ['A','F'] -> S102 + ['a','f'] -> S102 +Action: nil +Symbols classes: {['0','9'], ['A','F'], ['a','f']} + +S99{ + _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • + _little_u_value : '\' 'u' _hex_digit _hex_digit _hex_digit _hex_digit • + _unicode_value : (. | _little_u_value | _big_u_value | _escaped_char) • + _interpreted_string : '"' {_unicode_value | _byte_value} • '"' + _interpreted_string : '"' {_unicode_value | • _byte_value} '"' + _interpreted_string : '"' {• _unicode_value | _byte_value} '"' + string_lit : _raw_string | • _interpreted_string + _byte_value : _octal_byte_value | • _hex_byte_value + _byte_value : • _octal_byte_value | _hex_byte_value + _unicode_value : . | _little_u_value | _big_u_value | • _escaped_char + _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char + _unicode_value : . | • _little_u_value | _big_u_value | _escaped_char + _unicode_value : • . | _little_u_value | _big_u_value | _escaped_char + _hex_byte_value : • '\' 'x' _hex_digit _hex_digit + _octal_byte_value : • '\' _octal_digit _octal_digit _octal_digit + _escaped_char : • '\' ('a' | 'b' | 'f' | 'n' | 'r' | 't' | 'v' | '\' | ''' | '"') + _big_u_value : • '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit + _little_u_value : • '\' 'u' _hex_digit _hex_digit _hex_digit _hex_digit +} +Transitions: + ['"','"'] -> S27 + ['\','\'] -> S28 +. -> S29 +Action: nil +Symbols classes: {['"','"'], ['\','\']} + +S100{ + _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • + _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit • _hex_digit _hex_digit _hex_digit _hex_digit + _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char + char_lit : ''' (• _unicode_value | _byte_value) ''' + _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' + _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' + _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' +} +Transitions: + ['0','9'] -> S103 + ['A','F'] -> S103 + ['a','f'] -> S103 +Action: nil +Symbols classes: {['0','9'], ['A','F'], ['a','f']} + +S101{ + _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • + _little_u_value : '\' 'u' _hex_digit _hex_digit _hex_digit _hex_digit • + _unicode_value : (. | _little_u_value | _big_u_value | _escaped_char) • + char_lit : ''' (_unicode_value | _byte_value) • ''' +} +Transitions: + [''','''] -> S64 +Action: nil +Symbols classes: {[''',''']} + +S102{ + _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • + _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit • _hex_digit _hex_digit _hex_digit + _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char + _interpreted_string : '"' {• _unicode_value | _byte_value} '"' + string_lit : _raw_string | • _interpreted_string + _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' + _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' + _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' +} +Transitions: + ['0','9'] -> S104 + ['A','F'] -> S104 + ['a','f'] -> S104 +Action: nil +Symbols classes: {['0','9'], ['A','F'], ['a','f']} + +S103{ + _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • + _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit • _hex_digit _hex_digit _hex_digit + _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char + char_lit : ''' (• _unicode_value | _byte_value) ''' + _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' + _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' + _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' +} +Transitions: + ['0','9'] -> S105 + ['A','F'] -> S105 + ['a','f'] -> S105 +Action: nil +Symbols classes: {['0','9'], ['A','F'], ['a','f']} + +S104{ + _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • + _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit • _hex_digit _hex_digit + _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char + _interpreted_string : '"' {• _unicode_value | _byte_value} '"' + string_lit : _raw_string | • _interpreted_string + _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' + _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' + _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' +} +Transitions: + ['0','9'] -> S106 + ['A','F'] -> S106 + ['a','f'] -> S106 +Action: nil +Symbols classes: {['0','9'], ['A','F'], ['a','f']} + +S105{ + _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • + _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit • _hex_digit _hex_digit + _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char + char_lit : ''' (• _unicode_value | _byte_value) ''' + _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' + _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' + _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' +} +Transitions: + ['0','9'] -> S107 + ['A','F'] -> S107 + ['a','f'] -> S107 +Action: nil +Symbols classes: {['0','9'], ['A','F'], ['a','f']} + +S106{ + _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • + _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit • _hex_digit + _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char + _interpreted_string : '"' {• _unicode_value | _byte_value} '"' + string_lit : _raw_string | • _interpreted_string + _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' + _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' + _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' +} +Transitions: + ['0','9'] -> S108 + ['A','F'] -> S108 + ['a','f'] -> S108 +Action: nil +Symbols classes: {['0','9'], ['A','F'], ['a','f']} + +S107{ + _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • + _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit • _hex_digit + _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char + char_lit : ''' (• _unicode_value | _byte_value) ''' + _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' + _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' + _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' +} +Transitions: + ['0','9'] -> S109 + ['A','F'] -> S109 + ['a','f'] -> S109 +Action: nil +Symbols classes: {['0','9'], ['A','F'], ['a','f']} + +S108{ + _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • + _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit • + _unicode_value : (. | _little_u_value | _big_u_value | _escaped_char) • + _interpreted_string : '"' {_unicode_value | _byte_value} • '"' + _interpreted_string : '"' {_unicode_value | • _byte_value} '"' + _interpreted_string : '"' {• _unicode_value | _byte_value} '"' + string_lit : _raw_string | • _interpreted_string + _byte_value : _octal_byte_value | • _hex_byte_value + _byte_value : • _octal_byte_value | _hex_byte_value + _unicode_value : . | _little_u_value | _big_u_value | • _escaped_char + _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char + _unicode_value : . | • _little_u_value | _big_u_value | _escaped_char + _unicode_value : • . | _little_u_value | _big_u_value | _escaped_char + _hex_byte_value : • '\' 'x' _hex_digit _hex_digit + _octal_byte_value : • '\' _octal_digit _octal_digit _octal_digit + _escaped_char : • '\' ('a' | 'b' | 'f' | 'n' | 'r' | 't' | 'v' | '\' | ''' | '"') + _big_u_value : • '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit + _little_u_value : • '\' 'u' _hex_digit _hex_digit _hex_digit _hex_digit +} +Transitions: + ['"','"'] -> S27 + ['\','\'] -> S28 +. -> S29 +Action: nil +Symbols classes: {['"','"'], ['\','\']} + +S109{ + _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • + _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit • + _unicode_value : (. | _little_u_value | _big_u_value | _escaped_char) • + char_lit : ''' (_unicode_value | _byte_value) • ''' +} +Transitions: + [''','''] -> S64 +Action: nil +Symbols classes: {[''',''']} + diff --git a/internal/frontend_ext/parser/action.go b/internal/fe2/parser/action.go similarity index 100% rename from internal/frontend_ext/parser/action.go rename to internal/fe2/parser/action.go diff --git a/internal/frontend_ext/parser/actiontable.go b/internal/fe2/parser/actiontable.go similarity index 74% rename from internal/frontend_ext/parser/actiontable.go rename to internal/fe2/parser/actiontable.go index 47662403..ed8d66f4 100644 --- a/internal/frontend_ext/parser/actiontable.go +++ b/internal/fe2/parser/actiontable.go @@ -14,8 +14,8 @@ var actionTab = actionTable{ actionRow{ // S0 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω shift(6), // tokId nil, // : nil, // ; @@ -24,8 +24,8 @@ var actionTab = actionTable{ nil, // | nil, // . nil, // char_lit - nil, // ~ nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -34,16 +34,18 @@ var actionTab = actionTable{ nil, // } shift(11), // g_sdt_lit shift(13), // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, actionRow{ // S1 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - accept(true), // $ + nil, // + accept(true), // Ω nil, // tokId nil, // : nil, // ; @@ -52,8 +54,8 @@ var actionTab = actionTable{ nil, // | nil, // . nil, // char_lit - nil, // ~ nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -62,16 +64,18 @@ var actionTab = actionTable{ nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, actionRow{ // S2 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - reduce(2), // $, reduce: Grammar + nil, // + reduce(2), // Ω, reduce: Grammar nil, // tokId nil, // : nil, // ; @@ -80,8 +84,8 @@ var actionTab = actionTable{ nil, // | nil, // . nil, // char_lit - nil, // ~ nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -90,16 +94,18 @@ var actionTab = actionTable{ nil, // } shift(11), // g_sdt_lit shift(13), // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, actionRow{ // S3 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - reduce(3), // $, reduce: Grammar + nil, // + reduce(3), // Ω, reduce: Grammar nil, // tokId nil, // : nil, // ; @@ -108,8 +114,8 @@ var actionTab = actionTable{ nil, // | nil, // . nil, // char_lit - nil, // ~ nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -118,16 +124,18 @@ var actionTab = actionTable{ nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, actionRow{ // S4 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - reduce(4), // $, reduce: LexicalPart + nil, // + reduce(4), // Ω, reduce: LexicalPart shift(6), // tokId nil, // : nil, // ; @@ -136,8 +144,8 @@ var actionTab = actionTable{ nil, // | nil, // . nil, // char_lit - nil, // ~ nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -146,16 +154,18 @@ var actionTab = actionTable{ nil, // } reduce(4), // g_sdt_lit, reduce: LexicalPart reduce(4), // prodId, reduce: LexicalPart - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, actionRow{ // S5 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - reduce(5), // $, reduce: LexProductions + nil, // + reduce(5), // Ω, reduce: LexProductions reduce(5), // tokId, reduce: LexProductions nil, // : nil, // ; @@ -164,8 +174,8 @@ var actionTab = actionTable{ nil, // | nil, // . nil, // char_lit - nil, // ~ nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -174,16 +184,18 @@ var actionTab = actionTable{ nil, // } reduce(5), // g_sdt_lit, reduce: LexProductions reduce(5), // prodId, reduce: LexProductions - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, actionRow{ // S6 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId shift(16), // : nil, // ; @@ -192,8 +204,8 @@ var actionTab = actionTable{ nil, // | nil, // . nil, // char_lit - nil, // ~ nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -202,16 +214,18 @@ var actionTab = actionTable{ nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, actionRow{ // S7 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId shift(17), // : nil, // ; @@ -220,8 +234,8 @@ var actionTab = actionTable{ nil, // | nil, // . nil, // char_lit - nil, // ~ nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -230,16 +244,18 @@ var actionTab = actionTable{ nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, actionRow{ // S8 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId shift(18), // : nil, // ; @@ -248,8 +264,8 @@ var actionTab = actionTable{ nil, // | nil, // . nil, // char_lit - nil, // ~ nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -258,16 +274,18 @@ var actionTab = actionTable{ nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, actionRow{ // S9 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; @@ -276,8 +294,8 @@ var actionTab = actionTable{ nil, // | nil, // . nil, // char_lit - nil, // ~ nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -286,16 +304,18 @@ var actionTab = actionTable{ nil, // } nil, // g_sdt_lit shift(13), // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, actionRow{ // S10 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - reduce(24), // $, reduce: SyntaxPart + nil, // + reduce(24), // Ω, reduce: SyntaxPart nil, // tokId nil, // : nil, // ; @@ -304,8 +324,8 @@ var actionTab = actionTable{ nil, // | nil, // . nil, // char_lit - nil, // ~ nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -314,16 +334,18 @@ var actionTab = actionTable{ nil, // } nil, // g_sdt_lit shift(13), // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, actionRow{ // S11 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; @@ -332,8 +354,8 @@ var actionTab = actionTable{ nil, // | nil, // . nil, // char_lit - nil, // ~ nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -342,16 +364,18 @@ var actionTab = actionTable{ nil, // } nil, // g_sdt_lit reduce(25), // prodId, reduce: FileHeader - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, actionRow{ // S12 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - reduce(26), // $, reduce: SyntaxProdList + nil, // + reduce(26), // Ω, reduce: SyntaxProdList nil, // tokId nil, // : nil, // ; @@ -360,8 +384,8 @@ var actionTab = actionTable{ nil, // | nil, // . nil, // char_lit - nil, // ~ nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -370,16 +394,18 @@ var actionTab = actionTable{ nil, // } nil, // g_sdt_lit reduce(26), // prodId, reduce: SyntaxProdList - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, actionRow{ // S13 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId shift(21), // : nil, // ; @@ -388,8 +414,8 @@ var actionTab = actionTable{ nil, // | nil, // . nil, // char_lit - nil, // ~ nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -398,16 +424,18 @@ var actionTab = actionTable{ nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, actionRow{ // S14 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - reduce(1), // $, reduce: Grammar + nil, // + reduce(1), // Ω, reduce: Grammar nil, // tokId nil, // : nil, // ; @@ -416,8 +444,8 @@ var actionTab = actionTable{ nil, // | nil, // . nil, // char_lit - nil, // ~ nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -426,16 +454,18 @@ var actionTab = actionTable{ nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, actionRow{ // S15 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - reduce(6), // $, reduce: LexProductions + nil, // + reduce(6), // Ω, reduce: LexProductions reduce(6), // tokId, reduce: LexProductions nil, // : nil, // ; @@ -444,8 +474,8 @@ var actionTab = actionTable{ nil, // | nil, // . nil, // char_lit - nil, // ~ nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -454,16 +484,18 @@ var actionTab = actionTable{ nil, // } reduce(6), // g_sdt_lit, reduce: LexProductions reduce(6), // prodId, reduce: LexProductions - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, actionRow{ // S16 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; @@ -472,8 +504,8 @@ var actionTab = actionTable{ nil, // | shift(26), // . shift(27), // char_lit - shift(28), // ~ nil, // - + shift(28), // ~ shift(29), // ( nil, // ) shift(30), // [ @@ -482,16 +514,18 @@ var actionTab = actionTable{ nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, actionRow{ // S17 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; @@ -500,8 +534,8 @@ var actionTab = actionTable{ nil, // | shift(26), // . shift(27), // char_lit - shift(28), // ~ nil, // - + shift(28), // ~ shift(29), // ( nil, // ) shift(30), // [ @@ -510,16 +544,18 @@ var actionTab = actionTable{ nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, actionRow{ // S18 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; @@ -528,8 +564,8 @@ var actionTab = actionTable{ nil, // | shift(26), // . shift(27), // char_lit - shift(28), // ~ nil, // - + shift(28), // ~ shift(29), // ( nil, // ) shift(30), // [ @@ -538,16 +574,18 @@ var actionTab = actionTable{ nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, actionRow{ // S19 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - reduce(23), // $, reduce: SyntaxPart + nil, // + reduce(23), // Ω, reduce: SyntaxPart nil, // tokId nil, // : nil, // ; @@ -556,8 +594,8 @@ var actionTab = actionTable{ nil, // | nil, // . nil, // char_lit - nil, // ~ nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -566,16 +604,18 @@ var actionTab = actionTable{ nil, // } nil, // g_sdt_lit shift(13), // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, actionRow{ // S20 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - reduce(27), // $, reduce: SyntaxProdList + nil, // + reduce(27), // Ω, reduce: SyntaxProdList nil, // tokId nil, // : nil, // ; @@ -584,8 +624,8 @@ var actionTab = actionTable{ nil, // | nil, // . nil, // char_lit - nil, // ~ nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -594,54 +634,58 @@ var actionTab = actionTable{ nil, // } nil, // g_sdt_lit reduce(27), // prodId, reduce: SyntaxProdList - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, actionRow{ // S21 - canRecover: true, + canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ - shift(34), // tokId - nil, // : - reduce(36), // ;, reduce: SyntaxBody - nil, // regDefId - nil, // ignoredTokId - reduce(36), // |, reduce: SyntaxBody - nil, // . - nil, // char_lit - nil, // ~ - nil, // - - nil, // ( - nil, // ) - nil, // [ - nil, // ] - nil, // { - nil, // } - nil, // g_sdt_lit - shift(35), // prodId - shift(39), // error - nil, // empty - shift(41), // string_lit + nil, // + nil, // Ω + shift(34), // tokId + nil, // : + nil, // ; + nil, // regDefId + nil, // ignoredTokId + nil, // | + nil, // . + nil, // char_lit + nil, // - + nil, // ~ + nil, // ( + nil, // ) + nil, // [ + nil, // ] + nil, // { + nil, // } + nil, // g_sdt_lit + shift(35), // prodId + shift(42), // string_lit + shift(43), // errore + shift(44), // λ + shift(45), // empty + shift(46), // ε }, }, actionRow{ // S22 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : - shift(42), // ; + shift(47), // ; nil, // regDefId nil, // ignoredTokId - shift(43), // | + shift(48), // | nil, // . nil, // char_lit - nil, // ~ nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -650,16 +694,18 @@ var actionTab = actionTable{ nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, actionRow{ // S23 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : reduce(19), // ;, reduce: LexTerm @@ -668,8 +714,8 @@ var actionTab = actionTable{ reduce(19), // |, reduce: LexTerm reduce(19), // ., reduce: LexTerm reduce(19), // char_lit, reduce: LexTerm - reduce(19), // ~, reduce: LexTerm nil, // - + reduce(19), // ~, reduce: LexTerm reduce(19), // (, reduce: LexTerm nil, // ) reduce(19), // [, reduce: LexTerm @@ -678,16 +724,18 @@ var actionTab = actionTable{ nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, actionRow{ // S24 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : reduce(10), // ;, reduce: LexPattern @@ -696,8 +744,8 @@ var actionTab = actionTable{ reduce(10), // |, reduce: LexPattern shift(26), // . shift(27), // char_lit - shift(28), // ~ nil, // - + shift(28), // ~ shift(29), // ( nil, // ) shift(30), // [ @@ -706,16 +754,18 @@ var actionTab = actionTable{ nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, actionRow{ // S25 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : reduce(12), // ;, reduce: LexAlt @@ -724,8 +774,8 @@ var actionTab = actionTable{ reduce(12), // |, reduce: LexAlt reduce(12), // ., reduce: LexAlt reduce(12), // char_lit, reduce: LexAlt - reduce(12), // ~, reduce: LexAlt nil, // - + reduce(12), // ~, reduce: LexAlt reduce(12), // (, reduce: LexAlt nil, // ) reduce(12), // [, reduce: LexAlt @@ -734,16 +784,18 @@ var actionTab = actionTable{ nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, actionRow{ // S26 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : reduce(14), // ;, reduce: LexTerm @@ -752,8 +804,8 @@ var actionTab = actionTable{ reduce(14), // |, reduce: LexTerm reduce(14), // ., reduce: LexTerm reduce(14), // char_lit, reduce: LexTerm - reduce(14), // ~, reduce: LexTerm nil, // - + reduce(14), // ~, reduce: LexTerm reduce(14), // (, reduce: LexTerm nil, // ) reduce(14), // [, reduce: LexTerm @@ -762,16 +814,18 @@ var actionTab = actionTable{ nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, actionRow{ // S27 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : reduce(15), // ;, reduce: LexTerm @@ -780,8 +834,8 @@ var actionTab = actionTable{ reduce(15), // |, reduce: LexTerm reduce(15), // ., reduce: LexTerm reduce(15), // char_lit, reduce: LexTerm + shift(50), // - reduce(15), // ~, reduce: LexTerm - shift(45), // - reduce(15), // (, reduce: LexTerm nil, // ) reduce(15), // [, reduce: LexTerm @@ -790,16 +844,18 @@ var actionTab = actionTable{ nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, actionRow{ // S28 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; @@ -807,10 +863,10 @@ var actionTab = actionTable{ nil, // ignoredTokId nil, // | nil, // . - shift(46), // char_lit - nil, // ~ + shift(51), // char_lit nil, // - - shift(47), // ( + nil, // ~ + shift(52), // ( nil, // ) nil, // [ nil, // ] @@ -818,110 +874,118 @@ var actionTab = actionTable{ nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, actionRow{ // S29 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; - shift(49), // regDefId + shift(54), // regDefId nil, // ignoredTokId nil, // | - shift(52), // . - shift(53), // char_lit - shift(54), // ~ + shift(57), // . + shift(58), // char_lit nil, // - - shift(55), // ( + shift(59), // ~ + shift(60), // ( nil, // ) - shift(56), // [ + shift(61), // [ nil, // ] - shift(57), // { + shift(62), // { nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, actionRow{ // S30 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; - shift(59), // regDefId + shift(64), // regDefId nil, // ignoredTokId nil, // | - shift(62), // . - shift(63), // char_lit - shift(64), // ~ + shift(67), // . + shift(68), // char_lit nil, // - - shift(65), // ( + shift(69), // ~ + shift(70), // ( nil, // ) - shift(66), // [ + shift(71), // [ nil, // ] - shift(67), // { + shift(72), // { nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, actionRow{ // S31 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; - shift(69), // regDefId + shift(74), // regDefId nil, // ignoredTokId nil, // | - shift(72), // . - shift(73), // char_lit - shift(74), // ~ + shift(77), // . + shift(78), // char_lit nil, // - - shift(75), // ( + shift(79), // ~ + shift(80), // ( nil, // ) - shift(76), // [ + shift(81), // [ nil, // ] - shift(77), // { + shift(82), // { nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, actionRow{ // S32 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : - shift(78), // ; + shift(83), // ; nil, // regDefId nil, // ignoredTokId - shift(43), // | + shift(48), // | nil, // . nil, // char_lit - nil, // ~ nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -930,26 +994,28 @@ var actionTab = actionTable{ nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, actionRow{ // S33 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : - shift(79), // ; + shift(84), // ; nil, // regDefId nil, // ignoredTokId - shift(43), // | + shift(48), // | nil, // . nil, // char_lit - nil, // ~ nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -958,82 +1024,88 @@ var actionTab = actionTable{ nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, actionRow{ // S34 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ - reduce(40), // tokId, reduce: Symbol + nil, // + nil, // Ω + reduce(41), // tokId, reduce: Symbol nil, // : - reduce(40), // ;, reduce: Symbol + reduce(41), // ;, reduce: Symbol nil, // regDefId nil, // ignoredTokId - reduce(40), // |, reduce: Symbol + reduce(41), // |, reduce: Symbol nil, // . nil, // char_lit - nil, // ~ nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ nil, // ] nil, // { nil, // } - reduce(40), // g_sdt_lit, reduce: Symbol - reduce(40), // prodId, reduce: Symbol - nil, // error + reduce(41), // g_sdt_lit, reduce: Symbol + reduce(41), // prodId, reduce: Symbol + reduce(41), // string_lit, reduce: Symbol + nil, // errore + nil, // λ nil, // empty - reduce(40), // string_lit, reduce: Symbol + nil, // ε }, }, actionRow{ // S35 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ - reduce(39), // tokId, reduce: Symbol + nil, // + nil, // Ω + reduce(40), // tokId, reduce: Symbol nil, // : - reduce(39), // ;, reduce: Symbol + reduce(40), // ;, reduce: Symbol nil, // regDefId nil, // ignoredTokId - reduce(39), // |, reduce: Symbol + reduce(40), // |, reduce: Symbol nil, // . nil, // char_lit - nil, // ~ nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ nil, // ] nil, // { nil, // } - reduce(39), // g_sdt_lit, reduce: Symbol - reduce(39), // prodId, reduce: Symbol - nil, // error + reduce(40), // g_sdt_lit, reduce: Symbol + reduce(40), // prodId, reduce: Symbol + reduce(40), // string_lit, reduce: Symbol + nil, // errore + nil, // λ nil, // empty - reduce(39), // string_lit, reduce: Symbol + nil, // ε }, }, actionRow{ // S36 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : - shift(80), // ; + shift(85), // ; nil, // regDefId nil, // ignoredTokId - shift(81), // | + shift(86), // | nil, // . nil, // char_lit - nil, // ~ nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -1042,16 +1114,18 @@ var actionTab = actionTable{ nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, actionRow{ // S37 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : reduce(29), // ;, reduce: Alternatives @@ -1060,8 +1134,8 @@ var actionTab = actionTable{ reduce(29), // |, reduce: Alternatives nil, // . nil, // char_lit - nil, // ~ nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -1070,16 +1144,18 @@ var actionTab = actionTable{ nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, actionRow{ // S38 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω shift(34), // tokId nil, // : reduce(31), // ;, reduce: SyntaxBody @@ -1088,26 +1164,28 @@ var actionTab = actionTable{ reduce(31), // |, reduce: SyntaxBody nil, // . nil, // char_lit - nil, // ~ nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ nil, // ] nil, // { nil, // } - shift(82), // g_sdt_lit + shift(87), // g_sdt_lit shift(35), // prodId - nil, // error + shift(42), // string_lit + nil, // errore + nil, // λ nil, // empty - shift(41), // string_lit + nil, // ε }, }, actionRow{ // S39 - canRecover: true, + canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω shift(34), // tokId nil, // : reduce(33), // ;, reduce: SyntaxBody @@ -1116,120 +1194,278 @@ var actionTab = actionTable{ reduce(33), // |, reduce: SyntaxBody nil, // . nil, // char_lit - nil, // ~ nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ nil, // ] nil, // { nil, // } - nil, // g_sdt_lit + shift(89), // g_sdt_lit shift(35), // prodId - nil, // error + shift(42), // string_lit + nil, // errore + nil, // λ nil, // empty - shift(41), // string_lit + nil, // ε }, }, actionRow{ // S40 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ - reduce(37), // tokId, reduce: Symbols + nil, // + nil, // Ω + nil, // tokId nil, // : - reduce(37), // ;, reduce: Symbols + reduce(37), // ;, reduce: SyntaxBody nil, // regDefId nil, // ignoredTokId - reduce(37), // |, reduce: Symbols + reduce(37), // |, reduce: SyntaxBody nil, // . nil, // char_lit - nil, // ~ nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ nil, // ] nil, // { nil, // } - reduce(37), // g_sdt_lit, reduce: Symbols - reduce(37), // prodId, reduce: Symbols - nil, // error + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // errore + nil, // λ nil, // empty - reduce(37), // string_lit, reduce: Symbols + nil, // ε }, }, actionRow{ // S41 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ - reduce(41), // tokId, reduce: Symbol + nil, // + nil, // Ω + reduce(38), // tokId, reduce: Symbols nil, // : - reduce(41), // ;, reduce: Symbol + reduce(38), // ;, reduce: Symbols nil, // regDefId nil, // ignoredTokId - reduce(41), // |, reduce: Symbol + reduce(38), // |, reduce: Symbols nil, // . nil, // char_lit - nil, // ~ nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ nil, // ] nil, // { nil, // } - reduce(41), // g_sdt_lit, reduce: Symbol - reduce(41), // prodId, reduce: Symbol - nil, // error + reduce(38), // g_sdt_lit, reduce: Symbols + reduce(38), // prodId, reduce: Symbols + reduce(38), // string_lit, reduce: Symbols + nil, // errore + nil, // λ nil, // empty - reduce(41), // string_lit, reduce: Symbol + nil, // ε }, }, actionRow{ // S42 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - reduce(7), // $, reduce: LexProduction - reduce(7), // tokId, reduce: LexProduction - nil, // : - nil, // ; - reduce(7), // regDefId, reduce: LexProduction - reduce(7), // ignoredTokId, reduce: LexProduction - nil, // | - nil, // . - nil, // char_lit - nil, // ~ - nil, // - - nil, // ( - nil, // ) - nil, // [ - nil, // ] - nil, // { - nil, // } - reduce(7), // g_sdt_lit, reduce: LexProduction - reduce(7), // prodId, reduce: LexProduction - nil, // error - nil, // empty - nil, // string_lit + nil, // + nil, // Ω + reduce(42), // tokId, reduce: Symbol + nil, // : + reduce(42), // ;, reduce: Symbol + nil, // regDefId + nil, // ignoredTokId + reduce(42), // |, reduce: Symbol + nil, // . + nil, // char_lit + nil, // - + nil, // ~ + nil, // ( + nil, // ) + nil, // [ + nil, // ] + nil, // { + nil, // } + reduce(42), // g_sdt_lit, reduce: Symbol + reduce(42), // prodId, reduce: Symbol + reduce(42), // string_lit, reduce: Symbol + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, actionRow{ // S43 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ - nil, // tokId - nil, // : - nil, // ; - shift(23), // regDefId - nil, // ignoredTokId - nil, // | + nil, // + nil, // Ω + reduce(43), // tokId, reduce: ErrorSymbol + nil, // : + reduce(43), // ;, reduce: ErrorSymbol + nil, // regDefId + nil, // ignoredTokId + reduce(43), // |, reduce: ErrorSymbol + nil, // . + nil, // char_lit + nil, // - + nil, // ~ + nil, // ( + nil, // ) + nil, // [ + nil, // ] + nil, // { + nil, // } + reduce(43), // g_sdt_lit, reduce: ErrorSymbol + reduce(43), // prodId, reduce: ErrorSymbol + reduce(43), // string_lit, reduce: ErrorSymbol + nil, // errore + nil, // λ + nil, // empty + nil, // ε + }, + }, + actionRow{ // S44 + canRecover: false, + actions: [numSymbols]action{ + nil, // + nil, // Ω + reduce(44), // tokId, reduce: ErrorSymbol + nil, // : + reduce(44), // ;, reduce: ErrorSymbol + nil, // regDefId + nil, // ignoredTokId + reduce(44), // |, reduce: ErrorSymbol + nil, // . + nil, // char_lit + nil, // - + nil, // ~ + nil, // ( + nil, // ) + nil, // [ + nil, // ] + nil, // { + nil, // } + reduce(44), // g_sdt_lit, reduce: ErrorSymbol + reduce(44), // prodId, reduce: ErrorSymbol + reduce(44), // string_lit, reduce: ErrorSymbol + nil, // errore + nil, // λ + nil, // empty + nil, // ε + }, + }, + actionRow{ // S45 + canRecover: false, + actions: [numSymbols]action{ + nil, // + nil, // Ω + nil, // tokId + nil, // : + reduce(45), // ;, reduce: EpsilonSymbol + nil, // regDefId + nil, // ignoredTokId + reduce(45), // |, reduce: EpsilonSymbol + nil, // . + nil, // char_lit + nil, // - + nil, // ~ + nil, // ( + nil, // ) + nil, // [ + nil, // ] + nil, // { + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε + }, + }, + actionRow{ // S46 + canRecover: false, + actions: [numSymbols]action{ + nil, // + nil, // Ω + nil, // tokId + nil, // : + reduce(46), // ;, reduce: EpsilonSymbol + nil, // regDefId + nil, // ignoredTokId + reduce(46), // |, reduce: EpsilonSymbol + nil, // . + nil, // char_lit + nil, // - + nil, // ~ + nil, // ( + nil, // ) + nil, // [ + nil, // ] + nil, // { + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε + }, + }, + actionRow{ // S47 + canRecover: false, + actions: [numSymbols]action{ + nil, // + reduce(7), // Ω, reduce: LexProduction + reduce(7), // tokId, reduce: LexProduction + nil, // : + nil, // ; + reduce(7), // regDefId, reduce: LexProduction + reduce(7), // ignoredTokId, reduce: LexProduction + nil, // | + nil, // . + nil, // char_lit + nil, // - + nil, // ~ + nil, // ( + nil, // ) + nil, // [ + nil, // ] + nil, // { + nil, // } + reduce(7), // g_sdt_lit, reduce: LexProduction + reduce(7), // prodId, reduce: LexProduction + nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε + }, + }, + actionRow{ // S48 + canRecover: false, + actions: [numSymbols]action{ + nil, // + nil, // Ω + nil, // tokId + nil, // : + nil, // ; + shift(23), // regDefId + nil, // ignoredTokId + nil, // | shift(26), // . shift(27), // char_lit - shift(28), // ~ nil, // - + shift(28), // ~ shift(29), // ( nil, // ) shift(30), // [ @@ -1238,16 +1474,18 @@ var actionTab = actionTable{ nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S44 + actionRow{ // S49 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : reduce(13), // ;, reduce: LexAlt @@ -1256,8 +1494,8 @@ var actionTab = actionTable{ reduce(13), // |, reduce: LexAlt reduce(13), // ., reduce: LexAlt reduce(13), // char_lit, reduce: LexAlt - reduce(13), // ~, reduce: LexAlt nil, // - + reduce(13), // ~, reduce: LexAlt reduce(13), // (, reduce: LexAlt nil, // ) reduce(13), // [, reduce: LexAlt @@ -1266,16 +1504,18 @@ var actionTab = actionTable{ nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S45 + actionRow{ // S50 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; @@ -1283,9 +1523,9 @@ var actionTab = actionTable{ nil, // ignoredTokId nil, // | nil, // . - shift(86), // char_lit - nil, // ~ + shift(92), // char_lit nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -1294,44 +1534,48 @@ var actionTab = actionTable{ nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S46 + actionRow{ // S51 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : - reduce(16), // ;, reduce: LexTerm - reduce(16), // regDefId, reduce: LexTerm + reduce(17), // ;, reduce: LexTerm + reduce(17), // regDefId, reduce: LexTerm nil, // ignoredTokId - reduce(16), // |, reduce: LexTerm - reduce(16), // ., reduce: LexTerm - reduce(16), // char_lit, reduce: LexTerm - reduce(16), // ~, reduce: LexTerm + reduce(17), // |, reduce: LexTerm + reduce(17), // ., reduce: LexTerm + reduce(17), // char_lit, reduce: LexTerm nil, // - - reduce(16), // (, reduce: LexTerm + reduce(17), // ~, reduce: LexTerm + reduce(17), // (, reduce: LexTerm nil, // ) - reduce(16), // [, reduce: LexTerm + reduce(17), // [, reduce: LexTerm nil, // ] - reduce(16), // {, reduce: LexTerm + reduce(17), // {, reduce: LexTerm nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S47 + actionRow{ // S52 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; @@ -1339,9 +1583,9 @@ var actionTab = actionTable{ nil, // ignoredTokId nil, // | nil, // . - shift(87), // char_lit - nil, // ~ + shift(93), // char_lit nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -1350,44 +1594,48 @@ var actionTab = actionTable{ nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S48 + actionRow{ // S53 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; nil, // regDefId nil, // ignoredTokId - shift(88), // | + shift(94), // | nil, // . nil, // char_lit - nil, // ~ nil, // - + nil, // ~ nil, // ( - shift(89), // ) + shift(95), // ) nil, // [ nil, // ] nil, // { nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S49 + actionRow{ // S54 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; @@ -1396,8 +1644,8 @@ var actionTab = actionTable{ reduce(19), // |, reduce: LexTerm reduce(19), // ., reduce: LexTerm reduce(19), // char_lit, reduce: LexTerm - reduce(19), // ~, reduce: LexTerm nil, // - + reduce(19), // ~, reduce: LexTerm reduce(19), // (, reduce: LexTerm reduce(19), // ), reduce: LexTerm reduce(19), // [, reduce: LexTerm @@ -1406,44 +1654,48 @@ var actionTab = actionTable{ nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S50 + actionRow{ // S55 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; - shift(49), // regDefId + shift(54), // regDefId nil, // ignoredTokId reduce(10), // |, reduce: LexPattern - shift(52), // . - shift(53), // char_lit - shift(54), // ~ + shift(57), // . + shift(58), // char_lit nil, // - - shift(55), // ( + shift(59), // ~ + shift(60), // ( reduce(10), // ), reduce: LexPattern - shift(56), // [ + shift(61), // [ nil, // ] - shift(57), // { + shift(62), // { nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S51 + actionRow{ // S56 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; @@ -1452,8 +1704,8 @@ var actionTab = actionTable{ reduce(12), // |, reduce: LexAlt reduce(12), // ., reduce: LexAlt reduce(12), // char_lit, reduce: LexAlt - reduce(12), // ~, reduce: LexAlt nil, // - + reduce(12), // ~, reduce: LexAlt reduce(12), // (, reduce: LexAlt reduce(12), // ), reduce: LexAlt reduce(12), // [, reduce: LexAlt @@ -1462,16 +1714,18 @@ var actionTab = actionTable{ nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S52 + actionRow{ // S57 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; @@ -1480,8 +1734,8 @@ var actionTab = actionTable{ reduce(14), // |, reduce: LexTerm reduce(14), // ., reduce: LexTerm reduce(14), // char_lit, reduce: LexTerm - reduce(14), // ~, reduce: LexTerm nil, // - + reduce(14), // ~, reduce: LexTerm reduce(14), // (, reduce: LexTerm reduce(14), // ), reduce: LexTerm reduce(14), // [, reduce: LexTerm @@ -1490,16 +1744,18 @@ var actionTab = actionTable{ nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S53 + actionRow{ // S58 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; @@ -1508,8 +1764,8 @@ var actionTab = actionTable{ reduce(15), // |, reduce: LexTerm reduce(15), // ., reduce: LexTerm reduce(15), // char_lit, reduce: LexTerm + shift(97), // - reduce(15), // ~, reduce: LexTerm - shift(91), // - reduce(15), // (, reduce: LexTerm reduce(15), // ), reduce: LexTerm reduce(15), // [, reduce: LexTerm @@ -1518,16 +1774,18 @@ var actionTab = actionTable{ nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S54 + actionRow{ // S59 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; @@ -1535,10 +1793,10 @@ var actionTab = actionTable{ nil, // ignoredTokId nil, // | nil, // . - shift(92), // char_lit - nil, // ~ + shift(98), // char_lit nil, // - - shift(93), // ( + nil, // ~ + shift(99), // ( nil, // ) nil, // [ nil, // ] @@ -1546,128 +1804,138 @@ var actionTab = actionTable{ nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S55 + actionRow{ // S60 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; - shift(49), // regDefId + shift(54), // regDefId nil, // ignoredTokId nil, // | - shift(52), // . - shift(53), // char_lit - shift(54), // ~ + shift(57), // . + shift(58), // char_lit nil, // - - shift(55), // ( + shift(59), // ~ + shift(60), // ( nil, // ) - shift(56), // [ + shift(61), // [ nil, // ] - shift(57), // { + shift(62), // { nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S56 + actionRow{ // S61 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; - shift(59), // regDefId + shift(64), // regDefId nil, // ignoredTokId nil, // | - shift(62), // . - shift(63), // char_lit - shift(64), // ~ + shift(67), // . + shift(68), // char_lit nil, // - - shift(65), // ( + shift(69), // ~ + shift(70), // ( nil, // ) - shift(66), // [ + shift(71), // [ nil, // ] - shift(67), // { + shift(72), // { nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S57 + actionRow{ // S62 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; - shift(69), // regDefId + shift(74), // regDefId nil, // ignoredTokId nil, // | - shift(72), // . - shift(73), // char_lit - shift(74), // ~ + shift(77), // . + shift(78), // char_lit nil, // - - shift(75), // ( + shift(79), // ~ + shift(80), // ( nil, // ) - shift(76), // [ + shift(81), // [ nil, // ] - shift(77), // { + shift(82), // { nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S58 + actionRow{ // S63 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ - nil, // tokId - nil, // : - nil, // ; - nil, // regDefId - nil, // ignoredTokId - shift(97), // | - nil, // . - nil, // char_lit - nil, // ~ - nil, // - - nil, // ( - nil, // ) - nil, // [ - shift(98), // ] - nil, // { - nil, // } - nil, // g_sdt_lit - nil, // prodId - nil, // error - nil, // empty - nil, // string_lit + nil, // + nil, // Ω + nil, // tokId + nil, // : + nil, // ; + nil, // regDefId + nil, // ignoredTokId + shift(103), // | + nil, // . + nil, // char_lit + nil, // - + nil, // ~ + nil, // ( + nil, // ) + nil, // [ + shift(104), // ] + nil, // { + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S59 + actionRow{ // S64 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; @@ -1676,8 +1944,8 @@ var actionTab = actionTable{ reduce(19), // |, reduce: LexTerm reduce(19), // ., reduce: LexTerm reduce(19), // char_lit, reduce: LexTerm - reduce(19), // ~, reduce: LexTerm nil, // - + reduce(19), // ~, reduce: LexTerm reduce(19), // (, reduce: LexTerm nil, // ) reduce(19), // [, reduce: LexTerm @@ -1686,44 +1954,48 @@ var actionTab = actionTable{ nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S60 + actionRow{ // S65 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; - shift(59), // regDefId + shift(64), // regDefId nil, // ignoredTokId reduce(10), // |, reduce: LexPattern - shift(62), // . - shift(63), // char_lit - shift(64), // ~ + shift(67), // . + shift(68), // char_lit nil, // - - shift(65), // ( + shift(69), // ~ + shift(70), // ( nil, // ) - shift(66), // [ + shift(71), // [ reduce(10), // ], reduce: LexPattern - shift(67), // { + shift(72), // { nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S61 + actionRow{ // S66 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; @@ -1732,8 +2004,8 @@ var actionTab = actionTable{ reduce(12), // |, reduce: LexAlt reduce(12), // ., reduce: LexAlt reduce(12), // char_lit, reduce: LexAlt - reduce(12), // ~, reduce: LexAlt nil, // - + reduce(12), // ~, reduce: LexAlt reduce(12), // (, reduce: LexAlt nil, // ) reduce(12), // [, reduce: LexAlt @@ -1742,16 +2014,18 @@ var actionTab = actionTable{ nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S62 + actionRow{ // S67 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; @@ -1760,8 +2034,8 @@ var actionTab = actionTable{ reduce(14), // |, reduce: LexTerm reduce(14), // ., reduce: LexTerm reduce(14), // char_lit, reduce: LexTerm - reduce(14), // ~, reduce: LexTerm nil, // - + reduce(14), // ~, reduce: LexTerm reduce(14), // (, reduce: LexTerm nil, // ) reduce(14), // [, reduce: LexTerm @@ -1770,16 +2044,18 @@ var actionTab = actionTable{ nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S63 + actionRow{ // S68 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; @@ -1788,8 +2064,8 @@ var actionTab = actionTable{ reduce(15), // |, reduce: LexTerm reduce(15), // ., reduce: LexTerm reduce(15), // char_lit, reduce: LexTerm + shift(106), // - reduce(15), // ~, reduce: LexTerm - shift(100), // - reduce(15), // (, reduce: LexTerm nil, // ) reduce(15), // [, reduce: LexTerm @@ -1798,16 +2074,18 @@ var actionTab = actionTable{ nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S64 + actionRow{ // S69 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; @@ -1815,10 +2093,10 @@ var actionTab = actionTable{ nil, // ignoredTokId nil, // | nil, // . - shift(101), // char_lit - nil, // ~ + shift(107), // char_lit nil, // - - shift(102), // ( + nil, // ~ + shift(108), // ( nil, // ) nil, // [ nil, // ] @@ -1826,128 +2104,138 @@ var actionTab = actionTable{ nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S65 + actionRow{ // S70 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; - shift(49), // regDefId + shift(54), // regDefId nil, // ignoredTokId nil, // | - shift(52), // . - shift(53), // char_lit - shift(54), // ~ + shift(57), // . + shift(58), // char_lit nil, // - - shift(55), // ( + shift(59), // ~ + shift(60), // ( nil, // ) - shift(56), // [ + shift(61), // [ nil, // ] - shift(57), // { + shift(62), // { nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S66 + actionRow{ // S71 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; - shift(59), // regDefId + shift(64), // regDefId nil, // ignoredTokId nil, // | - shift(62), // . - shift(63), // char_lit - shift(64), // ~ + shift(67), // . + shift(68), // char_lit nil, // - - shift(65), // ( + shift(69), // ~ + shift(70), // ( nil, // ) - shift(66), // [ + shift(71), // [ nil, // ] - shift(67), // { + shift(72), // { nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S67 + actionRow{ // S72 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; - shift(69), // regDefId + shift(74), // regDefId nil, // ignoredTokId nil, // | - shift(72), // . - shift(73), // char_lit - shift(74), // ~ + shift(77), // . + shift(78), // char_lit nil, // - - shift(75), // ( + shift(79), // ~ + shift(80), // ( nil, // ) - shift(76), // [ + shift(81), // [ nil, // ] - shift(77), // { + shift(82), // { nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S68 + actionRow{ // S73 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; nil, // regDefId nil, // ignoredTokId - shift(106), // | + shift(112), // | nil, // . nil, // char_lit - nil, // ~ nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ nil, // ] nil, // { - shift(107), // } + shift(113), // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S69 + actionRow{ // S74 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; @@ -1956,8 +2244,8 @@ var actionTab = actionTable{ reduce(19), // |, reduce: LexTerm reduce(19), // ., reduce: LexTerm reduce(19), // char_lit, reduce: LexTerm - reduce(19), // ~, reduce: LexTerm nil, // - + reduce(19), // ~, reduce: LexTerm reduce(19), // (, reduce: LexTerm nil, // ) reduce(19), // [, reduce: LexTerm @@ -1966,44 +2254,48 @@ var actionTab = actionTable{ reduce(19), // }, reduce: LexTerm nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S70 + actionRow{ // S75 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; - shift(69), // regDefId + shift(74), // regDefId nil, // ignoredTokId reduce(10), // |, reduce: LexPattern - shift(72), // . - shift(73), // char_lit - shift(74), // ~ + shift(77), // . + shift(78), // char_lit nil, // - - shift(75), // ( + shift(79), // ~ + shift(80), // ( nil, // ) - shift(76), // [ + shift(81), // [ nil, // ] - shift(77), // { + shift(82), // { reduce(10), // }, reduce: LexPattern nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S71 + actionRow{ // S76 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; @@ -2012,8 +2304,8 @@ var actionTab = actionTable{ reduce(12), // |, reduce: LexAlt reduce(12), // ., reduce: LexAlt reduce(12), // char_lit, reduce: LexAlt - reduce(12), // ~, reduce: LexAlt nil, // - + reduce(12), // ~, reduce: LexAlt reduce(12), // (, reduce: LexAlt nil, // ) reduce(12), // [, reduce: LexAlt @@ -2022,16 +2314,18 @@ var actionTab = actionTable{ reduce(12), // }, reduce: LexAlt nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S72 + actionRow{ // S77 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; @@ -2040,8 +2334,8 @@ var actionTab = actionTable{ reduce(14), // |, reduce: LexTerm reduce(14), // ., reduce: LexTerm reduce(14), // char_lit, reduce: LexTerm - reduce(14), // ~, reduce: LexTerm nil, // - + reduce(14), // ~, reduce: LexTerm reduce(14), // (, reduce: LexTerm nil, // ) reduce(14), // [, reduce: LexTerm @@ -2050,16 +2344,18 @@ var actionTab = actionTable{ reduce(14), // }, reduce: LexTerm nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S73 + actionRow{ // S78 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; @@ -2068,8 +2364,8 @@ var actionTab = actionTable{ reduce(15), // |, reduce: LexTerm reduce(15), // ., reduce: LexTerm reduce(15), // char_lit, reduce: LexTerm + shift(115), // - reduce(15), // ~, reduce: LexTerm - shift(109), // - reduce(15), // (, reduce: LexTerm nil, // ) reduce(15), // [, reduce: LexTerm @@ -2078,16 +2374,18 @@ var actionTab = actionTable{ reduce(15), // }, reduce: LexTerm nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S74 + actionRow{ // S79 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; @@ -2095,10 +2393,10 @@ var actionTab = actionTable{ nil, // ignoredTokId nil, // | nil, // . - shift(110), // char_lit - nil, // ~ + shift(116), // char_lit nil, // - - shift(111), // ( + nil, // ~ + shift(117), // ( nil, // ) nil, // [ nil, // ] @@ -2106,100 +2404,108 @@ var actionTab = actionTable{ nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S75 + actionRow{ // S80 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; - shift(49), // regDefId + shift(54), // regDefId nil, // ignoredTokId nil, // | - shift(52), // . - shift(53), // char_lit - shift(54), // ~ + shift(57), // . + shift(58), // char_lit nil, // - - shift(55), // ( + shift(59), // ~ + shift(60), // ( nil, // ) - shift(56), // [ + shift(61), // [ nil, // ] - shift(57), // { + shift(62), // { nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S76 + actionRow{ // S81 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; - shift(59), // regDefId + shift(64), // regDefId nil, // ignoredTokId nil, // | - shift(62), // . - shift(63), // char_lit - shift(64), // ~ + shift(67), // . + shift(68), // char_lit nil, // - - shift(65), // ( + shift(69), // ~ + shift(70), // ( nil, // ) - shift(66), // [ + shift(71), // [ nil, // ] - shift(67), // { + shift(72), // { nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S77 + actionRow{ // S82 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; - shift(69), // regDefId + shift(74), // regDefId nil, // ignoredTokId nil, // | - shift(72), // . - shift(73), // char_lit - shift(74), // ~ + shift(77), // . + shift(78), // char_lit nil, // - - shift(75), // ( + shift(79), // ~ + shift(80), // ( nil, // ) - shift(76), // [ + shift(81), // [ nil, // ] - shift(77), // { + shift(82), // { nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S78 + actionRow{ // S83 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - reduce(8), // $, reduce: LexProduction + nil, // + reduce(8), // Ω, reduce: LexProduction reduce(8), // tokId, reduce: LexProduction nil, // : nil, // ; @@ -2208,8 +2514,8 @@ var actionTab = actionTable{ nil, // | nil, // . nil, // char_lit - nil, // ~ nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -2218,16 +2524,18 @@ var actionTab = actionTable{ nil, // } reduce(8), // g_sdt_lit, reduce: LexProduction reduce(8), // prodId, reduce: LexProduction - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S79 + actionRow{ // S84 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - reduce(9), // $, reduce: LexProduction + nil, // + reduce(9), // Ω, reduce: LexProduction reduce(9), // tokId, reduce: LexProduction nil, // : nil, // ; @@ -2236,8 +2544,8 @@ var actionTab = actionTable{ nil, // | nil, // . nil, // char_lit - nil, // ~ nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -2246,16 +2554,18 @@ var actionTab = actionTable{ nil, // } reduce(9), // g_sdt_lit, reduce: LexProduction reduce(9), // prodId, reduce: LexProduction - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S80 + actionRow{ // S85 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - reduce(28), // $, reduce: SyntaxProduction + nil, // + reduce(28), // Ω, reduce: SyntaxProduction nil, // tokId nil, // : nil, // ; @@ -2264,8 +2574,8 @@ var actionTab = actionTable{ nil, // | nil, // . nil, // char_lit - nil, // ~ nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -2274,26 +2584,58 @@ var actionTab = actionTable{ nil, // } nil, // g_sdt_lit reduce(28), // prodId, reduce: SyntaxProduction - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S81 - canRecover: true, + actionRow{ // S86 + canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ - shift(34), // tokId + nil, // + nil, // Ω + shift(34), // tokId + nil, // : + nil, // ; + nil, // regDefId + nil, // ignoredTokId + nil, // | + nil, // . + nil, // char_lit + nil, // - + nil, // ~ + nil, // ( + nil, // ) + nil, // [ + nil, // ] + nil, // { + nil, // } + nil, // g_sdt_lit + shift(35), // prodId + shift(42), // string_lit + shift(43), // errore + shift(44), // λ + shift(45), // empty + shift(46), // ε + }, + }, + actionRow{ // S87 + canRecover: false, + actions: [numSymbols]action{ + nil, // + nil, // Ω + nil, // tokId nil, // : - reduce(36), // ;, reduce: SyntaxBody + reduce(32), // ;, reduce: SyntaxBody nil, // regDefId nil, // ignoredTokId - reduce(36), // |, reduce: SyntaxBody + reduce(32), // |, reduce: SyntaxBody nil, // . nil, // char_lit - nil, // ~ nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -2301,73 +2643,79 @@ var actionTab = actionTable{ nil, // { nil, // } nil, // g_sdt_lit - shift(35), // prodId - shift(39), // error + nil, // prodId + nil, // string_lit + nil, // errore + nil, // λ nil, // empty - shift(41), // string_lit + nil, // ε }, }, - actionRow{ // S82 + actionRow{ // S88 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ - nil, // tokId + nil, // + nil, // Ω + reduce(39), // tokId, reduce: Symbols nil, // : - reduce(32), // ;, reduce: SyntaxBody + reduce(39), // ;, reduce: Symbols nil, // regDefId nil, // ignoredTokId - reduce(32), // |, reduce: SyntaxBody + reduce(39), // |, reduce: Symbols nil, // . nil, // char_lit - nil, // ~ nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ nil, // ] nil, // { nil, // } - nil, // g_sdt_lit - nil, // prodId - nil, // error + reduce(39), // g_sdt_lit, reduce: Symbols + reduce(39), // prodId, reduce: Symbols + reduce(39), // string_lit, reduce: Symbols + nil, // errore + nil, // λ nil, // empty - nil, // string_lit + nil, // ε }, }, - actionRow{ // S83 + actionRow{ // S89 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ - reduce(38), // tokId, reduce: Symbols + nil, // + nil, // Ω + nil, // tokId nil, // : - reduce(38), // ;, reduce: Symbols + reduce(36), // ;, reduce: SyntaxBody nil, // regDefId nil, // ignoredTokId - reduce(38), // |, reduce: Symbols + reduce(36), // |, reduce: SyntaxBody nil, // . nil, // char_lit - nil, // ~ nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ nil, // ] nil, // { nil, // } - reduce(38), // g_sdt_lit, reduce: Symbols - reduce(38), // prodId, reduce: Symbols - nil, // error + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // errore + nil, // λ nil, // empty - reduce(38), // string_lit, reduce: Symbols + nil, // ε }, }, - actionRow{ // S84 - canRecover: true, + actionRow{ // S90 + canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω shift(34), // tokId nil, // : reduce(34), // ;, reduce: SyntaxBody @@ -2376,26 +2724,28 @@ var actionTab = actionTable{ reduce(34), // |, reduce: SyntaxBody nil, // . nil, // char_lit - nil, // ~ nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ nil, // ] nil, // { nil, // } - shift(116), // g_sdt_lit + shift(122), // g_sdt_lit shift(35), // prodId - nil, // error + shift(42), // string_lit + nil, // errore + nil, // λ nil, // empty - shift(41), // string_lit + nil, // ε }, }, - actionRow{ // S85 + actionRow{ // S91 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : reduce(11), // ;, reduce: LexPattern @@ -2404,8 +2754,8 @@ var actionTab = actionTable{ reduce(11), // |, reduce: LexPattern shift(26), // . shift(27), // char_lit - shift(28), // ~ nil, // - + shift(28), // ~ shift(29), // ( nil, // ) shift(30), // [ @@ -2414,44 +2764,48 @@ var actionTab = actionTable{ nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S86 + actionRow{ // S92 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : - reduce(17), // ;, reduce: LexTerm - reduce(17), // regDefId, reduce: LexTerm + reduce(16), // ;, reduce: LexTerm + reduce(16), // regDefId, reduce: LexTerm nil, // ignoredTokId - reduce(17), // |, reduce: LexTerm - reduce(17), // ., reduce: LexTerm - reduce(17), // char_lit, reduce: LexTerm - reduce(17), // ~, reduce: LexTerm + reduce(16), // |, reduce: LexTerm + reduce(16), // ., reduce: LexTerm + reduce(16), // char_lit, reduce: LexTerm nil, // - - reduce(17), // (, reduce: LexTerm + reduce(16), // ~, reduce: LexTerm + reduce(16), // (, reduce: LexTerm nil, // ) - reduce(17), // [, reduce: LexTerm + reduce(16), // [, reduce: LexTerm nil, // ] - reduce(17), // {, reduce: LexTerm + reduce(16), // {, reduce: LexTerm nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S87 + actionRow{ // S93 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; @@ -2460,8 +2814,8 @@ var actionTab = actionTable{ nil, // | nil, // . nil, // char_lit + shift(123), // - nil, // ~ - shift(117), // - nil, // ( nil, // ) nil, // [ @@ -2470,44 +2824,48 @@ var actionTab = actionTable{ nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S88 + actionRow{ // S94 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; - shift(49), // regDefId + shift(54), // regDefId nil, // ignoredTokId nil, // | - shift(52), // . - shift(53), // char_lit - shift(54), // ~ + shift(57), // . + shift(58), // char_lit nil, // - - shift(55), // ( + shift(59), // ~ + shift(60), // ( nil, // ) - shift(56), // [ + shift(61), // [ nil, // ] - shift(57), // { + shift(62), // { nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S89 + actionRow{ // S95 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : reduce(22), // ;, reduce: LexTerm @@ -2516,8 +2874,8 @@ var actionTab = actionTable{ reduce(22), // |, reduce: LexTerm reduce(22), // ., reduce: LexTerm reduce(22), // char_lit, reduce: LexTerm - reduce(22), // ~, reduce: LexTerm nil, // - + reduce(22), // ~, reduce: LexTerm reduce(22), // (, reduce: LexTerm nil, // ) reduce(22), // [, reduce: LexTerm @@ -2526,16 +2884,18 @@ var actionTab = actionTable{ nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S90 + actionRow{ // S96 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; @@ -2544,8 +2904,8 @@ var actionTab = actionTable{ reduce(13), // |, reduce: LexAlt reduce(13), // ., reduce: LexAlt reduce(13), // char_lit, reduce: LexAlt - reduce(13), // ~, reduce: LexAlt nil, // - + reduce(13), // ~, reduce: LexAlt reduce(13), // (, reduce: LexAlt reduce(13), // ), reduce: LexAlt reduce(13), // [, reduce: LexAlt @@ -2554,16 +2914,18 @@ var actionTab = actionTable{ nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S91 + actionRow{ // S97 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; @@ -2571,9 +2933,9 @@ var actionTab = actionTable{ nil, // ignoredTokId nil, // | nil, // . - shift(119), // char_lit - nil, // ~ + shift(125), // char_lit nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -2582,44 +2944,48 @@ var actionTab = actionTable{ nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S92 + actionRow{ // S98 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; - reduce(16), // regDefId, reduce: LexTerm + reduce(17), // regDefId, reduce: LexTerm nil, // ignoredTokId - reduce(16), // |, reduce: LexTerm - reduce(16), // ., reduce: LexTerm - reduce(16), // char_lit, reduce: LexTerm - reduce(16), // ~, reduce: LexTerm + reduce(17), // |, reduce: LexTerm + reduce(17), // ., reduce: LexTerm + reduce(17), // char_lit, reduce: LexTerm nil, // - - reduce(16), // (, reduce: LexTerm - reduce(16), // ), reduce: LexTerm - reduce(16), // [, reduce: LexTerm + reduce(17), // ~, reduce: LexTerm + reduce(17), // (, reduce: LexTerm + reduce(17), // ), reduce: LexTerm + reduce(17), // [, reduce: LexTerm nil, // ] - reduce(16), // {, reduce: LexTerm + reduce(17), // {, reduce: LexTerm nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S93 + actionRow{ // S99 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; @@ -2627,9 +2993,9 @@ var actionTab = actionTable{ nil, // ignoredTokId nil, // | nil, // . - shift(120), // char_lit - nil, // ~ + shift(126), // char_lit nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -2638,128 +3004,138 @@ var actionTab = actionTable{ nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S94 + actionRow{ // S100 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; nil, // regDefId nil, // ignoredTokId - shift(88), // | + shift(94), // | nil, // . nil, // char_lit - nil, // ~ nil, // - + nil, // ~ nil, // ( - shift(121), // ) + shift(127), // ) nil, // [ nil, // ] nil, // { nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S95 + actionRow{ // S101 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; nil, // regDefId nil, // ignoredTokId - shift(97), // | + shift(103), // | nil, // . nil, // char_lit - nil, // ~ nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ - shift(122), // ] + shift(128), // ] nil, // { nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S96 + actionRow{ // S102 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; nil, // regDefId nil, // ignoredTokId - shift(106), // | + shift(112), // | nil, // . nil, // char_lit - nil, // ~ nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ nil, // ] nil, // { - shift(123), // } + shift(129), // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S97 + actionRow{ // S103 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; - shift(59), // regDefId + shift(64), // regDefId nil, // ignoredTokId nil, // | - shift(62), // . - shift(63), // char_lit - shift(64), // ~ + shift(67), // . + shift(68), // char_lit nil, // - - shift(65), // ( + shift(69), // ~ + shift(70), // ( nil, // ) - shift(66), // [ + shift(71), // [ nil, // ] - shift(67), // { + shift(72), // { nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S98 + actionRow{ // S104 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : reduce(20), // ;, reduce: LexTerm @@ -2768,8 +3144,8 @@ var actionTab = actionTable{ reduce(20), // |, reduce: LexTerm reduce(20), // ., reduce: LexTerm reduce(20), // char_lit, reduce: LexTerm - reduce(20), // ~, reduce: LexTerm nil, // - + reduce(20), // ~, reduce: LexTerm reduce(20), // (, reduce: LexTerm nil, // ) reduce(20), // [, reduce: LexTerm @@ -2778,16 +3154,18 @@ var actionTab = actionTable{ nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S99 + actionRow{ // S105 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; @@ -2796,8 +3174,8 @@ var actionTab = actionTable{ reduce(13), // |, reduce: LexAlt reduce(13), // ., reduce: LexAlt reduce(13), // char_lit, reduce: LexAlt - reduce(13), // ~, reduce: LexAlt nil, // - + reduce(13), // ~, reduce: LexAlt reduce(13), // (, reduce: LexAlt nil, // ) reduce(13), // [, reduce: LexAlt @@ -2806,16 +3184,18 @@ var actionTab = actionTable{ nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S100 + actionRow{ // S106 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; @@ -2823,9 +3203,9 @@ var actionTab = actionTable{ nil, // ignoredTokId nil, // | nil, // . - shift(125), // char_lit - nil, // ~ + shift(131), // char_lit nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -2834,44 +3214,48 @@ var actionTab = actionTable{ nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S101 + actionRow{ // S107 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; - reduce(16), // regDefId, reduce: LexTerm + reduce(17), // regDefId, reduce: LexTerm nil, // ignoredTokId - reduce(16), // |, reduce: LexTerm - reduce(16), // ., reduce: LexTerm - reduce(16), // char_lit, reduce: LexTerm - reduce(16), // ~, reduce: LexTerm + reduce(17), // |, reduce: LexTerm + reduce(17), // ., reduce: LexTerm + reduce(17), // char_lit, reduce: LexTerm nil, // - - reduce(16), // (, reduce: LexTerm + reduce(17), // ~, reduce: LexTerm + reduce(17), // (, reduce: LexTerm nil, // ) - reduce(16), // [, reduce: LexTerm - reduce(16), // ], reduce: LexTerm - reduce(16), // {, reduce: LexTerm + reduce(17), // [, reduce: LexTerm + reduce(17), // ], reduce: LexTerm + reduce(17), // {, reduce: LexTerm nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S102 + actionRow{ // S108 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; @@ -2879,9 +3263,9 @@ var actionTab = actionTable{ nil, // ignoredTokId nil, // | nil, // . - shift(126), // char_lit - nil, // ~ + shift(132), // char_lit nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -2890,128 +3274,138 @@ var actionTab = actionTable{ nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S103 + actionRow{ // S109 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; nil, // regDefId nil, // ignoredTokId - shift(88), // | + shift(94), // | nil, // . nil, // char_lit - nil, // ~ nil, // - + nil, // ~ nil, // ( - shift(127), // ) + shift(133), // ) nil, // [ nil, // ] nil, // { nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S104 + actionRow{ // S110 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; nil, // regDefId nil, // ignoredTokId - shift(97), // | + shift(103), // | nil, // . nil, // char_lit - nil, // ~ nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ - shift(128), // ] + shift(134), // ] nil, // { nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S105 + actionRow{ // S111 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; nil, // regDefId nil, // ignoredTokId - shift(106), // | + shift(112), // | nil, // . nil, // char_lit - nil, // ~ nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ nil, // ] nil, // { - shift(129), // } + shift(135), // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S106 + actionRow{ // S112 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; - shift(69), // regDefId + shift(74), // regDefId nil, // ignoredTokId nil, // | - shift(72), // . - shift(73), // char_lit - shift(74), // ~ + shift(77), // . + shift(78), // char_lit nil, // - - shift(75), // ( + shift(79), // ~ + shift(80), // ( nil, // ) - shift(76), // [ + shift(81), // [ nil, // ] - shift(77), // { + shift(82), // { nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S107 + actionRow{ // S113 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : reduce(21), // ;, reduce: LexTerm @@ -3020,8 +3414,8 @@ var actionTab = actionTable{ reduce(21), // |, reduce: LexTerm reduce(21), // ., reduce: LexTerm reduce(21), // char_lit, reduce: LexTerm - reduce(21), // ~, reduce: LexTerm nil, // - + reduce(21), // ~, reduce: LexTerm reduce(21), // (, reduce: LexTerm nil, // ) reduce(21), // [, reduce: LexTerm @@ -3030,16 +3424,18 @@ var actionTab = actionTable{ nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S108 + actionRow{ // S114 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; @@ -3048,8 +3444,8 @@ var actionTab = actionTable{ reduce(13), // |, reduce: LexAlt reduce(13), // ., reduce: LexAlt reduce(13), // char_lit, reduce: LexAlt - reduce(13), // ~, reduce: LexAlt nil, // - + reduce(13), // ~, reduce: LexAlt reduce(13), // (, reduce: LexAlt nil, // ) reduce(13), // [, reduce: LexAlt @@ -3058,16 +3454,18 @@ var actionTab = actionTable{ reduce(13), // }, reduce: LexAlt nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S109 + actionRow{ // S115 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; @@ -3075,9 +3473,9 @@ var actionTab = actionTable{ nil, // ignoredTokId nil, // | nil, // . - shift(131), // char_lit - nil, // ~ + shift(137), // char_lit nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -3086,44 +3484,48 @@ var actionTab = actionTable{ nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S110 + actionRow{ // S116 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; - reduce(16), // regDefId, reduce: LexTerm + reduce(17), // regDefId, reduce: LexTerm nil, // ignoredTokId - reduce(16), // |, reduce: LexTerm - reduce(16), // ., reduce: LexTerm - reduce(16), // char_lit, reduce: LexTerm - reduce(16), // ~, reduce: LexTerm + reduce(17), // |, reduce: LexTerm + reduce(17), // ., reduce: LexTerm + reduce(17), // char_lit, reduce: LexTerm nil, // - - reduce(16), // (, reduce: LexTerm + reduce(17), // ~, reduce: LexTerm + reduce(17), // (, reduce: LexTerm nil, // ) - reduce(16), // [, reduce: LexTerm + reduce(17), // [, reduce: LexTerm nil, // ] - reduce(16), // {, reduce: LexTerm - reduce(16), // }, reduce: LexTerm + reduce(17), // {, reduce: LexTerm + reduce(17), // }, reduce: LexTerm nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S111 + actionRow{ // S117 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; @@ -3131,9 +3533,9 @@ var actionTab = actionTable{ nil, // ignoredTokId nil, // | nil, // . - shift(132), // char_lit - nil, // ~ + shift(138), // char_lit nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -3142,100 +3544,108 @@ var actionTab = actionTable{ nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S112 + actionRow{ // S118 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; nil, // regDefId nil, // ignoredTokId - shift(88), // | + shift(94), // | nil, // . nil, // char_lit - nil, // ~ nil, // - + nil, // ~ nil, // ( - shift(133), // ) + shift(139), // ) nil, // [ nil, // ] nil, // { nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S113 + actionRow{ // S119 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; nil, // regDefId nil, // ignoredTokId - shift(97), // | + shift(103), // | nil, // . nil, // char_lit - nil, // ~ nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ - shift(134), // ] + shift(140), // ] nil, // { nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S114 + actionRow{ // S120 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; nil, // regDefId nil, // ignoredTokId - shift(106), // | + shift(112), // | nil, // . nil, // char_lit - nil, // ~ nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ nil, // ] nil, // { - shift(135), // } + shift(141), // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S115 + actionRow{ // S121 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : reduce(30), // ;, reduce: Alternatives @@ -3244,8 +3654,8 @@ var actionTab = actionTable{ reduce(30), // |, reduce: Alternatives nil, // . nil, // char_lit - nil, // ~ nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -3254,16 +3664,18 @@ var actionTab = actionTable{ nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S116 - canRecover: true, + actionRow{ // S122 + canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : reduce(35), // ;, reduce: SyntaxBody @@ -3272,8 +3684,8 @@ var actionTab = actionTable{ reduce(35), // |, reduce: SyntaxBody nil, // . nil, // char_lit - nil, // ~ nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -3282,16 +3694,18 @@ var actionTab = actionTable{ nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S117 + actionRow{ // S123 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; @@ -3299,9 +3713,9 @@ var actionTab = actionTable{ nil, // ignoredTokId nil, // | nil, // . - shift(136), // char_lit - nil, // ~ + shift(142), // char_lit nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -3310,72 +3724,78 @@ var actionTab = actionTable{ nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S118 + actionRow{ // S124 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; - shift(49), // regDefId + shift(54), // regDefId nil, // ignoredTokId reduce(11), // |, reduce: LexPattern - shift(52), // . - shift(53), // char_lit - shift(54), // ~ + shift(57), // . + shift(58), // char_lit nil, // - - shift(55), // ( + shift(59), // ~ + shift(60), // ( reduce(11), // ), reduce: LexPattern - shift(56), // [ + shift(61), // [ nil, // ] - shift(57), // { + shift(62), // { nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S119 + actionRow{ // S125 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; - reduce(17), // regDefId, reduce: LexTerm + reduce(16), // regDefId, reduce: LexTerm nil, // ignoredTokId - reduce(17), // |, reduce: LexTerm - reduce(17), // ., reduce: LexTerm - reduce(17), // char_lit, reduce: LexTerm - reduce(17), // ~, reduce: LexTerm + reduce(16), // |, reduce: LexTerm + reduce(16), // ., reduce: LexTerm + reduce(16), // char_lit, reduce: LexTerm nil, // - - reduce(17), // (, reduce: LexTerm - reduce(17), // ), reduce: LexTerm - reduce(17), // [, reduce: LexTerm + reduce(16), // ~, reduce: LexTerm + reduce(16), // (, reduce: LexTerm + reduce(16), // ), reduce: LexTerm + reduce(16), // [, reduce: LexTerm nil, // ] - reduce(17), // {, reduce: LexTerm + reduce(16), // {, reduce: LexTerm nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S120 + actionRow{ // S126 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; @@ -3384,8 +3804,8 @@ var actionTab = actionTable{ nil, // | nil, // . nil, // char_lit + shift(143), // - nil, // ~ - shift(137), // - nil, // ( nil, // ) nil, // [ @@ -3394,16 +3814,18 @@ var actionTab = actionTable{ nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S121 + actionRow{ // S127 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; @@ -3412,8 +3834,8 @@ var actionTab = actionTable{ reduce(22), // |, reduce: LexTerm reduce(22), // ., reduce: LexTerm reduce(22), // char_lit, reduce: LexTerm - reduce(22), // ~, reduce: LexTerm nil, // - + reduce(22), // ~, reduce: LexTerm reduce(22), // (, reduce: LexTerm reduce(22), // ), reduce: LexTerm reduce(22), // [, reduce: LexTerm @@ -3422,16 +3844,18 @@ var actionTab = actionTable{ nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S122 + actionRow{ // S128 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; @@ -3440,8 +3864,8 @@ var actionTab = actionTable{ reduce(20), // |, reduce: LexTerm reduce(20), // ., reduce: LexTerm reduce(20), // char_lit, reduce: LexTerm - reduce(20), // ~, reduce: LexTerm nil, // - + reduce(20), // ~, reduce: LexTerm reduce(20), // (, reduce: LexTerm reduce(20), // ), reduce: LexTerm reduce(20), // [, reduce: LexTerm @@ -3450,16 +3874,18 @@ var actionTab = actionTable{ nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S123 + actionRow{ // S129 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; @@ -3468,8 +3894,8 @@ var actionTab = actionTable{ reduce(21), // |, reduce: LexTerm reduce(21), // ., reduce: LexTerm reduce(21), // char_lit, reduce: LexTerm - reduce(21), // ~, reduce: LexTerm nil, // - + reduce(21), // ~, reduce: LexTerm reduce(21), // (, reduce: LexTerm reduce(21), // ), reduce: LexTerm reduce(21), // [, reduce: LexTerm @@ -3478,72 +3904,78 @@ var actionTab = actionTable{ nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S124 + actionRow{ // S130 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; - shift(59), // regDefId + shift(64), // regDefId nil, // ignoredTokId reduce(11), // |, reduce: LexPattern - shift(62), // . - shift(63), // char_lit - shift(64), // ~ + shift(67), // . + shift(68), // char_lit nil, // - - shift(65), // ( + shift(69), // ~ + shift(70), // ( nil, // ) - shift(66), // [ + shift(71), // [ reduce(11), // ], reduce: LexPattern - shift(67), // { + shift(72), // { nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S125 + actionRow{ // S131 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; - reduce(17), // regDefId, reduce: LexTerm + reduce(16), // regDefId, reduce: LexTerm nil, // ignoredTokId - reduce(17), // |, reduce: LexTerm - reduce(17), // ., reduce: LexTerm - reduce(17), // char_lit, reduce: LexTerm - reduce(17), // ~, reduce: LexTerm + reduce(16), // |, reduce: LexTerm + reduce(16), // ., reduce: LexTerm + reduce(16), // char_lit, reduce: LexTerm nil, // - - reduce(17), // (, reduce: LexTerm + reduce(16), // ~, reduce: LexTerm + reduce(16), // (, reduce: LexTerm nil, // ) - reduce(17), // [, reduce: LexTerm - reduce(17), // ], reduce: LexTerm - reduce(17), // {, reduce: LexTerm + reduce(16), // [, reduce: LexTerm + reduce(16), // ], reduce: LexTerm + reduce(16), // {, reduce: LexTerm nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S126 + actionRow{ // S132 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; @@ -3552,8 +3984,8 @@ var actionTab = actionTable{ nil, // | nil, // . nil, // char_lit + shift(144), // - nil, // ~ - shift(138), // - nil, // ( nil, // ) nil, // [ @@ -3562,16 +3994,18 @@ var actionTab = actionTable{ nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S127 + actionRow{ // S133 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; @@ -3580,8 +4014,8 @@ var actionTab = actionTable{ reduce(22), // |, reduce: LexTerm reduce(22), // ., reduce: LexTerm reduce(22), // char_lit, reduce: LexTerm - reduce(22), // ~, reduce: LexTerm nil, // - + reduce(22), // ~, reduce: LexTerm reduce(22), // (, reduce: LexTerm nil, // ) reduce(22), // [, reduce: LexTerm @@ -3590,16 +4024,18 @@ var actionTab = actionTable{ nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S128 + actionRow{ // S134 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; @@ -3608,8 +4044,8 @@ var actionTab = actionTable{ reduce(20), // |, reduce: LexTerm reduce(20), // ., reduce: LexTerm reduce(20), // char_lit, reduce: LexTerm - reduce(20), // ~, reduce: LexTerm nil, // - + reduce(20), // ~, reduce: LexTerm reduce(20), // (, reduce: LexTerm nil, // ) reduce(20), // [, reduce: LexTerm @@ -3618,16 +4054,18 @@ var actionTab = actionTable{ nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S129 + actionRow{ // S135 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; @@ -3636,8 +4074,8 @@ var actionTab = actionTable{ reduce(21), // |, reduce: LexTerm reduce(21), // ., reduce: LexTerm reduce(21), // char_lit, reduce: LexTerm - reduce(21), // ~, reduce: LexTerm nil, // - + reduce(21), // ~, reduce: LexTerm reduce(21), // (, reduce: LexTerm nil, // ) reduce(21), // [, reduce: LexTerm @@ -3646,72 +4084,78 @@ var actionTab = actionTable{ nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S130 + actionRow{ // S136 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; - shift(69), // regDefId + shift(74), // regDefId nil, // ignoredTokId reduce(11), // |, reduce: LexPattern - shift(72), // . - shift(73), // char_lit - shift(74), // ~ + shift(77), // . + shift(78), // char_lit nil, // - - shift(75), // ( + shift(79), // ~ + shift(80), // ( nil, // ) - shift(76), // [ + shift(81), // [ nil, // ] - shift(77), // { + shift(82), // { reduce(11), // }, reduce: LexPattern nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S131 + actionRow{ // S137 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; - reduce(17), // regDefId, reduce: LexTerm + reduce(16), // regDefId, reduce: LexTerm nil, // ignoredTokId - reduce(17), // |, reduce: LexTerm - reduce(17), // ., reduce: LexTerm - reduce(17), // char_lit, reduce: LexTerm - reduce(17), // ~, reduce: LexTerm + reduce(16), // |, reduce: LexTerm + reduce(16), // ., reduce: LexTerm + reduce(16), // char_lit, reduce: LexTerm nil, // - - reduce(17), // (, reduce: LexTerm + reduce(16), // ~, reduce: LexTerm + reduce(16), // (, reduce: LexTerm nil, // ) - reduce(17), // [, reduce: LexTerm + reduce(16), // [, reduce: LexTerm nil, // ] - reduce(17), // {, reduce: LexTerm - reduce(17), // }, reduce: LexTerm + reduce(16), // {, reduce: LexTerm + reduce(16), // }, reduce: LexTerm nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S132 + actionRow{ // S138 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; @@ -3720,8 +4164,8 @@ var actionTab = actionTable{ nil, // | nil, // . nil, // char_lit + shift(145), // - nil, // ~ - shift(139), // - nil, // ( nil, // ) nil, // [ @@ -3730,16 +4174,18 @@ var actionTab = actionTable{ nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S133 + actionRow{ // S139 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; @@ -3748,8 +4194,8 @@ var actionTab = actionTable{ reduce(22), // |, reduce: LexTerm reduce(22), // ., reduce: LexTerm reduce(22), // char_lit, reduce: LexTerm - reduce(22), // ~, reduce: LexTerm nil, // - + reduce(22), // ~, reduce: LexTerm reduce(22), // (, reduce: LexTerm nil, // ) reduce(22), // [, reduce: LexTerm @@ -3758,16 +4204,18 @@ var actionTab = actionTable{ reduce(22), // }, reduce: LexTerm nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S134 + actionRow{ // S140 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; @@ -3776,8 +4224,8 @@ var actionTab = actionTable{ reduce(20), // |, reduce: LexTerm reduce(20), // ., reduce: LexTerm reduce(20), // char_lit, reduce: LexTerm - reduce(20), // ~, reduce: LexTerm nil, // - + reduce(20), // ~, reduce: LexTerm reduce(20), // (, reduce: LexTerm nil, // ) reduce(20), // [, reduce: LexTerm @@ -3786,16 +4234,18 @@ var actionTab = actionTable{ reduce(20), // }, reduce: LexTerm nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S135 + actionRow{ // S141 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; @@ -3804,8 +4254,8 @@ var actionTab = actionTable{ reduce(21), // |, reduce: LexTerm reduce(21), // ., reduce: LexTerm reduce(21), // char_lit, reduce: LexTerm - reduce(21), // ~, reduce: LexTerm nil, // - + reduce(21), // ~, reduce: LexTerm reduce(21), // (, reduce: LexTerm nil, // ) reduce(21), // [, reduce: LexTerm @@ -3814,16 +4264,18 @@ var actionTab = actionTable{ reduce(21), // }, reduce: LexTerm nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S136 + actionRow{ // S142 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; @@ -3832,26 +4284,28 @@ var actionTab = actionTable{ nil, // | nil, // . nil, // char_lit - nil, // ~ nil, // - + nil, // ~ nil, // ( - shift(140), // ) + shift(146), // ) nil, // [ nil, // ] nil, // { nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S137 + actionRow{ // S143 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; @@ -3859,9 +4313,9 @@ var actionTab = actionTable{ nil, // ignoredTokId nil, // | nil, // . - shift(141), // char_lit - nil, // ~ + shift(147), // char_lit nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -3870,16 +4324,18 @@ var actionTab = actionTable{ nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S138 + actionRow{ // S144 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; @@ -3887,9 +4343,9 @@ var actionTab = actionTable{ nil, // ignoredTokId nil, // | nil, // . - shift(142), // char_lit - nil, // ~ + shift(148), // char_lit nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -3898,16 +4354,18 @@ var actionTab = actionTable{ nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S139 + actionRow{ // S145 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; @@ -3915,9 +4373,9 @@ var actionTab = actionTable{ nil, // ignoredTokId nil, // | nil, // . - shift(143), // char_lit - nil, // ~ + shift(149), // char_lit nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -3926,16 +4384,18 @@ var actionTab = actionTable{ nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S140 + actionRow{ // S146 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : reduce(18), // ;, reduce: LexTerm @@ -3944,8 +4404,8 @@ var actionTab = actionTable{ reduce(18), // |, reduce: LexTerm reduce(18), // ., reduce: LexTerm reduce(18), // char_lit, reduce: LexTerm - reduce(18), // ~, reduce: LexTerm nil, // - + reduce(18), // ~, reduce: LexTerm reduce(18), // (, reduce: LexTerm nil, // ) reduce(18), // [, reduce: LexTerm @@ -3954,16 +4414,18 @@ var actionTab = actionTable{ nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S141 + actionRow{ // S147 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; @@ -3972,26 +4434,28 @@ var actionTab = actionTable{ nil, // | nil, // . nil, // char_lit - nil, // ~ nil, // - + nil, // ~ nil, // ( - shift(144), // ) + shift(150), // ) nil, // [ nil, // ] nil, // { nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S142 + actionRow{ // S148 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; @@ -4000,26 +4464,28 @@ var actionTab = actionTable{ nil, // | nil, // . nil, // char_lit - nil, // ~ nil, // - + nil, // ~ nil, // ( - shift(145), // ) + shift(151), // ) nil, // [ nil, // ] nil, // { nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S143 + actionRow{ // S149 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; @@ -4028,26 +4494,28 @@ var actionTab = actionTable{ nil, // | nil, // . nil, // char_lit - nil, // ~ nil, // - + nil, // ~ nil, // ( - shift(146), // ) + shift(152), // ) nil, // [ nil, // ] nil, // { nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S144 + actionRow{ // S150 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; @@ -4056,8 +4524,8 @@ var actionTab = actionTable{ reduce(18), // |, reduce: LexTerm reduce(18), // ., reduce: LexTerm reduce(18), // char_lit, reduce: LexTerm - reduce(18), // ~, reduce: LexTerm nil, // - + reduce(18), // ~, reduce: LexTerm reduce(18), // (, reduce: LexTerm reduce(18), // ), reduce: LexTerm reduce(18), // [, reduce: LexTerm @@ -4066,16 +4534,18 @@ var actionTab = actionTable{ nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S145 + actionRow{ // S151 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; @@ -4084,8 +4554,8 @@ var actionTab = actionTable{ reduce(18), // |, reduce: LexTerm reduce(18), // ., reduce: LexTerm reduce(18), // char_lit, reduce: LexTerm - reduce(18), // ~, reduce: LexTerm nil, // - + reduce(18), // ~, reduce: LexTerm reduce(18), // (, reduce: LexTerm nil, // ) reduce(18), // [, reduce: LexTerm @@ -4094,16 +4564,18 @@ var actionTab = actionTable{ nil, // } nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, - actionRow{ // S146 + actionRow{ // S152 canRecover: false, actions: [numSymbols]action{ - nil, // INVALID - nil, // $ + nil, // + nil, // Ω nil, // tokId nil, // : nil, // ; @@ -4112,8 +4584,8 @@ var actionTab = actionTable{ reduce(18), // |, reduce: LexTerm reduce(18), // ., reduce: LexTerm reduce(18), // char_lit, reduce: LexTerm - reduce(18), // ~, reduce: LexTerm nil, // - + reduce(18), // ~, reduce: LexTerm reduce(18), // (, reduce: LexTerm nil, // ) reduce(18), // [, reduce: LexTerm @@ -4122,9 +4594,11 @@ var actionTab = actionTable{ reduce(18), // }, reduce: LexTerm nil, // g_sdt_lit nil, // prodId - nil, // error - nil, // empty nil, // string_lit + nil, // errore + nil, // λ + nil, // empty + nil, // ε }, }, } diff --git a/internal/frontend_ext/parser/gototable.go b/internal/fe2/parser/gototable.go similarity index 83% rename from internal/frontend_ext/parser/gototable.go rename to internal/fe2/parser/gototable.go index c6ab4087..3d6c3d15 100644 --- a/internal/frontend_ext/parser/gototable.go +++ b/internal/fe2/parser/gototable.go @@ -2,7 +2,7 @@ package parser -const numNTSymbols = 16 +const numNTSymbols = 18 type ( gotoTable [numStates]gotoRow @@ -27,6 +27,8 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, gotoRow{ // S1 -1, // S' @@ -45,6 +47,8 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, gotoRow{ // S2 -1, // S' @@ -63,6 +67,8 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, gotoRow{ // S3 -1, // S' @@ -81,6 +87,8 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, gotoRow{ // S4 -1, // S' @@ -99,6 +107,8 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, gotoRow{ // S5 -1, // S' @@ -117,6 +127,8 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, gotoRow{ // S6 -1, // S' @@ -135,6 +147,8 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, gotoRow{ // S7 -1, // S' @@ -153,6 +167,8 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, gotoRow{ // S8 -1, // S' @@ -171,6 +187,8 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, gotoRow{ // S9 -1, // S' @@ -189,6 +207,8 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, gotoRow{ // S10 -1, // S' @@ -207,6 +227,8 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, gotoRow{ // S11 -1, // S' @@ -225,6 +247,8 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, gotoRow{ // S12 -1, // S' @@ -243,6 +267,8 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, gotoRow{ // S13 -1, // S' @@ -261,6 +287,8 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, gotoRow{ // S14 -1, // S' @@ -279,6 +307,8 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, gotoRow{ // S15 -1, // S' @@ -297,6 +327,8 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, gotoRow{ // S16 -1, // S' @@ -315,6 +347,8 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, gotoRow{ // S17 -1, // S' @@ -333,6 +367,8 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, gotoRow{ // S18 -1, // S' @@ -351,6 +387,8 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, gotoRow{ // S19 -1, // S' @@ -369,6 +407,8 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, gotoRow{ // S20 -1, // S' @@ -387,6 +427,8 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, gotoRow{ // S21 -1, // S' @@ -404,7 +446,9 @@ var gotoTab = gotoTable{ 36, // Alternatives 37, // SyntaxBody 38, // Symbols - 40, // Symbol + 41, // Symbol + 39, // ErrorSymbol + 40, // EpsilonSymbol }, gotoRow{ // S22 -1, // S' @@ -423,6 +467,8 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, gotoRow{ // S23 -1, // S' @@ -441,6 +487,8 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, gotoRow{ // S24 -1, // S' @@ -450,7 +498,7 @@ var gotoTab = gotoTable{ -1, // LexProduction -1, // LexPattern -1, // LexAlt - 44, // LexTerm + 49, // LexTerm -1, // SyntaxPart -1, // FileHeader -1, // SyntaxProdList @@ -459,6 +507,8 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, gotoRow{ // S25 -1, // S' @@ -477,6 +527,8 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, gotoRow{ // S26 -1, // S' @@ -495,6 +547,8 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, gotoRow{ // S27 -1, // S' @@ -513,6 +567,8 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, gotoRow{ // S28 -1, // S' @@ -531,6 +587,8 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, gotoRow{ // S29 -1, // S' @@ -538,9 +596,9 @@ var gotoTab = gotoTable{ -1, // LexicalPart -1, // LexProductions -1, // LexProduction - 48, // LexPattern - 50, // LexAlt - 51, // LexTerm + 53, // LexPattern + 55, // LexAlt + 56, // LexTerm -1, // SyntaxPart -1, // FileHeader -1, // SyntaxProdList @@ -549,6 +607,8 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, gotoRow{ // S30 -1, // S' @@ -556,9 +616,9 @@ var gotoTab = gotoTable{ -1, // LexicalPart -1, // LexProductions -1, // LexProduction - 58, // LexPattern - 60, // LexAlt - 61, // LexTerm + 63, // LexPattern + 65, // LexAlt + 66, // LexTerm -1, // SyntaxPart -1, // FileHeader -1, // SyntaxProdList @@ -567,6 +627,8 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, gotoRow{ // S31 -1, // S' @@ -574,9 +636,9 @@ var gotoTab = gotoTable{ -1, // LexicalPart -1, // LexProductions -1, // LexProduction - 68, // LexPattern - 70, // LexAlt - 71, // LexTerm + 73, // LexPattern + 75, // LexAlt + 76, // LexTerm -1, // SyntaxPart -1, // FileHeader -1, // SyntaxProdList @@ -585,6 +647,8 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, gotoRow{ // S32 -1, // S' @@ -603,6 +667,8 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, gotoRow{ // S33 -1, // S' @@ -621,6 +687,8 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, gotoRow{ // S34 -1, // S' @@ -639,6 +707,8 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, gotoRow{ // S35 -1, // S' @@ -657,6 +727,8 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, gotoRow{ // S36 -1, // S' @@ -675,6 +747,8 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, gotoRow{ // S37 -1, // S' @@ -693,6 +767,8 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, gotoRow{ // S38 -1, // S' @@ -710,7 +786,9 @@ var gotoTab = gotoTable{ -1, // Alternatives -1, // SyntaxBody -1, // Symbols - 83, // Symbol + 88, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, gotoRow{ // S39 -1, // S' @@ -727,8 +805,10 @@ var gotoTab = gotoTable{ -1, // SyntaxProduction -1, // Alternatives -1, // SyntaxBody - 84, // Symbols - 40, // Symbol + 90, // Symbols + 41, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, gotoRow{ // S40 -1, // S' @@ -747,6 +827,8 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, gotoRow{ // S41 -1, // S' @@ -765,6 +847,8 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, gotoRow{ // S42 -1, // S' @@ -783,6 +867,8 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, gotoRow{ // S43 -1, // S' @@ -791,8 +877,8 @@ var gotoTab = gotoTable{ -1, // LexProductions -1, // LexProduction -1, // LexPattern - 85, // LexAlt - 25, // LexTerm + -1, // LexAlt + -1, // LexTerm -1, // SyntaxPart -1, // FileHeader -1, // SyntaxProdList @@ -801,6 +887,8 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, gotoRow{ // S44 -1, // S' @@ -819,6 +907,8 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, gotoRow{ // S45 -1, // S' @@ -837,6 +927,8 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, gotoRow{ // S46 -1, // S' @@ -855,6 +947,8 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, gotoRow{ // S47 -1, // S' @@ -873,6 +967,8 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, gotoRow{ // S48 -1, // S' @@ -881,8 +977,8 @@ var gotoTab = gotoTable{ -1, // LexProductions -1, // LexProduction -1, // LexPattern - -1, // LexAlt - -1, // LexTerm + 91, // LexAlt + 25, // LexTerm -1, // SyntaxPart -1, // FileHeader -1, // SyntaxProdList @@ -891,6 +987,8 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, gotoRow{ // S49 -1, // S' @@ -909,6 +1007,8 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, gotoRow{ // S50 -1, // S' @@ -918,7 +1018,7 @@ var gotoTab = gotoTable{ -1, // LexProduction -1, // LexPattern -1, // LexAlt - 90, // LexTerm + -1, // LexTerm -1, // SyntaxPart -1, // FileHeader -1, // SyntaxProdList @@ -927,6 +1027,8 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, gotoRow{ // S51 -1, // S' @@ -945,6 +1047,8 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, gotoRow{ // S52 -1, // S' @@ -963,6 +1067,8 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, gotoRow{ // S53 -1, // S' @@ -981,6 +1087,8 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, gotoRow{ // S54 -1, // S' @@ -999,6 +1107,8 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, gotoRow{ // S55 -1, // S' @@ -1006,9 +1116,9 @@ var gotoTab = gotoTable{ -1, // LexicalPart -1, // LexProductions -1, // LexProduction - 94, // LexPattern - 50, // LexAlt - 51, // LexTerm + -1, // LexPattern + -1, // LexAlt + 96, // LexTerm -1, // SyntaxPart -1, // FileHeader -1, // SyntaxProdList @@ -1017,6 +1127,8 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, gotoRow{ // S56 -1, // S' @@ -1024,9 +1136,9 @@ var gotoTab = gotoTable{ -1, // LexicalPart -1, // LexProductions -1, // LexProduction - 95, // LexPattern - 60, // LexAlt - 61, // LexTerm + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm -1, // SyntaxPart -1, // FileHeader -1, // SyntaxProdList @@ -1035,6 +1147,8 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, gotoRow{ // S57 -1, // S' @@ -1042,9 +1156,9 @@ var gotoTab = gotoTable{ -1, // LexicalPart -1, // LexProductions -1, // LexProduction - 96, // LexPattern - 70, // LexAlt - 71, // LexTerm + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm -1, // SyntaxPart -1, // FileHeader -1, // SyntaxProdList @@ -1053,6 +1167,8 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, gotoRow{ // S58 -1, // S' @@ -1071,6 +1187,8 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, gotoRow{ // S59 -1, // S' @@ -1089,8 +1207,70 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, gotoRow{ // S60 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + 100, // LexPattern + 55, // LexAlt + 56, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol + }, + gotoRow{ // S61 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + 101, // LexPattern + 65, // LexAlt + 66, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol + }, + gotoRow{ // S62 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + 102, // LexPattern + 75, // LexAlt + 76, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol + }, + gotoRow{ // S63 -1, // S' -1, // Grammar -1, // LexicalPart @@ -1098,7 +1278,7 @@ var gotoTab = gotoTable{ -1, // LexProduction -1, // LexPattern -1, // LexAlt - 99, // LexTerm + -1, // LexTerm -1, // SyntaxPart -1, // FileHeader -1, // SyntaxProdList @@ -1107,8 +1287,10 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, - gotoRow{ // S61 + gotoRow{ // S64 -1, // S' -1, // Grammar -1, // LexicalPart @@ -1125,8 +1307,30 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, - gotoRow{ // S62 + gotoRow{ // S65 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + 105, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol + }, + gotoRow{ // S66 -1, // S' -1, // Grammar -1, // LexicalPart @@ -1143,8 +1347,10 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, - gotoRow{ // S63 + gotoRow{ // S67 -1, // S' -1, // Grammar -1, // LexicalPart @@ -1161,8 +1367,10 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, - gotoRow{ // S64 + gotoRow{ // S68 -1, // S' -1, // Grammar -1, // LexicalPart @@ -1179,16 +1387,38 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, - gotoRow{ // S65 + gotoRow{ // S69 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol + }, + gotoRow{ // S70 -1, // S' -1, // Grammar -1, // LexicalPart -1, // LexProductions -1, // LexProduction - 103, // LexPattern - 50, // LexAlt - 51, // LexTerm + 109, // LexPattern + 55, // LexAlt + 56, // LexTerm -1, // SyntaxPart -1, // FileHeader -1, // SyntaxProdList @@ -1197,16 +1427,18 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, - gotoRow{ // S66 + gotoRow{ // S71 -1, // S' -1, // Grammar -1, // LexicalPart -1, // LexProductions -1, // LexProduction - 104, // LexPattern - 60, // LexAlt - 61, // LexTerm + 110, // LexPattern + 65, // LexAlt + 66, // LexTerm -1, // SyntaxPart -1, // FileHeader -1, // SyntaxProdList @@ -1215,16 +1447,18 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, - gotoRow{ // S67 + gotoRow{ // S72 -1, // S' -1, // Grammar -1, // LexicalPart -1, // LexProductions -1, // LexProduction - 105, // LexPattern - 70, // LexAlt - 71, // LexTerm + 111, // LexPattern + 75, // LexAlt + 76, // LexTerm -1, // SyntaxPart -1, // FileHeader -1, // SyntaxProdList @@ -1233,8 +1467,10 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, - gotoRow{ // S68 + gotoRow{ // S73 -1, // S' -1, // Grammar -1, // LexicalPart @@ -1251,8 +1487,10 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, - gotoRow{ // S69 + gotoRow{ // S74 -1, // S' -1, // Grammar -1, // LexicalPart @@ -1269,8 +1507,10 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, - gotoRow{ // S70 + gotoRow{ // S75 -1, // S' -1, // Grammar -1, // LexicalPart @@ -1278,7 +1518,7 @@ var gotoTab = gotoTable{ -1, // LexProduction -1, // LexPattern -1, // LexAlt - 108, // LexTerm + 114, // LexTerm -1, // SyntaxPart -1, // FileHeader -1, // SyntaxProdList @@ -1287,8 +1527,10 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, - gotoRow{ // S71 + gotoRow{ // S76 -1, // S' -1, // Grammar -1, // LexicalPart @@ -1305,8 +1547,10 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, - gotoRow{ // S72 + gotoRow{ // S77 -1, // S' -1, // Grammar -1, // LexicalPart @@ -1323,8 +1567,10 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, - gotoRow{ // S73 + gotoRow{ // S78 -1, // S' -1, // Grammar -1, // LexicalPart @@ -1341,8 +1587,10 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, - gotoRow{ // S74 + gotoRow{ // S79 -1, // S' -1, // Grammar -1, // LexicalPart @@ -1359,16 +1607,18 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, - gotoRow{ // S75 + gotoRow{ // S80 -1, // S' -1, // Grammar -1, // LexicalPart -1, // LexProductions -1, // LexProduction - 112, // LexPattern - 50, // LexAlt - 51, // LexTerm + 118, // LexPattern + 55, // LexAlt + 56, // LexTerm -1, // SyntaxPart -1, // FileHeader -1, // SyntaxProdList @@ -1377,16 +1627,18 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, - gotoRow{ // S76 + gotoRow{ // S81 -1, // S' -1, // Grammar -1, // LexicalPart -1, // LexProductions -1, // LexProduction - 113, // LexPattern - 60, // LexAlt - 61, // LexTerm + 119, // LexPattern + 65, // LexAlt + 66, // LexTerm -1, // SyntaxPart -1, // FileHeader -1, // SyntaxProdList @@ -1395,16 +1647,18 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, - gotoRow{ // S77 + gotoRow{ // S82 -1, // S' -1, // Grammar -1, // LexicalPart -1, // LexProductions -1, // LexProduction - 114, // LexPattern - 70, // LexAlt - 71, // LexTerm + 120, // LexPattern + 75, // LexAlt + 76, // LexTerm -1, // SyntaxPart -1, // FileHeader -1, // SyntaxProdList @@ -1413,8 +1667,10 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, - gotoRow{ // S78 + gotoRow{ // S83 -1, // S' -1, // Grammar -1, // LexicalPart @@ -1431,8 +1687,10 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, - gotoRow{ // S79 + gotoRow{ // S84 -1, // S' -1, // Grammar -1, // LexicalPart @@ -1449,8 +1707,10 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, - gotoRow{ // S80 + gotoRow{ // S85 -1, // S' -1, // Grammar -1, // LexicalPart @@ -1467,8 +1727,10 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, - gotoRow{ // S81 + gotoRow{ // S86 -1, // S' -1, // Grammar -1, // LexicalPart @@ -1482,11 +1744,13 @@ var gotoTab = gotoTable{ -1, // SyntaxProdList -1, // SyntaxProduction -1, // Alternatives - 115, // SyntaxBody + 121, // SyntaxBody 38, // Symbols - 40, // Symbol + 41, // Symbol + 39, // ErrorSymbol + 40, // EpsilonSymbol }, - gotoRow{ // S82 + gotoRow{ // S87 -1, // S' -1, // Grammar -1, // LexicalPart @@ -1503,8 +1767,10 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, - gotoRow{ // S83 + gotoRow{ // S88 -1, // S' -1, // Grammar -1, // LexicalPart @@ -1521,8 +1787,10 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, - gotoRow{ // S84 + gotoRow{ // S89 -1, // S' -1, // Grammar -1, // LexicalPart @@ -1538,9 +1806,31 @@ var gotoTab = gotoTable{ -1, // Alternatives -1, // SyntaxBody -1, // Symbols - 83, // Symbol + -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, - gotoRow{ // S85 + gotoRow{ // S90 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + 88, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol + }, + gotoRow{ // S91 -1, // S' -1, // Grammar -1, // LexicalPart @@ -1548,7 +1838,7 @@ var gotoTab = gotoTable{ -1, // LexProduction -1, // LexPattern -1, // LexAlt - 44, // LexTerm + 49, // LexTerm -1, // SyntaxPart -1, // FileHeader -1, // SyntaxProdList @@ -1557,8 +1847,10 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, - gotoRow{ // S86 + gotoRow{ // S92 -1, // S' -1, // Grammar -1, // LexicalPart @@ -1575,8 +1867,10 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, - gotoRow{ // S87 + gotoRow{ // S93 -1, // S' -1, // Grammar -1, // LexicalPart @@ -1593,16 +1887,18 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, - gotoRow{ // S88 + gotoRow{ // S94 -1, // S' -1, // Grammar -1, // LexicalPart -1, // LexProductions -1, // LexProduction -1, // LexPattern - 118, // LexAlt - 51, // LexTerm + 124, // LexAlt + 56, // LexTerm -1, // SyntaxPart -1, // FileHeader -1, // SyntaxProdList @@ -1611,8 +1907,10 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, - gotoRow{ // S89 + gotoRow{ // S95 -1, // S' -1, // Grammar -1, // LexicalPart @@ -1629,8 +1927,10 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, - gotoRow{ // S90 + gotoRow{ // S96 -1, // S' -1, // Grammar -1, // LexicalPart @@ -1647,8 +1947,10 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, - gotoRow{ // S91 + gotoRow{ // S97 -1, // S' -1, // Grammar -1, // LexicalPart @@ -1665,8 +1967,10 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, - gotoRow{ // S92 + gotoRow{ // S98 -1, // S' -1, // Grammar -1, // LexicalPart @@ -1683,8 +1987,10 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, - gotoRow{ // S93 + gotoRow{ // S99 -1, // S' -1, // Grammar -1, // LexicalPart @@ -1701,8 +2007,10 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, - gotoRow{ // S94 + gotoRow{ // S100 -1, // S' -1, // Grammar -1, // LexicalPart @@ -1719,8 +2027,10 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, - gotoRow{ // S95 + gotoRow{ // S101 -1, // S' -1, // Grammar -1, // LexicalPart @@ -1737,8 +2047,10 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, - gotoRow{ // S96 + gotoRow{ // S102 -1, // S' -1, // Grammar -1, // LexicalPart @@ -1755,16 +2067,18 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, - gotoRow{ // S97 + gotoRow{ // S103 -1, // S' -1, // Grammar -1, // LexicalPart -1, // LexProductions -1, // LexProduction -1, // LexPattern - 124, // LexAlt - 61, // LexTerm + 130, // LexAlt + 66, // LexTerm -1, // SyntaxPart -1, // FileHeader -1, // SyntaxProdList @@ -1773,8 +2087,10 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, - gotoRow{ // S98 + gotoRow{ // S104 -1, // S' -1, // Grammar -1, // LexicalPart @@ -1791,8 +2107,10 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, - gotoRow{ // S99 + gotoRow{ // S105 -1, // S' -1, // Grammar -1, // LexicalPart @@ -1809,8 +2127,10 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, - gotoRow{ // S100 + gotoRow{ // S106 -1, // S' -1, // Grammar -1, // LexicalPart @@ -1827,8 +2147,10 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, - gotoRow{ // S101 + gotoRow{ // S107 -1, // S' -1, // Grammar -1, // LexicalPart @@ -1845,8 +2167,10 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, - gotoRow{ // S102 + gotoRow{ // S108 -1, // S' -1, // Grammar -1, // LexicalPart @@ -1863,8 +2187,10 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, - gotoRow{ // S103 + gotoRow{ // S109 -1, // S' -1, // Grammar -1, // LexicalPart @@ -1881,8 +2207,10 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, - gotoRow{ // S104 + gotoRow{ // S110 -1, // S' -1, // Grammar -1, // LexicalPart @@ -1899,8 +2227,10 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, - gotoRow{ // S105 + gotoRow{ // S111 -1, // S' -1, // Grammar -1, // LexicalPart @@ -1917,16 +2247,18 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, - gotoRow{ // S106 + gotoRow{ // S112 -1, // S' -1, // Grammar -1, // LexicalPart -1, // LexProductions -1, // LexProduction -1, // LexPattern - 130, // LexAlt - 71, // LexTerm + 136, // LexAlt + 76, // LexTerm -1, // SyntaxPart -1, // FileHeader -1, // SyntaxProdList @@ -1935,8 +2267,10 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, - gotoRow{ // S107 + gotoRow{ // S113 -1, // S' -1, // Grammar -1, // LexicalPart @@ -1953,8 +2287,10 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, - gotoRow{ // S108 + gotoRow{ // S114 -1, // S' -1, // Grammar -1, // LexicalPart @@ -1971,8 +2307,10 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, - gotoRow{ // S109 + gotoRow{ // S115 -1, // S' -1, // Grammar -1, // LexicalPart @@ -1989,8 +2327,10 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, - gotoRow{ // S110 + gotoRow{ // S116 -1, // S' -1, // Grammar -1, // LexicalPart @@ -2007,8 +2347,10 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, - gotoRow{ // S111 + gotoRow{ // S117 -1, // S' -1, // Grammar -1, // LexicalPart @@ -2025,8 +2367,10 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, - gotoRow{ // S112 + gotoRow{ // S118 -1, // S' -1, // Grammar -1, // LexicalPart @@ -2043,8 +2387,10 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, - gotoRow{ // S113 + gotoRow{ // S119 -1, // S' -1, // Grammar -1, // LexicalPart @@ -2061,8 +2407,10 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, - gotoRow{ // S114 + gotoRow{ // S120 -1, // S' -1, // Grammar -1, // LexicalPart @@ -2079,8 +2427,10 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, - gotoRow{ // S115 + gotoRow{ // S121 -1, // S' -1, // Grammar -1, // LexicalPart @@ -2097,8 +2447,10 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, - gotoRow{ // S116 + gotoRow{ // S122 -1, // S' -1, // Grammar -1, // LexicalPart @@ -2115,8 +2467,10 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, - gotoRow{ // S117 + gotoRow{ // S123 -1, // S' -1, // Grammar -1, // LexicalPart @@ -2133,8 +2487,10 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, - gotoRow{ // S118 + gotoRow{ // S124 -1, // S' -1, // Grammar -1, // LexicalPart @@ -2142,7 +2498,7 @@ var gotoTab = gotoTable{ -1, // LexProduction -1, // LexPattern -1, // LexAlt - 90, // LexTerm + 96, // LexTerm -1, // SyntaxPart -1, // FileHeader -1, // SyntaxProdList @@ -2151,8 +2507,10 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, - gotoRow{ // S119 + gotoRow{ // S125 -1, // S' -1, // Grammar -1, // LexicalPart @@ -2169,8 +2527,10 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, - gotoRow{ // S120 + gotoRow{ // S126 -1, // S' -1, // Grammar -1, // LexicalPart @@ -2187,8 +2547,10 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, - gotoRow{ // S121 + gotoRow{ // S127 -1, // S' -1, // Grammar -1, // LexicalPart @@ -2205,8 +2567,10 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, - gotoRow{ // S122 + gotoRow{ // S128 -1, // S' -1, // Grammar -1, // LexicalPart @@ -2223,8 +2587,10 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, - gotoRow{ // S123 + gotoRow{ // S129 -1, // S' -1, // Grammar -1, // LexicalPart @@ -2241,26 +2607,30 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, - gotoRow{ // S124 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - 99, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol + gotoRow{ // S130 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + 105, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, - gotoRow{ // S125 + gotoRow{ // S131 -1, // S' -1, // Grammar -1, // LexicalPart @@ -2277,8 +2647,10 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, - gotoRow{ // S126 + gotoRow{ // S132 -1, // S' -1, // Grammar -1, // LexicalPart @@ -2295,8 +2667,10 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, - gotoRow{ // S127 + gotoRow{ // S133 -1, // S' -1, // Grammar -1, // LexicalPart @@ -2313,8 +2687,10 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, - gotoRow{ // S128 + gotoRow{ // S134 -1, // S' -1, // Grammar -1, // LexicalPart @@ -2331,8 +2707,10 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, - gotoRow{ // S129 + gotoRow{ // S135 -1, // S' -1, // Grammar -1, // LexicalPart @@ -2349,8 +2727,10 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, - gotoRow{ // S130 + gotoRow{ // S136 -1, // S' -1, // Grammar -1, // LexicalPart @@ -2358,7 +2738,7 @@ var gotoTab = gotoTable{ -1, // LexProduction -1, // LexPattern -1, // LexAlt - 108, // LexTerm + 114, // LexTerm -1, // SyntaxPart -1, // FileHeader -1, // SyntaxProdList @@ -2367,8 +2747,10 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, - gotoRow{ // S131 + gotoRow{ // S137 -1, // S' -1, // Grammar -1, // LexicalPart @@ -2385,8 +2767,10 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, - gotoRow{ // S132 + gotoRow{ // S138 -1, // S' -1, // Grammar -1, // LexicalPart @@ -2403,8 +2787,10 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, - gotoRow{ // S133 + gotoRow{ // S139 -1, // S' -1, // Grammar -1, // LexicalPart @@ -2421,8 +2807,10 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, - gotoRow{ // S134 + gotoRow{ // S140 -1, // S' -1, // Grammar -1, // LexicalPart @@ -2439,8 +2827,10 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, - gotoRow{ // S135 + gotoRow{ // S141 -1, // S' -1, // Grammar -1, // LexicalPart @@ -2457,8 +2847,10 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, - gotoRow{ // S136 + gotoRow{ // S142 -1, // S' -1, // Grammar -1, // LexicalPart @@ -2475,8 +2867,10 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, - gotoRow{ // S137 + gotoRow{ // S143 -1, // S' -1, // Grammar -1, // LexicalPart @@ -2493,8 +2887,10 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, - gotoRow{ // S138 + gotoRow{ // S144 -1, // S' -1, // Grammar -1, // LexicalPart @@ -2511,8 +2907,10 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, - gotoRow{ // S139 + gotoRow{ // S145 -1, // S' -1, // Grammar -1, // LexicalPart @@ -2529,8 +2927,10 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, - gotoRow{ // S140 + gotoRow{ // S146 -1, // S' -1, // Grammar -1, // LexicalPart @@ -2547,8 +2947,10 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, - gotoRow{ // S141 + gotoRow{ // S147 -1, // S' -1, // Grammar -1, // LexicalPart @@ -2565,8 +2967,10 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, - gotoRow{ // S142 + gotoRow{ // S148 -1, // S' -1, // Grammar -1, // LexicalPart @@ -2583,8 +2987,10 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, - gotoRow{ // S143 + gotoRow{ // S149 -1, // S' -1, // Grammar -1, // LexicalPart @@ -2601,8 +3007,10 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, - gotoRow{ // S144 + gotoRow{ // S150 -1, // S' -1, // Grammar -1, // LexicalPart @@ -2619,8 +3027,10 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, - gotoRow{ // S145 + gotoRow{ // S151 -1, // S' -1, // Grammar -1, // LexicalPart @@ -2637,8 +3047,10 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, - gotoRow{ // S146 + gotoRow{ // S152 -1, // S' -1, // Grammar -1, // LexicalPart @@ -2655,5 +3067,7 @@ var gotoTab = gotoTable{ -1, // SyntaxBody -1, // Symbols -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol }, } diff --git a/internal/frontend_ext/parser/parser.go b/internal/fe2/parser/parser.go similarity index 94% rename from internal/frontend_ext/parser/parser.go rename to internal/fe2/parser/parser.go index a810d488..afd22cc7 100644 --- a/internal/frontend_ext/parser/parser.go +++ b/internal/fe2/parser/parser.go @@ -6,14 +6,14 @@ import ( "fmt" "strings" - parseError "github.com/maxcalandrelli/gocc/internal/frontend/errors" - "github.com/maxcalandrelli/gocc/internal/frontend/token" + parseError "github.com/maxcalandrelli/gocc/internal/fe2/errors" + "github.com/maxcalandrelli/gocc/internal/fe2/token" ) const ( - numProductions = 42 - numStates = 147 - numSymbols = 39 + numProductions = 47 + numStates = 153 + numSymbols = 43 ) // Stack @@ -88,9 +88,10 @@ func (s *stack) String() string { // Parser type Parser struct { - stack *stack - nextToken *token.Token - pos int + stack *stack + nextToken *token.Token + pos int + UserContext interface{} } type Scanner interface { diff --git a/internal/frontend_ext/parser/productionstable.go b/internal/fe2/parser/productionstable.go similarity index 82% rename from internal/frontend_ext/parser/productionstable.go rename to internal/fe2/parser/productionstable.go index a53e8aae..7323365e 100644 --- a/internal/frontend_ext/parser/productionstable.go +++ b/internal/fe2/parser/productionstable.go @@ -4,6 +4,8 @@ package parser import "github.com/maxcalandrelli/gocc/internal/ast" + + type ( //TODO: change type and variable names to be consistent with other tables ProdTab [numProductions]ProdTabEntry @@ -171,43 +173,43 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `LexTerm : char_lit << ast.NewLexCharLit(X[0], false) >>`, + String: `LexTerm : char_lit << ast.NewLexCharLitExt(X[0],false) >>`, Id: "LexTerm", NTType: 7, Index: 15, NumSymbols: 1, ReduceFunc: func(X []Attrib) (Attrib, error) { - return ast.NewLexCharLit(X[0], false) + return ast.NewLexCharLitExt(X[0],false) }, }, ProdTabEntry{ - String: `LexTerm : "~" char_lit << ast.NewLexCharLit(X[0], true) >>`, + String: `LexTerm : char_lit "-" char_lit << ast.NewLexCharRangeExt(X[0], X[2],false) >>`, Id: "LexTerm", NTType: 7, Index: 16, - NumSymbols: 2, + NumSymbols: 3, ReduceFunc: func(X []Attrib) (Attrib, error) { - return ast.NewLexCharLit(X[0], true) + return ast.NewLexCharRangeExt(X[0], X[2],false) }, }, ProdTabEntry{ - String: `LexTerm : char_lit "-" char_lit << ast.NewLexCharRange(X[0], X[2], false) >>`, + String: `LexTerm : "~" char_lit << ast.NewLexCharLitExt(X[0], true) >>`, Id: "LexTerm", NTType: 7, Index: 17, - NumSymbols: 3, + NumSymbols: 2, ReduceFunc: func(X []Attrib) (Attrib, error) { - return ast.NewLexCharRange(X[0], X[2], false) + return ast.NewLexCharLitExt(X[0], true) }, }, ProdTabEntry{ - String: `LexTerm : "~" "(" char_lit "-" char_lit ")" << ast.NewLexCharRange(X[2], X[4], true) >>`, + String: `LexTerm : "~" "(" char_lit "-" char_lit ")" << ast.NewLexCharRangeExt(X[2], X[4], true) >>`, Id: "LexTerm", NTType: 7, Index: 18, NumSymbols: 6, ReduceFunc: func(X []Attrib) (Attrib, error) { - return ast.NewLexCharRange(X[2], X[4], true) + return ast.NewLexCharRangeExt(X[2], X[4], true) }, }, ProdTabEntry{ @@ -331,70 +333,80 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `SyntaxBody : Symbols << ast.NewSyntaxBody(X[0], nil) >>`, + String: `SyntaxBody : Symbols << ast.NewSyntaxBodyGen(X[0], nil) >>`, Id: "SyntaxBody", NTType: 13, Index: 31, NumSymbols: 1, ReduceFunc: func(X []Attrib) (Attrib, error) { - return ast.NewSyntaxBody(X[0], nil) + return ast.NewSyntaxBodyGen(X[0], nil) }, }, ProdTabEntry{ - String: `SyntaxBody : Symbols g_sdt_lit << ast.NewSyntaxBody(X[0], X[1]) >>`, + String: `SyntaxBody : Symbols g_sdt_lit << ast.NewSyntaxBodyGen(X[0], X[1]) >>`, Id: "SyntaxBody", NTType: 13, Index: 32, NumSymbols: 2, ReduceFunc: func(X []Attrib) (Attrib, error) { - return ast.NewSyntaxBody(X[0], X[1]) + return ast.NewSyntaxBodyGen(X[0], X[1]) }, }, ProdTabEntry{ - String: `SyntaxBody : "error" << ast.NewErrorBody(nil, nil) >>`, + String: `SyntaxBody : ErrorSymbol << ast.NewErrorBodyGen(nil, nil) >>`, Id: "SyntaxBody", NTType: 13, Index: 33, NumSymbols: 1, ReduceFunc: func(X []Attrib) (Attrib, error) { - return ast.NewErrorBody(nil, nil) + return ast.NewErrorBodyGen(nil, nil) }, }, ProdTabEntry{ - String: `SyntaxBody : "error" Symbols << ast.NewErrorBody(X[1], nil) >>`, + String: `SyntaxBody : ErrorSymbol Symbols << ast.NewErrorBodyGen(X[1], nil) >>`, Id: "SyntaxBody", NTType: 13, Index: 34, NumSymbols: 2, ReduceFunc: func(X []Attrib) (Attrib, error) { - return ast.NewErrorBody(X[1], nil) + return ast.NewErrorBodyGen(X[1], nil) }, }, ProdTabEntry{ - String: `SyntaxBody : "error" Symbols g_sdt_lit << ast.NewErrorBody(X[1], X[2]) >>`, + String: `SyntaxBody : ErrorSymbol Symbols g_sdt_lit << ast.NewErrorBodyGen(X[1], X[2]) >>`, Id: "SyntaxBody", NTType: 13, Index: 35, NumSymbols: 3, ReduceFunc: func(X []Attrib) (Attrib, error) { - return ast.NewErrorBody(X[1], X[2]) + return ast.NewErrorBodyGen(X[1], X[2]) }, }, ProdTabEntry{ - String: `SyntaxBody : "empty" << ast.NewEmptyBody() >>`, + String: `SyntaxBody : ErrorSymbol g_sdt_lit << ast.NewErrorBodyGen(nil, X[1]) >>`, Id: "SyntaxBody", NTType: 13, Index: 36, - NumSymbols: 0, + NumSymbols: 2, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewErrorBodyGen(nil, X[1]) + }, + }, + ProdTabEntry{ + String: `SyntaxBody : EpsilonSymbol << ast.NewEmptyBodyGen() >>`, + Id: "SyntaxBody", + NTType: 13, + Index: 37, + NumSymbols: 1, ReduceFunc: func(X []Attrib) (Attrib, error) { - return ast.NewEmptyBody() + return ast.NewEmptyBodyGen() }, }, ProdTabEntry{ String: `Symbols : Symbol << ast.NewSyntaxSymbols(X[0]) >>`, Id: "Symbols", NTType: 14, - Index: 37, + Index: 38, NumSymbols: 1, ReduceFunc: func(X []Attrib) (Attrib, error) { return ast.NewSyntaxSymbols(X[0]) @@ -404,7 +416,7 @@ var productionsTable = ProdTab{ String: `Symbols : Symbols Symbol << ast.AddSyntaxSymbol(X[0], X[1]) >>`, Id: "Symbols", NTType: 14, - Index: 38, + Index: 39, NumSymbols: 2, ReduceFunc: func(X []Attrib) (Attrib, error) { return ast.AddSyntaxSymbol(X[0], X[1]) @@ -414,7 +426,7 @@ var productionsTable = ProdTab{ String: `Symbol : prodId << ast.NewSyntaxProdId(X[0]) >>`, Id: "Symbol", NTType: 15, - Index: 39, + Index: 40, NumSymbols: 1, ReduceFunc: func(X []Attrib) (Attrib, error) { return ast.NewSyntaxProdId(X[0]) @@ -424,7 +436,7 @@ var productionsTable = ProdTab{ String: `Symbol : tokId << ast.NewTokId(X[0]) >>`, Id: "Symbol", NTType: 15, - Index: 40, + Index: 41, NumSymbols: 1, ReduceFunc: func(X []Attrib) (Attrib, error) { return ast.NewTokId(X[0]) @@ -434,10 +446,50 @@ var productionsTable = ProdTab{ String: `Symbol : string_lit << ast.NewStringLit(X[0]) >>`, Id: "Symbol", NTType: 15, - Index: 41, + Index: 42, NumSymbols: 1, ReduceFunc: func(X []Attrib) (Attrib, error) { return ast.NewStringLit(X[0]) }, }, + ProdTabEntry{ + String: `ErrorSymbol : "errore" << >>`, + Id: "ErrorSymbol", + NTType: 16, + Index: 43, + NumSymbols: 1, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return X[0], nil + }, + }, + ProdTabEntry{ + String: `ErrorSymbol : "λ" << >>`, + Id: "ErrorSymbol", + NTType: 16, + Index: 44, + NumSymbols: 1, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return X[0], nil + }, + }, + ProdTabEntry{ + String: `EpsilonSymbol : "empty" << >>`, + Id: "EpsilonSymbol", + NTType: 17, + Index: 45, + NumSymbols: 1, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return X[0], nil + }, + }, + ProdTabEntry{ + String: `EpsilonSymbol : "ε" << >>`, + Id: "EpsilonSymbol", + NTType: 17, + Index: 46, + NumSymbols: 1, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return X[0], nil + }, + }, } diff --git a/internal/fe2/terminals.txt b/internal/fe2/terminals.txt new file mode 100644 index 00000000..e4df5703 --- /dev/null +++ b/internal/fe2/terminals.txt @@ -0,0 +1,25 @@ + +tokId +: +; +regDefId +ignoredTokId +| +. +char_lit +- +~ +( +) +[ +] +{ +} +g_sdt_lit +prodId +string_lit +errore +λ +empty +ε diff --git a/internal/frontend_ext/token/token.go b/internal/fe2/token/token.go similarity index 80% rename from internal/frontend_ext/token/token.go rename to internal/fe2/token/token.go index 86cf3dee..3a6e3b95 100644 --- a/internal/frontend_ext/token/token.go +++ b/internal/fe2/token/token.go @@ -6,10 +6,18 @@ import ( "fmt" ) +type UserContext interface{} + +type ParseContext struct { + Remaining []byte +} + type Token struct { Type Lit []byte Pos + Context *ParseContext + User UserContext } type Type int @@ -59,8 +67,8 @@ func (m TokenMap) StringType(typ Type) string { var TokMap = TokenMap{ typeMap: []string{ - "INVALID", - "$", + "", + "Ω", "tokId", ":", ";", @@ -69,8 +77,8 @@ var TokMap = TokenMap{ "|", ".", "char_lit", - "~", "-", + "~", "(", ")", "[", @@ -79,14 +87,16 @@ var TokMap = TokenMap{ "}", "g_sdt_lit", "prodId", - "error", - "empty", "string_lit", + "errore", + "λ", + "empty", + "ε", }, idMap: map[string]Type{ - "INVALID": 0, - "$": 1, + "": 0, + "Ω": 1, "tokId": 2, ":": 3, ";": 4, @@ -95,8 +105,8 @@ var TokMap = TokenMap{ "|": 7, ".": 8, "char_lit": 9, - "~": 10, - "-": 11, + "-": 10, + "~": 11, "(": 12, ")": 13, "[": 14, @@ -105,8 +115,10 @@ var TokMap = TokenMap{ "}": 17, "g_sdt_lit": 18, "prodId": 19, - "error": 20, - "empty": 21, - "string_lit": 22, + "string_lit": 20, + "errore": 21, + "λ": 22, + "empty": 23, + "ε": 24, }, } diff --git a/internal/frontend_ext/util/litconv.go b/internal/fe2/util/litconv.go similarity index 100% rename from internal/frontend_ext/util/litconv.go rename to internal/fe2/util/litconv.go diff --git a/internal/frontend_ext/util/rune.go b/internal/fe2/util/rune.go similarity index 100% rename from internal/frontend_ext/util/rune.go rename to internal/fe2/util/rune.go diff --git a/internal/frontend b/internal/frontend deleted file mode 120000 index 5158712d..00000000 --- a/internal/frontend +++ /dev/null @@ -1 +0,0 @@ -frontend_ext \ No newline at end of file diff --git a/internal/frontend_orig/errors/errors.go b/internal/frontend/errors/errors.go similarity index 100% rename from internal/frontend_orig/errors/errors.go rename to internal/frontend/errors/errors.go diff --git a/internal/frontend_orig/parser/parser.go b/internal/frontend/parser/parser.go similarity index 97% rename from internal/frontend_orig/parser/parser.go rename to internal/frontend/parser/parser.go index 31deb083..24f87272 100644 --- a/internal/frontend_orig/parser/parser.go +++ b/internal/frontend/parser/parser.go @@ -4,6 +4,8 @@ import ( "errors" "fmt" "strconv" + + "github.com/maxcalandrelli/gocc/internal/config" ) import errs "github.com/maxcalandrelli/gocc/internal/frontend/errors" @@ -196,7 +198,7 @@ func (P *Parser) Error(err error, scanner Scanner) (recovered bool, errorAttrib errorAttrib.ExpectedTokens = append(errorAttrib.ExpectedTokens, P.tokenMap.TokenString(t)) } - action, ok := P.actTab[P.stack.Top()].Actions[P.tokenMap.Type("error")] + action, ok := P.actTab[P.stack.Top()].Actions[P.tokenMap.Type(config.SYMBOL_ERROR)] if !ok { return } diff --git a/internal/frontend_orig/parser/parser_ut.go b/internal/frontend/parser/parser_ut.go similarity index 97% rename from internal/frontend_orig/parser/parser_ut.go rename to internal/frontend/parser/parser_ut.go index 82076b0a..c65fadb6 100644 --- a/internal/frontend_orig/parser/parser_ut.go +++ b/internal/frontend/parser/parser_ut.go @@ -3,6 +3,8 @@ package parser import ( "errors" "strconv" + + "github.com/maxcalandrelli/gocc/internal/config" ) import errs "github.com/maxcalandrelli/gocc/internal/frontend/errors" @@ -54,7 +56,7 @@ func (P *ParserUTab) Error(err error, scanner Scanner) (recovered bool, errorAtt } } - action := P.actTab[P.stack.Top()][P.tokenMap.Type("error")] + action := P.actTab[P.stack.Top()][P.tokenMap.Type(config.SYMBOL_ERROR)] if action == nil { return } diff --git a/internal/frontend_orig/parser/tables.go b/internal/frontend/parser/tables.go similarity index 100% rename from internal/frontend_orig/parser/tables.go rename to internal/frontend/parser/tables.go diff --git a/internal/frontend_orig/parser/tables_uncompressed.go b/internal/frontend/parser/tables_uncompressed.go similarity index 100% rename from internal/frontend_orig/parser/tables_uncompressed.go rename to internal/frontend/parser/tables_uncompressed.go diff --git a/internal/frontend_orig/scanner/scanner.go b/internal/frontend/scanner/scanner.go similarity index 99% rename from internal/frontend_orig/scanner/scanner.go rename to internal/frontend/scanner/scanner.go index 0489d443..a10f7a86 100644 --- a/internal/frontend_orig/scanner/scanner.go +++ b/internal/frontend/scanner/scanner.go @@ -13,6 +13,8 @@ import ( "strconv" "unicode" "unicode/utf8" + + "github.com/maxcalandrelli/gocc/internal/config" ) import "github.com/maxcalandrelli/gocc/internal/frontend/token" @@ -480,7 +482,7 @@ scanAgain: S.next() // always make progress switch ch { case -1: - tok = S.tokenMap.Type("$") + tok = S.tokenMap.Type(config.SYMBOL_EOF) case '"': tok = S.tokenMap.Type("string_lit") S.scanString(pos) diff --git a/internal/frontend_orig/scanner/scanner_test.go b/internal/frontend/scanner/scanner_test.go similarity index 100% rename from internal/frontend_orig/scanner/scanner_test.go rename to internal/frontend/scanner/scanner_test.go diff --git a/internal/frontend_orig/token/token.go b/internal/frontend/token/token.go similarity index 97% rename from internal/frontend_orig/token/token.go rename to internal/frontend/token/token.go index f30eb7a0..1a75c235 100644 --- a/internal/frontend_orig/token/token.go +++ b/internal/frontend/token/token.go @@ -7,6 +7,8 @@ import ( "regexp" "strconv" "strings" + + "github.com/maxcalandrelli/gocc/internal/config" ) type Token struct { @@ -33,7 +35,7 @@ func (this *Token) Equals(that *Token) bool { func (this *Token) String() string { str := "" if this.Type == EOF { - str += "\"$\"" + str += fmt.Sprintf("\"%s\"", config.SYMBOL_EOF) } else { str += "\"" + string(this.Lit) + "\"" } @@ -130,7 +132,7 @@ type TokenMap struct { func NewMap() *TokenMap { tm := &TokenMap{make([]string, 0, 10), make(map[string]Type)} - tm.AddToken("$") + tm.AddToken(config.SYMBOL_EOF) // tm.AddToken("ε") return tm } diff --git a/internal/frontend_orig/token/tokens.go b/internal/frontend/token/tokens.go similarity index 68% rename from internal/frontend_orig/token/tokens.go rename to internal/frontend/token/tokens.go index 8043d915..6e9426da 100644 --- a/internal/frontend_orig/token/tokens.go +++ b/internal/frontend/token/tokens.go @@ -1,5 +1,9 @@ package token +import ( + "github.com/maxcalandrelli/gocc/internal/config" +) + var FRONTENDTokens = NewMapFromStrings([]string{ "id", "tokId", @@ -19,7 +23,7 @@ var FRONTENDTokens = NewMapFromStrings([]string{ ")", "prodId", "g_sdt_lit", - "error", - "empty", + config.SYMBOL_ERROR, + config.SYMBOL_EMPTY, "string_lit", }) diff --git a/internal/parser/first/first.go b/internal/parser/first/first.go index 2455e0db..5938ff1f 100644 --- a/internal/parser/first/first.go +++ b/internal/parser/first/first.go @@ -18,6 +18,8 @@ import ( "fmt" "strings" + "github.com/maxcalandrelli/gocc/internal/config" + "github.com/maxcalandrelli/gocc/internal/ast" "github.com/maxcalandrelli/gocc/internal/parser/symbols" ) @@ -30,8 +32,6 @@ type FirstSets struct { symbols *symbols.Symbols } -const EMPTY = "empty" - //Returns the FirstSets of the Grammar. func GetFirstSets(g *ast.Grammar, symbols *symbols.Symbols) *FirstSets { firstSets := &FirstSets{ @@ -47,8 +47,8 @@ func GetFirstSets(g *ast.Grammar, symbols *symbols.Symbols) *FirstSets { again = false for _, prod := range g.SyntaxPart.ProdList { switch { - case len(prod.Body.Symbols) == 0: - if firstSets.AddToken(prod.Id, EMPTY) { + case prod.Body.Empty(): + if firstSets.AddToken(prod.Id, config.SYMBOL_EMPTY) { again = true } case symbols.IsTerminal(prod.Body.Symbols[0].SymbolString()): @@ -144,14 +144,14 @@ func FirstS(firstSets *FirstSets, symbols []string) (first SymbolSet) { } fst := First(firstSets, symbols[0]) first.AddSet(fst) - _, containEmpty := fst["empty"] + _, containEmpty := fst[config.SYMBOL_EMPTY] for i := 1; i < len(symbols) && containEmpty; i++ { fst = First(firstSets, symbols[i]) first.AddSet(fst) - _, containEmpty = fst["empty"] + _, containEmpty = fst[config.SYMBOL_EMPTY] } if !containEmpty { - delete(first, "empty") + delete(first, config.SYMBOL_EMPTY) } return } diff --git a/internal/parser/gen/golang/productionstable.go b/internal/parser/gen/golang/productionstable.go index 92b15e63..0bb7ae5b 100644 --- a/internal/parser/gen/golang/productionstable.go +++ b/internal/parser/gen/golang/productionstable.go @@ -53,7 +53,7 @@ func getProdsTab(header string, prods ast.SyntaxProdList, symbols *symbols.Symbo data.ProdTab[i].String = fmt.Sprintf("`%s`", prod.String()) data.ProdTab[i].Id = prod.Id data.ProdTab[i].NTType = symbols.NTType(prod.Id) - isEmpty := prod.Body.Symbols[0].SymbolString() == "empty" + isEmpty := prod.Body.Empty() if isEmpty { data.ProdTab[i].NumSymbols = 0 } else { @@ -69,7 +69,6 @@ func getProdsTab(header string, prods ast.SyntaxProdList, symbols *symbols.Symbo data.ProdTab[i].ReduceFunc = "return X[0], nil" } } - data.TokenImport= path.Join(pkg, "token"), return data } @@ -80,12 +79,12 @@ type prodsTabData struct { } type prodTabEntry struct { - String string - Id string - NTType int - NumSymbols int - ReduceFunc string - TokenImport string + String string + Id string + NTType int + NumSymbols int + ReduceFunc string + TokenImport string } const prodsTabSrc = ` @@ -95,10 +94,6 @@ package parser {{.Header}} -import ( - "{{.TokenImport}}" -) - type ( diff --git a/internal/parser/lr1/items/item.go b/internal/parser/lr1/items/item.go index e496db02..bf060e66 100644 --- a/internal/parser/lr1/items/item.go +++ b/internal/parser/lr1/items/item.go @@ -18,6 +18,8 @@ import ( "fmt" "strings" + "github.com/maxcalandrelli/gocc/internal/config" + "github.com/maxcalandrelli/gocc/internal/ast" "github.com/maxcalandrelli/gocc/internal/parser/lr1/action" ) @@ -46,7 +48,7 @@ func NewItem(prodIdx int, prod *ast.SyntaxProd, pos int, followingSymbol string) Pos: pos, FollowingSymbol: followingSymbol, } - if prod.Body.Symbols[0].SymbolString() == "empty" { + if prod.Body.Empty() { item.Len = 0 } else { item.Len = len(prod.Body.Symbols) @@ -72,8 +74,8 @@ func NewItem(prodIdx int, prod *ast.SyntaxProd, pos int, followingSymbol string) func (this *Item) accept(sym string) bool { return this.ProdIdx == 0 && this.Pos >= this.Len && - this.FollowingSymbol == "$" && - sym == "$" + config.SYMBOL_EOF == this.FollowingSymbol && + config.SYMBOL_EOF == sym } /* @@ -81,7 +83,7 @@ If the action is shift the next state is nextState */ func (this *Item) action(sym string, nextState int) action.Action { switch { - case sym == "INVALID": + case config.SYMBOL_INVALID == sym: return action.ERROR case this.accept(sym): return action.ACCEPT @@ -94,7 +96,7 @@ func (this *Item) action(sym string, nextState int) action.Action { } func (this *Item) canRecover() bool { - return this.Len > 0 && this.Body[0] == "error" + return this.Len > 0 && config.SYMBOL_ERROR == this.Body[0] } //Returns whether two Items are equal based on their ProdIdx, Pos and NextToken. @@ -127,7 +129,7 @@ func (this *Item) getString() string { buf := new(strings.Builder) fmt.Fprintf(buf, "%s : ", this.Id) if this.Len == 0 { - fmt.Fprintf(buf, "empty") + fmt.Fprintf(buf, config.SYMBOL_EMPTY) } else { for i, s := range this.Body { if this.Pos == i { diff --git a/internal/parser/lr1/items/itemsets.go b/internal/parser/lr1/items/itemsets.go index 0ba64d68..2212e7c8 100644 --- a/internal/parser/lr1/items/itemsets.go +++ b/internal/parser/lr1/items/itemsets.go @@ -18,6 +18,8 @@ import ( "fmt" "strings" + "github.com/maxcalandrelli/gocc/internal/config" + "github.com/maxcalandrelli/gocc/internal/ast" "github.com/maxcalandrelli/gocc/internal/parser/first" "github.com/maxcalandrelli/gocc/internal/parser/symbols" @@ -118,6 +120,6 @@ func InitialItemSet(g *ast.Grammar, symbols *symbols.Symbols, fs *first.FirstSet set := NewItemSet(symbols, g.SyntaxPart.ProdList, fs) set.SetNo = 0 prod := g.SyntaxPart.ProdList[0] - set.AddItem(NewItem(0, prod, 0, "$")) + set.AddItem(NewItem(0, prod, 0, config.SYMBOL_EOF)) return set } diff --git a/internal/parser/symbols/symbols.go b/internal/parser/symbols/symbols.go index 887d61de..3ed609a5 100644 --- a/internal/parser/symbols/symbols.go +++ b/internal/parser/symbols/symbols.go @@ -21,6 +21,8 @@ import ( "fmt" "strings" + "github.com/maxcalandrelli/gocc/internal/config" + "github.com/maxcalandrelli/gocc/internal/ast" ) @@ -54,8 +56,8 @@ func NewSymbols(grammar *ast.Grammar) *Symbols { stringLitList: make([]string, 0, 16), } - symbols.Add("INVALID") - symbols.Add("$") + symbols.Add(config.SYMBOL_INVALID) + symbols.Add(config.SYMBOL_EOF) if grammar.SyntaxPart == nil { return symbols diff --git a/internal/test/t1/parser/parser.go b/internal/test/t1/parser/parser.go index 9f35838c..d6a60783 100644 --- a/internal/test/t1/parser/parser.go +++ b/internal/test/t1/parser/parser.go @@ -6,6 +6,8 @@ import ( "fmt" "strings" + "github.com/maxcalandrelli/gocc/internal/config" + parseError "github.com/maxcalandrelli/gocc/internal/test/t1/errors" "github.com/maxcalandrelli/gocc/internal/test/t1/token" ) @@ -121,7 +123,7 @@ func (p *Parser) Error(err error, scanner Scanner) (recovered bool, errorAttrib } } - if action := actionTab[p.stack.top()].actions[token.TokMap.Type("error")]; action != nil { + if action := actionTab[p.stack.top()].actions[token.TokMap.Type(config.CurrentConfiguration.GetCanonicalSymbols(config.SYMBOL_ERROR)[0])]; action != nil { p.stack.push(int(action.(shift)), errorAttrib) // action can only be shift } else { return diff --git a/main.go b/main.go index 53eded8b..73848eae 100644 --- a/main.go +++ b/main.go @@ -1,3 +1,7 @@ +// +//go:generate go run stock/main.go -a -v -o internal/fe2 spec/gocc2.ebnf +// + //Copyright 2013 Vastech SA (PTY) LTD // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -13,17 +17,17 @@ // limitations under the License. //Gocc is LR1 parser generator for go written in go. The generator uses a BNF with very easy to use SDT rules. -//Please see https://github.com/maxcalandrelli/gocc/ for more documentation. +//Please see https://github.com/goccmack/gocc/ for more documentation. /* Modified by: Massimiliano Calandrelli Changes: changed all go files using import from - https://github.com/maxcalandrelli/gocc + https://github.com/goccmack/gocc to import from https://github.com/maxcalandrelli/gocc - use original gocc (https://github.com/maxcalandrelli/gocc) to reproduce + use original gocc (https://github.com/goccmack/gocc) to reproduce the initial (handwritten?) parser added file internal/ast/sdthlp.go changed file spec/gocc.bnf @@ -54,9 +58,9 @@ import ( "github.com/maxcalandrelli/gocc/internal/ast" "github.com/maxcalandrelli/gocc/internal/config" - "github.com/maxcalandrelli/gocc/internal/frontend/lexer" - "github.com/maxcalandrelli/gocc/internal/frontend/parser" - _ "github.com/maxcalandrelli/gocc/internal/frontend/token" + newscanner "github.com/maxcalandrelli/gocc/internal/fe2/lexer" + newparser "github.com/maxcalandrelli/gocc/internal/fe2/parser" + "github.com/maxcalandrelli/gocc/internal/fe2/token" "github.com/maxcalandrelli/gocc/internal/io" genLexer "github.com/maxcalandrelli/gocc/internal/lexer/gen/golang" lexItems "github.com/maxcalandrelli/gocc/internal/lexer/items" @@ -83,24 +87,25 @@ func main() { } if cfg.Help() { + fmt.Fprintf(os.Stderr, "gocc version 1.1.0006\n") flag.Usage() } - /* - scanner := &scanner.Scanner{} - scanner.Init(srcBuffer, token.FRONTENDTokens) - - parser := parser.NewParser(parser.ActionTable, parser.GotoTable, parser.ProductionsTable, token.FRONTENDTokens) - */ + config.CurrentConfiguration = cfg srcBuffer, err := ioutil.ReadFile(cfg.SourceFile()) if err != nil { fmt.Println(err) os.Exit(1) } - scanner := lexer.NewLexer(srcBuffer) - p := parser.NewParser() - grammar, err := p.Parse(scanner) + + var ( + grammar interface{} + ) + ast.StringGetter = func(v interface{}) string { return string(v.(*token.Token).Lit) } + scanner := newscanner.NewLexer(srcBuffer) + p := newparser.NewParser() + grammar, err = p.Parse(scanner) if err != nil { fmt.Printf("Parse error: %s\n", err) os.Exit(1) @@ -143,7 +148,6 @@ func main() { genToken.Gen(cfg.Package(), cfg.OutDir(), tokenMap) genUtil.Gen(cfg.OutDir()) - } func usage() { diff --git a/spec/gocc2.ebnf b/spec/gocc2.ebnf index ad40ccab..5fe23775 100644 --- a/spec/gocc2.ebnf +++ b/spec/gocc2.ebnf @@ -13,30 +13,22 @@ // limitations under the License. + + !comment : _lineComment | _blockComment ; -_lineComment : '/' '/' {.} '\n' ; -_blockComment : '/' '*' {. | '*'} '*' '/' ; !whitespace : ' ' | '\t' | '\n' | '\r' ; -tokId : _tokId ; - +_lineComment : '/' '/' {.} '\n' ; +_blockComment : '/' '*' {. | '*'} '*' '/' ; _tokId : _lowcase {_id_char} ; - _lowcase : 'a'-'z' ; - _id_char : _upcase | _lowcase | '_' | _digit ; - _upcase : 'A'-'Z' ; +_digit : '0'-'9' ; -_digit : '0' '9' ; - -regDefId : '_' {_id_char} ; - -ignoredTokId : '!' _tokId ; - -char_lit : '\'' (_unicode_value | _byte_value) '\'' ; _unicode_value + : . // Any UTF-8 character literal | _little_u_value | _big_u_value @@ -79,14 +71,24 @@ _hex_digit | 'a' - 'f' ; +_raw_string + : '`' {.} '`' + ; -_hex_digit_alt - : '0' - '9' - | 'A' - 'F' - | 'a' - 'z' - | ~ ( 'g' - 'z') +_interpreted_string + : '"' { _unicode_value | _byte_value } '"' ; + + +tokId : _tokId ; + +regDefId : '_' {_id_char} ; + +ignoredTokId : '!' _tokId ; + +char_lit : '\'' (_unicode_value | _byte_value) '\'' ; + prodId : _upcase {_id_char} ; @@ -101,97 +103,205 @@ string_lit | _interpreted_string ; -_raw_string - : '`' {.} '`' - ; - -_interpreted_string - : '"' { _unicode_value | _byte_value } '"' - ; - - - - - - - - - /*** Syntactic items ***/ << import "github.com/maxcalandrelli/gocc/internal/ast" >> -Grammar : LexicalPart SyntaxPart << ast.NewGrammar($0, $1) >> - | LexicalPart << ast.NewGrammar($0, nil) >> - | SyntaxPart << ast.NewGrammar(nil, $0) >> - ; - -LexicalPart : LexProductions << ast.NewLexPart(nil, nil, $0) >> - ; - - -LexProductions : LexProduction << ast.NewLexProductions($0) >> - | LexProductions LexProduction << ast.AppendLexProduction($0, $1) >> - ; - -LexProduction : tokId ":" LexPattern ";" << ast.NewLexTokDef($0, $2) >> - | regDefId ":" LexPattern ";" << ast.NewLexRegDef($0, $2) >> - | ignoredTokId ":" LexPattern ";" << ast.NewLexIgnoredTokDef($0, $2) >> - ; - -LexPattern : LexAlt << ast.NewLexPattern($0) >> - | LexPattern "|" LexAlt << ast.AppendLexAlt($0, $2) >> - ; - -LexAlt : LexTerm << ast.NewLexAlt($0) >> - | LexAlt LexTerm << ast.AppendLexTerm($0, $1) >> - ; - -LexTerm : "." << ast.LexDOT, nil >> - | char_lit << ast.NewLexCharLit($0, false) >> - | "~" char_lit << ast.NewLexCharLit($0, true) >> - | char_lit "-" char_lit << ast.NewLexCharRange($0, $2, false) >> - | "~" "(" char_lit "-" char_lit ")" << ast.NewLexCharRange($2, $4, true) >> - | regDefId << ast.NewLexRegDefId($0) >> - | "[" LexPattern "]" << ast.NewLexOptPattern($1) >> - | "{" LexPattern "}" << ast.NewLexRepPattern($1) >> - | "(" LexPattern ")" << ast.NewLexGroupPattern($1) >> - ; - -SyntaxPart : FileHeader SyntaxProdList << ast.NewSyntaxPart($0, $1) >> - | SyntaxProdList << ast.NewSyntaxPart(nil, $0) >> - ; - -FileHeader : g_sdt_lit << ast.NewFileHeader($0) >> - ; - -SyntaxProdList : SyntaxProduction << ast.NewSyntaxProdList($0) >> - | SyntaxProdList SyntaxProduction << ast.AddSyntaxProds($0, $1) >> - ; - -SyntaxProduction : prodId ":" Alternatives ";" << ast.NewSyntaxProd($0, $2) >> - ; - -Alternatives : SyntaxBody << ast.NewSyntaxAlts($0) >> - | Alternatives "|" SyntaxBody << ast.AddSyntaxAlt($0, $2) >> - ; - -SyntaxBody : Symbols << ast.NewSyntaxBody($0, nil) >> - | Symbols g_sdt_lit << ast.NewSyntaxBody($0, $1) >> - | "error" << ast.NewErrorBody(nil, nil) >> - | "error" Symbols << ast.NewErrorBody($1, nil) >> - | "error" Symbols g_sdt_lit << ast.NewErrorBody($1, $2) >> - | "empty" << ast.NewEmptyBody() >> - ; - -Symbols : Symbol << ast.NewSyntaxSymbols($0) >> - | Symbols Symbol << ast.AddSyntaxSymbol($0, $1) >> - ; - -Symbol : prodId << ast.NewSyntaxProdId($0) >> - | tokId << ast.NewTokId($0) >> - | string_lit << ast.NewStringLit($0) >> - ; +Grammar : + LexicalPart + SyntaxPart + << ast.NewGrammar($0, $1) >> + | + LexicalPart + << ast.NewGrammar($0, nil) >> + | + SyntaxPart + << ast.NewGrammar(nil, $0) >> +; + +LexicalPart : + LexProductions + << ast.NewLexPart(nil, nil, $0) >> +; + +LexProductions : + LexProduction + << ast.NewLexProductions($0) >> + | + LexProductions + LexProduction + << ast.AppendLexProduction($0, $1) >> +; + +LexProduction : + tokId + ":" + LexPattern + ";" + << ast.NewLexTokDef($0, $2) >> + | + regDefId + ":" + LexPattern + ";" + << ast.NewLexRegDef($0, $2) >> + | + ignoredTokId + ":" + LexPattern + ";" + << ast.NewLexIgnoredTokDef($0, $2) >> +; + +LexPattern : + LexAlt + << ast.NewLexPattern($0) >> + | + LexPattern + "|" + LexAlt + << ast.AppendLexAlt($0, $2) >> +; + +LexAlt : + LexTerm + << ast.NewLexAlt($0) >> + | + LexAlt + LexTerm + << ast.AppendLexTerm($0, $1) >> +; + +LexTerm : + "." + << ast.LexDOT, nil >> + | + char_lit + << ast.NewLexCharLitExt($0,false) >> + | + char_lit "-" char_lit + << ast.NewLexCharRangeExt($0, $2,false) >> + | + "~" char_lit + << ast.NewLexCharLitExt($0, true) >> + | + "~" "(" char_lit "-" char_lit ")" + << ast.NewLexCharRangeExt($2, $4, true) >> + | + regDefId + << ast.NewLexRegDefId($0) >> + | + "[" + LexPattern + "]" + << ast.NewLexOptPattern($1) >> + | + "{" + LexPattern + "}" + << ast.NewLexRepPattern($1) >> + | + "(" + LexPattern + ")" + << ast.NewLexGroupPattern($1) >> +; + +SyntaxPart : + FileHeader + SyntaxProdList + << ast.NewSyntaxPart($0, $1) >> + | + SyntaxProdList + << ast.NewSyntaxPart(nil, $0) >> +; + +FileHeader : + g_sdt_lit + << ast.NewFileHeader($0) >> +; + +SyntaxProdList : + SyntaxProduction + << ast.NewSyntaxProdList($0) >> + | + SyntaxProdList + SyntaxProduction + << ast.AddSyntaxProds($0, $1) >> +; + +SyntaxProduction : + prodId + ":" + Alternatives + ";" + << ast.NewSyntaxProd($0, $2) >> +; + +Alternatives : + SyntaxBody + << ast.NewSyntaxAlts($0) >> + | + Alternatives + "|" + SyntaxBody + << ast.AddSyntaxAlt($0, $2) >> +; + +SyntaxBody : + Symbols + << ast.NewSyntaxBodyGen($0, nil) >> + | + Symbols g_sdt_lit + << ast.NewSyntaxBodyGen($0, $1) >> + | + ErrorSymbol + << ast.NewErrorBodyGen(nil, nil) >> + | + ErrorSymbol Symbols + << ast.NewErrorBodyGen($1, nil) >> + | + ErrorSymbol Symbols g_sdt_lit + << ast.NewErrorBodyGen($1, $2) >> + | + ErrorSymbol g_sdt_lit + << ast.NewErrorBodyGen(nil, $1) >> + | + EpsilonSymbol + << ast.NewEmptyBodyGen() >> +; + +Symbols : + Symbol + << ast.NewSyntaxSymbols($0) >> + | + Symbols + Symbol + << ast.AddSyntaxSymbol($0, $1) >> +; + +Symbol : + prodId + << ast.NewSyntaxProdId($0) >> + | + tokId + << ast.NewTokId($0) >> + | + string_lit + << ast.NewStringLit($0) >> +; + +ErrorSymbol : + "error" + | + "λ" +; + +EpsilonSymbol : + "empty" + | + "ε" +; diff --git a/spec/test.bnf b/spec/test.bnf new file mode 100644 index 00000000..7852621d --- /dev/null +++ b/spec/test.bnf @@ -0,0 +1,21 @@ + + +hexdigit : '0'-'F' ;// ~(':'-'@') ; + +Test1: + "try" Test2 +; + +Test2 : Test3 | Test1; + +Test3 : +"not" "empty" +| +T +| +hexdigit +; + +T : "a" | error Test1 | "X" | X ; + +X : "error" | "empty" | "ε" | "λ" | error | empty | ε | λ ; diff --git a/stock/main.go b/stock/main.go new file mode 100644 index 00000000..48b8b7e5 --- /dev/null +++ b/stock/main.go @@ -0,0 +1,175 @@ +//Copyright 2013 Vastech SA (PTY) LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//Gocc is LR1 parser generator for go written in go. The generator uses a BNF with very easy to use SDT rules. +//Please see https://github.com/goccmack/gocc/ for more documentation. + +package main + +import ( + "bytes" + "flag" + "fmt" + "io/ioutil" + "os" + "path" + "strings" + + "github.com/maxcalandrelli/gocc/internal/ast" + "github.com/maxcalandrelli/gocc/internal/config" + oldparser "github.com/maxcalandrelli/gocc/internal/frontend/parser" + oldscanner "github.com/maxcalandrelli/gocc/internal/frontend/scanner" + oldtoken "github.com/maxcalandrelli/gocc/internal/frontend/token" + "github.com/maxcalandrelli/gocc/internal/io" + genLexer "github.com/maxcalandrelli/gocc/internal/lexer/gen/golang" + lexItems "github.com/maxcalandrelli/gocc/internal/lexer/items" + "github.com/maxcalandrelli/gocc/internal/parser/first" + genParser "github.com/maxcalandrelli/gocc/internal/parser/gen" + lr1Action "github.com/maxcalandrelli/gocc/internal/parser/lr1/action" + lr1Items "github.com/maxcalandrelli/gocc/internal/parser/lr1/items" + "github.com/maxcalandrelli/gocc/internal/parser/symbols" + outToken "github.com/maxcalandrelli/gocc/internal/token" + genToken "github.com/maxcalandrelli/gocc/internal/token/gen" + genUtil "github.com/maxcalandrelli/gocc/internal/util/gen" +) + +func main() { + flag.Usage = usage + cfg, err := config.New() + if err != nil { + fmt.Printf("Error reading configuration: %s\n", err) + flag.Usage() + } + + if cfg.Verbose() { + cfg.PrintParams() + } + + if cfg.Help() { + fmt.Fprintf(os.Stderr, "gocc base version\n") + flag.Usage() + } + + config.CurrentConfiguration = cfg + + srcBuffer, err := ioutil.ReadFile(cfg.SourceFile()) + if err != nil { + fmt.Println(err) + os.Exit(1) + } + + var ( + grammar interface{} + ) + ast.StringGetter = func(v interface{}) string { return string(v.(*oldtoken.Token).Lit) } + scanner := &oldscanner.Scanner{} + scanner.Init(srcBuffer, oldtoken.FRONTENDTokens) + parser := oldparser.NewParser(oldparser.ActionTable, oldparser.GotoTable, oldparser.ProductionsTable, oldtoken.FRONTENDTokens) + grammar, err = parser.Parse(scanner) + if err != nil { + fmt.Printf("Parse error: %s\n", err) + os.Exit(1) + } + + g := grammar.(*ast.Grammar) + + gSymbols := symbols.NewSymbols(g) + if cfg.Verbose() { + writeTerminals(gSymbols, cfg) + } + + var tokenMap *outToken.TokenMap + + gSymbols.Add(g.LexPart.TokenIds()...) + g.LexPart.UpdateStringLitTokens(gSymbols.ListStringLitSymbols()) + lexSets := lexItems.GetItemSets(g.LexPart) + if cfg.Verbose() { + io.WriteFileString(path.Join(cfg.OutDir(), "lexer_sets.txt"), lexSets.String()) + } + tokenMap = outToken.NewTokenMap(gSymbols.ListTerminals()) + if !cfg.NoLexer() { + genLexer.Gen(cfg.Package(), cfg.OutDir(), g.LexPart.Header.SDTLit, lexSets, tokenMap, cfg) + } + + if g.SyntaxPart != nil { + firstSets := first.GetFirstSets(g, gSymbols) + if cfg.Verbose() { + io.WriteFileString(path.Join(cfg.OutDir(), "first.txt"), firstSets.String()) + } + + lr1Sets := lr1Items.GetItemSets(g, gSymbols, firstSets) + if cfg.Verbose() { + io.WriteFileString(path.Join(cfg.OutDir(), "LR1_sets.txt"), lr1Sets.String()) + } + + conflicts := genParser.Gen(cfg.Package(), cfg.OutDir(), g.SyntaxPart.Header.SDTLit, g.SyntaxPart.ProdList, gSymbols, lr1Sets, tokenMap, cfg) + handleConflicts(conflicts, lr1Sets.Size(), cfg, g.SyntaxPart.ProdList) + } + + genToken.Gen(cfg.Package(), cfg.OutDir(), tokenMap) + genUtil.Gen(cfg.OutDir()) +} + +func usage() { + fmt.Fprintf(os.Stderr, "usage: gocc flags bnf_file\n\n") + fmt.Fprintf(os.Stderr, " bnf_file: contains the BNF grammar\n\n") + fmt.Fprintf(os.Stderr, "Flags:\n") + flag.PrintDefaults() + os.Exit(1) +} + +func handleConflicts(conflicts map[int]lr1Items.RowConflicts, numSets int, cfg config.Config, prods ast.SyntaxProdList) { + if len(conflicts) <= 0 { + return + } + fmt.Printf("%d LR-1 conflicts \n", len(conflicts)) + if cfg.Verbose() { + io.WriteFileString(path.Join(cfg.OutDir(), "LR1_conflicts.txt"), conflictString(conflicts, numSets, prods)) + } + if !cfg.AutoResolveLRConf() { + os.Exit(1) + } +} + +func conflictString(conflicts map[int]lr1Items.RowConflicts, numSets int, prods ast.SyntaxProdList) string { + w := new(strings.Builder) + fmt.Fprintf(w, "%d LR-1 conflicts: \n", len(conflicts)) + for i := 0; i < numSets; i++ { + if cnf, exist := conflicts[i]; exist { + fmt.Fprintf(w, "\tS%d\n", i) + for sym, conflicts := range cnf { + fmt.Fprintf(w, "\t\tsymbol: %s\n", sym) + for _, cflct := range conflicts { + switch c := cflct.(type) { + case lr1Action.Reduce: + fmt.Fprintf(w, "\t\t\tReduce(%d:%s)\n", c, prods[c]) + case lr1Action.Shift: + fmt.Fprintf(w, "\t\t\t%s\n", cflct) + default: + panic(fmt.Sprintf("unexpected type of action: %s", cflct)) + } + } + } + } + } + return w.String() +} + +func writeTerminals(gSymbols *symbols.Symbols, cfg config.Config) { + buf := new(bytes.Buffer) + for _, t := range gSymbols.ListTerminals() { + fmt.Fprintf(buf, "%s\n", t) + } + io.WriteFile(path.Join(cfg.OutDir(), "terminals.txt"), buf.Bytes()) +} From 0cc60392054b1c3b16c29a985ae5026989caf457 Mon Sep 17 00:00:00 2001 From: Massimiliano Calandrelli Date: Fri, 4 Oct 2019 15:37:03 +0200 Subject: [PATCH 03/33] ... --- internal/base/gen/gen.go | 23 ++++++++++++++ internal/base/gen/golang/base.go | 53 ++++++++++++++++++++++++++++++++ internal/fe2/fe2.go | 18 +++++++++++ main.go | 2 ++ spec/test.bnf | 6 +++- 5 files changed, 101 insertions(+), 1 deletion(-) create mode 100644 internal/base/gen/gen.go create mode 100644 internal/base/gen/golang/base.go create mode 100644 internal/fe2/fe2.go diff --git a/internal/base/gen/gen.go b/internal/base/gen/gen.go new file mode 100644 index 00000000..2940cea2 --- /dev/null +++ b/internal/base/gen/gen.go @@ -0,0 +1,23 @@ +//Copyright 2013 Vastech SA (PTY) LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package gen + +import ( + "github.com/maxcalandrelli/gocc/internal/base/gen/golang" +) + +func Gen(pkg, outdir string) { + golang.GenBase(pkg, outdir) +} diff --git a/internal/base/gen/golang/base.go b/internal/base/gen/golang/base.go new file mode 100644 index 00000000..5eb8e516 --- /dev/null +++ b/internal/base/gen/golang/base.go @@ -0,0 +1,53 @@ +//Copyright 2013 Vastech SA (PTY) LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package golang + +import ( + "bytes" + "go/format" + "path" + "text/template" + + "github.com/maxcalandrelli/gocc/internal/io" +) + +type data struct { + MyName string +} + +func GenBase(pkg, outdir string) { + baseName := path.Base(outdir) + tokenPath := path.Join(outdir, baseName+".go") + tmpl, err := template.New(baseName).Parse(TokenMapSrc[1:]) + if err != nil { + panic(err) + } + buf := new(bytes.Buffer) + err = tmpl.Execute(buf, data{MyName: baseName}) + // Use go/format to indent the idMap literal correctly. + source, err := format.Source(buf.Bytes()) + if err != nil { + panic(err) + } + io.WriteFile(tokenPath, source) +} + +const TokenMapSrc string = ` +// Code generated by gocc; DO NOT EDIT. + +package {{.MyName}} + + +` diff --git a/internal/fe2/fe2.go b/internal/fe2/fe2.go new file mode 100644 index 00000000..4e658ed3 --- /dev/null +++ b/internal/fe2/fe2.go @@ -0,0 +1,18 @@ +package fe2 + +import ( + "github.com/maxcalandrelli/gocc/internal/fe2/lexer" + "github.com/maxcalandrelli/gocc/internal/fe2/parser" +) + +func NewParser() *parser.Parser { + return parser.NewParser() +} + +func NewLexer(src []byte) *lexer.Lexer { + return lexer.NewLexer(src) +} + +func NewLexerFile(fpath string) (*lexer.Lexer, error) { + return lexer.NewLexerFile(fpath) +} diff --git a/main.go b/main.go index 73848eae..f9fac154 100644 --- a/main.go +++ b/main.go @@ -57,6 +57,7 @@ import ( "strings" "github.com/maxcalandrelli/gocc/internal/ast" + genBase "github.com/maxcalandrelli/gocc/internal/base/gen" "github.com/maxcalandrelli/gocc/internal/config" newscanner "github.com/maxcalandrelli/gocc/internal/fe2/lexer" newparser "github.com/maxcalandrelli/gocc/internal/fe2/parser" @@ -148,6 +149,7 @@ func main() { genToken.Gen(cfg.Package(), cfg.OutDir(), tokenMap) genUtil.Gen(cfg.OutDir()) + genBase.Gen(cfg.Package(), cfg.OutDir()) } func usage() { diff --git a/spec/test.bnf b/spec/test.bnf index 7852621d..5ef30d97 100644 --- a/spec/test.bnf +++ b/spec/test.bnf @@ -1,6 +1,10 @@ -hexdigit : '0'-'F' ;// ~(':'-'@') ; +hexdigit : '0'-'F' ~(':'-'@') ; + +Test : + Test1 +; Test1: "try" Test2 From 16b0b3b28560007385b391e737a4829b2e8c0571 Mon Sep 17 00:00:00 2001 From: Massimiliano Calandrelli Date: Sun, 6 Oct 2019 18:35:10 +0200 Subject: [PATCH 04/33] charset range negation working --- internal/ast/reconcile.go | 7 + internal/ast/syntaxempty.go | 4 + internal/ast/syntaxeof.go | 6 +- internal/ast/syntaxerror.go | 4 + internal/ast/syntaxprodid.go | 8 + internal/ast/syntaxstringlit.go | 6 + internal/ast/syntaxsymbol.go | 1 + internal/ast/syntaxtokid.go | 4 + internal/base/gen/gen.go | 4 +- internal/base/gen/golang/base.go | 135 +- internal/config/config.go | 18 +- internal/fe2/fe2.go | 41 +- internal/fe2/{ => internal}/errors/errors.go | 2 +- .../io/stream/internal/stream_impl.go | 275 ++ .../io/stream/internal/stream_public.go | 101 + internal/fe2/internal/io/stream/stream.go | 39 + internal/fe2/{ => internal}/lexer/acttab.go | 90 +- internal/fe2/{ => internal}/lexer/lexer.go | 116 +- .../{ => internal}/lexer/transitiontable.go | 696 ++-- internal/fe2/{ => internal}/parser/action.go | 0 .../fe2/{ => internal}/parser/actiontable.go | 1325 ++++---- .../fe2/{ => internal}/parser/gototable.go | 246 +- internal/fe2/{ => internal}/parser/parser.go | 6 +- .../{ => internal}/parser/productionstable.go | 6 +- internal/fe2/{ => internal}/token/token.go | 30 +- internal/fe2/{ => internal}/util/litconv.go | 0 internal/fe2/{ => internal}/util/rune.go | 0 internal/fe2/log/LR1_conflicts.txt | 17 + internal/fe2/{ => log}/LR1_sets.txt | 2822 ++++++++--------- internal/fe2/{ => log}/first.txt | 12 +- internal/fe2/{ => log}/lexer_sets.txt | 811 +++-- internal/fe2/{ => log}/terminals.txt | 3 +- internal/fe2/main/main.go | 38 + internal/io/gen/gen.go | 23 + internal/io/gen/golang/gen.go | 491 +++ internal/lexer/gen/golang/acttab.go | 10 +- internal/lexer/gen/golang/gen.go | 8 +- internal/lexer/gen/golang/lexer.go | 12 +- internal/lexer/gen/golang/transtab.go | 4 +- internal/lexer/items/disjunctrangeset.go | 64 +- internal/lexer/items/disjunctrangeset_test.go | 48 +- internal/lexer/items/itemset.go | 27 +- internal/parser/gen/gen.go | 15 +- internal/parser/gen/golang/action.go | 4 +- internal/parser/gen/golang/actiontable.go | 10 +- internal/parser/gen/golang/errors.go | 6 +- internal/parser/gen/golang/gototable.go | 10 +- internal/parser/gen/golang/parser.go | 12 +- .../parser/gen/golang/productionstable.go | 4 +- internal/parser/symbols/symbols.go | 2 + internal/token/gen/gen.go | 4 +- internal/token/gen/golang/token.go | 4 +- internal/util/gen/gen.go | 6 +- internal/util/gen/golang/litconv.go | 4 +- internal/util/gen/golang/rune.go | 4 +- main.go | 63 +- spec/gocc2.ebnf | 4 +- spec/test.bnf | 11 +- stock/main.go | 33 +- 59 files changed, 4381 insertions(+), 3375 deletions(-) rename internal/fe2/{ => internal}/errors/errors.go (95%) create mode 100644 internal/fe2/internal/io/stream/internal/stream_impl.go create mode 100644 internal/fe2/internal/io/stream/internal/stream_public.go create mode 100644 internal/fe2/internal/io/stream/stream.go rename internal/fe2/{ => internal}/lexer/acttab.go (96%) rename internal/fe2/{ => internal}/lexer/lexer.go (81%) rename internal/fe2/{ => internal}/lexer/transitiontable.go (94%) rename internal/fe2/{ => internal}/parser/action.go (100%) rename internal/fe2/{ => internal}/parser/actiontable.go (90%) rename internal/fe2/{ => internal}/parser/gototable.go (98%) rename internal/fe2/{ => internal}/parser/parser.go (96%) rename internal/fe2/{ => internal}/parser/productionstable.go (98%) rename internal/fe2/{ => internal}/token/token.go (82%) rename internal/fe2/{ => internal}/util/litconv.go (100%) rename internal/fe2/{ => internal}/util/rune.go (100%) create mode 100644 internal/fe2/log/LR1_conflicts.txt rename internal/fe2/{ => log}/LR1_sets.txt (71%) rename internal/fe2/{ => log}/first.txt (95%) rename internal/fe2/{ => log}/lexer_sets.txt (91%) rename internal/fe2/{ => log}/terminals.txt (92%) create mode 100644 internal/fe2/main/main.go create mode 100644 internal/io/gen/gen.go create mode 100644 internal/io/gen/golang/gen.go diff --git a/internal/ast/reconcile.go b/internal/ast/reconcile.go index 8356704c..83b56ea8 100644 --- a/internal/ast/reconcile.go +++ b/internal/ast/reconcile.go @@ -1,9 +1,16 @@ package ast +import ( + "github.com/maxcalandrelli/gocc/internal/frontend/token" +) + var ( StringGetter func(interface{}) string ) func getString(v interface{}) string { + if StringGetter == nil { + return string(v.(*token.Token).Lit) + } return StringGetter(v) } diff --git a/internal/ast/syntaxempty.go b/internal/ast/syntaxempty.go index 094bef89..d3a17949 100644 --- a/internal/ast/syntaxempty.go +++ b/internal/ast/syntaxempty.go @@ -34,3 +34,7 @@ func (SyntaxEmpty) String() string { } func (SyntaxEmpty) IsEpsilon() bool { return true } + +func (SyntaxEmpty) SymbolName() string { + return config.INTERNAL_SYMBOL_EMPTY +} diff --git a/internal/ast/syntaxeof.go b/internal/ast/syntaxeof.go index 60a28a00..90ef5d51 100644 --- a/internal/ast/syntaxeof.go +++ b/internal/ast/syntaxeof.go @@ -25,10 +25,14 @@ type SyntaxEof struct { var eofSymbol = SyntaxEof{config.SYMBOL_EOF, StdSyntaxSymbol{}} -func (SyntaxEof) SymbolsString() string { +func (SyntaxEof) SymbolString() string { return eofSymbol.string } func (SyntaxEof) String() string { return eofSymbol.string } + +func (SyntaxEof) SymbolName() string { + return config.INTERNAL_SYMBOL_EOF +} diff --git a/internal/ast/syntaxerror.go b/internal/ast/syntaxerror.go index 7c08ec70..fc3d5feb 100644 --- a/internal/ast/syntaxerror.go +++ b/internal/ast/syntaxerror.go @@ -34,3 +34,7 @@ func (SyntaxError) String() string { } func (SyntaxError) IsError() bool { return true } + +func (SyntaxError) SymbolName() string { + return config.INTERNAL_SYMBOL_ERROR +} diff --git a/internal/ast/syntaxprodid.go b/internal/ast/syntaxprodid.go index 53fa1172..fac69198 100644 --- a/internal/ast/syntaxprodid.go +++ b/internal/ast/syntaxprodid.go @@ -14,6 +14,10 @@ package ast +import ( + "github.com/maxcalandrelli/gocc/internal/config" +) + // Id or name of a grammar(syntax) production type SyntaxProdId struct { string @@ -31,3 +35,7 @@ func (this SyntaxProdId) SymbolString() string { func (this SyntaxProdId) String() string { return this.string } + +func (this SyntaxProdId) SymbolName() string { + return config.INTERNAL_SYMBOL_PROD + this.string +} diff --git a/internal/ast/syntaxstringlit.go b/internal/ast/syntaxstringlit.go index edc34c50..b6741152 100644 --- a/internal/ast/syntaxstringlit.go +++ b/internal/ast/syntaxstringlit.go @@ -16,6 +16,8 @@ package ast import ( "fmt" + + "github.com/maxcalandrelli/gocc/internal/config" ) type SyntaxStringLit struct { @@ -39,3 +41,7 @@ func (this SyntaxStringLit) String() string { func (this SyntaxStringLit) Bytes() []byte { return []byte(this.string) } + +func (this SyntaxStringLit) SymbolName() string { + return config.INTERNAL_SYMBOL_LIT + this.string +} diff --git a/internal/ast/syntaxsymbol.go b/internal/ast/syntaxsymbol.go index 25b361f6..9f8a5e7c 100644 --- a/internal/ast/syntaxsymbol.go +++ b/internal/ast/syntaxsymbol.go @@ -18,6 +18,7 @@ package ast All syntax symbols are types of string */ type SyntaxSymbol interface { + SymbolName() string SymbolString() string String() string IsError() bool diff --git a/internal/ast/syntaxtokid.go b/internal/ast/syntaxtokid.go index 3b83d121..95fe5975 100644 --- a/internal/ast/syntaxtokid.go +++ b/internal/ast/syntaxtokid.go @@ -30,3 +30,7 @@ func (this SyntaxTokId) SymbolString() string { func (this SyntaxTokId) String() string { return this.string } + +func (this SyntaxTokId) SymbolName() string { + return this.string +} diff --git a/internal/base/gen/gen.go b/internal/base/gen/gen.go index 2940cea2..68228d79 100644 --- a/internal/base/gen/gen.go +++ b/internal/base/gen/gen.go @@ -18,6 +18,6 @@ import ( "github.com/maxcalandrelli/gocc/internal/base/gen/golang" ) -func Gen(pkg, outdir string) { - golang.GenBase(pkg, outdir) +func Gen(pkg, outdir, subpath string) { + golang.Gen(pkg, outdir, subpath) } diff --git a/internal/base/gen/golang/base.go b/internal/base/gen/golang/base.go index 5eb8e516..d331d9e0 100644 --- a/internal/base/gen/golang/base.go +++ b/internal/base/gen/golang/base.go @@ -24,30 +24,151 @@ import ( ) type data struct { - MyName string + MyName string + Pkg string + Outdir string + Subpath string } -func GenBase(pkg, outdir string) { +func Gen(pkg, outdir, subpath string) { baseName := path.Base(outdir) - tokenPath := path.Join(outdir, baseName+".go") - tmpl, err := template.New(baseName).Parse(TokenMapSrc[1:]) + d := data{ + MyName: baseName, + Pkg: pkg, + Outdir: outdir, + Subpath: subpath, + } + genBase(d) + genMain(d) +} + +func genBase(d data) { + basePath := path.Join(d.Outdir, d.MyName+".go") + tmpl, err := template.New(d.MyName).Parse(baseSrc[1:]) if err != nil { panic(err) } buf := new(bytes.Buffer) - err = tmpl.Execute(buf, data{MyName: baseName}) + err = tmpl.Execute(buf, d) // Use go/format to indent the idMap literal correctly. source, err := format.Source(buf.Bytes()) if err != nil { panic(err) } - io.WriteFile(tokenPath, source) + io.WriteFile(basePath, source) } -const TokenMapSrc string = ` +func genMain(d data) { + basePath := path.Join(d.Outdir, "main", "main.go") + tmpl, err := template.New(d.MyName).Parse(mainSrc[1:]) + if err != nil { + panic(err) + } + buf := new(bytes.Buffer) + err = tmpl.Execute(buf, d) + // Use go/format to indent the idMap literal correctly. + source, err := format.Source(buf.Bytes()) + if err != nil { + panic(err) + } + io.WriteFile(basePath, source) +} + +const baseSrc string = ` // Code generated by gocc; DO NOT EDIT. package {{.MyName}} +import ( + "io" + + "{{.Pkg}}/{{.Subpath}}/token" + "{{.Pkg}}/{{.Subpath}}/lexer" + "{{.Pkg}}/{{.Subpath}}/parser" + "{{.Pkg}}/{{.Subpath}}/io/stream" +) + +type Token = token.Token +type WindowReader = stream.WindowReader + + +func ParseFile(fpath string) (interface{}, error) { + if lexer, err := NewLexerFile(fpath); err == nil { + return NewParser().Parse(lexer) + } else { + return nil, err + } +} + +func ParseText(text string) (interface{}, error) { + return NewParser().Parse(NewLexer([]byte(text))) +} + +func NewLexer(src []byte) *lexer.Lexer { + return lexer.NewLexer(src) +} + +func NewLexerFile(fpath string) (*lexer.Lexer, error) { + return lexer.NewLexerFile(fpath) +} + +func NewParser() *parser.Parser { + return parser.NewParser() +} + + +func NewWindowReaderFromBytes(src []byte) WindowReader { + return stream.NewWindowReaderFromBytes(src) +} + +func NewWindowReader(rdr io.Reader) WindowReader { + return stream.NewWindowReader(rdr) +} + +func NewLimitedWindowReader(rdr io.Reader, sizeMin, sizeMax int) WindowReader { + return stream.NewLimitedWindowReader(rdr, sizeMin, sizeMax) +} + +` + +const mainSrc string = ` +package main + +import ( + "flag" + "fmt" + "os" + "strings" + + {{.MyName}} "{{.Pkg}}" +) + +func showResult (r interface{}, e error) { + if e != nil { + fmt.Fprintf(os.Stderr, "parsing returned the following error: %s\n", e.Error()) + } else { + fmt.Printf("%#v\n", r) + } +} + +var ( + File string + Text string +) + +func main () { + flag.StringVar(&File, "file", "", "parse also text in file") + flag.StringVar(&Text, "text", "", "parse also text given with flag") + flag.Parse() + if Text > "" { + showResult({{.MyName}}.ParseText(Text)) + } + if File > "" { + showResult({{.MyName}}.ParseFile(File)) + } + if str := strings.Join(os.Args[1:], " "); str > "" { + showResult({{.MyName}}.ParseText(str)) + } +} ` diff --git a/internal/config/config.go b/internal/config/config.go index 30713f68..2164be5a 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -26,14 +26,16 @@ import ( ) const ( - DISPLAY_SYMBOL_EMPTY = "ε" - DISPLAY_SYMBOL_ERROR = "λ(λάθος)" - DISPLAY_SYMBOL_INVALID = "ά(άκυρος)" - DISPLAY_SYMBOL_EOF = "Ω" - SYMBOL_EMPTY = "empty" - SYMBOL_ERROR = "error" - SYMBOL_INVALID = "" - SYMBOL_EOF = "Ω" + INTERNAL_SYMBOL_EMPTY = "ε" + INTERNAL_SYMBOL_ERROR = "λ" // (λάθος) + INTERNAL_SYMBOL_INVALID = "ά" // (άκυρος) + INTERNAL_SYMBOL_EOF = "Ω" + INTERNAL_SYMBOL_PROD = "Π:" + INTERNAL_SYMBOL_LIT = "Λ:" + SYMBOL_EMPTY = "empty" + SYMBOL_ERROR = "error" + SYMBOL_INVALID = "" + SYMBOL_EOF = "Ω" ) type ( diff --git a/internal/fe2/fe2.go b/internal/fe2/fe2.go index 4e658ed3..53849a8e 100644 --- a/internal/fe2/fe2.go +++ b/internal/fe2/fe2.go @@ -1,12 +1,29 @@ +// Code generated by gocc; DO NOT EDIT. + package fe2 import ( - "github.com/maxcalandrelli/gocc/internal/fe2/lexer" - "github.com/maxcalandrelli/gocc/internal/fe2/parser" + "io" + + "github.com/maxcalandrelli/gocc/internal/fe2/internal/io/stream" + "github.com/maxcalandrelli/gocc/internal/fe2/internal/lexer" + "github.com/maxcalandrelli/gocc/internal/fe2/internal/parser" + "github.com/maxcalandrelli/gocc/internal/fe2/internal/token" ) -func NewParser() *parser.Parser { - return parser.NewParser() +type Token = token.Token +type WindowReader = stream.WindowReader + +func ParseFile(fpath string) (interface{}, error) { + if lexer, err := NewLexerFile(fpath); err == nil { + return NewParser().Parse(lexer) + } else { + return nil, err + } +} + +func ParseText(text string) (interface{}, error) { + return NewParser().Parse(NewLexer([]byte(text))) } func NewLexer(src []byte) *lexer.Lexer { @@ -16,3 +33,19 @@ func NewLexer(src []byte) *lexer.Lexer { func NewLexerFile(fpath string) (*lexer.Lexer, error) { return lexer.NewLexerFile(fpath) } + +func NewParser() *parser.Parser { + return parser.NewParser() +} + +func NewWindowReaderFromBytes(src []byte) WindowReader { + return stream.NewWindowReaderFromBytes(src) +} + +func NewWindowReader(rdr io.Reader) WindowReader { + return stream.NewWindowReader(rdr) +} + +func NewLimitedWindowReader(rdr io.Reader, sizeMin, sizeMax int) WindowReader { + return stream.NewLimitedWindowReader(rdr, sizeMin, sizeMax) +} diff --git a/internal/fe2/errors/errors.go b/internal/fe2/internal/errors/errors.go similarity index 95% rename from internal/fe2/errors/errors.go rename to internal/fe2/internal/errors/errors.go index 0a9b882f..f30d1848 100644 --- a/internal/fe2/errors/errors.go +++ b/internal/fe2/internal/errors/errors.go @@ -6,7 +6,7 @@ import ( "fmt" "strings" - "github.com/maxcalandrelli/gocc/internal/fe2/token" + "github.com/maxcalandrelli/gocc/internal/fe2/internal/token" ) type ErrorSymbol interface { diff --git a/internal/fe2/internal/io/stream/internal/stream_impl.go b/internal/fe2/internal/io/stream/internal/stream_impl.go new file mode 100644 index 00000000..c5af4395 --- /dev/null +++ b/internal/fe2/internal/io/stream/internal/stream_impl.go @@ -0,0 +1,275 @@ +package internal + +import ( + "io" + "sync" + "unicode/utf8" +) + +type ( + impl_WindowReader struct { + bufferBlockSize int + maxBufferSize int + buffers [][]byte + available int + absbase int64 + position int + eof bool + rdr io.Reader + lock *sync.Mutex + } +) + +func (s *impl_WindowReader) lockReader() { + if s.lock != nil { + s.lock.Lock() + } +} + +func (s *impl_WindowReader) unlockReader() { + if s.lock != nil { + s.lock.Unlock() + } +} + +func (s *impl_WindowReader) seek(offset int64, whence int) (offs int64, err error) { + switch whence { + case io.SeekStart: + return s.seek(offset-s.ReadPosition(), io.SeekCurrent) + case io.SeekCurrent: + switch { + case offset == 0: + return s.ReadPosition(), nil + case offset < 0: + if -offset > int64(s.maxBackOffset()) { + err = io.ErrShortBuffer + } else { + s.advanceGet(int(offset)) + } + case offset > 0: + for offset > 0 && !s.eof { + available := s.Buffered() + if offset <= int64(available) { + s.advanceGet(int(offset)) + break + } + if available > 0 { + s.advanceGet(available) + offset -= int64(available) + } + read, _ := s.fetchBytes(int(offset)) + s.advanceGet(read) + offset -= int64(read) + } + if s.eof { + err = io.EOF + } + } + case io.SeekEnd: + for !s.eof { + s.seek(int64(s.MaxCap()), io.SeekCurrent) + } + s.seek(int64(s.Buffered()), io.SeekCurrent) + } + if s.eof && err == nil && s.Buffered() > 0 { + s.eof = false + } + return s.ReadPosition(), err +} + +func (s impl_WindowReader) maxBackOffset() int { + r := s.position + if s.absbase > 0 { + r = s.Cap() - s.Buffered() + } + return r +} + +func (s impl_WindowReader) bufferIndex(pos int) int { + if pos < 0 { + panic("negative position") + } + return pos / s.bufferBlockSize +} + +func (s impl_WindowReader) bufferBytes(pos int) []byte { + return s.buffers[s.bufferIndex(pos)] +} + +func (s impl_WindowReader) bufferByteRange(pos int, length int) []byte { + p := s.bufferIndex(pos) + return s.bufferBytes(pos)[p : p+length] +} + +func (s impl_WindowReader) bufferOffset(pos int) int { + return pos % s.bufferBlockSize +} + +func (s *impl_WindowReader) advanceGet(n int) { + sz := s.Cap() + switch { + case n < 0: + if -n > s.maxBackOffset() { + panic("underflow") + } + s.position += n + if s.position < 0 { + s.position += sz + s.absbase -= int64(sz) + } + case n > 0: + if n > s.Buffered() { + panic("overflow") + } + s.position += n + if s.position >= sz { + s.position -= sz + s.absbase += int64(sz) + } + } + s.available -= n +} + +func (s *impl_WindowReader) copy(to []byte, length int) { + for offs, cp := 0, 0; length > 0; length -= cp { + s.position %= s.MaxCap() + p := s.bufferOffset(s.position) + b := s.bufferBytes(s.position) + r := s.bufferBlockSize - p + if length <= r { + cp = copy(to[offs:], b[p:p+length]) + } else { + cp = copy(to[offs:], b[p:]) + } + s.advanceGet(cp) + offs += cp + } +} + +func (s *impl_WindowReader) fetchBytes(n int) (read int, err error) { + if s.rdr == nil { + s.eof = true + return 0, io.EOF + } + for n > 0 && s.Buffered() < s.MaxCap() && err == nil { + readNow := n + putpos := s.position + s.available + r := s.bufferBlockSize - s.bufferOffset(putpos) + if readNow > r { + readNow = r + } + for s.bufferIndex(putpos) >= len(s.buffers) && s.Cap() < s.MaxCap() { + s.buffers = append(s.buffers, make([]byte, s.bufferBlockSize)) + } + putpos %= s.MaxCap() + offs := s.bufferOffset(putpos) + if r, err = s.rdr.Read(s.bufferBytes(putpos)[offs : offs+readNow]); r > 0 { + s.available += r + read += r + n -= r + } + } + if n > 0 && err == nil { + err = io.ErrShortBuffer + } + return +} + +func (s *impl_WindowReader) read(p []byte) (read int, err error) { + if s.eof { + return 0, io.EOF + } + for read < len(p) && err == nil { + available := s.Buffered() + if len(p)-read <= available { + s.copy(p[read:], len(p)-read) + read = len(p) + } else { + if available == 0 { + available, err = s.fetchBytes(len(p) - read) + } + s.copy(p[read:], available) + read += available + switch err { + case io.ErrShortBuffer: + err = nil + case io.EOF: + s.eof = true + } + } + } + return +} + +func (s impl_WindowReader) peekByte() (byte, error) { + if s.Buffered() < 1 { + return 0, io.ErrShortBuffer + } + return s.bufferBytes(s.position)[s.bufferOffset(s.position)], nil +} + +func (s *impl_WindowReader) unreadByte() error { + _, e := s.seek(-1, io.SeekCurrent) + return e +} + +func (s *impl_WindowReader) readRune() (r rune, size int, err error) { + for i := 1; err == nil && i <= 4; i++ { + if s.Buffered() < i { + if _, err = s.fetchBytes(i); err != nil { + return + } + } + t := s.bufferByteRange(s.position, i) + if r, size = utf8.DecodeRune(t); r != utf8.RuneError { + s.advanceGet(size) + return + } + } + return utf8.RuneError, 0, err +} + +func (s *impl_WindowReader) unreadRune() (err error) { + tmps := *s + tmpb := []byte{} + for { + if _, err = tmps.seek(-1, io.SeekCurrent); err == nil { + b, _ := tmps.PeekByte() + tmpb = append([]byte{b}, tmpb...) + switch len(tmpb) { + case 1: + if (tmpb[0] & 0xC0) == 0x80 { + continue + } + _, err = s.seek(-int64(len(tmpb)), io.SeekCurrent) + return + case 2: + if (tmpb[0] & 0xC0) == 0x80 { + continue + } + if (tmpb[0] & 0xE0) != 0xC0 { + break + } + _, err = s.seek(-int64(len(tmpb)), io.SeekCurrent) + return + case 3: + if (tmpb[0] & 0xC0) == 0x80 { + continue + } + if (tmpb[0] & 0xF0) != 0xE0 { + break + } + _, err = s.seek(-int64(len(tmpb)), io.SeekCurrent) + return + case 4: + if (tmpb[0] & 0xF8) != 0xF0 { + break + } + _, err = s.seek(-int64(len(tmpb)), io.SeekCurrent) + return + } + } + } + _, err = s.seek(-1, io.SeekCurrent) + return +} diff --git a/internal/fe2/internal/io/stream/internal/stream_public.go b/internal/fe2/internal/io/stream/internal/stream_public.go new file mode 100644 index 00000000..2c99c2fa --- /dev/null +++ b/internal/fe2/internal/io/stream/internal/stream_public.go @@ -0,0 +1,101 @@ +package internal + +import ( + "io" +) + +func NewWindowReader(buf []byte, underlyingReader io.Reader, blksize, smax int, InfoPrefixRoundUp bool) *impl_WindowReader { + if blksize < 0 || smax < blksize { + panic("illegal buffer size") + } + r := &impl_WindowReader{rdr: underlyingReader} + r.bufferBlockSize = blksize + if underlyingReader != nil { + if blksize <= 0 { + r.bufferBlockSize = 1 << 10 + } else if InfoPrefixRoundUp { + for r.bufferBlockSize = 1; blksize > 0; r.bufferBlockSize = r.bufferBlockSize << 1 { + blksize = blksize >> 1 + } + } + if smax > 0 { + r.maxBufferSize = ((smax-1)/r.bufferBlockSize + 1) * r.bufferBlockSize + } + r.buffers = [][]byte{} + } else { + r.buffers = [][]byte{buf} + r.available = len(buf) + r.bufferBlockSize = r.available + r.maxBufferSize = r.available + } + return r +} + +func (s impl_WindowReader) Cap() int { + return len(s.buffers) * s.bufferBlockSize +} + +func (s impl_WindowReader) BlockSize() int { + return s.bufferBlockSize +} + +func (s impl_WindowReader) MaxCap() int { + if s.maxBufferSize > 0 { + return s.maxBufferSize + } + return 1 << 31 +} + +func (s impl_WindowReader) MaxUnreadSize() int { + return s.maxBackOffset() +} + +func (s impl_WindowReader) Buffered() int { + return s.available +} + +func (s impl_WindowReader) ReadPosition() int64 { + return s.absbase + int64(s.position) +} + +func (s *impl_WindowReader) Read(p []byte) (read int, err error) { + s.lockReader() + defer func() { s.unlockReader() }() + return s.read(p) +} + +func (s *impl_WindowReader) Seek(offset int64, whence int) (offs int64, err error) { + s.lockReader() + defer func() { s.unlockReader() }() + return s.seek(offset, whence) +} + +func (s *impl_WindowReader) ReadByte() (byte, error) { + b := []byte{0} + _, err := s.Read(b) + return b[0], err +} + +func (s *impl_WindowReader) PeekByte() (byte, error) { + s.lockReader() + defer func() { s.unlockReader() }() + return s.PeekByte() +} + +func (s *impl_WindowReader) UnreadByte() error { + s.lockReader() + defer func() { s.unlockReader() }() + return s.unreadByte() +} + +func (s *impl_WindowReader) ReadRune() (r rune, size int, err error) { + s.lockReader() + defer func() { s.unlockReader() }() + return s.readRune() +} + +func (s *impl_WindowReader) UnreadRune() (err error) { + s.lockReader() + defer func() { s.unlockReader() }() + return s.unreadRune() +} diff --git a/internal/fe2/internal/io/stream/stream.go b/internal/fe2/internal/io/stream/stream.go new file mode 100644 index 00000000..b2216430 --- /dev/null +++ b/internal/fe2/internal/io/stream/stream.go @@ -0,0 +1,39 @@ +package stream + +import ( + internal "github.com/maxcalandrelli/gocc/internal/fe2/internal/io/stream/internal" + "io" +) + +type ( + WindowReader interface { + BlockSize() int + Buffered() int + Cap() int + MaxCap() int + Read([]byte) (int, error) + ReadByte() (byte, error) + ReadPosition() int64 + ReadRune() (rune, int, error) + Seek(int64, int) (int64, error) + UnreadByte() error + UnreadRune() error + MaxUnreadSize() int + } +) + +var ( + InfoPrefixRoundUp = false +) + +func NewWindowReaderFromBytes(src []byte) WindowReader { + return internal.NewWindowReader(src, nil, 0, 0, InfoPrefixRoundUp) +} + +func NewWindowReader(rdr io.Reader) WindowReader { + return internal.NewWindowReader(nil, rdr, 0, 0, false) +} + +func NewLimitedWindowReader(rdr io.Reader, sizeMin, sizeMax int) WindowReader { + return internal.NewWindowReader(nil, rdr, sizeMin, sizeMax, InfoPrefixRoundUp) +} diff --git a/internal/fe2/lexer/acttab.go b/internal/fe2/internal/lexer/acttab.go similarity index 96% rename from internal/fe2/lexer/acttab.go rename to internal/fe2/internal/lexer/acttab.go index d3688e3c..fb559a1c 100644 --- a/internal/fe2/lexer/acttab.go +++ b/internal/fe2/internal/lexer/acttab.go @@ -5,7 +5,7 @@ package lexer import ( "fmt" - "github.com/maxcalandrelli/gocc/internal/fe2/token" + "github.com/maxcalandrelli/gocc/internal/fe2/internal/token" ) type ActionTable [NumStates]ActionRow @@ -41,11 +41,11 @@ var ActTab = ActionTable{ Ignore: "", }, ActionRow{ // S5 - Accept: 12, + Accept: 11, Ignore: "", }, ActionRow{ // S6 - Accept: 13, + Accept: 12, Ignore: "", }, ActionRow{ // S7 @@ -73,15 +73,15 @@ var ActTab = ActionTable{ Ignore: "", }, ActionRow{ // S13 - Accept: 19, + Accept: 18, Ignore: "", }, ActionRow{ // S14 - Accept: 14, + Accept: 13, Ignore: "", }, ActionRow{ // S15 - Accept: 15, + Accept: 14, Ignore: "", }, ActionRow{ // S16 @@ -101,7 +101,7 @@ var ActTab = ActionTable{ Ignore: "", }, ActionRow{ // S20 - Accept: 16, + Accept: 15, Ignore: "", }, ActionRow{ // S21 @@ -109,27 +109,27 @@ var ActTab = ActionTable{ Ignore: "", }, ActionRow{ // S22 - Accept: 17, + Accept: 16, Ignore: "", }, ActionRow{ // S23 - Accept: 11, + Accept: 23, Ignore: "", }, ActionRow{ // S24 - Accept: 24, + Accept: 21, Ignore: "", }, ActionRow{ // S25 - Accept: 22, + Accept: 6, Ignore: "", }, ActionRow{ // S26 - Accept: 6, + Accept: 19, Ignore: "", }, ActionRow{ // S27 - Accept: 20, + Accept: 0, Ignore: "", }, ActionRow{ // S28 @@ -157,23 +157,23 @@ var ActTab = ActionTable{ Ignore: "", }, ActionRow{ // S34 - Accept: 0, + Accept: 18, Ignore: "", }, ActionRow{ // S35 - Accept: 19, + Accept: 18, Ignore: "", }, ActionRow{ // S36 - Accept: 19, + Accept: 18, Ignore: "", }, ActionRow{ // S37 - Accept: 19, + Accept: 18, Ignore: "", }, ActionRow{ // S38 - Accept: 19, + Accept: 5, Ignore: "", }, ActionRow{ // S39 @@ -189,11 +189,11 @@ var ActTab = ActionTable{ Ignore: "", }, ActionRow{ // S42 - Accept: 5, + Accept: 19, Ignore: "", }, ActionRow{ // S43 - Accept: 20, + Accept: 2, Ignore: "", }, ActionRow{ // S44 @@ -217,7 +217,7 @@ var ActTab = ActionTable{ Ignore: "", }, ActionRow{ // S49 - Accept: 2, + Accept: 6, Ignore: "", }, ActionRow{ // S50 @@ -233,7 +233,7 @@ var ActTab = ActionTable{ Ignore: "", }, ActionRow{ // S53 - Accept: 6, + Accept: 0, Ignore: "", }, ActionRow{ // S54 @@ -273,31 +273,31 @@ var ActTab = ActionTable{ Ignore: "", }, ActionRow{ // S63 - Accept: 0, - Ignore: "", - }, - ActionRow{ // S64 Accept: 9, Ignore: "", }, - ActionRow{ // S65 + ActionRow{ // S64 Accept: 0, Ignore: "", }, - ActionRow{ // S66 + ActionRow{ // S65 Accept: -1, Ignore: "!comment", }, - ActionRow{ // S67 + ActionRow{ // S66 Accept: 0, Ignore: "", }, + ActionRow{ // S67 + Accept: 2, + Ignore: "", + }, ActionRow{ // S68 Accept: 2, Ignore: "", }, ActionRow{ // S69 - Accept: 2, + Accept: 0, Ignore: "", }, ActionRow{ // S70 @@ -329,23 +329,23 @@ var ActTab = ActionTable{ Ignore: "", }, ActionRow{ // S77 - Accept: 0, - Ignore: "", - }, - ActionRow{ // S78 Accept: -1, Ignore: "!comment", }, - ActionRow{ // S79 + ActionRow{ // S78 Accept: 0, Ignore: "", }, + ActionRow{ // S79 + Accept: 2, + Ignore: "", + }, ActionRow{ // S80 Accept: 2, Ignore: "", }, ActionRow{ // S81 - Accept: 2, + Accept: 0, Ignore: "", }, ActionRow{ // S82 @@ -377,19 +377,19 @@ var ActTab = ActionTable{ Ignore: "", }, ActionRow{ // S89 - Accept: 0, + Accept: 17, Ignore: "", }, ActionRow{ // S90 - Accept: 18, + Accept: 22, Ignore: "", }, ActionRow{ // S91 - Accept: 23, + Accept: 20, Ignore: "", }, ActionRow{ // S92 - Accept: 2, + Accept: 0, Ignore: "", }, ActionRow{ // S93 @@ -409,7 +409,7 @@ var ActTab = ActionTable{ Ignore: "", }, ActionRow{ // S97 - Accept: 21, + Accept: 0, Ignore: "", }, ActionRow{ // S98 @@ -452,12 +452,4 @@ var ActTab = ActionTable{ Accept: 0, Ignore: "", }, - ActionRow{ // S108 - Accept: 0, - Ignore: "", - }, - ActionRow{ // S109 - Accept: 0, - Ignore: "", - }, } diff --git a/internal/fe2/lexer/lexer.go b/internal/fe2/internal/lexer/lexer.go similarity index 81% rename from internal/fe2/lexer/lexer.go rename to internal/fe2/internal/lexer/lexer.go index 949214af..2ab9e40f 100644 --- a/internal/fe2/lexer/lexer.go +++ b/internal/fe2/internal/lexer/lexer.go @@ -6,13 +6,13 @@ import ( "io/ioutil" "unicode/utf8" - "github.com/maxcalandrelli/gocc/internal/fe2/token" + "github.com/maxcalandrelli/gocc/internal/fe2/internal/token" ) const ( NoState = -1 - NumStates = 110 - NumSymbols = 76 + NumStates = 108 + NumSymbols = 74 ) type Position struct { @@ -161,67 +161,65 @@ Lexer symbols: 10: '|' 11: '.' 12: '-' -13: '~' -14: '(' -15: ')' -16: '[' -17: ']' -18: '{' -19: '}' -20: 'e' +13: '(' +14: ')' +15: '[' +16: ']' +17: '{' +18: '}' +19: 'e' +20: 'r' 21: 'r' -22: 'r' -23: 'o' -24: 'r' +22: 'o' +23: 'r' +24: \u03bb 25: 'e' -26: \u03bb -27: 'e' -28: 'm' -29: 'p' -30: 't' -31: 'y' -32: \u03b5 -33: '/' +26: 'm' +27: 'p' +28: 't' +29: 'y' +30: \u03b5 +31: '/' +32: '/' +33: '\n' 34: '/' -35: '\n' -36: '/' +35: '*' +36: '*' 37: '*' -38: '*' -39: '*' -40: '/' -41: '_' +38: '/' +39: '_' +40: '\' +41: 'u' 42: '\' -43: 'u' +43: 'U' 44: '\' -45: 'U' -46: '\' -47: 'a' -48: 'b' -49: 'f' -50: 'n' -51: 'r' -52: 't' -53: 'v' -54: '\' -55: ''' -56: '"' -57: '\' -58: '\' -59: 'x' -60: '`' -61: '`' -62: '"' -63: '"' -64: ' ' -65: '\t' -66: '\n' -67: '\r' -68: 'a'-'z' -69: 'A'-'Z' +45: 'a' +46: 'b' +47: 'f' +48: 'n' +49: 'r' +50: 't' +51: 'v' +52: '\' +53: ''' +54: '"' +55: '\' +56: '\' +57: 'x' +58: '`' +59: '`' +60: '"' +61: '"' +62: ' ' +63: '\t' +64: '\n' +65: '\r' +66: 'a'-'z' +67: 'A'-'Z' +68: '0'-'9' +69: '0'-'7' 70: '0'-'9' -71: '0'-'7' -72: '0'-'9' -73: 'A'-'F' -74: 'a'-'f' -75: . +71: 'A'-'F' +72: 'a'-'f' +73: . */ diff --git a/internal/fe2/lexer/transitiontable.go b/internal/fe2/internal/lexer/transitiontable.go similarity index 94% rename from internal/fe2/lexer/transitiontable.go rename to internal/fe2/internal/lexer/transitiontable.go index 1b458438..8dd0dff6 100644 --- a/internal/fe2/lexer/transitiontable.go +++ b/internal/fe2/internal/lexer/transitiontable.go @@ -65,12 +65,10 @@ var TransTab = TransitionTable{ return 21 case r == 125: // ['}','}'] return 22 - case r == 126: // ['~','~'] - return 23 case r == 949: // [\u03b5,\u03b5] - return 24 + return 23 case r == 955: // [\u03bb,\u03bb] - return 25 + return 24 } return NoState }, @@ -84,7 +82,7 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 97 <= r && r <= 122: // ['a','z'] - return 26 + return 25 } return NoState }, @@ -92,20 +90,20 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case r == 34: // ['"','"'] - return 27 + return 26 case r == 92: // ['\','\'] - return 28 + return 27 default: - return 29 + return 28 } }, // S4 func(r rune) int { switch { case r == 92: // ['\','\'] - return 30 + return 29 default: - return 31 + return 30 } }, // S5 @@ -136,9 +134,9 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case r == 42: // ['*','*'] - return 32 + return 31 case r == 47: // ['/','/'] - return 33 + return 32 } return NoState }, @@ -158,7 +156,7 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case r == 60: // ['<','<'] - return 34 + return 33 } return NoState }, @@ -166,13 +164,13 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 35 + return 34 case 65 <= r && r <= 90: // ['A','Z'] - return 36 + return 35 case r == 95: // ['_','_'] - return 37 + return 36 case 97 <= r && r <= 122: // ['a','z'] - return 38 + return 37 } return NoState }, @@ -192,13 +190,13 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 39 + return 38 case 65 <= r && r <= 90: // ['A','Z'] - return 40 + return 39 case r == 95: // ['_','_'] - return 41 + return 40 case 97 <= r && r <= 122: // ['a','z'] - return 42 + return 41 } return NoState }, @@ -206,7 +204,7 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case r == 96: // ['`','`'] - return 43 + return 42 default: return 17 } @@ -215,13 +213,13 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 44 + return 43 case 65 <= r && r <= 90: // ['A','Z'] - return 45 + return 44 case r == 95: // ['_','_'] - return 46 + return 45 case 97 <= r && r <= 122: // ['a','z'] - return 47 + return 46 } return NoState }, @@ -229,21 +227,21 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 44 + return 43 case 65 <= r && r <= 90: // ['A','Z'] - return 45 + return 44 case r == 95: // ['_','_'] - return 46 + return 45 case 97 <= r && r <= 108: // ['a','l'] - return 47 + return 46 case r == 109: // ['m','m'] - return 48 - case 110 <= r && r <= 113: // ['n','q'] return 47 + case 110 <= r && r <= 113: // ['n','q'] + return 46 case r == 114: // ['r','r'] - return 49 + return 48 case 115 <= r && r <= 122: // ['s','z'] - return 47 + return 46 } return NoState }, @@ -278,106 +276,108 @@ var TransTab = TransitionTable{ return NoState }, // S25 - func(r rune) int { - switch { - } - return NoState - }, - // S26 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 50 + return 49 case 65 <= r && r <= 90: // ['A','Z'] - return 51 + return 50 case r == 95: // ['_','_'] - return 52 + return 51 case 97 <= r && r <= 122: // ['a','z'] - return 53 + return 52 } return NoState }, - // S27 + // S26 func(r rune) int { switch { } return NoState }, - // S28 + // S27 func(r rune) int { switch { case r == 34: // ['"','"'] - return 54 + return 53 case r == 39: // [''','''] - return 54 + return 53 case 48 <= r && r <= 55: // ['0','7'] - return 55 + return 54 case r == 85: // ['U','U'] - return 56 + return 55 case r == 92: // ['\','\'] - return 54 + return 53 case r == 97: // ['a','a'] - return 54 + return 53 case r == 98: // ['b','b'] - return 54 + return 53 case r == 102: // ['f','f'] - return 54 + return 53 case r == 110: // ['n','n'] - return 54 + return 53 case r == 114: // ['r','r'] - return 54 + return 53 case r == 116: // ['t','t'] - return 54 + return 53 case r == 117: // ['u','u'] - return 57 + return 56 case r == 118: // ['v','v'] - return 54 + return 53 case r == 120: // ['x','x'] - return 58 + return 57 } return NoState }, - // S29 + // S28 func(r rune) int { switch { case r == 34: // ['"','"'] - return 27 + return 26 case r == 92: // ['\','\'] - return 28 + return 27 default: - return 29 + return 28 } }, - // S30 + // S29 func(r rune) int { switch { case r == 34: // ['"','"'] - return 59 + return 58 case r == 39: // [''','''] - return 59 + return 58 case 48 <= r && r <= 55: // ['0','7'] - return 60 + return 59 case r == 85: // ['U','U'] - return 61 + return 60 case r == 92: // ['\','\'] - return 59 + return 58 case r == 97: // ['a','a'] - return 59 + return 58 case r == 98: // ['b','b'] - return 59 + return 58 case r == 102: // ['f','f'] - return 59 + return 58 case r == 110: // ['n','n'] - return 59 + return 58 case r == 114: // ['r','r'] - return 59 + return 58 case r == 116: // ['t','t'] - return 59 + return 58 case r == 117: // ['u','u'] - return 62 + return 61 case r == 118: // ['v','v'] - return 59 + return 58 case r == 120: // ['x','x'] + return 62 + } + return NoState + }, + // S30 + func(r rune) int { + switch { + case r == 39: // [''','''] return 63 } return NoState @@ -385,15 +385,16 @@ var TransTab = TransitionTable{ // S31 func(r rune) int { switch { - case r == 39: // [''','''] + case r == 42: // ['*','*'] return 64 + default: + return 31 } - return NoState }, // S32 func(r rune) int { switch { - case r == 42: // ['*','*'] + case r == 10: // ['\n','\n'] return 65 default: return 32 @@ -402,30 +403,35 @@ var TransTab = TransitionTable{ // S33 func(r rune) int { switch { - case r == 10: // ['\n','\n'] - return 66 default: - return 33 + return 66 } }, // S34 func(r rune) int { switch { - default: - return 67 + case 48 <= r && r <= 57: // ['0','9'] + return 34 + case 65 <= r && r <= 90: // ['A','Z'] + return 35 + case r == 95: // ['_','_'] + return 36 + case 97 <= r && r <= 122: // ['a','z'] + return 37 } + return NoState }, // S35 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 35 + return 34 case 65 <= r && r <= 90: // ['A','Z'] - return 36 + return 35 case r == 95: // ['_','_'] - return 37 + return 36 case 97 <= r && r <= 122: // ['a','z'] - return 38 + return 37 } return NoState }, @@ -433,13 +439,13 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 35 + return 34 case 65 <= r && r <= 90: // ['A','Z'] - return 36 + return 35 case r == 95: // ['_','_'] - return 37 + return 36 case 97 <= r && r <= 122: // ['a','z'] - return 38 + return 37 } return NoState }, @@ -447,13 +453,13 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 35 + return 34 case 65 <= r && r <= 90: // ['A','Z'] - return 36 + return 35 case r == 95: // ['_','_'] - return 37 + return 36 case 97 <= r && r <= 122: // ['a','z'] - return 38 + return 37 } return NoState }, @@ -461,13 +467,13 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 35 + return 38 case 65 <= r && r <= 90: // ['A','Z'] - return 36 + return 39 case r == 95: // ['_','_'] - return 37 + return 40 case 97 <= r && r <= 122: // ['a','z'] - return 38 + return 41 } return NoState }, @@ -475,13 +481,13 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 39 + return 38 case 65 <= r && r <= 90: // ['A','Z'] - return 40 + return 39 case r == 95: // ['_','_'] - return 41 + return 40 case 97 <= r && r <= 122: // ['a','z'] - return 42 + return 41 } return NoState }, @@ -489,13 +495,13 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 39 + return 38 case 65 <= r && r <= 90: // ['A','Z'] - return 40 + return 39 case r == 95: // ['_','_'] - return 41 + return 40 case 97 <= r && r <= 122: // ['a','z'] - return 42 + return 41 } return NoState }, @@ -503,33 +509,33 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 39 + return 38 case 65 <= r && r <= 90: // ['A','Z'] - return 40 + return 39 case r == 95: // ['_','_'] - return 41 + return 40 case 97 <= r && r <= 122: // ['a','z'] - return 42 + return 41 } return NoState }, // S42 func(r rune) int { switch { - case 48 <= r && r <= 57: // ['0','9'] - return 39 - case 65 <= r && r <= 90: // ['A','Z'] - return 40 - case r == 95: // ['_','_'] - return 41 - case 97 <= r && r <= 122: // ['a','z'] - return 42 } return NoState }, // S43 func(r rune) int { switch { + case 48 <= r && r <= 57: // ['0','9'] + return 43 + case 65 <= r && r <= 90: // ['A','Z'] + return 44 + case r == 95: // ['_','_'] + return 45 + case 97 <= r && r <= 122: // ['a','z'] + return 46 } return NoState }, @@ -537,13 +543,13 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 44 + return 43 case 65 <= r && r <= 90: // ['A','Z'] - return 45 + return 44 case r == 95: // ['_','_'] - return 46 + return 45 case 97 <= r && r <= 122: // ['a','z'] - return 47 + return 46 } return NoState }, @@ -551,13 +557,13 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 44 + return 43 case 65 <= r && r <= 90: // ['A','Z'] - return 45 + return 44 case r == 95: // ['_','_'] - return 46 + return 45 case 97 <= r && r <= 122: // ['a','z'] - return 47 + return 46 } return NoState }, @@ -565,13 +571,13 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 44 + return 43 case 65 <= r && r <= 90: // ['A','Z'] - return 45 + return 44 case r == 95: // ['_','_'] - return 46 + return 45 case 97 <= r && r <= 122: // ['a','z'] - return 47 + return 46 } return NoState }, @@ -579,13 +585,17 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 44 + return 43 case 65 <= r && r <= 90: // ['A','Z'] - return 45 + return 44 case r == 95: // ['_','_'] + return 45 + case 97 <= r && r <= 111: // ['a','o'] + return 46 + case r == 112: // ['p','p'] + return 67 + case 113 <= r && r <= 122: // ['q','z'] return 46 - case 97 <= r && r <= 122: // ['a','z'] - return 47 } return NoState }, @@ -593,17 +603,17 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 44 + return 43 case 65 <= r && r <= 90: // ['A','Z'] - return 45 + return 44 case r == 95: // ['_','_'] + return 45 + case 97 <= r && r <= 113: // ['a','q'] return 46 - case 97 <= r && r <= 111: // ['a','o'] - return 47 - case r == 112: // ['p','p'] + case r == 114: // ['r','r'] return 68 - case 113 <= r && r <= 122: // ['q','z'] - return 47 + case 115 <= r && r <= 122: // ['s','z'] + return 46 } return NoState }, @@ -611,17 +621,13 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 44 + return 49 case 65 <= r && r <= 90: // ['A','Z'] - return 45 + return 50 case r == 95: // ['_','_'] - return 46 - case 97 <= r && r <= 113: // ['a','q'] - return 47 - case r == 114: // ['r','r'] - return 69 - case 115 <= r && r <= 122: // ['s','z'] - return 47 + return 51 + case 97 <= r && r <= 122: // ['a','z'] + return 52 } return NoState }, @@ -629,13 +635,13 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 50 + return 49 case 65 <= r && r <= 90: // ['A','Z'] - return 51 + return 50 case r == 95: // ['_','_'] - return 52 + return 51 case 97 <= r && r <= 122: // ['a','z'] - return 53 + return 52 } return NoState }, @@ -643,13 +649,13 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 50 + return 49 case 65 <= r && r <= 90: // ['A','Z'] - return 51 + return 50 case r == 95: // ['_','_'] - return 52 + return 51 case 97 <= r && r <= 122: // ['a','z'] - return 53 + return 52 } return NoState }, @@ -657,45 +663,43 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 50 + return 49 case 65 <= r && r <= 90: // ['A','Z'] - return 51 + return 50 case r == 95: // ['_','_'] - return 52 + return 51 case 97 <= r && r <= 122: // ['a','z'] - return 53 + return 52 } return NoState }, // S53 func(r rune) int { switch { - case 48 <= r && r <= 57: // ['0','9'] - return 50 - case 65 <= r && r <= 90: // ['A','Z'] - return 51 - case r == 95: // ['_','_'] - return 52 - case 97 <= r && r <= 122: // ['a','z'] - return 53 + case r == 34: // ['"','"'] + return 26 + case r == 92: // ['\','\'] + return 27 + default: + return 28 } - return NoState }, // S54 func(r rune) int { switch { - case r == 34: // ['"','"'] - return 27 - case r == 92: // ['\','\'] - return 28 - default: - return 29 + case 48 <= r && r <= 55: // ['0','7'] + return 69 } + return NoState }, // S55 func(r rune) int { switch { - case 48 <= r && r <= 55: // ['0','7'] + case 48 <= r && r <= 57: // ['0','9'] + return 70 + case 65 <= r && r <= 70: // ['A','F'] + return 70 + case 97 <= r && r <= 102: // ['a','f'] return 70 } return NoState @@ -727,27 +731,27 @@ var TransTab = TransitionTable{ // S58 func(r rune) int { switch { - case 48 <= r && r <= 57: // ['0','9'] - return 73 - case 65 <= r && r <= 70: // ['A','F'] - return 73 - case 97 <= r && r <= 102: // ['a','f'] - return 73 + case r == 39: // [''','''] + return 63 } return NoState }, // S59 func(r rune) int { switch { - case r == 39: // [''','''] - return 64 + case 48 <= r && r <= 55: // ['0','7'] + return 73 } return NoState }, // S60 func(r rune) int { switch { - case 48 <= r && r <= 55: // ['0','7'] + case 48 <= r && r <= 57: // ['0','9'] + return 74 + case 65 <= r && r <= 70: // ['A','F'] + return 74 + case 97 <= r && r <= 102: // ['a','f'] return 74 } return NoState @@ -779,87 +783,87 @@ var TransTab = TransitionTable{ // S63 func(r rune) int { switch { - case 48 <= r && r <= 57: // ['0','9'] - return 77 - case 65 <= r && r <= 70: // ['A','F'] - return 77 - case 97 <= r && r <= 102: // ['a','f'] - return 77 } return NoState }, // S64 - func(r rune) int { - switch { - } - return NoState - }, - // S65 func(r rune) int { switch { case r == 42: // ['*','*'] - return 65 + return 64 case r == 47: // ['/','/'] - return 78 + return 77 default: - return 32 + return 31 } }, - // S66 + // S65 func(r rune) int { switch { } return NoState }, - // S67 + // S66 func(r rune) int { switch { case r == 62: // ['>','>'] - return 79 + return 78 default: - return 67 + return 66 } }, - // S68 + // S67 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 44 + return 43 case 65 <= r && r <= 90: // ['A','Z'] - return 45 + return 44 case r == 95: // ['_','_'] - return 46 + return 45 case 97 <= r && r <= 115: // ['a','s'] - return 47 + return 46 case r == 116: // ['t','t'] - return 80 + return 79 case 117 <= r && r <= 122: // ['u','z'] - return 47 + return 46 } return NoState }, - // S69 + // S68 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 44 + return 43 case 65 <= r && r <= 90: // ['A','Z'] - return 45 + return 44 case r == 95: // ['_','_'] - return 46 + return 45 case 97 <= r && r <= 110: // ['a','n'] - return 47 + return 46 case r == 111: // ['o','o'] - return 81 + return 80 case 112 <= r && r <= 122: // ['p','z'] - return 47 + return 46 } return NoState }, - // S70 + // S69 func(r rune) int { switch { case 48 <= r && r <= 55: // ['0','7'] + return 81 + } + return NoState + }, + // S70 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 82 + case 65 <= r && r <= 70: // ['A','F'] + return 82 + case 97 <= r && r <= 102: // ['a','f'] return 82 } return NoState @@ -891,11 +895,7 @@ var TransTab = TransitionTable{ // S73 func(r rune) int { switch { - case 48 <= r && r <= 57: // ['0','9'] - return 85 - case 65 <= r && r <= 70: // ['A','F'] - return 85 - case 97 <= r && r <= 102: // ['a','f'] + case 48 <= r && r <= 55: // ['0','7'] return 85 } return NoState @@ -903,7 +903,11 @@ var TransTab = TransitionTable{ // S74 func(r rune) int { switch { - case 48 <= r && r <= 55: // ['0','7'] + case 48 <= r && r <= 57: // ['0','9'] + return 86 + case 65 <= r && r <= 70: // ['A','F'] + return 86 + case 97 <= r && r <= 102: // ['a','f'] return 86 } return NoState @@ -935,116 +939,116 @@ var TransTab = TransitionTable{ // S77 func(r rune) int { switch { - case 48 <= r && r <= 57: // ['0','9'] - return 89 - case 65 <= r && r <= 70: // ['A','F'] - return 89 - case 97 <= r && r <= 102: // ['a','f'] - return 89 } return NoState }, // S78 - func(r rune) int { - switch { - } - return NoState - }, - // S79 func(r rune) int { switch { case r == 62: // ['>','>'] - return 90 + return 89 } return NoState }, - // S80 + // S79 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 44 + return 43 case 65 <= r && r <= 90: // ['A','Z'] - return 45 + return 44 case r == 95: // ['_','_'] - return 46 + return 45 case 97 <= r && r <= 120: // ['a','x'] - return 47 + return 46 case r == 121: // ['y','y'] - return 91 + return 90 case r == 122: // ['z','z'] - return 47 + return 46 } return NoState }, - // S81 + // S80 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 44 + return 43 case 65 <= r && r <= 90: // ['A','Z'] - return 45 + return 44 case r == 95: // ['_','_'] - return 46 + return 45 case 97 <= r && r <= 113: // ['a','q'] - return 47 + return 46 case r == 114: // ['r','r'] - return 92 + return 91 case 115 <= r && r <= 122: // ['s','z'] - return 47 + return 46 } return NoState }, - // S82 + // S81 func(r rune) int { switch { case r == 34: // ['"','"'] - return 27 + return 26 case r == 92: // ['\','\'] - return 28 + return 27 default: - return 29 + return 28 } }, - // S83 + // S82 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 93 + return 92 case 65 <= r && r <= 70: // ['A','F'] - return 93 + return 92 case 97 <= r && r <= 102: // ['a','f'] - return 93 + return 92 } return NoState }, - // S84 + // S83 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 94 + return 93 case 65 <= r && r <= 70: // ['A','F'] - return 94 + return 93 case 97 <= r && r <= 102: // ['a','f'] - return 94 + return 93 } return NoState }, - // S85 + // S84 func(r rune) int { switch { case r == 34: // ['"','"'] - return 27 + return 26 case r == 92: // ['\','\'] - return 28 + return 27 default: - return 29 + return 28 } }, - // S86 + // S85 func(r rune) int { switch { case r == 39: // [''','''] - return 64 + return 63 + } + return NoState + }, + // S86 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 94 + case 65 <= r && r <= 70: // ['A','F'] + return 94 + case 97 <= r && r <= 102: // ['a','f'] + return 94 } return NoState }, @@ -1063,26 +1067,28 @@ var TransTab = TransitionTable{ // S88 func(r rune) int { switch { - case 48 <= r && r <= 57: // ['0','9'] - return 96 - case 65 <= r && r <= 70: // ['A','F'] - return 96 - case 97 <= r && r <= 102: // ['a','f'] - return 96 + case r == 39: // [''','''] + return 63 } return NoState }, // S89 func(r rune) int { switch { - case r == 39: // [''','''] - return 64 } return NoState }, // S90 func(r rune) int { switch { + case 48 <= r && r <= 57: // ['0','9'] + return 43 + case 65 <= r && r <= 90: // ['A','Z'] + return 44 + case r == 95: // ['_','_'] + return 45 + case 97 <= r && r <= 122: // ['a','z'] + return 46 } return NoState }, @@ -1090,13 +1096,13 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 44 + return 43 case 65 <= r && r <= 90: // ['A','Z'] - return 45 + return 44 case r == 95: // ['_','_'] - return 46 + return 45 case 97 <= r && r <= 122: // ['a','z'] - return 47 + return 46 } return NoState }, @@ -1104,21 +1110,27 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 44 - case 65 <= r && r <= 90: // ['A','Z'] - return 45 - case r == 95: // ['_','_'] - return 46 - case 97 <= r && r <= 100: // ['a','d'] - return 47 - case r == 101: // ['e','e'] - return 97 - case 102 <= r && r <= 122: // ['f','z'] - return 47 + return 96 + case 65 <= r && r <= 70: // ['A','F'] + return 96 + case 97 <= r && r <= 102: // ['a','f'] + return 96 } return NoState }, // S93 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 97 + case 65 <= r && r <= 70: // ['A','F'] + return 97 + case 97 <= r && r <= 102: // ['a','f'] + return 97 + } + return NoState + }, + // S94 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] @@ -1130,7 +1142,7 @@ var TransTab = TransitionTable{ } return NoState }, - // S94 + // S95 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] @@ -1142,7 +1154,7 @@ var TransTab = TransitionTable{ } return NoState }, - // S95 + // S96 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] @@ -1154,7 +1166,18 @@ var TransTab = TransitionTable{ } return NoState }, - // S96 + // S97 + func(r rune) int { + switch { + case r == 34: // ['"','"'] + return 26 + case r == 92: // ['\','\'] + return 27 + default: + return 28 + } + }, + // S98 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] @@ -1166,21 +1189,15 @@ var TransTab = TransitionTable{ } return NoState }, - // S97 + // S99 func(r rune) int { switch { - case 48 <= r && r <= 57: // ['0','9'] - return 44 - case 65 <= r && r <= 90: // ['A','Z'] - return 45 - case r == 95: // ['_','_'] - return 46 - case 97 <= r && r <= 122: // ['a','z'] - return 47 + case r == 39: // [''','''] + return 63 } return NoState }, - // S98 + // S100 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] @@ -1192,18 +1209,7 @@ var TransTab = TransitionTable{ } return NoState }, - // S99 - func(r rune) int { - switch { - case r == 34: // ['"','"'] - return 27 - case r == 92: // ['\','\'] - return 28 - default: - return 29 - } - }, - // S100 + // S101 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] @@ -1215,14 +1221,6 @@ var TransTab = TransitionTable{ } return NoState }, - // S101 - func(r rune) int { - switch { - case r == 39: // [''','''] - return 64 - } - return NoState - }, // S102 func(r rune) int { switch { @@ -1272,45 +1270,21 @@ var TransTab = TransitionTable{ return NoState }, // S106 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 108 - case 65 <= r && r <= 70: // ['A','F'] - return 108 - case 97 <= r && r <= 102: // ['a','f'] - return 108 - } - return NoState - }, - // S107 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 109 - case 65 <= r && r <= 70: // ['A','F'] - return 109 - case 97 <= r && r <= 102: // ['a','f'] - return 109 - } - return NoState - }, - // S108 func(r rune) int { switch { case r == 34: // ['"','"'] - return 27 + return 26 case r == 92: // ['\','\'] - return 28 + return 27 default: - return 29 + return 28 } }, - // S109 + // S107 func(r rune) int { switch { case r == 39: // [''','''] - return 64 + return 63 } return NoState }, diff --git a/internal/fe2/parser/action.go b/internal/fe2/internal/parser/action.go similarity index 100% rename from internal/fe2/parser/action.go rename to internal/fe2/internal/parser/action.go diff --git a/internal/fe2/parser/actiontable.go b/internal/fe2/internal/parser/actiontable.go similarity index 90% rename from internal/fe2/parser/actiontable.go rename to internal/fe2/internal/parser/actiontable.go index ed8d66f4..72c34760 100644 --- a/internal/fe2/parser/actiontable.go +++ b/internal/fe2/internal/parser/actiontable.go @@ -16,26 +16,25 @@ var actionTab = actionTable{ actions: [numSymbols]action{ nil, // nil, // Ω - shift(6), // tokId + shift(9), // tokId nil, // : nil, // ; - shift(7), // regDefId - shift(8), // ignoredTokId + shift(10), // regDefId + shift(11), // ignoredTokId nil, // | nil, // . nil, // char_lit nil, // - - nil, // ~ nil, // ( nil, // ) nil, // [ nil, // ] nil, // { nil, // } - shift(11), // g_sdt_lit + shift(12), // g_sdt_lit shift(13), // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -55,7 +54,6 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - - nil, // ~ nil, // ( nil, // ) nil, // [ @@ -65,7 +63,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -85,17 +83,16 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - - nil, // ~ nil, // ( nil, // ) nil, // [ nil, // ] nil, // { nil, // } - shift(11), // g_sdt_lit + shift(12), // g_sdt_lit shift(13), // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -105,27 +102,26 @@ var actionTab = actionTable{ canRecover: false, actions: [numSymbols]action{ nil, // - reduce(3), // Ω, reduce: Grammar - nil, // tokId + reduce(4), // Ω, reduce: LexicalPart + shift(9), // tokId nil, // : nil, // ; - nil, // regDefId - nil, // ignoredTokId + shift(10), // regDefId + shift(11), // ignoredTokId nil, // | nil, // . nil, // char_lit nil, // - - nil, // ~ nil, // ( nil, // ) nil, // [ nil, // ] nil, // { nil, // } - nil, // g_sdt_lit - nil, // prodId + reduce(4), // g_sdt_lit, reduce: LexicalPart + reduce(4), // prodId, reduce: LexicalPart nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -135,27 +131,26 @@ var actionTab = actionTable{ canRecover: false, actions: [numSymbols]action{ nil, // - reduce(4), // Ω, reduce: LexicalPart - shift(6), // tokId + reduce(5), // Ω, reduce: LexProductions + reduce(5), // tokId, reduce: LexProductions nil, // : nil, // ; - shift(7), // regDefId - shift(8), // ignoredTokId + reduce(5), // regDefId, reduce: LexProductions + reduce(5), // ignoredTokId, reduce: LexProductions nil, // | nil, // . nil, // char_lit nil, // - - nil, // ~ nil, // ( nil, // ) nil, // [ nil, // ] nil, // { nil, // } - reduce(4), // g_sdt_lit, reduce: LexicalPart - reduce(4), // prodId, reduce: LexicalPart + reduce(5), // g_sdt_lit, reduce: LexProductions + reduce(5), // prodId, reduce: LexProductions nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -165,27 +160,26 @@ var actionTab = actionTable{ canRecover: false, actions: [numSymbols]action{ nil, // - reduce(5), // Ω, reduce: LexProductions - reduce(5), // tokId, reduce: LexProductions + reduce(3), // Ω, reduce: Grammar + nil, // tokId nil, // : nil, // ; - reduce(5), // regDefId, reduce: LexProductions - reduce(5), // ignoredTokId, reduce: LexProductions + nil, // regDefId + nil, // ignoredTokId nil, // | nil, // . nil, // char_lit nil, // - - nil, // ~ nil, // ( nil, // ) nil, // [ nil, // ] nil, // { nil, // } - reduce(5), // g_sdt_lit, reduce: LexProductions - reduce(5), // prodId, reduce: LexProductions + nil, // g_sdt_lit + nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -197,7 +191,7 @@ var actionTab = actionTable{ nil, // nil, // Ω nil, // tokId - shift(16), // : + nil, // : nil, // ; nil, // regDefId nil, // ignoredTokId @@ -205,7 +199,6 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - - nil, // ~ nil, // ( nil, // ) nil, // [ @@ -213,21 +206,79 @@ var actionTab = actionTable{ nil, // { nil, // } nil, // g_sdt_lit - nil, // prodId + shift(13), // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε }, }, actionRow{ // S7 + canRecover: false, + actions: [numSymbols]action{ + nil, // + reduce(24), // Ω, reduce: SyntaxPart + nil, // tokId + nil, // : + nil, // ; + nil, // regDefId + nil, // ignoredTokId + nil, // | + nil, // . + nil, // char_lit + nil, // - + nil, // ( + nil, // ) + nil, // [ + nil, // ] + nil, // { + nil, // } + nil, // g_sdt_lit + shift(13), // prodId + nil, // string_lit + nil, // error + nil, // λ + nil, // empty + nil, // ε + }, + }, + actionRow{ // S8 + canRecover: false, + actions: [numSymbols]action{ + nil, // + reduce(26), // Ω, reduce: SyntaxProdList + nil, // tokId + nil, // : + nil, // ; + nil, // regDefId + nil, // ignoredTokId + nil, // | + nil, // . + nil, // char_lit + nil, // - + nil, // ( + nil, // ) + nil, // [ + nil, // ] + nil, // { + nil, // } + nil, // g_sdt_lit + reduce(26), // prodId, reduce: SyntaxProdList + nil, // string_lit + nil, // error + nil, // λ + nil, // empty + nil, // ε + }, + }, + actionRow{ // S9 canRecover: false, actions: [numSymbols]action{ nil, // nil, // Ω nil, // tokId - shift(17), // : + shift(18), // : nil, // ; nil, // regDefId nil, // ignoredTokId @@ -235,7 +286,6 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - - nil, // ~ nil, // ( nil, // ) nil, // [ @@ -245,19 +295,19 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε }, }, - actionRow{ // S8 + actionRow{ // S10 canRecover: false, actions: [numSymbols]action{ nil, // nil, // Ω nil, // tokId - shift(18), // : + shift(19), // : nil, // ; nil, // regDefId nil, // ignoredTokId @@ -265,7 +315,6 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - - nil, // ~ nil, // ( nil, // ) nil, // [ @@ -275,19 +324,19 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε }, }, - actionRow{ // S9 + actionRow{ // S11 canRecover: false, actions: [numSymbols]action{ nil, // nil, // Ω nil, // tokId - nil, // : + shift(20), // : nil, // ; nil, // regDefId nil, // ignoredTokId @@ -295,7 +344,6 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - - nil, // ~ nil, // ( nil, // ) nil, // [ @@ -303,45 +351,15 @@ var actionTab = actionTable{ nil, // { nil, // } nil, // g_sdt_lit - shift(13), // prodId + nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε }, }, - actionRow{ // S10 - canRecover: false, - actions: [numSymbols]action{ - nil, // - reduce(24), // Ω, reduce: SyntaxPart - nil, // tokId - nil, // : - nil, // ; - nil, // regDefId - nil, // ignoredTokId - nil, // | - nil, // . - nil, // char_lit - nil, // - - nil, // ~ - nil, // ( - nil, // ) - nil, // [ - nil, // ] - nil, // { - nil, // } - nil, // g_sdt_lit - shift(13), // prodId - nil, // string_lit - nil, // errore - nil, // λ - nil, // empty - nil, // ε - }, - }, - actionRow{ // S11 + actionRow{ // S12 canRecover: false, actions: [numSymbols]action{ nil, // @@ -355,7 +373,6 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - - nil, // ~ nil, // ( nil, // ) nil, // [ @@ -365,37 +382,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit reduce(25), // prodId, reduce: FileHeader nil, // string_lit - nil, // errore - nil, // λ - nil, // empty - nil, // ε - }, - }, - actionRow{ // S12 - canRecover: false, - actions: [numSymbols]action{ - nil, // - reduce(26), // Ω, reduce: SyntaxProdList - nil, // tokId - nil, // : - nil, // ; - nil, // regDefId - nil, // ignoredTokId - nil, // | - nil, // . - nil, // char_lit - nil, // - - nil, // ~ - nil, // ( - nil, // ) - nil, // [ - nil, // ] - nil, // { - nil, // } - nil, // g_sdt_lit - reduce(26), // prodId, reduce: SyntaxProdList - nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -415,7 +402,6 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - - nil, // ~ nil, // ( nil, // ) nil, // [ @@ -425,7 +411,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -445,7 +431,6 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - - nil, // ~ nil, // ( nil, // ) nil, // [ @@ -455,7 +440,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -475,7 +460,6 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - - nil, // ~ nil, // ( nil, // ) nil, // [ @@ -485,13 +469,71 @@ var actionTab = actionTable{ reduce(6), // g_sdt_lit, reduce: LexProductions reduce(6), // prodId, reduce: LexProductions nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε }, }, actionRow{ // S16 + canRecover: false, + actions: [numSymbols]action{ + nil, // + reduce(23), // Ω, reduce: SyntaxPart + nil, // tokId + nil, // : + nil, // ; + nil, // regDefId + nil, // ignoredTokId + nil, // | + nil, // . + nil, // char_lit + nil, // - + nil, // ( + nil, // ) + nil, // [ + nil, // ] + nil, // { + nil, // } + nil, // g_sdt_lit + shift(13), // prodId + nil, // string_lit + nil, // error + nil, // λ + nil, // empty + nil, // ε + }, + }, + actionRow{ // S17 + canRecover: false, + actions: [numSymbols]action{ + nil, // + reduce(27), // Ω, reduce: SyntaxProdList + nil, // tokId + nil, // : + nil, // ; + nil, // regDefId + nil, // ignoredTokId + nil, // | + nil, // . + nil, // char_lit + nil, // - + nil, // ( + nil, // ) + nil, // [ + nil, // ] + nil, // { + nil, // } + nil, // g_sdt_lit + reduce(27), // prodId, reduce: SyntaxProdList + nil, // string_lit + nil, // error + nil, // λ + nil, // empty + nil, // ε + }, + }, + actionRow{ // S18 canRecover: false, actions: [numSymbols]action{ nil, // @@ -499,13 +541,12 @@ var actionTab = actionTable{ nil, // tokId nil, // : nil, // ; - shift(23), // regDefId + shift(25), // regDefId nil, // ignoredTokId nil, // | shift(26), // . shift(27), // char_lit - nil, // - - shift(28), // ~ + shift(28), // - shift(29), // ( nil, // ) shift(30), // [ @@ -515,13 +556,13 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε }, }, - actionRow{ // S17 + actionRow{ // S19 canRecover: false, actions: [numSymbols]action{ nil, // @@ -529,13 +570,12 @@ var actionTab = actionTable{ nil, // tokId nil, // : nil, // ; - shift(23), // regDefId + shift(25), // regDefId nil, // ignoredTokId nil, // | shift(26), // . shift(27), // char_lit - nil, // - - shift(28), // ~ + shift(28), // - shift(29), // ( nil, // ) shift(30), // [ @@ -545,13 +585,13 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε }, }, - actionRow{ // S18 + actionRow{ // S20 canRecover: false, actions: [numSymbols]action{ nil, // @@ -559,13 +599,12 @@ var actionTab = actionTable{ nil, // tokId nil, // : nil, // ; - shift(23), // regDefId + shift(25), // regDefId nil, // ignoredTokId nil, // | shift(26), // . shift(27), // char_lit - nil, // - - shift(28), // ~ + shift(28), // - shift(29), // ( nil, // ) shift(30), // [ @@ -575,78 +614,18 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε }, }, - actionRow{ // S19 - canRecover: false, - actions: [numSymbols]action{ - nil, // - reduce(23), // Ω, reduce: SyntaxPart - nil, // tokId - nil, // : - nil, // ; - nil, // regDefId - nil, // ignoredTokId - nil, // | - nil, // . - nil, // char_lit - nil, // - - nil, // ~ - nil, // ( - nil, // ) - nil, // [ - nil, // ] - nil, // { - nil, // } - nil, // g_sdt_lit - shift(13), // prodId - nil, // string_lit - nil, // errore - nil, // λ - nil, // empty - nil, // ε - }, - }, - actionRow{ // S20 - canRecover: false, - actions: [numSymbols]action{ - nil, // - reduce(27), // Ω, reduce: SyntaxProdList - nil, // tokId - nil, // : - nil, // ; - nil, // regDefId - nil, // ignoredTokId - nil, // | - nil, // . - nil, // char_lit - nil, // - - nil, // ~ - nil, // ( - nil, // ) - nil, // [ - nil, // ] - nil, // { - nil, // } - nil, // g_sdt_lit - reduce(27), // prodId, reduce: SyntaxProdList - nil, // string_lit - nil, // errore - nil, // λ - nil, // empty - nil, // ε - }, - }, actionRow{ // S21 - canRecover: false, + canRecover: true, actions: [numSymbols]action{ nil, // nil, // Ω - shift(34), // tokId + shift(40), // tokId nil, // : nil, // ; nil, // regDefId @@ -655,7 +634,6 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - - nil, // ~ nil, // ( nil, // ) nil, // [ @@ -663,9 +641,9 @@ var actionTab = actionTable{ nil, // { nil, // } nil, // g_sdt_lit - shift(35), // prodId + shift(41), // prodId shift(42), // string_lit - shift(43), // errore + shift(43), // error shift(44), // λ shift(45), // empty shift(46), // ε @@ -685,7 +663,6 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - - nil, // ~ nil, // ( nil, // ) nil, // [ @@ -695,7 +672,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -708,24 +685,23 @@ var actionTab = actionTable{ nil, // Ω nil, // tokId nil, // : - reduce(19), // ;, reduce: LexTerm - reduce(19), // regDefId, reduce: LexTerm + reduce(10), // ;, reduce: LexPattern + shift(25), // regDefId nil, // ignoredTokId - reduce(19), // |, reduce: LexTerm - reduce(19), // ., reduce: LexTerm - reduce(19), // char_lit, reduce: LexTerm - nil, // - - reduce(19), // ~, reduce: LexTerm - reduce(19), // (, reduce: LexTerm + reduce(10), // |, reduce: LexPattern + shift(26), // . + shift(27), // char_lit + shift(28), // - + shift(29), // ( nil, // ) - reduce(19), // [, reduce: LexTerm + shift(30), // [ nil, // ] - reduce(19), // {, reduce: LexTerm + shift(31), // { nil, // } nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -738,24 +714,23 @@ var actionTab = actionTable{ nil, // Ω nil, // tokId nil, // : - reduce(10), // ;, reduce: LexPattern - shift(23), // regDefId + reduce(12), // ;, reduce: LexAlt + reduce(12), // regDefId, reduce: LexAlt nil, // ignoredTokId - reduce(10), // |, reduce: LexPattern - shift(26), // . - shift(27), // char_lit - nil, // - - shift(28), // ~ - shift(29), // ( + reduce(12), // |, reduce: LexAlt + reduce(12), // ., reduce: LexAlt + reduce(12), // char_lit, reduce: LexAlt + reduce(12), // -, reduce: LexAlt + reduce(12), // (, reduce: LexAlt nil, // ) - shift(30), // [ + reduce(12), // [, reduce: LexAlt nil, // ] - shift(31), // { + reduce(12), // {, reduce: LexAlt nil, // } nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -768,24 +743,23 @@ var actionTab = actionTable{ nil, // Ω nil, // tokId nil, // : - reduce(12), // ;, reduce: LexAlt - reduce(12), // regDefId, reduce: LexAlt + reduce(19), // ;, reduce: LexTerm + reduce(19), // regDefId, reduce: LexTerm nil, // ignoredTokId - reduce(12), // |, reduce: LexAlt - reduce(12), // ., reduce: LexAlt - reduce(12), // char_lit, reduce: LexAlt - nil, // - - reduce(12), // ~, reduce: LexAlt - reduce(12), // (, reduce: LexAlt + reduce(19), // |, reduce: LexTerm + reduce(19), // ., reduce: LexTerm + reduce(19), // char_lit, reduce: LexTerm + reduce(19), // -, reduce: LexTerm + reduce(19), // (, reduce: LexTerm nil, // ) - reduce(12), // [, reduce: LexAlt + reduce(19), // [, reduce: LexTerm nil, // ] - reduce(12), // {, reduce: LexAlt + reduce(19), // {, reduce: LexTerm nil, // } nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -804,8 +778,7 @@ var actionTab = actionTable{ reduce(14), // |, reduce: LexTerm reduce(14), // ., reduce: LexTerm reduce(14), // char_lit, reduce: LexTerm - nil, // - - reduce(14), // ~, reduce: LexTerm + reduce(14), // -, reduce: LexTerm reduce(14), // (, reduce: LexTerm nil, // ) reduce(14), // [, reduce: LexTerm @@ -815,7 +788,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -835,7 +808,6 @@ var actionTab = actionTable{ reduce(15), // ., reduce: LexTerm reduce(15), // char_lit, reduce: LexTerm shift(50), // - - reduce(15), // ~, reduce: LexTerm reduce(15), // (, reduce: LexTerm nil, // ) reduce(15), // [, reduce: LexTerm @@ -845,7 +817,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -865,7 +837,6 @@ var actionTab = actionTable{ nil, // . shift(51), // char_lit nil, // - - nil, // ~ shift(52), // ( nil, // ) nil, // [ @@ -875,7 +846,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -889,13 +860,12 @@ var actionTab = actionTable{ nil, // tokId nil, // : nil, // ; - shift(54), // regDefId + shift(56), // regDefId nil, // ignoredTokId nil, // | shift(57), // . shift(58), // char_lit - nil, // - - shift(59), // ~ + shift(59), // - shift(60), // ( nil, // ) shift(61), // [ @@ -905,7 +875,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -919,13 +889,12 @@ var actionTab = actionTable{ nil, // tokId nil, // : nil, // ; - shift(64), // regDefId + shift(66), // regDefId nil, // ignoredTokId nil, // | shift(67), // . shift(68), // char_lit - nil, // - - shift(69), // ~ + shift(69), // - shift(70), // ( nil, // ) shift(71), // [ @@ -935,7 +904,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -949,13 +918,12 @@ var actionTab = actionTable{ nil, // tokId nil, // : nil, // ; - shift(74), // regDefId + shift(76), // regDefId nil, // ignoredTokId nil, // | shift(77), // . shift(78), // char_lit - nil, // - - shift(79), // ~ + shift(79), // - shift(80), // ( nil, // ) shift(81), // [ @@ -965,7 +933,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -985,7 +953,6 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - - nil, // ~ nil, // ( nil, // ) nil, // [ @@ -995,7 +962,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -1015,7 +982,6 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - - nil, // ~ nil, // ( nil, // ) nil, // [ @@ -1025,127 +991,123 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε }, }, actionRow{ // S34 + canRecover: false, + actions: [numSymbols]action{ + nil, // + nil, // Ω + nil, // tokId + nil, // : + shift(85), // ; + nil, // regDefId + nil, // ignoredTokId + shift(86), // | + nil, // . + nil, // char_lit + nil, // - + nil, // ( + nil, // ) + nil, // [ + nil, // ] + nil, // { + nil, // } + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // error + nil, // λ + nil, // empty + nil, // ε + }, + }, + actionRow{ // S35 canRecover: false, actions: [numSymbols]action{ nil, // nil, // Ω - reduce(41), // tokId, reduce: Symbol + nil, // tokId nil, // : - reduce(41), // ;, reduce: Symbol + reduce(29), // ;, reduce: Alternatives nil, // regDefId nil, // ignoredTokId - reduce(41), // |, reduce: Symbol + reduce(29), // |, reduce: Alternatives nil, // . nil, // char_lit nil, // - - nil, // ~ nil, // ( nil, // ) nil, // [ nil, // ] nil, // { nil, // } - reduce(41), // g_sdt_lit, reduce: Symbol - reduce(41), // prodId, reduce: Symbol - reduce(41), // string_lit, reduce: Symbol - nil, // errore + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // error nil, // λ nil, // empty nil, // ε }, }, - actionRow{ // S35 + actionRow{ // S36 canRecover: false, actions: [numSymbols]action{ nil, // nil, // Ω - reduce(40), // tokId, reduce: Symbol + shift(40), // tokId nil, // : - reduce(40), // ;, reduce: Symbol + reduce(31), // ;, reduce: SyntaxBody nil, // regDefId nil, // ignoredTokId - reduce(40), // |, reduce: Symbol + reduce(31), // |, reduce: SyntaxBody nil, // . nil, // char_lit nil, // - - nil, // ~ nil, // ( nil, // ) nil, // [ nil, // ] nil, // { nil, // } - reduce(40), // g_sdt_lit, reduce: Symbol - reduce(40), // prodId, reduce: Symbol - reduce(40), // string_lit, reduce: Symbol - nil, // errore + shift(88), // g_sdt_lit + shift(41), // prodId + shift(42), // string_lit + nil, // error nil, // λ nil, // empty nil, // ε }, }, - actionRow{ // S36 - canRecover: false, - actions: [numSymbols]action{ - nil, // - nil, // Ω - nil, // tokId - nil, // : - shift(85), // ; - nil, // regDefId - nil, // ignoredTokId - shift(86), // | - nil, // . - nil, // char_lit - nil, // - - nil, // ~ - nil, // ( - nil, // ) - nil, // [ - nil, // ] - nil, // { - nil, // } - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // errore - nil, // λ - nil, // empty - nil, // ε - }, - }, actionRow{ // S37 canRecover: false, actions: [numSymbols]action{ nil, // nil, // Ω - nil, // tokId + reduce(38), // tokId, reduce: Symbols nil, // : - reduce(29), // ;, reduce: Alternatives + reduce(38), // ;, reduce: Symbols nil, // regDefId nil, // ignoredTokId - reduce(29), // |, reduce: Alternatives + reduce(38), // |, reduce: Symbols nil, // . nil, // char_lit nil, // - - nil, // ~ nil, // ( nil, // ) nil, // [ nil, // ] nil, // { nil, // } - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // errore + reduce(38), // g_sdt_lit, reduce: Symbols + reduce(38), // prodId, reduce: Symbols + reduce(38), // string_lit, reduce: Symbols + nil, // error nil, // λ nil, // empty nil, // ε @@ -1156,26 +1118,25 @@ var actionTab = actionTable{ actions: [numSymbols]action{ nil, // nil, // Ω - shift(34), // tokId + shift(40), // tokId nil, // : - reduce(31), // ;, reduce: SyntaxBody + reduce(33), // ;, reduce: SyntaxBody nil, // regDefId nil, // ignoredTokId - reduce(31), // |, reduce: SyntaxBody + reduce(33), // |, reduce: SyntaxBody nil, // . nil, // char_lit nil, // - - nil, // ~ nil, // ( nil, // ) nil, // [ nil, // ] nil, // { nil, // } - shift(87), // g_sdt_lit - shift(35), // prodId + shift(90), // g_sdt_lit + shift(41), // prodId shift(42), // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -1186,26 +1147,25 @@ var actionTab = actionTable{ actions: [numSymbols]action{ nil, // nil, // Ω - shift(34), // tokId + nil, // tokId nil, // : - reduce(33), // ;, reduce: SyntaxBody + reduce(37), // ;, reduce: SyntaxBody nil, // regDefId nil, // ignoredTokId - reduce(33), // |, reduce: SyntaxBody + reduce(37), // |, reduce: SyntaxBody nil, // . nil, // char_lit nil, // - - nil, // ~ nil, // ( nil, // ) nil, // [ nil, // ] nil, // { nil, // } - shift(89), // g_sdt_lit - shift(35), // prodId - shift(42), // string_lit - nil, // errore + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // error nil, // λ nil, // empty nil, // ε @@ -1216,26 +1176,25 @@ var actionTab = actionTable{ actions: [numSymbols]action{ nil, // nil, // Ω - nil, // tokId + reduce(41), // tokId, reduce: Symbol nil, // : - reduce(37), // ;, reduce: SyntaxBody + reduce(41), // ;, reduce: Symbol nil, // regDefId nil, // ignoredTokId - reduce(37), // |, reduce: SyntaxBody + reduce(41), // |, reduce: Symbol nil, // . nil, // char_lit nil, // - - nil, // ~ nil, // ( nil, // ) nil, // [ nil, // ] nil, // { nil, // } - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // errore + reduce(41), // g_sdt_lit, reduce: Symbol + reduce(41), // prodId, reduce: Symbol + reduce(41), // string_lit, reduce: Symbol + nil, // error nil, // λ nil, // empty nil, // ε @@ -1246,26 +1205,25 @@ var actionTab = actionTable{ actions: [numSymbols]action{ nil, // nil, // Ω - reduce(38), // tokId, reduce: Symbols + reduce(40), // tokId, reduce: Symbol nil, // : - reduce(38), // ;, reduce: Symbols + reduce(40), // ;, reduce: Symbol nil, // regDefId nil, // ignoredTokId - reduce(38), // |, reduce: Symbols + reduce(40), // |, reduce: Symbol nil, // . nil, // char_lit nil, // - - nil, // ~ nil, // ( nil, // ) nil, // [ nil, // ] nil, // { nil, // } - reduce(38), // g_sdt_lit, reduce: Symbols - reduce(38), // prodId, reduce: Symbols - reduce(38), // string_lit, reduce: Symbols - nil, // errore + reduce(40), // g_sdt_lit, reduce: Symbol + reduce(40), // prodId, reduce: Symbol + reduce(40), // string_lit, reduce: Symbol + nil, // error nil, // λ nil, // empty nil, // ε @@ -1285,7 +1243,6 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - - nil, // ~ nil, // ( nil, // ) nil, // [ @@ -1295,14 +1252,14 @@ var actionTab = actionTable{ reduce(42), // g_sdt_lit, reduce: Symbol reduce(42), // prodId, reduce: Symbol reduce(42), // string_lit, reduce: Symbol - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε }, }, actionRow{ // S43 - canRecover: false, + canRecover: true, actions: [numSymbols]action{ nil, // nil, // Ω @@ -1315,7 +1272,6 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - - nil, // ~ nil, // ( nil, // ) nil, // [ @@ -1325,7 +1281,7 @@ var actionTab = actionTable{ reduce(43), // g_sdt_lit, reduce: ErrorSymbol reduce(43), // prodId, reduce: ErrorSymbol reduce(43), // string_lit, reduce: ErrorSymbol - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -1345,7 +1301,6 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - - nil, // ~ nil, // ( nil, // ) nil, // [ @@ -1355,7 +1310,7 @@ var actionTab = actionTable{ reduce(44), // g_sdt_lit, reduce: ErrorSymbol reduce(44), // prodId, reduce: ErrorSymbol reduce(44), // string_lit, reduce: ErrorSymbol - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -1375,7 +1330,6 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - - nil, // ~ nil, // ( nil, // ) nil, // [ @@ -1385,7 +1339,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -1405,7 +1359,6 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - - nil, // ~ nil, // ( nil, // ) nil, // [ @@ -1415,7 +1368,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -1435,7 +1388,6 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - - nil, // ~ nil, // ( nil, // ) nil, // [ @@ -1445,7 +1397,7 @@ var actionTab = actionTable{ reduce(7), // g_sdt_lit, reduce: LexProduction reduce(7), // prodId, reduce: LexProduction nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -1459,13 +1411,12 @@ var actionTab = actionTable{ nil, // tokId nil, // : nil, // ; - shift(23), // regDefId + shift(25), // regDefId nil, // ignoredTokId nil, // | shift(26), // . shift(27), // char_lit - nil, // - - shift(28), // ~ + shift(28), // - shift(29), // ( nil, // ) shift(30), // [ @@ -1475,7 +1426,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -1494,8 +1445,7 @@ var actionTab = actionTable{ reduce(13), // |, reduce: LexAlt reduce(13), // ., reduce: LexAlt reduce(13), // char_lit, reduce: LexAlt - nil, // - - reduce(13), // ~, reduce: LexAlt + reduce(13), // -, reduce: LexAlt reduce(13), // (, reduce: LexAlt nil, // ) reduce(13), // [, reduce: LexAlt @@ -1505,7 +1455,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -1525,7 +1475,6 @@ var actionTab = actionTable{ nil, // . shift(92), // char_lit nil, // - - nil, // ~ nil, // ( nil, // ) nil, // [ @@ -1535,7 +1484,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -1554,8 +1503,7 @@ var actionTab = actionTable{ reduce(17), // |, reduce: LexTerm reduce(17), // ., reduce: LexTerm reduce(17), // char_lit, reduce: LexTerm - nil, // - - reduce(17), // ~, reduce: LexTerm + reduce(17), // -, reduce: LexTerm reduce(17), // (, reduce: LexTerm nil, // ) reduce(17), // [, reduce: LexTerm @@ -1565,7 +1513,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -1585,7 +1533,6 @@ var actionTab = actionTable{ nil, // . shift(93), // char_lit nil, // - - nil, // ~ nil, // ( nil, // ) nil, // [ @@ -1595,7 +1542,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -1615,7 +1562,6 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - - nil, // ~ nil, // ( shift(95), // ) nil, // [ @@ -1625,7 +1571,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -1639,23 +1585,22 @@ var actionTab = actionTable{ nil, // tokId nil, // : nil, // ; - reduce(19), // regDefId, reduce: LexTerm + shift(56), // regDefId nil, // ignoredTokId - reduce(19), // |, reduce: LexTerm - reduce(19), // ., reduce: LexTerm - reduce(19), // char_lit, reduce: LexTerm - nil, // - - reduce(19), // ~, reduce: LexTerm - reduce(19), // (, reduce: LexTerm - reduce(19), // ), reduce: LexTerm - reduce(19), // [, reduce: LexTerm + reduce(10), // |, reduce: LexPattern + shift(57), // . + shift(58), // char_lit + shift(59), // - + shift(60), // ( + reduce(10), // ), reduce: LexPattern + shift(61), // [ nil, // ] - reduce(19), // {, reduce: LexTerm + shift(62), // { nil, // } nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -1669,23 +1614,22 @@ var actionTab = actionTable{ nil, // tokId nil, // : nil, // ; - shift(54), // regDefId + reduce(12), // regDefId, reduce: LexAlt nil, // ignoredTokId - reduce(10), // |, reduce: LexPattern - shift(57), // . - shift(58), // char_lit - nil, // - - shift(59), // ~ - shift(60), // ( - reduce(10), // ), reduce: LexPattern - shift(61), // [ + reduce(12), // |, reduce: LexAlt + reduce(12), // ., reduce: LexAlt + reduce(12), // char_lit, reduce: LexAlt + reduce(12), // -, reduce: LexAlt + reduce(12), // (, reduce: LexAlt + reduce(12), // ), reduce: LexAlt + reduce(12), // [, reduce: LexAlt nil, // ] - shift(62), // { + reduce(12), // {, reduce: LexAlt nil, // } nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -1699,23 +1643,22 @@ var actionTab = actionTable{ nil, // tokId nil, // : nil, // ; - reduce(12), // regDefId, reduce: LexAlt + reduce(19), // regDefId, reduce: LexTerm nil, // ignoredTokId - reduce(12), // |, reduce: LexAlt - reduce(12), // ., reduce: LexAlt - reduce(12), // char_lit, reduce: LexAlt - nil, // - - reduce(12), // ~, reduce: LexAlt - reduce(12), // (, reduce: LexAlt - reduce(12), // ), reduce: LexAlt - reduce(12), // [, reduce: LexAlt + reduce(19), // |, reduce: LexTerm + reduce(19), // ., reduce: LexTerm + reduce(19), // char_lit, reduce: LexTerm + reduce(19), // -, reduce: LexTerm + reduce(19), // (, reduce: LexTerm + reduce(19), // ), reduce: LexTerm + reduce(19), // [, reduce: LexTerm nil, // ] - reduce(12), // {, reduce: LexAlt + reduce(19), // {, reduce: LexTerm nil, // } nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -1734,8 +1677,7 @@ var actionTab = actionTable{ reduce(14), // |, reduce: LexTerm reduce(14), // ., reduce: LexTerm reduce(14), // char_lit, reduce: LexTerm - nil, // - - reduce(14), // ~, reduce: LexTerm + reduce(14), // -, reduce: LexTerm reduce(14), // (, reduce: LexTerm reduce(14), // ), reduce: LexTerm reduce(14), // [, reduce: LexTerm @@ -1745,7 +1687,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -1765,7 +1707,6 @@ var actionTab = actionTable{ reduce(15), // ., reduce: LexTerm reduce(15), // char_lit, reduce: LexTerm shift(97), // - - reduce(15), // ~, reduce: LexTerm reduce(15), // (, reduce: LexTerm reduce(15), // ), reduce: LexTerm reduce(15), // [, reduce: LexTerm @@ -1775,7 +1716,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -1795,7 +1736,6 @@ var actionTab = actionTable{ nil, // . shift(98), // char_lit nil, // - - nil, // ~ shift(99), // ( nil, // ) nil, // [ @@ -1805,7 +1745,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -1819,13 +1759,12 @@ var actionTab = actionTable{ nil, // tokId nil, // : nil, // ; - shift(54), // regDefId + shift(56), // regDefId nil, // ignoredTokId nil, // | shift(57), // . shift(58), // char_lit - nil, // - - shift(59), // ~ + shift(59), // - shift(60), // ( nil, // ) shift(61), // [ @@ -1835,7 +1774,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -1849,13 +1788,12 @@ var actionTab = actionTable{ nil, // tokId nil, // : nil, // ; - shift(64), // regDefId + shift(66), // regDefId nil, // ignoredTokId nil, // | shift(67), // . shift(68), // char_lit - nil, // - - shift(69), // ~ + shift(69), // - shift(70), // ( nil, // ) shift(71), // [ @@ -1865,7 +1803,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -1879,13 +1817,12 @@ var actionTab = actionTable{ nil, // tokId nil, // : nil, // ; - shift(74), // regDefId + shift(76), // regDefId nil, // ignoredTokId nil, // | shift(77), // . shift(78), // char_lit - nil, // - - shift(79), // ~ + shift(79), // - shift(80), // ( nil, // ) shift(81), // [ @@ -1895,7 +1832,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -1915,7 +1852,6 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - - nil, // ~ nil, // ( nil, // ) nil, // [ @@ -1925,7 +1861,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -1939,23 +1875,22 @@ var actionTab = actionTable{ nil, // tokId nil, // : nil, // ; - reduce(19), // regDefId, reduce: LexTerm + shift(66), // regDefId nil, // ignoredTokId - reduce(19), // |, reduce: LexTerm - reduce(19), // ., reduce: LexTerm - reduce(19), // char_lit, reduce: LexTerm - nil, // - - reduce(19), // ~, reduce: LexTerm - reduce(19), // (, reduce: LexTerm + reduce(10), // |, reduce: LexPattern + shift(67), // . + shift(68), // char_lit + shift(69), // - + shift(70), // ( nil, // ) - reduce(19), // [, reduce: LexTerm - reduce(19), // ], reduce: LexTerm - reduce(19), // {, reduce: LexTerm + shift(71), // [ + reduce(10), // ], reduce: LexPattern + shift(72), // { nil, // } nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -1969,23 +1904,22 @@ var actionTab = actionTable{ nil, // tokId nil, // : nil, // ; - shift(64), // regDefId + reduce(12), // regDefId, reduce: LexAlt nil, // ignoredTokId - reduce(10), // |, reduce: LexPattern - shift(67), // . - shift(68), // char_lit - nil, // - - shift(69), // ~ - shift(70), // ( + reduce(12), // |, reduce: LexAlt + reduce(12), // ., reduce: LexAlt + reduce(12), // char_lit, reduce: LexAlt + reduce(12), // -, reduce: LexAlt + reduce(12), // (, reduce: LexAlt nil, // ) - shift(71), // [ - reduce(10), // ], reduce: LexPattern - shift(72), // { + reduce(12), // [, reduce: LexAlt + reduce(12), // ], reduce: LexAlt + reduce(12), // {, reduce: LexAlt nil, // } nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -1999,23 +1933,22 @@ var actionTab = actionTable{ nil, // tokId nil, // : nil, // ; - reduce(12), // regDefId, reduce: LexAlt + reduce(19), // regDefId, reduce: LexTerm nil, // ignoredTokId - reduce(12), // |, reduce: LexAlt - reduce(12), // ., reduce: LexAlt - reduce(12), // char_lit, reduce: LexAlt - nil, // - - reduce(12), // ~, reduce: LexAlt - reduce(12), // (, reduce: LexAlt + reduce(19), // |, reduce: LexTerm + reduce(19), // ., reduce: LexTerm + reduce(19), // char_lit, reduce: LexTerm + reduce(19), // -, reduce: LexTerm + reduce(19), // (, reduce: LexTerm nil, // ) - reduce(12), // [, reduce: LexAlt - reduce(12), // ], reduce: LexAlt - reduce(12), // {, reduce: LexAlt + reduce(19), // [, reduce: LexTerm + reduce(19), // ], reduce: LexTerm + reduce(19), // {, reduce: LexTerm nil, // } nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -2034,8 +1967,7 @@ var actionTab = actionTable{ reduce(14), // |, reduce: LexTerm reduce(14), // ., reduce: LexTerm reduce(14), // char_lit, reduce: LexTerm - nil, // - - reduce(14), // ~, reduce: LexTerm + reduce(14), // -, reduce: LexTerm reduce(14), // (, reduce: LexTerm nil, // ) reduce(14), // [, reduce: LexTerm @@ -2045,7 +1977,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -2065,7 +1997,6 @@ var actionTab = actionTable{ reduce(15), // ., reduce: LexTerm reduce(15), // char_lit, reduce: LexTerm shift(106), // - - reduce(15), // ~, reduce: LexTerm reduce(15), // (, reduce: LexTerm nil, // ) reduce(15), // [, reduce: LexTerm @@ -2075,7 +2006,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -2095,7 +2026,6 @@ var actionTab = actionTable{ nil, // . shift(107), // char_lit nil, // - - nil, // ~ shift(108), // ( nil, // ) nil, // [ @@ -2105,7 +2035,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -2119,13 +2049,12 @@ var actionTab = actionTable{ nil, // tokId nil, // : nil, // ; - shift(54), // regDefId + shift(56), // regDefId nil, // ignoredTokId nil, // | shift(57), // . shift(58), // char_lit - nil, // - - shift(59), // ~ + shift(59), // - shift(60), // ( nil, // ) shift(61), // [ @@ -2135,7 +2064,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -2149,13 +2078,12 @@ var actionTab = actionTable{ nil, // tokId nil, // : nil, // ; - shift(64), // regDefId + shift(66), // regDefId nil, // ignoredTokId nil, // | shift(67), // . shift(68), // char_lit - nil, // - - shift(69), // ~ + shift(69), // - shift(70), // ( nil, // ) shift(71), // [ @@ -2165,7 +2093,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -2179,13 +2107,12 @@ var actionTab = actionTable{ nil, // tokId nil, // : nil, // ; - shift(74), // regDefId + shift(76), // regDefId nil, // ignoredTokId nil, // | shift(77), // . shift(78), // char_lit - nil, // - - shift(79), // ~ + shift(79), // - shift(80), // ( nil, // ) shift(81), // [ @@ -2195,7 +2122,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -2215,7 +2142,6 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - - nil, // ~ nil, // ( nil, // ) nil, // [ @@ -2225,7 +2151,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -2239,23 +2165,22 @@ var actionTab = actionTable{ nil, // tokId nil, // : nil, // ; - reduce(19), // regDefId, reduce: LexTerm + shift(76), // regDefId nil, // ignoredTokId - reduce(19), // |, reduce: LexTerm - reduce(19), // ., reduce: LexTerm - reduce(19), // char_lit, reduce: LexTerm - nil, // - - reduce(19), // ~, reduce: LexTerm - reduce(19), // (, reduce: LexTerm + reduce(10), // |, reduce: LexPattern + shift(77), // . + shift(78), // char_lit + shift(79), // - + shift(80), // ( nil, // ) - reduce(19), // [, reduce: LexTerm + shift(81), // [ nil, // ] - reduce(19), // {, reduce: LexTerm - reduce(19), // }, reduce: LexTerm + shift(82), // { + reduce(10), // }, reduce: LexPattern nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -2269,23 +2194,22 @@ var actionTab = actionTable{ nil, // tokId nil, // : nil, // ; - shift(74), // regDefId + reduce(12), // regDefId, reduce: LexAlt nil, // ignoredTokId - reduce(10), // |, reduce: LexPattern - shift(77), // . - shift(78), // char_lit - nil, // - - shift(79), // ~ - shift(80), // ( + reduce(12), // |, reduce: LexAlt + reduce(12), // ., reduce: LexAlt + reduce(12), // char_lit, reduce: LexAlt + reduce(12), // -, reduce: LexAlt + reduce(12), // (, reduce: LexAlt nil, // ) - shift(81), // [ + reduce(12), // [, reduce: LexAlt nil, // ] - shift(82), // { - reduce(10), // }, reduce: LexPattern + reduce(12), // {, reduce: LexAlt + reduce(12), // }, reduce: LexAlt nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -2299,23 +2223,22 @@ var actionTab = actionTable{ nil, // tokId nil, // : nil, // ; - reduce(12), // regDefId, reduce: LexAlt + reduce(19), // regDefId, reduce: LexTerm nil, // ignoredTokId - reduce(12), // |, reduce: LexAlt - reduce(12), // ., reduce: LexAlt - reduce(12), // char_lit, reduce: LexAlt - nil, // - - reduce(12), // ~, reduce: LexAlt - reduce(12), // (, reduce: LexAlt + reduce(19), // |, reduce: LexTerm + reduce(19), // ., reduce: LexTerm + reduce(19), // char_lit, reduce: LexTerm + reduce(19), // -, reduce: LexTerm + reduce(19), // (, reduce: LexTerm nil, // ) - reduce(12), // [, reduce: LexAlt + reduce(19), // [, reduce: LexTerm nil, // ] - reduce(12), // {, reduce: LexAlt - reduce(12), // }, reduce: LexAlt + reduce(19), // {, reduce: LexTerm + reduce(19), // }, reduce: LexTerm nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -2334,8 +2257,7 @@ var actionTab = actionTable{ reduce(14), // |, reduce: LexTerm reduce(14), // ., reduce: LexTerm reduce(14), // char_lit, reduce: LexTerm - nil, // - - reduce(14), // ~, reduce: LexTerm + reduce(14), // -, reduce: LexTerm reduce(14), // (, reduce: LexTerm nil, // ) reduce(14), // [, reduce: LexTerm @@ -2345,7 +2267,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -2365,7 +2287,6 @@ var actionTab = actionTable{ reduce(15), // ., reduce: LexTerm reduce(15), // char_lit, reduce: LexTerm shift(115), // - - reduce(15), // ~, reduce: LexTerm reduce(15), // (, reduce: LexTerm nil, // ) reduce(15), // [, reduce: LexTerm @@ -2375,7 +2296,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -2395,7 +2316,6 @@ var actionTab = actionTable{ nil, // . shift(116), // char_lit nil, // - - nil, // ~ shift(117), // ( nil, // ) nil, // [ @@ -2405,7 +2325,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -2419,13 +2339,12 @@ var actionTab = actionTable{ nil, // tokId nil, // : nil, // ; - shift(54), // regDefId + shift(56), // regDefId nil, // ignoredTokId nil, // | shift(57), // . shift(58), // char_lit - nil, // - - shift(59), // ~ + shift(59), // - shift(60), // ( nil, // ) shift(61), // [ @@ -2435,7 +2354,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -2449,13 +2368,12 @@ var actionTab = actionTable{ nil, // tokId nil, // : nil, // ; - shift(64), // regDefId + shift(66), // regDefId nil, // ignoredTokId nil, // | shift(67), // . shift(68), // char_lit - nil, // - - shift(69), // ~ + shift(69), // - shift(70), // ( nil, // ) shift(71), // [ @@ -2465,7 +2383,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -2479,13 +2397,12 @@ var actionTab = actionTable{ nil, // tokId nil, // : nil, // ; - shift(74), // regDefId + shift(76), // regDefId nil, // ignoredTokId nil, // | shift(77), // . shift(78), // char_lit - nil, // - - shift(79), // ~ + shift(79), // - shift(80), // ( nil, // ) shift(81), // [ @@ -2495,7 +2412,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -2515,7 +2432,6 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - - nil, // ~ nil, // ( nil, // ) nil, // [ @@ -2525,7 +2441,7 @@ var actionTab = actionTable{ reduce(8), // g_sdt_lit, reduce: LexProduction reduce(8), // prodId, reduce: LexProduction nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -2545,7 +2461,6 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - - nil, // ~ nil, // ( nil, // ) nil, // [ @@ -2555,7 +2470,7 @@ var actionTab = actionTable{ reduce(9), // g_sdt_lit, reduce: LexProduction reduce(9), // prodId, reduce: LexProduction nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -2575,7 +2490,6 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - - nil, // ~ nil, // ( nil, // ) nil, // [ @@ -2585,18 +2499,18 @@ var actionTab = actionTable{ nil, // g_sdt_lit reduce(28), // prodId, reduce: SyntaxProduction nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε }, }, actionRow{ // S86 - canRecover: false, + canRecover: true, actions: [numSymbols]action{ nil, // nil, // Ω - shift(34), // tokId + shift(40), // tokId nil, // : nil, // ; nil, // regDefId @@ -2605,7 +2519,6 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - - nil, // ~ nil, // ( nil, // ) nil, // [ @@ -2613,9 +2526,9 @@ var actionTab = actionTable{ nil, // { nil, // } nil, // g_sdt_lit - shift(35), // prodId + shift(41), // prodId shift(42), // string_lit - shift(43), // errore + shift(43), // error shift(44), // λ shift(45), // empty shift(46), // ε @@ -2626,26 +2539,25 @@ var actionTab = actionTable{ actions: [numSymbols]action{ nil, // nil, // Ω - nil, // tokId + reduce(39), // tokId, reduce: Symbols nil, // : - reduce(32), // ;, reduce: SyntaxBody + reduce(39), // ;, reduce: Symbols nil, // regDefId nil, // ignoredTokId - reduce(32), // |, reduce: SyntaxBody + reduce(39), // |, reduce: Symbols nil, // . nil, // char_lit nil, // - - nil, // ~ nil, // ( nil, // ) nil, // [ nil, // ] nil, // { nil, // } - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // errore + reduce(39), // g_sdt_lit, reduce: Symbols + reduce(39), // prodId, reduce: Symbols + reduce(39), // string_lit, reduce: Symbols + nil, // error nil, // λ nil, // empty nil, // ε @@ -2656,26 +2568,25 @@ var actionTab = actionTable{ actions: [numSymbols]action{ nil, // nil, // Ω - reduce(39), // tokId, reduce: Symbols + nil, // tokId nil, // : - reduce(39), // ;, reduce: Symbols + reduce(32), // ;, reduce: SyntaxBody nil, // regDefId nil, // ignoredTokId - reduce(39), // |, reduce: Symbols + reduce(32), // |, reduce: SyntaxBody nil, // . nil, // char_lit nil, // - - nil, // ~ nil, // ( nil, // ) nil, // [ nil, // ] nil, // { nil, // } - reduce(39), // g_sdt_lit, reduce: Symbols - reduce(39), // prodId, reduce: Symbols - reduce(39), // string_lit, reduce: Symbols - nil, // errore + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // error nil, // λ nil, // empty nil, // ε @@ -2686,26 +2597,25 @@ var actionTab = actionTable{ actions: [numSymbols]action{ nil, // nil, // Ω - nil, // tokId + shift(40), // tokId nil, // : - reduce(36), // ;, reduce: SyntaxBody + reduce(34), // ;, reduce: SyntaxBody nil, // regDefId nil, // ignoredTokId - reduce(36), // |, reduce: SyntaxBody + reduce(34), // |, reduce: SyntaxBody nil, // . nil, // char_lit nil, // - - nil, // ~ nil, // ( nil, // ) nil, // [ nil, // ] nil, // { nil, // } - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // errore + shift(122), // g_sdt_lit + shift(41), // prodId + shift(42), // string_lit + nil, // error nil, // λ nil, // empty nil, // ε @@ -2716,26 +2626,25 @@ var actionTab = actionTable{ actions: [numSymbols]action{ nil, // nil, // Ω - shift(34), // tokId + nil, // tokId nil, // : - reduce(34), // ;, reduce: SyntaxBody + reduce(36), // ;, reduce: SyntaxBody nil, // regDefId nil, // ignoredTokId - reduce(34), // |, reduce: SyntaxBody + reduce(36), // |, reduce: SyntaxBody nil, // . nil, // char_lit nil, // - - nil, // ~ nil, // ( nil, // ) nil, // [ nil, // ] nil, // { nil, // } - shift(122), // g_sdt_lit - shift(35), // prodId - shift(42), // string_lit - nil, // errore + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // error nil, // λ nil, // empty nil, // ε @@ -2749,13 +2658,12 @@ var actionTab = actionTable{ nil, // tokId nil, // : reduce(11), // ;, reduce: LexPattern - shift(23), // regDefId + shift(25), // regDefId nil, // ignoredTokId reduce(11), // |, reduce: LexPattern shift(26), // . shift(27), // char_lit - nil, // - - shift(28), // ~ + shift(28), // - shift(29), // ( nil, // ) shift(30), // [ @@ -2765,7 +2673,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -2784,8 +2692,7 @@ var actionTab = actionTable{ reduce(16), // |, reduce: LexTerm reduce(16), // ., reduce: LexTerm reduce(16), // char_lit, reduce: LexTerm - nil, // - - reduce(16), // ~, reduce: LexTerm + reduce(16), // -, reduce: LexTerm reduce(16), // (, reduce: LexTerm nil, // ) reduce(16), // [, reduce: LexTerm @@ -2795,7 +2702,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -2815,7 +2722,6 @@ var actionTab = actionTable{ nil, // . nil, // char_lit shift(123), // - - nil, // ~ nil, // ( nil, // ) nil, // [ @@ -2825,7 +2731,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -2839,13 +2745,12 @@ var actionTab = actionTable{ nil, // tokId nil, // : nil, // ; - shift(54), // regDefId + shift(56), // regDefId nil, // ignoredTokId nil, // | shift(57), // . shift(58), // char_lit - nil, // - - shift(59), // ~ + shift(59), // - shift(60), // ( nil, // ) shift(61), // [ @@ -2855,7 +2760,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -2874,8 +2779,7 @@ var actionTab = actionTable{ reduce(22), // |, reduce: LexTerm reduce(22), // ., reduce: LexTerm reduce(22), // char_lit, reduce: LexTerm - nil, // - - reduce(22), // ~, reduce: LexTerm + reduce(22), // -, reduce: LexTerm reduce(22), // (, reduce: LexTerm nil, // ) reduce(22), // [, reduce: LexTerm @@ -2885,7 +2789,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -2904,8 +2808,7 @@ var actionTab = actionTable{ reduce(13), // |, reduce: LexAlt reduce(13), // ., reduce: LexAlt reduce(13), // char_lit, reduce: LexAlt - nil, // - - reduce(13), // ~, reduce: LexAlt + reduce(13), // -, reduce: LexAlt reduce(13), // (, reduce: LexAlt reduce(13), // ), reduce: LexAlt reduce(13), // [, reduce: LexAlt @@ -2915,7 +2818,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -2935,7 +2838,6 @@ var actionTab = actionTable{ nil, // . shift(125), // char_lit nil, // - - nil, // ~ nil, // ( nil, // ) nil, // [ @@ -2945,7 +2847,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -2964,8 +2866,7 @@ var actionTab = actionTable{ reduce(17), // |, reduce: LexTerm reduce(17), // ., reduce: LexTerm reduce(17), // char_lit, reduce: LexTerm - nil, // - - reduce(17), // ~, reduce: LexTerm + reduce(17), // -, reduce: LexTerm reduce(17), // (, reduce: LexTerm reduce(17), // ), reduce: LexTerm reduce(17), // [, reduce: LexTerm @@ -2975,7 +2876,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -2995,7 +2896,6 @@ var actionTab = actionTable{ nil, // . shift(126), // char_lit nil, // - - nil, // ~ nil, // ( nil, // ) nil, // [ @@ -3005,7 +2905,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -3025,7 +2925,6 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - - nil, // ~ nil, // ( shift(127), // ) nil, // [ @@ -3035,7 +2934,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -3055,7 +2954,6 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - - nil, // ~ nil, // ( nil, // ) nil, // [ @@ -3065,7 +2963,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -3085,7 +2983,6 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - - nil, // ~ nil, // ( nil, // ) nil, // [ @@ -3095,7 +2992,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -3109,13 +3006,12 @@ var actionTab = actionTable{ nil, // tokId nil, // : nil, // ; - shift(64), // regDefId + shift(66), // regDefId nil, // ignoredTokId nil, // | shift(67), // . shift(68), // char_lit - nil, // - - shift(69), // ~ + shift(69), // - shift(70), // ( nil, // ) shift(71), // [ @@ -3125,7 +3021,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -3144,8 +3040,7 @@ var actionTab = actionTable{ reduce(20), // |, reduce: LexTerm reduce(20), // ., reduce: LexTerm reduce(20), // char_lit, reduce: LexTerm - nil, // - - reduce(20), // ~, reduce: LexTerm + reduce(20), // -, reduce: LexTerm reduce(20), // (, reduce: LexTerm nil, // ) reduce(20), // [, reduce: LexTerm @@ -3155,7 +3050,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -3174,8 +3069,7 @@ var actionTab = actionTable{ reduce(13), // |, reduce: LexAlt reduce(13), // ., reduce: LexAlt reduce(13), // char_lit, reduce: LexAlt - nil, // - - reduce(13), // ~, reduce: LexAlt + reduce(13), // -, reduce: LexAlt reduce(13), // (, reduce: LexAlt nil, // ) reduce(13), // [, reduce: LexAlt @@ -3185,7 +3079,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -3205,7 +3099,6 @@ var actionTab = actionTable{ nil, // . shift(131), // char_lit nil, // - - nil, // ~ nil, // ( nil, // ) nil, // [ @@ -3215,7 +3108,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -3234,8 +3127,7 @@ var actionTab = actionTable{ reduce(17), // |, reduce: LexTerm reduce(17), // ., reduce: LexTerm reduce(17), // char_lit, reduce: LexTerm - nil, // - - reduce(17), // ~, reduce: LexTerm + reduce(17), // -, reduce: LexTerm reduce(17), // (, reduce: LexTerm nil, // ) reduce(17), // [, reduce: LexTerm @@ -3245,7 +3137,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -3265,7 +3157,6 @@ var actionTab = actionTable{ nil, // . shift(132), // char_lit nil, // - - nil, // ~ nil, // ( nil, // ) nil, // [ @@ -3275,7 +3166,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -3295,7 +3186,6 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - - nil, // ~ nil, // ( shift(133), // ) nil, // [ @@ -3305,7 +3195,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -3325,7 +3215,6 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - - nil, // ~ nil, // ( nil, // ) nil, // [ @@ -3335,7 +3224,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -3355,7 +3244,6 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - - nil, // ~ nil, // ( nil, // ) nil, // [ @@ -3365,7 +3253,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -3379,13 +3267,12 @@ var actionTab = actionTable{ nil, // tokId nil, // : nil, // ; - shift(74), // regDefId + shift(76), // regDefId nil, // ignoredTokId nil, // | shift(77), // . shift(78), // char_lit - nil, // - - shift(79), // ~ + shift(79), // - shift(80), // ( nil, // ) shift(81), // [ @@ -3395,7 +3282,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -3414,8 +3301,7 @@ var actionTab = actionTable{ reduce(21), // |, reduce: LexTerm reduce(21), // ., reduce: LexTerm reduce(21), // char_lit, reduce: LexTerm - nil, // - - reduce(21), // ~, reduce: LexTerm + reduce(21), // -, reduce: LexTerm reduce(21), // (, reduce: LexTerm nil, // ) reduce(21), // [, reduce: LexTerm @@ -3425,7 +3311,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -3444,8 +3330,7 @@ var actionTab = actionTable{ reduce(13), // |, reduce: LexAlt reduce(13), // ., reduce: LexAlt reduce(13), // char_lit, reduce: LexAlt - nil, // - - reduce(13), // ~, reduce: LexAlt + reduce(13), // -, reduce: LexAlt reduce(13), // (, reduce: LexAlt nil, // ) reduce(13), // [, reduce: LexAlt @@ -3455,7 +3340,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -3475,7 +3360,6 @@ var actionTab = actionTable{ nil, // . shift(137), // char_lit nil, // - - nil, // ~ nil, // ( nil, // ) nil, // [ @@ -3485,7 +3369,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -3504,8 +3388,7 @@ var actionTab = actionTable{ reduce(17), // |, reduce: LexTerm reduce(17), // ., reduce: LexTerm reduce(17), // char_lit, reduce: LexTerm - nil, // - - reduce(17), // ~, reduce: LexTerm + reduce(17), // -, reduce: LexTerm reduce(17), // (, reduce: LexTerm nil, // ) reduce(17), // [, reduce: LexTerm @@ -3515,7 +3398,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -3535,7 +3418,6 @@ var actionTab = actionTable{ nil, // . shift(138), // char_lit nil, // - - nil, // ~ nil, // ( nil, // ) nil, // [ @@ -3545,7 +3427,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -3565,7 +3447,6 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - - nil, // ~ nil, // ( shift(139), // ) nil, // [ @@ -3575,7 +3456,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -3595,7 +3476,6 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - - nil, // ~ nil, // ( nil, // ) nil, // [ @@ -3605,7 +3485,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -3625,7 +3505,6 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - - nil, // ~ nil, // ( nil, // ) nil, // [ @@ -3635,7 +3514,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -3655,7 +3534,6 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - - nil, // ~ nil, // ( nil, // ) nil, // [ @@ -3665,7 +3543,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -3685,7 +3563,6 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - - nil, // ~ nil, // ( nil, // ) nil, // [ @@ -3695,7 +3572,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -3715,7 +3592,6 @@ var actionTab = actionTable{ nil, // . shift(142), // char_lit nil, // - - nil, // ~ nil, // ( nil, // ) nil, // [ @@ -3725,7 +3601,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -3739,13 +3615,12 @@ var actionTab = actionTable{ nil, // tokId nil, // : nil, // ; - shift(54), // regDefId + shift(56), // regDefId nil, // ignoredTokId reduce(11), // |, reduce: LexPattern shift(57), // . shift(58), // char_lit - nil, // - - shift(59), // ~ + shift(59), // - shift(60), // ( reduce(11), // ), reduce: LexPattern shift(61), // [ @@ -3755,7 +3630,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -3774,8 +3649,7 @@ var actionTab = actionTable{ reduce(16), // |, reduce: LexTerm reduce(16), // ., reduce: LexTerm reduce(16), // char_lit, reduce: LexTerm - nil, // - - reduce(16), // ~, reduce: LexTerm + reduce(16), // -, reduce: LexTerm reduce(16), // (, reduce: LexTerm reduce(16), // ), reduce: LexTerm reduce(16), // [, reduce: LexTerm @@ -3785,7 +3659,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -3805,7 +3679,6 @@ var actionTab = actionTable{ nil, // . nil, // char_lit shift(143), // - - nil, // ~ nil, // ( nil, // ) nil, // [ @@ -3815,7 +3688,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -3834,8 +3707,7 @@ var actionTab = actionTable{ reduce(22), // |, reduce: LexTerm reduce(22), // ., reduce: LexTerm reduce(22), // char_lit, reduce: LexTerm - nil, // - - reduce(22), // ~, reduce: LexTerm + reduce(22), // -, reduce: LexTerm reduce(22), // (, reduce: LexTerm reduce(22), // ), reduce: LexTerm reduce(22), // [, reduce: LexTerm @@ -3845,7 +3717,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -3864,8 +3736,7 @@ var actionTab = actionTable{ reduce(20), // |, reduce: LexTerm reduce(20), // ., reduce: LexTerm reduce(20), // char_lit, reduce: LexTerm - nil, // - - reduce(20), // ~, reduce: LexTerm + reduce(20), // -, reduce: LexTerm reduce(20), // (, reduce: LexTerm reduce(20), // ), reduce: LexTerm reduce(20), // [, reduce: LexTerm @@ -3875,7 +3746,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -3894,8 +3765,7 @@ var actionTab = actionTable{ reduce(21), // |, reduce: LexTerm reduce(21), // ., reduce: LexTerm reduce(21), // char_lit, reduce: LexTerm - nil, // - - reduce(21), // ~, reduce: LexTerm + reduce(21), // -, reduce: LexTerm reduce(21), // (, reduce: LexTerm reduce(21), // ), reduce: LexTerm reduce(21), // [, reduce: LexTerm @@ -3905,7 +3775,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -3919,13 +3789,12 @@ var actionTab = actionTable{ nil, // tokId nil, // : nil, // ; - shift(64), // regDefId + shift(66), // regDefId nil, // ignoredTokId reduce(11), // |, reduce: LexPattern shift(67), // . shift(68), // char_lit - nil, // - - shift(69), // ~ + shift(69), // - shift(70), // ( nil, // ) shift(71), // [ @@ -3935,7 +3804,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -3954,8 +3823,7 @@ var actionTab = actionTable{ reduce(16), // |, reduce: LexTerm reduce(16), // ., reduce: LexTerm reduce(16), // char_lit, reduce: LexTerm - nil, // - - reduce(16), // ~, reduce: LexTerm + reduce(16), // -, reduce: LexTerm reduce(16), // (, reduce: LexTerm nil, // ) reduce(16), // [, reduce: LexTerm @@ -3965,7 +3833,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -3985,7 +3853,6 @@ var actionTab = actionTable{ nil, // . nil, // char_lit shift(144), // - - nil, // ~ nil, // ( nil, // ) nil, // [ @@ -3995,7 +3862,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -4014,8 +3881,7 @@ var actionTab = actionTable{ reduce(22), // |, reduce: LexTerm reduce(22), // ., reduce: LexTerm reduce(22), // char_lit, reduce: LexTerm - nil, // - - reduce(22), // ~, reduce: LexTerm + reduce(22), // -, reduce: LexTerm reduce(22), // (, reduce: LexTerm nil, // ) reduce(22), // [, reduce: LexTerm @@ -4025,7 +3891,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -4044,8 +3910,7 @@ var actionTab = actionTable{ reduce(20), // |, reduce: LexTerm reduce(20), // ., reduce: LexTerm reduce(20), // char_lit, reduce: LexTerm - nil, // - - reduce(20), // ~, reduce: LexTerm + reduce(20), // -, reduce: LexTerm reduce(20), // (, reduce: LexTerm nil, // ) reduce(20), // [, reduce: LexTerm @@ -4055,7 +3920,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -4074,8 +3939,7 @@ var actionTab = actionTable{ reduce(21), // |, reduce: LexTerm reduce(21), // ., reduce: LexTerm reduce(21), // char_lit, reduce: LexTerm - nil, // - - reduce(21), // ~, reduce: LexTerm + reduce(21), // -, reduce: LexTerm reduce(21), // (, reduce: LexTerm nil, // ) reduce(21), // [, reduce: LexTerm @@ -4085,7 +3949,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -4099,13 +3963,12 @@ var actionTab = actionTable{ nil, // tokId nil, // : nil, // ; - shift(74), // regDefId + shift(76), // regDefId nil, // ignoredTokId reduce(11), // |, reduce: LexPattern shift(77), // . shift(78), // char_lit - nil, // - - shift(79), // ~ + shift(79), // - shift(80), // ( nil, // ) shift(81), // [ @@ -4115,7 +3978,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -4134,8 +3997,7 @@ var actionTab = actionTable{ reduce(16), // |, reduce: LexTerm reduce(16), // ., reduce: LexTerm reduce(16), // char_lit, reduce: LexTerm - nil, // - - reduce(16), // ~, reduce: LexTerm + reduce(16), // -, reduce: LexTerm reduce(16), // (, reduce: LexTerm nil, // ) reduce(16), // [, reduce: LexTerm @@ -4145,7 +4007,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -4165,7 +4027,6 @@ var actionTab = actionTable{ nil, // . nil, // char_lit shift(145), // - - nil, // ~ nil, // ( nil, // ) nil, // [ @@ -4175,7 +4036,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -4194,8 +4055,7 @@ var actionTab = actionTable{ reduce(22), // |, reduce: LexTerm reduce(22), // ., reduce: LexTerm reduce(22), // char_lit, reduce: LexTerm - nil, // - - reduce(22), // ~, reduce: LexTerm + reduce(22), // -, reduce: LexTerm reduce(22), // (, reduce: LexTerm nil, // ) reduce(22), // [, reduce: LexTerm @@ -4205,7 +4065,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -4224,8 +4084,7 @@ var actionTab = actionTable{ reduce(20), // |, reduce: LexTerm reduce(20), // ., reduce: LexTerm reduce(20), // char_lit, reduce: LexTerm - nil, // - - reduce(20), // ~, reduce: LexTerm + reduce(20), // -, reduce: LexTerm reduce(20), // (, reduce: LexTerm nil, // ) reduce(20), // [, reduce: LexTerm @@ -4235,7 +4094,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -4254,8 +4113,7 @@ var actionTab = actionTable{ reduce(21), // |, reduce: LexTerm reduce(21), // ., reduce: LexTerm reduce(21), // char_lit, reduce: LexTerm - nil, // - - reduce(21), // ~, reduce: LexTerm + reduce(21), // -, reduce: LexTerm reduce(21), // (, reduce: LexTerm nil, // ) reduce(21), // [, reduce: LexTerm @@ -4265,7 +4123,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -4285,7 +4143,6 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - - nil, // ~ nil, // ( shift(146), // ) nil, // [ @@ -4295,7 +4152,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -4315,7 +4172,6 @@ var actionTab = actionTable{ nil, // . shift(147), // char_lit nil, // - - nil, // ~ nil, // ( nil, // ) nil, // [ @@ -4325,7 +4181,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -4345,7 +4201,6 @@ var actionTab = actionTable{ nil, // . shift(148), // char_lit nil, // - - nil, // ~ nil, // ( nil, // ) nil, // [ @@ -4355,7 +4210,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -4375,7 +4230,6 @@ var actionTab = actionTable{ nil, // . shift(149), // char_lit nil, // - - nil, // ~ nil, // ( nil, // ) nil, // [ @@ -4385,7 +4239,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -4404,8 +4258,7 @@ var actionTab = actionTable{ reduce(18), // |, reduce: LexTerm reduce(18), // ., reduce: LexTerm reduce(18), // char_lit, reduce: LexTerm - nil, // - - reduce(18), // ~, reduce: LexTerm + reduce(18), // -, reduce: LexTerm reduce(18), // (, reduce: LexTerm nil, // ) reduce(18), // [, reduce: LexTerm @@ -4415,7 +4268,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -4435,7 +4288,6 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - - nil, // ~ nil, // ( shift(150), // ) nil, // [ @@ -4445,7 +4297,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -4465,7 +4317,6 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - - nil, // ~ nil, // ( shift(151), // ) nil, // [ @@ -4475,7 +4326,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -4495,7 +4346,6 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - - nil, // ~ nil, // ( shift(152), // ) nil, // [ @@ -4505,7 +4355,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -4524,8 +4374,7 @@ var actionTab = actionTable{ reduce(18), // |, reduce: LexTerm reduce(18), // ., reduce: LexTerm reduce(18), // char_lit, reduce: LexTerm - nil, // - - reduce(18), // ~, reduce: LexTerm + reduce(18), // -, reduce: LexTerm reduce(18), // (, reduce: LexTerm reduce(18), // ), reduce: LexTerm reduce(18), // [, reduce: LexTerm @@ -4535,7 +4384,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -4554,8 +4403,7 @@ var actionTab = actionTable{ reduce(18), // |, reduce: LexTerm reduce(18), // ., reduce: LexTerm reduce(18), // char_lit, reduce: LexTerm - nil, // - - reduce(18), // ~, reduce: LexTerm + reduce(18), // -, reduce: LexTerm reduce(18), // (, reduce: LexTerm nil, // ) reduce(18), // [, reduce: LexTerm @@ -4565,7 +4413,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε @@ -4584,8 +4432,7 @@ var actionTab = actionTable{ reduce(18), // |, reduce: LexTerm reduce(18), // ., reduce: LexTerm reduce(18), // char_lit, reduce: LexTerm - nil, // - - reduce(18), // ~, reduce: LexTerm + reduce(18), // -, reduce: LexTerm reduce(18), // (, reduce: LexTerm nil, // ) reduce(18), // [, reduce: LexTerm @@ -4595,7 +4442,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // errore + nil, // error nil, // λ nil, // empty nil, // ε diff --git a/internal/fe2/parser/gototable.go b/internal/fe2/internal/parser/gototable.go similarity index 98% rename from internal/fe2/parser/gototable.go rename to internal/fe2/internal/parser/gototable.go index 3d6c3d15..6a1f09c2 100644 --- a/internal/fe2/parser/gototable.go +++ b/internal/fe2/internal/parser/gototable.go @@ -14,15 +14,15 @@ var gotoTab = gotoTable{ -1, // S' 1, // Grammar 2, // LexicalPart - 4, // LexProductions - 5, // LexProduction + 3, // LexProductions + 4, // LexProduction -1, // LexPattern -1, // LexAlt -1, // LexTerm - 3, // SyntaxPart - 9, // FileHeader - 10, // SyntaxProdList - 12, // SyntaxProduction + 5, // SyntaxPart + 6, // FileHeader + 7, // SyntaxProdList + 8, // SyntaxProduction -1, // Alternatives -1, // SyntaxBody -1, // Symbols @@ -60,9 +60,9 @@ var gotoTab = gotoTable{ -1, // LexAlt -1, // LexTerm 14, // SyntaxPart - 9, // FileHeader - 10, // SyntaxProdList - 12, // SyntaxProduction + 6, // FileHeader + 7, // SyntaxProdList + 8, // SyntaxProduction -1, // Alternatives -1, // SyntaxBody -1, // Symbols @@ -75,7 +75,7 @@ var gotoTab = gotoTable{ -1, // Grammar -1, // LexicalPart -1, // LexProductions - -1, // LexProduction + 15, // LexProduction -1, // LexPattern -1, // LexAlt -1, // LexTerm @@ -95,7 +95,7 @@ var gotoTab = gotoTable{ -1, // Grammar -1, // LexicalPart -1, // LexProductions - 15, // LexProduction + -1, // LexProduction -1, // LexPattern -1, // LexAlt -1, // LexTerm @@ -141,8 +141,8 @@ var gotoTab = gotoTable{ -1, // LexTerm -1, // SyntaxPart -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction + 16, // SyntaxProdList + 8, // SyntaxProduction -1, // Alternatives -1, // SyntaxBody -1, // Symbols @@ -162,7 +162,7 @@ var gotoTab = gotoTable{ -1, // SyntaxPart -1, // FileHeader -1, // SyntaxProdList - -1, // SyntaxProduction + 17, // SyntaxProduction -1, // Alternatives -1, // SyntaxBody -1, // Symbols @@ -201,8 +201,8 @@ var gotoTab = gotoTable{ -1, // LexTerm -1, // SyntaxPart -1, // FileHeader - 19, // SyntaxProdList - 12, // SyntaxProduction + -1, // SyntaxProdList + -1, // SyntaxProduction -1, // Alternatives -1, // SyntaxBody -1, // Symbols @@ -222,7 +222,7 @@ var gotoTab = gotoTable{ -1, // SyntaxPart -1, // FileHeader -1, // SyntaxProdList - 20, // SyntaxProduction + -1, // SyntaxProduction -1, // Alternatives -1, // SyntaxBody -1, // Symbols @@ -336,13 +336,13 @@ var gotoTab = gotoTable{ -1, // LexicalPart -1, // LexProductions -1, // LexProduction - 22, // LexPattern - 24, // LexAlt - 25, // LexTerm + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm -1, // SyntaxPart -1, // FileHeader -1, // SyntaxProdList - -1, // SyntaxProduction + 17, // SyntaxProduction -1, // Alternatives -1, // SyntaxBody -1, // Symbols @@ -356,9 +356,9 @@ var gotoTab = gotoTable{ -1, // LexicalPart -1, // LexProductions -1, // LexProduction - 32, // LexPattern - 24, // LexAlt - 25, // LexTerm + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm -1, // SyntaxPart -1, // FileHeader -1, // SyntaxProdList @@ -376,9 +376,9 @@ var gotoTab = gotoTable{ -1, // LexicalPart -1, // LexProductions -1, // LexProduction - 33, // LexPattern - 24, // LexAlt - 25, // LexTerm + 22, // LexPattern + 23, // LexAlt + 24, // LexTerm -1, // SyntaxPart -1, // FileHeader -1, // SyntaxProdList @@ -396,13 +396,13 @@ var gotoTab = gotoTable{ -1, // LexicalPart -1, // LexProductions -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm + 32, // LexPattern + 23, // LexAlt + 24, // LexTerm -1, // SyntaxPart -1, // FileHeader -1, // SyntaxProdList - 20, // SyntaxProduction + -1, // SyntaxProduction -1, // Alternatives -1, // SyntaxBody -1, // Symbols @@ -416,9 +416,9 @@ var gotoTab = gotoTable{ -1, // LexicalPart -1, // LexProductions -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm + 33, // LexPattern + 23, // LexAlt + 24, // LexTerm -1, // SyntaxPart -1, // FileHeader -1, // SyntaxProdList @@ -443,12 +443,12 @@ var gotoTab = gotoTable{ -1, // FileHeader -1, // SyntaxProdList -1, // SyntaxProduction - 36, // Alternatives - 37, // SyntaxBody - 38, // Symbols - 41, // Symbol - 39, // ErrorSymbol - 40, // EpsilonSymbol + 34, // Alternatives + 35, // SyntaxBody + 36, // Symbols + 37, // Symbol + 38, // ErrorSymbol + 39, // EpsilonSymbol }, gotoRow{ // S22 -1, // S' @@ -478,7 +478,7 @@ var gotoTab = gotoTable{ -1, // LexProduction -1, // LexPattern -1, // LexAlt - -1, // LexTerm + 49, // LexTerm -1, // SyntaxPart -1, // FileHeader -1, // SyntaxProdList @@ -498,7 +498,7 @@ var gotoTab = gotoTable{ -1, // LexProduction -1, // LexPattern -1, // LexAlt - 49, // LexTerm + -1, // LexTerm -1, // SyntaxPart -1, // FileHeader -1, // SyntaxProdList @@ -597,8 +597,8 @@ var gotoTab = gotoTable{ -1, // LexProductions -1, // LexProduction 53, // LexPattern - 55, // LexAlt - 56, // LexTerm + 54, // LexAlt + 55, // LexTerm -1, // SyntaxPart -1, // FileHeader -1, // SyntaxProdList @@ -617,8 +617,8 @@ var gotoTab = gotoTable{ -1, // LexProductions -1, // LexProduction 63, // LexPattern - 65, // LexAlt - 66, // LexTerm + 64, // LexAlt + 65, // LexTerm -1, // SyntaxPart -1, // FileHeader -1, // SyntaxProdList @@ -637,8 +637,8 @@ var gotoTab = gotoTable{ -1, // LexProductions -1, // LexProduction 73, // LexPattern - 75, // LexAlt - 76, // LexTerm + 74, // LexAlt + 75, // LexTerm -1, // SyntaxPart -1, // FileHeader -1, // SyntaxProdList @@ -746,7 +746,7 @@ var gotoTab = gotoTable{ -1, // Alternatives -1, // SyntaxBody -1, // Symbols - -1, // Symbol + 87, // Symbol -1, // ErrorSymbol -1, // EpsilonSymbol }, @@ -785,8 +785,8 @@ var gotoTab = gotoTable{ -1, // SyntaxProduction -1, // Alternatives -1, // SyntaxBody - -1, // Symbols - 88, // Symbol + 89, // Symbols + 37, // Symbol -1, // ErrorSymbol -1, // EpsilonSymbol }, @@ -805,8 +805,8 @@ var gotoTab = gotoTable{ -1, // SyntaxProduction -1, // Alternatives -1, // SyntaxBody - 90, // Symbols - 41, // Symbol + -1, // Symbols + -1, // Symbol -1, // ErrorSymbol -1, // EpsilonSymbol }, @@ -978,7 +978,7 @@ var gotoTab = gotoTable{ -1, // LexProduction -1, // LexPattern 91, // LexAlt - 25, // LexTerm + 24, // LexTerm -1, // SyntaxPart -1, // FileHeader -1, // SyntaxProdList @@ -1098,7 +1098,7 @@ var gotoTab = gotoTable{ -1, // LexProduction -1, // LexPattern -1, // LexAlt - -1, // LexTerm + 96, // LexTerm -1, // SyntaxPart -1, // FileHeader -1, // SyntaxProdList @@ -1118,7 +1118,7 @@ var gotoTab = gotoTable{ -1, // LexProduction -1, // LexPattern -1, // LexAlt - 96, // LexTerm + -1, // LexTerm -1, // SyntaxPart -1, // FileHeader -1, // SyntaxProdList @@ -1217,8 +1217,8 @@ var gotoTab = gotoTable{ -1, // LexProductions -1, // LexProduction 100, // LexPattern - 55, // LexAlt - 56, // LexTerm + 54, // LexAlt + 55, // LexTerm -1, // SyntaxPart -1, // FileHeader -1, // SyntaxProdList @@ -1237,8 +1237,8 @@ var gotoTab = gotoTable{ -1, // LexProductions -1, // LexProduction 101, // LexPattern - 65, // LexAlt - 66, // LexTerm + 64, // LexAlt + 65, // LexTerm -1, // SyntaxPart -1, // FileHeader -1, // SyntaxProdList @@ -1257,8 +1257,8 @@ var gotoTab = gotoTable{ -1, // LexProductions -1, // LexProduction 102, // LexPattern - 75, // LexAlt - 76, // LexTerm + 74, // LexAlt + 75, // LexTerm -1, // SyntaxPart -1, // FileHeader -1, // SyntaxProdList @@ -1291,26 +1291,6 @@ var gotoTab = gotoTable{ -1, // EpsilonSymbol }, gotoRow{ // S64 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol - }, - gotoRow{ // S65 -1, // S' -1, // Grammar -1, // LexicalPart @@ -1330,6 +1310,26 @@ var gotoTab = gotoTable{ -1, // ErrorSymbol -1, // EpsilonSymbol }, + gotoRow{ // S65 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol + }, gotoRow{ // S66 -1, // S' -1, // Grammar @@ -1417,8 +1417,8 @@ var gotoTab = gotoTable{ -1, // LexProductions -1, // LexProduction 109, // LexPattern - 55, // LexAlt - 56, // LexTerm + 54, // LexAlt + 55, // LexTerm -1, // SyntaxPart -1, // FileHeader -1, // SyntaxProdList @@ -1437,8 +1437,8 @@ var gotoTab = gotoTable{ -1, // LexProductions -1, // LexProduction 110, // LexPattern - 65, // LexAlt - 66, // LexTerm + 64, // LexAlt + 65, // LexTerm -1, // SyntaxPart -1, // FileHeader -1, // SyntaxProdList @@ -1457,8 +1457,8 @@ var gotoTab = gotoTable{ -1, // LexProductions -1, // LexProduction 111, // LexPattern - 75, // LexAlt - 76, // LexTerm + 74, // LexAlt + 75, // LexTerm -1, // SyntaxPart -1, // FileHeader -1, // SyntaxProdList @@ -1491,26 +1491,6 @@ var gotoTab = gotoTable{ -1, // EpsilonSymbol }, gotoRow{ // S74 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol - }, - gotoRow{ // S75 -1, // S' -1, // Grammar -1, // LexicalPart @@ -1530,6 +1510,26 @@ var gotoTab = gotoTable{ -1, // ErrorSymbol -1, // EpsilonSymbol }, + gotoRow{ // S75 + -1, // S' + -1, // Grammar + -1, // LexicalPart + -1, // LexProductions + -1, // LexProduction + -1, // LexPattern + -1, // LexAlt + -1, // LexTerm + -1, // SyntaxPart + -1, // FileHeader + -1, // SyntaxProdList + -1, // SyntaxProduction + -1, // Alternatives + -1, // SyntaxBody + -1, // Symbols + -1, // Symbol + -1, // ErrorSymbol + -1, // EpsilonSymbol + }, gotoRow{ // S76 -1, // S' -1, // Grammar @@ -1617,8 +1617,8 @@ var gotoTab = gotoTable{ -1, // LexProductions -1, // LexProduction 118, // LexPattern - 55, // LexAlt - 56, // LexTerm + 54, // LexAlt + 55, // LexTerm -1, // SyntaxPart -1, // FileHeader -1, // SyntaxProdList @@ -1637,8 +1637,8 @@ var gotoTab = gotoTable{ -1, // LexProductions -1, // LexProduction 119, // LexPattern - 65, // LexAlt - 66, // LexTerm + 64, // LexAlt + 65, // LexTerm -1, // SyntaxPart -1, // FileHeader -1, // SyntaxProdList @@ -1657,8 +1657,8 @@ var gotoTab = gotoTable{ -1, // LexProductions -1, // LexProduction 120, // LexPattern - 75, // LexAlt - 76, // LexTerm + 74, // LexAlt + 75, // LexTerm -1, // SyntaxPart -1, // FileHeader -1, // SyntaxProdList @@ -1745,10 +1745,10 @@ var gotoTab = gotoTable{ -1, // SyntaxProduction -1, // Alternatives 121, // SyntaxBody - 38, // Symbols - 41, // Symbol - 39, // ErrorSymbol - 40, // EpsilonSymbol + 36, // Symbols + 37, // Symbol + 38, // ErrorSymbol + 39, // EpsilonSymbol }, gotoRow{ // S87 -1, // S' @@ -1806,7 +1806,7 @@ var gotoTab = gotoTable{ -1, // Alternatives -1, // SyntaxBody -1, // Symbols - -1, // Symbol + 87, // Symbol -1, // ErrorSymbol -1, // EpsilonSymbol }, @@ -1826,7 +1826,7 @@ var gotoTab = gotoTable{ -1, // Alternatives -1, // SyntaxBody -1, // Symbols - 88, // Symbol + -1, // Symbol -1, // ErrorSymbol -1, // EpsilonSymbol }, @@ -1898,7 +1898,7 @@ var gotoTab = gotoTable{ -1, // LexProduction -1, // LexPattern 124, // LexAlt - 56, // LexTerm + 55, // LexTerm -1, // SyntaxPart -1, // FileHeader -1, // SyntaxProdList @@ -2078,7 +2078,7 @@ var gotoTab = gotoTable{ -1, // LexProduction -1, // LexPattern 130, // LexAlt - 66, // LexTerm + 65, // LexTerm -1, // SyntaxPart -1, // FileHeader -1, // SyntaxProdList @@ -2258,7 +2258,7 @@ var gotoTab = gotoTable{ -1, // LexProduction -1, // LexPattern 136, // LexAlt - 76, // LexTerm + 75, // LexTerm -1, // SyntaxPart -1, // FileHeader -1, // SyntaxProdList diff --git a/internal/fe2/parser/parser.go b/internal/fe2/internal/parser/parser.go similarity index 96% rename from internal/fe2/parser/parser.go rename to internal/fe2/internal/parser/parser.go index afd22cc7..f6410a04 100644 --- a/internal/fe2/parser/parser.go +++ b/internal/fe2/internal/parser/parser.go @@ -6,14 +6,14 @@ import ( "fmt" "strings" - parseError "github.com/maxcalandrelli/gocc/internal/fe2/errors" - "github.com/maxcalandrelli/gocc/internal/fe2/token" + parseError "github.com/maxcalandrelli/gocc/internal/fe2/internal/errors" + "github.com/maxcalandrelli/gocc/internal/fe2/internal/token" ) const ( numProductions = 47 numStates = 153 - numSymbols = 43 + numSymbols = 42 ) // Stack diff --git a/internal/fe2/parser/productionstable.go b/internal/fe2/internal/parser/productionstable.go similarity index 98% rename from internal/fe2/parser/productionstable.go rename to internal/fe2/internal/parser/productionstable.go index 7323365e..3cfaaf3a 100644 --- a/internal/fe2/parser/productionstable.go +++ b/internal/fe2/internal/parser/productionstable.go @@ -193,7 +193,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `LexTerm : "~" char_lit << ast.NewLexCharLitExt(X[0], true) >>`, + String: `LexTerm : "-" char_lit << ast.NewLexCharLitExt(X[0], true) >>`, Id: "LexTerm", NTType: 7, Index: 17, @@ -203,7 +203,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `LexTerm : "~" "(" char_lit "-" char_lit ")" << ast.NewLexCharRangeExt(X[2], X[4], true) >>`, + String: `LexTerm : "-" "(" char_lit "-" char_lit ")" << ast.NewLexCharRangeExt(X[2], X[4], true) >>`, Id: "LexTerm", NTType: 7, Index: 18, @@ -453,7 +453,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `ErrorSymbol : "errore" << >>`, + String: `ErrorSymbol : "error" << >>`, Id: "ErrorSymbol", NTType: 16, Index: 43, diff --git a/internal/fe2/token/token.go b/internal/fe2/internal/token/token.go similarity index 82% rename from internal/fe2/token/token.go rename to internal/fe2/internal/token/token.go index 3a6e3b95..5b72164b 100644 --- a/internal/fe2/token/token.go +++ b/internal/fe2/internal/token/token.go @@ -78,7 +78,6 @@ var TokMap = TokenMap{ ".", "char_lit", "-", - "~", "(", ")", "[", @@ -88,7 +87,7 @@ var TokMap = TokenMap{ "g_sdt_lit", "prodId", "string_lit", - "errore", + "error", "λ", "empty", "ε", @@ -106,19 +105,18 @@ var TokMap = TokenMap{ ".": 8, "char_lit": 9, "-": 10, - "~": 11, - "(": 12, - ")": 13, - "[": 14, - "]": 15, - "{": 16, - "}": 17, - "g_sdt_lit": 18, - "prodId": 19, - "string_lit": 20, - "errore": 21, - "λ": 22, - "empty": 23, - "ε": 24, + "(": 11, + ")": 12, + "[": 13, + "]": 14, + "{": 15, + "}": 16, + "g_sdt_lit": 17, + "prodId": 18, + "string_lit": 19, + "error": 20, + "λ": 21, + "empty": 22, + "ε": 23, }, } diff --git a/internal/fe2/util/litconv.go b/internal/fe2/internal/util/litconv.go similarity index 100% rename from internal/fe2/util/litconv.go rename to internal/fe2/internal/util/litconv.go diff --git a/internal/fe2/util/rune.go b/internal/fe2/internal/util/rune.go similarity index 100% rename from internal/fe2/util/rune.go rename to internal/fe2/internal/util/rune.go diff --git a/internal/fe2/log/LR1_conflicts.txt b/internal/fe2/log/LR1_conflicts.txt new file mode 100644 index 00000000..ed2fa3ed --- /dev/null +++ b/internal/fe2/log/LR1_conflicts.txt @@ -0,0 +1,17 @@ +4 LR-1 conflicts: + S27 + symbol: - + Shift(50) + Reduce(15:LexTerm : char_lit << ast.NewLexCharLitExt(X[0],false) >>) + S58 + symbol: - + Shift(97) + Reduce(15:LexTerm : char_lit << ast.NewLexCharLitExt(X[0],false) >>) + S68 + symbol: - + Reduce(15:LexTerm : char_lit << ast.NewLexCharLitExt(X[0],false) >>) + Shift(106) + S78 + symbol: - + Reduce(15:LexTerm : char_lit << ast.NewLexCharLitExt(X[0],false) >>) + Shift(115) diff --git a/internal/fe2/LR1_sets.txt b/internal/fe2/log/LR1_sets.txt similarity index 71% rename from internal/fe2/LR1_sets.txt rename to internal/fe2/log/LR1_sets.txt index 61c25ed4..e5085957 100644 --- a/internal/fe2/LR1_sets.txt +++ b/internal/fe2/log/LR1_sets.txt @@ -49,16 +49,16 @@ S0{ Transitions: Grammar -> 1 LexicalPart -> 2 - SyntaxPart -> 3 - LexProductions -> 4 - LexProduction -> 5 - tokId -> 6 - regDefId -> 7 - ignoredTokId -> 8 - FileHeader -> 9 - SyntaxProdList -> 10 - g_sdt_lit -> 11 - SyntaxProduction -> 12 + LexProductions -> 3 + LexProduction -> 4 + SyntaxPart -> 5 + FileHeader -> 6 + SyntaxProdList -> 7 + SyntaxProduction -> 8 + tokId -> 9 + regDefId -> 10 + ignoredTokId -> 11 + g_sdt_lit -> 12 prodId -> 13 @@ -82,21 +82,15 @@ S2{ SyntaxProduction : •prodId : Alternatives ; «prodId» } Transitions: - FileHeader -> 9 - SyntaxProdList -> 10 - g_sdt_lit -> 11 - SyntaxProduction -> 12 + FileHeader -> 6 + SyntaxProdList -> 7 + SyntaxProduction -> 8 + g_sdt_lit -> 12 prodId -> 13 SyntaxPart -> 14 S3{ - Grammar : SyntaxPart• «Ω» -} -Transitions: - - -S4{ LexicalPart : LexProductions• «g_sdt_lit» LexicalPart : LexProductions• «prodId» LexicalPart : LexProductions• «Ω» @@ -126,13 +120,13 @@ S4{ LexProduction : •ignoredTokId : LexPattern ; «tokId» } Transitions: - tokId -> 6 - regDefId -> 7 - ignoredTokId -> 8 + tokId -> 9 + regDefId -> 10 + ignoredTokId -> 11 LexProduction -> 15 -S5{ +S4{ LexProductions : LexProduction• «g_sdt_lit» LexProductions : LexProduction• «prodId» LexProductions : LexProduction• «Ω» @@ -143,43 +137,13 @@ S5{ Transitions: -S6{ - LexProduction : tokId •: LexPattern ; «g_sdt_lit» - LexProduction : tokId •: LexPattern ; «prodId» - LexProduction : tokId •: LexPattern ; «Ω» - LexProduction : tokId •: LexPattern ; «ignoredTokId» - LexProduction : tokId •: LexPattern ; «regDefId» - LexProduction : tokId •: LexPattern ; «tokId» -} -Transitions: - : -> 16 - - -S7{ - LexProduction : regDefId •: LexPattern ; «g_sdt_lit» - LexProduction : regDefId •: LexPattern ; «prodId» - LexProduction : regDefId •: LexPattern ; «Ω» - LexProduction : regDefId •: LexPattern ; «ignoredTokId» - LexProduction : regDefId •: LexPattern ; «regDefId» - LexProduction : regDefId •: LexPattern ; «tokId» -} -Transitions: - : -> 17 - - -S8{ - LexProduction : ignoredTokId •: LexPattern ; «g_sdt_lit» - LexProduction : ignoredTokId •: LexPattern ; «prodId» - LexProduction : ignoredTokId •: LexPattern ; «Ω» - LexProduction : ignoredTokId •: LexPattern ; «ignoredTokId» - LexProduction : ignoredTokId •: LexPattern ; «regDefId» - LexProduction : ignoredTokId •: LexPattern ; «tokId» +S5{ + Grammar : SyntaxPart• «Ω» } Transitions: - : -> 18 -S9{ +S6{ SyntaxPart : FileHeader •SyntaxProdList «Ω» SyntaxProdList : •SyntaxProduction «Ω» SyntaxProdList : •SyntaxProdList SyntaxProduction «Ω» @@ -189,12 +153,12 @@ S9{ SyntaxProduction : •prodId : Alternatives ; «prodId» } Transitions: - SyntaxProduction -> 12 + SyntaxProduction -> 8 prodId -> 13 - SyntaxProdList -> 19 + SyntaxProdList -> 16 -S10{ +S7{ SyntaxPart : SyntaxProdList• «Ω» SyntaxProdList : SyntaxProdList •SyntaxProduction «Ω» SyntaxProdList : SyntaxProdList •SyntaxProduction «prodId» @@ -203,18 +167,54 @@ S10{ } Transitions: prodId -> 13 - SyntaxProduction -> 20 + SyntaxProduction -> 17 + + +S8{ + SyntaxProdList : SyntaxProduction• «Ω» + SyntaxProdList : SyntaxProduction• «prodId» +} +Transitions: + + +S9{ + LexProduction : tokId •: LexPattern ; «g_sdt_lit» + LexProduction : tokId •: LexPattern ; «prodId» + LexProduction : tokId •: LexPattern ; «Ω» + LexProduction : tokId •: LexPattern ; «ignoredTokId» + LexProduction : tokId •: LexPattern ; «regDefId» + LexProduction : tokId •: LexPattern ; «tokId» +} +Transitions: + : -> 18 + + +S10{ + LexProduction : regDefId •: LexPattern ; «g_sdt_lit» + LexProduction : regDefId •: LexPattern ; «prodId» + LexProduction : regDefId •: LexPattern ; «Ω» + LexProduction : regDefId •: LexPattern ; «ignoredTokId» + LexProduction : regDefId •: LexPattern ; «regDefId» + LexProduction : regDefId •: LexPattern ; «tokId» +} +Transitions: + : -> 19 S11{ - FileHeader : g_sdt_lit• «prodId» + LexProduction : ignoredTokId •: LexPattern ; «g_sdt_lit» + LexProduction : ignoredTokId •: LexPattern ; «prodId» + LexProduction : ignoredTokId •: LexPattern ; «Ω» + LexProduction : ignoredTokId •: LexPattern ; «ignoredTokId» + LexProduction : ignoredTokId •: LexPattern ; «regDefId» + LexProduction : ignoredTokId •: LexPattern ; «tokId» } Transitions: + : -> 20 S12{ - SyntaxProdList : SyntaxProduction• «Ω» - SyntaxProdList : SyntaxProduction• «prodId» + FileHeader : g_sdt_lit• «prodId» } Transitions: @@ -245,6 +245,25 @@ Transitions: S16{ + SyntaxPart : FileHeader SyntaxProdList• «Ω» + SyntaxProdList : SyntaxProdList •SyntaxProduction «Ω» + SyntaxProdList : SyntaxProdList •SyntaxProduction «prodId» + SyntaxProduction : •prodId : Alternatives ; «Ω» + SyntaxProduction : •prodId : Alternatives ; «prodId» +} +Transitions: + prodId -> 13 + SyntaxProduction -> 17 + + +S17{ + SyntaxProdList : SyntaxProdList SyntaxProduction• «Ω» + SyntaxProdList : SyntaxProdList SyntaxProduction• «prodId» +} +Transitions: + + +S18{ LexProduction : tokId : •LexPattern ; «g_sdt_lit» LexProduction : tokId : •LexPattern ; «prodId» LexProduction : tokId : •LexPattern ; «Ω» @@ -260,42 +279,51 @@ S16{ LexTerm : •. «;» LexTerm : •char_lit «;» LexTerm : •char_lit - char_lit «;» - LexTerm : •~ char_lit «;» - LexTerm : •~ ( char_lit - char_lit ) «;» + LexTerm : •- char_lit «;» + LexTerm : •- ( char_lit - char_lit ) «;» LexTerm : •regDefId «;» LexTerm : •[ LexPattern ] «;» LexTerm : •{ LexPattern } «;» LexTerm : •( LexPattern ) «;» LexAlt : •LexTerm «(» + LexAlt : •LexTerm «-» LexAlt : •LexTerm «.» LexAlt : •LexTerm «[» LexAlt : •LexTerm «char_lit» LexAlt : •LexTerm «regDefId» LexAlt : •LexTerm «{» - LexAlt : •LexTerm «~» LexAlt : •LexAlt LexTerm «(» + LexAlt : •LexAlt LexTerm «-» LexAlt : •LexAlt LexTerm «.» LexAlt : •LexAlt LexTerm «[» LexAlt : •LexAlt LexTerm «char_lit» LexAlt : •LexAlt LexTerm «regDefId» LexAlt : •LexAlt LexTerm «{» - LexAlt : •LexAlt LexTerm «~» LexAlt : •LexTerm «|» LexAlt : •LexAlt LexTerm «|» LexTerm : •. «(» LexTerm : •char_lit «(» LexTerm : •char_lit - char_lit «(» - LexTerm : •~ char_lit «(» - LexTerm : •~ ( char_lit - char_lit ) «(» + LexTerm : •- char_lit «(» + LexTerm : •- ( char_lit - char_lit ) «(» LexTerm : •regDefId «(» LexTerm : •[ LexPattern ] «(» LexTerm : •{ LexPattern } «(» LexTerm : •( LexPattern ) «(» + LexTerm : •. «-» + LexTerm : •char_lit «-» + LexTerm : •char_lit - char_lit «-» + LexTerm : •- char_lit «-» + LexTerm : •- ( char_lit - char_lit ) «-» + LexTerm : •regDefId «-» + LexTerm : •[ LexPattern ] «-» + LexTerm : •{ LexPattern } «-» + LexTerm : •( LexPattern ) «-» LexTerm : •. «.» LexTerm : •char_lit «.» LexTerm : •char_lit - char_lit «.» - LexTerm : •~ char_lit «.» - LexTerm : •~ ( char_lit - char_lit ) «.» + LexTerm : •- char_lit «.» + LexTerm : •- ( char_lit - char_lit ) «.» LexTerm : •regDefId «.» LexTerm : •[ LexPattern ] «.» LexTerm : •{ LexPattern } «.» @@ -303,8 +331,8 @@ S16{ LexTerm : •. «[» LexTerm : •char_lit «[» LexTerm : •char_lit - char_lit «[» - LexTerm : •~ char_lit «[» - LexTerm : •~ ( char_lit - char_lit ) «[» + LexTerm : •- char_lit «[» + LexTerm : •- ( char_lit - char_lit ) «[» LexTerm : •regDefId «[» LexTerm : •[ LexPattern ] «[» LexTerm : •{ LexPattern } «[» @@ -312,8 +340,8 @@ S16{ LexTerm : •. «char_lit» LexTerm : •char_lit «char_lit» LexTerm : •char_lit - char_lit «char_lit» - LexTerm : •~ char_lit «char_lit» - LexTerm : •~ ( char_lit - char_lit ) «char_lit» + LexTerm : •- char_lit «char_lit» + LexTerm : •- ( char_lit - char_lit ) «char_lit» LexTerm : •regDefId «char_lit» LexTerm : •[ LexPattern ] «char_lit» LexTerm : •{ LexPattern } «char_lit» @@ -321,8 +349,8 @@ S16{ LexTerm : •. «regDefId» LexTerm : •char_lit «regDefId» LexTerm : •char_lit - char_lit «regDefId» - LexTerm : •~ char_lit «regDefId» - LexTerm : •~ ( char_lit - char_lit ) «regDefId» + LexTerm : •- char_lit «regDefId» + LexTerm : •- ( char_lit - char_lit ) «regDefId» LexTerm : •regDefId «regDefId» LexTerm : •[ LexPattern ] «regDefId» LexTerm : •{ LexPattern } «regDefId» @@ -330,26 +358,17 @@ S16{ LexTerm : •. «{» LexTerm : •char_lit «{» LexTerm : •char_lit - char_lit «{» - LexTerm : •~ char_lit «{» - LexTerm : •~ ( char_lit - char_lit ) «{» + LexTerm : •- char_lit «{» + LexTerm : •- ( char_lit - char_lit ) «{» LexTerm : •regDefId «{» LexTerm : •[ LexPattern ] «{» LexTerm : •{ LexPattern } «{» LexTerm : •( LexPattern ) «{» - LexTerm : •. «~» - LexTerm : •char_lit «~» - LexTerm : •char_lit - char_lit «~» - LexTerm : •~ char_lit «~» - LexTerm : •~ ( char_lit - char_lit ) «~» - LexTerm : •regDefId «~» - LexTerm : •[ LexPattern ] «~» - LexTerm : •{ LexPattern } «~» - LexTerm : •( LexPattern ) «~» LexTerm : •. «|» LexTerm : •char_lit «|» LexTerm : •char_lit - char_lit «|» - LexTerm : •~ char_lit «|» - LexTerm : •~ ( char_lit - char_lit ) «|» + LexTerm : •- char_lit «|» + LexTerm : •- ( char_lit - char_lit ) «|» LexTerm : •regDefId «|» LexTerm : •[ LexPattern ] «|» LexTerm : •{ LexPattern } «|» @@ -357,18 +376,18 @@ S16{ } Transitions: LexPattern -> 22 - regDefId -> 23 - LexAlt -> 24 - LexTerm -> 25 + LexAlt -> 23 + LexTerm -> 24 + regDefId -> 25 . -> 26 char_lit -> 27 - ~ -> 28 + - -> 28 ( -> 29 [ -> 30 { -> 31 -S17{ +S19{ LexProduction : regDefId : •LexPattern ; «g_sdt_lit» LexProduction : regDefId : •LexPattern ; «prodId» LexProduction : regDefId : •LexPattern ; «Ω» @@ -384,42 +403,51 @@ S17{ LexTerm : •. «;» LexTerm : •char_lit «;» LexTerm : •char_lit - char_lit «;» - LexTerm : •~ char_lit «;» - LexTerm : •~ ( char_lit - char_lit ) «;» + LexTerm : •- char_lit «;» + LexTerm : •- ( char_lit - char_lit ) «;» LexTerm : •regDefId «;» LexTerm : •[ LexPattern ] «;» LexTerm : •{ LexPattern } «;» LexTerm : •( LexPattern ) «;» LexAlt : •LexTerm «(» + LexAlt : •LexTerm «-» LexAlt : •LexTerm «.» LexAlt : •LexTerm «[» LexAlt : •LexTerm «char_lit» LexAlt : •LexTerm «regDefId» LexAlt : •LexTerm «{» - LexAlt : •LexTerm «~» LexAlt : •LexAlt LexTerm «(» + LexAlt : •LexAlt LexTerm «-» LexAlt : •LexAlt LexTerm «.» LexAlt : •LexAlt LexTerm «[» LexAlt : •LexAlt LexTerm «char_lit» LexAlt : •LexAlt LexTerm «regDefId» LexAlt : •LexAlt LexTerm «{» - LexAlt : •LexAlt LexTerm «~» LexAlt : •LexTerm «|» LexAlt : •LexAlt LexTerm «|» LexTerm : •. «(» LexTerm : •char_lit «(» LexTerm : •char_lit - char_lit «(» - LexTerm : •~ char_lit «(» - LexTerm : •~ ( char_lit - char_lit ) «(» + LexTerm : •- char_lit «(» + LexTerm : •- ( char_lit - char_lit ) «(» LexTerm : •regDefId «(» LexTerm : •[ LexPattern ] «(» LexTerm : •{ LexPattern } «(» LexTerm : •( LexPattern ) «(» + LexTerm : •. «-» + LexTerm : •char_lit «-» + LexTerm : •char_lit - char_lit «-» + LexTerm : •- char_lit «-» + LexTerm : •- ( char_lit - char_lit ) «-» + LexTerm : •regDefId «-» + LexTerm : •[ LexPattern ] «-» + LexTerm : •{ LexPattern } «-» + LexTerm : •( LexPattern ) «-» LexTerm : •. «.» LexTerm : •char_lit «.» LexTerm : •char_lit - char_lit «.» - LexTerm : •~ char_lit «.» - LexTerm : •~ ( char_lit - char_lit ) «.» + LexTerm : •- char_lit «.» + LexTerm : •- ( char_lit - char_lit ) «.» LexTerm : •regDefId «.» LexTerm : •[ LexPattern ] «.» LexTerm : •{ LexPattern } «.» @@ -427,8 +455,8 @@ S17{ LexTerm : •. «[» LexTerm : •char_lit «[» LexTerm : •char_lit - char_lit «[» - LexTerm : •~ char_lit «[» - LexTerm : •~ ( char_lit - char_lit ) «[» + LexTerm : •- char_lit «[» + LexTerm : •- ( char_lit - char_lit ) «[» LexTerm : •regDefId «[» LexTerm : •[ LexPattern ] «[» LexTerm : •{ LexPattern } «[» @@ -436,8 +464,8 @@ S17{ LexTerm : •. «char_lit» LexTerm : •char_lit «char_lit» LexTerm : •char_lit - char_lit «char_lit» - LexTerm : •~ char_lit «char_lit» - LexTerm : •~ ( char_lit - char_lit ) «char_lit» + LexTerm : •- char_lit «char_lit» + LexTerm : •- ( char_lit - char_lit ) «char_lit» LexTerm : •regDefId «char_lit» LexTerm : •[ LexPattern ] «char_lit» LexTerm : •{ LexPattern } «char_lit» @@ -445,8 +473,8 @@ S17{ LexTerm : •. «regDefId» LexTerm : •char_lit «regDefId» LexTerm : •char_lit - char_lit «regDefId» - LexTerm : •~ char_lit «regDefId» - LexTerm : •~ ( char_lit - char_lit ) «regDefId» + LexTerm : •- char_lit «regDefId» + LexTerm : •- ( char_lit - char_lit ) «regDefId» LexTerm : •regDefId «regDefId» LexTerm : •[ LexPattern ] «regDefId» LexTerm : •{ LexPattern } «regDefId» @@ -454,45 +482,36 @@ S17{ LexTerm : •. «{» LexTerm : •char_lit «{» LexTerm : •char_lit - char_lit «{» - LexTerm : •~ char_lit «{» - LexTerm : •~ ( char_lit - char_lit ) «{» + LexTerm : •- char_lit «{» + LexTerm : •- ( char_lit - char_lit ) «{» LexTerm : •regDefId «{» LexTerm : •[ LexPattern ] «{» LexTerm : •{ LexPattern } «{» LexTerm : •( LexPattern ) «{» - LexTerm : •. «~» - LexTerm : •char_lit «~» - LexTerm : •char_lit - char_lit «~» - LexTerm : •~ char_lit «~» - LexTerm : •~ ( char_lit - char_lit ) «~» - LexTerm : •regDefId «~» - LexTerm : •[ LexPattern ] «~» - LexTerm : •{ LexPattern } «~» - LexTerm : •( LexPattern ) «~» LexTerm : •. «|» LexTerm : •char_lit «|» LexTerm : •char_lit - char_lit «|» - LexTerm : •~ char_lit «|» - LexTerm : •~ ( char_lit - char_lit ) «|» + LexTerm : •- char_lit «|» + LexTerm : •- ( char_lit - char_lit ) «|» LexTerm : •regDefId «|» LexTerm : •[ LexPattern ] «|» LexTerm : •{ LexPattern } «|» LexTerm : •( LexPattern ) «|» } Transitions: - regDefId -> 23 - LexAlt -> 24 - LexTerm -> 25 + LexAlt -> 23 + LexTerm -> 24 + regDefId -> 25 . -> 26 char_lit -> 27 - ~ -> 28 + - -> 28 ( -> 29 [ -> 30 { -> 31 LexPattern -> 32 -S18{ +S20{ LexProduction : ignoredTokId : •LexPattern ; «g_sdt_lit» LexProduction : ignoredTokId : •LexPattern ; «prodId» LexProduction : ignoredTokId : •LexPattern ; «Ω» @@ -508,42 +527,51 @@ S18{ LexTerm : •. «;» LexTerm : •char_lit «;» LexTerm : •char_lit - char_lit «;» - LexTerm : •~ char_lit «;» - LexTerm : •~ ( char_lit - char_lit ) «;» + LexTerm : •- char_lit «;» + LexTerm : •- ( char_lit - char_lit ) «;» LexTerm : •regDefId «;» LexTerm : •[ LexPattern ] «;» LexTerm : •{ LexPattern } «;» LexTerm : •( LexPattern ) «;» LexAlt : •LexTerm «(» + LexAlt : •LexTerm «-» LexAlt : •LexTerm «.» LexAlt : •LexTerm «[» LexAlt : •LexTerm «char_lit» LexAlt : •LexTerm «regDefId» LexAlt : •LexTerm «{» - LexAlt : •LexTerm «~» LexAlt : •LexAlt LexTerm «(» + LexAlt : •LexAlt LexTerm «-» LexAlt : •LexAlt LexTerm «.» LexAlt : •LexAlt LexTerm «[» LexAlt : •LexAlt LexTerm «char_lit» LexAlt : •LexAlt LexTerm «regDefId» LexAlt : •LexAlt LexTerm «{» - LexAlt : •LexAlt LexTerm «~» LexAlt : •LexTerm «|» LexAlt : •LexAlt LexTerm «|» LexTerm : •. «(» LexTerm : •char_lit «(» LexTerm : •char_lit - char_lit «(» - LexTerm : •~ char_lit «(» - LexTerm : •~ ( char_lit - char_lit ) «(» + LexTerm : •- char_lit «(» + LexTerm : •- ( char_lit - char_lit ) «(» LexTerm : •regDefId «(» LexTerm : •[ LexPattern ] «(» LexTerm : •{ LexPattern } «(» LexTerm : •( LexPattern ) «(» + LexTerm : •. «-» + LexTerm : •char_lit «-» + LexTerm : •char_lit - char_lit «-» + LexTerm : •- char_lit «-» + LexTerm : •- ( char_lit - char_lit ) «-» + LexTerm : •regDefId «-» + LexTerm : •[ LexPattern ] «-» + LexTerm : •{ LexPattern } «-» + LexTerm : •( LexPattern ) «-» LexTerm : •. «.» LexTerm : •char_lit «.» LexTerm : •char_lit - char_lit «.» - LexTerm : •~ char_lit «.» - LexTerm : •~ ( char_lit - char_lit ) «.» + LexTerm : •- char_lit «.» + LexTerm : •- ( char_lit - char_lit ) «.» LexTerm : •regDefId «.» LexTerm : •[ LexPattern ] «.» LexTerm : •{ LexPattern } «.» @@ -551,8 +579,8 @@ S18{ LexTerm : •. «[» LexTerm : •char_lit «[» LexTerm : •char_lit - char_lit «[» - LexTerm : •~ char_lit «[» - LexTerm : •~ ( char_lit - char_lit ) «[» + LexTerm : •- char_lit «[» + LexTerm : •- ( char_lit - char_lit ) «[» LexTerm : •regDefId «[» LexTerm : •[ LexPattern ] «[» LexTerm : •{ LexPattern } «[» @@ -560,8 +588,8 @@ S18{ LexTerm : •. «char_lit» LexTerm : •char_lit «char_lit» LexTerm : •char_lit - char_lit «char_lit» - LexTerm : •~ char_lit «char_lit» - LexTerm : •~ ( char_lit - char_lit ) «char_lit» + LexTerm : •- char_lit «char_lit» + LexTerm : •- ( char_lit - char_lit ) «char_lit» LexTerm : •regDefId «char_lit» LexTerm : •[ LexPattern ] «char_lit» LexTerm : •{ LexPattern } «char_lit» @@ -569,8 +597,8 @@ S18{ LexTerm : •. «regDefId» LexTerm : •char_lit «regDefId» LexTerm : •char_lit - char_lit «regDefId» - LexTerm : •~ char_lit «regDefId» - LexTerm : •~ ( char_lit - char_lit ) «regDefId» + LexTerm : •- char_lit «regDefId» + LexTerm : •- ( char_lit - char_lit ) «regDefId» LexTerm : •regDefId «regDefId» LexTerm : •[ LexPattern ] «regDefId» LexTerm : •{ LexPattern } «regDefId» @@ -578,63 +606,35 @@ S18{ LexTerm : •. «{» LexTerm : •char_lit «{» LexTerm : •char_lit - char_lit «{» - LexTerm : •~ char_lit «{» - LexTerm : •~ ( char_lit - char_lit ) «{» + LexTerm : •- char_lit «{» + LexTerm : •- ( char_lit - char_lit ) «{» LexTerm : •regDefId «{» LexTerm : •[ LexPattern ] «{» LexTerm : •{ LexPattern } «{» LexTerm : •( LexPattern ) «{» - LexTerm : •. «~» - LexTerm : •char_lit «~» - LexTerm : •char_lit - char_lit «~» - LexTerm : •~ char_lit «~» - LexTerm : •~ ( char_lit - char_lit ) «~» - LexTerm : •regDefId «~» - LexTerm : •[ LexPattern ] «~» - LexTerm : •{ LexPattern } «~» - LexTerm : •( LexPattern ) «~» LexTerm : •. «|» LexTerm : •char_lit «|» LexTerm : •char_lit - char_lit «|» - LexTerm : •~ char_lit «|» - LexTerm : •~ ( char_lit - char_lit ) «|» + LexTerm : •- char_lit «|» + LexTerm : •- ( char_lit - char_lit ) «|» LexTerm : •regDefId «|» LexTerm : •[ LexPattern ] «|» LexTerm : •{ LexPattern } «|» LexTerm : •( LexPattern ) «|» } Transitions: - regDefId -> 23 - LexAlt -> 24 - LexTerm -> 25 + LexAlt -> 23 + LexTerm -> 24 + regDefId -> 25 . -> 26 char_lit -> 27 - ~ -> 28 + - -> 28 ( -> 29 [ -> 30 { -> 31 LexPattern -> 33 -S19{ - SyntaxPart : FileHeader SyntaxProdList• «Ω» - SyntaxProdList : SyntaxProdList •SyntaxProduction «Ω» - SyntaxProdList : SyntaxProdList •SyntaxProduction «prodId» - SyntaxProduction : •prodId : Alternatives ; «Ω» - SyntaxProduction : •prodId : Alternatives ; «prodId» -} -Transitions: - prodId -> 13 - SyntaxProduction -> 20 - - -S20{ - SyntaxProdList : SyntaxProdList SyntaxProduction• «Ω» - SyntaxProdList : SyntaxProdList SyntaxProduction• «prodId» -} -Transitions: - - S21{ SyntaxProduction : prodId : •Alternatives ; «Ω» SyntaxProduction : prodId : •Alternatives ; «prodId» @@ -653,15 +653,15 @@ S21{ Symbols : •Symbols Symbol «;» Symbols : •Symbol «g_sdt_lit» Symbols : •Symbols Symbol «g_sdt_lit» - ErrorSymbol : •errore «;» + ErrorSymbol : •error «;» ErrorSymbol : •λ «;» - ErrorSymbol : •errore «prodId» - ErrorSymbol : •errore «string_lit» - ErrorSymbol : •errore «tokId» + ErrorSymbol : •error «prodId» + ErrorSymbol : •error «string_lit» + ErrorSymbol : •error «tokId» ErrorSymbol : •λ «prodId» ErrorSymbol : •λ «string_lit» ErrorSymbol : •λ «tokId» - ErrorSymbol : •errore «g_sdt_lit» + ErrorSymbol : •error «g_sdt_lit» ErrorSymbol : •λ «g_sdt_lit» EpsilonSymbol : •empty «;» EpsilonSymbol : •ε «;» @@ -686,7 +686,7 @@ S21{ Symbol : •string_lit «g_sdt_lit» Symbols : •Symbol «|» Symbols : •Symbols Symbol «|» - ErrorSymbol : •errore «|» + ErrorSymbol : •error «|» ErrorSymbol : •λ «|» EpsilonSymbol : •empty «|» EpsilonSymbol : •ε «|» @@ -704,16 +704,16 @@ S21{ Symbol : •string_lit «|» } Transitions: - tokId -> 34 - prodId -> 35 - Alternatives -> 36 - SyntaxBody -> 37 - Symbols -> 38 - ErrorSymbol -> 39 - EpsilonSymbol -> 40 - Symbol -> 41 + Alternatives -> 34 + SyntaxBody -> 35 + Symbols -> 36 + Symbol -> 37 + ErrorSymbol -> 38 + EpsilonSymbol -> 39 + tokId -> 40 + prodId -> 41 string_lit -> 42 - errore -> 43 + error -> 43 λ -> 44 empty -> 45 ε -> 46 @@ -735,36 +735,22 @@ Transitions: S23{ - LexTerm : regDefId• «;» - LexTerm : regDefId• «(» - LexTerm : regDefId• «.» - LexTerm : regDefId• «[» - LexTerm : regDefId• «char_lit» - LexTerm : regDefId• «regDefId» - LexTerm : regDefId• «{» - LexTerm : regDefId• «~» - LexTerm : regDefId• «|» -} -Transitions: - - -S24{ LexPattern : LexAlt• «;» LexAlt : LexAlt •LexTerm «;» LexPattern : LexAlt• «|» LexAlt : LexAlt •LexTerm «(» + LexAlt : LexAlt •LexTerm «-» LexAlt : LexAlt •LexTerm «.» LexAlt : LexAlt •LexTerm «[» LexAlt : LexAlt •LexTerm «char_lit» LexAlt : LexAlt •LexTerm «regDefId» LexAlt : LexAlt •LexTerm «{» - LexAlt : LexAlt •LexTerm «~» LexAlt : LexAlt •LexTerm «|» LexTerm : •. «;» LexTerm : •char_lit «;» LexTerm : •char_lit - char_lit «;» - LexTerm : •~ char_lit «;» - LexTerm : •~ ( char_lit - char_lit ) «;» + LexTerm : •- char_lit «;» + LexTerm : •- ( char_lit - char_lit ) «;» LexTerm : •regDefId «;» LexTerm : •[ LexPattern ] «;» LexTerm : •{ LexPattern } «;» @@ -772,17 +758,26 @@ S24{ LexTerm : •. «(» LexTerm : •char_lit «(» LexTerm : •char_lit - char_lit «(» - LexTerm : •~ char_lit «(» - LexTerm : •~ ( char_lit - char_lit ) «(» + LexTerm : •- char_lit «(» + LexTerm : •- ( char_lit - char_lit ) «(» LexTerm : •regDefId «(» LexTerm : •[ LexPattern ] «(» LexTerm : •{ LexPattern } «(» LexTerm : •( LexPattern ) «(» + LexTerm : •. «-» + LexTerm : •char_lit «-» + LexTerm : •char_lit - char_lit «-» + LexTerm : •- char_lit «-» + LexTerm : •- ( char_lit - char_lit ) «-» + LexTerm : •regDefId «-» + LexTerm : •[ LexPattern ] «-» + LexTerm : •{ LexPattern } «-» + LexTerm : •( LexPattern ) «-» LexTerm : •. «.» LexTerm : •char_lit «.» LexTerm : •char_lit - char_lit «.» - LexTerm : •~ char_lit «.» - LexTerm : •~ ( char_lit - char_lit ) «.» + LexTerm : •- char_lit «.» + LexTerm : •- ( char_lit - char_lit ) «.» LexTerm : •regDefId «.» LexTerm : •[ LexPattern ] «.» LexTerm : •{ LexPattern } «.» @@ -790,8 +785,8 @@ S24{ LexTerm : •. «[» LexTerm : •char_lit «[» LexTerm : •char_lit - char_lit «[» - LexTerm : •~ char_lit «[» - LexTerm : •~ ( char_lit - char_lit ) «[» + LexTerm : •- char_lit «[» + LexTerm : •- ( char_lit - char_lit ) «[» LexTerm : •regDefId «[» LexTerm : •[ LexPattern ] «[» LexTerm : •{ LexPattern } «[» @@ -799,8 +794,8 @@ S24{ LexTerm : •. «char_lit» LexTerm : •char_lit «char_lit» LexTerm : •char_lit - char_lit «char_lit» - LexTerm : •~ char_lit «char_lit» - LexTerm : •~ ( char_lit - char_lit ) «char_lit» + LexTerm : •- char_lit «char_lit» + LexTerm : •- ( char_lit - char_lit ) «char_lit» LexTerm : •regDefId «char_lit» LexTerm : •[ LexPattern ] «char_lit» LexTerm : •{ LexPattern } «char_lit» @@ -808,8 +803,8 @@ S24{ LexTerm : •. «regDefId» LexTerm : •char_lit «regDefId» LexTerm : •char_lit - char_lit «regDefId» - LexTerm : •~ char_lit «regDefId» - LexTerm : •~ ( char_lit - char_lit ) «regDefId» + LexTerm : •- char_lit «regDefId» + LexTerm : •- ( char_lit - char_lit ) «regDefId» LexTerm : •regDefId «regDefId» LexTerm : •[ LexPattern ] «regDefId» LexTerm : •{ LexPattern } «regDefId» @@ -817,65 +812,70 @@ S24{ LexTerm : •. «{» LexTerm : •char_lit «{» LexTerm : •char_lit - char_lit «{» - LexTerm : •~ char_lit «{» - LexTerm : •~ ( char_lit - char_lit ) «{» + LexTerm : •- char_lit «{» + LexTerm : •- ( char_lit - char_lit ) «{» LexTerm : •regDefId «{» LexTerm : •[ LexPattern ] «{» LexTerm : •{ LexPattern } «{» LexTerm : •( LexPattern ) «{» - LexTerm : •. «~» - LexTerm : •char_lit «~» - LexTerm : •char_lit - char_lit «~» - LexTerm : •~ char_lit «~» - LexTerm : •~ ( char_lit - char_lit ) «~» - LexTerm : •regDefId «~» - LexTerm : •[ LexPattern ] «~» - LexTerm : •{ LexPattern } «~» - LexTerm : •( LexPattern ) «~» LexTerm : •. «|» LexTerm : •char_lit «|» LexTerm : •char_lit - char_lit «|» - LexTerm : •~ char_lit «|» - LexTerm : •~ ( char_lit - char_lit ) «|» + LexTerm : •- char_lit «|» + LexTerm : •- ( char_lit - char_lit ) «|» LexTerm : •regDefId «|» LexTerm : •[ LexPattern ] «|» LexTerm : •{ LexPattern } «|» LexTerm : •( LexPattern ) «|» } Transitions: - regDefId -> 23 + regDefId -> 25 . -> 26 char_lit -> 27 - ~ -> 28 + - -> 28 ( -> 29 [ -> 30 { -> 31 LexTerm -> 49 -S25{ +S24{ LexAlt : LexTerm• «;» LexAlt : LexTerm• «(» + LexAlt : LexTerm• «-» LexAlt : LexTerm• «.» LexAlt : LexTerm• «[» LexAlt : LexTerm• «char_lit» LexAlt : LexTerm• «regDefId» LexAlt : LexTerm• «{» - LexAlt : LexTerm• «~» LexAlt : LexTerm• «|» } Transitions: +S25{ + LexTerm : regDefId• «;» + LexTerm : regDefId• «(» + LexTerm : regDefId• «-» + LexTerm : regDefId• «.» + LexTerm : regDefId• «[» + LexTerm : regDefId• «char_lit» + LexTerm : regDefId• «regDefId» + LexTerm : regDefId• «{» + LexTerm : regDefId• «|» +} +Transitions: + + S26{ LexTerm : .• «;» LexTerm : .• «(» + LexTerm : .• «-» LexTerm : .• «.» LexTerm : .• «[» LexTerm : .• «char_lit» LexTerm : .• «regDefId» LexTerm : .• «{» - LexTerm : .• «~» LexTerm : .• «|» } Transitions: @@ -886,6 +886,8 @@ S27{ LexTerm : char_lit •- char_lit «;» LexTerm : char_lit• «(» LexTerm : char_lit •- char_lit «(» + LexTerm : char_lit• «-» + LexTerm : char_lit •- char_lit «-» LexTerm : char_lit• «.» LexTerm : char_lit •- char_lit «.» LexTerm : char_lit• «[» @@ -896,8 +898,6 @@ S27{ LexTerm : char_lit •- char_lit «regDefId» LexTerm : char_lit• «{» LexTerm : char_lit •- char_lit «{» - LexTerm : char_lit• «~» - LexTerm : char_lit •- char_lit «~» LexTerm : char_lit• «|» LexTerm : char_lit •- char_lit «|» } @@ -906,24 +906,24 @@ Transitions: S28{ - LexTerm : ~ •char_lit «;» - LexTerm : ~ •( char_lit - char_lit ) «;» - LexTerm : ~ •char_lit «(» - LexTerm : ~ •( char_lit - char_lit ) «(» - LexTerm : ~ •char_lit «.» - LexTerm : ~ •( char_lit - char_lit ) «.» - LexTerm : ~ •char_lit «[» - LexTerm : ~ •( char_lit - char_lit ) «[» - LexTerm : ~ •char_lit «char_lit» - LexTerm : ~ •( char_lit - char_lit ) «char_lit» - LexTerm : ~ •char_lit «regDefId» - LexTerm : ~ •( char_lit - char_lit ) «regDefId» - LexTerm : ~ •char_lit «{» - LexTerm : ~ •( char_lit - char_lit ) «{» - LexTerm : ~ •char_lit «~» - LexTerm : ~ •( char_lit - char_lit ) «~» - LexTerm : ~ •char_lit «|» - LexTerm : ~ •( char_lit - char_lit ) «|» + LexTerm : - •char_lit «;» + LexTerm : - •( char_lit - char_lit ) «;» + LexTerm : - •char_lit «(» + LexTerm : - •( char_lit - char_lit ) «(» + LexTerm : - •char_lit «-» + LexTerm : - •( char_lit - char_lit ) «-» + LexTerm : - •char_lit «.» + LexTerm : - •( char_lit - char_lit ) «.» + LexTerm : - •char_lit «[» + LexTerm : - •( char_lit - char_lit ) «[» + LexTerm : - •char_lit «char_lit» + LexTerm : - •( char_lit - char_lit ) «char_lit» + LexTerm : - •char_lit «regDefId» + LexTerm : - •( char_lit - char_lit ) «regDefId» + LexTerm : - •char_lit «{» + LexTerm : - •( char_lit - char_lit ) «{» + LexTerm : - •char_lit «|» + LexTerm : - •( char_lit - char_lit ) «|» } Transitions: char_lit -> 51 @@ -933,12 +933,12 @@ Transitions: S29{ LexTerm : ( •LexPattern ) «;» LexTerm : ( •LexPattern ) «(» + LexTerm : ( •LexPattern ) «-» LexTerm : ( •LexPattern ) «.» LexTerm : ( •LexPattern ) «[» LexTerm : ( •LexPattern ) «char_lit» LexTerm : ( •LexPattern ) «regDefId» LexTerm : ( •LexPattern ) «{» - LexTerm : ( •LexPattern ) «~» LexTerm : ( •LexPattern ) «|» LexPattern : •LexAlt «)» LexPattern : •LexPattern | LexAlt «)» @@ -949,42 +949,51 @@ S29{ LexTerm : •. «)» LexTerm : •char_lit «)» LexTerm : •char_lit - char_lit «)» - LexTerm : •~ char_lit «)» - LexTerm : •~ ( char_lit - char_lit ) «)» + LexTerm : •- char_lit «)» + LexTerm : •- ( char_lit - char_lit ) «)» LexTerm : •regDefId «)» LexTerm : •[ LexPattern ] «)» LexTerm : •{ LexPattern } «)» LexTerm : •( LexPattern ) «)» LexAlt : •LexTerm «(» + LexAlt : •LexTerm «-» LexAlt : •LexTerm «.» LexAlt : •LexTerm «[» LexAlt : •LexTerm «char_lit» LexAlt : •LexTerm «regDefId» LexAlt : •LexTerm «{» - LexAlt : •LexTerm «~» LexAlt : •LexAlt LexTerm «(» + LexAlt : •LexAlt LexTerm «-» LexAlt : •LexAlt LexTerm «.» LexAlt : •LexAlt LexTerm «[» LexAlt : •LexAlt LexTerm «char_lit» LexAlt : •LexAlt LexTerm «regDefId» LexAlt : •LexAlt LexTerm «{» - LexAlt : •LexAlt LexTerm «~» LexAlt : •LexTerm «|» LexAlt : •LexAlt LexTerm «|» LexTerm : •. «(» LexTerm : •char_lit «(» LexTerm : •char_lit - char_lit «(» - LexTerm : •~ char_lit «(» - LexTerm : •~ ( char_lit - char_lit ) «(» + LexTerm : •- char_lit «(» + LexTerm : •- ( char_lit - char_lit ) «(» LexTerm : •regDefId «(» LexTerm : •[ LexPattern ] «(» LexTerm : •{ LexPattern } «(» LexTerm : •( LexPattern ) «(» + LexTerm : •. «-» + LexTerm : •char_lit «-» + LexTerm : •char_lit - char_lit «-» + LexTerm : •- char_lit «-» + LexTerm : •- ( char_lit - char_lit ) «-» + LexTerm : •regDefId «-» + LexTerm : •[ LexPattern ] «-» + LexTerm : •{ LexPattern } «-» + LexTerm : •( LexPattern ) «-» LexTerm : •. «.» LexTerm : •char_lit «.» LexTerm : •char_lit - char_lit «.» - LexTerm : •~ char_lit «.» - LexTerm : •~ ( char_lit - char_lit ) «.» + LexTerm : •- char_lit «.» + LexTerm : •- ( char_lit - char_lit ) «.» LexTerm : •regDefId «.» LexTerm : •[ LexPattern ] «.» LexTerm : •{ LexPattern } «.» @@ -992,8 +1001,8 @@ S29{ LexTerm : •. «[» LexTerm : •char_lit «[» LexTerm : •char_lit - char_lit «[» - LexTerm : •~ char_lit «[» - LexTerm : •~ ( char_lit - char_lit ) «[» + LexTerm : •- char_lit «[» + LexTerm : •- ( char_lit - char_lit ) «[» LexTerm : •regDefId «[» LexTerm : •[ LexPattern ] «[» LexTerm : •{ LexPattern } «[» @@ -1001,8 +1010,8 @@ S29{ LexTerm : •. «char_lit» LexTerm : •char_lit «char_lit» LexTerm : •char_lit - char_lit «char_lit» - LexTerm : •~ char_lit «char_lit» - LexTerm : •~ ( char_lit - char_lit ) «char_lit» + LexTerm : •- char_lit «char_lit» + LexTerm : •- ( char_lit - char_lit ) «char_lit» LexTerm : •regDefId «char_lit» LexTerm : •[ LexPattern ] «char_lit» LexTerm : •{ LexPattern } «char_lit» @@ -1010,8 +1019,8 @@ S29{ LexTerm : •. «regDefId» LexTerm : •char_lit «regDefId» LexTerm : •char_lit - char_lit «regDefId» - LexTerm : •~ char_lit «regDefId» - LexTerm : •~ ( char_lit - char_lit ) «regDefId» + LexTerm : •- char_lit «regDefId» + LexTerm : •- ( char_lit - char_lit ) «regDefId» LexTerm : •regDefId «regDefId» LexTerm : •[ LexPattern ] «regDefId» LexTerm : •{ LexPattern } «regDefId» @@ -1019,26 +1028,17 @@ S29{ LexTerm : •. «{» LexTerm : •char_lit «{» LexTerm : •char_lit - char_lit «{» - LexTerm : •~ char_lit «{» - LexTerm : •~ ( char_lit - char_lit ) «{» + LexTerm : •- char_lit «{» + LexTerm : •- ( char_lit - char_lit ) «{» LexTerm : •regDefId «{» LexTerm : •[ LexPattern ] «{» LexTerm : •{ LexPattern } «{» LexTerm : •( LexPattern ) «{» - LexTerm : •. «~» - LexTerm : •char_lit «~» - LexTerm : •char_lit - char_lit «~» - LexTerm : •~ char_lit «~» - LexTerm : •~ ( char_lit - char_lit ) «~» - LexTerm : •regDefId «~» - LexTerm : •[ LexPattern ] «~» - LexTerm : •{ LexPattern } «~» - LexTerm : •( LexPattern ) «~» LexTerm : •. «|» LexTerm : •char_lit «|» LexTerm : •char_lit - char_lit «|» - LexTerm : •~ char_lit «|» - LexTerm : •~ ( char_lit - char_lit ) «|» + LexTerm : •- char_lit «|» + LexTerm : •- ( char_lit - char_lit ) «|» LexTerm : •regDefId «|» LexTerm : •[ LexPattern ] «|» LexTerm : •{ LexPattern } «|» @@ -1046,12 +1046,12 @@ S29{ } Transitions: LexPattern -> 53 - regDefId -> 54 - LexAlt -> 55 - LexTerm -> 56 + LexAlt -> 54 + LexTerm -> 55 + regDefId -> 56 . -> 57 char_lit -> 58 - ~ -> 59 + - -> 59 ( -> 60 [ -> 61 { -> 62 @@ -1060,12 +1060,12 @@ Transitions: S30{ LexTerm : [ •LexPattern ] «;» LexTerm : [ •LexPattern ] «(» + LexTerm : [ •LexPattern ] «-» LexTerm : [ •LexPattern ] «.» LexTerm : [ •LexPattern ] «[» LexTerm : [ •LexPattern ] «char_lit» LexTerm : [ •LexPattern ] «regDefId» LexTerm : [ •LexPattern ] «{» - LexTerm : [ •LexPattern ] «~» LexTerm : [ •LexPattern ] «|» LexPattern : •LexAlt «]» LexPattern : •LexPattern | LexAlt «]» @@ -1076,42 +1076,51 @@ S30{ LexTerm : •. «]» LexTerm : •char_lit «]» LexTerm : •char_lit - char_lit «]» - LexTerm : •~ char_lit «]» - LexTerm : •~ ( char_lit - char_lit ) «]» + LexTerm : •- char_lit «]» + LexTerm : •- ( char_lit - char_lit ) «]» LexTerm : •regDefId «]» LexTerm : •[ LexPattern ] «]» LexTerm : •{ LexPattern } «]» LexTerm : •( LexPattern ) «]» LexAlt : •LexTerm «(» + LexAlt : •LexTerm «-» LexAlt : •LexTerm «.» LexAlt : •LexTerm «[» LexAlt : •LexTerm «char_lit» LexAlt : •LexTerm «regDefId» LexAlt : •LexTerm «{» - LexAlt : •LexTerm «~» LexAlt : •LexAlt LexTerm «(» + LexAlt : •LexAlt LexTerm «-» LexAlt : •LexAlt LexTerm «.» LexAlt : •LexAlt LexTerm «[» LexAlt : •LexAlt LexTerm «char_lit» LexAlt : •LexAlt LexTerm «regDefId» LexAlt : •LexAlt LexTerm «{» - LexAlt : •LexAlt LexTerm «~» LexAlt : •LexTerm «|» LexAlt : •LexAlt LexTerm «|» LexTerm : •. «(» LexTerm : •char_lit «(» LexTerm : •char_lit - char_lit «(» - LexTerm : •~ char_lit «(» - LexTerm : •~ ( char_lit - char_lit ) «(» + LexTerm : •- char_lit «(» + LexTerm : •- ( char_lit - char_lit ) «(» LexTerm : •regDefId «(» LexTerm : •[ LexPattern ] «(» LexTerm : •{ LexPattern } «(» LexTerm : •( LexPattern ) «(» + LexTerm : •. «-» + LexTerm : •char_lit «-» + LexTerm : •char_lit - char_lit «-» + LexTerm : •- char_lit «-» + LexTerm : •- ( char_lit - char_lit ) «-» + LexTerm : •regDefId «-» + LexTerm : •[ LexPattern ] «-» + LexTerm : •{ LexPattern } «-» + LexTerm : •( LexPattern ) «-» LexTerm : •. «.» LexTerm : •char_lit «.» LexTerm : •char_lit - char_lit «.» - LexTerm : •~ char_lit «.» - LexTerm : •~ ( char_lit - char_lit ) «.» + LexTerm : •- char_lit «.» + LexTerm : •- ( char_lit - char_lit ) «.» LexTerm : •regDefId «.» LexTerm : •[ LexPattern ] «.» LexTerm : •{ LexPattern } «.» @@ -1119,8 +1128,8 @@ S30{ LexTerm : •. «[» LexTerm : •char_lit «[» LexTerm : •char_lit - char_lit «[» - LexTerm : •~ char_lit «[» - LexTerm : •~ ( char_lit - char_lit ) «[» + LexTerm : •- char_lit «[» + LexTerm : •- ( char_lit - char_lit ) «[» LexTerm : •regDefId «[» LexTerm : •[ LexPattern ] «[» LexTerm : •{ LexPattern } «[» @@ -1128,8 +1137,8 @@ S30{ LexTerm : •. «char_lit» LexTerm : •char_lit «char_lit» LexTerm : •char_lit - char_lit «char_lit» - LexTerm : •~ char_lit «char_lit» - LexTerm : •~ ( char_lit - char_lit ) «char_lit» + LexTerm : •- char_lit «char_lit» + LexTerm : •- ( char_lit - char_lit ) «char_lit» LexTerm : •regDefId «char_lit» LexTerm : •[ LexPattern ] «char_lit» LexTerm : •{ LexPattern } «char_lit» @@ -1137,8 +1146,8 @@ S30{ LexTerm : •. «regDefId» LexTerm : •char_lit «regDefId» LexTerm : •char_lit - char_lit «regDefId» - LexTerm : •~ char_lit «regDefId» - LexTerm : •~ ( char_lit - char_lit ) «regDefId» + LexTerm : •- char_lit «regDefId» + LexTerm : •- ( char_lit - char_lit ) «regDefId» LexTerm : •regDefId «regDefId» LexTerm : •[ LexPattern ] «regDefId» LexTerm : •{ LexPattern } «regDefId» @@ -1146,26 +1155,17 @@ S30{ LexTerm : •. «{» LexTerm : •char_lit «{» LexTerm : •char_lit - char_lit «{» - LexTerm : •~ char_lit «{» - LexTerm : •~ ( char_lit - char_lit ) «{» + LexTerm : •- char_lit «{» + LexTerm : •- ( char_lit - char_lit ) «{» LexTerm : •regDefId «{» LexTerm : •[ LexPattern ] «{» LexTerm : •{ LexPattern } «{» LexTerm : •( LexPattern ) «{» - LexTerm : •. «~» - LexTerm : •char_lit «~» - LexTerm : •char_lit - char_lit «~» - LexTerm : •~ char_lit «~» - LexTerm : •~ ( char_lit - char_lit ) «~» - LexTerm : •regDefId «~» - LexTerm : •[ LexPattern ] «~» - LexTerm : •{ LexPattern } «~» - LexTerm : •( LexPattern ) «~» LexTerm : •. «|» LexTerm : •char_lit «|» LexTerm : •char_lit - char_lit «|» - LexTerm : •~ char_lit «|» - LexTerm : •~ ( char_lit - char_lit ) «|» + LexTerm : •- char_lit «|» + LexTerm : •- ( char_lit - char_lit ) «|» LexTerm : •regDefId «|» LexTerm : •[ LexPattern ] «|» LexTerm : •{ LexPattern } «|» @@ -1173,12 +1173,12 @@ S30{ } Transitions: LexPattern -> 63 - regDefId -> 64 - LexAlt -> 65 - LexTerm -> 66 + LexAlt -> 64 + LexTerm -> 65 + regDefId -> 66 . -> 67 char_lit -> 68 - ~ -> 69 + - -> 69 ( -> 70 [ -> 71 { -> 72 @@ -1187,12 +1187,12 @@ Transitions: S31{ LexTerm : { •LexPattern } «;» LexTerm : { •LexPattern } «(» + LexTerm : { •LexPattern } «-» LexTerm : { •LexPattern } «.» LexTerm : { •LexPattern } «[» LexTerm : { •LexPattern } «char_lit» LexTerm : { •LexPattern } «regDefId» LexTerm : { •LexPattern } «{» - LexTerm : { •LexPattern } «~» LexTerm : { •LexPattern } «|» LexPattern : •LexAlt «}» LexPattern : •LexPattern | LexAlt «}» @@ -1203,42 +1203,51 @@ S31{ LexTerm : •. «}» LexTerm : •char_lit «}» LexTerm : •char_lit - char_lit «}» - LexTerm : •~ char_lit «}» - LexTerm : •~ ( char_lit - char_lit ) «}» + LexTerm : •- char_lit «}» + LexTerm : •- ( char_lit - char_lit ) «}» LexTerm : •regDefId «}» LexTerm : •[ LexPattern ] «}» LexTerm : •{ LexPattern } «}» LexTerm : •( LexPattern ) «}» LexAlt : •LexTerm «(» + LexAlt : •LexTerm «-» LexAlt : •LexTerm «.» LexAlt : •LexTerm «[» LexAlt : •LexTerm «char_lit» LexAlt : •LexTerm «regDefId» LexAlt : •LexTerm «{» - LexAlt : •LexTerm «~» LexAlt : •LexAlt LexTerm «(» + LexAlt : •LexAlt LexTerm «-» LexAlt : •LexAlt LexTerm «.» LexAlt : •LexAlt LexTerm «[» LexAlt : •LexAlt LexTerm «char_lit» LexAlt : •LexAlt LexTerm «regDefId» LexAlt : •LexAlt LexTerm «{» - LexAlt : •LexAlt LexTerm «~» LexAlt : •LexTerm «|» LexAlt : •LexAlt LexTerm «|» LexTerm : •. «(» LexTerm : •char_lit «(» LexTerm : •char_lit - char_lit «(» - LexTerm : •~ char_lit «(» - LexTerm : •~ ( char_lit - char_lit ) «(» + LexTerm : •- char_lit «(» + LexTerm : •- ( char_lit - char_lit ) «(» LexTerm : •regDefId «(» LexTerm : •[ LexPattern ] «(» LexTerm : •{ LexPattern } «(» LexTerm : •( LexPattern ) «(» + LexTerm : •. «-» + LexTerm : •char_lit «-» + LexTerm : •char_lit - char_lit «-» + LexTerm : •- char_lit «-» + LexTerm : •- ( char_lit - char_lit ) «-» + LexTerm : •regDefId «-» + LexTerm : •[ LexPattern ] «-» + LexTerm : •{ LexPattern } «-» + LexTerm : •( LexPattern ) «-» LexTerm : •. «.» LexTerm : •char_lit «.» LexTerm : •char_lit - char_lit «.» - LexTerm : •~ char_lit «.» - LexTerm : •~ ( char_lit - char_lit ) «.» + LexTerm : •- char_lit «.» + LexTerm : •- ( char_lit - char_lit ) «.» LexTerm : •regDefId «.» LexTerm : •[ LexPattern ] «.» LexTerm : •{ LexPattern } «.» @@ -1246,8 +1255,8 @@ S31{ LexTerm : •. «[» LexTerm : •char_lit «[» LexTerm : •char_lit - char_lit «[» - LexTerm : •~ char_lit «[» - LexTerm : •~ ( char_lit - char_lit ) «[» + LexTerm : •- char_lit «[» + LexTerm : •- ( char_lit - char_lit ) «[» LexTerm : •regDefId «[» LexTerm : •[ LexPattern ] «[» LexTerm : •{ LexPattern } «[» @@ -1255,8 +1264,8 @@ S31{ LexTerm : •. «char_lit» LexTerm : •char_lit «char_lit» LexTerm : •char_lit - char_lit «char_lit» - LexTerm : •~ char_lit «char_lit» - LexTerm : •~ ( char_lit - char_lit ) «char_lit» + LexTerm : •- char_lit «char_lit» + LexTerm : •- ( char_lit - char_lit ) «char_lit» LexTerm : •regDefId «char_lit» LexTerm : •[ LexPattern ] «char_lit» LexTerm : •{ LexPattern } «char_lit» @@ -1264,8 +1273,8 @@ S31{ LexTerm : •. «regDefId» LexTerm : •char_lit «regDefId» LexTerm : •char_lit - char_lit «regDefId» - LexTerm : •~ char_lit «regDefId» - LexTerm : •~ ( char_lit - char_lit ) «regDefId» + LexTerm : •- char_lit «regDefId» + LexTerm : •- ( char_lit - char_lit ) «regDefId» LexTerm : •regDefId «regDefId» LexTerm : •[ LexPattern ] «regDefId» LexTerm : •{ LexPattern } «regDefId» @@ -1273,26 +1282,17 @@ S31{ LexTerm : •. «{» LexTerm : •char_lit «{» LexTerm : •char_lit - char_lit «{» - LexTerm : •~ char_lit «{» - LexTerm : •~ ( char_lit - char_lit ) «{» + LexTerm : •- char_lit «{» + LexTerm : •- ( char_lit - char_lit ) «{» LexTerm : •regDefId «{» LexTerm : •[ LexPattern ] «{» LexTerm : •{ LexPattern } «{» LexTerm : •( LexPattern ) «{» - LexTerm : •. «~» - LexTerm : •char_lit «~» - LexTerm : •char_lit - char_lit «~» - LexTerm : •~ char_lit «~» - LexTerm : •~ ( char_lit - char_lit ) «~» - LexTerm : •regDefId «~» - LexTerm : •[ LexPattern ] «~» - LexTerm : •{ LexPattern } «~» - LexTerm : •( LexPattern ) «~» LexTerm : •. «|» LexTerm : •char_lit «|» LexTerm : •char_lit - char_lit «|» - LexTerm : •~ char_lit «|» - LexTerm : •~ ( char_lit - char_lit ) «|» + LexTerm : •- char_lit «|» + LexTerm : •- ( char_lit - char_lit ) «|» LexTerm : •regDefId «|» LexTerm : •[ LexPattern ] «|» LexTerm : •{ LexPattern } «|» @@ -1300,12 +1300,12 @@ S31{ } Transitions: LexPattern -> 73 - regDefId -> 74 - LexAlt -> 75 - LexTerm -> 76 + LexAlt -> 74 + LexTerm -> 75 + regDefId -> 76 . -> 77 char_lit -> 78 - ~ -> 79 + - -> 79 ( -> 80 [ -> 81 { -> 82 @@ -1342,28 +1342,6 @@ Transitions: S34{ - Symbol : tokId• «;» - Symbol : tokId• «g_sdt_lit» - Symbol : tokId• «prodId» - Symbol : tokId• «string_lit» - Symbol : tokId• «tokId» - Symbol : tokId• «|» -} -Transitions: - - -S35{ - Symbol : prodId• «;» - Symbol : prodId• «g_sdt_lit» - Symbol : prodId• «prodId» - Symbol : prodId• «string_lit» - Symbol : prodId• «tokId» - Symbol : prodId• «|» -} -Transitions: - - -S36{ SyntaxProduction : prodId : Alternatives •; «Ω» SyntaxProduction : prodId : Alternatives •; «prodId» Alternatives : Alternatives •| SyntaxBody «;» @@ -1374,14 +1352,14 @@ Transitions: | -> 86 -S37{ +S35{ Alternatives : SyntaxBody• «;» Alternatives : SyntaxBody• «|» } Transitions: -S38{ +S36{ SyntaxBody : Symbols• «;» SyntaxBody : Symbols •g_sdt_lit «;» Symbols : Symbols •Symbol «;» @@ -1412,14 +1390,25 @@ S38{ Symbol : •string_lit «|» } Transitions: - tokId -> 34 - prodId -> 35 + tokId -> 40 + prodId -> 41 string_lit -> 42 - g_sdt_lit -> 87 - Symbol -> 88 + Symbol -> 87 + g_sdt_lit -> 88 -S39{ +S37{ + Symbols : Symbol• «;» + Symbols : Symbol• «g_sdt_lit» + Symbols : Symbol• «prodId» + Symbols : Symbol• «string_lit» + Symbols : Symbol• «tokId» + Symbols : Symbol• «|» +} +Transitions: + + +S38{ SyntaxBody : ErrorSymbol• «;» SyntaxBody : ErrorSymbol •Symbols «;» SyntaxBody : ErrorSymbol •Symbols g_sdt_lit «;» @@ -1460,28 +1449,39 @@ S39{ Symbol : •string_lit «tokId» } Transitions: - tokId -> 34 - prodId -> 35 - Symbol -> 41 + Symbol -> 37 + tokId -> 40 + prodId -> 41 string_lit -> 42 - g_sdt_lit -> 89 - Symbols -> 90 + Symbols -> 89 + g_sdt_lit -> 90 -S40{ +S39{ SyntaxBody : EpsilonSymbol• «;» SyntaxBody : EpsilonSymbol• «|» } Transitions: +S40{ + Symbol : tokId• «;» + Symbol : tokId• «g_sdt_lit» + Symbol : tokId• «prodId» + Symbol : tokId• «string_lit» + Symbol : tokId• «tokId» + Symbol : tokId• «|» +} +Transitions: + + S41{ - Symbols : Symbol• «;» - Symbols : Symbol• «g_sdt_lit» - Symbols : Symbol• «prodId» - Symbols : Symbol• «string_lit» - Symbols : Symbol• «tokId» - Symbols : Symbol• «|» + Symbol : prodId• «;» + Symbol : prodId• «g_sdt_lit» + Symbol : prodId• «prodId» + Symbol : prodId• «string_lit» + Symbol : prodId• «tokId» + Symbol : prodId• «|» } Transitions: @@ -1498,12 +1498,12 @@ Transitions: S43{ - ErrorSymbol : errore• «;» - ErrorSymbol : errore• «prodId» - ErrorSymbol : errore• «string_lit» - ErrorSymbol : errore• «tokId» - ErrorSymbol : errore• «g_sdt_lit» - ErrorSymbol : errore• «|» + ErrorSymbol : error• «;» + ErrorSymbol : error• «prodId» + ErrorSymbol : error• «string_lit» + ErrorSymbol : error• «tokId» + ErrorSymbol : error• «g_sdt_lit» + ErrorSymbol : error• «|» } Transitions: @@ -1554,31 +1554,31 @@ S48{ LexTerm : •. «;» LexTerm : •char_lit «;» LexTerm : •char_lit - char_lit «;» - LexTerm : •~ char_lit «;» - LexTerm : •~ ( char_lit - char_lit ) «;» + LexTerm : •- char_lit «;» + LexTerm : •- ( char_lit - char_lit ) «;» LexTerm : •regDefId «;» LexTerm : •[ LexPattern ] «;» LexTerm : •{ LexPattern } «;» LexTerm : •( LexPattern ) «;» LexAlt : •LexTerm «(» + LexAlt : •LexTerm «-» LexAlt : •LexTerm «.» LexAlt : •LexTerm «[» LexAlt : •LexTerm «char_lit» LexAlt : •LexTerm «regDefId» LexAlt : •LexTerm «{» - LexAlt : •LexTerm «~» LexAlt : •LexAlt LexTerm «(» + LexAlt : •LexAlt LexTerm «-» LexAlt : •LexAlt LexTerm «.» LexAlt : •LexAlt LexTerm «[» LexAlt : •LexAlt LexTerm «char_lit» LexAlt : •LexAlt LexTerm «regDefId» LexAlt : •LexAlt LexTerm «{» - LexAlt : •LexAlt LexTerm «~» LexTerm : •. «|» LexTerm : •char_lit «|» LexTerm : •char_lit - char_lit «|» - LexTerm : •~ char_lit «|» - LexTerm : •~ ( char_lit - char_lit ) «|» + LexTerm : •- char_lit «|» + LexTerm : •- ( char_lit - char_lit ) «|» LexTerm : •regDefId «|» LexTerm : •[ LexPattern ] «|» LexTerm : •{ LexPattern } «|» @@ -1586,17 +1586,26 @@ S48{ LexTerm : •. «(» LexTerm : •char_lit «(» LexTerm : •char_lit - char_lit «(» - LexTerm : •~ char_lit «(» - LexTerm : •~ ( char_lit - char_lit ) «(» + LexTerm : •- char_lit «(» + LexTerm : •- ( char_lit - char_lit ) «(» LexTerm : •regDefId «(» LexTerm : •[ LexPattern ] «(» LexTerm : •{ LexPattern } «(» LexTerm : •( LexPattern ) «(» + LexTerm : •. «-» + LexTerm : •char_lit «-» + LexTerm : •char_lit - char_lit «-» + LexTerm : •- char_lit «-» + LexTerm : •- ( char_lit - char_lit ) «-» + LexTerm : •regDefId «-» + LexTerm : •[ LexPattern ] «-» + LexTerm : •{ LexPattern } «-» + LexTerm : •( LexPattern ) «-» LexTerm : •. «.» LexTerm : •char_lit «.» LexTerm : •char_lit - char_lit «.» - LexTerm : •~ char_lit «.» - LexTerm : •~ ( char_lit - char_lit ) «.» + LexTerm : •- char_lit «.» + LexTerm : •- ( char_lit - char_lit ) «.» LexTerm : •regDefId «.» LexTerm : •[ LexPattern ] «.» LexTerm : •{ LexPattern } «.» @@ -1604,8 +1613,8 @@ S48{ LexTerm : •. «[» LexTerm : •char_lit «[» LexTerm : •char_lit - char_lit «[» - LexTerm : •~ char_lit «[» - LexTerm : •~ ( char_lit - char_lit ) «[» + LexTerm : •- char_lit «[» + LexTerm : •- ( char_lit - char_lit ) «[» LexTerm : •regDefId «[» LexTerm : •[ LexPattern ] «[» LexTerm : •{ LexPattern } «[» @@ -1613,8 +1622,8 @@ S48{ LexTerm : •. «char_lit» LexTerm : •char_lit «char_lit» LexTerm : •char_lit - char_lit «char_lit» - LexTerm : •~ char_lit «char_lit» - LexTerm : •~ ( char_lit - char_lit ) «char_lit» + LexTerm : •- char_lit «char_lit» + LexTerm : •- ( char_lit - char_lit ) «char_lit» LexTerm : •regDefId «char_lit» LexTerm : •[ LexPattern ] «char_lit» LexTerm : •{ LexPattern } «char_lit» @@ -1622,8 +1631,8 @@ S48{ LexTerm : •. «regDefId» LexTerm : •char_lit «regDefId» LexTerm : •char_lit - char_lit «regDefId» - LexTerm : •~ char_lit «regDefId» - LexTerm : •~ ( char_lit - char_lit ) «regDefId» + LexTerm : •- char_lit «regDefId» + LexTerm : •- ( char_lit - char_lit ) «regDefId» LexTerm : •regDefId «regDefId» LexTerm : •[ LexPattern ] «regDefId» LexTerm : •{ LexPattern } «regDefId» @@ -1631,28 +1640,19 @@ S48{ LexTerm : •. «{» LexTerm : •char_lit «{» LexTerm : •char_lit - char_lit «{» - LexTerm : •~ char_lit «{» - LexTerm : •~ ( char_lit - char_lit ) «{» + LexTerm : •- char_lit «{» + LexTerm : •- ( char_lit - char_lit ) «{» LexTerm : •regDefId «{» LexTerm : •[ LexPattern ] «{» LexTerm : •{ LexPattern } «{» LexTerm : •( LexPattern ) «{» - LexTerm : •. «~» - LexTerm : •char_lit «~» - LexTerm : •char_lit - char_lit «~» - LexTerm : •~ char_lit «~» - LexTerm : •~ ( char_lit - char_lit ) «~» - LexTerm : •regDefId «~» - LexTerm : •[ LexPattern ] «~» - LexTerm : •{ LexPattern } «~» - LexTerm : •( LexPattern ) «~» -} -Transitions: - regDefId -> 23 - LexTerm -> 25 +} +Transitions: + LexTerm -> 24 + regDefId -> 25 . -> 26 char_lit -> 27 - ~ -> 28 + - -> 28 ( -> 29 [ -> 30 { -> 31 @@ -1662,12 +1662,12 @@ Transitions: S49{ LexAlt : LexAlt LexTerm• «;» LexAlt : LexAlt LexTerm• «(» + LexAlt : LexAlt LexTerm• «-» LexAlt : LexAlt LexTerm• «.» LexAlt : LexAlt LexTerm• «[» LexAlt : LexAlt LexTerm• «char_lit» LexAlt : LexAlt LexTerm• «regDefId» LexAlt : LexAlt LexTerm• «{» - LexAlt : LexAlt LexTerm• «~» LexAlt : LexAlt LexTerm• «|» } Transitions: @@ -1676,12 +1676,12 @@ Transitions: S50{ LexTerm : char_lit - •char_lit «;» LexTerm : char_lit - •char_lit «(» + LexTerm : char_lit - •char_lit «-» LexTerm : char_lit - •char_lit «.» LexTerm : char_lit - •char_lit «[» LexTerm : char_lit - •char_lit «char_lit» LexTerm : char_lit - •char_lit «regDefId» LexTerm : char_lit - •char_lit «{» - LexTerm : char_lit - •char_lit «~» LexTerm : char_lit - •char_lit «|» } Transitions: @@ -1689,29 +1689,29 @@ Transitions: S51{ - LexTerm : ~ char_lit• «;» - LexTerm : ~ char_lit• «(» - LexTerm : ~ char_lit• «.» - LexTerm : ~ char_lit• «[» - LexTerm : ~ char_lit• «char_lit» - LexTerm : ~ char_lit• «regDefId» - LexTerm : ~ char_lit• «{» - LexTerm : ~ char_lit• «~» - LexTerm : ~ char_lit• «|» + LexTerm : - char_lit• «;» + LexTerm : - char_lit• «(» + LexTerm : - char_lit• «-» + LexTerm : - char_lit• «.» + LexTerm : - char_lit• «[» + LexTerm : - char_lit• «char_lit» + LexTerm : - char_lit• «regDefId» + LexTerm : - char_lit• «{» + LexTerm : - char_lit• «|» } Transitions: S52{ - LexTerm : ~ ( •char_lit - char_lit ) «;» - LexTerm : ~ ( •char_lit - char_lit ) «(» - LexTerm : ~ ( •char_lit - char_lit ) «.» - LexTerm : ~ ( •char_lit - char_lit ) «[» - LexTerm : ~ ( •char_lit - char_lit ) «char_lit» - LexTerm : ~ ( •char_lit - char_lit ) «regDefId» - LexTerm : ~ ( •char_lit - char_lit ) «{» - LexTerm : ~ ( •char_lit - char_lit ) «~» - LexTerm : ~ ( •char_lit - char_lit ) «|» + LexTerm : - ( •char_lit - char_lit ) «;» + LexTerm : - ( •char_lit - char_lit ) «(» + LexTerm : - ( •char_lit - char_lit ) «-» + LexTerm : - ( •char_lit - char_lit ) «.» + LexTerm : - ( •char_lit - char_lit ) «[» + LexTerm : - ( •char_lit - char_lit ) «char_lit» + LexTerm : - ( •char_lit - char_lit ) «regDefId» + LexTerm : - ( •char_lit - char_lit ) «{» + LexTerm : - ( •char_lit - char_lit ) «|» } Transitions: char_lit -> 93 @@ -1720,12 +1720,12 @@ Transitions: S53{ LexTerm : ( LexPattern •) «;» LexTerm : ( LexPattern •) «(» + LexTerm : ( LexPattern •) «-» LexTerm : ( LexPattern •) «.» LexTerm : ( LexPattern •) «[» LexTerm : ( LexPattern •) «char_lit» LexTerm : ( LexPattern •) «regDefId» LexTerm : ( LexPattern •) «{» - LexTerm : ( LexPattern •) «~» LexTerm : ( LexPattern •) «|» LexPattern : LexPattern •| LexAlt «)» LexPattern : LexPattern •| LexAlt «|» @@ -1736,36 +1736,22 @@ Transitions: S54{ - LexTerm : regDefId• «)» - LexTerm : regDefId• «(» - LexTerm : regDefId• «.» - LexTerm : regDefId• «[» - LexTerm : regDefId• «char_lit» - LexTerm : regDefId• «regDefId» - LexTerm : regDefId• «{» - LexTerm : regDefId• «~» - LexTerm : regDefId• «|» -} -Transitions: - - -S55{ LexPattern : LexAlt• «)» LexAlt : LexAlt •LexTerm «)» LexPattern : LexAlt• «|» LexAlt : LexAlt •LexTerm «(» + LexAlt : LexAlt •LexTerm «-» LexAlt : LexAlt •LexTerm «.» LexAlt : LexAlt •LexTerm «[» LexAlt : LexAlt •LexTerm «char_lit» LexAlt : LexAlt •LexTerm «regDefId» LexAlt : LexAlt •LexTerm «{» - LexAlt : LexAlt •LexTerm «~» LexAlt : LexAlt •LexTerm «|» LexTerm : •. «)» LexTerm : •char_lit «)» LexTerm : •char_lit - char_lit «)» - LexTerm : •~ char_lit «)» - LexTerm : •~ ( char_lit - char_lit ) «)» + LexTerm : •- char_lit «)» + LexTerm : •- ( char_lit - char_lit ) «)» LexTerm : •regDefId «)» LexTerm : •[ LexPattern ] «)» LexTerm : •{ LexPattern } «)» @@ -1773,17 +1759,26 @@ S55{ LexTerm : •. «(» LexTerm : •char_lit «(» LexTerm : •char_lit - char_lit «(» - LexTerm : •~ char_lit «(» - LexTerm : •~ ( char_lit - char_lit ) «(» + LexTerm : •- char_lit «(» + LexTerm : •- ( char_lit - char_lit ) «(» LexTerm : •regDefId «(» LexTerm : •[ LexPattern ] «(» LexTerm : •{ LexPattern } «(» LexTerm : •( LexPattern ) «(» + LexTerm : •. «-» + LexTerm : •char_lit «-» + LexTerm : •char_lit - char_lit «-» + LexTerm : •- char_lit «-» + LexTerm : •- ( char_lit - char_lit ) «-» + LexTerm : •regDefId «-» + LexTerm : •[ LexPattern ] «-» + LexTerm : •{ LexPattern } «-» + LexTerm : •( LexPattern ) «-» LexTerm : •. «.» LexTerm : •char_lit «.» LexTerm : •char_lit - char_lit «.» - LexTerm : •~ char_lit «.» - LexTerm : •~ ( char_lit - char_lit ) «.» + LexTerm : •- char_lit «.» + LexTerm : •- ( char_lit - char_lit ) «.» LexTerm : •regDefId «.» LexTerm : •[ LexPattern ] «.» LexTerm : •{ LexPattern } «.» @@ -1791,8 +1786,8 @@ S55{ LexTerm : •. «[» LexTerm : •char_lit «[» LexTerm : •char_lit - char_lit «[» - LexTerm : •~ char_lit «[» - LexTerm : •~ ( char_lit - char_lit ) «[» + LexTerm : •- char_lit «[» + LexTerm : •- ( char_lit - char_lit ) «[» LexTerm : •regDefId «[» LexTerm : •[ LexPattern ] «[» LexTerm : •{ LexPattern } «[» @@ -1800,8 +1795,8 @@ S55{ LexTerm : •. «char_lit» LexTerm : •char_lit «char_lit» LexTerm : •char_lit - char_lit «char_lit» - LexTerm : •~ char_lit «char_lit» - LexTerm : •~ ( char_lit - char_lit ) «char_lit» + LexTerm : •- char_lit «char_lit» + LexTerm : •- ( char_lit - char_lit ) «char_lit» LexTerm : •regDefId «char_lit» LexTerm : •[ LexPattern ] «char_lit» LexTerm : •{ LexPattern } «char_lit» @@ -1809,8 +1804,8 @@ S55{ LexTerm : •. «regDefId» LexTerm : •char_lit «regDefId» LexTerm : •char_lit - char_lit «regDefId» - LexTerm : •~ char_lit «regDefId» - LexTerm : •~ ( char_lit - char_lit ) «regDefId» + LexTerm : •- char_lit «regDefId» + LexTerm : •- ( char_lit - char_lit ) «regDefId» LexTerm : •regDefId «regDefId» LexTerm : •[ LexPattern ] «regDefId» LexTerm : •{ LexPattern } «regDefId» @@ -1818,65 +1813,70 @@ S55{ LexTerm : •. «{» LexTerm : •char_lit «{» LexTerm : •char_lit - char_lit «{» - LexTerm : •~ char_lit «{» - LexTerm : •~ ( char_lit - char_lit ) «{» + LexTerm : •- char_lit «{» + LexTerm : •- ( char_lit - char_lit ) «{» LexTerm : •regDefId «{» LexTerm : •[ LexPattern ] «{» LexTerm : •{ LexPattern } «{» LexTerm : •( LexPattern ) «{» - LexTerm : •. «~» - LexTerm : •char_lit «~» - LexTerm : •char_lit - char_lit «~» - LexTerm : •~ char_lit «~» - LexTerm : •~ ( char_lit - char_lit ) «~» - LexTerm : •regDefId «~» - LexTerm : •[ LexPattern ] «~» - LexTerm : •{ LexPattern } «~» - LexTerm : •( LexPattern ) «~» LexTerm : •. «|» LexTerm : •char_lit «|» LexTerm : •char_lit - char_lit «|» - LexTerm : •~ char_lit «|» - LexTerm : •~ ( char_lit - char_lit ) «|» + LexTerm : •- char_lit «|» + LexTerm : •- ( char_lit - char_lit ) «|» LexTerm : •regDefId «|» LexTerm : •[ LexPattern ] «|» LexTerm : •{ LexPattern } «|» LexTerm : •( LexPattern ) «|» } Transitions: - regDefId -> 54 + regDefId -> 56 . -> 57 char_lit -> 58 - ~ -> 59 + - -> 59 ( -> 60 [ -> 61 { -> 62 LexTerm -> 96 -S56{ +S55{ LexAlt : LexTerm• «)» LexAlt : LexTerm• «(» + LexAlt : LexTerm• «-» LexAlt : LexTerm• «.» LexAlt : LexTerm• «[» LexAlt : LexTerm• «char_lit» LexAlt : LexTerm• «regDefId» LexAlt : LexTerm• «{» - LexAlt : LexTerm• «~» LexAlt : LexTerm• «|» } Transitions: +S56{ + LexTerm : regDefId• «)» + LexTerm : regDefId• «(» + LexTerm : regDefId• «-» + LexTerm : regDefId• «.» + LexTerm : regDefId• «[» + LexTerm : regDefId• «char_lit» + LexTerm : regDefId• «regDefId» + LexTerm : regDefId• «{» + LexTerm : regDefId• «|» +} +Transitions: + + S57{ LexTerm : .• «)» LexTerm : .• «(» + LexTerm : .• «-» LexTerm : .• «.» LexTerm : .• «[» LexTerm : .• «char_lit» LexTerm : .• «regDefId» LexTerm : .• «{» - LexTerm : .• «~» LexTerm : .• «|» } Transitions: @@ -1887,6 +1887,8 @@ S58{ LexTerm : char_lit •- char_lit «)» LexTerm : char_lit• «(» LexTerm : char_lit •- char_lit «(» + LexTerm : char_lit• «-» + LexTerm : char_lit •- char_lit «-» LexTerm : char_lit• «.» LexTerm : char_lit •- char_lit «.» LexTerm : char_lit• «[» @@ -1897,8 +1899,6 @@ S58{ LexTerm : char_lit •- char_lit «regDefId» LexTerm : char_lit• «{» LexTerm : char_lit •- char_lit «{» - LexTerm : char_lit• «~» - LexTerm : char_lit •- char_lit «~» LexTerm : char_lit• «|» LexTerm : char_lit •- char_lit «|» } @@ -1907,24 +1907,24 @@ Transitions: S59{ - LexTerm : ~ •char_lit «)» - LexTerm : ~ •( char_lit - char_lit ) «)» - LexTerm : ~ •char_lit «(» - LexTerm : ~ •( char_lit - char_lit ) «(» - LexTerm : ~ •char_lit «.» - LexTerm : ~ •( char_lit - char_lit ) «.» - LexTerm : ~ •char_lit «[» - LexTerm : ~ •( char_lit - char_lit ) «[» - LexTerm : ~ •char_lit «char_lit» - LexTerm : ~ •( char_lit - char_lit ) «char_lit» - LexTerm : ~ •char_lit «regDefId» - LexTerm : ~ •( char_lit - char_lit ) «regDefId» - LexTerm : ~ •char_lit «{» - LexTerm : ~ •( char_lit - char_lit ) «{» - LexTerm : ~ •char_lit «~» - LexTerm : ~ •( char_lit - char_lit ) «~» - LexTerm : ~ •char_lit «|» - LexTerm : ~ •( char_lit - char_lit ) «|» + LexTerm : - •char_lit «)» + LexTerm : - •( char_lit - char_lit ) «)» + LexTerm : - •char_lit «(» + LexTerm : - •( char_lit - char_lit ) «(» + LexTerm : - •char_lit «-» + LexTerm : - •( char_lit - char_lit ) «-» + LexTerm : - •char_lit «.» + LexTerm : - •( char_lit - char_lit ) «.» + LexTerm : - •char_lit «[» + LexTerm : - •( char_lit - char_lit ) «[» + LexTerm : - •char_lit «char_lit» + LexTerm : - •( char_lit - char_lit ) «char_lit» + LexTerm : - •char_lit «regDefId» + LexTerm : - •( char_lit - char_lit ) «regDefId» + LexTerm : - •char_lit «{» + LexTerm : - •( char_lit - char_lit ) «{» + LexTerm : - •char_lit «|» + LexTerm : - •( char_lit - char_lit ) «|» } Transitions: char_lit -> 98 @@ -1934,12 +1934,12 @@ Transitions: S60{ LexTerm : ( •LexPattern ) «)» LexTerm : ( •LexPattern ) «(» + LexTerm : ( •LexPattern ) «-» LexTerm : ( •LexPattern ) «.» LexTerm : ( •LexPattern ) «[» LexTerm : ( •LexPattern ) «char_lit» LexTerm : ( •LexPattern ) «regDefId» LexTerm : ( •LexPattern ) «{» - LexTerm : ( •LexPattern ) «~» LexTerm : ( •LexPattern ) «|» LexPattern : •LexAlt «)» LexPattern : •LexPattern | LexAlt «)» @@ -1950,42 +1950,51 @@ S60{ LexTerm : •. «)» LexTerm : •char_lit «)» LexTerm : •char_lit - char_lit «)» - LexTerm : •~ char_lit «)» - LexTerm : •~ ( char_lit - char_lit ) «)» + LexTerm : •- char_lit «)» + LexTerm : •- ( char_lit - char_lit ) «)» LexTerm : •regDefId «)» LexTerm : •[ LexPattern ] «)» LexTerm : •{ LexPattern } «)» LexTerm : •( LexPattern ) «)» LexAlt : •LexTerm «(» + LexAlt : •LexTerm «-» LexAlt : •LexTerm «.» LexAlt : •LexTerm «[» LexAlt : •LexTerm «char_lit» LexAlt : •LexTerm «regDefId» LexAlt : •LexTerm «{» - LexAlt : •LexTerm «~» LexAlt : •LexAlt LexTerm «(» + LexAlt : •LexAlt LexTerm «-» LexAlt : •LexAlt LexTerm «.» LexAlt : •LexAlt LexTerm «[» LexAlt : •LexAlt LexTerm «char_lit» LexAlt : •LexAlt LexTerm «regDefId» LexAlt : •LexAlt LexTerm «{» - LexAlt : •LexAlt LexTerm «~» LexAlt : •LexTerm «|» LexAlt : •LexAlt LexTerm «|» LexTerm : •. «(» LexTerm : •char_lit «(» LexTerm : •char_lit - char_lit «(» - LexTerm : •~ char_lit «(» - LexTerm : •~ ( char_lit - char_lit ) «(» + LexTerm : •- char_lit «(» + LexTerm : •- ( char_lit - char_lit ) «(» LexTerm : •regDefId «(» LexTerm : •[ LexPattern ] «(» LexTerm : •{ LexPattern } «(» LexTerm : •( LexPattern ) «(» + LexTerm : •. «-» + LexTerm : •char_lit «-» + LexTerm : •char_lit - char_lit «-» + LexTerm : •- char_lit «-» + LexTerm : •- ( char_lit - char_lit ) «-» + LexTerm : •regDefId «-» + LexTerm : •[ LexPattern ] «-» + LexTerm : •{ LexPattern } «-» + LexTerm : •( LexPattern ) «-» LexTerm : •. «.» LexTerm : •char_lit «.» LexTerm : •char_lit - char_lit «.» - LexTerm : •~ char_lit «.» - LexTerm : •~ ( char_lit - char_lit ) «.» + LexTerm : •- char_lit «.» + LexTerm : •- ( char_lit - char_lit ) «.» LexTerm : •regDefId «.» LexTerm : •[ LexPattern ] «.» LexTerm : •{ LexPattern } «.» @@ -1993,8 +2002,8 @@ S60{ LexTerm : •. «[» LexTerm : •char_lit «[» LexTerm : •char_lit - char_lit «[» - LexTerm : •~ char_lit «[» - LexTerm : •~ ( char_lit - char_lit ) «[» + LexTerm : •- char_lit «[» + LexTerm : •- ( char_lit - char_lit ) «[» LexTerm : •regDefId «[» LexTerm : •[ LexPattern ] «[» LexTerm : •{ LexPattern } «[» @@ -2002,8 +2011,8 @@ S60{ LexTerm : •. «char_lit» LexTerm : •char_lit «char_lit» LexTerm : •char_lit - char_lit «char_lit» - LexTerm : •~ char_lit «char_lit» - LexTerm : •~ ( char_lit - char_lit ) «char_lit» + LexTerm : •- char_lit «char_lit» + LexTerm : •- ( char_lit - char_lit ) «char_lit» LexTerm : •regDefId «char_lit» LexTerm : •[ LexPattern ] «char_lit» LexTerm : •{ LexPattern } «char_lit» @@ -2011,8 +2020,8 @@ S60{ LexTerm : •. «regDefId» LexTerm : •char_lit «regDefId» LexTerm : •char_lit - char_lit «regDefId» - LexTerm : •~ char_lit «regDefId» - LexTerm : •~ ( char_lit - char_lit ) «regDefId» + LexTerm : •- char_lit «regDefId» + LexTerm : •- ( char_lit - char_lit ) «regDefId» LexTerm : •regDefId «regDefId» LexTerm : •[ LexPattern ] «regDefId» LexTerm : •{ LexPattern } «regDefId» @@ -2020,38 +2029,29 @@ S60{ LexTerm : •. «{» LexTerm : •char_lit «{» LexTerm : •char_lit - char_lit «{» - LexTerm : •~ char_lit «{» - LexTerm : •~ ( char_lit - char_lit ) «{» + LexTerm : •- char_lit «{» + LexTerm : •- ( char_lit - char_lit ) «{» LexTerm : •regDefId «{» LexTerm : •[ LexPattern ] «{» LexTerm : •{ LexPattern } «{» LexTerm : •( LexPattern ) «{» - LexTerm : •. «~» - LexTerm : •char_lit «~» - LexTerm : •char_lit - char_lit «~» - LexTerm : •~ char_lit «~» - LexTerm : •~ ( char_lit - char_lit ) «~» - LexTerm : •regDefId «~» - LexTerm : •[ LexPattern ] «~» - LexTerm : •{ LexPattern } «~» - LexTerm : •( LexPattern ) «~» LexTerm : •. «|» LexTerm : •char_lit «|» LexTerm : •char_lit - char_lit «|» - LexTerm : •~ char_lit «|» - LexTerm : •~ ( char_lit - char_lit ) «|» + LexTerm : •- char_lit «|» + LexTerm : •- ( char_lit - char_lit ) «|» LexTerm : •regDefId «|» LexTerm : •[ LexPattern ] «|» LexTerm : •{ LexPattern } «|» LexTerm : •( LexPattern ) «|» } Transitions: - regDefId -> 54 - LexAlt -> 55 - LexTerm -> 56 + LexAlt -> 54 + LexTerm -> 55 + regDefId -> 56 . -> 57 char_lit -> 58 - ~ -> 59 + - -> 59 ( -> 60 [ -> 61 { -> 62 @@ -2061,12 +2061,12 @@ Transitions: S61{ LexTerm : [ •LexPattern ] «)» LexTerm : [ •LexPattern ] «(» + LexTerm : [ •LexPattern ] «-» LexTerm : [ •LexPattern ] «.» LexTerm : [ •LexPattern ] «[» LexTerm : [ •LexPattern ] «char_lit» LexTerm : [ •LexPattern ] «regDefId» LexTerm : [ •LexPattern ] «{» - LexTerm : [ •LexPattern ] «~» LexTerm : [ •LexPattern ] «|» LexPattern : •LexAlt «]» LexPattern : •LexPattern | LexAlt «]» @@ -2077,42 +2077,51 @@ S61{ LexTerm : •. «]» LexTerm : •char_lit «]» LexTerm : •char_lit - char_lit «]» - LexTerm : •~ char_lit «]» - LexTerm : •~ ( char_lit - char_lit ) «]» + LexTerm : •- char_lit «]» + LexTerm : •- ( char_lit - char_lit ) «]» LexTerm : •regDefId «]» LexTerm : •[ LexPattern ] «]» LexTerm : •{ LexPattern } «]» LexTerm : •( LexPattern ) «]» LexAlt : •LexTerm «(» + LexAlt : •LexTerm «-» LexAlt : •LexTerm «.» LexAlt : •LexTerm «[» LexAlt : •LexTerm «char_lit» LexAlt : •LexTerm «regDefId» LexAlt : •LexTerm «{» - LexAlt : •LexTerm «~» LexAlt : •LexAlt LexTerm «(» + LexAlt : •LexAlt LexTerm «-» LexAlt : •LexAlt LexTerm «.» LexAlt : •LexAlt LexTerm «[» LexAlt : •LexAlt LexTerm «char_lit» LexAlt : •LexAlt LexTerm «regDefId» LexAlt : •LexAlt LexTerm «{» - LexAlt : •LexAlt LexTerm «~» LexAlt : •LexTerm «|» LexAlt : •LexAlt LexTerm «|» LexTerm : •. «(» LexTerm : •char_lit «(» LexTerm : •char_lit - char_lit «(» - LexTerm : •~ char_lit «(» - LexTerm : •~ ( char_lit - char_lit ) «(» + LexTerm : •- char_lit «(» + LexTerm : •- ( char_lit - char_lit ) «(» LexTerm : •regDefId «(» LexTerm : •[ LexPattern ] «(» LexTerm : •{ LexPattern } «(» LexTerm : •( LexPattern ) «(» + LexTerm : •. «-» + LexTerm : •char_lit «-» + LexTerm : •char_lit - char_lit «-» + LexTerm : •- char_lit «-» + LexTerm : •- ( char_lit - char_lit ) «-» + LexTerm : •regDefId «-» + LexTerm : •[ LexPattern ] «-» + LexTerm : •{ LexPattern } «-» + LexTerm : •( LexPattern ) «-» LexTerm : •. «.» LexTerm : •char_lit «.» LexTerm : •char_lit - char_lit «.» - LexTerm : •~ char_lit «.» - LexTerm : •~ ( char_lit - char_lit ) «.» + LexTerm : •- char_lit «.» + LexTerm : •- ( char_lit - char_lit ) «.» LexTerm : •regDefId «.» LexTerm : •[ LexPattern ] «.» LexTerm : •{ LexPattern } «.» @@ -2120,8 +2129,8 @@ S61{ LexTerm : •. «[» LexTerm : •char_lit «[» LexTerm : •char_lit - char_lit «[» - LexTerm : •~ char_lit «[» - LexTerm : •~ ( char_lit - char_lit ) «[» + LexTerm : •- char_lit «[» + LexTerm : •- ( char_lit - char_lit ) «[» LexTerm : •regDefId «[» LexTerm : •[ LexPattern ] «[» LexTerm : •{ LexPattern } «[» @@ -2129,8 +2138,8 @@ S61{ LexTerm : •. «char_lit» LexTerm : •char_lit «char_lit» LexTerm : •char_lit - char_lit «char_lit» - LexTerm : •~ char_lit «char_lit» - LexTerm : •~ ( char_lit - char_lit ) «char_lit» + LexTerm : •- char_lit «char_lit» + LexTerm : •- ( char_lit - char_lit ) «char_lit» LexTerm : •regDefId «char_lit» LexTerm : •[ LexPattern ] «char_lit» LexTerm : •{ LexPattern } «char_lit» @@ -2138,8 +2147,8 @@ S61{ LexTerm : •. «regDefId» LexTerm : •char_lit «regDefId» LexTerm : •char_lit - char_lit «regDefId» - LexTerm : •~ char_lit «regDefId» - LexTerm : •~ ( char_lit - char_lit ) «regDefId» + LexTerm : •- char_lit «regDefId» + LexTerm : •- ( char_lit - char_lit ) «regDefId» LexTerm : •regDefId «regDefId» LexTerm : •[ LexPattern ] «regDefId» LexTerm : •{ LexPattern } «regDefId» @@ -2147,38 +2156,29 @@ S61{ LexTerm : •. «{» LexTerm : •char_lit «{» LexTerm : •char_lit - char_lit «{» - LexTerm : •~ char_lit «{» - LexTerm : •~ ( char_lit - char_lit ) «{» + LexTerm : •- char_lit «{» + LexTerm : •- ( char_lit - char_lit ) «{» LexTerm : •regDefId «{» LexTerm : •[ LexPattern ] «{» LexTerm : •{ LexPattern } «{» LexTerm : •( LexPattern ) «{» - LexTerm : •. «~» - LexTerm : •char_lit «~» - LexTerm : •char_lit - char_lit «~» - LexTerm : •~ char_lit «~» - LexTerm : •~ ( char_lit - char_lit ) «~» - LexTerm : •regDefId «~» - LexTerm : •[ LexPattern ] «~» - LexTerm : •{ LexPattern } «~» - LexTerm : •( LexPattern ) «~» LexTerm : •. «|» LexTerm : •char_lit «|» LexTerm : •char_lit - char_lit «|» - LexTerm : •~ char_lit «|» - LexTerm : •~ ( char_lit - char_lit ) «|» + LexTerm : •- char_lit «|» + LexTerm : •- ( char_lit - char_lit ) «|» LexTerm : •regDefId «|» LexTerm : •[ LexPattern ] «|» LexTerm : •{ LexPattern } «|» LexTerm : •( LexPattern ) «|» } Transitions: - regDefId -> 64 - LexAlt -> 65 - LexTerm -> 66 + LexAlt -> 64 + LexTerm -> 65 + regDefId -> 66 . -> 67 char_lit -> 68 - ~ -> 69 + - -> 69 ( -> 70 [ -> 71 { -> 72 @@ -2188,12 +2188,12 @@ Transitions: S62{ LexTerm : { •LexPattern } «)» LexTerm : { •LexPattern } «(» + LexTerm : { •LexPattern } «-» LexTerm : { •LexPattern } «.» LexTerm : { •LexPattern } «[» LexTerm : { •LexPattern } «char_lit» LexTerm : { •LexPattern } «regDefId» LexTerm : { •LexPattern } «{» - LexTerm : { •LexPattern } «~» LexTerm : { •LexPattern } «|» LexPattern : •LexAlt «}» LexPattern : •LexPattern | LexAlt «}» @@ -2204,42 +2204,51 @@ S62{ LexTerm : •. «}» LexTerm : •char_lit «}» LexTerm : •char_lit - char_lit «}» - LexTerm : •~ char_lit «}» - LexTerm : •~ ( char_lit - char_lit ) «}» + LexTerm : •- char_lit «}» + LexTerm : •- ( char_lit - char_lit ) «}» LexTerm : •regDefId «}» LexTerm : •[ LexPattern ] «}» LexTerm : •{ LexPattern } «}» LexTerm : •( LexPattern ) «}» LexAlt : •LexTerm «(» + LexAlt : •LexTerm «-» LexAlt : •LexTerm «.» LexAlt : •LexTerm «[» LexAlt : •LexTerm «char_lit» LexAlt : •LexTerm «regDefId» LexAlt : •LexTerm «{» - LexAlt : •LexTerm «~» LexAlt : •LexAlt LexTerm «(» + LexAlt : •LexAlt LexTerm «-» LexAlt : •LexAlt LexTerm «.» LexAlt : •LexAlt LexTerm «[» LexAlt : •LexAlt LexTerm «char_lit» LexAlt : •LexAlt LexTerm «regDefId» LexAlt : •LexAlt LexTerm «{» - LexAlt : •LexAlt LexTerm «~» LexAlt : •LexTerm «|» LexAlt : •LexAlt LexTerm «|» LexTerm : •. «(» LexTerm : •char_lit «(» LexTerm : •char_lit - char_lit «(» - LexTerm : •~ char_lit «(» - LexTerm : •~ ( char_lit - char_lit ) «(» + LexTerm : •- char_lit «(» + LexTerm : •- ( char_lit - char_lit ) «(» LexTerm : •regDefId «(» LexTerm : •[ LexPattern ] «(» LexTerm : •{ LexPattern } «(» LexTerm : •( LexPattern ) «(» + LexTerm : •. «-» + LexTerm : •char_lit «-» + LexTerm : •char_lit - char_lit «-» + LexTerm : •- char_lit «-» + LexTerm : •- ( char_lit - char_lit ) «-» + LexTerm : •regDefId «-» + LexTerm : •[ LexPattern ] «-» + LexTerm : •{ LexPattern } «-» + LexTerm : •( LexPattern ) «-» LexTerm : •. «.» LexTerm : •char_lit «.» LexTerm : •char_lit - char_lit «.» - LexTerm : •~ char_lit «.» - LexTerm : •~ ( char_lit - char_lit ) «.» + LexTerm : •- char_lit «.» + LexTerm : •- ( char_lit - char_lit ) «.» LexTerm : •regDefId «.» LexTerm : •[ LexPattern ] «.» LexTerm : •{ LexPattern } «.» @@ -2247,8 +2256,8 @@ S62{ LexTerm : •. «[» LexTerm : •char_lit «[» LexTerm : •char_lit - char_lit «[» - LexTerm : •~ char_lit «[» - LexTerm : •~ ( char_lit - char_lit ) «[» + LexTerm : •- char_lit «[» + LexTerm : •- ( char_lit - char_lit ) «[» LexTerm : •regDefId «[» LexTerm : •[ LexPattern ] «[» LexTerm : •{ LexPattern } «[» @@ -2256,8 +2265,8 @@ S62{ LexTerm : •. «char_lit» LexTerm : •char_lit «char_lit» LexTerm : •char_lit - char_lit «char_lit» - LexTerm : •~ char_lit «char_lit» - LexTerm : •~ ( char_lit - char_lit ) «char_lit» + LexTerm : •- char_lit «char_lit» + LexTerm : •- ( char_lit - char_lit ) «char_lit» LexTerm : •regDefId «char_lit» LexTerm : •[ LexPattern ] «char_lit» LexTerm : •{ LexPattern } «char_lit» @@ -2265,8 +2274,8 @@ S62{ LexTerm : •. «regDefId» LexTerm : •char_lit «regDefId» LexTerm : •char_lit - char_lit «regDefId» - LexTerm : •~ char_lit «regDefId» - LexTerm : •~ ( char_lit - char_lit ) «regDefId» + LexTerm : •- char_lit «regDefId» + LexTerm : •- ( char_lit - char_lit ) «regDefId» LexTerm : •regDefId «regDefId» LexTerm : •[ LexPattern ] «regDefId» LexTerm : •{ LexPattern } «regDefId» @@ -2274,38 +2283,29 @@ S62{ LexTerm : •. «{» LexTerm : •char_lit «{» LexTerm : •char_lit - char_lit «{» - LexTerm : •~ char_lit «{» - LexTerm : •~ ( char_lit - char_lit ) «{» + LexTerm : •- char_lit «{» + LexTerm : •- ( char_lit - char_lit ) «{» LexTerm : •regDefId «{» LexTerm : •[ LexPattern ] «{» LexTerm : •{ LexPattern } «{» LexTerm : •( LexPattern ) «{» - LexTerm : •. «~» - LexTerm : •char_lit «~» - LexTerm : •char_lit - char_lit «~» - LexTerm : •~ char_lit «~» - LexTerm : •~ ( char_lit - char_lit ) «~» - LexTerm : •regDefId «~» - LexTerm : •[ LexPattern ] «~» - LexTerm : •{ LexPattern } «~» - LexTerm : •( LexPattern ) «~» LexTerm : •. «|» LexTerm : •char_lit «|» LexTerm : •char_lit - char_lit «|» - LexTerm : •~ char_lit «|» - LexTerm : •~ ( char_lit - char_lit ) «|» + LexTerm : •- char_lit «|» + LexTerm : •- ( char_lit - char_lit ) «|» LexTerm : •regDefId «|» LexTerm : •[ LexPattern ] «|» LexTerm : •{ LexPattern } «|» LexTerm : •( LexPattern ) «|» } Transitions: - regDefId -> 74 - LexAlt -> 75 - LexTerm -> 76 + LexAlt -> 74 + LexTerm -> 75 + regDefId -> 76 . -> 77 char_lit -> 78 - ~ -> 79 + - -> 79 ( -> 80 [ -> 81 { -> 82 @@ -2315,12 +2315,12 @@ Transitions: S63{ LexTerm : [ LexPattern •] «;» LexTerm : [ LexPattern •] «(» + LexTerm : [ LexPattern •] «-» LexTerm : [ LexPattern •] «.» LexTerm : [ LexPattern •] «[» LexTerm : [ LexPattern •] «char_lit» LexTerm : [ LexPattern •] «regDefId» LexTerm : [ LexPattern •] «{» - LexTerm : [ LexPattern •] «~» LexTerm : [ LexPattern •] «|» LexPattern : LexPattern •| LexAlt «]» LexPattern : LexPattern •| LexAlt «|» @@ -2331,36 +2331,22 @@ Transitions: S64{ - LexTerm : regDefId• «]» - LexTerm : regDefId• «(» - LexTerm : regDefId• «.» - LexTerm : regDefId• «[» - LexTerm : regDefId• «char_lit» - LexTerm : regDefId• «regDefId» - LexTerm : regDefId• «{» - LexTerm : regDefId• «~» - LexTerm : regDefId• «|» -} -Transitions: - - -S65{ LexPattern : LexAlt• «]» LexAlt : LexAlt •LexTerm «]» LexPattern : LexAlt• «|» LexAlt : LexAlt •LexTerm «(» + LexAlt : LexAlt •LexTerm «-» LexAlt : LexAlt •LexTerm «.» LexAlt : LexAlt •LexTerm «[» LexAlt : LexAlt •LexTerm «char_lit» LexAlt : LexAlt •LexTerm «regDefId» LexAlt : LexAlt •LexTerm «{» - LexAlt : LexAlt •LexTerm «~» LexAlt : LexAlt •LexTerm «|» LexTerm : •. «]» LexTerm : •char_lit «]» LexTerm : •char_lit - char_lit «]» - LexTerm : •~ char_lit «]» - LexTerm : •~ ( char_lit - char_lit ) «]» + LexTerm : •- char_lit «]» + LexTerm : •- ( char_lit - char_lit ) «]» LexTerm : •regDefId «]» LexTerm : •[ LexPattern ] «]» LexTerm : •{ LexPattern } «]» @@ -2368,17 +2354,26 @@ S65{ LexTerm : •. «(» LexTerm : •char_lit «(» LexTerm : •char_lit - char_lit «(» - LexTerm : •~ char_lit «(» - LexTerm : •~ ( char_lit - char_lit ) «(» + LexTerm : •- char_lit «(» + LexTerm : •- ( char_lit - char_lit ) «(» LexTerm : •regDefId «(» LexTerm : •[ LexPattern ] «(» LexTerm : •{ LexPattern } «(» LexTerm : •( LexPattern ) «(» + LexTerm : •. «-» + LexTerm : •char_lit «-» + LexTerm : •char_lit - char_lit «-» + LexTerm : •- char_lit «-» + LexTerm : •- ( char_lit - char_lit ) «-» + LexTerm : •regDefId «-» + LexTerm : •[ LexPattern ] «-» + LexTerm : •{ LexPattern } «-» + LexTerm : •( LexPattern ) «-» LexTerm : •. «.» LexTerm : •char_lit «.» LexTerm : •char_lit - char_lit «.» - LexTerm : •~ char_lit «.» - LexTerm : •~ ( char_lit - char_lit ) «.» + LexTerm : •- char_lit «.» + LexTerm : •- ( char_lit - char_lit ) «.» LexTerm : •regDefId «.» LexTerm : •[ LexPattern ] «.» LexTerm : •{ LexPattern } «.» @@ -2386,8 +2381,8 @@ S65{ LexTerm : •. «[» LexTerm : •char_lit «[» LexTerm : •char_lit - char_lit «[» - LexTerm : •~ char_lit «[» - LexTerm : •~ ( char_lit - char_lit ) «[» + LexTerm : •- char_lit «[» + LexTerm : •- ( char_lit - char_lit ) «[» LexTerm : •regDefId «[» LexTerm : •[ LexPattern ] «[» LexTerm : •{ LexPattern } «[» @@ -2395,8 +2390,8 @@ S65{ LexTerm : •. «char_lit» LexTerm : •char_lit «char_lit» LexTerm : •char_lit - char_lit «char_lit» - LexTerm : •~ char_lit «char_lit» - LexTerm : •~ ( char_lit - char_lit ) «char_lit» + LexTerm : •- char_lit «char_lit» + LexTerm : •- ( char_lit - char_lit ) «char_lit» LexTerm : •regDefId «char_lit» LexTerm : •[ LexPattern ] «char_lit» LexTerm : •{ LexPattern } «char_lit» @@ -2404,8 +2399,8 @@ S65{ LexTerm : •. «regDefId» LexTerm : •char_lit «regDefId» LexTerm : •char_lit - char_lit «regDefId» - LexTerm : •~ char_lit «regDefId» - LexTerm : •~ ( char_lit - char_lit ) «regDefId» + LexTerm : •- char_lit «regDefId» + LexTerm : •- ( char_lit - char_lit ) «regDefId» LexTerm : •regDefId «regDefId» LexTerm : •[ LexPattern ] «regDefId» LexTerm : •{ LexPattern } «regDefId» @@ -2413,65 +2408,70 @@ S65{ LexTerm : •. «{» LexTerm : •char_lit «{» LexTerm : •char_lit - char_lit «{» - LexTerm : •~ char_lit «{» - LexTerm : •~ ( char_lit - char_lit ) «{» + LexTerm : •- char_lit «{» + LexTerm : •- ( char_lit - char_lit ) «{» LexTerm : •regDefId «{» LexTerm : •[ LexPattern ] «{» LexTerm : •{ LexPattern } «{» LexTerm : •( LexPattern ) «{» - LexTerm : •. «~» - LexTerm : •char_lit «~» - LexTerm : •char_lit - char_lit «~» - LexTerm : •~ char_lit «~» - LexTerm : •~ ( char_lit - char_lit ) «~» - LexTerm : •regDefId «~» - LexTerm : •[ LexPattern ] «~» - LexTerm : •{ LexPattern } «~» - LexTerm : •( LexPattern ) «~» LexTerm : •. «|» LexTerm : •char_lit «|» LexTerm : •char_lit - char_lit «|» - LexTerm : •~ char_lit «|» - LexTerm : •~ ( char_lit - char_lit ) «|» + LexTerm : •- char_lit «|» + LexTerm : •- ( char_lit - char_lit ) «|» LexTerm : •regDefId «|» LexTerm : •[ LexPattern ] «|» LexTerm : •{ LexPattern } «|» LexTerm : •( LexPattern ) «|» } Transitions: - regDefId -> 64 + regDefId -> 66 . -> 67 char_lit -> 68 - ~ -> 69 + - -> 69 ( -> 70 [ -> 71 { -> 72 LexTerm -> 105 -S66{ +S65{ LexAlt : LexTerm• «]» LexAlt : LexTerm• «(» + LexAlt : LexTerm• «-» LexAlt : LexTerm• «.» LexAlt : LexTerm• «[» LexAlt : LexTerm• «char_lit» LexAlt : LexTerm• «regDefId» LexAlt : LexTerm• «{» - LexAlt : LexTerm• «~» LexAlt : LexTerm• «|» } Transitions: +S66{ + LexTerm : regDefId• «]» + LexTerm : regDefId• «(» + LexTerm : regDefId• «-» + LexTerm : regDefId• «.» + LexTerm : regDefId• «[» + LexTerm : regDefId• «char_lit» + LexTerm : regDefId• «regDefId» + LexTerm : regDefId• «{» + LexTerm : regDefId• «|» +} +Transitions: + + S67{ LexTerm : .• «]» LexTerm : .• «(» + LexTerm : .• «-» LexTerm : .• «.» LexTerm : .• «[» LexTerm : .• «char_lit» LexTerm : .• «regDefId» LexTerm : .• «{» - LexTerm : .• «~» LexTerm : .• «|» } Transitions: @@ -2482,6 +2482,8 @@ S68{ LexTerm : char_lit •- char_lit «]» LexTerm : char_lit• «(» LexTerm : char_lit •- char_lit «(» + LexTerm : char_lit• «-» + LexTerm : char_lit •- char_lit «-» LexTerm : char_lit• «.» LexTerm : char_lit •- char_lit «.» LexTerm : char_lit• «[» @@ -2492,8 +2494,6 @@ S68{ LexTerm : char_lit •- char_lit «regDefId» LexTerm : char_lit• «{» LexTerm : char_lit •- char_lit «{» - LexTerm : char_lit• «~» - LexTerm : char_lit •- char_lit «~» LexTerm : char_lit• «|» LexTerm : char_lit •- char_lit «|» } @@ -2502,24 +2502,24 @@ Transitions: S69{ - LexTerm : ~ •char_lit «]» - LexTerm : ~ •( char_lit - char_lit ) «]» - LexTerm : ~ •char_lit «(» - LexTerm : ~ •( char_lit - char_lit ) «(» - LexTerm : ~ •char_lit «.» - LexTerm : ~ •( char_lit - char_lit ) «.» - LexTerm : ~ •char_lit «[» - LexTerm : ~ •( char_lit - char_lit ) «[» - LexTerm : ~ •char_lit «char_lit» - LexTerm : ~ •( char_lit - char_lit ) «char_lit» - LexTerm : ~ •char_lit «regDefId» - LexTerm : ~ •( char_lit - char_lit ) «regDefId» - LexTerm : ~ •char_lit «{» - LexTerm : ~ •( char_lit - char_lit ) «{» - LexTerm : ~ •char_lit «~» - LexTerm : ~ •( char_lit - char_lit ) «~» - LexTerm : ~ •char_lit «|» - LexTerm : ~ •( char_lit - char_lit ) «|» + LexTerm : - •char_lit «]» + LexTerm : - •( char_lit - char_lit ) «]» + LexTerm : - •char_lit «(» + LexTerm : - •( char_lit - char_lit ) «(» + LexTerm : - •char_lit «-» + LexTerm : - •( char_lit - char_lit ) «-» + LexTerm : - •char_lit «.» + LexTerm : - •( char_lit - char_lit ) «.» + LexTerm : - •char_lit «[» + LexTerm : - •( char_lit - char_lit ) «[» + LexTerm : - •char_lit «char_lit» + LexTerm : - •( char_lit - char_lit ) «char_lit» + LexTerm : - •char_lit «regDefId» + LexTerm : - •( char_lit - char_lit ) «regDefId» + LexTerm : - •char_lit «{» + LexTerm : - •( char_lit - char_lit ) «{» + LexTerm : - •char_lit «|» + LexTerm : - •( char_lit - char_lit ) «|» } Transitions: char_lit -> 107 @@ -2529,12 +2529,12 @@ Transitions: S70{ LexTerm : ( •LexPattern ) «]» LexTerm : ( •LexPattern ) «(» + LexTerm : ( •LexPattern ) «-» LexTerm : ( •LexPattern ) «.» LexTerm : ( •LexPattern ) «[» LexTerm : ( •LexPattern ) «char_lit» LexTerm : ( •LexPattern ) «regDefId» LexTerm : ( •LexPattern ) «{» - LexTerm : ( •LexPattern ) «~» LexTerm : ( •LexPattern ) «|» LexPattern : •LexAlt «)» LexPattern : •LexPattern | LexAlt «)» @@ -2545,42 +2545,51 @@ S70{ LexTerm : •. «)» LexTerm : •char_lit «)» LexTerm : •char_lit - char_lit «)» - LexTerm : •~ char_lit «)» - LexTerm : •~ ( char_lit - char_lit ) «)» + LexTerm : •- char_lit «)» + LexTerm : •- ( char_lit - char_lit ) «)» LexTerm : •regDefId «)» LexTerm : •[ LexPattern ] «)» LexTerm : •{ LexPattern } «)» LexTerm : •( LexPattern ) «)» LexAlt : •LexTerm «(» + LexAlt : •LexTerm «-» LexAlt : •LexTerm «.» LexAlt : •LexTerm «[» LexAlt : •LexTerm «char_lit» LexAlt : •LexTerm «regDefId» LexAlt : •LexTerm «{» - LexAlt : •LexTerm «~» LexAlt : •LexAlt LexTerm «(» + LexAlt : •LexAlt LexTerm «-» LexAlt : •LexAlt LexTerm «.» LexAlt : •LexAlt LexTerm «[» LexAlt : •LexAlt LexTerm «char_lit» LexAlt : •LexAlt LexTerm «regDefId» LexAlt : •LexAlt LexTerm «{» - LexAlt : •LexAlt LexTerm «~» LexAlt : •LexTerm «|» LexAlt : •LexAlt LexTerm «|» LexTerm : •. «(» LexTerm : •char_lit «(» LexTerm : •char_lit - char_lit «(» - LexTerm : •~ char_lit «(» - LexTerm : •~ ( char_lit - char_lit ) «(» + LexTerm : •- char_lit «(» + LexTerm : •- ( char_lit - char_lit ) «(» LexTerm : •regDefId «(» LexTerm : •[ LexPattern ] «(» LexTerm : •{ LexPattern } «(» LexTerm : •( LexPattern ) «(» + LexTerm : •. «-» + LexTerm : •char_lit «-» + LexTerm : •char_lit - char_lit «-» + LexTerm : •- char_lit «-» + LexTerm : •- ( char_lit - char_lit ) «-» + LexTerm : •regDefId «-» + LexTerm : •[ LexPattern ] «-» + LexTerm : •{ LexPattern } «-» + LexTerm : •( LexPattern ) «-» LexTerm : •. «.» LexTerm : •char_lit «.» LexTerm : •char_lit - char_lit «.» - LexTerm : •~ char_lit «.» - LexTerm : •~ ( char_lit - char_lit ) «.» + LexTerm : •- char_lit «.» + LexTerm : •- ( char_lit - char_lit ) «.» LexTerm : •regDefId «.» LexTerm : •[ LexPattern ] «.» LexTerm : •{ LexPattern } «.» @@ -2588,8 +2597,8 @@ S70{ LexTerm : •. «[» LexTerm : •char_lit «[» LexTerm : •char_lit - char_lit «[» - LexTerm : •~ char_lit «[» - LexTerm : •~ ( char_lit - char_lit ) «[» + LexTerm : •- char_lit «[» + LexTerm : •- ( char_lit - char_lit ) «[» LexTerm : •regDefId «[» LexTerm : •[ LexPattern ] «[» LexTerm : •{ LexPattern } «[» @@ -2597,8 +2606,8 @@ S70{ LexTerm : •. «char_lit» LexTerm : •char_lit «char_lit» LexTerm : •char_lit - char_lit «char_lit» - LexTerm : •~ char_lit «char_lit» - LexTerm : •~ ( char_lit - char_lit ) «char_lit» + LexTerm : •- char_lit «char_lit» + LexTerm : •- ( char_lit - char_lit ) «char_lit» LexTerm : •regDefId «char_lit» LexTerm : •[ LexPattern ] «char_lit» LexTerm : •{ LexPattern } «char_lit» @@ -2606,8 +2615,8 @@ S70{ LexTerm : •. «regDefId» LexTerm : •char_lit «regDefId» LexTerm : •char_lit - char_lit «regDefId» - LexTerm : •~ char_lit «regDefId» - LexTerm : •~ ( char_lit - char_lit ) «regDefId» + LexTerm : •- char_lit «regDefId» + LexTerm : •- ( char_lit - char_lit ) «regDefId» LexTerm : •regDefId «regDefId» LexTerm : •[ LexPattern ] «regDefId» LexTerm : •{ LexPattern } «regDefId» @@ -2615,38 +2624,29 @@ S70{ LexTerm : •. «{» LexTerm : •char_lit «{» LexTerm : •char_lit - char_lit «{» - LexTerm : •~ char_lit «{» - LexTerm : •~ ( char_lit - char_lit ) «{» + LexTerm : •- char_lit «{» + LexTerm : •- ( char_lit - char_lit ) «{» LexTerm : •regDefId «{» LexTerm : •[ LexPattern ] «{» LexTerm : •{ LexPattern } «{» LexTerm : •( LexPattern ) «{» - LexTerm : •. «~» - LexTerm : •char_lit «~» - LexTerm : •char_lit - char_lit «~» - LexTerm : •~ char_lit «~» - LexTerm : •~ ( char_lit - char_lit ) «~» - LexTerm : •regDefId «~» - LexTerm : •[ LexPattern ] «~» - LexTerm : •{ LexPattern } «~» - LexTerm : •( LexPattern ) «~» LexTerm : •. «|» LexTerm : •char_lit «|» LexTerm : •char_lit - char_lit «|» - LexTerm : •~ char_lit «|» - LexTerm : •~ ( char_lit - char_lit ) «|» + LexTerm : •- char_lit «|» + LexTerm : •- ( char_lit - char_lit ) «|» LexTerm : •regDefId «|» LexTerm : •[ LexPattern ] «|» LexTerm : •{ LexPattern } «|» LexTerm : •( LexPattern ) «|» } Transitions: - regDefId -> 54 - LexAlt -> 55 - LexTerm -> 56 + LexAlt -> 54 + LexTerm -> 55 + regDefId -> 56 . -> 57 char_lit -> 58 - ~ -> 59 + - -> 59 ( -> 60 [ -> 61 { -> 62 @@ -2656,12 +2656,12 @@ Transitions: S71{ LexTerm : [ •LexPattern ] «]» LexTerm : [ •LexPattern ] «(» + LexTerm : [ •LexPattern ] «-» LexTerm : [ •LexPattern ] «.» LexTerm : [ •LexPattern ] «[» LexTerm : [ •LexPattern ] «char_lit» LexTerm : [ •LexPattern ] «regDefId» LexTerm : [ •LexPattern ] «{» - LexTerm : [ •LexPattern ] «~» LexTerm : [ •LexPattern ] «|» LexPattern : •LexAlt «]» LexPattern : •LexPattern | LexAlt «]» @@ -2672,42 +2672,51 @@ S71{ LexTerm : •. «]» LexTerm : •char_lit «]» LexTerm : •char_lit - char_lit «]» - LexTerm : •~ char_lit «]» - LexTerm : •~ ( char_lit - char_lit ) «]» + LexTerm : •- char_lit «]» + LexTerm : •- ( char_lit - char_lit ) «]» LexTerm : •regDefId «]» LexTerm : •[ LexPattern ] «]» LexTerm : •{ LexPattern } «]» LexTerm : •( LexPattern ) «]» LexAlt : •LexTerm «(» + LexAlt : •LexTerm «-» LexAlt : •LexTerm «.» LexAlt : •LexTerm «[» LexAlt : •LexTerm «char_lit» LexAlt : •LexTerm «regDefId» LexAlt : •LexTerm «{» - LexAlt : •LexTerm «~» LexAlt : •LexAlt LexTerm «(» + LexAlt : •LexAlt LexTerm «-» LexAlt : •LexAlt LexTerm «.» LexAlt : •LexAlt LexTerm «[» LexAlt : •LexAlt LexTerm «char_lit» LexAlt : •LexAlt LexTerm «regDefId» LexAlt : •LexAlt LexTerm «{» - LexAlt : •LexAlt LexTerm «~» LexAlt : •LexTerm «|» LexAlt : •LexAlt LexTerm «|» LexTerm : •. «(» LexTerm : •char_lit «(» LexTerm : •char_lit - char_lit «(» - LexTerm : •~ char_lit «(» - LexTerm : •~ ( char_lit - char_lit ) «(» + LexTerm : •- char_lit «(» + LexTerm : •- ( char_lit - char_lit ) «(» LexTerm : •regDefId «(» LexTerm : •[ LexPattern ] «(» LexTerm : •{ LexPattern } «(» LexTerm : •( LexPattern ) «(» + LexTerm : •. «-» + LexTerm : •char_lit «-» + LexTerm : •char_lit - char_lit «-» + LexTerm : •- char_lit «-» + LexTerm : •- ( char_lit - char_lit ) «-» + LexTerm : •regDefId «-» + LexTerm : •[ LexPattern ] «-» + LexTerm : •{ LexPattern } «-» + LexTerm : •( LexPattern ) «-» LexTerm : •. «.» LexTerm : •char_lit «.» LexTerm : •char_lit - char_lit «.» - LexTerm : •~ char_lit «.» - LexTerm : •~ ( char_lit - char_lit ) «.» + LexTerm : •- char_lit «.» + LexTerm : •- ( char_lit - char_lit ) «.» LexTerm : •regDefId «.» LexTerm : •[ LexPattern ] «.» LexTerm : •{ LexPattern } «.» @@ -2715,8 +2724,8 @@ S71{ LexTerm : •. «[» LexTerm : •char_lit «[» LexTerm : •char_lit - char_lit «[» - LexTerm : •~ char_lit «[» - LexTerm : •~ ( char_lit - char_lit ) «[» + LexTerm : •- char_lit «[» + LexTerm : •- ( char_lit - char_lit ) «[» LexTerm : •regDefId «[» LexTerm : •[ LexPattern ] «[» LexTerm : •{ LexPattern } «[» @@ -2724,8 +2733,8 @@ S71{ LexTerm : •. «char_lit» LexTerm : •char_lit «char_lit» LexTerm : •char_lit - char_lit «char_lit» - LexTerm : •~ char_lit «char_lit» - LexTerm : •~ ( char_lit - char_lit ) «char_lit» + LexTerm : •- char_lit «char_lit» + LexTerm : •- ( char_lit - char_lit ) «char_lit» LexTerm : •regDefId «char_lit» LexTerm : •[ LexPattern ] «char_lit» LexTerm : •{ LexPattern } «char_lit» @@ -2733,8 +2742,8 @@ S71{ LexTerm : •. «regDefId» LexTerm : •char_lit «regDefId» LexTerm : •char_lit - char_lit «regDefId» - LexTerm : •~ char_lit «regDefId» - LexTerm : •~ ( char_lit - char_lit ) «regDefId» + LexTerm : •- char_lit «regDefId» + LexTerm : •- ( char_lit - char_lit ) «regDefId» LexTerm : •regDefId «regDefId» LexTerm : •[ LexPattern ] «regDefId» LexTerm : •{ LexPattern } «regDefId» @@ -2742,38 +2751,29 @@ S71{ LexTerm : •. «{» LexTerm : •char_lit «{» LexTerm : •char_lit - char_lit «{» - LexTerm : •~ char_lit «{» - LexTerm : •~ ( char_lit - char_lit ) «{» + LexTerm : •- char_lit «{» + LexTerm : •- ( char_lit - char_lit ) «{» LexTerm : •regDefId «{» LexTerm : •[ LexPattern ] «{» LexTerm : •{ LexPattern } «{» LexTerm : •( LexPattern ) «{» - LexTerm : •. «~» - LexTerm : •char_lit «~» - LexTerm : •char_lit - char_lit «~» - LexTerm : •~ char_lit «~» - LexTerm : •~ ( char_lit - char_lit ) «~» - LexTerm : •regDefId «~» - LexTerm : •[ LexPattern ] «~» - LexTerm : •{ LexPattern } «~» - LexTerm : •( LexPattern ) «~» LexTerm : •. «|» LexTerm : •char_lit «|» LexTerm : •char_lit - char_lit «|» - LexTerm : •~ char_lit «|» - LexTerm : •~ ( char_lit - char_lit ) «|» + LexTerm : •- char_lit «|» + LexTerm : •- ( char_lit - char_lit ) «|» LexTerm : •regDefId «|» LexTerm : •[ LexPattern ] «|» LexTerm : •{ LexPattern } «|» LexTerm : •( LexPattern ) «|» } Transitions: - regDefId -> 64 - LexAlt -> 65 - LexTerm -> 66 + LexAlt -> 64 + LexTerm -> 65 + regDefId -> 66 . -> 67 char_lit -> 68 - ~ -> 69 + - -> 69 ( -> 70 [ -> 71 { -> 72 @@ -2783,12 +2783,12 @@ Transitions: S72{ LexTerm : { •LexPattern } «]» LexTerm : { •LexPattern } «(» + LexTerm : { •LexPattern } «-» LexTerm : { •LexPattern } «.» LexTerm : { •LexPattern } «[» LexTerm : { •LexPattern } «char_lit» LexTerm : { •LexPattern } «regDefId» LexTerm : { •LexPattern } «{» - LexTerm : { •LexPattern } «~» LexTerm : { •LexPattern } «|» LexPattern : •LexAlt «}» LexPattern : •LexPattern | LexAlt «}» @@ -2799,42 +2799,51 @@ S72{ LexTerm : •. «}» LexTerm : •char_lit «}» LexTerm : •char_lit - char_lit «}» - LexTerm : •~ char_lit «}» - LexTerm : •~ ( char_lit - char_lit ) «}» + LexTerm : •- char_lit «}» + LexTerm : •- ( char_lit - char_lit ) «}» LexTerm : •regDefId «}» LexTerm : •[ LexPattern ] «}» LexTerm : •{ LexPattern } «}» LexTerm : •( LexPattern ) «}» LexAlt : •LexTerm «(» + LexAlt : •LexTerm «-» LexAlt : •LexTerm «.» LexAlt : •LexTerm «[» LexAlt : •LexTerm «char_lit» LexAlt : •LexTerm «regDefId» LexAlt : •LexTerm «{» - LexAlt : •LexTerm «~» LexAlt : •LexAlt LexTerm «(» + LexAlt : •LexAlt LexTerm «-» LexAlt : •LexAlt LexTerm «.» LexAlt : •LexAlt LexTerm «[» LexAlt : •LexAlt LexTerm «char_lit» LexAlt : •LexAlt LexTerm «regDefId» LexAlt : •LexAlt LexTerm «{» - LexAlt : •LexAlt LexTerm «~» LexAlt : •LexTerm «|» LexAlt : •LexAlt LexTerm «|» LexTerm : •. «(» LexTerm : •char_lit «(» LexTerm : •char_lit - char_lit «(» - LexTerm : •~ char_lit «(» - LexTerm : •~ ( char_lit - char_lit ) «(» + LexTerm : •- char_lit «(» + LexTerm : •- ( char_lit - char_lit ) «(» LexTerm : •regDefId «(» LexTerm : •[ LexPattern ] «(» LexTerm : •{ LexPattern } «(» LexTerm : •( LexPattern ) «(» + LexTerm : •. «-» + LexTerm : •char_lit «-» + LexTerm : •char_lit - char_lit «-» + LexTerm : •- char_lit «-» + LexTerm : •- ( char_lit - char_lit ) «-» + LexTerm : •regDefId «-» + LexTerm : •[ LexPattern ] «-» + LexTerm : •{ LexPattern } «-» + LexTerm : •( LexPattern ) «-» LexTerm : •. «.» LexTerm : •char_lit «.» LexTerm : •char_lit - char_lit «.» - LexTerm : •~ char_lit «.» - LexTerm : •~ ( char_lit - char_lit ) «.» + LexTerm : •- char_lit «.» + LexTerm : •- ( char_lit - char_lit ) «.» LexTerm : •regDefId «.» LexTerm : •[ LexPattern ] «.» LexTerm : •{ LexPattern } «.» @@ -2842,8 +2851,8 @@ S72{ LexTerm : •. «[» LexTerm : •char_lit «[» LexTerm : •char_lit - char_lit «[» - LexTerm : •~ char_lit «[» - LexTerm : •~ ( char_lit - char_lit ) «[» + LexTerm : •- char_lit «[» + LexTerm : •- ( char_lit - char_lit ) «[» LexTerm : •regDefId «[» LexTerm : •[ LexPattern ] «[» LexTerm : •{ LexPattern } «[» @@ -2851,8 +2860,8 @@ S72{ LexTerm : •. «char_lit» LexTerm : •char_lit «char_lit» LexTerm : •char_lit - char_lit «char_lit» - LexTerm : •~ char_lit «char_lit» - LexTerm : •~ ( char_lit - char_lit ) «char_lit» + LexTerm : •- char_lit «char_lit» + LexTerm : •- ( char_lit - char_lit ) «char_lit» LexTerm : •regDefId «char_lit» LexTerm : •[ LexPattern ] «char_lit» LexTerm : •{ LexPattern } «char_lit» @@ -2860,8 +2869,8 @@ S72{ LexTerm : •. «regDefId» LexTerm : •char_lit «regDefId» LexTerm : •char_lit - char_lit «regDefId» - LexTerm : •~ char_lit «regDefId» - LexTerm : •~ ( char_lit - char_lit ) «regDefId» + LexTerm : •- char_lit «regDefId» + LexTerm : •- ( char_lit - char_lit ) «regDefId» LexTerm : •regDefId «regDefId» LexTerm : •[ LexPattern ] «regDefId» LexTerm : •{ LexPattern } «regDefId» @@ -2869,38 +2878,29 @@ S72{ LexTerm : •. «{» LexTerm : •char_lit «{» LexTerm : •char_lit - char_lit «{» - LexTerm : •~ char_lit «{» - LexTerm : •~ ( char_lit - char_lit ) «{» + LexTerm : •- char_lit «{» + LexTerm : •- ( char_lit - char_lit ) «{» LexTerm : •regDefId «{» LexTerm : •[ LexPattern ] «{» LexTerm : •{ LexPattern } «{» LexTerm : •( LexPattern ) «{» - LexTerm : •. «~» - LexTerm : •char_lit «~» - LexTerm : •char_lit - char_lit «~» - LexTerm : •~ char_lit «~» - LexTerm : •~ ( char_lit - char_lit ) «~» - LexTerm : •regDefId «~» - LexTerm : •[ LexPattern ] «~» - LexTerm : •{ LexPattern } «~» - LexTerm : •( LexPattern ) «~» LexTerm : •. «|» LexTerm : •char_lit «|» LexTerm : •char_lit - char_lit «|» - LexTerm : •~ char_lit «|» - LexTerm : •~ ( char_lit - char_lit ) «|» + LexTerm : •- char_lit «|» + LexTerm : •- ( char_lit - char_lit ) «|» LexTerm : •regDefId «|» LexTerm : •[ LexPattern ] «|» LexTerm : •{ LexPattern } «|» LexTerm : •( LexPattern ) «|» } Transitions: - regDefId -> 74 - LexAlt -> 75 - LexTerm -> 76 + LexAlt -> 74 + LexTerm -> 75 + regDefId -> 76 . -> 77 char_lit -> 78 - ~ -> 79 + - -> 79 ( -> 80 [ -> 81 { -> 82 @@ -2910,12 +2910,12 @@ Transitions: S73{ LexTerm : { LexPattern •} «;» LexTerm : { LexPattern •} «(» + LexTerm : { LexPattern •} «-» LexTerm : { LexPattern •} «.» LexTerm : { LexPattern •} «[» LexTerm : { LexPattern •} «char_lit» LexTerm : { LexPattern •} «regDefId» LexTerm : { LexPattern •} «{» - LexTerm : { LexPattern •} «~» LexTerm : { LexPattern •} «|» LexPattern : LexPattern •| LexAlt «}» LexPattern : LexPattern •| LexAlt «|» @@ -2926,36 +2926,22 @@ Transitions: S74{ - LexTerm : regDefId• «}» - LexTerm : regDefId• «(» - LexTerm : regDefId• «.» - LexTerm : regDefId• «[» - LexTerm : regDefId• «char_lit» - LexTerm : regDefId• «regDefId» - LexTerm : regDefId• «{» - LexTerm : regDefId• «~» - LexTerm : regDefId• «|» -} -Transitions: - - -S75{ LexPattern : LexAlt• «}» LexAlt : LexAlt •LexTerm «}» LexPattern : LexAlt• «|» LexAlt : LexAlt •LexTerm «(» + LexAlt : LexAlt •LexTerm «-» LexAlt : LexAlt •LexTerm «.» LexAlt : LexAlt •LexTerm «[» LexAlt : LexAlt •LexTerm «char_lit» LexAlt : LexAlt •LexTerm «regDefId» LexAlt : LexAlt •LexTerm «{» - LexAlt : LexAlt •LexTerm «~» LexAlt : LexAlt •LexTerm «|» LexTerm : •. «}» LexTerm : •char_lit «}» LexTerm : •char_lit - char_lit «}» - LexTerm : •~ char_lit «}» - LexTerm : •~ ( char_lit - char_lit ) «}» + LexTerm : •- char_lit «}» + LexTerm : •- ( char_lit - char_lit ) «}» LexTerm : •regDefId «}» LexTerm : •[ LexPattern ] «}» LexTerm : •{ LexPattern } «}» @@ -2963,17 +2949,26 @@ S75{ LexTerm : •. «(» LexTerm : •char_lit «(» LexTerm : •char_lit - char_lit «(» - LexTerm : •~ char_lit «(» - LexTerm : •~ ( char_lit - char_lit ) «(» + LexTerm : •- char_lit «(» + LexTerm : •- ( char_lit - char_lit ) «(» LexTerm : •regDefId «(» LexTerm : •[ LexPattern ] «(» LexTerm : •{ LexPattern } «(» LexTerm : •( LexPattern ) «(» + LexTerm : •. «-» + LexTerm : •char_lit «-» + LexTerm : •char_lit - char_lit «-» + LexTerm : •- char_lit «-» + LexTerm : •- ( char_lit - char_lit ) «-» + LexTerm : •regDefId «-» + LexTerm : •[ LexPattern ] «-» + LexTerm : •{ LexPattern } «-» + LexTerm : •( LexPattern ) «-» LexTerm : •. «.» LexTerm : •char_lit «.» LexTerm : •char_lit - char_lit «.» - LexTerm : •~ char_lit «.» - LexTerm : •~ ( char_lit - char_lit ) «.» + LexTerm : •- char_lit «.» + LexTerm : •- ( char_lit - char_lit ) «.» LexTerm : •regDefId «.» LexTerm : •[ LexPattern ] «.» LexTerm : •{ LexPattern } «.» @@ -2981,8 +2976,8 @@ S75{ LexTerm : •. «[» LexTerm : •char_lit «[» LexTerm : •char_lit - char_lit «[» - LexTerm : •~ char_lit «[» - LexTerm : •~ ( char_lit - char_lit ) «[» + LexTerm : •- char_lit «[» + LexTerm : •- ( char_lit - char_lit ) «[» LexTerm : •regDefId «[» LexTerm : •[ LexPattern ] «[» LexTerm : •{ LexPattern } «[» @@ -2990,8 +2985,8 @@ S75{ LexTerm : •. «char_lit» LexTerm : •char_lit «char_lit» LexTerm : •char_lit - char_lit «char_lit» - LexTerm : •~ char_lit «char_lit» - LexTerm : •~ ( char_lit - char_lit ) «char_lit» + LexTerm : •- char_lit «char_lit» + LexTerm : •- ( char_lit - char_lit ) «char_lit» LexTerm : •regDefId «char_lit» LexTerm : •[ LexPattern ] «char_lit» LexTerm : •{ LexPattern } «char_lit» @@ -2999,8 +2994,8 @@ S75{ LexTerm : •. «regDefId» LexTerm : •char_lit «regDefId» LexTerm : •char_lit - char_lit «regDefId» - LexTerm : •~ char_lit «regDefId» - LexTerm : •~ ( char_lit - char_lit ) «regDefId» + LexTerm : •- char_lit «regDefId» + LexTerm : •- ( char_lit - char_lit ) «regDefId» LexTerm : •regDefId «regDefId» LexTerm : •[ LexPattern ] «regDefId» LexTerm : •{ LexPattern } «regDefId» @@ -3008,65 +3003,70 @@ S75{ LexTerm : •. «{» LexTerm : •char_lit «{» LexTerm : •char_lit - char_lit «{» - LexTerm : •~ char_lit «{» - LexTerm : •~ ( char_lit - char_lit ) «{» + LexTerm : •- char_lit «{» + LexTerm : •- ( char_lit - char_lit ) «{» LexTerm : •regDefId «{» LexTerm : •[ LexPattern ] «{» LexTerm : •{ LexPattern } «{» LexTerm : •( LexPattern ) «{» - LexTerm : •. «~» - LexTerm : •char_lit «~» - LexTerm : •char_lit - char_lit «~» - LexTerm : •~ char_lit «~» - LexTerm : •~ ( char_lit - char_lit ) «~» - LexTerm : •regDefId «~» - LexTerm : •[ LexPattern ] «~» - LexTerm : •{ LexPattern } «~» - LexTerm : •( LexPattern ) «~» LexTerm : •. «|» LexTerm : •char_lit «|» LexTerm : •char_lit - char_lit «|» - LexTerm : •~ char_lit «|» - LexTerm : •~ ( char_lit - char_lit ) «|» + LexTerm : •- char_lit «|» + LexTerm : •- ( char_lit - char_lit ) «|» LexTerm : •regDefId «|» LexTerm : •[ LexPattern ] «|» LexTerm : •{ LexPattern } «|» LexTerm : •( LexPattern ) «|» } Transitions: - regDefId -> 74 + regDefId -> 76 . -> 77 char_lit -> 78 - ~ -> 79 + - -> 79 ( -> 80 [ -> 81 { -> 82 LexTerm -> 114 -S76{ +S75{ LexAlt : LexTerm• «}» LexAlt : LexTerm• «(» + LexAlt : LexTerm• «-» LexAlt : LexTerm• «.» LexAlt : LexTerm• «[» LexAlt : LexTerm• «char_lit» LexAlt : LexTerm• «regDefId» LexAlt : LexTerm• «{» - LexAlt : LexTerm• «~» LexAlt : LexTerm• «|» } Transitions: +S76{ + LexTerm : regDefId• «}» + LexTerm : regDefId• «(» + LexTerm : regDefId• «-» + LexTerm : regDefId• «.» + LexTerm : regDefId• «[» + LexTerm : regDefId• «char_lit» + LexTerm : regDefId• «regDefId» + LexTerm : regDefId• «{» + LexTerm : regDefId• «|» +} +Transitions: + + S77{ LexTerm : .• «}» LexTerm : .• «(» + LexTerm : .• «-» LexTerm : .• «.» LexTerm : .• «[» LexTerm : .• «char_lit» LexTerm : .• «regDefId» LexTerm : .• «{» - LexTerm : .• «~» LexTerm : .• «|» } Transitions: @@ -3077,6 +3077,8 @@ S78{ LexTerm : char_lit •- char_lit «}» LexTerm : char_lit• «(» LexTerm : char_lit •- char_lit «(» + LexTerm : char_lit• «-» + LexTerm : char_lit •- char_lit «-» LexTerm : char_lit• «.» LexTerm : char_lit •- char_lit «.» LexTerm : char_lit• «[» @@ -3087,8 +3089,6 @@ S78{ LexTerm : char_lit •- char_lit «regDefId» LexTerm : char_lit• «{» LexTerm : char_lit •- char_lit «{» - LexTerm : char_lit• «~» - LexTerm : char_lit •- char_lit «~» LexTerm : char_lit• «|» LexTerm : char_lit •- char_lit «|» } @@ -3097,24 +3097,24 @@ Transitions: S79{ - LexTerm : ~ •char_lit «}» - LexTerm : ~ •( char_lit - char_lit ) «}» - LexTerm : ~ •char_lit «(» - LexTerm : ~ •( char_lit - char_lit ) «(» - LexTerm : ~ •char_lit «.» - LexTerm : ~ •( char_lit - char_lit ) «.» - LexTerm : ~ •char_lit «[» - LexTerm : ~ •( char_lit - char_lit ) «[» - LexTerm : ~ •char_lit «char_lit» - LexTerm : ~ •( char_lit - char_lit ) «char_lit» - LexTerm : ~ •char_lit «regDefId» - LexTerm : ~ •( char_lit - char_lit ) «regDefId» - LexTerm : ~ •char_lit «{» - LexTerm : ~ •( char_lit - char_lit ) «{» - LexTerm : ~ •char_lit «~» - LexTerm : ~ •( char_lit - char_lit ) «~» - LexTerm : ~ •char_lit «|» - LexTerm : ~ •( char_lit - char_lit ) «|» + LexTerm : - •char_lit «}» + LexTerm : - •( char_lit - char_lit ) «}» + LexTerm : - •char_lit «(» + LexTerm : - •( char_lit - char_lit ) «(» + LexTerm : - •char_lit «-» + LexTerm : - •( char_lit - char_lit ) «-» + LexTerm : - •char_lit «.» + LexTerm : - •( char_lit - char_lit ) «.» + LexTerm : - •char_lit «[» + LexTerm : - •( char_lit - char_lit ) «[» + LexTerm : - •char_lit «char_lit» + LexTerm : - •( char_lit - char_lit ) «char_lit» + LexTerm : - •char_lit «regDefId» + LexTerm : - •( char_lit - char_lit ) «regDefId» + LexTerm : - •char_lit «{» + LexTerm : - •( char_lit - char_lit ) «{» + LexTerm : - •char_lit «|» + LexTerm : - •( char_lit - char_lit ) «|» } Transitions: char_lit -> 116 @@ -3124,12 +3124,12 @@ Transitions: S80{ LexTerm : ( •LexPattern ) «}» LexTerm : ( •LexPattern ) «(» + LexTerm : ( •LexPattern ) «-» LexTerm : ( •LexPattern ) «.» LexTerm : ( •LexPattern ) «[» LexTerm : ( •LexPattern ) «char_lit» LexTerm : ( •LexPattern ) «regDefId» LexTerm : ( •LexPattern ) «{» - LexTerm : ( •LexPattern ) «~» LexTerm : ( •LexPattern ) «|» LexPattern : •LexAlt «)» LexPattern : •LexPattern | LexAlt «)» @@ -3140,42 +3140,51 @@ S80{ LexTerm : •. «)» LexTerm : •char_lit «)» LexTerm : •char_lit - char_lit «)» - LexTerm : •~ char_lit «)» - LexTerm : •~ ( char_lit - char_lit ) «)» + LexTerm : •- char_lit «)» + LexTerm : •- ( char_lit - char_lit ) «)» LexTerm : •regDefId «)» LexTerm : •[ LexPattern ] «)» LexTerm : •{ LexPattern } «)» LexTerm : •( LexPattern ) «)» LexAlt : •LexTerm «(» + LexAlt : •LexTerm «-» LexAlt : •LexTerm «.» LexAlt : •LexTerm «[» LexAlt : •LexTerm «char_lit» LexAlt : •LexTerm «regDefId» LexAlt : •LexTerm «{» - LexAlt : •LexTerm «~» LexAlt : •LexAlt LexTerm «(» + LexAlt : •LexAlt LexTerm «-» LexAlt : •LexAlt LexTerm «.» LexAlt : •LexAlt LexTerm «[» LexAlt : •LexAlt LexTerm «char_lit» LexAlt : •LexAlt LexTerm «regDefId» LexAlt : •LexAlt LexTerm «{» - LexAlt : •LexAlt LexTerm «~» LexAlt : •LexTerm «|» LexAlt : •LexAlt LexTerm «|» LexTerm : •. «(» LexTerm : •char_lit «(» LexTerm : •char_lit - char_lit «(» - LexTerm : •~ char_lit «(» - LexTerm : •~ ( char_lit - char_lit ) «(» + LexTerm : •- char_lit «(» + LexTerm : •- ( char_lit - char_lit ) «(» LexTerm : •regDefId «(» LexTerm : •[ LexPattern ] «(» LexTerm : •{ LexPattern } «(» LexTerm : •( LexPattern ) «(» + LexTerm : •. «-» + LexTerm : •char_lit «-» + LexTerm : •char_lit - char_lit «-» + LexTerm : •- char_lit «-» + LexTerm : •- ( char_lit - char_lit ) «-» + LexTerm : •regDefId «-» + LexTerm : •[ LexPattern ] «-» + LexTerm : •{ LexPattern } «-» + LexTerm : •( LexPattern ) «-» LexTerm : •. «.» LexTerm : •char_lit «.» LexTerm : •char_lit - char_lit «.» - LexTerm : •~ char_lit «.» - LexTerm : •~ ( char_lit - char_lit ) «.» + LexTerm : •- char_lit «.» + LexTerm : •- ( char_lit - char_lit ) «.» LexTerm : •regDefId «.» LexTerm : •[ LexPattern ] «.» LexTerm : •{ LexPattern } «.» @@ -3183,8 +3192,8 @@ S80{ LexTerm : •. «[» LexTerm : •char_lit «[» LexTerm : •char_lit - char_lit «[» - LexTerm : •~ char_lit «[» - LexTerm : •~ ( char_lit - char_lit ) «[» + LexTerm : •- char_lit «[» + LexTerm : •- ( char_lit - char_lit ) «[» LexTerm : •regDefId «[» LexTerm : •[ LexPattern ] «[» LexTerm : •{ LexPattern } «[» @@ -3192,8 +3201,8 @@ S80{ LexTerm : •. «char_lit» LexTerm : •char_lit «char_lit» LexTerm : •char_lit - char_lit «char_lit» - LexTerm : •~ char_lit «char_lit» - LexTerm : •~ ( char_lit - char_lit ) «char_lit» + LexTerm : •- char_lit «char_lit» + LexTerm : •- ( char_lit - char_lit ) «char_lit» LexTerm : •regDefId «char_lit» LexTerm : •[ LexPattern ] «char_lit» LexTerm : •{ LexPattern } «char_lit» @@ -3201,8 +3210,8 @@ S80{ LexTerm : •. «regDefId» LexTerm : •char_lit «regDefId» LexTerm : •char_lit - char_lit «regDefId» - LexTerm : •~ char_lit «regDefId» - LexTerm : •~ ( char_lit - char_lit ) «regDefId» + LexTerm : •- char_lit «regDefId» + LexTerm : •- ( char_lit - char_lit ) «regDefId» LexTerm : •regDefId «regDefId» LexTerm : •[ LexPattern ] «regDefId» LexTerm : •{ LexPattern } «regDefId» @@ -3210,38 +3219,29 @@ S80{ LexTerm : •. «{» LexTerm : •char_lit «{» LexTerm : •char_lit - char_lit «{» - LexTerm : •~ char_lit «{» - LexTerm : •~ ( char_lit - char_lit ) «{» + LexTerm : •- char_lit «{» + LexTerm : •- ( char_lit - char_lit ) «{» LexTerm : •regDefId «{» LexTerm : •[ LexPattern ] «{» LexTerm : •{ LexPattern } «{» LexTerm : •( LexPattern ) «{» - LexTerm : •. «~» - LexTerm : •char_lit «~» - LexTerm : •char_lit - char_lit «~» - LexTerm : •~ char_lit «~» - LexTerm : •~ ( char_lit - char_lit ) «~» - LexTerm : •regDefId «~» - LexTerm : •[ LexPattern ] «~» - LexTerm : •{ LexPattern } «~» - LexTerm : •( LexPattern ) «~» LexTerm : •. «|» LexTerm : •char_lit «|» LexTerm : •char_lit - char_lit «|» - LexTerm : •~ char_lit «|» - LexTerm : •~ ( char_lit - char_lit ) «|» + LexTerm : •- char_lit «|» + LexTerm : •- ( char_lit - char_lit ) «|» LexTerm : •regDefId «|» LexTerm : •[ LexPattern ] «|» LexTerm : •{ LexPattern } «|» LexTerm : •( LexPattern ) «|» } Transitions: - regDefId -> 54 - LexAlt -> 55 - LexTerm -> 56 + LexAlt -> 54 + LexTerm -> 55 + regDefId -> 56 . -> 57 char_lit -> 58 - ~ -> 59 + - -> 59 ( -> 60 [ -> 61 { -> 62 @@ -3251,12 +3251,12 @@ Transitions: S81{ LexTerm : [ •LexPattern ] «}» LexTerm : [ •LexPattern ] «(» + LexTerm : [ •LexPattern ] «-» LexTerm : [ •LexPattern ] «.» LexTerm : [ •LexPattern ] «[» LexTerm : [ •LexPattern ] «char_lit» LexTerm : [ •LexPattern ] «regDefId» LexTerm : [ •LexPattern ] «{» - LexTerm : [ •LexPattern ] «~» LexTerm : [ •LexPattern ] «|» LexPattern : •LexAlt «]» LexPattern : •LexPattern | LexAlt «]» @@ -3267,42 +3267,51 @@ S81{ LexTerm : •. «]» LexTerm : •char_lit «]» LexTerm : •char_lit - char_lit «]» - LexTerm : •~ char_lit «]» - LexTerm : •~ ( char_lit - char_lit ) «]» + LexTerm : •- char_lit «]» + LexTerm : •- ( char_lit - char_lit ) «]» LexTerm : •regDefId «]» LexTerm : •[ LexPattern ] «]» LexTerm : •{ LexPattern } «]» LexTerm : •( LexPattern ) «]» LexAlt : •LexTerm «(» + LexAlt : •LexTerm «-» LexAlt : •LexTerm «.» LexAlt : •LexTerm «[» LexAlt : •LexTerm «char_lit» LexAlt : •LexTerm «regDefId» LexAlt : •LexTerm «{» - LexAlt : •LexTerm «~» LexAlt : •LexAlt LexTerm «(» + LexAlt : •LexAlt LexTerm «-» LexAlt : •LexAlt LexTerm «.» LexAlt : •LexAlt LexTerm «[» LexAlt : •LexAlt LexTerm «char_lit» LexAlt : •LexAlt LexTerm «regDefId» LexAlt : •LexAlt LexTerm «{» - LexAlt : •LexAlt LexTerm «~» LexAlt : •LexTerm «|» LexAlt : •LexAlt LexTerm «|» LexTerm : •. «(» LexTerm : •char_lit «(» LexTerm : •char_lit - char_lit «(» - LexTerm : •~ char_lit «(» - LexTerm : •~ ( char_lit - char_lit ) «(» + LexTerm : •- char_lit «(» + LexTerm : •- ( char_lit - char_lit ) «(» LexTerm : •regDefId «(» LexTerm : •[ LexPattern ] «(» LexTerm : •{ LexPattern } «(» LexTerm : •( LexPattern ) «(» + LexTerm : •. «-» + LexTerm : •char_lit «-» + LexTerm : •char_lit - char_lit «-» + LexTerm : •- char_lit «-» + LexTerm : •- ( char_lit - char_lit ) «-» + LexTerm : •regDefId «-» + LexTerm : •[ LexPattern ] «-» + LexTerm : •{ LexPattern } «-» + LexTerm : •( LexPattern ) «-» LexTerm : •. «.» LexTerm : •char_lit «.» LexTerm : •char_lit - char_lit «.» - LexTerm : •~ char_lit «.» - LexTerm : •~ ( char_lit - char_lit ) «.» + LexTerm : •- char_lit «.» + LexTerm : •- ( char_lit - char_lit ) «.» LexTerm : •regDefId «.» LexTerm : •[ LexPattern ] «.» LexTerm : •{ LexPattern } «.» @@ -3310,8 +3319,8 @@ S81{ LexTerm : •. «[» LexTerm : •char_lit «[» LexTerm : •char_lit - char_lit «[» - LexTerm : •~ char_lit «[» - LexTerm : •~ ( char_lit - char_lit ) «[» + LexTerm : •- char_lit «[» + LexTerm : •- ( char_lit - char_lit ) «[» LexTerm : •regDefId «[» LexTerm : •[ LexPattern ] «[» LexTerm : •{ LexPattern } «[» @@ -3319,8 +3328,8 @@ S81{ LexTerm : •. «char_lit» LexTerm : •char_lit «char_lit» LexTerm : •char_lit - char_lit «char_lit» - LexTerm : •~ char_lit «char_lit» - LexTerm : •~ ( char_lit - char_lit ) «char_lit» + LexTerm : •- char_lit «char_lit» + LexTerm : •- ( char_lit - char_lit ) «char_lit» LexTerm : •regDefId «char_lit» LexTerm : •[ LexPattern ] «char_lit» LexTerm : •{ LexPattern } «char_lit» @@ -3328,8 +3337,8 @@ S81{ LexTerm : •. «regDefId» LexTerm : •char_lit «regDefId» LexTerm : •char_lit - char_lit «regDefId» - LexTerm : •~ char_lit «regDefId» - LexTerm : •~ ( char_lit - char_lit ) «regDefId» + LexTerm : •- char_lit «regDefId» + LexTerm : •- ( char_lit - char_lit ) «regDefId» LexTerm : •regDefId «regDefId» LexTerm : •[ LexPattern ] «regDefId» LexTerm : •{ LexPattern } «regDefId» @@ -3337,38 +3346,29 @@ S81{ LexTerm : •. «{» LexTerm : •char_lit «{» LexTerm : •char_lit - char_lit «{» - LexTerm : •~ char_lit «{» - LexTerm : •~ ( char_lit - char_lit ) «{» + LexTerm : •- char_lit «{» + LexTerm : •- ( char_lit - char_lit ) «{» LexTerm : •regDefId «{» LexTerm : •[ LexPattern ] «{» LexTerm : •{ LexPattern } «{» LexTerm : •( LexPattern ) «{» - LexTerm : •. «~» - LexTerm : •char_lit «~» - LexTerm : •char_lit - char_lit «~» - LexTerm : •~ char_lit «~» - LexTerm : •~ ( char_lit - char_lit ) «~» - LexTerm : •regDefId «~» - LexTerm : •[ LexPattern ] «~» - LexTerm : •{ LexPattern } «~» - LexTerm : •( LexPattern ) «~» LexTerm : •. «|» LexTerm : •char_lit «|» LexTerm : •char_lit - char_lit «|» - LexTerm : •~ char_lit «|» - LexTerm : •~ ( char_lit - char_lit ) «|» + LexTerm : •- char_lit «|» + LexTerm : •- ( char_lit - char_lit ) «|» LexTerm : •regDefId «|» LexTerm : •[ LexPattern ] «|» LexTerm : •{ LexPattern } «|» LexTerm : •( LexPattern ) «|» } Transitions: - regDefId -> 64 - LexAlt -> 65 - LexTerm -> 66 + LexAlt -> 64 + LexTerm -> 65 + regDefId -> 66 . -> 67 char_lit -> 68 - ~ -> 69 + - -> 69 ( -> 70 [ -> 71 { -> 72 @@ -3378,12 +3378,12 @@ Transitions: S82{ LexTerm : { •LexPattern } «}» LexTerm : { •LexPattern } «(» + LexTerm : { •LexPattern } «-» LexTerm : { •LexPattern } «.» LexTerm : { •LexPattern } «[» LexTerm : { •LexPattern } «char_lit» LexTerm : { •LexPattern } «regDefId» LexTerm : { •LexPattern } «{» - LexTerm : { •LexPattern } «~» LexTerm : { •LexPattern } «|» LexPattern : •LexAlt «}» LexPattern : •LexPattern | LexAlt «}» @@ -3394,42 +3394,51 @@ S82{ LexTerm : •. «}» LexTerm : •char_lit «}» LexTerm : •char_lit - char_lit «}» - LexTerm : •~ char_lit «}» - LexTerm : •~ ( char_lit - char_lit ) «}» + LexTerm : •- char_lit «}» + LexTerm : •- ( char_lit - char_lit ) «}» LexTerm : •regDefId «}» LexTerm : •[ LexPattern ] «}» LexTerm : •{ LexPattern } «}» LexTerm : •( LexPattern ) «}» LexAlt : •LexTerm «(» + LexAlt : •LexTerm «-» LexAlt : •LexTerm «.» LexAlt : •LexTerm «[» LexAlt : •LexTerm «char_lit» LexAlt : •LexTerm «regDefId» LexAlt : •LexTerm «{» - LexAlt : •LexTerm «~» LexAlt : •LexAlt LexTerm «(» + LexAlt : •LexAlt LexTerm «-» LexAlt : •LexAlt LexTerm «.» LexAlt : •LexAlt LexTerm «[» LexAlt : •LexAlt LexTerm «char_lit» LexAlt : •LexAlt LexTerm «regDefId» LexAlt : •LexAlt LexTerm «{» - LexAlt : •LexAlt LexTerm «~» LexAlt : •LexTerm «|» LexAlt : •LexAlt LexTerm «|» LexTerm : •. «(» LexTerm : •char_lit «(» LexTerm : •char_lit - char_lit «(» - LexTerm : •~ char_lit «(» - LexTerm : •~ ( char_lit - char_lit ) «(» + LexTerm : •- char_lit «(» + LexTerm : •- ( char_lit - char_lit ) «(» LexTerm : •regDefId «(» LexTerm : •[ LexPattern ] «(» LexTerm : •{ LexPattern } «(» LexTerm : •( LexPattern ) «(» + LexTerm : •. «-» + LexTerm : •char_lit «-» + LexTerm : •char_lit - char_lit «-» + LexTerm : •- char_lit «-» + LexTerm : •- ( char_lit - char_lit ) «-» + LexTerm : •regDefId «-» + LexTerm : •[ LexPattern ] «-» + LexTerm : •{ LexPattern } «-» + LexTerm : •( LexPattern ) «-» LexTerm : •. «.» LexTerm : •char_lit «.» LexTerm : •char_lit - char_lit «.» - LexTerm : •~ char_lit «.» - LexTerm : •~ ( char_lit - char_lit ) «.» + LexTerm : •- char_lit «.» + LexTerm : •- ( char_lit - char_lit ) «.» LexTerm : •regDefId «.» LexTerm : •[ LexPattern ] «.» LexTerm : •{ LexPattern } «.» @@ -3437,8 +3446,8 @@ S82{ LexTerm : •. «[» LexTerm : •char_lit «[» LexTerm : •char_lit - char_lit «[» - LexTerm : •~ char_lit «[» - LexTerm : •~ ( char_lit - char_lit ) «[» + LexTerm : •- char_lit «[» + LexTerm : •- ( char_lit - char_lit ) «[» LexTerm : •regDefId «[» LexTerm : •[ LexPattern ] «[» LexTerm : •{ LexPattern } «[» @@ -3446,8 +3455,8 @@ S82{ LexTerm : •. «char_lit» LexTerm : •char_lit «char_lit» LexTerm : •char_lit - char_lit «char_lit» - LexTerm : •~ char_lit «char_lit» - LexTerm : •~ ( char_lit - char_lit ) «char_lit» + LexTerm : •- char_lit «char_lit» + LexTerm : •- ( char_lit - char_lit ) «char_lit» LexTerm : •regDefId «char_lit» LexTerm : •[ LexPattern ] «char_lit» LexTerm : •{ LexPattern } «char_lit» @@ -3455,8 +3464,8 @@ S82{ LexTerm : •. «regDefId» LexTerm : •char_lit «regDefId» LexTerm : •char_lit - char_lit «regDefId» - LexTerm : •~ char_lit «regDefId» - LexTerm : •~ ( char_lit - char_lit ) «regDefId» + LexTerm : •- char_lit «regDefId» + LexTerm : •- ( char_lit - char_lit ) «regDefId» LexTerm : •regDefId «regDefId» LexTerm : •[ LexPattern ] «regDefId» LexTerm : •{ LexPattern } «regDefId» @@ -3464,38 +3473,29 @@ S82{ LexTerm : •. «{» LexTerm : •char_lit «{» LexTerm : •char_lit - char_lit «{» - LexTerm : •~ char_lit «{» - LexTerm : •~ ( char_lit - char_lit ) «{» + LexTerm : •- char_lit «{» + LexTerm : •- ( char_lit - char_lit ) «{» LexTerm : •regDefId «{» LexTerm : •[ LexPattern ] «{» LexTerm : •{ LexPattern } «{» LexTerm : •( LexPattern ) «{» - LexTerm : •. «~» - LexTerm : •char_lit «~» - LexTerm : •char_lit - char_lit «~» - LexTerm : •~ char_lit «~» - LexTerm : •~ ( char_lit - char_lit ) «~» - LexTerm : •regDefId «~» - LexTerm : •[ LexPattern ] «~» - LexTerm : •{ LexPattern } «~» - LexTerm : •( LexPattern ) «~» LexTerm : •. «|» LexTerm : •char_lit «|» LexTerm : •char_lit - char_lit «|» - LexTerm : •~ char_lit «|» - LexTerm : •~ ( char_lit - char_lit ) «|» + LexTerm : •- char_lit «|» + LexTerm : •- ( char_lit - char_lit ) «|» LexTerm : •regDefId «|» LexTerm : •[ LexPattern ] «|» LexTerm : •{ LexPattern } «|» LexTerm : •( LexPattern ) «|» } Transitions: - regDefId -> 74 - LexAlt -> 75 - LexTerm -> 76 + LexAlt -> 74 + LexTerm -> 75 + regDefId -> 76 . -> 77 char_lit -> 78 - ~ -> 79 + - -> 79 ( -> 80 [ -> 81 { -> 82 @@ -3552,21 +3552,21 @@ S86{ Symbols : •Symbols Symbol «;» Symbols : •Symbol «g_sdt_lit» Symbols : •Symbols Symbol «g_sdt_lit» - ErrorSymbol : •errore «;» + ErrorSymbol : •error «;» ErrorSymbol : •λ «;» - ErrorSymbol : •errore «prodId» - ErrorSymbol : •errore «string_lit» - ErrorSymbol : •errore «tokId» + ErrorSymbol : •error «prodId» + ErrorSymbol : •error «string_lit» + ErrorSymbol : •error «tokId» ErrorSymbol : •λ «prodId» ErrorSymbol : •λ «string_lit» ErrorSymbol : •λ «tokId» - ErrorSymbol : •errore «g_sdt_lit» + ErrorSymbol : •error «g_sdt_lit» ErrorSymbol : •λ «g_sdt_lit» EpsilonSymbol : •empty «;» EpsilonSymbol : •ε «;» Symbols : •Symbol «|» Symbols : •Symbols Symbol «|» - ErrorSymbol : •errore «|» + ErrorSymbol : •error «|» ErrorSymbol : •λ «|» EpsilonSymbol : •empty «|» EpsilonSymbol : •ε «|» @@ -3596,14 +3596,14 @@ S86{ Symbol : •string_lit «tokId» } Transitions: - tokId -> 34 - prodId -> 35 - Symbols -> 38 - ErrorSymbol -> 39 - EpsilonSymbol -> 40 - Symbol -> 41 + Symbols -> 36 + Symbol -> 37 + ErrorSymbol -> 38 + EpsilonSymbol -> 39 + tokId -> 40 + prodId -> 41 string_lit -> 42 - errore -> 43 + error -> 43 λ -> 44 empty -> 45 ε -> 46 @@ -3611,13 +3611,6 @@ Transitions: S87{ - SyntaxBody : Symbols g_sdt_lit• «;» - SyntaxBody : Symbols g_sdt_lit• «|» -} -Transitions: - - -S88{ Symbols : Symbols Symbol• «;» Symbols : Symbols Symbol• «g_sdt_lit» Symbols : Symbols Symbol• «prodId» @@ -3628,14 +3621,14 @@ S88{ Transitions: -S89{ - SyntaxBody : ErrorSymbol g_sdt_lit• «;» - SyntaxBody : ErrorSymbol g_sdt_lit• «|» +S88{ + SyntaxBody : Symbols g_sdt_lit• «;» + SyntaxBody : Symbols g_sdt_lit• «|» } Transitions: -S90{ +S89{ SyntaxBody : ErrorSymbol Symbols• «;» SyntaxBody : ErrorSymbol Symbols •g_sdt_lit «;» SyntaxBody : ErrorSymbol Symbols• «|» @@ -3666,30 +3659,37 @@ S90{ Symbol : •string_lit «tokId» } Transitions: - tokId -> 34 - prodId -> 35 + tokId -> 40 + prodId -> 41 string_lit -> 42 - Symbol -> 88 + Symbol -> 87 g_sdt_lit -> 122 +S90{ + SyntaxBody : ErrorSymbol g_sdt_lit• «;» + SyntaxBody : ErrorSymbol g_sdt_lit• «|» +} +Transitions: + + S91{ LexPattern : LexPattern | LexAlt• «;» LexPattern : LexPattern | LexAlt• «|» LexAlt : LexAlt •LexTerm «;» LexAlt : LexAlt •LexTerm «|» LexAlt : LexAlt •LexTerm «(» + LexAlt : LexAlt •LexTerm «-» LexAlt : LexAlt •LexTerm «.» LexAlt : LexAlt •LexTerm «[» LexAlt : LexAlt •LexTerm «char_lit» LexAlt : LexAlt •LexTerm «regDefId» LexAlt : LexAlt •LexTerm «{» - LexAlt : LexAlt •LexTerm «~» LexTerm : •. «;» LexTerm : •char_lit «;» LexTerm : •char_lit - char_lit «;» - LexTerm : •~ char_lit «;» - LexTerm : •~ ( char_lit - char_lit ) «;» + LexTerm : •- char_lit «;» + LexTerm : •- ( char_lit - char_lit ) «;» LexTerm : •regDefId «;» LexTerm : •[ LexPattern ] «;» LexTerm : •{ LexPattern } «;» @@ -3697,8 +3697,8 @@ S91{ LexTerm : •. «|» LexTerm : •char_lit «|» LexTerm : •char_lit - char_lit «|» - LexTerm : •~ char_lit «|» - LexTerm : •~ ( char_lit - char_lit ) «|» + LexTerm : •- char_lit «|» + LexTerm : •- ( char_lit - char_lit ) «|» LexTerm : •regDefId «|» LexTerm : •[ LexPattern ] «|» LexTerm : •{ LexPattern } «|» @@ -3706,17 +3706,26 @@ S91{ LexTerm : •. «(» LexTerm : •char_lit «(» LexTerm : •char_lit - char_lit «(» - LexTerm : •~ char_lit «(» - LexTerm : •~ ( char_lit - char_lit ) «(» + LexTerm : •- char_lit «(» + LexTerm : •- ( char_lit - char_lit ) «(» LexTerm : •regDefId «(» LexTerm : •[ LexPattern ] «(» LexTerm : •{ LexPattern } «(» LexTerm : •( LexPattern ) «(» + LexTerm : •. «-» + LexTerm : •char_lit «-» + LexTerm : •char_lit - char_lit «-» + LexTerm : •- char_lit «-» + LexTerm : •- ( char_lit - char_lit ) «-» + LexTerm : •regDefId «-» + LexTerm : •[ LexPattern ] «-» + LexTerm : •{ LexPattern } «-» + LexTerm : •( LexPattern ) «-» LexTerm : •. «.» LexTerm : •char_lit «.» LexTerm : •char_lit - char_lit «.» - LexTerm : •~ char_lit «.» - LexTerm : •~ ( char_lit - char_lit ) «.» + LexTerm : •- char_lit «.» + LexTerm : •- ( char_lit - char_lit ) «.» LexTerm : •regDefId «.» LexTerm : •[ LexPattern ] «.» LexTerm : •{ LexPattern } «.» @@ -3724,8 +3733,8 @@ S91{ LexTerm : •. «[» LexTerm : •char_lit «[» LexTerm : •char_lit - char_lit «[» - LexTerm : •~ char_lit «[» - LexTerm : •~ ( char_lit - char_lit ) «[» + LexTerm : •- char_lit «[» + LexTerm : •- ( char_lit - char_lit ) «[» LexTerm : •regDefId «[» LexTerm : •[ LexPattern ] «[» LexTerm : •{ LexPattern } «[» @@ -3733,8 +3742,8 @@ S91{ LexTerm : •. «char_lit» LexTerm : •char_lit «char_lit» LexTerm : •char_lit - char_lit «char_lit» - LexTerm : •~ char_lit «char_lit» - LexTerm : •~ ( char_lit - char_lit ) «char_lit» + LexTerm : •- char_lit «char_lit» + LexTerm : •- ( char_lit - char_lit ) «char_lit» LexTerm : •regDefId «char_lit» LexTerm : •[ LexPattern ] «char_lit» LexTerm : •{ LexPattern } «char_lit» @@ -3742,8 +3751,8 @@ S91{ LexTerm : •. «regDefId» LexTerm : •char_lit «regDefId» LexTerm : •char_lit - char_lit «regDefId» - LexTerm : •~ char_lit «regDefId» - LexTerm : •~ ( char_lit - char_lit ) «regDefId» + LexTerm : •- char_lit «regDefId» + LexTerm : •- ( char_lit - char_lit ) «regDefId» LexTerm : •regDefId «regDefId» LexTerm : •[ LexPattern ] «regDefId» LexTerm : •{ LexPattern } «regDefId» @@ -3751,27 +3760,18 @@ S91{ LexTerm : •. «{» LexTerm : •char_lit «{» LexTerm : •char_lit - char_lit «{» - LexTerm : •~ char_lit «{» - LexTerm : •~ ( char_lit - char_lit ) «{» + LexTerm : •- char_lit «{» + LexTerm : •- ( char_lit - char_lit ) «{» LexTerm : •regDefId «{» LexTerm : •[ LexPattern ] «{» LexTerm : •{ LexPattern } «{» LexTerm : •( LexPattern ) «{» - LexTerm : •. «~» - LexTerm : •char_lit «~» - LexTerm : •char_lit - char_lit «~» - LexTerm : •~ char_lit «~» - LexTerm : •~ ( char_lit - char_lit ) «~» - LexTerm : •regDefId «~» - LexTerm : •[ LexPattern ] «~» - LexTerm : •{ LexPattern } «~» - LexTerm : •( LexPattern ) «~» -} -Transitions: - regDefId -> 23 +} +Transitions: + regDefId -> 25 . -> 26 char_lit -> 27 - ~ -> 28 + - -> 28 ( -> 29 [ -> 30 { -> 31 @@ -3781,27 +3781,27 @@ Transitions: S92{ LexTerm : char_lit - char_lit• «;» LexTerm : char_lit - char_lit• «(» + LexTerm : char_lit - char_lit• «-» LexTerm : char_lit - char_lit• «.» LexTerm : char_lit - char_lit• «[» LexTerm : char_lit - char_lit• «char_lit» LexTerm : char_lit - char_lit• «regDefId» LexTerm : char_lit - char_lit• «{» - LexTerm : char_lit - char_lit• «~» LexTerm : char_lit - char_lit• «|» } Transitions: S93{ - LexTerm : ~ ( char_lit •- char_lit ) «;» - LexTerm : ~ ( char_lit •- char_lit ) «(» - LexTerm : ~ ( char_lit •- char_lit ) «.» - LexTerm : ~ ( char_lit •- char_lit ) «[» - LexTerm : ~ ( char_lit •- char_lit ) «char_lit» - LexTerm : ~ ( char_lit •- char_lit ) «regDefId» - LexTerm : ~ ( char_lit •- char_lit ) «{» - LexTerm : ~ ( char_lit •- char_lit ) «~» - LexTerm : ~ ( char_lit •- char_lit ) «|» + LexTerm : - ( char_lit •- char_lit ) «;» + LexTerm : - ( char_lit •- char_lit ) «(» + LexTerm : - ( char_lit •- char_lit ) «-» + LexTerm : - ( char_lit •- char_lit ) «.» + LexTerm : - ( char_lit •- char_lit ) «[» + LexTerm : - ( char_lit •- char_lit ) «char_lit» + LexTerm : - ( char_lit •- char_lit ) «regDefId» + LexTerm : - ( char_lit •- char_lit ) «{» + LexTerm : - ( char_lit •- char_lit ) «|» } Transitions: - -> 123 @@ -3817,31 +3817,31 @@ S94{ LexTerm : •. «)» LexTerm : •char_lit «)» LexTerm : •char_lit - char_lit «)» - LexTerm : •~ char_lit «)» - LexTerm : •~ ( char_lit - char_lit ) «)» + LexTerm : •- char_lit «)» + LexTerm : •- ( char_lit - char_lit ) «)» LexTerm : •regDefId «)» LexTerm : •[ LexPattern ] «)» LexTerm : •{ LexPattern } «)» LexTerm : •( LexPattern ) «)» LexAlt : •LexTerm «(» + LexAlt : •LexTerm «-» LexAlt : •LexTerm «.» LexAlt : •LexTerm «[» LexAlt : •LexTerm «char_lit» LexAlt : •LexTerm «regDefId» LexAlt : •LexTerm «{» - LexAlt : •LexTerm «~» LexAlt : •LexAlt LexTerm «(» + LexAlt : •LexAlt LexTerm «-» LexAlt : •LexAlt LexTerm «.» LexAlt : •LexAlt LexTerm «[» LexAlt : •LexAlt LexTerm «char_lit» LexAlt : •LexAlt LexTerm «regDefId» LexAlt : •LexAlt LexTerm «{» - LexAlt : •LexAlt LexTerm «~» LexTerm : •. «|» LexTerm : •char_lit «|» LexTerm : •char_lit - char_lit «|» - LexTerm : •~ char_lit «|» - LexTerm : •~ ( char_lit - char_lit ) «|» + LexTerm : •- char_lit «|» + LexTerm : •- ( char_lit - char_lit ) «|» LexTerm : •regDefId «|» LexTerm : •[ LexPattern ] «|» LexTerm : •{ LexPattern } «|» @@ -3849,17 +3849,26 @@ S94{ LexTerm : •. «(» LexTerm : •char_lit «(» LexTerm : •char_lit - char_lit «(» - LexTerm : •~ char_lit «(» - LexTerm : •~ ( char_lit - char_lit ) «(» + LexTerm : •- char_lit «(» + LexTerm : •- ( char_lit - char_lit ) «(» LexTerm : •regDefId «(» LexTerm : •[ LexPattern ] «(» LexTerm : •{ LexPattern } «(» LexTerm : •( LexPattern ) «(» + LexTerm : •. «-» + LexTerm : •char_lit «-» + LexTerm : •char_lit - char_lit «-» + LexTerm : •- char_lit «-» + LexTerm : •- ( char_lit - char_lit ) «-» + LexTerm : •regDefId «-» + LexTerm : •[ LexPattern ] «-» + LexTerm : •{ LexPattern } «-» + LexTerm : •( LexPattern ) «-» LexTerm : •. «.» LexTerm : •char_lit «.» LexTerm : •char_lit - char_lit «.» - LexTerm : •~ char_lit «.» - LexTerm : •~ ( char_lit - char_lit ) «.» + LexTerm : •- char_lit «.» + LexTerm : •- ( char_lit - char_lit ) «.» LexTerm : •regDefId «.» LexTerm : •[ LexPattern ] «.» LexTerm : •{ LexPattern } «.» @@ -3867,8 +3876,8 @@ S94{ LexTerm : •. «[» LexTerm : •char_lit «[» LexTerm : •char_lit - char_lit «[» - LexTerm : •~ char_lit «[» - LexTerm : •~ ( char_lit - char_lit ) «[» + LexTerm : •- char_lit «[» + LexTerm : •- ( char_lit - char_lit ) «[» LexTerm : •regDefId «[» LexTerm : •[ LexPattern ] «[» LexTerm : •{ LexPattern } «[» @@ -3876,8 +3885,8 @@ S94{ LexTerm : •. «char_lit» LexTerm : •char_lit «char_lit» LexTerm : •char_lit - char_lit «char_lit» - LexTerm : •~ char_lit «char_lit» - LexTerm : •~ ( char_lit - char_lit ) «char_lit» + LexTerm : •- char_lit «char_lit» + LexTerm : •- ( char_lit - char_lit ) «char_lit» LexTerm : •regDefId «char_lit» LexTerm : •[ LexPattern ] «char_lit» LexTerm : •{ LexPattern } «char_lit» @@ -3885,8 +3894,8 @@ S94{ LexTerm : •. «regDefId» LexTerm : •char_lit «regDefId» LexTerm : •char_lit - char_lit «regDefId» - LexTerm : •~ char_lit «regDefId» - LexTerm : •~ ( char_lit - char_lit ) «regDefId» + LexTerm : •- char_lit «regDefId» + LexTerm : •- ( char_lit - char_lit ) «regDefId» LexTerm : •regDefId «regDefId» LexTerm : •[ LexPattern ] «regDefId» LexTerm : •{ LexPattern } «regDefId» @@ -3894,28 +3903,19 @@ S94{ LexTerm : •. «{» LexTerm : •char_lit «{» LexTerm : •char_lit - char_lit «{» - LexTerm : •~ char_lit «{» - LexTerm : •~ ( char_lit - char_lit ) «{» + LexTerm : •- char_lit «{» + LexTerm : •- ( char_lit - char_lit ) «{» LexTerm : •regDefId «{» LexTerm : •[ LexPattern ] «{» LexTerm : •{ LexPattern } «{» LexTerm : •( LexPattern ) «{» - LexTerm : •. «~» - LexTerm : •char_lit «~» - LexTerm : •char_lit - char_lit «~» - LexTerm : •~ char_lit «~» - LexTerm : •~ ( char_lit - char_lit ) «~» - LexTerm : •regDefId «~» - LexTerm : •[ LexPattern ] «~» - LexTerm : •{ LexPattern } «~» - LexTerm : •( LexPattern ) «~» -} -Transitions: - regDefId -> 54 - LexTerm -> 56 +} +Transitions: + LexTerm -> 55 + regDefId -> 56 . -> 57 char_lit -> 58 - ~ -> 59 + - -> 59 ( -> 60 [ -> 61 { -> 62 @@ -3925,12 +3925,12 @@ Transitions: S95{ LexTerm : ( LexPattern )• «;» LexTerm : ( LexPattern )• «(» + LexTerm : ( LexPattern )• «-» LexTerm : ( LexPattern )• «.» LexTerm : ( LexPattern )• «[» LexTerm : ( LexPattern )• «char_lit» LexTerm : ( LexPattern )• «regDefId» LexTerm : ( LexPattern )• «{» - LexTerm : ( LexPattern )• «~» LexTerm : ( LexPattern )• «|» } Transitions: @@ -3939,12 +3939,12 @@ Transitions: S96{ LexAlt : LexAlt LexTerm• «)» LexAlt : LexAlt LexTerm• «(» + LexAlt : LexAlt LexTerm• «-» LexAlt : LexAlt LexTerm• «.» LexAlt : LexAlt LexTerm• «[» LexAlt : LexAlt LexTerm• «char_lit» LexAlt : LexAlt LexTerm• «regDefId» LexAlt : LexAlt LexTerm• «{» - LexAlt : LexAlt LexTerm• «~» LexAlt : LexAlt LexTerm• «|» } Transitions: @@ -3953,12 +3953,12 @@ Transitions: S97{ LexTerm : char_lit - •char_lit «)» LexTerm : char_lit - •char_lit «(» + LexTerm : char_lit - •char_lit «-» LexTerm : char_lit - •char_lit «.» LexTerm : char_lit - •char_lit «[» LexTerm : char_lit - •char_lit «char_lit» LexTerm : char_lit - •char_lit «regDefId» LexTerm : char_lit - •char_lit «{» - LexTerm : char_lit - •char_lit «~» LexTerm : char_lit - •char_lit «|» } Transitions: @@ -3966,29 +3966,29 @@ Transitions: S98{ - LexTerm : ~ char_lit• «)» - LexTerm : ~ char_lit• «(» - LexTerm : ~ char_lit• «.» - LexTerm : ~ char_lit• «[» - LexTerm : ~ char_lit• «char_lit» - LexTerm : ~ char_lit• «regDefId» - LexTerm : ~ char_lit• «{» - LexTerm : ~ char_lit• «~» - LexTerm : ~ char_lit• «|» + LexTerm : - char_lit• «)» + LexTerm : - char_lit• «(» + LexTerm : - char_lit• «-» + LexTerm : - char_lit• «.» + LexTerm : - char_lit• «[» + LexTerm : - char_lit• «char_lit» + LexTerm : - char_lit• «regDefId» + LexTerm : - char_lit• «{» + LexTerm : - char_lit• «|» } Transitions: S99{ - LexTerm : ~ ( •char_lit - char_lit ) «)» - LexTerm : ~ ( •char_lit - char_lit ) «(» - LexTerm : ~ ( •char_lit - char_lit ) «.» - LexTerm : ~ ( •char_lit - char_lit ) «[» - LexTerm : ~ ( •char_lit - char_lit ) «char_lit» - LexTerm : ~ ( •char_lit - char_lit ) «regDefId» - LexTerm : ~ ( •char_lit - char_lit ) «{» - LexTerm : ~ ( •char_lit - char_lit ) «~» - LexTerm : ~ ( •char_lit - char_lit ) «|» + LexTerm : - ( •char_lit - char_lit ) «)» + LexTerm : - ( •char_lit - char_lit ) «(» + LexTerm : - ( •char_lit - char_lit ) «-» + LexTerm : - ( •char_lit - char_lit ) «.» + LexTerm : - ( •char_lit - char_lit ) «[» + LexTerm : - ( •char_lit - char_lit ) «char_lit» + LexTerm : - ( •char_lit - char_lit ) «regDefId» + LexTerm : - ( •char_lit - char_lit ) «{» + LexTerm : - ( •char_lit - char_lit ) «|» } Transitions: char_lit -> 126 @@ -3997,12 +3997,12 @@ Transitions: S100{ LexTerm : ( LexPattern •) «)» LexTerm : ( LexPattern •) «(» + LexTerm : ( LexPattern •) «-» LexTerm : ( LexPattern •) «.» LexTerm : ( LexPattern •) «[» LexTerm : ( LexPattern •) «char_lit» LexTerm : ( LexPattern •) «regDefId» LexTerm : ( LexPattern •) «{» - LexTerm : ( LexPattern •) «~» LexTerm : ( LexPattern •) «|» LexPattern : LexPattern •| LexAlt «)» LexPattern : LexPattern •| LexAlt «|» @@ -4015,12 +4015,12 @@ Transitions: S101{ LexTerm : [ LexPattern •] «)» LexTerm : [ LexPattern •] «(» + LexTerm : [ LexPattern •] «-» LexTerm : [ LexPattern •] «.» LexTerm : [ LexPattern •] «[» LexTerm : [ LexPattern •] «char_lit» LexTerm : [ LexPattern •] «regDefId» LexTerm : [ LexPattern •] «{» - LexTerm : [ LexPattern •] «~» LexTerm : [ LexPattern •] «|» LexPattern : LexPattern •| LexAlt «]» LexPattern : LexPattern •| LexAlt «|» @@ -4033,12 +4033,12 @@ Transitions: S102{ LexTerm : { LexPattern •} «)» LexTerm : { LexPattern •} «(» + LexTerm : { LexPattern •} «-» LexTerm : { LexPattern •} «.» LexTerm : { LexPattern •} «[» LexTerm : { LexPattern •} «char_lit» LexTerm : { LexPattern •} «regDefId» LexTerm : { LexPattern •} «{» - LexTerm : { LexPattern •} «~» LexTerm : { LexPattern •} «|» LexPattern : LexPattern •| LexAlt «}» LexPattern : LexPattern •| LexAlt «|» @@ -4058,31 +4058,31 @@ S103{ LexTerm : •. «]» LexTerm : •char_lit «]» LexTerm : •char_lit - char_lit «]» - LexTerm : •~ char_lit «]» - LexTerm : •~ ( char_lit - char_lit ) «]» + LexTerm : •- char_lit «]» + LexTerm : •- ( char_lit - char_lit ) «]» LexTerm : •regDefId «]» LexTerm : •[ LexPattern ] «]» LexTerm : •{ LexPattern } «]» LexTerm : •( LexPattern ) «]» LexAlt : •LexTerm «(» + LexAlt : •LexTerm «-» LexAlt : •LexTerm «.» LexAlt : •LexTerm «[» LexAlt : •LexTerm «char_lit» LexAlt : •LexTerm «regDefId» LexAlt : •LexTerm «{» - LexAlt : •LexTerm «~» LexAlt : •LexAlt LexTerm «(» + LexAlt : •LexAlt LexTerm «-» LexAlt : •LexAlt LexTerm «.» LexAlt : •LexAlt LexTerm «[» LexAlt : •LexAlt LexTerm «char_lit» LexAlt : •LexAlt LexTerm «regDefId» LexAlt : •LexAlt LexTerm «{» - LexAlt : •LexAlt LexTerm «~» LexTerm : •. «|» LexTerm : •char_lit «|» LexTerm : •char_lit - char_lit «|» - LexTerm : •~ char_lit «|» - LexTerm : •~ ( char_lit - char_lit ) «|» + LexTerm : •- char_lit «|» + LexTerm : •- ( char_lit - char_lit ) «|» LexTerm : •regDefId «|» LexTerm : •[ LexPattern ] «|» LexTerm : •{ LexPattern } «|» @@ -4090,17 +4090,26 @@ S103{ LexTerm : •. «(» LexTerm : •char_lit «(» LexTerm : •char_lit - char_lit «(» - LexTerm : •~ char_lit «(» - LexTerm : •~ ( char_lit - char_lit ) «(» + LexTerm : •- char_lit «(» + LexTerm : •- ( char_lit - char_lit ) «(» LexTerm : •regDefId «(» LexTerm : •[ LexPattern ] «(» LexTerm : •{ LexPattern } «(» LexTerm : •( LexPattern ) «(» + LexTerm : •. «-» + LexTerm : •char_lit «-» + LexTerm : •char_lit - char_lit «-» + LexTerm : •- char_lit «-» + LexTerm : •- ( char_lit - char_lit ) «-» + LexTerm : •regDefId «-» + LexTerm : •[ LexPattern ] «-» + LexTerm : •{ LexPattern } «-» + LexTerm : •( LexPattern ) «-» LexTerm : •. «.» LexTerm : •char_lit «.» LexTerm : •char_lit - char_lit «.» - LexTerm : •~ char_lit «.» - LexTerm : •~ ( char_lit - char_lit ) «.» + LexTerm : •- char_lit «.» + LexTerm : •- ( char_lit - char_lit ) «.» LexTerm : •regDefId «.» LexTerm : •[ LexPattern ] «.» LexTerm : •{ LexPattern } «.» @@ -4108,8 +4117,8 @@ S103{ LexTerm : •. «[» LexTerm : •char_lit «[» LexTerm : •char_lit - char_lit «[» - LexTerm : •~ char_lit «[» - LexTerm : •~ ( char_lit - char_lit ) «[» + LexTerm : •- char_lit «[» + LexTerm : •- ( char_lit - char_lit ) «[» LexTerm : •regDefId «[» LexTerm : •[ LexPattern ] «[» LexTerm : •{ LexPattern } «[» @@ -4117,8 +4126,8 @@ S103{ LexTerm : •. «char_lit» LexTerm : •char_lit «char_lit» LexTerm : •char_lit - char_lit «char_lit» - LexTerm : •~ char_lit «char_lit» - LexTerm : •~ ( char_lit - char_lit ) «char_lit» + LexTerm : •- char_lit «char_lit» + LexTerm : •- ( char_lit - char_lit ) «char_lit» LexTerm : •regDefId «char_lit» LexTerm : •[ LexPattern ] «char_lit» LexTerm : •{ LexPattern } «char_lit» @@ -4126,8 +4135,8 @@ S103{ LexTerm : •. «regDefId» LexTerm : •char_lit «regDefId» LexTerm : •char_lit - char_lit «regDefId» - LexTerm : •~ char_lit «regDefId» - LexTerm : •~ ( char_lit - char_lit ) «regDefId» + LexTerm : •- char_lit «regDefId» + LexTerm : •- ( char_lit - char_lit ) «regDefId» LexTerm : •regDefId «regDefId» LexTerm : •[ LexPattern ] «regDefId» LexTerm : •{ LexPattern } «regDefId» @@ -4135,28 +4144,19 @@ S103{ LexTerm : •. «{» LexTerm : •char_lit «{» LexTerm : •char_lit - char_lit «{» - LexTerm : •~ char_lit «{» - LexTerm : •~ ( char_lit - char_lit ) «{» + LexTerm : •- char_lit «{» + LexTerm : •- ( char_lit - char_lit ) «{» LexTerm : •regDefId «{» LexTerm : •[ LexPattern ] «{» LexTerm : •{ LexPattern } «{» LexTerm : •( LexPattern ) «{» - LexTerm : •. «~» - LexTerm : •char_lit «~» - LexTerm : •char_lit - char_lit «~» - LexTerm : •~ char_lit «~» - LexTerm : •~ ( char_lit - char_lit ) «~» - LexTerm : •regDefId «~» - LexTerm : •[ LexPattern ] «~» - LexTerm : •{ LexPattern } «~» - LexTerm : •( LexPattern ) «~» -} -Transitions: - regDefId -> 64 - LexTerm -> 66 +} +Transitions: + LexTerm -> 65 + regDefId -> 66 . -> 67 char_lit -> 68 - ~ -> 69 + - -> 69 ( -> 70 [ -> 71 { -> 72 @@ -4166,12 +4166,12 @@ Transitions: S104{ LexTerm : [ LexPattern ]• «;» LexTerm : [ LexPattern ]• «(» + LexTerm : [ LexPattern ]• «-» LexTerm : [ LexPattern ]• «.» LexTerm : [ LexPattern ]• «[» LexTerm : [ LexPattern ]• «char_lit» LexTerm : [ LexPattern ]• «regDefId» LexTerm : [ LexPattern ]• «{» - LexTerm : [ LexPattern ]• «~» LexTerm : [ LexPattern ]• «|» } Transitions: @@ -4180,12 +4180,12 @@ Transitions: S105{ LexAlt : LexAlt LexTerm• «]» LexAlt : LexAlt LexTerm• «(» + LexAlt : LexAlt LexTerm• «-» LexAlt : LexAlt LexTerm• «.» LexAlt : LexAlt LexTerm• «[» LexAlt : LexAlt LexTerm• «char_lit» LexAlt : LexAlt LexTerm• «regDefId» LexAlt : LexAlt LexTerm• «{» - LexAlt : LexAlt LexTerm• «~» LexAlt : LexAlt LexTerm• «|» } Transitions: @@ -4194,12 +4194,12 @@ Transitions: S106{ LexTerm : char_lit - •char_lit «]» LexTerm : char_lit - •char_lit «(» + LexTerm : char_lit - •char_lit «-» LexTerm : char_lit - •char_lit «.» LexTerm : char_lit - •char_lit «[» LexTerm : char_lit - •char_lit «char_lit» LexTerm : char_lit - •char_lit «regDefId» LexTerm : char_lit - •char_lit «{» - LexTerm : char_lit - •char_lit «~» LexTerm : char_lit - •char_lit «|» } Transitions: @@ -4207,29 +4207,29 @@ Transitions: S107{ - LexTerm : ~ char_lit• «]» - LexTerm : ~ char_lit• «(» - LexTerm : ~ char_lit• «.» - LexTerm : ~ char_lit• «[» - LexTerm : ~ char_lit• «char_lit» - LexTerm : ~ char_lit• «regDefId» - LexTerm : ~ char_lit• «{» - LexTerm : ~ char_lit• «~» - LexTerm : ~ char_lit• «|» + LexTerm : - char_lit• «]» + LexTerm : - char_lit• «(» + LexTerm : - char_lit• «-» + LexTerm : - char_lit• «.» + LexTerm : - char_lit• «[» + LexTerm : - char_lit• «char_lit» + LexTerm : - char_lit• «regDefId» + LexTerm : - char_lit• «{» + LexTerm : - char_lit• «|» } Transitions: S108{ - LexTerm : ~ ( •char_lit - char_lit ) «]» - LexTerm : ~ ( •char_lit - char_lit ) «(» - LexTerm : ~ ( •char_lit - char_lit ) «.» - LexTerm : ~ ( •char_lit - char_lit ) «[» - LexTerm : ~ ( •char_lit - char_lit ) «char_lit» - LexTerm : ~ ( •char_lit - char_lit ) «regDefId» - LexTerm : ~ ( •char_lit - char_lit ) «{» - LexTerm : ~ ( •char_lit - char_lit ) «~» - LexTerm : ~ ( •char_lit - char_lit ) «|» + LexTerm : - ( •char_lit - char_lit ) «]» + LexTerm : - ( •char_lit - char_lit ) «(» + LexTerm : - ( •char_lit - char_lit ) «-» + LexTerm : - ( •char_lit - char_lit ) «.» + LexTerm : - ( •char_lit - char_lit ) «[» + LexTerm : - ( •char_lit - char_lit ) «char_lit» + LexTerm : - ( •char_lit - char_lit ) «regDefId» + LexTerm : - ( •char_lit - char_lit ) «{» + LexTerm : - ( •char_lit - char_lit ) «|» } Transitions: char_lit -> 132 @@ -4238,12 +4238,12 @@ Transitions: S109{ LexTerm : ( LexPattern •) «]» LexTerm : ( LexPattern •) «(» + LexTerm : ( LexPattern •) «-» LexTerm : ( LexPattern •) «.» LexTerm : ( LexPattern •) «[» LexTerm : ( LexPattern •) «char_lit» LexTerm : ( LexPattern •) «regDefId» LexTerm : ( LexPattern •) «{» - LexTerm : ( LexPattern •) «~» LexTerm : ( LexPattern •) «|» LexPattern : LexPattern •| LexAlt «)» LexPattern : LexPattern •| LexAlt «|» @@ -4256,12 +4256,12 @@ Transitions: S110{ LexTerm : [ LexPattern •] «]» LexTerm : [ LexPattern •] «(» + LexTerm : [ LexPattern •] «-» LexTerm : [ LexPattern •] «.» LexTerm : [ LexPattern •] «[» LexTerm : [ LexPattern •] «char_lit» LexTerm : [ LexPattern •] «regDefId» LexTerm : [ LexPattern •] «{» - LexTerm : [ LexPattern •] «~» LexTerm : [ LexPattern •] «|» LexPattern : LexPattern •| LexAlt «]» LexPattern : LexPattern •| LexAlt «|» @@ -4274,12 +4274,12 @@ Transitions: S111{ LexTerm : { LexPattern •} «]» LexTerm : { LexPattern •} «(» + LexTerm : { LexPattern •} «-» LexTerm : { LexPattern •} «.» LexTerm : { LexPattern •} «[» LexTerm : { LexPattern •} «char_lit» LexTerm : { LexPattern •} «regDefId» LexTerm : { LexPattern •} «{» - LexTerm : { LexPattern •} «~» LexTerm : { LexPattern •} «|» LexPattern : LexPattern •| LexAlt «}» LexPattern : LexPattern •| LexAlt «|» @@ -4299,31 +4299,31 @@ S112{ LexTerm : •. «}» LexTerm : •char_lit «}» LexTerm : •char_lit - char_lit «}» - LexTerm : •~ char_lit «}» - LexTerm : •~ ( char_lit - char_lit ) «}» + LexTerm : •- char_lit «}» + LexTerm : •- ( char_lit - char_lit ) «}» LexTerm : •regDefId «}» LexTerm : •[ LexPattern ] «}» LexTerm : •{ LexPattern } «}» LexTerm : •( LexPattern ) «}» LexAlt : •LexTerm «(» + LexAlt : •LexTerm «-» LexAlt : •LexTerm «.» LexAlt : •LexTerm «[» LexAlt : •LexTerm «char_lit» LexAlt : •LexTerm «regDefId» LexAlt : •LexTerm «{» - LexAlt : •LexTerm «~» LexAlt : •LexAlt LexTerm «(» + LexAlt : •LexAlt LexTerm «-» LexAlt : •LexAlt LexTerm «.» LexAlt : •LexAlt LexTerm «[» LexAlt : •LexAlt LexTerm «char_lit» LexAlt : •LexAlt LexTerm «regDefId» LexAlt : •LexAlt LexTerm «{» - LexAlt : •LexAlt LexTerm «~» LexTerm : •. «|» LexTerm : •char_lit «|» LexTerm : •char_lit - char_lit «|» - LexTerm : •~ char_lit «|» - LexTerm : •~ ( char_lit - char_lit ) «|» + LexTerm : •- char_lit «|» + LexTerm : •- ( char_lit - char_lit ) «|» LexTerm : •regDefId «|» LexTerm : •[ LexPattern ] «|» LexTerm : •{ LexPattern } «|» @@ -4331,17 +4331,26 @@ S112{ LexTerm : •. «(» LexTerm : •char_lit «(» LexTerm : •char_lit - char_lit «(» - LexTerm : •~ char_lit «(» - LexTerm : •~ ( char_lit - char_lit ) «(» + LexTerm : •- char_lit «(» + LexTerm : •- ( char_lit - char_lit ) «(» LexTerm : •regDefId «(» LexTerm : •[ LexPattern ] «(» LexTerm : •{ LexPattern } «(» LexTerm : •( LexPattern ) «(» + LexTerm : •. «-» + LexTerm : •char_lit «-» + LexTerm : •char_lit - char_lit «-» + LexTerm : •- char_lit «-» + LexTerm : •- ( char_lit - char_lit ) «-» + LexTerm : •regDefId «-» + LexTerm : •[ LexPattern ] «-» + LexTerm : •{ LexPattern } «-» + LexTerm : •( LexPattern ) «-» LexTerm : •. «.» LexTerm : •char_lit «.» LexTerm : •char_lit - char_lit «.» - LexTerm : •~ char_lit «.» - LexTerm : •~ ( char_lit - char_lit ) «.» + LexTerm : •- char_lit «.» + LexTerm : •- ( char_lit - char_lit ) «.» LexTerm : •regDefId «.» LexTerm : •[ LexPattern ] «.» LexTerm : •{ LexPattern } «.» @@ -4349,8 +4358,8 @@ S112{ LexTerm : •. «[» LexTerm : •char_lit «[» LexTerm : •char_lit - char_lit «[» - LexTerm : •~ char_lit «[» - LexTerm : •~ ( char_lit - char_lit ) «[» + LexTerm : •- char_lit «[» + LexTerm : •- ( char_lit - char_lit ) «[» LexTerm : •regDefId «[» LexTerm : •[ LexPattern ] «[» LexTerm : •{ LexPattern } «[» @@ -4358,8 +4367,8 @@ S112{ LexTerm : •. «char_lit» LexTerm : •char_lit «char_lit» LexTerm : •char_lit - char_lit «char_lit» - LexTerm : •~ char_lit «char_lit» - LexTerm : •~ ( char_lit - char_lit ) «char_lit» + LexTerm : •- char_lit «char_lit» + LexTerm : •- ( char_lit - char_lit ) «char_lit» LexTerm : •regDefId «char_lit» LexTerm : •[ LexPattern ] «char_lit» LexTerm : •{ LexPattern } «char_lit» @@ -4367,8 +4376,8 @@ S112{ LexTerm : •. «regDefId» LexTerm : •char_lit «regDefId» LexTerm : •char_lit - char_lit «regDefId» - LexTerm : •~ char_lit «regDefId» - LexTerm : •~ ( char_lit - char_lit ) «regDefId» + LexTerm : •- char_lit «regDefId» + LexTerm : •- ( char_lit - char_lit ) «regDefId» LexTerm : •regDefId «regDefId» LexTerm : •[ LexPattern ] «regDefId» LexTerm : •{ LexPattern } «regDefId» @@ -4376,28 +4385,19 @@ S112{ LexTerm : •. «{» LexTerm : •char_lit «{» LexTerm : •char_lit - char_lit «{» - LexTerm : •~ char_lit «{» - LexTerm : •~ ( char_lit - char_lit ) «{» + LexTerm : •- char_lit «{» + LexTerm : •- ( char_lit - char_lit ) «{» LexTerm : •regDefId «{» LexTerm : •[ LexPattern ] «{» LexTerm : •{ LexPattern } «{» LexTerm : •( LexPattern ) «{» - LexTerm : •. «~» - LexTerm : •char_lit «~» - LexTerm : •char_lit - char_lit «~» - LexTerm : •~ char_lit «~» - LexTerm : •~ ( char_lit - char_lit ) «~» - LexTerm : •regDefId «~» - LexTerm : •[ LexPattern ] «~» - LexTerm : •{ LexPattern } «~» - LexTerm : •( LexPattern ) «~» -} -Transitions: - regDefId -> 74 - LexTerm -> 76 +} +Transitions: + LexTerm -> 75 + regDefId -> 76 . -> 77 char_lit -> 78 - ~ -> 79 + - -> 79 ( -> 80 [ -> 81 { -> 82 @@ -4407,12 +4407,12 @@ Transitions: S113{ LexTerm : { LexPattern }• «;» LexTerm : { LexPattern }• «(» + LexTerm : { LexPattern }• «-» LexTerm : { LexPattern }• «.» LexTerm : { LexPattern }• «[» LexTerm : { LexPattern }• «char_lit» LexTerm : { LexPattern }• «regDefId» LexTerm : { LexPattern }• «{» - LexTerm : { LexPattern }• «~» LexTerm : { LexPattern }• «|» } Transitions: @@ -4421,12 +4421,12 @@ Transitions: S114{ LexAlt : LexAlt LexTerm• «}» LexAlt : LexAlt LexTerm• «(» + LexAlt : LexAlt LexTerm• «-» LexAlt : LexAlt LexTerm• «.» LexAlt : LexAlt LexTerm• «[» LexAlt : LexAlt LexTerm• «char_lit» LexAlt : LexAlt LexTerm• «regDefId» LexAlt : LexAlt LexTerm• «{» - LexAlt : LexAlt LexTerm• «~» LexAlt : LexAlt LexTerm• «|» } Transitions: @@ -4435,12 +4435,12 @@ Transitions: S115{ LexTerm : char_lit - •char_lit «}» LexTerm : char_lit - •char_lit «(» + LexTerm : char_lit - •char_lit «-» LexTerm : char_lit - •char_lit «.» LexTerm : char_lit - •char_lit «[» LexTerm : char_lit - •char_lit «char_lit» LexTerm : char_lit - •char_lit «regDefId» LexTerm : char_lit - •char_lit «{» - LexTerm : char_lit - •char_lit «~» LexTerm : char_lit - •char_lit «|» } Transitions: @@ -4448,29 +4448,29 @@ Transitions: S116{ - LexTerm : ~ char_lit• «}» - LexTerm : ~ char_lit• «(» - LexTerm : ~ char_lit• «.» - LexTerm : ~ char_lit• «[» - LexTerm : ~ char_lit• «char_lit» - LexTerm : ~ char_lit• «regDefId» - LexTerm : ~ char_lit• «{» - LexTerm : ~ char_lit• «~» - LexTerm : ~ char_lit• «|» + LexTerm : - char_lit• «}» + LexTerm : - char_lit• «(» + LexTerm : - char_lit• «-» + LexTerm : - char_lit• «.» + LexTerm : - char_lit• «[» + LexTerm : - char_lit• «char_lit» + LexTerm : - char_lit• «regDefId» + LexTerm : - char_lit• «{» + LexTerm : - char_lit• «|» } Transitions: S117{ - LexTerm : ~ ( •char_lit - char_lit ) «}» - LexTerm : ~ ( •char_lit - char_lit ) «(» - LexTerm : ~ ( •char_lit - char_lit ) «.» - LexTerm : ~ ( •char_lit - char_lit ) «[» - LexTerm : ~ ( •char_lit - char_lit ) «char_lit» - LexTerm : ~ ( •char_lit - char_lit ) «regDefId» - LexTerm : ~ ( •char_lit - char_lit ) «{» - LexTerm : ~ ( •char_lit - char_lit ) «~» - LexTerm : ~ ( •char_lit - char_lit ) «|» + LexTerm : - ( •char_lit - char_lit ) «}» + LexTerm : - ( •char_lit - char_lit ) «(» + LexTerm : - ( •char_lit - char_lit ) «-» + LexTerm : - ( •char_lit - char_lit ) «.» + LexTerm : - ( •char_lit - char_lit ) «[» + LexTerm : - ( •char_lit - char_lit ) «char_lit» + LexTerm : - ( •char_lit - char_lit ) «regDefId» + LexTerm : - ( •char_lit - char_lit ) «{» + LexTerm : - ( •char_lit - char_lit ) «|» } Transitions: char_lit -> 138 @@ -4479,12 +4479,12 @@ Transitions: S118{ LexTerm : ( LexPattern •) «}» LexTerm : ( LexPattern •) «(» + LexTerm : ( LexPattern •) «-» LexTerm : ( LexPattern •) «.» LexTerm : ( LexPattern •) «[» LexTerm : ( LexPattern •) «char_lit» LexTerm : ( LexPattern •) «regDefId» LexTerm : ( LexPattern •) «{» - LexTerm : ( LexPattern •) «~» LexTerm : ( LexPattern •) «|» LexPattern : LexPattern •| LexAlt «)» LexPattern : LexPattern •| LexAlt «|» @@ -4497,12 +4497,12 @@ Transitions: S119{ LexTerm : [ LexPattern •] «}» LexTerm : [ LexPattern •] «(» + LexTerm : [ LexPattern •] «-» LexTerm : [ LexPattern •] «.» LexTerm : [ LexPattern •] «[» LexTerm : [ LexPattern •] «char_lit» LexTerm : [ LexPattern •] «regDefId» LexTerm : [ LexPattern •] «{» - LexTerm : [ LexPattern •] «~» LexTerm : [ LexPattern •] «|» LexPattern : LexPattern •| LexAlt «]» LexPattern : LexPattern •| LexAlt «|» @@ -4515,12 +4515,12 @@ Transitions: S120{ LexTerm : { LexPattern •} «}» LexTerm : { LexPattern •} «(» + LexTerm : { LexPattern •} «-» LexTerm : { LexPattern •} «.» LexTerm : { LexPattern •} «[» LexTerm : { LexPattern •} «char_lit» LexTerm : { LexPattern •} «regDefId» LexTerm : { LexPattern •} «{» - LexTerm : { LexPattern •} «~» LexTerm : { LexPattern •} «|» LexPattern : LexPattern •| LexAlt «}» LexPattern : LexPattern •| LexAlt «|» @@ -4545,15 +4545,15 @@ Transitions: S123{ - LexTerm : ~ ( char_lit - •char_lit ) «;» - LexTerm : ~ ( char_lit - •char_lit ) «(» - LexTerm : ~ ( char_lit - •char_lit ) «.» - LexTerm : ~ ( char_lit - •char_lit ) «[» - LexTerm : ~ ( char_lit - •char_lit ) «char_lit» - LexTerm : ~ ( char_lit - •char_lit ) «regDefId» - LexTerm : ~ ( char_lit - •char_lit ) «{» - LexTerm : ~ ( char_lit - •char_lit ) «~» - LexTerm : ~ ( char_lit - •char_lit ) «|» + LexTerm : - ( char_lit - •char_lit ) «;» + LexTerm : - ( char_lit - •char_lit ) «(» + LexTerm : - ( char_lit - •char_lit ) «-» + LexTerm : - ( char_lit - •char_lit ) «.» + LexTerm : - ( char_lit - •char_lit ) «[» + LexTerm : - ( char_lit - •char_lit ) «char_lit» + LexTerm : - ( char_lit - •char_lit ) «regDefId» + LexTerm : - ( char_lit - •char_lit ) «{» + LexTerm : - ( char_lit - •char_lit ) «|» } Transitions: char_lit -> 142 @@ -4565,17 +4565,17 @@ S124{ LexAlt : LexAlt •LexTerm «)» LexAlt : LexAlt •LexTerm «|» LexAlt : LexAlt •LexTerm «(» + LexAlt : LexAlt •LexTerm «-» LexAlt : LexAlt •LexTerm «.» LexAlt : LexAlt •LexTerm «[» LexAlt : LexAlt •LexTerm «char_lit» LexAlt : LexAlt •LexTerm «regDefId» LexAlt : LexAlt •LexTerm «{» - LexAlt : LexAlt •LexTerm «~» LexTerm : •. «)» LexTerm : •char_lit «)» LexTerm : •char_lit - char_lit «)» - LexTerm : •~ char_lit «)» - LexTerm : •~ ( char_lit - char_lit ) «)» + LexTerm : •- char_lit «)» + LexTerm : •- ( char_lit - char_lit ) «)» LexTerm : •regDefId «)» LexTerm : •[ LexPattern ] «)» LexTerm : •{ LexPattern } «)» @@ -4583,8 +4583,8 @@ S124{ LexTerm : •. «|» LexTerm : •char_lit «|» LexTerm : •char_lit - char_lit «|» - LexTerm : •~ char_lit «|» - LexTerm : •~ ( char_lit - char_lit ) «|» + LexTerm : •- char_lit «|» + LexTerm : •- ( char_lit - char_lit ) «|» LexTerm : •regDefId «|» LexTerm : •[ LexPattern ] «|» LexTerm : •{ LexPattern } «|» @@ -4592,17 +4592,26 @@ S124{ LexTerm : •. «(» LexTerm : •char_lit «(» LexTerm : •char_lit - char_lit «(» - LexTerm : •~ char_lit «(» - LexTerm : •~ ( char_lit - char_lit ) «(» + LexTerm : •- char_lit «(» + LexTerm : •- ( char_lit - char_lit ) «(» LexTerm : •regDefId «(» LexTerm : •[ LexPattern ] «(» LexTerm : •{ LexPattern } «(» LexTerm : •( LexPattern ) «(» + LexTerm : •. «-» + LexTerm : •char_lit «-» + LexTerm : •char_lit - char_lit «-» + LexTerm : •- char_lit «-» + LexTerm : •- ( char_lit - char_lit ) «-» + LexTerm : •regDefId «-» + LexTerm : •[ LexPattern ] «-» + LexTerm : •{ LexPattern } «-» + LexTerm : •( LexPattern ) «-» LexTerm : •. «.» LexTerm : •char_lit «.» LexTerm : •char_lit - char_lit «.» - LexTerm : •~ char_lit «.» - LexTerm : •~ ( char_lit - char_lit ) «.» + LexTerm : •- char_lit «.» + LexTerm : •- ( char_lit - char_lit ) «.» LexTerm : •regDefId «.» LexTerm : •[ LexPattern ] «.» LexTerm : •{ LexPattern } «.» @@ -4610,8 +4619,8 @@ S124{ LexTerm : •. «[» LexTerm : •char_lit «[» LexTerm : •char_lit - char_lit «[» - LexTerm : •~ char_lit «[» - LexTerm : •~ ( char_lit - char_lit ) «[» + LexTerm : •- char_lit «[» + LexTerm : •- ( char_lit - char_lit ) «[» LexTerm : •regDefId «[» LexTerm : •[ LexPattern ] «[» LexTerm : •{ LexPattern } «[» @@ -4619,8 +4628,8 @@ S124{ LexTerm : •. «char_lit» LexTerm : •char_lit «char_lit» LexTerm : •char_lit - char_lit «char_lit» - LexTerm : •~ char_lit «char_lit» - LexTerm : •~ ( char_lit - char_lit ) «char_lit» + LexTerm : •- char_lit «char_lit» + LexTerm : •- ( char_lit - char_lit ) «char_lit» LexTerm : •regDefId «char_lit» LexTerm : •[ LexPattern ] «char_lit» LexTerm : •{ LexPattern } «char_lit» @@ -4628,8 +4637,8 @@ S124{ LexTerm : •. «regDefId» LexTerm : •char_lit «regDefId» LexTerm : •char_lit - char_lit «regDefId» - LexTerm : •~ char_lit «regDefId» - LexTerm : •~ ( char_lit - char_lit ) «regDefId» + LexTerm : •- char_lit «regDefId» + LexTerm : •- ( char_lit - char_lit ) «regDefId» LexTerm : •regDefId «regDefId» LexTerm : •[ LexPattern ] «regDefId» LexTerm : •{ LexPattern } «regDefId» @@ -4637,27 +4646,18 @@ S124{ LexTerm : •. «{» LexTerm : •char_lit «{» LexTerm : •char_lit - char_lit «{» - LexTerm : •~ char_lit «{» - LexTerm : •~ ( char_lit - char_lit ) «{» + LexTerm : •- char_lit «{» + LexTerm : •- ( char_lit - char_lit ) «{» LexTerm : •regDefId «{» LexTerm : •[ LexPattern ] «{» LexTerm : •{ LexPattern } «{» LexTerm : •( LexPattern ) «{» - LexTerm : •. «~» - LexTerm : •char_lit «~» - LexTerm : •char_lit - char_lit «~» - LexTerm : •~ char_lit «~» - LexTerm : •~ ( char_lit - char_lit ) «~» - LexTerm : •regDefId «~» - LexTerm : •[ LexPattern ] «~» - LexTerm : •{ LexPattern } «~» - LexTerm : •( LexPattern ) «~» -} -Transitions: - regDefId -> 54 +} +Transitions: + regDefId -> 56 . -> 57 char_lit -> 58 - ~ -> 59 + - -> 59 ( -> 60 [ -> 61 { -> 62 @@ -4667,27 +4667,27 @@ Transitions: S125{ LexTerm : char_lit - char_lit• «)» LexTerm : char_lit - char_lit• «(» + LexTerm : char_lit - char_lit• «-» LexTerm : char_lit - char_lit• «.» LexTerm : char_lit - char_lit• «[» LexTerm : char_lit - char_lit• «char_lit» LexTerm : char_lit - char_lit• «regDefId» LexTerm : char_lit - char_lit• «{» - LexTerm : char_lit - char_lit• «~» LexTerm : char_lit - char_lit• «|» } Transitions: S126{ - LexTerm : ~ ( char_lit •- char_lit ) «)» - LexTerm : ~ ( char_lit •- char_lit ) «(» - LexTerm : ~ ( char_lit •- char_lit ) «.» - LexTerm : ~ ( char_lit •- char_lit ) «[» - LexTerm : ~ ( char_lit •- char_lit ) «char_lit» - LexTerm : ~ ( char_lit •- char_lit ) «regDefId» - LexTerm : ~ ( char_lit •- char_lit ) «{» - LexTerm : ~ ( char_lit •- char_lit ) «~» - LexTerm : ~ ( char_lit •- char_lit ) «|» + LexTerm : - ( char_lit •- char_lit ) «)» + LexTerm : - ( char_lit •- char_lit ) «(» + LexTerm : - ( char_lit •- char_lit ) «-» + LexTerm : - ( char_lit •- char_lit ) «.» + LexTerm : - ( char_lit •- char_lit ) «[» + LexTerm : - ( char_lit •- char_lit ) «char_lit» + LexTerm : - ( char_lit •- char_lit ) «regDefId» + LexTerm : - ( char_lit •- char_lit ) «{» + LexTerm : - ( char_lit •- char_lit ) «|» } Transitions: - -> 143 @@ -4696,12 +4696,12 @@ Transitions: S127{ LexTerm : ( LexPattern )• «)» LexTerm : ( LexPattern )• «(» + LexTerm : ( LexPattern )• «-» LexTerm : ( LexPattern )• «.» LexTerm : ( LexPattern )• «[» LexTerm : ( LexPattern )• «char_lit» LexTerm : ( LexPattern )• «regDefId» LexTerm : ( LexPattern )• «{» - LexTerm : ( LexPattern )• «~» LexTerm : ( LexPattern )• «|» } Transitions: @@ -4710,12 +4710,12 @@ Transitions: S128{ LexTerm : [ LexPattern ]• «)» LexTerm : [ LexPattern ]• «(» + LexTerm : [ LexPattern ]• «-» LexTerm : [ LexPattern ]• «.» LexTerm : [ LexPattern ]• «[» LexTerm : [ LexPattern ]• «char_lit» LexTerm : [ LexPattern ]• «regDefId» LexTerm : [ LexPattern ]• «{» - LexTerm : [ LexPattern ]• «~» LexTerm : [ LexPattern ]• «|» } Transitions: @@ -4724,12 +4724,12 @@ Transitions: S129{ LexTerm : { LexPattern }• «)» LexTerm : { LexPattern }• «(» + LexTerm : { LexPattern }• «-» LexTerm : { LexPattern }• «.» LexTerm : { LexPattern }• «[» LexTerm : { LexPattern }• «char_lit» LexTerm : { LexPattern }• «regDefId» LexTerm : { LexPattern }• «{» - LexTerm : { LexPattern }• «~» LexTerm : { LexPattern }• «|» } Transitions: @@ -4741,17 +4741,17 @@ S130{ LexAlt : LexAlt •LexTerm «]» LexAlt : LexAlt •LexTerm «|» LexAlt : LexAlt •LexTerm «(» + LexAlt : LexAlt •LexTerm «-» LexAlt : LexAlt •LexTerm «.» LexAlt : LexAlt •LexTerm «[» LexAlt : LexAlt •LexTerm «char_lit» LexAlt : LexAlt •LexTerm «regDefId» LexAlt : LexAlt •LexTerm «{» - LexAlt : LexAlt •LexTerm «~» LexTerm : •. «]» LexTerm : •char_lit «]» LexTerm : •char_lit - char_lit «]» - LexTerm : •~ char_lit «]» - LexTerm : •~ ( char_lit - char_lit ) «]» + LexTerm : •- char_lit «]» + LexTerm : •- ( char_lit - char_lit ) «]» LexTerm : •regDefId «]» LexTerm : •[ LexPattern ] «]» LexTerm : •{ LexPattern } «]» @@ -4759,8 +4759,8 @@ S130{ LexTerm : •. «|» LexTerm : •char_lit «|» LexTerm : •char_lit - char_lit «|» - LexTerm : •~ char_lit «|» - LexTerm : •~ ( char_lit - char_lit ) «|» + LexTerm : •- char_lit «|» + LexTerm : •- ( char_lit - char_lit ) «|» LexTerm : •regDefId «|» LexTerm : •[ LexPattern ] «|» LexTerm : •{ LexPattern } «|» @@ -4768,17 +4768,26 @@ S130{ LexTerm : •. «(» LexTerm : •char_lit «(» LexTerm : •char_lit - char_lit «(» - LexTerm : •~ char_lit «(» - LexTerm : •~ ( char_lit - char_lit ) «(» + LexTerm : •- char_lit «(» + LexTerm : •- ( char_lit - char_lit ) «(» LexTerm : •regDefId «(» LexTerm : •[ LexPattern ] «(» LexTerm : •{ LexPattern } «(» LexTerm : •( LexPattern ) «(» + LexTerm : •. «-» + LexTerm : •char_lit «-» + LexTerm : •char_lit - char_lit «-» + LexTerm : •- char_lit «-» + LexTerm : •- ( char_lit - char_lit ) «-» + LexTerm : •regDefId «-» + LexTerm : •[ LexPattern ] «-» + LexTerm : •{ LexPattern } «-» + LexTerm : •( LexPattern ) «-» LexTerm : •. «.» LexTerm : •char_lit «.» LexTerm : •char_lit - char_lit «.» - LexTerm : •~ char_lit «.» - LexTerm : •~ ( char_lit - char_lit ) «.» + LexTerm : •- char_lit «.» + LexTerm : •- ( char_lit - char_lit ) «.» LexTerm : •regDefId «.» LexTerm : •[ LexPattern ] «.» LexTerm : •{ LexPattern } «.» @@ -4786,8 +4795,8 @@ S130{ LexTerm : •. «[» LexTerm : •char_lit «[» LexTerm : •char_lit - char_lit «[» - LexTerm : •~ char_lit «[» - LexTerm : •~ ( char_lit - char_lit ) «[» + LexTerm : •- char_lit «[» + LexTerm : •- ( char_lit - char_lit ) «[» LexTerm : •regDefId «[» LexTerm : •[ LexPattern ] «[» LexTerm : •{ LexPattern } «[» @@ -4795,8 +4804,8 @@ S130{ LexTerm : •. «char_lit» LexTerm : •char_lit «char_lit» LexTerm : •char_lit - char_lit «char_lit» - LexTerm : •~ char_lit «char_lit» - LexTerm : •~ ( char_lit - char_lit ) «char_lit» + LexTerm : •- char_lit «char_lit» + LexTerm : •- ( char_lit - char_lit ) «char_lit» LexTerm : •regDefId «char_lit» LexTerm : •[ LexPattern ] «char_lit» LexTerm : •{ LexPattern } «char_lit» @@ -4804,8 +4813,8 @@ S130{ LexTerm : •. «regDefId» LexTerm : •char_lit «regDefId» LexTerm : •char_lit - char_lit «regDefId» - LexTerm : •~ char_lit «regDefId» - LexTerm : •~ ( char_lit - char_lit ) «regDefId» + LexTerm : •- char_lit «regDefId» + LexTerm : •- ( char_lit - char_lit ) «regDefId» LexTerm : •regDefId «regDefId» LexTerm : •[ LexPattern ] «regDefId» LexTerm : •{ LexPattern } «regDefId» @@ -4813,27 +4822,18 @@ S130{ LexTerm : •. «{» LexTerm : •char_lit «{» LexTerm : •char_lit - char_lit «{» - LexTerm : •~ char_lit «{» - LexTerm : •~ ( char_lit - char_lit ) «{» + LexTerm : •- char_lit «{» + LexTerm : •- ( char_lit - char_lit ) «{» LexTerm : •regDefId «{» LexTerm : •[ LexPattern ] «{» LexTerm : •{ LexPattern } «{» LexTerm : •( LexPattern ) «{» - LexTerm : •. «~» - LexTerm : •char_lit «~» - LexTerm : •char_lit - char_lit «~» - LexTerm : •~ char_lit «~» - LexTerm : •~ ( char_lit - char_lit ) «~» - LexTerm : •regDefId «~» - LexTerm : •[ LexPattern ] «~» - LexTerm : •{ LexPattern } «~» - LexTerm : •( LexPattern ) «~» -} -Transitions: - regDefId -> 64 +} +Transitions: + regDefId -> 66 . -> 67 char_lit -> 68 - ~ -> 69 + - -> 69 ( -> 70 [ -> 71 { -> 72 @@ -4843,27 +4843,27 @@ Transitions: S131{ LexTerm : char_lit - char_lit• «]» LexTerm : char_lit - char_lit• «(» + LexTerm : char_lit - char_lit• «-» LexTerm : char_lit - char_lit• «.» LexTerm : char_lit - char_lit• «[» LexTerm : char_lit - char_lit• «char_lit» LexTerm : char_lit - char_lit• «regDefId» LexTerm : char_lit - char_lit• «{» - LexTerm : char_lit - char_lit• «~» LexTerm : char_lit - char_lit• «|» } Transitions: S132{ - LexTerm : ~ ( char_lit •- char_lit ) «]» - LexTerm : ~ ( char_lit •- char_lit ) «(» - LexTerm : ~ ( char_lit •- char_lit ) «.» - LexTerm : ~ ( char_lit •- char_lit ) «[» - LexTerm : ~ ( char_lit •- char_lit ) «char_lit» - LexTerm : ~ ( char_lit •- char_lit ) «regDefId» - LexTerm : ~ ( char_lit •- char_lit ) «{» - LexTerm : ~ ( char_lit •- char_lit ) «~» - LexTerm : ~ ( char_lit •- char_lit ) «|» + LexTerm : - ( char_lit •- char_lit ) «]» + LexTerm : - ( char_lit •- char_lit ) «(» + LexTerm : - ( char_lit •- char_lit ) «-» + LexTerm : - ( char_lit •- char_lit ) «.» + LexTerm : - ( char_lit •- char_lit ) «[» + LexTerm : - ( char_lit •- char_lit ) «char_lit» + LexTerm : - ( char_lit •- char_lit ) «regDefId» + LexTerm : - ( char_lit •- char_lit ) «{» + LexTerm : - ( char_lit •- char_lit ) «|» } Transitions: - -> 144 @@ -4872,12 +4872,12 @@ Transitions: S133{ LexTerm : ( LexPattern )• «]» LexTerm : ( LexPattern )• «(» + LexTerm : ( LexPattern )• «-» LexTerm : ( LexPattern )• «.» LexTerm : ( LexPattern )• «[» LexTerm : ( LexPattern )• «char_lit» LexTerm : ( LexPattern )• «regDefId» LexTerm : ( LexPattern )• «{» - LexTerm : ( LexPattern )• «~» LexTerm : ( LexPattern )• «|» } Transitions: @@ -4886,12 +4886,12 @@ Transitions: S134{ LexTerm : [ LexPattern ]• «]» LexTerm : [ LexPattern ]• «(» + LexTerm : [ LexPattern ]• «-» LexTerm : [ LexPattern ]• «.» LexTerm : [ LexPattern ]• «[» LexTerm : [ LexPattern ]• «char_lit» LexTerm : [ LexPattern ]• «regDefId» LexTerm : [ LexPattern ]• «{» - LexTerm : [ LexPattern ]• «~» LexTerm : [ LexPattern ]• «|» } Transitions: @@ -4900,12 +4900,12 @@ Transitions: S135{ LexTerm : { LexPattern }• «]» LexTerm : { LexPattern }• «(» + LexTerm : { LexPattern }• «-» LexTerm : { LexPattern }• «.» LexTerm : { LexPattern }• «[» LexTerm : { LexPattern }• «char_lit» LexTerm : { LexPattern }• «regDefId» LexTerm : { LexPattern }• «{» - LexTerm : { LexPattern }• «~» LexTerm : { LexPattern }• «|» } Transitions: @@ -4917,17 +4917,17 @@ S136{ LexAlt : LexAlt •LexTerm «}» LexAlt : LexAlt •LexTerm «|» LexAlt : LexAlt •LexTerm «(» + LexAlt : LexAlt •LexTerm «-» LexAlt : LexAlt •LexTerm «.» LexAlt : LexAlt •LexTerm «[» LexAlt : LexAlt •LexTerm «char_lit» LexAlt : LexAlt •LexTerm «regDefId» LexAlt : LexAlt •LexTerm «{» - LexAlt : LexAlt •LexTerm «~» LexTerm : •. «}» LexTerm : •char_lit «}» LexTerm : •char_lit - char_lit «}» - LexTerm : •~ char_lit «}» - LexTerm : •~ ( char_lit - char_lit ) «}» + LexTerm : •- char_lit «}» + LexTerm : •- ( char_lit - char_lit ) «}» LexTerm : •regDefId «}» LexTerm : •[ LexPattern ] «}» LexTerm : •{ LexPattern } «}» @@ -4935,8 +4935,8 @@ S136{ LexTerm : •. «|» LexTerm : •char_lit «|» LexTerm : •char_lit - char_lit «|» - LexTerm : •~ char_lit «|» - LexTerm : •~ ( char_lit - char_lit ) «|» + LexTerm : •- char_lit «|» + LexTerm : •- ( char_lit - char_lit ) «|» LexTerm : •regDefId «|» LexTerm : •[ LexPattern ] «|» LexTerm : •{ LexPattern } «|» @@ -4944,17 +4944,26 @@ S136{ LexTerm : •. «(» LexTerm : •char_lit «(» LexTerm : •char_lit - char_lit «(» - LexTerm : •~ char_lit «(» - LexTerm : •~ ( char_lit - char_lit ) «(» + LexTerm : •- char_lit «(» + LexTerm : •- ( char_lit - char_lit ) «(» LexTerm : •regDefId «(» LexTerm : •[ LexPattern ] «(» LexTerm : •{ LexPattern } «(» LexTerm : •( LexPattern ) «(» + LexTerm : •. «-» + LexTerm : •char_lit «-» + LexTerm : •char_lit - char_lit «-» + LexTerm : •- char_lit «-» + LexTerm : •- ( char_lit - char_lit ) «-» + LexTerm : •regDefId «-» + LexTerm : •[ LexPattern ] «-» + LexTerm : •{ LexPattern } «-» + LexTerm : •( LexPattern ) «-» LexTerm : •. «.» LexTerm : •char_lit «.» LexTerm : •char_lit - char_lit «.» - LexTerm : •~ char_lit «.» - LexTerm : •~ ( char_lit - char_lit ) «.» + LexTerm : •- char_lit «.» + LexTerm : •- ( char_lit - char_lit ) «.» LexTerm : •regDefId «.» LexTerm : •[ LexPattern ] «.» LexTerm : •{ LexPattern } «.» @@ -4962,8 +4971,8 @@ S136{ LexTerm : •. «[» LexTerm : •char_lit «[» LexTerm : •char_lit - char_lit «[» - LexTerm : •~ char_lit «[» - LexTerm : •~ ( char_lit - char_lit ) «[» + LexTerm : •- char_lit «[» + LexTerm : •- ( char_lit - char_lit ) «[» LexTerm : •regDefId «[» LexTerm : •[ LexPattern ] «[» LexTerm : •{ LexPattern } «[» @@ -4971,8 +4980,8 @@ S136{ LexTerm : •. «char_lit» LexTerm : •char_lit «char_lit» LexTerm : •char_lit - char_lit «char_lit» - LexTerm : •~ char_lit «char_lit» - LexTerm : •~ ( char_lit - char_lit ) «char_lit» + LexTerm : •- char_lit «char_lit» + LexTerm : •- ( char_lit - char_lit ) «char_lit» LexTerm : •regDefId «char_lit» LexTerm : •[ LexPattern ] «char_lit» LexTerm : •{ LexPattern } «char_lit» @@ -4980,8 +4989,8 @@ S136{ LexTerm : •. «regDefId» LexTerm : •char_lit «regDefId» LexTerm : •char_lit - char_lit «regDefId» - LexTerm : •~ char_lit «regDefId» - LexTerm : •~ ( char_lit - char_lit ) «regDefId» + LexTerm : •- char_lit «regDefId» + LexTerm : •- ( char_lit - char_lit ) «regDefId» LexTerm : •regDefId «regDefId» LexTerm : •[ LexPattern ] «regDefId» LexTerm : •{ LexPattern } «regDefId» @@ -4989,27 +4998,18 @@ S136{ LexTerm : •. «{» LexTerm : •char_lit «{» LexTerm : •char_lit - char_lit «{» - LexTerm : •~ char_lit «{» - LexTerm : •~ ( char_lit - char_lit ) «{» + LexTerm : •- char_lit «{» + LexTerm : •- ( char_lit - char_lit ) «{» LexTerm : •regDefId «{» LexTerm : •[ LexPattern ] «{» LexTerm : •{ LexPattern } «{» LexTerm : •( LexPattern ) «{» - LexTerm : •. «~» - LexTerm : •char_lit «~» - LexTerm : •char_lit - char_lit «~» - LexTerm : •~ char_lit «~» - LexTerm : •~ ( char_lit - char_lit ) «~» - LexTerm : •regDefId «~» - LexTerm : •[ LexPattern ] «~» - LexTerm : •{ LexPattern } «~» - LexTerm : •( LexPattern ) «~» -} -Transitions: - regDefId -> 74 +} +Transitions: + regDefId -> 76 . -> 77 char_lit -> 78 - ~ -> 79 + - -> 79 ( -> 80 [ -> 81 { -> 82 @@ -5019,27 +5019,27 @@ Transitions: S137{ LexTerm : char_lit - char_lit• «}» LexTerm : char_lit - char_lit• «(» + LexTerm : char_lit - char_lit• «-» LexTerm : char_lit - char_lit• «.» LexTerm : char_lit - char_lit• «[» LexTerm : char_lit - char_lit• «char_lit» LexTerm : char_lit - char_lit• «regDefId» LexTerm : char_lit - char_lit• «{» - LexTerm : char_lit - char_lit• «~» LexTerm : char_lit - char_lit• «|» } Transitions: S138{ - LexTerm : ~ ( char_lit •- char_lit ) «}» - LexTerm : ~ ( char_lit •- char_lit ) «(» - LexTerm : ~ ( char_lit •- char_lit ) «.» - LexTerm : ~ ( char_lit •- char_lit ) «[» - LexTerm : ~ ( char_lit •- char_lit ) «char_lit» - LexTerm : ~ ( char_lit •- char_lit ) «regDefId» - LexTerm : ~ ( char_lit •- char_lit ) «{» - LexTerm : ~ ( char_lit •- char_lit ) «~» - LexTerm : ~ ( char_lit •- char_lit ) «|» + LexTerm : - ( char_lit •- char_lit ) «}» + LexTerm : - ( char_lit •- char_lit ) «(» + LexTerm : - ( char_lit •- char_lit ) «-» + LexTerm : - ( char_lit •- char_lit ) «.» + LexTerm : - ( char_lit •- char_lit ) «[» + LexTerm : - ( char_lit •- char_lit ) «char_lit» + LexTerm : - ( char_lit •- char_lit ) «regDefId» + LexTerm : - ( char_lit •- char_lit ) «{» + LexTerm : - ( char_lit •- char_lit ) «|» } Transitions: - -> 145 @@ -5048,12 +5048,12 @@ Transitions: S139{ LexTerm : ( LexPattern )• «}» LexTerm : ( LexPattern )• «(» + LexTerm : ( LexPattern )• «-» LexTerm : ( LexPattern )• «.» LexTerm : ( LexPattern )• «[» LexTerm : ( LexPattern )• «char_lit» LexTerm : ( LexPattern )• «regDefId» LexTerm : ( LexPattern )• «{» - LexTerm : ( LexPattern )• «~» LexTerm : ( LexPattern )• «|» } Transitions: @@ -5062,12 +5062,12 @@ Transitions: S140{ LexTerm : [ LexPattern ]• «}» LexTerm : [ LexPattern ]• «(» + LexTerm : [ LexPattern ]• «-» LexTerm : [ LexPattern ]• «.» LexTerm : [ LexPattern ]• «[» LexTerm : [ LexPattern ]• «char_lit» LexTerm : [ LexPattern ]• «regDefId» LexTerm : [ LexPattern ]• «{» - LexTerm : [ LexPattern ]• «~» LexTerm : [ LexPattern ]• «|» } Transitions: @@ -5076,174 +5076,174 @@ Transitions: S141{ LexTerm : { LexPattern }• «}» LexTerm : { LexPattern }• «(» + LexTerm : { LexPattern }• «-» LexTerm : { LexPattern }• «.» LexTerm : { LexPattern }• «[» LexTerm : { LexPattern }• «char_lit» LexTerm : { LexPattern }• «regDefId» LexTerm : { LexPattern }• «{» - LexTerm : { LexPattern }• «~» LexTerm : { LexPattern }• «|» } Transitions: S142{ - LexTerm : ~ ( char_lit - char_lit •) «;» - LexTerm : ~ ( char_lit - char_lit •) «(» - LexTerm : ~ ( char_lit - char_lit •) «.» - LexTerm : ~ ( char_lit - char_lit •) «[» - LexTerm : ~ ( char_lit - char_lit •) «char_lit» - LexTerm : ~ ( char_lit - char_lit •) «regDefId» - LexTerm : ~ ( char_lit - char_lit •) «{» - LexTerm : ~ ( char_lit - char_lit •) «~» - LexTerm : ~ ( char_lit - char_lit •) «|» + LexTerm : - ( char_lit - char_lit •) «;» + LexTerm : - ( char_lit - char_lit •) «(» + LexTerm : - ( char_lit - char_lit •) «-» + LexTerm : - ( char_lit - char_lit •) «.» + LexTerm : - ( char_lit - char_lit •) «[» + LexTerm : - ( char_lit - char_lit •) «char_lit» + LexTerm : - ( char_lit - char_lit •) «regDefId» + LexTerm : - ( char_lit - char_lit •) «{» + LexTerm : - ( char_lit - char_lit •) «|» } Transitions: ) -> 146 S143{ - LexTerm : ~ ( char_lit - •char_lit ) «)» - LexTerm : ~ ( char_lit - •char_lit ) «(» - LexTerm : ~ ( char_lit - •char_lit ) «.» - LexTerm : ~ ( char_lit - •char_lit ) «[» - LexTerm : ~ ( char_lit - •char_lit ) «char_lit» - LexTerm : ~ ( char_lit - •char_lit ) «regDefId» - LexTerm : ~ ( char_lit - •char_lit ) «{» - LexTerm : ~ ( char_lit - •char_lit ) «~» - LexTerm : ~ ( char_lit - •char_lit ) «|» + LexTerm : - ( char_lit - •char_lit ) «)» + LexTerm : - ( char_lit - •char_lit ) «(» + LexTerm : - ( char_lit - •char_lit ) «-» + LexTerm : - ( char_lit - •char_lit ) «.» + LexTerm : - ( char_lit - •char_lit ) «[» + LexTerm : - ( char_lit - •char_lit ) «char_lit» + LexTerm : - ( char_lit - •char_lit ) «regDefId» + LexTerm : - ( char_lit - •char_lit ) «{» + LexTerm : - ( char_lit - •char_lit ) «|» } Transitions: char_lit -> 147 S144{ - LexTerm : ~ ( char_lit - •char_lit ) «]» - LexTerm : ~ ( char_lit - •char_lit ) «(» - LexTerm : ~ ( char_lit - •char_lit ) «.» - LexTerm : ~ ( char_lit - •char_lit ) «[» - LexTerm : ~ ( char_lit - •char_lit ) «char_lit» - LexTerm : ~ ( char_lit - •char_lit ) «regDefId» - LexTerm : ~ ( char_lit - •char_lit ) «{» - LexTerm : ~ ( char_lit - •char_lit ) «~» - LexTerm : ~ ( char_lit - •char_lit ) «|» + LexTerm : - ( char_lit - •char_lit ) «]» + LexTerm : - ( char_lit - •char_lit ) «(» + LexTerm : - ( char_lit - •char_lit ) «-» + LexTerm : - ( char_lit - •char_lit ) «.» + LexTerm : - ( char_lit - •char_lit ) «[» + LexTerm : - ( char_lit - •char_lit ) «char_lit» + LexTerm : - ( char_lit - •char_lit ) «regDefId» + LexTerm : - ( char_lit - •char_lit ) «{» + LexTerm : - ( char_lit - •char_lit ) «|» } Transitions: char_lit -> 148 S145{ - LexTerm : ~ ( char_lit - •char_lit ) «}» - LexTerm : ~ ( char_lit - •char_lit ) «(» - LexTerm : ~ ( char_lit - •char_lit ) «.» - LexTerm : ~ ( char_lit - •char_lit ) «[» - LexTerm : ~ ( char_lit - •char_lit ) «char_lit» - LexTerm : ~ ( char_lit - •char_lit ) «regDefId» - LexTerm : ~ ( char_lit - •char_lit ) «{» - LexTerm : ~ ( char_lit - •char_lit ) «~» - LexTerm : ~ ( char_lit - •char_lit ) «|» + LexTerm : - ( char_lit - •char_lit ) «}» + LexTerm : - ( char_lit - •char_lit ) «(» + LexTerm : - ( char_lit - •char_lit ) «-» + LexTerm : - ( char_lit - •char_lit ) «.» + LexTerm : - ( char_lit - •char_lit ) «[» + LexTerm : - ( char_lit - •char_lit ) «char_lit» + LexTerm : - ( char_lit - •char_lit ) «regDefId» + LexTerm : - ( char_lit - •char_lit ) «{» + LexTerm : - ( char_lit - •char_lit ) «|» } Transitions: char_lit -> 149 S146{ - LexTerm : ~ ( char_lit - char_lit )• «;» - LexTerm : ~ ( char_lit - char_lit )• «(» - LexTerm : ~ ( char_lit - char_lit )• «.» - LexTerm : ~ ( char_lit - char_lit )• «[» - LexTerm : ~ ( char_lit - char_lit )• «char_lit» - LexTerm : ~ ( char_lit - char_lit )• «regDefId» - LexTerm : ~ ( char_lit - char_lit )• «{» - LexTerm : ~ ( char_lit - char_lit )• «~» - LexTerm : ~ ( char_lit - char_lit )• «|» + LexTerm : - ( char_lit - char_lit )• «;» + LexTerm : - ( char_lit - char_lit )• «(» + LexTerm : - ( char_lit - char_lit )• «-» + LexTerm : - ( char_lit - char_lit )• «.» + LexTerm : - ( char_lit - char_lit )• «[» + LexTerm : - ( char_lit - char_lit )• «char_lit» + LexTerm : - ( char_lit - char_lit )• «regDefId» + LexTerm : - ( char_lit - char_lit )• «{» + LexTerm : - ( char_lit - char_lit )• «|» } Transitions: S147{ - LexTerm : ~ ( char_lit - char_lit •) «)» - LexTerm : ~ ( char_lit - char_lit •) «(» - LexTerm : ~ ( char_lit - char_lit •) «.» - LexTerm : ~ ( char_lit - char_lit •) «[» - LexTerm : ~ ( char_lit - char_lit •) «char_lit» - LexTerm : ~ ( char_lit - char_lit •) «regDefId» - LexTerm : ~ ( char_lit - char_lit •) «{» - LexTerm : ~ ( char_lit - char_lit •) «~» - LexTerm : ~ ( char_lit - char_lit •) «|» + LexTerm : - ( char_lit - char_lit •) «)» + LexTerm : - ( char_lit - char_lit •) «(» + LexTerm : - ( char_lit - char_lit •) «-» + LexTerm : - ( char_lit - char_lit •) «.» + LexTerm : - ( char_lit - char_lit •) «[» + LexTerm : - ( char_lit - char_lit •) «char_lit» + LexTerm : - ( char_lit - char_lit •) «regDefId» + LexTerm : - ( char_lit - char_lit •) «{» + LexTerm : - ( char_lit - char_lit •) «|» } Transitions: ) -> 150 S148{ - LexTerm : ~ ( char_lit - char_lit •) «]» - LexTerm : ~ ( char_lit - char_lit •) «(» - LexTerm : ~ ( char_lit - char_lit •) «.» - LexTerm : ~ ( char_lit - char_lit •) «[» - LexTerm : ~ ( char_lit - char_lit •) «char_lit» - LexTerm : ~ ( char_lit - char_lit •) «regDefId» - LexTerm : ~ ( char_lit - char_lit •) «{» - LexTerm : ~ ( char_lit - char_lit •) «~» - LexTerm : ~ ( char_lit - char_lit •) «|» + LexTerm : - ( char_lit - char_lit •) «]» + LexTerm : - ( char_lit - char_lit •) «(» + LexTerm : - ( char_lit - char_lit •) «-» + LexTerm : - ( char_lit - char_lit •) «.» + LexTerm : - ( char_lit - char_lit •) «[» + LexTerm : - ( char_lit - char_lit •) «char_lit» + LexTerm : - ( char_lit - char_lit •) «regDefId» + LexTerm : - ( char_lit - char_lit •) «{» + LexTerm : - ( char_lit - char_lit •) «|» } Transitions: ) -> 151 S149{ - LexTerm : ~ ( char_lit - char_lit •) «}» - LexTerm : ~ ( char_lit - char_lit •) «(» - LexTerm : ~ ( char_lit - char_lit •) «.» - LexTerm : ~ ( char_lit - char_lit •) «[» - LexTerm : ~ ( char_lit - char_lit •) «char_lit» - LexTerm : ~ ( char_lit - char_lit •) «regDefId» - LexTerm : ~ ( char_lit - char_lit •) «{» - LexTerm : ~ ( char_lit - char_lit •) «~» - LexTerm : ~ ( char_lit - char_lit •) «|» + LexTerm : - ( char_lit - char_lit •) «}» + LexTerm : - ( char_lit - char_lit •) «(» + LexTerm : - ( char_lit - char_lit •) «-» + LexTerm : - ( char_lit - char_lit •) «.» + LexTerm : - ( char_lit - char_lit •) «[» + LexTerm : - ( char_lit - char_lit •) «char_lit» + LexTerm : - ( char_lit - char_lit •) «regDefId» + LexTerm : - ( char_lit - char_lit •) «{» + LexTerm : - ( char_lit - char_lit •) «|» } Transitions: ) -> 152 S150{ - LexTerm : ~ ( char_lit - char_lit )• «)» - LexTerm : ~ ( char_lit - char_lit )• «(» - LexTerm : ~ ( char_lit - char_lit )• «.» - LexTerm : ~ ( char_lit - char_lit )• «[» - LexTerm : ~ ( char_lit - char_lit )• «char_lit» - LexTerm : ~ ( char_lit - char_lit )• «regDefId» - LexTerm : ~ ( char_lit - char_lit )• «{» - LexTerm : ~ ( char_lit - char_lit )• «~» - LexTerm : ~ ( char_lit - char_lit )• «|» + LexTerm : - ( char_lit - char_lit )• «)» + LexTerm : - ( char_lit - char_lit )• «(» + LexTerm : - ( char_lit - char_lit )• «-» + LexTerm : - ( char_lit - char_lit )• «.» + LexTerm : - ( char_lit - char_lit )• «[» + LexTerm : - ( char_lit - char_lit )• «char_lit» + LexTerm : - ( char_lit - char_lit )• «regDefId» + LexTerm : - ( char_lit - char_lit )• «{» + LexTerm : - ( char_lit - char_lit )• «|» } Transitions: S151{ - LexTerm : ~ ( char_lit - char_lit )• «]» - LexTerm : ~ ( char_lit - char_lit )• «(» - LexTerm : ~ ( char_lit - char_lit )• «.» - LexTerm : ~ ( char_lit - char_lit )• «[» - LexTerm : ~ ( char_lit - char_lit )• «char_lit» - LexTerm : ~ ( char_lit - char_lit )• «regDefId» - LexTerm : ~ ( char_lit - char_lit )• «{» - LexTerm : ~ ( char_lit - char_lit )• «~» - LexTerm : ~ ( char_lit - char_lit )• «|» + LexTerm : - ( char_lit - char_lit )• «]» + LexTerm : - ( char_lit - char_lit )• «(» + LexTerm : - ( char_lit - char_lit )• «-» + LexTerm : - ( char_lit - char_lit )• «.» + LexTerm : - ( char_lit - char_lit )• «[» + LexTerm : - ( char_lit - char_lit )• «char_lit» + LexTerm : - ( char_lit - char_lit )• «regDefId» + LexTerm : - ( char_lit - char_lit )• «{» + LexTerm : - ( char_lit - char_lit )• «|» } Transitions: S152{ - LexTerm : ~ ( char_lit - char_lit )• «}» - LexTerm : ~ ( char_lit - char_lit )• «(» - LexTerm : ~ ( char_lit - char_lit )• «.» - LexTerm : ~ ( char_lit - char_lit )• «[» - LexTerm : ~ ( char_lit - char_lit )• «char_lit» - LexTerm : ~ ( char_lit - char_lit )• «regDefId» - LexTerm : ~ ( char_lit - char_lit )• «{» - LexTerm : ~ ( char_lit - char_lit )• «~» - LexTerm : ~ ( char_lit - char_lit )• «|» + LexTerm : - ( char_lit - char_lit )• «}» + LexTerm : - ( char_lit - char_lit )• «(» + LexTerm : - ( char_lit - char_lit )• «-» + LexTerm : - ( char_lit - char_lit )• «.» + LexTerm : - ( char_lit - char_lit )• «[» + LexTerm : - ( char_lit - char_lit )• «char_lit» + LexTerm : - ( char_lit - char_lit )• «regDefId» + LexTerm : - ( char_lit - char_lit )• «{» + LexTerm : - ( char_lit - char_lit )• «|» } Transitions: diff --git a/internal/fe2/first.txt b/internal/fe2/log/first.txt similarity index 95% rename from internal/fe2/first.txt rename to internal/fe2/log/first.txt index 8def1809..d1fec2f2 100644 --- a/internal/fe2/first.txt +++ b/internal/fe2/log/first.txt @@ -29,30 +29,30 @@ LexProduction: { } LexPattern: { ( + - . [ char_lit regDefId { - ~ } LexAlt: { ( + - . [ char_lit regDefId { - ~ } LexTerm: { ( + - . [ char_lit regDefId { - ~ } SyntaxPart: { g_sdt_lit @@ -69,7 +69,7 @@ SyntaxProduction: { } Alternatives: { empty - errore + error prodId string_lit tokId @@ -79,7 +79,7 @@ Alternatives: { } SyntaxBody: { empty - errore + error prodId string_lit tokId @@ -97,7 +97,7 @@ Symbol: { tokId } ErrorSymbol: { - errore + error λ } EpsilonSymbol: { diff --git a/internal/fe2/lexer_sets.txt b/internal/fe2/log/lexer_sets.txt similarity index 91% rename from internal/fe2/lexer_sets.txt rename to internal/fe2/log/lexer_sets.txt index ca376f8a..a03a485a 100644 --- a/internal/fe2/lexer_sets.txt +++ b/internal/fe2/log/lexer_sets.txt @@ -19,14 +19,13 @@ S0{ | : • '|' . : • '.' - : • '-' - ~ : • '~' ( : • '(' ) : • ')' [ : • '[' ] : • ']' { : • '{' } : • '}' - errore : • 'e' 'r' 'r' 'o' 'r' 'e' + error : • 'e' 'r' 'r' 'o' 'r' λ : • \u03bb empty : • 'e' 'm' 'p' 't' 'y' ε : • \u03b5 @@ -65,11 +64,10 @@ Transitions: ['{','{'] -> S20 ['|','|'] -> S21 ['}','}'] -> S22 - ['~','~'] -> S23 - [\u03b5,\u03b5] -> S24 - [\u03bb,\u03bb] -> S25 + [\u03b5,\u03b5] -> S23 + [\u03bb,\u03bb] -> S24 Action: nil -Symbols classes: {['\t','\t'], ['\n','\n'], ['\r','\r'], [' ',' '], ['!','!'], ['"','"'], [''','''], ['(','('], [')',')'], ['-','-'], ['.','.'], ['/','/'], [':',':'], [';',';'], ['<','<'], ['A','Z'], ['[','['], [']',']'], ['_','_'], ['`','`'], ['a','d'], ['e','e'], ['f','z'], ['{','{'], ['|','|'], ['}','}'], ['~','~'], [\u03b5,\u03b5], [\u03bb,\u03bb]} +Symbols classes: {['\t','\t'], ['\n','\n'], ['\r','\r'], [' ',' '], ['!','!'], ['"','"'], [''','''], ['(','('], [')',')'], ['-','-'], ['.','.'], ['/','/'], [':',':'], [';',';'], ['<','<'], ['A','Z'], ['[','['], [']',']'], ['_','_'], ['`','`'], ['a','d'], ['e','e'], ['f','z'], ['{','{'], ['|','|'], ['}','}'], [\u03b5,\u03b5], [\u03bb,\u03bb]} S1{ !whitespace : (' ' | '\t' | '\n' | '\r') • @@ -84,7 +82,7 @@ S2{ _lowcase : • 'a'-'z' } Transitions: - ['a','z'] -> S26 + ['a','z'] -> S25 Action: nil Symbols classes: {['a','z']} @@ -106,9 +104,9 @@ S3{ _little_u_value : • '\' 'u' _hex_digit _hex_digit _hex_digit _hex_digit } Transitions: - ['"','"'] -> S27 - ['\','\'] -> S28 -. -> S29 + ['"','"'] -> S26 + ['\','\'] -> S27 +. -> S28 Action: nil Symbols classes: {['"','"'], ['\','\']} @@ -128,8 +126,8 @@ S4{ _little_u_value : • '\' 'u' _hex_digit _hex_digit _hex_digit _hex_digit } Transitions: - ['\','\'] -> S30 -. -> S31 + ['\','\'] -> S29 +. -> S30 Action: nil Symbols classes: {['\','\']} @@ -168,8 +166,8 @@ S9{ !comment : • _lineComment | _blockComment } Transitions: - ['*','*'] -> S32 - ['/','/'] -> S33 + ['*','*'] -> S31 + ['/','/'] -> S32 Action: nil Symbols classes: {['*','*'], ['/','/']} @@ -191,7 +189,7 @@ S12{ g_sdt_lit : '<' • '<' . {.} '>' '>' } Transitions: - ['<','<'] -> S34 + ['<','<'] -> S33 Action: nil Symbols classes: {['<','<']} @@ -208,10 +206,10 @@ S13{ _upcase : • 'A'-'Z' } Transitions: - ['0','9'] -> S35 - ['A','Z'] -> S36 - ['_','_'] -> S37 - ['a','z'] -> S38 + ['0','9'] -> S34 + ['A','Z'] -> S35 + ['_','_'] -> S36 + ['a','z'] -> S37 Action: Accept("prodId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} @@ -241,10 +239,10 @@ S16{ _upcase : • 'A'-'Z' } Transitions: - ['0','9'] -> S39 - ['A','Z'] -> S40 - ['_','_'] -> S41 - ['a','z'] -> S42 + ['0','9'] -> S38 + ['A','Z'] -> S39 + ['_','_'] -> S40 + ['a','z'] -> S41 Action: Accept("regDefId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} @@ -254,7 +252,7 @@ S17{ string_lit : • _raw_string | _interpreted_string } Transitions: - ['`','`'] -> S43 + ['`','`'] -> S42 . -> S17 Action: nil Symbols classes: {['`','`']} @@ -274,15 +272,15 @@ S18{ _upcase : • 'A'-'Z' } Transitions: - ['0','9'] -> S44 - ['A','Z'] -> S45 - ['_','_'] -> S46 - ['a','z'] -> S47 + ['0','9'] -> S43 + ['A','Z'] -> S44 + ['_','_'] -> S45 + ['a','z'] -> S46 Action: Accept("tokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} S19{ - errore : 'e' • 'r' 'r' 'o' 'r' 'e' + error : 'e' • 'r' 'r' 'o' 'r' empty : 'e' • 'm' 'p' 't' 'y' _lowcase : 'a'-'z' • _tokId : _lowcase {_id_char} • @@ -298,14 +296,14 @@ S19{ _upcase : • 'A'-'Z' } Transitions: - ['0','9'] -> S44 - ['A','Z'] -> S45 - ['_','_'] -> S46 - ['a','l'] -> S47 - ['m','m'] -> S48 - ['n','q'] -> S47 - ['r','r'] -> S49 - ['s','z'] -> S47 + ['0','9'] -> S43 + ['A','Z'] -> S44 + ['_','_'] -> S45 + ['a','l'] -> S46 + ['m','m'] -> S47 + ['n','q'] -> S46 + ['r','r'] -> S48 + ['s','z'] -> S46 Action: Accept("tokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','l'], ['m','m'], ['n','q'], ['r','r'], ['s','z']} @@ -331,27 +329,20 @@ Action: Accept("}") Symbols classes: {} S23{ - ~ : '~' • -} -Transitions: -Action: Accept("~") -Symbols classes: {} - -S24{ ε : \u03b5 • } Transitions: Action: Accept("ε") Symbols classes: {} -S25{ +S24{ λ : \u03bb • } Transitions: Action: Accept("λ") Symbols classes: {} -S26{ +S25{ _lowcase : 'a'-'z' • _tokId : _lowcase {_id_char} • _tokId : _lowcase {• _id_char} @@ -366,14 +357,14 @@ S26{ _upcase : • 'A'-'Z' } Transitions: - ['0','9'] -> S50 - ['A','Z'] -> S51 - ['_','_'] -> S52 - ['a','z'] -> S53 + ['0','9'] -> S49 + ['A','Z'] -> S50 + ['_','_'] -> S51 + ['a','z'] -> S52 Action: Accept("ignoredTokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} -S27{ +S26{ _interpreted_string : '"' {_unicode_value | _byte_value} '"' • string_lit : (_raw_string | _interpreted_string) • } @@ -381,7 +372,7 @@ Transitions: Action: Accept("string_lit") Symbols classes: {} -S28{ +S27{ _hex_byte_value : '\' • 'x' _hex_digit _hex_digit _octal_byte_value : '\' • _octal_digit _octal_digit _octal_digit _escaped_char : '\' ('a' | 'b' | 'f' | 'n' | 'r' | 't' | 'v' | '\' | ''' | • '"') @@ -407,24 +398,24 @@ S28{ _octal_digit : • '0'-'7' } Transitions: - ['"','"'] -> S54 - [''','''] -> S54 - ['0','7'] -> S55 - ['U','U'] -> S56 - ['\','\'] -> S54 - ['a','a'] -> S54 - ['b','b'] -> S54 - ['f','f'] -> S54 - ['n','n'] -> S54 - ['r','r'] -> S54 - ['t','t'] -> S54 - ['u','u'] -> S57 - ['v','v'] -> S54 - ['x','x'] -> S58 + ['"','"'] -> S53 + [''','''] -> S53 + ['0','7'] -> S54 + ['U','U'] -> S55 + ['\','\'] -> S53 + ['a','a'] -> S53 + ['b','b'] -> S53 + ['f','f'] -> S53 + ['n','n'] -> S53 + ['r','r'] -> S53 + ['t','t'] -> S53 + ['u','u'] -> S56 + ['v','v'] -> S53 + ['x','x'] -> S57 Action: nil Symbols classes: {['"','"'], [''','''], ['0','7'], ['U','U'], ['\','\'], ['a','a'], ['b','b'], ['f','f'], ['n','n'], ['r','r'], ['t','t'], ['u','u'], ['v','v'], ['x','x']} -S29{ +S28{ _unicode_value : (. | _little_u_value | _big_u_value | _escaped_char) • _interpreted_string : '"' {_unicode_value | _byte_value} • '"' _interpreted_string : '"' {_unicode_value | • _byte_value} '"' @@ -443,13 +434,13 @@ S29{ _little_u_value : • '\' 'u' _hex_digit _hex_digit _hex_digit _hex_digit } Transitions: - ['"','"'] -> S27 - ['\','\'] -> S28 -. -> S29 + ['"','"'] -> S26 + ['\','\'] -> S27 +. -> S28 Action: nil Symbols classes: {['"','"'], ['\','\']} -S30{ +S29{ _hex_byte_value : '\' • 'x' _hex_digit _hex_digit _octal_byte_value : '\' • _octal_digit _octal_digit _octal_digit _escaped_char : '\' ('a' | 'b' | 'f' | 'n' | 'r' | 't' | 'v' | '\' | ''' | • '"') @@ -474,64 +465,64 @@ S30{ _octal_digit : • '0'-'7' } Transitions: - ['"','"'] -> S59 - [''','''] -> S59 - ['0','7'] -> S60 - ['U','U'] -> S61 - ['\','\'] -> S59 - ['a','a'] -> S59 - ['b','b'] -> S59 - ['f','f'] -> S59 - ['n','n'] -> S59 - ['r','r'] -> S59 - ['t','t'] -> S59 - ['u','u'] -> S62 - ['v','v'] -> S59 - ['x','x'] -> S63 + ['"','"'] -> S58 + [''','''] -> S58 + ['0','7'] -> S59 + ['U','U'] -> S60 + ['\','\'] -> S58 + ['a','a'] -> S58 + ['b','b'] -> S58 + ['f','f'] -> S58 + ['n','n'] -> S58 + ['r','r'] -> S58 + ['t','t'] -> S58 + ['u','u'] -> S61 + ['v','v'] -> S58 + ['x','x'] -> S62 Action: nil Symbols classes: {['"','"'], [''','''], ['0','7'], ['U','U'], ['\','\'], ['a','a'], ['b','b'], ['f','f'], ['n','n'], ['r','r'], ['t','t'], ['u','u'], ['v','v'], ['x','x']} -S31{ +S30{ _unicode_value : (. | _little_u_value | _big_u_value | _escaped_char) • char_lit : ''' (_unicode_value | _byte_value) • ''' } Transitions: - [''','''] -> S64 + [''','''] -> S63 Action: nil Symbols classes: {[''',''']} -S32{ +S31{ _blockComment : '/' '*' {. | '*'} • '*' '/' _blockComment : '/' '*' {. | • '*'} '*' '/' _blockComment : '/' '*' {• . | '*'} '*' '/' !comment : _lineComment | • _blockComment } Transitions: - ['*','*'] -> S65 -. -> S32 + ['*','*'] -> S64 +. -> S31 Action: nil Symbols classes: {['*','*']} -S33{ +S32{ _lineComment : '/' '/' {.} • '\n' _lineComment : '/' '/' {• .} '\n' !comment : • _lineComment | _blockComment } Transitions: - ['\n','\n'] -> S66 -. -> S33 + ['\n','\n'] -> S65 +. -> S32 Action: nil Symbols classes: {['\n','\n']} -S34{ +S33{ g_sdt_lit : '<' '<' • . {.} '>' '>' } Transitions: -. -> S67 +. -> S66 Action: nil Symbols classes: {} -S35{ +S34{ _digit : '0'-'9' • _id_char : (_upcase | _lowcase | '_' | _digit) • prodId : _upcase {_id_char} • @@ -545,14 +536,14 @@ S35{ _upcase : • 'A'-'Z' } Transitions: - ['0','9'] -> S35 - ['A','Z'] -> S36 - ['_','_'] -> S37 - ['a','z'] -> S38 + ['0','9'] -> S34 + ['A','Z'] -> S35 + ['_','_'] -> S36 + ['a','z'] -> S37 Action: Accept("prodId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} -S36{ +S35{ _upcase : 'A'-'Z' • _id_char : (_upcase | _lowcase | '_' | _digit) • prodId : _upcase {_id_char} • @@ -566,14 +557,14 @@ S36{ _upcase : • 'A'-'Z' } Transitions: - ['0','9'] -> S35 - ['A','Z'] -> S36 - ['_','_'] -> S37 - ['a','z'] -> S38 + ['0','9'] -> S34 + ['A','Z'] -> S35 + ['_','_'] -> S36 + ['a','z'] -> S37 Action: Accept("prodId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} -S37{ +S36{ _id_char : (_upcase | _lowcase | '_' | _digit) • prodId : _upcase {_id_char} • prodId : _upcase {• _id_char} @@ -586,14 +577,14 @@ S37{ _upcase : • 'A'-'Z' } Transitions: - ['0','9'] -> S35 - ['A','Z'] -> S36 - ['_','_'] -> S37 - ['a','z'] -> S38 + ['0','9'] -> S34 + ['A','Z'] -> S35 + ['_','_'] -> S36 + ['a','z'] -> S37 Action: Accept("prodId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} -S38{ +S37{ _lowcase : 'a'-'z' • _id_char : (_upcase | _lowcase | '_' | _digit) • prodId : _upcase {_id_char} • @@ -607,14 +598,14 @@ S38{ _upcase : • 'A'-'Z' } Transitions: - ['0','9'] -> S35 - ['A','Z'] -> S36 - ['_','_'] -> S37 - ['a','z'] -> S38 + ['0','9'] -> S34 + ['A','Z'] -> S35 + ['_','_'] -> S36 + ['a','z'] -> S37 Action: Accept("prodId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} -S39{ +S38{ _digit : '0'-'9' • _id_char : (_upcase | _lowcase | '_' | _digit) • regDefId : '_' {_id_char} • @@ -628,14 +619,14 @@ S39{ _upcase : • 'A'-'Z' } Transitions: - ['0','9'] -> S39 - ['A','Z'] -> S40 - ['_','_'] -> S41 - ['a','z'] -> S42 + ['0','9'] -> S38 + ['A','Z'] -> S39 + ['_','_'] -> S40 + ['a','z'] -> S41 Action: Accept("regDefId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} -S40{ +S39{ _upcase : 'A'-'Z' • _id_char : (_upcase | _lowcase | '_' | _digit) • regDefId : '_' {_id_char} • @@ -649,14 +640,14 @@ S40{ _upcase : • 'A'-'Z' } Transitions: - ['0','9'] -> S39 - ['A','Z'] -> S40 - ['_','_'] -> S41 - ['a','z'] -> S42 + ['0','9'] -> S38 + ['A','Z'] -> S39 + ['_','_'] -> S40 + ['a','z'] -> S41 Action: Accept("regDefId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} -S41{ +S40{ _id_char : (_upcase | _lowcase | '_' | _digit) • regDefId : '_' {_id_char} • regDefId : '_' {• _id_char} @@ -669,14 +660,14 @@ S41{ _upcase : • 'A'-'Z' } Transitions: - ['0','9'] -> S39 - ['A','Z'] -> S40 - ['_','_'] -> S41 - ['a','z'] -> S42 + ['0','9'] -> S38 + ['A','Z'] -> S39 + ['_','_'] -> S40 + ['a','z'] -> S41 Action: Accept("regDefId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} -S42{ +S41{ _lowcase : 'a'-'z' • _id_char : (_upcase | _lowcase | '_' | _digit) • regDefId : '_' {_id_char} • @@ -690,14 +681,14 @@ S42{ _upcase : • 'A'-'Z' } Transitions: - ['0','9'] -> S39 - ['A','Z'] -> S40 - ['_','_'] -> S41 - ['a','z'] -> S42 + ['0','9'] -> S38 + ['A','Z'] -> S39 + ['_','_'] -> S40 + ['a','z'] -> S41 Action: Accept("regDefId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} -S43{ +S42{ _raw_string : '`' {.} '`' • string_lit : (_raw_string | _interpreted_string) • } @@ -705,7 +696,7 @@ Transitions: Action: Accept("string_lit") Symbols classes: {} -S44{ +S43{ _digit : '0'-'9' • _id_char : (_upcase | _lowcase | '_' | _digit) • _tokId : _lowcase {_id_char} • @@ -721,14 +712,14 @@ S44{ _upcase : • 'A'-'Z' } Transitions: - ['0','9'] -> S44 - ['A','Z'] -> S45 - ['_','_'] -> S46 - ['a','z'] -> S47 + ['0','9'] -> S43 + ['A','Z'] -> S44 + ['_','_'] -> S45 + ['a','z'] -> S46 Action: Accept("tokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} -S45{ +S44{ _upcase : 'A'-'Z' • _id_char : (_upcase | _lowcase | '_' | _digit) • _tokId : _lowcase {_id_char} • @@ -744,14 +735,14 @@ S45{ _upcase : • 'A'-'Z' } Transitions: - ['0','9'] -> S44 - ['A','Z'] -> S45 - ['_','_'] -> S46 - ['a','z'] -> S47 + ['0','9'] -> S43 + ['A','Z'] -> S44 + ['_','_'] -> S45 + ['a','z'] -> S46 Action: Accept("tokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} -S46{ +S45{ _id_char : (_upcase | _lowcase | '_' | _digit) • _tokId : _lowcase {_id_char} • _tokId : _lowcase {• _id_char} @@ -766,14 +757,14 @@ S46{ _upcase : • 'A'-'Z' } Transitions: - ['0','9'] -> S44 - ['A','Z'] -> S45 - ['_','_'] -> S46 - ['a','z'] -> S47 + ['0','9'] -> S43 + ['A','Z'] -> S44 + ['_','_'] -> S45 + ['a','z'] -> S46 Action: Accept("tokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} -S47{ +S46{ _lowcase : 'a'-'z' • _id_char : (_upcase | _lowcase | '_' | _digit) • _tokId : _lowcase {_id_char} • @@ -789,14 +780,14 @@ S47{ _upcase : • 'A'-'Z' } Transitions: - ['0','9'] -> S44 - ['A','Z'] -> S45 - ['_','_'] -> S46 - ['a','z'] -> S47 + ['0','9'] -> S43 + ['A','Z'] -> S44 + ['_','_'] -> S45 + ['a','z'] -> S46 Action: Accept("tokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} -S48{ +S47{ empty : 'e' 'm' • 'p' 't' 'y' _lowcase : 'a'-'z' • _id_char : (_upcase | _lowcase | '_' | _digit) • @@ -813,17 +804,17 @@ S48{ _upcase : • 'A'-'Z' } Transitions: - ['0','9'] -> S44 - ['A','Z'] -> S45 - ['_','_'] -> S46 - ['a','o'] -> S47 - ['p','p'] -> S68 - ['q','z'] -> S47 + ['0','9'] -> S43 + ['A','Z'] -> S44 + ['_','_'] -> S45 + ['a','o'] -> S46 + ['p','p'] -> S67 + ['q','z'] -> S46 Action: Accept("tokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','o'], ['p','p'], ['q','z']} -S49{ - errore : 'e' 'r' • 'r' 'o' 'r' 'e' +S48{ + error : 'e' 'r' • 'r' 'o' 'r' _lowcase : 'a'-'z' • _id_char : (_upcase | _lowcase | '_' | _digit) • _tokId : _lowcase {_id_char} • @@ -839,16 +830,16 @@ S49{ _upcase : • 'A'-'Z' } Transitions: - ['0','9'] -> S44 - ['A','Z'] -> S45 - ['_','_'] -> S46 - ['a','q'] -> S47 - ['r','r'] -> S69 - ['s','z'] -> S47 + ['0','9'] -> S43 + ['A','Z'] -> S44 + ['_','_'] -> S45 + ['a','q'] -> S46 + ['r','r'] -> S68 + ['s','z'] -> S46 Action: Accept("tokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','q'], ['r','r'], ['s','z']} -S50{ +S49{ _digit : '0'-'9' • _id_char : (_upcase | _lowcase | '_' | _digit) • _tokId : _lowcase {_id_char} • @@ -864,14 +855,14 @@ S50{ _upcase : • 'A'-'Z' } Transitions: - ['0','9'] -> S50 - ['A','Z'] -> S51 - ['_','_'] -> S52 - ['a','z'] -> S53 + ['0','9'] -> S49 + ['A','Z'] -> S50 + ['_','_'] -> S51 + ['a','z'] -> S52 Action: Accept("ignoredTokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} -S51{ +S50{ _upcase : 'A'-'Z' • _id_char : (_upcase | _lowcase | '_' | _digit) • _tokId : _lowcase {_id_char} • @@ -887,14 +878,14 @@ S51{ _upcase : • 'A'-'Z' } Transitions: - ['0','9'] -> S50 - ['A','Z'] -> S51 - ['_','_'] -> S52 - ['a','z'] -> S53 + ['0','9'] -> S49 + ['A','Z'] -> S50 + ['_','_'] -> S51 + ['a','z'] -> S52 Action: Accept("ignoredTokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} -S52{ +S51{ _id_char : (_upcase | _lowcase | '_' | _digit) • _tokId : _lowcase {_id_char} • _tokId : _lowcase {• _id_char} @@ -909,14 +900,14 @@ S52{ _upcase : • 'A'-'Z' } Transitions: - ['0','9'] -> S50 - ['A','Z'] -> S51 - ['_','_'] -> S52 - ['a','z'] -> S53 + ['0','9'] -> S49 + ['A','Z'] -> S50 + ['_','_'] -> S51 + ['a','z'] -> S52 Action: Accept("ignoredTokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} -S53{ +S52{ _lowcase : 'a'-'z' • _id_char : (_upcase | _lowcase | '_' | _digit) • _tokId : _lowcase {_id_char} • @@ -932,14 +923,14 @@ S53{ _upcase : • 'A'-'Z' } Transitions: - ['0','9'] -> S50 - ['A','Z'] -> S51 - ['_','_'] -> S52 - ['a','z'] -> S53 + ['0','9'] -> S49 + ['A','Z'] -> S50 + ['_','_'] -> S51 + ['a','z'] -> S52 Action: Accept("ignoredTokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} -S54{ +S53{ _escaped_char : '\' ('a' | 'b' | 'f' | 'n' | 'r' | 't' | 'v' | '\' | ''' | '"') • _unicode_value : (. | _little_u_value | _big_u_value | _escaped_char) • _interpreted_string : '"' {_unicode_value | _byte_value} • '"' @@ -959,13 +950,13 @@ S54{ _little_u_value : • '\' 'u' _hex_digit _hex_digit _hex_digit _hex_digit } Transitions: - ['"','"'] -> S27 - ['\','\'] -> S28 -. -> S29 + ['"','"'] -> S26 + ['\','\'] -> S27 +. -> S28 Action: nil Symbols classes: {['"','"'], ['\','\']} -S55{ +S54{ _octal_digit : '0'-'7' • _octal_byte_value : '\' _octal_digit • _octal_digit _octal_digit _byte_value : • _octal_byte_value | _hex_byte_value @@ -974,11 +965,11 @@ S55{ _octal_digit : • '0'-'7' } Transitions: - ['0','7'] -> S70 + ['0','7'] -> S69 Action: nil Symbols classes: {['0','7']} -S56{ +S55{ _big_u_value : '\' 'U' • _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char _interpreted_string : '"' {• _unicode_value | _byte_value} '"' @@ -988,13 +979,13 @@ S56{ _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' } Transitions: - ['0','9'] -> S71 - ['A','F'] -> S71 - ['a','f'] -> S71 + ['0','9'] -> S70 + ['A','F'] -> S70 + ['a','f'] -> S70 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S57{ +S56{ _little_u_value : '\' 'u' • _hex_digit _hex_digit _hex_digit _hex_digit _unicode_value : . | • _little_u_value | _big_u_value | _escaped_char _interpreted_string : '"' {• _unicode_value | _byte_value} '"' @@ -1004,13 +995,13 @@ S57{ _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' } Transitions: - ['0','9'] -> S72 - ['A','F'] -> S72 - ['a','f'] -> S72 + ['0','9'] -> S71 + ['A','F'] -> S71 + ['a','f'] -> S71 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S58{ +S57{ _hex_byte_value : '\' 'x' • _hex_digit _hex_digit _byte_value : _octal_byte_value | • _hex_byte_value _interpreted_string : '"' {_unicode_value | • _byte_value} '"' @@ -1020,23 +1011,23 @@ S58{ _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' } Transitions: - ['0','9'] -> S73 - ['A','F'] -> S73 - ['a','f'] -> S73 + ['0','9'] -> S72 + ['A','F'] -> S72 + ['a','f'] -> S72 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S59{ +S58{ _escaped_char : '\' ('a' | 'b' | 'f' | 'n' | 'r' | 't' | 'v' | '\' | ''' | '"') • _unicode_value : (. | _little_u_value | _big_u_value | _escaped_char) • char_lit : ''' (_unicode_value | _byte_value) • ''' } Transitions: - [''','''] -> S64 + [''','''] -> S63 Action: nil Symbols classes: {[''',''']} -S60{ +S59{ _octal_digit : '0'-'7' • _octal_byte_value : '\' _octal_digit • _octal_digit _octal_digit _byte_value : • _octal_byte_value | _hex_byte_value @@ -1044,11 +1035,11 @@ S60{ _octal_digit : • '0'-'7' } Transitions: - ['0','7'] -> S74 + ['0','7'] -> S73 Action: nil Symbols classes: {['0','7']} -S61{ +S60{ _big_u_value : '\' 'U' • _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char char_lit : ''' (• _unicode_value | _byte_value) ''' @@ -1057,13 +1048,13 @@ S61{ _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' } Transitions: - ['0','9'] -> S75 - ['A','F'] -> S75 - ['a','f'] -> S75 + ['0','9'] -> S74 + ['A','F'] -> S74 + ['a','f'] -> S74 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S62{ +S61{ _little_u_value : '\' 'u' • _hex_digit _hex_digit _hex_digit _hex_digit _unicode_value : . | • _little_u_value | _big_u_value | _escaped_char char_lit : ''' (• _unicode_value | _byte_value) ''' @@ -1072,13 +1063,13 @@ S62{ _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' } Transitions: - ['0','9'] -> S76 - ['A','F'] -> S76 - ['a','f'] -> S76 + ['0','9'] -> S75 + ['A','F'] -> S75 + ['a','f'] -> S75 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S63{ +S62{ _hex_byte_value : '\' 'x' • _hex_digit _hex_digit _byte_value : _octal_byte_value | • _hex_byte_value char_lit : ''' (_unicode_value | • _byte_value) ''' @@ -1087,20 +1078,20 @@ S63{ _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' } Transitions: - ['0','9'] -> S77 - ['A','F'] -> S77 - ['a','f'] -> S77 + ['0','9'] -> S76 + ['A','F'] -> S76 + ['a','f'] -> S76 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S64{ +S63{ char_lit : ''' (_unicode_value | _byte_value) ''' • } Transitions: Action: Accept("char_lit") Symbols classes: {} -S65{ +S64{ _blockComment : '/' '*' {. | '*'} '*' • '/' _blockComment : '/' '*' {. | '*'} • '*' '/' _blockComment : '/' '*' {. | • '*'} '*' '/' @@ -1108,13 +1099,13 @@ S65{ !comment : _lineComment | • _blockComment } Transitions: - ['*','*'] -> S65 - ['/','/'] -> S78 -. -> S32 + ['*','*'] -> S64 + ['/','/'] -> S77 +. -> S31 Action: nil Symbols classes: {['*','*'], ['/','/']} -S66{ +S65{ _lineComment : '/' '/' {.} '\n' • !comment : (_lineComment | _blockComment) • } @@ -1122,17 +1113,17 @@ Transitions: Action: Ignore("!comment") Symbols classes: {} -S67{ +S66{ g_sdt_lit : '<' '<' . {.} • '>' '>' g_sdt_lit : '<' '<' . {• .} '>' '>' } Transitions: - ['>','>'] -> S79 -. -> S67 + ['>','>'] -> S78 +. -> S66 Action: nil Symbols classes: {['>','>']} -S68{ +S67{ empty : 'e' 'm' 'p' • 't' 'y' _lowcase : 'a'-'z' • _id_char : (_upcase | _lowcase | '_' | _digit) • @@ -1149,17 +1140,17 @@ S68{ _upcase : • 'A'-'Z' } Transitions: - ['0','9'] -> S44 - ['A','Z'] -> S45 - ['_','_'] -> S46 - ['a','s'] -> S47 - ['t','t'] -> S80 - ['u','z'] -> S47 + ['0','9'] -> S43 + ['A','Z'] -> S44 + ['_','_'] -> S45 + ['a','s'] -> S46 + ['t','t'] -> S79 + ['u','z'] -> S46 Action: Accept("tokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','s'], ['t','t'], ['u','z']} -S69{ - errore : 'e' 'r' 'r' • 'o' 'r' 'e' +S68{ + error : 'e' 'r' 'r' • 'o' 'r' _lowcase : 'a'-'z' • _id_char : (_upcase | _lowcase | '_' | _digit) • _tokId : _lowcase {_id_char} • @@ -1175,16 +1166,16 @@ S69{ _upcase : • 'A'-'Z' } Transitions: - ['0','9'] -> S44 - ['A','Z'] -> S45 - ['_','_'] -> S46 - ['a','n'] -> S47 - ['o','o'] -> S81 - ['p','z'] -> S47 + ['0','9'] -> S43 + ['A','Z'] -> S44 + ['_','_'] -> S45 + ['a','n'] -> S46 + ['o','o'] -> S80 + ['p','z'] -> S46 Action: Accept("tokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','n'], ['o','o'], ['p','z']} -S70{ +S69{ _octal_digit : '0'-'7' • _octal_byte_value : '\' _octal_digit _octal_digit • _octal_digit _byte_value : • _octal_byte_value | _hex_byte_value @@ -1193,11 +1184,11 @@ S70{ _octal_digit : • '0'-'7' } Transitions: - ['0','7'] -> S82 + ['0','7'] -> S81 Action: nil Symbols classes: {['0','7']} -S71{ +S70{ _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _big_u_value : '\' 'U' _hex_digit • _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char @@ -1208,13 +1199,13 @@ S71{ _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' } Transitions: - ['0','9'] -> S83 - ['A','F'] -> S83 - ['a','f'] -> S83 + ['0','9'] -> S82 + ['A','F'] -> S82 + ['a','f'] -> S82 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S72{ +S71{ _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _little_u_value : '\' 'u' _hex_digit • _hex_digit _hex_digit _hex_digit _unicode_value : . | • _little_u_value | _big_u_value | _escaped_char @@ -1225,13 +1216,13 @@ S72{ _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' } Transitions: - ['0','9'] -> S84 - ['A','F'] -> S84 - ['a','f'] -> S84 + ['0','9'] -> S83 + ['A','F'] -> S83 + ['a','f'] -> S83 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S73{ +S72{ _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _hex_byte_value : '\' 'x' _hex_digit • _hex_digit _byte_value : _octal_byte_value | • _hex_byte_value @@ -1242,13 +1233,13 @@ S73{ _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' } Transitions: - ['0','9'] -> S85 - ['A','F'] -> S85 - ['a','f'] -> S85 + ['0','9'] -> S84 + ['A','F'] -> S84 + ['a','f'] -> S84 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S74{ +S73{ _octal_digit : '0'-'7' • _octal_byte_value : '\' _octal_digit _octal_digit • _octal_digit _byte_value : • _octal_byte_value | _hex_byte_value @@ -1256,11 +1247,11 @@ S74{ _octal_digit : • '0'-'7' } Transitions: - ['0','7'] -> S86 + ['0','7'] -> S85 Action: nil Symbols classes: {['0','7']} -S75{ +S74{ _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _big_u_value : '\' 'U' _hex_digit • _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char @@ -1270,13 +1261,13 @@ S75{ _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' } Transitions: - ['0','9'] -> S87 - ['A','F'] -> S87 - ['a','f'] -> S87 + ['0','9'] -> S86 + ['A','F'] -> S86 + ['a','f'] -> S86 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S76{ +S75{ _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _little_u_value : '\' 'u' _hex_digit • _hex_digit _hex_digit _hex_digit _unicode_value : . | • _little_u_value | _big_u_value | _escaped_char @@ -1286,13 +1277,13 @@ S76{ _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' } Transitions: - ['0','9'] -> S88 - ['A','F'] -> S88 - ['a','f'] -> S88 + ['0','9'] -> S87 + ['A','F'] -> S87 + ['a','f'] -> S87 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S77{ +S76{ _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _hex_byte_value : '\' 'x' _hex_digit • _hex_digit _byte_value : _octal_byte_value | • _hex_byte_value @@ -1302,13 +1293,13 @@ S77{ _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' } Transitions: - ['0','9'] -> S89 - ['A','F'] -> S89 - ['a','f'] -> S89 + ['0','9'] -> S88 + ['A','F'] -> S88 + ['a','f'] -> S88 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S78{ +S77{ _blockComment : '/' '*' {. | '*'} '*' '/' • !comment : (_lineComment | _blockComment) • } @@ -1316,15 +1307,15 @@ Transitions: Action: Ignore("!comment") Symbols classes: {} -S79{ +S78{ g_sdt_lit : '<' '<' . {.} '>' • '>' } Transitions: - ['>','>'] -> S90 + ['>','>'] -> S89 Action: nil Symbols classes: {['>','>']} -S80{ +S79{ empty : 'e' 'm' 'p' 't' • 'y' _lowcase : 'a'-'z' • _id_char : (_upcase | _lowcase | '_' | _digit) • @@ -1341,17 +1332,17 @@ S80{ _upcase : • 'A'-'Z' } Transitions: - ['0','9'] -> S44 - ['A','Z'] -> S45 - ['_','_'] -> S46 - ['a','x'] -> S47 - ['y','y'] -> S91 - ['z','z'] -> S47 + ['0','9'] -> S43 + ['A','Z'] -> S44 + ['_','_'] -> S45 + ['a','x'] -> S46 + ['y','y'] -> S90 + ['z','z'] -> S46 Action: Accept("tokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','x'], ['y','y'], ['z','z']} -S81{ - errore : 'e' 'r' 'r' 'o' • 'r' 'e' +S80{ + error : 'e' 'r' 'r' 'o' • 'r' _lowcase : 'a'-'z' • _id_char : (_upcase | _lowcase | '_' | _digit) • _tokId : _lowcase {_id_char} • @@ -1367,16 +1358,16 @@ S81{ _upcase : • 'A'-'Z' } Transitions: - ['0','9'] -> S44 - ['A','Z'] -> S45 - ['_','_'] -> S46 - ['a','q'] -> S47 - ['r','r'] -> S92 - ['s','z'] -> S47 + ['0','9'] -> S43 + ['A','Z'] -> S44 + ['_','_'] -> S45 + ['a','q'] -> S46 + ['r','r'] -> S91 + ['s','z'] -> S46 Action: Accept("tokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','q'], ['r','r'], ['s','z']} -S82{ +S81{ _octal_digit : '0'-'7' • _octal_byte_value : '\' _octal_digit _octal_digit _octal_digit • _byte_value : (_octal_byte_value | _hex_byte_value) • @@ -1397,13 +1388,13 @@ S82{ _little_u_value : • '\' 'u' _hex_digit _hex_digit _hex_digit _hex_digit } Transitions: - ['"','"'] -> S27 - ['\','\'] -> S28 -. -> S29 + ['"','"'] -> S26 + ['\','\'] -> S27 +. -> S28 Action: nil Symbols classes: {['"','"'], ['\','\']} -S83{ +S82{ _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _big_u_value : '\' 'U' _hex_digit _hex_digit • _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char @@ -1414,13 +1405,13 @@ S83{ _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' } Transitions: - ['0','9'] -> S93 - ['A','F'] -> S93 - ['a','f'] -> S93 + ['0','9'] -> S92 + ['A','F'] -> S92 + ['a','f'] -> S92 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S84{ +S83{ _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _little_u_value : '\' 'u' _hex_digit _hex_digit • _hex_digit _hex_digit _unicode_value : . | • _little_u_value | _big_u_value | _escaped_char @@ -1431,13 +1422,13 @@ S84{ _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' } Transitions: - ['0','9'] -> S94 - ['A','F'] -> S94 - ['a','f'] -> S94 + ['0','9'] -> S93 + ['A','F'] -> S93 + ['a','f'] -> S93 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S85{ +S84{ _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _hex_byte_value : '\' 'x' _hex_digit _hex_digit • _byte_value : (_octal_byte_value | _hex_byte_value) • @@ -1458,24 +1449,24 @@ S85{ _little_u_value : • '\' 'u' _hex_digit _hex_digit _hex_digit _hex_digit } Transitions: - ['"','"'] -> S27 - ['\','\'] -> S28 -. -> S29 + ['"','"'] -> S26 + ['\','\'] -> S27 +. -> S28 Action: nil Symbols classes: {['"','"'], ['\','\']} -S86{ +S85{ _octal_digit : '0'-'7' • _octal_byte_value : '\' _octal_digit _octal_digit _octal_digit • _byte_value : (_octal_byte_value | _hex_byte_value) • char_lit : ''' (_unicode_value | _byte_value) • ''' } Transitions: - [''','''] -> S64 + [''','''] -> S63 Action: nil Symbols classes: {[''',''']} -S87{ +S86{ _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _big_u_value : '\' 'U' _hex_digit _hex_digit • _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char @@ -1485,13 +1476,13 @@ S87{ _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' } Transitions: - ['0','9'] -> S95 - ['A','F'] -> S95 - ['a','f'] -> S95 + ['0','9'] -> S94 + ['A','F'] -> S94 + ['a','f'] -> S94 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S88{ +S87{ _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _little_u_value : '\' 'u' _hex_digit _hex_digit • _hex_digit _hex_digit _unicode_value : . | • _little_u_value | _big_u_value | _escaped_char @@ -1501,31 +1492,31 @@ S88{ _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' } Transitions: - ['0','9'] -> S96 - ['A','F'] -> S96 - ['a','f'] -> S96 + ['0','9'] -> S95 + ['A','F'] -> S95 + ['a','f'] -> S95 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S89{ +S88{ _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _hex_byte_value : '\' 'x' _hex_digit _hex_digit • _byte_value : (_octal_byte_value | _hex_byte_value) • char_lit : ''' (_unicode_value | _byte_value) • ''' } Transitions: - [''','''] -> S64 + [''','''] -> S63 Action: nil Symbols classes: {[''',''']} -S90{ +S89{ g_sdt_lit : '<' '<' . {.} '>' '>' • } Transitions: Action: Accept("g_sdt_lit") Symbols classes: {} -S91{ +S90{ empty : 'e' 'm' 'p' 't' 'y' • _lowcase : 'a'-'z' • _id_char : (_upcase | _lowcase | '_' | _digit) • @@ -1542,15 +1533,15 @@ S91{ _upcase : • 'A'-'Z' } Transitions: - ['0','9'] -> S44 - ['A','Z'] -> S45 - ['_','_'] -> S46 - ['a','z'] -> S47 + ['0','9'] -> S43 + ['A','Z'] -> S44 + ['_','_'] -> S45 + ['a','z'] -> S46 Action: Accept("empty") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} -S92{ - errore : 'e' 'r' 'r' 'o' 'r' • 'e' +S91{ + error : 'e' 'r' 'r' 'o' 'r' • _lowcase : 'a'-'z' • _id_char : (_upcase | _lowcase | '_' | _digit) • _tokId : _lowcase {_id_char} • @@ -1566,16 +1557,14 @@ S92{ _upcase : • 'A'-'Z' } Transitions: - ['0','9'] -> S44 - ['A','Z'] -> S45 - ['_','_'] -> S46 - ['a','d'] -> S47 - ['e','e'] -> S97 - ['f','z'] -> S47 -Action: Accept("tokId") -Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','d'], ['e','e'], ['f','z']} + ['0','9'] -> S43 + ['A','Z'] -> S44 + ['_','_'] -> S45 + ['a','z'] -> S46 +Action: Accept("error") +Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} -S93{ +S92{ _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit • _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char @@ -1586,13 +1575,13 @@ S93{ _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' } Transitions: - ['0','9'] -> S98 - ['A','F'] -> S98 - ['a','f'] -> S98 + ['0','9'] -> S96 + ['A','F'] -> S96 + ['a','f'] -> S96 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S94{ +S93{ _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _little_u_value : '\' 'u' _hex_digit _hex_digit _hex_digit • _hex_digit _unicode_value : . | • _little_u_value | _big_u_value | _escaped_char @@ -1603,13 +1592,13 @@ S94{ _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' } Transitions: - ['0','9'] -> S99 - ['A','F'] -> S99 - ['a','f'] -> S99 + ['0','9'] -> S97 + ['A','F'] -> S97 + ['a','f'] -> S97 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S95{ +S94{ _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit • _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char @@ -1619,13 +1608,13 @@ S95{ _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' } Transitions: - ['0','9'] -> S100 - ['A','F'] -> S100 - ['a','f'] -> S100 + ['0','9'] -> S98 + ['A','F'] -> S98 + ['a','f'] -> S98 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S96{ +S95{ _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _little_u_value : '\' 'u' _hex_digit _hex_digit _hex_digit • _hex_digit _unicode_value : . | • _little_u_value | _big_u_value | _escaped_char @@ -1635,37 +1624,13 @@ S96{ _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' } Transitions: - ['0','9'] -> S101 - ['A','F'] -> S101 - ['a','f'] -> S101 + ['0','9'] -> S99 + ['A','F'] -> S99 + ['a','f'] -> S99 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S97{ - errore : 'e' 'r' 'r' 'o' 'r' 'e' • - _lowcase : 'a'-'z' • - _id_char : (_upcase | _lowcase | '_' | _digit) • - _tokId : _lowcase {_id_char} • - _tokId : _lowcase {• _id_char} - tokId : _tokId • - tokId : • _tokId - _id_char : _upcase | _lowcase | '_' | • _digit - _id_char : _upcase | _lowcase | • '_' | _digit - _id_char : _upcase | • _lowcase | '_' | _digit - _id_char : • _upcase | _lowcase | '_' | _digit - _digit : • '0'-'9' - _lowcase : • 'a'-'z' - _upcase : • 'A'-'Z' -} -Transitions: - ['0','9'] -> S44 - ['A','Z'] -> S45 - ['_','_'] -> S46 - ['a','z'] -> S47 -Action: Accept("errore") -Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} - -S98{ +S96{ _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit • _hex_digit _hex_digit _hex_digit _hex_digit _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char @@ -1676,13 +1641,13 @@ S98{ _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' } Transitions: - ['0','9'] -> S102 - ['A','F'] -> S102 - ['a','f'] -> S102 + ['0','9'] -> S100 + ['A','F'] -> S100 + ['a','f'] -> S100 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S99{ +S97{ _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _little_u_value : '\' 'u' _hex_digit _hex_digit _hex_digit _hex_digit • _unicode_value : (. | _little_u_value | _big_u_value | _escaped_char) • @@ -1703,13 +1668,13 @@ S99{ _little_u_value : • '\' 'u' _hex_digit _hex_digit _hex_digit _hex_digit } Transitions: - ['"','"'] -> S27 - ['\','\'] -> S28 -. -> S29 + ['"','"'] -> S26 + ['\','\'] -> S27 +. -> S28 Action: nil Symbols classes: {['"','"'], ['\','\']} -S100{ +S98{ _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit • _hex_digit _hex_digit _hex_digit _hex_digit _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char @@ -1719,24 +1684,24 @@ S100{ _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' } Transitions: - ['0','9'] -> S103 - ['A','F'] -> S103 - ['a','f'] -> S103 + ['0','9'] -> S101 + ['A','F'] -> S101 + ['a','f'] -> S101 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S101{ +S99{ _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _little_u_value : '\' 'u' _hex_digit _hex_digit _hex_digit _hex_digit • _unicode_value : (. | _little_u_value | _big_u_value | _escaped_char) • char_lit : ''' (_unicode_value | _byte_value) • ''' } Transitions: - [''','''] -> S64 + [''','''] -> S63 Action: nil Symbols classes: {[''',''']} -S102{ +S100{ _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit • _hex_digit _hex_digit _hex_digit _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char @@ -1747,13 +1712,13 @@ S102{ _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' } Transitions: - ['0','9'] -> S104 - ['A','F'] -> S104 - ['a','f'] -> S104 + ['0','9'] -> S102 + ['A','F'] -> S102 + ['a','f'] -> S102 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S103{ +S101{ _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit • _hex_digit _hex_digit _hex_digit _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char @@ -1763,13 +1728,13 @@ S103{ _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' } Transitions: - ['0','9'] -> S105 - ['A','F'] -> S105 - ['a','f'] -> S105 + ['0','9'] -> S103 + ['A','F'] -> S103 + ['a','f'] -> S103 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S104{ +S102{ _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit • _hex_digit _hex_digit _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char @@ -1780,13 +1745,13 @@ S104{ _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' } Transitions: - ['0','9'] -> S106 - ['A','F'] -> S106 - ['a','f'] -> S106 + ['0','9'] -> S104 + ['A','F'] -> S104 + ['a','f'] -> S104 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S105{ +S103{ _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit • _hex_digit _hex_digit _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char @@ -1796,13 +1761,13 @@ S105{ _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' } Transitions: - ['0','9'] -> S107 - ['A','F'] -> S107 - ['a','f'] -> S107 + ['0','9'] -> S105 + ['A','F'] -> S105 + ['a','f'] -> S105 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S106{ +S104{ _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit • _hex_digit _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char @@ -1813,13 +1778,13 @@ S106{ _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' } Transitions: - ['0','9'] -> S108 - ['A','F'] -> S108 - ['a','f'] -> S108 + ['0','9'] -> S106 + ['A','F'] -> S106 + ['a','f'] -> S106 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S107{ +S105{ _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit • _hex_digit _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char @@ -1829,13 +1794,13 @@ S107{ _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' } Transitions: - ['0','9'] -> S109 - ['A','F'] -> S109 - ['a','f'] -> S109 + ['0','9'] -> S107 + ['A','F'] -> S107 + ['a','f'] -> S107 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S108{ +S106{ _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit • _unicode_value : (. | _little_u_value | _big_u_value | _escaped_char) • @@ -1856,20 +1821,20 @@ S108{ _little_u_value : • '\' 'u' _hex_digit _hex_digit _hex_digit _hex_digit } Transitions: - ['"','"'] -> S27 - ['\','\'] -> S28 -. -> S29 + ['"','"'] -> S26 + ['\','\'] -> S27 +. -> S28 Action: nil Symbols classes: {['"','"'], ['\','\']} -S109{ +S107{ _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit • _unicode_value : (. | _little_u_value | _big_u_value | _escaped_char) • char_lit : ''' (_unicode_value | _byte_value) • ''' } Transitions: - [''','''] -> S64 + [''','''] -> S63 Action: nil Symbols classes: {[''',''']} diff --git a/internal/fe2/terminals.txt b/internal/fe2/log/terminals.txt similarity index 92% rename from internal/fe2/terminals.txt rename to internal/fe2/log/terminals.txt index e4df5703..d8ca280f 100644 --- a/internal/fe2/terminals.txt +++ b/internal/fe2/log/terminals.txt @@ -9,7 +9,6 @@ ignoredTokId . char_lit - -~ ( ) [ @@ -19,7 +18,7 @@ char_lit g_sdt_lit prodId string_lit -errore +error λ empty ε diff --git a/internal/fe2/main/main.go b/internal/fe2/main/main.go new file mode 100644 index 00000000..4e6988f9 --- /dev/null +++ b/internal/fe2/main/main.go @@ -0,0 +1,38 @@ +package main + +import ( + "flag" + "fmt" + "os" + "strings" + + fe2 "github.com/maxcalandrelli/gocc/internal/fe2" +) + +func showResult(r interface{}, e error) { + if e != nil { + fmt.Fprintf(os.Stderr, "parsing returned the following error: %s\n", e.Error()) + } else { + fmt.Printf("%#v\n", r) + } +} + +var ( + File string + Text string +) + +func main() { + flag.StringVar(&File, "file", "", "parse also text in file") + flag.StringVar(&Text, "text", "", "parse also text given with flag") + flag.Parse() + if Text > "" { + showResult(fe2.ParseText(Text)) + } + if File > "" { + showResult(fe2.ParseFile(File)) + } + if str := strings.Join(os.Args[1:], " "); str > "" { + showResult(fe2.ParseText(str)) + } +} diff --git a/internal/io/gen/gen.go b/internal/io/gen/gen.go new file mode 100644 index 00000000..c79fe71c --- /dev/null +++ b/internal/io/gen/gen.go @@ -0,0 +1,23 @@ +//Copyright 2013 Vastech SA (PTY) LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package gen + +import ( + "github.com/maxcalandrelli/gocc/internal/io/gen/golang" +) + +func Gen(pkg, outdir, subpath string) { + golang.GenIo(pkg, outdir, subpath) +} diff --git a/internal/io/gen/golang/gen.go b/internal/io/gen/golang/gen.go new file mode 100644 index 00000000..b076d404 --- /dev/null +++ b/internal/io/gen/golang/gen.go @@ -0,0 +1,491 @@ +package golang + +import ( + "bytes" + "path" + "text/template" + + "github.com/maxcalandrelli/gocc/internal/io" +) + +type data struct { + MyName string + Pkg string + Outdir string + Subpath string + MyPath string + MyInternal string +} + +func GenIo(pkg, outdir, subpath string) { + myData := data{ + Pkg: pkg, + Outdir: outdir, + Subpath: subpath, + MyPath: "io/stream", + MyInternal: "internal", + } + genIoStream(myData) + genIoStreamImpl(myData) + genIoStreamPublic(myData) +} + +func genIoStream(d data) { + tmpl, err := template.New("io_stream").Parse(streamSrc[1:]) + if err != nil { + panic(err) + } + wr := new(bytes.Buffer) + if err := tmpl.Execute(wr, d); err != nil { + panic(err) + } + io.WriteFile(path.Join(d.Outdir, d.Subpath, d.MyPath, "stream.go"), wr.Bytes()) +} + +func genIoStreamImpl(d data) { + tmpl, err := template.New("io_stream_impl").Parse(streamImplSrc[1:]) + if err != nil { + panic(err) + } + wr := new(bytes.Buffer) + if err := tmpl.Execute(wr, d); err != nil { + panic(err) + } + io.WriteFile(path.Join(d.Outdir, d.Subpath, d.MyPath, d.MyInternal, "stream_impl.go"), wr.Bytes()) +} + +func genIoStreamPublic(d data) { + tmpl, err := template.New("io_stream_public").Parse(streamPublicSrc[1:]) + if err != nil { + panic(err) + } + wr := new(bytes.Buffer) + if err := tmpl.Execute(wr, d); err != nil { + panic(err) + } + io.WriteFile(path.Join(d.Outdir, d.Subpath, d.MyPath, d.MyInternal, "stream_public.go"), wr.Bytes()) +} + +var streamSrc = ` +package stream + +import ( + internal "{{.Pkg}}/{{.Subpath}}/{{.MyPath}}/{{.MyInternal}}" + "io" +) + +type ( + WindowReader interface { + BlockSize() int + Buffered() int + Cap() int + MaxCap() int + Read([]byte) (int, error) + ReadByte() (byte, error) + ReadPosition() int64 + ReadRune() (rune, int, error) + Seek(int64, int) (int64, error) + UnreadByte() error + UnreadRune() error + MaxUnreadSize() int + } +) + +var ( + InfoPrefixRoundUp = false +) + +func NewWindowReaderFromBytes(src []byte) WindowReader { + return internal.NewWindowReader(src, nil, 0, 0, InfoPrefixRoundUp) +} + +func NewWindowReader(rdr io.Reader) WindowReader { + return internal.NewWindowReader(nil, rdr, 0, 0, false) +} + +func NewLimitedWindowReader(rdr io.Reader, sizeMin, sizeMax int) WindowReader { + return internal.NewWindowReader(nil, rdr, sizeMin, sizeMax, InfoPrefixRoundUp) +} +` + +var streamImplSrc = ` +package internal + +import ( + "io" + "sync" + "unicode/utf8" +) + +type ( + impl_WindowReader struct { + bufferBlockSize int + maxBufferSize int + buffers [][]byte + available int + absbase int64 + position int + eof bool + rdr io.Reader + lock *sync.Mutex + } +) + +func (s *impl_WindowReader) lockReader() { + if s.lock != nil { + s.lock.Lock() + } +} + +func (s *impl_WindowReader) unlockReader() { + if s.lock != nil { + s.lock.Unlock() + } +} + +func (s *impl_WindowReader) seek(offset int64, whence int) (offs int64, err error) { + switch whence { + case io.SeekStart: + return s.seek(offset-s.ReadPosition(), io.SeekCurrent) + case io.SeekCurrent: + switch { + case offset == 0: + return s.ReadPosition(), nil + case offset < 0: + if -offset > int64(s.maxBackOffset()) { + err = io.ErrShortBuffer + } else { + s.advanceGet(int(offset)) + } + case offset > 0: + for offset > 0 && !s.eof { + available := s.Buffered() + if offset <= int64(available) { + s.advanceGet(int(offset)) + break + } + if available > 0 { + s.advanceGet(available) + offset -= int64(available) + } + read, _ := s.fetchBytes(int(offset)) + s.advanceGet(read) + offset -= int64(read) + } + if s.eof { + err = io.EOF + } + } + case io.SeekEnd: + for !s.eof { + s.seek(int64(s.MaxCap()), io.SeekCurrent) + } + s.seek(int64(s.Buffered()), io.SeekCurrent) + } + if s.eof && err == nil && s.Buffered() > 0 { + s.eof = false + } + return s.ReadPosition(), err +} + +func (s impl_WindowReader) maxBackOffset() int { + r := s.position + if s.absbase > 0 { + r = s.Cap() - s.Buffered() + } + return r +} + +func (s impl_WindowReader) bufferIndex(pos int) int { + if pos < 0 { + panic("negative position") + } + return pos / s.bufferBlockSize +} + +func (s impl_WindowReader) bufferBytes(pos int) []byte { + return s.buffers[s.bufferIndex(pos)] +} + +func (s impl_WindowReader) bufferByteRange(pos int, length int) []byte { + p := s.bufferIndex(pos) + return s.bufferBytes(pos)[p : p+length] +} + +func (s impl_WindowReader) bufferOffset(pos int) int { + return pos % s.bufferBlockSize +} + +func (s *impl_WindowReader) advanceGet(n int) { + sz := s.Cap() + switch { + case n < 0: + if -n > s.maxBackOffset() { + panic("underflow") + } + s.position += n + if s.position < 0 { + s.position += sz + s.absbase -= int64(sz) + } + case n > 0: + if n > s.Buffered() { + panic("overflow") + } + s.position += n + if s.position >= sz { + s.position -= sz + s.absbase += int64(sz) + } + } + s.available -= n +} + +func (s *impl_WindowReader) copy(to []byte, length int) { + for offs, cp := 0, 0; length > 0; length -= cp { + s.position %= s.MaxCap() + p := s.bufferOffset(s.position) + b := s.bufferBytes(s.position) + r := s.bufferBlockSize - p + if length <= r { + cp = copy(to[offs:], b[p:p+length]) + } else { + cp = copy(to[offs:], b[p:]) + } + s.advanceGet(cp) + offs += cp + } +} + +func (s *impl_WindowReader) fetchBytes(n int) (read int, err error) { + if s.rdr == nil { + s.eof = true + return 0, io.EOF + } + for n > 0 && s.Buffered() < s.MaxCap() && err == nil { + readNow := n + putpos := s.position + s.available + r := s.bufferBlockSize - s.bufferOffset(putpos) + if readNow > r { + readNow = r + } + for s.bufferIndex(putpos) >= len(s.buffers) && s.Cap() < s.MaxCap() { + s.buffers = append(s.buffers, make([]byte, s.bufferBlockSize)) + } + putpos %= s.MaxCap() + offs := s.bufferOffset(putpos) + if r, err = s.rdr.Read(s.bufferBytes(putpos)[offs : offs+readNow]); r > 0 { + s.available += r + read += r + n -= r + } + } + if n > 0 && err == nil { + err = io.ErrShortBuffer + } + return +} + +func (s *impl_WindowReader) read(p []byte) (read int, err error) { + if s.eof { + return 0, io.EOF + } + for read < len(p) && err == nil { + available := s.Buffered() + if len(p)-read <= available { + s.copy(p[read:], len(p)-read) + read = len(p) + } else { + if available == 0 { + available, err = s.fetchBytes(len(p) - read) + } + s.copy(p[read:], available) + read += available + switch err { + case io.ErrShortBuffer: + err = nil + case io.EOF: + s.eof = true + } + } + } + return +} + +func (s impl_WindowReader) peekByte() (byte, error) { + if s.Buffered() < 1 { + return 0, io.ErrShortBuffer + } + return s.bufferBytes(s.position)[s.bufferOffset(s.position)], nil +} + +func (s *impl_WindowReader) unreadByte() error { + _, e := s.seek(-1, io.SeekCurrent) + return e +} + +func (s *impl_WindowReader) readRune() (r rune, size int, err error) { + for i := 1; err == nil && i <= 4; i++ { + if s.Buffered() < i { + if _, err = s.fetchBytes(i); err != nil { + return + } + } + t := s.bufferByteRange(s.position, i) + if r, size = utf8.DecodeRune(t); r != utf8.RuneError { + s.advanceGet(size) + return + } + } + return utf8.RuneError, 0, err +} + +func (s *impl_WindowReader) unreadRune() (err error) { + tmps := *s + tmpb := []byte{} + for { + if _, err = tmps.seek(-1, io.SeekCurrent); err == nil { + b, _ := tmps.PeekByte() + tmpb = append([]byte{b}, tmpb...) + switch len(tmpb) { + case 1: + if (tmpb[0] & 0xC0) == 0x80 { + continue + } + _, err = s.seek(-int64(len(tmpb)), io.SeekCurrent) + return + case 2: + if (tmpb[0] & 0xC0) == 0x80 { + continue + } + if (tmpb[0] & 0xE0) != 0xC0 { + break + } + _, err = s.seek(-int64(len(tmpb)), io.SeekCurrent) + return + case 3: + if (tmpb[0] & 0xC0) == 0x80 { + continue + } + if (tmpb[0] & 0xF0) != 0xE0 { + break + } + _, err = s.seek(-int64(len(tmpb)), io.SeekCurrent) + return + case 4: + if (tmpb[0] & 0xF8) != 0xF0 { + break + } + _, err = s.seek(-int64(len(tmpb)), io.SeekCurrent) + return + } + } + } + _, err = s.seek(-1, io.SeekCurrent) + return +} +` + +var streamPublicSrc = ` +package internal + +import ( + "io" +) + +func NewWindowReader(buf []byte, underlyingReader io.Reader, blksize, smax int, InfoPrefixRoundUp bool) *impl_WindowReader { + if blksize < 0 || smax < blksize { + panic("illegal buffer size") + } + r := &impl_WindowReader{rdr: underlyingReader} + r.bufferBlockSize = blksize + if underlyingReader != nil { + if blksize <= 0 { + r.bufferBlockSize = 1 << 10 + } else if InfoPrefixRoundUp { + for r.bufferBlockSize = 1; blksize > 0; r.bufferBlockSize = r.bufferBlockSize << 1 { + blksize = blksize >> 1 + } + } + if smax > 0 { + r.maxBufferSize = ((smax-1)/r.bufferBlockSize + 1) * r.bufferBlockSize + } + r.buffers = [][]byte{} + } else { + r.buffers = [][]byte{buf} + r.available = len(buf) + r.bufferBlockSize = r.available + r.maxBufferSize = r.available + } + return r +} + +func (s impl_WindowReader) Cap() int { + return len(s.buffers) * s.bufferBlockSize +} + +func (s impl_WindowReader) BlockSize() int { + return s.bufferBlockSize +} + +func (s impl_WindowReader) MaxCap() int { + if s.maxBufferSize > 0 { + return s.maxBufferSize + } + return 1 << 31 +} + +func (s impl_WindowReader) MaxUnreadSize() int { + return s.maxBackOffset() +} + +func (s impl_WindowReader) Buffered() int { + return s.available +} + +func (s impl_WindowReader) ReadPosition() int64 { + return s.absbase + int64(s.position) +} + +func (s *impl_WindowReader) Read(p []byte) (read int, err error) { + s.lockReader() + defer func() { s.unlockReader() }() + return s.read(p) +} + +func (s *impl_WindowReader) Seek(offset int64, whence int) (offs int64, err error) { + s.lockReader() + defer func() { s.unlockReader() }() + return s.seek(offset, whence) +} + +func (s *impl_WindowReader) ReadByte() (byte, error) { + b := []byte{0} + _, err := s.Read(b) + return b[0], err +} + +func (s *impl_WindowReader) PeekByte() (byte, error) { + s.lockReader() + defer func() { s.unlockReader() }() + return s.PeekByte() +} + +func (s *impl_WindowReader) UnreadByte() error { + s.lockReader() + defer func() { s.unlockReader() }() + return s.unreadByte() +} + +func (s *impl_WindowReader) ReadRune() (r rune, size int, err error) { + s.lockReader() + defer func() { s.unlockReader() }() + return s.readRune() +} + +func (s *impl_WindowReader) UnreadRune() (err error) { + s.lockReader() + defer func() { s.unlockReader() }() + return s.unreadRune() +} +` diff --git a/internal/lexer/gen/golang/acttab.go b/internal/lexer/gen/golang/acttab.go index 5ba95348..fd23eb5f 100644 --- a/internal/lexer/gen/golang/acttab.go +++ b/internal/lexer/gen/golang/acttab.go @@ -24,22 +24,22 @@ import ( "github.com/maxcalandrelli/gocc/internal/token" ) -func genActionTable(pkg, outDir string, itemsets *items.ItemSets, tokMap *token.TokenMap) { - fname := path.Join(outDir, "lexer", "acttab.go") +func genActionTable(pkg, outDir string, itemsets *items.ItemSets, tokMap *token.TokenMap, subpath string) { + fname := path.Join(outDir, subpath, "lexer", "acttab.go") tmpl, err := template.New("action table").Parse(actionTableSrc[1:]) if err != nil { panic(err) } wr := new(bytes.Buffer) - if err := tmpl.Execute(wr, getActTab(pkg, itemsets, tokMap)); err != nil { + if err := tmpl.Execute(wr, getActTab(pkg, subpath, itemsets, tokMap)); err != nil { panic(err) } io.WriteFile(fname, wr.Bytes()) } -func getActTab(pkg string, itemsets *items.ItemSets, tokMap *token.TokenMap) *actTab { +func getActTab(pkg, subpath string, itemsets *items.ItemSets, tokMap *token.TokenMap) *actTab { actab := &actTab{ - TokenImport: path.Join(pkg, "token"), + TokenImport: path.Join(pkg, subpath, "token"), Actions: make([]action, itemsets.Size()), } for sno, set := range itemsets.List() { diff --git a/internal/lexer/gen/golang/gen.go b/internal/lexer/gen/golang/gen.go index bfabfc4f..7300869a 100644 --- a/internal/lexer/gen/golang/gen.go +++ b/internal/lexer/gen/golang/gen.go @@ -20,8 +20,8 @@ import ( "github.com/maxcalandrelli/gocc/internal/token" ) -func Gen(pkg, outDir string, header string, itemsets *items.ItemSets, tokMap *token.TokenMap, cfg config.Config) { - genLexer(pkg, outDir, itemsets, cfg) - genTransitionTable(pkg, outDir, header, itemsets) - genActionTable(pkg, outDir, itemsets, tokMap) +func Gen(pkg, outDir string, header string, itemsets *items.ItemSets, tokMap *token.TokenMap, cfg config.Config, subpath string) { + genLexer(pkg, outDir, itemsets, cfg, subpath) + genTransitionTable(pkg, outDir, header, itemsets, subpath) + genActionTable(pkg, outDir, itemsets, tokMap, subpath) } diff --git a/internal/lexer/gen/golang/lexer.go b/internal/lexer/gen/golang/lexer.go index 295741e1..9d6d4b6d 100644 --- a/internal/lexer/gen/golang/lexer.go +++ b/internal/lexer/gen/golang/lexer.go @@ -24,25 +24,25 @@ import ( "github.com/maxcalandrelli/gocc/internal/lexer/items" ) -func genLexer(pkg, outDir string, itemsets *items.ItemSets, cfg config.Config) { +func genLexer(pkg, outDir string, itemsets *items.ItemSets, cfg config.Config, subpath string) { tmpl, err := template.New("lexer").Parse(lexerSrc[1:]) if err != nil { panic(err) } buf := new(bytes.Buffer) - err = tmpl.Execute(buf, getLexerData(pkg, outDir, itemsets, cfg)) + err = tmpl.Execute(buf, getLexerData(pkg, outDir, itemsets, cfg, subpath)) if err != nil { panic(err) } - io.WriteFile(path.Join(outDir, "lexer", "lexer.go"), buf.Bytes()) + io.WriteFile(path.Join(outDir, subpath, "lexer", "lexer.go"), buf.Bytes()) } -func getLexerData(pkg, outDir string, itemsets *items.ItemSets, cfg config.Config) *lexerData { +func getLexerData(pkg, outDir string, itemsets *items.ItemSets, cfg config.Config, subpath string) *lexerData { lexSymbols := itemsets.Symbols().List() return &lexerData{ Debug: cfg.DebugLexer(), - TokenImport: path.Join(pkg, "token"), - UtilImport: path.Join(pkg, "util"), + TokenImport: path.Join(pkg, subpath, "token"), + UtilImport: path.Join(pkg, subpath, "util"), NumStates: itemsets.Size(), NumSymbols: len(lexSymbols), Symbols: lexSymbols, diff --git a/internal/lexer/gen/golang/transtab.go b/internal/lexer/gen/golang/transtab.go index c2195e29..e7db24ef 100644 --- a/internal/lexer/gen/golang/transtab.go +++ b/internal/lexer/gen/golang/transtab.go @@ -24,8 +24,8 @@ import ( "github.com/maxcalandrelli/gocc/internal/lexer/items" ) -func genTransitionTable(pkg, outDir, header string, itemSets *items.ItemSets) { - fname := path.Join(outDir, "lexer", "transitiontable.go") +func genTransitionTable(pkg, outDir, header string, itemSets *items.ItemSets, subpath string) { + fname := path.Join(outDir, subpath, "lexer", "transitiontable.go") io.WriteFile(fname, getTransitionTable(itemSets, header)) } diff --git a/internal/lexer/items/disjunctrangeset.go b/internal/lexer/items/disjunctrangeset.go index 8dbd3f56..cb3a970b 100644 --- a/internal/lexer/items/disjunctrangeset.go +++ b/internal/lexer/items/disjunctrangeset.go @@ -38,9 +38,13 @@ func (this *DisjunctRangeSet) AddLexTNode(sym ast.LexTNode) { switch s := sym.(type) { case *ast.LexCharRange: if s.Negate { + //fmt.Printf("Set is: %q, will remove '%c'-'%c'\n", this, s.From.Val, s.To.Val) this.SubtractRange(s.From.Val, s.To.Val) + //fmt.Printf("Set now: %q\n", this) } else { + //fmt.Printf("Set is: %q, will add '%c'-'%c'\n", this, s.From.Val, s.To.Val) this.AddRange(s.From.Val, s.To.Val) + //fmt.Printf("Set now: %q\n", this) } case *ast.LexCharLit: if s.Negate { @@ -138,35 +142,37 @@ func (this *DisjunctRangeSet) AddRange(from, to rune) { } func (this *DisjunctRangeSet) subtractRange(index int, from, to rune) int { - //fmt.Printf("subtracting <%c-%c> at index %d<%c-%c>\n", from, to, index, this.set[index].From, this.set[index].To) - rng := this.set[index] - if to >= from && to >= rng.From { - if from > rng.To || to < rng.From { - return index + 1 - } - if from < rng.From { - return this.subtractRange(index, rng.From, to) - } - if to > rng.To { - this.subtractRange(index, from, rng.To) - return this.subtractRange(index+1, rng.To+1, to) - } - // - // from >= rng.to && to <= rng.to - // - //fmt.Printf("actually deleting range <%c-%c> at index %d<%c-%c>\n", from, to, index, this.set[index].From, this.set[index].To) - switch { - case from == rng.From && to == rng.To: - copy(this.set[index:], this.set[index+1:]) - this.set = this.set[:len(this.set)-1] - case from == rng.From: - this.set[index].From = to + 1 - case to == rng.To: - this.set[index].To = from - 1 - default: - this.set[index].From = this.set[index].From - this.set[index].To = from - 1 - this.AddRange(to+1, rng.To) + if index < len(this.set) { + //fmt.Printf("subtracting <%c-%c> at index %d<%c-%c>\n", from, to, index, this.set[index].From, this.set[index].To) + rng := this.set[index] + if to >= from && to >= rng.From { + if from > rng.To || to < rng.From { + return index + 1 + } + if from < rng.From { + return this.subtractRange(index, rng.From, to) + } + if to > rng.To { + return this.subtractRange(this.subtractRange(index, from, rng.To), rng.To+1, to) + } + // + // from >= rng.to && to <= rng.to + // + //fmt.Printf("actually deleting range <%c-%c> at index %d<%c-%c>\n", from, to, index, this.set[index].From, this.set[index].To) + switch { + case from == rng.From && to == rng.To: + copy(this.set[index:], this.set[index+1:]) + this.set = this.set[:len(this.set)-1] + return index + case from == rng.From: + this.set[index].From = to + 1 + case to == rng.To: + this.set[index].To = from - 1 + default: + this.set[index].From = this.set[index].From + this.set[index].To = from - 1 + this.AddRange(to+1, rng.To) + } } } return len(this.set) diff --git a/internal/lexer/items/disjunctrangeset_test.go b/internal/lexer/items/disjunctrangeset_test.go index d4562481..5e3ce8bd 100644 --- a/internal/lexer/items/disjunctrangeset_test.go +++ b/internal/lexer/items/disjunctrangeset_test.go @@ -15,6 +15,7 @@ package items import ( + "fmt" // "fmt" "testing" @@ -413,29 +414,34 @@ func TestDisjunctSets14(t *testing.T) { } } -func TestDisjunctSets15(t *testing.T) { - set := NewDisjunctRangeSet() - subtract := func(a, b rune) { - t.Logf("current set: %s; subtracting <%c-%c>\n", set.String(), a, b) - set.SubtractRange(a, b) - t.Logf("resulting set: %s\n", set.String()) - } - set.AddRange('D', 'F') - set.AddRange('J', 'L') - set.AddRange('Q', 'Z') - set.AddRange('5', '8') - set.AddRange('a', 'z') - subtract('0', '4') - subtract('A', 'D') - subtract('E', 'M') - subtract('S', '^') - subtract('K', 'C') - subtract('c', 'f') - subtract('w', 'w') - set.AddLexTNode(ast.LexDOT) - expect := "{['5','8'], ['J','L'], ['Q','R'], ['a','b'], ['g','v'], ['x','z']}" +func test15hlp(t *testing.T, set *DisjunctRangeSet, from, to rune, subtract bool, expect string) { + if subtract { + fmt.Printf("current set: %s; subtracting <%c-%c>\n", set.String(), from, to) + set.SubtractRange(from, to) + } else { + fmt.Printf("current set: %s; adding <%c-%c>\n", set.String(), from, to) + set.AddRange(from, to) + } + fmt.Printf("resulting set: %s\n", set.String()) if expect != set.String() { + fmt.Printf("expected set: %s\n", expect) t.Fatalf("expected set: %s\n", expect) t.Fatalf("actual set: %s\n", set.String()) } } + +func TestDisjunctSets15(t *testing.T) { + set := NewDisjunctRangeSet() + test15hlp(t, set, 'D', 'F', false, "{['D','F']}") + test15hlp(t, set, 'J', 'L', false, "{['D','F'], ['J','L']}") + test15hlp(t, set, 'Q', 'Z', false, "{['D','F'], ['J','L'], ['Q','Z']}") + test15hlp(t, set, '5', '8', false, "{['5','8'], ['D','F'], ['J','L'], ['Q','Z']}") + test15hlp(t, set, 'a', 'z', false, "{['5','8'], ['D','F'], ['J','L'], ['Q','Z'], ['a','z']}") + test15hlp(t, set, '0', '4', true, "{['5','8'], ['D','F'], ['J','L'], ['Q','Z'], ['a','z']}") + test15hlp(t, set, 'A', 'D', true, "{['5','8'], ['E','F'], ['J','L'], ['Q','Z'], ['a','z']}") + test15hlp(t, set, 'E', 'M', true, "{['5','8'], ['Q','Z'], ['a','z']}") + test15hlp(t, set, 'S', '^', true, "{['5','8'], ['Q','R'], ['a','z']}") + test15hlp(t, set, 'K', 'C', true, "{['5','8'], ['Q','R'], ['a','z']}") + test15hlp(t, set, 'c', 'f', true, "{['5','8'], ['Q','R'], ['a','b'], ['g','z']}") + test15hlp(t, set, 'w', 'w', true, "{['5','8'], ['Q','R'], ['a','b'], ['g','v'], ['x','z']}") +} diff --git a/internal/lexer/items/itemset.go b/internal/lexer/items/itemset.go index 4c1b82ae..551a2819 100644 --- a/internal/lexer/items/itemset.go +++ b/internal/lexer/items/itemset.go @@ -112,7 +112,32 @@ func (this *ItemSet) getSymbolClasses() { this.SymbolClasses = NewDisjunctRangeSet() for _, item := range this.Items { if !item.Reduce() { - this.SymbolClasses.AddLexTNode(item.ExpectedSymbol()) + addNow := false + switch chars := item.ExpectedSymbol().(type) { + case *ast.LexCharLit: + addNow = !chars.Negate + case *ast.LexCharRange: + addNow = !chars.Negate + default: + addNow = true + } + if addNow { + this.SymbolClasses.AddLexTNode(item.ExpectedSymbol()) + } + } + } + for _, item := range this.Items { + if !item.Reduce() { + addNow := false + switch chars := item.ExpectedSymbol().(type) { + case *ast.LexCharLit: + addNow = chars.Negate + case *ast.LexCharRange: + addNow = chars.Negate + } + if addNow { + this.SymbolClasses.AddLexTNode(item.ExpectedSymbol()) + } } } } diff --git a/internal/parser/gen/gen.go b/internal/parser/gen/gen.go index 0d632984..120cb471 100644 --- a/internal/parser/gen/gen.go +++ b/internal/parser/gen/gen.go @@ -27,14 +27,13 @@ import ( ) func Gen(pkg, outDir, header string, prods ast.SyntaxProdList, symbols *symbols.Symbols, - itemsets *items.ItemSets, tokMap *token.TokenMap, cfg config.Config) (conflicts map[int]items.RowConflicts) { - - golang.GenAction(outDir) - conflicts = golang.GenActionTable(outDir, prods, itemsets, tokMap, cfg.Zip()) - golang.GenErrors(pkg, outDir) - golang.GenGotoTable(outDir, itemsets, symbols, cfg.Zip()) - golang.GenParser(pkg, outDir, prods, itemsets, symbols, cfg) - golang.GenProductionsTable(pkg, outDir, header, prods, symbols, itemsets, tokMap) + itemsets *items.ItemSets, tokMap *token.TokenMap, cfg config.Config, subpath string) (conflicts map[int]items.RowConflicts) { + golang.GenAction(outDir, subpath) + conflicts = golang.GenActionTable(outDir, prods, itemsets, tokMap, cfg.Zip(), subpath) + golang.GenErrors(pkg, outDir, subpath) + golang.GenGotoTable(outDir, itemsets, symbols, cfg.Zip(), subpath) + golang.GenParser(pkg, outDir, prods, itemsets, symbols, cfg, subpath) + golang.GenProductionsTable(pkg, outDir, header, prods, symbols, itemsets, tokMap, subpath) return } diff --git a/internal/parser/gen/golang/action.go b/internal/parser/gen/golang/action.go index afc86816..a66f8ae5 100644 --- a/internal/parser/gen/golang/action.go +++ b/internal/parser/gen/golang/action.go @@ -20,8 +20,8 @@ import ( "github.com/maxcalandrelli/gocc/internal/io" ) -func GenAction(outDir string) { - io.WriteFileString(path.Join(outDir, "parser", "action.go"), actionSrc[1:]) +func GenAction(outDir, subpath string) { + io.WriteFileString(path.Join(outDir, subpath, "parser", "action.go"), actionSrc[1:]) } const actionSrc = ` diff --git a/internal/parser/gen/golang/actiontable.go b/internal/parser/gen/golang/actiontable.go index 2fcc16b9..7e1c21c5 100644 --- a/internal/parser/gen/golang/actiontable.go +++ b/internal/parser/gen/golang/actiontable.go @@ -28,9 +28,9 @@ import ( "github.com/maxcalandrelli/gocc/internal/token" ) -func GenActionTable(outDir string, prods ast.SyntaxProdList, itemSets *items.ItemSets, tokMap *token.TokenMap, zip bool) map[int]items.RowConflicts { +func GenActionTable(outDir string, prods ast.SyntaxProdList, itemSets *items.ItemSets, tokMap *token.TokenMap, zip bool, subpath string) map[int]items.RowConflicts { if zip { - return GenCompActionTable(outDir, prods, itemSets, tokMap) + return GenCompActionTable(outDir, subpath, prods, itemSets, tokMap) } tmpl, err := template.New("parser action table").Parse(actionTableSrc[1:]) if err != nil { @@ -41,7 +41,7 @@ func GenActionTable(outDir string, prods ast.SyntaxProdList, itemSets *items.Ite if err := tmpl.Execute(wr, data); err != nil { panic(err) } - io.WriteFile(path.Join(outDir, "parser", "actiontable.go"), wr.Bytes()) + io.WriteFile(path.Join(outDir, subpath, "parser", "actiontable.go"), wr.Bytes()) return conflicts } @@ -159,7 +159,7 @@ var actionTab = actionTable{ } ` -func GenCompActionTable(outDir string, prods ast.SyntaxProdList, itemSets *items.ItemSets, tokMap *token.TokenMap) map[int]items.RowConflicts { +func GenCompActionTable(outDir, subpath string, prods ast.SyntaxProdList, itemSets *items.ItemSets, tokMap *token.TokenMap) map[int]items.RowConflicts { tab := make([]struct { CanRecover bool Actions []struct { @@ -216,7 +216,7 @@ func GenCompActionTable(outDir string, prods ast.SyntaxProdList, itemSets *items if err := tmpl.Execute(wr, bytesStr); err != nil { panic(err) } - io.WriteFile(path.Join(outDir, "parser", "actiontable.go"), wr.Bytes()) + io.WriteFile(path.Join(outDir, subpath, "parser", "actiontable.go"), wr.Bytes()) return conflictss } diff --git a/internal/parser/gen/golang/errors.go b/internal/parser/gen/golang/errors.go index 449020b6..5df611d0 100644 --- a/internal/parser/gen/golang/errors.go +++ b/internal/parser/gen/golang/errors.go @@ -21,16 +21,16 @@ import ( "github.com/maxcalandrelli/gocc/internal/io" ) -func GenErrors(pkg, outDir string) { +func GenErrors(pkg, outDir, subpath string) { tmpl, err := template.New("parser errors").Parse(errorsSrc[1:]) if err != nil { panic(err) } wr := new(bytes.Buffer) - if err := tmpl.Execute(wr, path.Join(pkg, "token")); err != nil { + if err := tmpl.Execute(wr, path.Join(pkg, subpath, "token")); err != nil { panic(err) } - io.WriteFile(path.Join(outDir, "errors", "errors.go"), wr.Bytes()) + io.WriteFile(path.Join(outDir, subpath, "errors", "errors.go"), wr.Bytes()) } const errorsSrc = ` diff --git a/internal/parser/gen/golang/gototable.go b/internal/parser/gen/golang/gototable.go index 57010eb2..83d48b2f 100644 --- a/internal/parser/gen/golang/gototable.go +++ b/internal/parser/gen/golang/gototable.go @@ -38,9 +38,9 @@ type gotoRowElement struct { Pad int } -func GenGotoTable(outDir string, itemSets *items.ItemSets, sym *symbols.Symbols, zip bool) { +func GenGotoTable(outDir string, itemSets *items.ItemSets, sym *symbols.Symbols, zip bool, subpath string) { if zip { - GenCompGotoTable(outDir, itemSets, sym) + GenCompGotoTable(outDir, subpath, itemSets, sym) return } tmpl, err := template.New("parser goto table").Parse(gotoTableSrc[1:]) @@ -51,7 +51,7 @@ func GenGotoTable(outDir string, itemSets *items.ItemSets, sym *symbols.Symbols, if err := tmpl.Execute(wr, getGotoTableData(itemSets, sym)); err != nil { panic(err) } - io.WriteFile(path.Join(outDir, "parser", "gototable.go"), wr.Bytes()) + io.WriteFile(path.Join(outDir, subpath, "parser", "gototable.go"), wr.Bytes()) } func getGotoTableData(itemSets *items.ItemSets, sym *symbols.Symbols) *gotoTableData { @@ -138,7 +138,7 @@ func genEnc(v interface{}) string { return string(strBuf.Bytes()) } -func GenCompGotoTable(outDir string, itemSets *items.ItemSets, sym *symbols.Symbols) { +func GenCompGotoTable(outDir, subpath string, itemSets *items.ItemSets, sym *symbols.Symbols) { numNTSymbols := sym.NumNTSymbols() rows := make([][]int, itemSets.Size()) for i, set := range itemSets.List() { @@ -163,7 +163,7 @@ func GenCompGotoTable(outDir string, itemSets *items.ItemSets, sym *symbols.Symb if err := tmpl.Execute(wr, v); err != nil { panic(err) } - io.WriteFile(path.Join(outDir, "parser", "gototable.go"), wr.Bytes()) + io.WriteFile(path.Join(outDir, subpath, "parser", "gototable.go"), wr.Bytes()) } const gotoTableCompSrc = ` diff --git a/internal/parser/gen/golang/parser.go b/internal/parser/gen/golang/parser.go index 0d09d1da..6bf64876 100644 --- a/internal/parser/gen/golang/parser.go +++ b/internal/parser/gen/golang/parser.go @@ -26,16 +26,16 @@ import ( "github.com/maxcalandrelli/gocc/internal/parser/symbols" ) -func GenParser(pkg, outDir string, prods ast.SyntaxProdList, itemSets *items.ItemSets, symbols *symbols.Symbols, cfg config.Config) { +func GenParser(pkg, outDir string, prods ast.SyntaxProdList, itemSets *items.ItemSets, symbols *symbols.Symbols, cfg config.Config, subpath string) { tmpl, err := template.New("parser").Parse(parserSrc[1:]) if err != nil { panic(err) } wr := new(bytes.Buffer) - if err := tmpl.Execute(wr, getParserData(pkg, prods, itemSets, symbols, cfg)); err != nil { + if err := tmpl.Execute(wr, getParserData(pkg, subpath, prods, itemSets, symbols, cfg)); err != nil { panic(err) } - io.WriteFile(path.Join(outDir, "parser", "parser.go"), wr.Bytes()) + io.WriteFile(path.Join(outDir, subpath, "parser", "parser.go"), wr.Bytes()) } type parserData struct { @@ -47,11 +47,11 @@ type parserData struct { NumSymbols int } -func getParserData(pkg string, prods ast.SyntaxProdList, itemSets *items.ItemSets, symbols *symbols.Symbols, cfg config.Config) *parserData { +func getParserData(pkg, subpath string, prods ast.SyntaxProdList, itemSets *items.ItemSets, symbols *symbols.Symbols, cfg config.Config) *parserData { return &parserData{ Debug: cfg.DebugParser(), - ErrorImport: path.Join(pkg, "errors"), - TokenImport: path.Join(pkg, "token"), + ErrorImport: path.Join(pkg, subpath, "errors"), + TokenImport: path.Join(pkg, subpath, "token"), NumProductions: len(prods), NumStates: itemSets.Size(), NumSymbols: symbols.NumSymbols(), diff --git a/internal/parser/gen/golang/productionstable.go b/internal/parser/gen/golang/productionstable.go index 0bb7ae5b..9dab7562 100644 --- a/internal/parser/gen/golang/productionstable.go +++ b/internal/parser/gen/golang/productionstable.go @@ -28,9 +28,9 @@ import ( ) func GenProductionsTable(pkg, outDir, header string, prods ast.SyntaxProdList, symbols *symbols.Symbols, - itemsets *items.ItemSets, tokMap *token.TokenMap) { + itemsets *items.ItemSets, tokMap *token.TokenMap, subpath string) { - fname := path.Join(outDir, "parser", "productionstable.go") + fname := path.Join(outDir, subpath, "parser", "productionstable.go") tmpl, err := template.New("parser productions table").Parse(prodsTabSrc[1:]) if err != nil { panic(err) diff --git a/internal/parser/symbols/symbols.go b/internal/parser/symbols/symbols.go index 3ed609a5..7aaf3eaf 100644 --- a/internal/parser/symbols/symbols.go +++ b/internal/parser/symbols/symbols.go @@ -69,6 +69,8 @@ func NewSymbols(grammar *ast.Grammar) *Symbols { symbols.ntIdMap[p.Id] = len(symbols.ntTypeMap) - 1 } symbols.Add(p.Id) + } + for _, p := range grammar.SyntaxPart.ProdList { for _, sym := range p.Body.Symbols { symStr := sym.SymbolString() symbols.Add(symStr) diff --git a/internal/token/gen/gen.go b/internal/token/gen/gen.go index f237eeed..686577d4 100644 --- a/internal/token/gen/gen.go +++ b/internal/token/gen/gen.go @@ -19,6 +19,6 @@ import ( "github.com/maxcalandrelli/gocc/internal/token/gen/golang" ) -func Gen(pkg, outdir string, tokenMap *token.TokenMap) { - golang.GenToken(pkg, outdir, tokenMap) +func Gen(pkg, outdir string, tokenMap *token.TokenMap, subpath string) { + golang.GenToken(pkg, outdir, tokenMap, subpath) } diff --git a/internal/token/gen/golang/token.go b/internal/token/gen/golang/token.go index b5a603b3..d8cc6a54 100644 --- a/internal/token/gen/golang/token.go +++ b/internal/token/gen/golang/token.go @@ -25,8 +25,8 @@ import ( "github.com/maxcalandrelli/gocc/internal/token" ) -func GenToken(pkg, outdir string, tokMap *token.TokenMap) { - tokenPath := path.Join(outdir, "token", "token.go") +func GenToken(pkg, outdir string, tokMap *token.TokenMap, subpath string) { + tokenPath := path.Join(outdir, subpath, "token", "token.go") tmpl, err := template.New("token").Parse(TokenMapSrc[1:]) if err != nil { panic(err) diff --git a/internal/util/gen/gen.go b/internal/util/gen/gen.go index 6a179024..241dab8d 100644 --- a/internal/util/gen/gen.go +++ b/internal/util/gen/gen.go @@ -4,7 +4,7 @@ import ( "github.com/maxcalandrelli/gocc/internal/util/gen/golang" ) -func Gen(outDir string) { - golang.GenRune(outDir) - golang.GenLitConv(outDir) +func Gen(outDir, subpath string) { + golang.GenRune(outDir, subpath) + golang.GenLitConv(outDir, subpath) } diff --git a/internal/util/gen/golang/litconv.go b/internal/util/gen/golang/litconv.go index b78d36c6..9e641adb 100644 --- a/internal/util/gen/golang/litconv.go +++ b/internal/util/gen/golang/litconv.go @@ -6,8 +6,8 @@ import ( "github.com/maxcalandrelli/gocc/internal/io" ) -func GenLitConv(outDir string) { - io.WriteFileString(path.Join(outDir, "util", "litconv.go"), litConvSrc[1:]) +func GenLitConv(outDir, subpath string) { + io.WriteFileString(path.Join(outDir, subpath, "util", "litconv.go"), litConvSrc[1:]) } const litConvSrc = ` diff --git a/internal/util/gen/golang/rune.go b/internal/util/gen/golang/rune.go index cf814b56..09c3c519 100644 --- a/internal/util/gen/golang/rune.go +++ b/internal/util/gen/golang/rune.go @@ -6,8 +6,8 @@ import ( "github.com/maxcalandrelli/gocc/internal/io" ) -func GenRune(outDir string) { - io.WriteFileString(path.Join(outDir, "util", "rune.go"), runeSrc[1:]) +func GenRune(outDir, subpath string) { + io.WriteFileString(path.Join(outDir, subpath, "util", "rune.go"), runeSrc[1:]) } var runeSrc = ` diff --git a/main.go b/main.go index f9fac154..0deeba78 100644 --- a/main.go +++ b/main.go @@ -51,7 +51,6 @@ import ( "bytes" "flag" "fmt" - "io/ioutil" "os" "path" "strings" @@ -59,10 +58,9 @@ import ( "github.com/maxcalandrelli/gocc/internal/ast" genBase "github.com/maxcalandrelli/gocc/internal/base/gen" "github.com/maxcalandrelli/gocc/internal/config" - newscanner "github.com/maxcalandrelli/gocc/internal/fe2/lexer" - newparser "github.com/maxcalandrelli/gocc/internal/fe2/parser" - "github.com/maxcalandrelli/gocc/internal/fe2/token" + altfe "github.com/maxcalandrelli/gocc/internal/fe2" "github.com/maxcalandrelli/gocc/internal/io" + genIo "github.com/maxcalandrelli/gocc/internal/io/gen" genLexer "github.com/maxcalandrelli/gocc/internal/lexer/gen/golang" lexItems "github.com/maxcalandrelli/gocc/internal/lexer/items" "github.com/maxcalandrelli/gocc/internal/parser/first" @@ -94,29 +92,34 @@ func main() { config.CurrentConfiguration = cfg - srcBuffer, err := ioutil.ReadFile(cfg.SourceFile()) - if err != nil { - fmt.Println(err) - os.Exit(1) - } - var ( grammar interface{} ) - ast.StringGetter = func(v interface{}) string { return string(v.(*token.Token).Lit) } - scanner := newscanner.NewLexer(srcBuffer) - p := newparser.NewParser() - grammar, err = p.Parse(scanner) + ast.StringGetter = func(v interface{}) string { return string(v.(*altfe.Token).Lit) } + /* + srcBuffer, err := ioutil.ReadFile(cfg.SourceFile()) + if err != nil { + fmt.Println(err) + os.Exit(1) + } + scanner := altfe.NewLexer(srcBuffer) + p := altfe.NewParser() + grammar, err = p.Parse(scanner) + */ + grammar, err = altfe.ParseFile(cfg.SourceFile()) if err != nil { fmt.Printf("Parse error: %s\n", err) os.Exit(1) } + outdir_base := cfg.OutDir() + subpath := "internal" + outdir_log := path.Join(outdir_base, "log") g := grammar.(*ast.Grammar) gSymbols := symbols.NewSymbols(g) if cfg.Verbose() { - writeTerminals(gSymbols, cfg) + writeTerminals(gSymbols, cfg, outdir_log) } var tokenMap *outToken.TokenMap @@ -124,32 +127,34 @@ func main() { gSymbols.Add(g.LexPart.TokenIds()...) g.LexPart.UpdateStringLitTokens(gSymbols.ListStringLitSymbols()) lexSets := lexItems.GetItemSets(g.LexPart) + if cfg.Verbose() { - io.WriteFileString(path.Join(cfg.OutDir(), "lexer_sets.txt"), lexSets.String()) + io.WriteFileString(path.Join(outdir_log, "lexer_sets.txt"), lexSets.String()) } tokenMap = outToken.NewTokenMap(gSymbols.ListTerminals()) if !cfg.NoLexer() { - genLexer.Gen(cfg.Package(), cfg.OutDir(), g.LexPart.Header.SDTLit, lexSets, tokenMap, cfg) + genLexer.Gen(cfg.Package(), outdir_base, g.LexPart.Header.SDTLit, lexSets, tokenMap, cfg, subpath) } if g.SyntaxPart != nil { firstSets := first.GetFirstSets(g, gSymbols) if cfg.Verbose() { - io.WriteFileString(path.Join(cfg.OutDir(), "first.txt"), firstSets.String()) + io.WriteFileString(path.Join(outdir_log, "first.txt"), firstSets.String()) } lr1Sets := lr1Items.GetItemSets(g, gSymbols, firstSets) if cfg.Verbose() { - io.WriteFileString(path.Join(cfg.OutDir(), "LR1_sets.txt"), lr1Sets.String()) + io.WriteFileString(path.Join(outdir_log, "LR1_sets.txt"), lr1Sets.String()) } - conflicts := genParser.Gen(cfg.Package(), cfg.OutDir(), g.SyntaxPart.Header.SDTLit, g.SyntaxPart.ProdList, gSymbols, lr1Sets, tokenMap, cfg) - handleConflicts(conflicts, lr1Sets.Size(), cfg, g.SyntaxPart.ProdList) + conflicts := genParser.Gen(cfg.Package(), outdir_base, g.SyntaxPart.Header.SDTLit, g.SyntaxPart.ProdList, gSymbols, lr1Sets, tokenMap, cfg, subpath) + handleConflicts(conflicts, lr1Sets.Size(), cfg, g.SyntaxPart.ProdList, outdir_log) } - genToken.Gen(cfg.Package(), cfg.OutDir(), tokenMap) - genUtil.Gen(cfg.OutDir()) - genBase.Gen(cfg.Package(), cfg.OutDir()) + genToken.Gen(cfg.Package(), outdir_base, tokenMap, subpath) + genUtil.Gen(outdir_base, subpath) + genBase.Gen(cfg.Package(), outdir_base, subpath) + genIo.Gen(cfg.Package(), outdir_base, subpath) } func usage() { @@ -160,13 +165,13 @@ func usage() { os.Exit(1) } -func handleConflicts(conflicts map[int]lr1Items.RowConflicts, numSets int, cfg config.Config, prods ast.SyntaxProdList) { +func handleConflicts(conflicts map[int]lr1Items.RowConflicts, numSets int, cfg config.Config, prods ast.SyntaxProdList, outdir string) { if len(conflicts) <= 0 { return } fmt.Printf("%d LR-1 conflicts \n", len(conflicts)) - if cfg.Verbose() { - io.WriteFileString(path.Join(cfg.OutDir(), "LR1_conflicts.txt"), conflictString(conflicts, numSets, prods)) + if cfg.Verbose() || !cfg.AutoResolveLRConf() { + io.WriteFileString(path.Join(outdir, "LR1_conflicts.txt"), conflictString(conflicts, numSets, prods)) } if !cfg.AutoResolveLRConf() { os.Exit(1) @@ -197,10 +202,10 @@ func conflictString(conflicts map[int]lr1Items.RowConflicts, numSets int, prods return w.String() } -func writeTerminals(gSymbols *symbols.Symbols, cfg config.Config) { +func writeTerminals(gSymbols *symbols.Symbols, cfg config.Config, outdir string) { buf := new(bytes.Buffer) for _, t := range gSymbols.ListTerminals() { fmt.Fprintf(buf, "%s\n", t) } - io.WriteFile(path.Join(cfg.OutDir(), "terminals.txt"), buf.Bytes()) + io.WriteFile(path.Join(outdir, "terminals.txt"), buf.Bytes()) } diff --git a/spec/gocc2.ebnf b/spec/gocc2.ebnf index 5fe23775..8930a746 100644 --- a/spec/gocc2.ebnf +++ b/spec/gocc2.ebnf @@ -184,10 +184,10 @@ LexTerm : char_lit "-" char_lit << ast.NewLexCharRangeExt($0, $2,false) >> | - "~" char_lit + "-" char_lit << ast.NewLexCharLitExt($0, true) >> | - "~" "(" char_lit "-" char_lit ")" + "-" "(" char_lit "-" char_lit ")" << ast.NewLexCharRangeExt($2, $4, true) >> | regDefId diff --git a/spec/test.bnf b/spec/test.bnf index 5ef30d97..2e381a72 100644 --- a/spec/test.bnf +++ b/spec/test.bnf @@ -1,6 +1,8 @@ +!space : ' ' | '\t' ; -hexdigit : '0'-'F' ~(':'-'@') ; +hexdigit : '0'-'F' | -(':'-'@') ; +_hexdigit2 : '0'-'F' | -(':'-'@') ; Test : Test1 @@ -20,6 +22,9 @@ T hexdigit ; -T : "a" | error Test1 | "X" | X ; +T : "a" | "X" | ProdX ; + +ProdX : "empty" | "ε" | "λ" | empty | ε ; + +// X0: "!" | "hexdigit"; -X : "error" | "empty" | "ε" | "λ" | error | empty | ε | λ ; diff --git a/stock/main.go b/stock/main.go index 48b8b7e5..87e4fe40 100644 --- a/stock/main.go +++ b/stock/main.go @@ -27,11 +27,13 @@ import ( "strings" "github.com/maxcalandrelli/gocc/internal/ast" + genBase "github.com/maxcalandrelli/gocc/internal/base/gen" "github.com/maxcalandrelli/gocc/internal/config" oldparser "github.com/maxcalandrelli/gocc/internal/frontend/parser" oldscanner "github.com/maxcalandrelli/gocc/internal/frontend/scanner" oldtoken "github.com/maxcalandrelli/gocc/internal/frontend/token" "github.com/maxcalandrelli/gocc/internal/io" + genIo "github.com/maxcalandrelli/gocc/internal/io/gen" genLexer "github.com/maxcalandrelli/gocc/internal/lexer/gen/golang" lexItems "github.com/maxcalandrelli/gocc/internal/lexer/items" "github.com/maxcalandrelli/gocc/internal/parser/first" @@ -82,11 +84,14 @@ func main() { os.Exit(1) } + outdir_base := cfg.OutDir() + subpath := "internal" + outdir_log := path.Join(outdir_base, "log") g := grammar.(*ast.Grammar) gSymbols := symbols.NewSymbols(g) if cfg.Verbose() { - writeTerminals(gSymbols, cfg) + writeTerminals(gSymbols, cfg, outdir_log) } var tokenMap *outToken.TokenMap @@ -95,30 +100,32 @@ func main() { g.LexPart.UpdateStringLitTokens(gSymbols.ListStringLitSymbols()) lexSets := lexItems.GetItemSets(g.LexPart) if cfg.Verbose() { - io.WriteFileString(path.Join(cfg.OutDir(), "lexer_sets.txt"), lexSets.String()) + io.WriteFileString(path.Join(outdir_log, "lexer_sets.txt"), lexSets.String()) } tokenMap = outToken.NewTokenMap(gSymbols.ListTerminals()) if !cfg.NoLexer() { - genLexer.Gen(cfg.Package(), cfg.OutDir(), g.LexPart.Header.SDTLit, lexSets, tokenMap, cfg) + genLexer.Gen(cfg.Package(), outdir_base, g.LexPart.Header.SDTLit, lexSets, tokenMap, cfg, subpath) } if g.SyntaxPart != nil { firstSets := first.GetFirstSets(g, gSymbols) if cfg.Verbose() { - io.WriteFileString(path.Join(cfg.OutDir(), "first.txt"), firstSets.String()) + io.WriteFileString(path.Join(outdir_log, "first.txt"), firstSets.String()) } lr1Sets := lr1Items.GetItemSets(g, gSymbols, firstSets) if cfg.Verbose() { - io.WriteFileString(path.Join(cfg.OutDir(), "LR1_sets.txt"), lr1Sets.String()) + io.WriteFileString(path.Join(outdir_log, "LR1_sets.txt"), lr1Sets.String()) } - conflicts := genParser.Gen(cfg.Package(), cfg.OutDir(), g.SyntaxPart.Header.SDTLit, g.SyntaxPart.ProdList, gSymbols, lr1Sets, tokenMap, cfg) - handleConflicts(conflicts, lr1Sets.Size(), cfg, g.SyntaxPart.ProdList) + conflicts := genParser.Gen(cfg.Package(), outdir_base, g.SyntaxPart.Header.SDTLit, g.SyntaxPart.ProdList, gSymbols, lr1Sets, tokenMap, cfg, subpath) + handleConflicts(conflicts, lr1Sets.Size(), cfg, g.SyntaxPart.ProdList, outdir_log) } - genToken.Gen(cfg.Package(), cfg.OutDir(), tokenMap) - genUtil.Gen(cfg.OutDir()) + genToken.Gen(cfg.Package(), outdir_base, tokenMap, subpath) + genUtil.Gen(outdir_base, subpath) + genBase.Gen(cfg.Package(), outdir_base, subpath) + genIo.Gen(cfg.Package(), outdir_base, subpath) } func usage() { @@ -129,13 +136,13 @@ func usage() { os.Exit(1) } -func handleConflicts(conflicts map[int]lr1Items.RowConflicts, numSets int, cfg config.Config, prods ast.SyntaxProdList) { +func handleConflicts(conflicts map[int]lr1Items.RowConflicts, numSets int, cfg config.Config, prods ast.SyntaxProdList, outdir string) { if len(conflicts) <= 0 { return } fmt.Printf("%d LR-1 conflicts \n", len(conflicts)) if cfg.Verbose() { - io.WriteFileString(path.Join(cfg.OutDir(), "LR1_conflicts.txt"), conflictString(conflicts, numSets, prods)) + io.WriteFileString(path.Join(outdir, "LR1_conflicts.txt"), conflictString(conflicts, numSets, prods)) } if !cfg.AutoResolveLRConf() { os.Exit(1) @@ -166,10 +173,10 @@ func conflictString(conflicts map[int]lr1Items.RowConflicts, numSets int, prods return w.String() } -func writeTerminals(gSymbols *symbols.Symbols, cfg config.Config) { +func writeTerminals(gSymbols *symbols.Symbols, cfg config.Config, outdir string) { buf := new(bytes.Buffer) for _, t := range gSymbols.ListTerminals() { fmt.Fprintf(buf, "%s\n", t) } - io.WriteFile(path.Join(cfg.OutDir(), "terminals.txt"), buf.Bytes()) + io.WriteFile(path.Join(outdir, "terminals.txt"), buf.Bytes()) } From fd071d8c6515b978713081f5e26523dbd69d2aa1 Mon Sep 17 00:00:00 2001 From: Massimiliano Calandrelli Date: Sun, 6 Oct 2019 18:43:42 +0200 Subject: [PATCH 05/33] ... --- internal/ast/reconcile.go | 2 +- .../reparsed}/internal/errors/errors.go | 2 +- .../io/stream/internal/stream_impl.go | 0 .../io/stream/internal/stream_public.go | 0 .../reparsed}/internal/io/stream/stream.go | 2 +- .../reparsed}/internal/lexer/acttab.go | 84 +- .../reparsed}/internal/lexer/lexer.go | 115 +- .../internal/lexer/transitiontable.go | 658 ++--- .../reparsed}/internal/parser/action.go | 0 .../reparsed}/internal/parser/actiontable.go | 287 ++- .../reparsed}/internal/parser/gototable.go | 0 .../reparsed}/internal/parser/parser.go | 6 +- .../internal/parser/productionstable.go | 4 +- .../reparsed}/internal/token/token.go | 28 +- .../reparsed}/internal/util/litconv.go | 0 .../reparsed}/internal/util/rune.go | 0 .../reparsed}/log/LR1_conflicts.txt | 4 +- .../reparsed}/log/LR1_sets.txt | 2208 ++++++++--------- .../{fe2 => frontend/reparsed}/log/first.txt | 6 +- .../reparsed}/log/lexer_sets.txt | 769 +++--- .../reparsed}/log/terminals.txt | 1 + .../{fe2 => frontend/reparsed}/main/main.go | 8 +- .../fe2.go => frontend/reparsed/reparsed.go} | 10 +- .../frontend/{ => stock}/errors/errors.go | 2 +- .../frontend/{ => stock}/parser/parser.go | 4 +- .../frontend/{ => stock}/parser/parser_ut.go | 4 +- .../frontend/{ => stock}/parser/tables.go | 0 .../{ => stock}/parser/tables_uncompressed.go | 0 .../frontend/{ => stock}/scanner/scanner.go | 2 +- .../{ => stock}/scanner/scanner_test.go | 2 +- internal/frontend/{ => stock}/token/token.go | 0 internal/frontend/{ => stock}/token/tokens.go | 0 internal/lexer/items/testutils_test.go | 6 +- internal/parser/lr1/items/testdata_test.go | 6 +- main.go | 2 +- spec/gocc2.ebnf | 4 +- spec/test.bnf | 3 +- stock/main.go | 6 +- 38 files changed, 2206 insertions(+), 2029 deletions(-) rename internal/{fe2 => frontend/reparsed}/internal/errors/errors.go (94%) rename internal/{fe2 => frontend/reparsed}/internal/io/stream/internal/stream_impl.go (100%) rename internal/{fe2 => frontend/reparsed}/internal/io/stream/internal/stream_public.go (100%) rename internal/{fe2 => frontend/reparsed}/internal/io/stream/stream.go (88%) rename internal/{fe2 => frontend/reparsed}/internal/lexer/acttab.go (96%) rename internal/{fe2 => frontend/reparsed}/internal/lexer/lexer.go (80%) rename internal/{fe2 => frontend/reparsed}/internal/lexer/transitiontable.go (95%) rename internal/{fe2 => frontend/reparsed}/internal/parser/action.go (100%) rename internal/{fe2 => frontend/reparsed}/internal/parser/actiontable.go (95%) rename internal/{fe2 => frontend/reparsed}/internal/parser/gototable.go (100%) rename internal/{fe2 => frontend/reparsed}/internal/parser/parser.go (96%) rename internal/{fe2 => frontend/reparsed}/internal/parser/productionstable.go (99%) rename internal/{fe2 => frontend/reparsed}/internal/token/token.go (83%) rename internal/{fe2 => frontend/reparsed}/internal/util/litconv.go (100%) rename internal/{fe2 => frontend/reparsed}/internal/util/rune.go (100%) rename internal/{fe2 => frontend/reparsed}/log/LR1_conflicts.txt (100%) rename internal/{fe2 => frontend/reparsed}/log/LR1_sets.txt (73%) rename internal/{fe2 => frontend/reparsed}/log/first.txt (98%) rename internal/{fe2 => frontend/reparsed}/log/lexer_sets.txt (93%) rename internal/{fe2 => frontend/reparsed}/log/terminals.txt (98%) rename internal/{fe2 => frontend/reparsed}/main/main.go (74%) rename internal/{fe2/fe2.go => frontend/reparsed/reparsed.go} (74%) rename internal/frontend/{ => stock}/errors/errors.go (87%) rename internal/frontend/{ => stock}/parser/parser.go (97%) rename internal/frontend/{ => stock}/parser/parser_ut.go (96%) rename internal/frontend/{ => stock}/parser/tables.go (100%) rename internal/frontend/{ => stock}/parser/tables_uncompressed.go (100%) rename internal/frontend/{ => stock}/scanner/scanner.go (99%) rename internal/frontend/{ => stock}/scanner/scanner_test.go (96%) rename internal/frontend/{ => stock}/token/token.go (100%) rename internal/frontend/{ => stock}/token/tokens.go (100%) diff --git a/internal/ast/reconcile.go b/internal/ast/reconcile.go index 83b56ea8..09488db6 100644 --- a/internal/ast/reconcile.go +++ b/internal/ast/reconcile.go @@ -1,7 +1,7 @@ package ast import ( - "github.com/maxcalandrelli/gocc/internal/frontend/token" + "github.com/maxcalandrelli/gocc/internal/frontend/stock/token" ) var ( diff --git a/internal/fe2/internal/errors/errors.go b/internal/frontend/reparsed/internal/errors/errors.go similarity index 94% rename from internal/fe2/internal/errors/errors.go rename to internal/frontend/reparsed/internal/errors/errors.go index f30d1848..0977f1f7 100644 --- a/internal/fe2/internal/errors/errors.go +++ b/internal/frontend/reparsed/internal/errors/errors.go @@ -6,7 +6,7 @@ import ( "fmt" "strings" - "github.com/maxcalandrelli/gocc/internal/fe2/internal/token" + "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/internal/token" ) type ErrorSymbol interface { diff --git a/internal/fe2/internal/io/stream/internal/stream_impl.go b/internal/frontend/reparsed/internal/io/stream/internal/stream_impl.go similarity index 100% rename from internal/fe2/internal/io/stream/internal/stream_impl.go rename to internal/frontend/reparsed/internal/io/stream/internal/stream_impl.go diff --git a/internal/fe2/internal/io/stream/internal/stream_public.go b/internal/frontend/reparsed/internal/io/stream/internal/stream_public.go similarity index 100% rename from internal/fe2/internal/io/stream/internal/stream_public.go rename to internal/frontend/reparsed/internal/io/stream/internal/stream_public.go diff --git a/internal/fe2/internal/io/stream/stream.go b/internal/frontend/reparsed/internal/io/stream/stream.go similarity index 88% rename from internal/fe2/internal/io/stream/stream.go rename to internal/frontend/reparsed/internal/io/stream/stream.go index b2216430..7268d341 100644 --- a/internal/fe2/internal/io/stream/stream.go +++ b/internal/frontend/reparsed/internal/io/stream/stream.go @@ -1,7 +1,7 @@ package stream import ( - internal "github.com/maxcalandrelli/gocc/internal/fe2/internal/io/stream/internal" + internal "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/internal/io/stream/internal" "io" ) diff --git a/internal/fe2/internal/lexer/acttab.go b/internal/frontend/reparsed/internal/lexer/acttab.go similarity index 96% rename from internal/fe2/internal/lexer/acttab.go rename to internal/frontend/reparsed/internal/lexer/acttab.go index fb559a1c..73854767 100644 --- a/internal/fe2/internal/lexer/acttab.go +++ b/internal/frontend/reparsed/internal/lexer/acttab.go @@ -5,7 +5,7 @@ package lexer import ( "fmt" - "github.com/maxcalandrelli/gocc/internal/fe2/internal/token" + "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/internal/token" ) type ActionTable [NumStates]ActionRow @@ -41,11 +41,11 @@ var ActTab = ActionTable{ Ignore: "", }, ActionRow{ // S5 - Accept: 11, + Accept: 12, Ignore: "", }, ActionRow{ // S6 - Accept: 12, + Accept: 13, Ignore: "", }, ActionRow{ // S7 @@ -73,15 +73,15 @@ var ActTab = ActionTable{ Ignore: "", }, ActionRow{ // S13 - Accept: 18, + Accept: 19, Ignore: "", }, ActionRow{ // S14 - Accept: 13, + Accept: 14, Ignore: "", }, ActionRow{ // S15 - Accept: 14, + Accept: 15, Ignore: "", }, ActionRow{ // S16 @@ -101,7 +101,7 @@ var ActTab = ActionTable{ Ignore: "", }, ActionRow{ // S20 - Accept: 15, + Accept: 16, Ignore: "", }, ActionRow{ // S21 @@ -109,27 +109,27 @@ var ActTab = ActionTable{ Ignore: "", }, ActionRow{ // S22 - Accept: 16, + Accept: 17, Ignore: "", }, ActionRow{ // S23 - Accept: 23, + Accept: 11, Ignore: "", }, ActionRow{ // S24 - Accept: 21, + Accept: 24, Ignore: "", }, ActionRow{ // S25 - Accept: 6, + Accept: 22, Ignore: "", }, ActionRow{ // S26 - Accept: 19, + Accept: 6, Ignore: "", }, ActionRow{ // S27 - Accept: 0, + Accept: 20, Ignore: "", }, ActionRow{ // S28 @@ -157,23 +157,23 @@ var ActTab = ActionTable{ Ignore: "", }, ActionRow{ // S34 - Accept: 18, + Accept: 0, Ignore: "", }, ActionRow{ // S35 - Accept: 18, + Accept: 19, Ignore: "", }, ActionRow{ // S36 - Accept: 18, + Accept: 19, Ignore: "", }, ActionRow{ // S37 - Accept: 18, + Accept: 19, Ignore: "", }, ActionRow{ // S38 - Accept: 5, + Accept: 19, Ignore: "", }, ActionRow{ // S39 @@ -189,11 +189,11 @@ var ActTab = ActionTable{ Ignore: "", }, ActionRow{ // S42 - Accept: 19, + Accept: 5, Ignore: "", }, ActionRow{ // S43 - Accept: 2, + Accept: 20, Ignore: "", }, ActionRow{ // S44 @@ -217,7 +217,7 @@ var ActTab = ActionTable{ Ignore: "", }, ActionRow{ // S49 - Accept: 6, + Accept: 2, Ignore: "", }, ActionRow{ // S50 @@ -233,7 +233,7 @@ var ActTab = ActionTable{ Ignore: "", }, ActionRow{ // S53 - Accept: 0, + Accept: 6, Ignore: "", }, ActionRow{ // S54 @@ -273,23 +273,23 @@ var ActTab = ActionTable{ Ignore: "", }, ActionRow{ // S63 - Accept: 9, + Accept: 0, Ignore: "", }, ActionRow{ // S64 - Accept: 0, + Accept: 9, Ignore: "", }, ActionRow{ // S65 - Accept: -1, - Ignore: "!comment", - }, - ActionRow{ // S66 Accept: 0, Ignore: "", }, + ActionRow{ // S66 + Accept: -1, + Ignore: "!comment", + }, ActionRow{ // S67 - Accept: 2, + Accept: 0, Ignore: "", }, ActionRow{ // S68 @@ -297,7 +297,7 @@ var ActTab = ActionTable{ Ignore: "", }, ActionRow{ // S69 - Accept: 0, + Accept: 2, Ignore: "", }, ActionRow{ // S70 @@ -329,15 +329,15 @@ var ActTab = ActionTable{ Ignore: "", }, ActionRow{ // S77 - Accept: -1, - Ignore: "!comment", - }, - ActionRow{ // S78 Accept: 0, Ignore: "", }, + ActionRow{ // S78 + Accept: -1, + Ignore: "!comment", + }, ActionRow{ // S79 - Accept: 2, + Accept: 0, Ignore: "", }, ActionRow{ // S80 @@ -345,7 +345,7 @@ var ActTab = ActionTable{ Ignore: "", }, ActionRow{ // S81 - Accept: 0, + Accept: 2, Ignore: "", }, ActionRow{ // S82 @@ -377,19 +377,19 @@ var ActTab = ActionTable{ Ignore: "", }, ActionRow{ // S89 - Accept: 17, + Accept: 0, Ignore: "", }, ActionRow{ // S90 - Accept: 22, + Accept: 18, Ignore: "", }, ActionRow{ // S91 - Accept: 20, + Accept: 23, Ignore: "", }, ActionRow{ // S92 - Accept: 0, + Accept: 21, Ignore: "", }, ActionRow{ // S93 @@ -452,4 +452,8 @@ var ActTab = ActionTable{ Accept: 0, Ignore: "", }, + ActionRow{ // S108 + Accept: 0, + Ignore: "", + }, } diff --git a/internal/fe2/internal/lexer/lexer.go b/internal/frontend/reparsed/internal/lexer/lexer.go similarity index 80% rename from internal/fe2/internal/lexer/lexer.go rename to internal/frontend/reparsed/internal/lexer/lexer.go index 2ab9e40f..e22a6757 100644 --- a/internal/fe2/internal/lexer/lexer.go +++ b/internal/frontend/reparsed/internal/lexer/lexer.go @@ -6,13 +6,13 @@ import ( "io/ioutil" "unicode/utf8" - "github.com/maxcalandrelli/gocc/internal/fe2/internal/token" + "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/internal/token" ) const ( NoState = -1 - NumStates = 108 - NumSymbols = 74 + NumStates = 109 + NumSymbols = 75 ) type Position struct { @@ -161,65 +161,66 @@ Lexer symbols: 10: '|' 11: '.' 12: '-' -13: '(' -14: ')' -15: '[' -16: ']' -17: '{' -18: '}' -19: 'e' -20: 'r' +13: '~' +14: '(' +15: ')' +16: '[' +17: ']' +18: '{' +19: '}' +20: 'e' 21: 'r' -22: 'o' -23: 'r' -24: \u03bb -25: 'e' -26: 'm' -27: 'p' -28: 't' -29: 'y' -30: \u03b5 -31: '/' +22: 'r' +23: 'o' +24: 'r' +25: \u03bb +26: 'e' +27: 'm' +28: 'p' +29: 't' +30: 'y' +31: \u03b5 32: '/' -33: '\n' -34: '/' -35: '*' +33: '/' +34: '\n' +35: '/' 36: '*' 37: '*' -38: '/' -39: '_' -40: '\' -41: 'u' -42: '\' -43: 'U' -44: '\' -45: 'a' -46: 'b' -47: 'f' -48: 'n' -49: 'r' -50: 't' -51: 'v' -52: '\' -53: ''' -54: '"' -55: '\' +38: '*' +39: '/' +40: '_' +41: '\' +42: 'u' +43: '\' +44: 'U' +45: '\' +46: 'a' +47: 'b' +48: 'f' +49: 'n' +50: 'r' +51: 't' +52: 'v' +53: '\' +54: ''' +55: '"' 56: '\' -57: 'x' -58: '`' +57: '\' +58: 'x' 59: '`' -60: '"' +60: '`' 61: '"' -62: ' ' -63: '\t' -64: '\n' -65: '\r' -66: 'a'-'z' -67: 'A'-'Z' -68: '0'-'9' -69: '0'-'7' -70: '0'-'9' -71: 'A'-'F' -72: 'a'-'f' -73: . +62: '"' +63: ' ' +64: '\t' +65: '\n' +66: '\r' +67: 'a'-'z' +68: 'A'-'Z' +69: '0'-'9' +70: '0'-'7' +71: '0'-'9' +72: 'A'-'F' +73: 'a'-'f' +74: . */ diff --git a/internal/fe2/internal/lexer/transitiontable.go b/internal/frontend/reparsed/internal/lexer/transitiontable.go similarity index 95% rename from internal/fe2/internal/lexer/transitiontable.go rename to internal/frontend/reparsed/internal/lexer/transitiontable.go index 8dd0dff6..9cf91598 100644 --- a/internal/fe2/internal/lexer/transitiontable.go +++ b/internal/frontend/reparsed/internal/lexer/transitiontable.go @@ -65,10 +65,12 @@ var TransTab = TransitionTable{ return 21 case r == 125: // ['}','}'] return 22 - case r == 949: // [\u03b5,\u03b5] + case r == 126: // ['~','~'] return 23 - case r == 955: // [\u03bb,\u03bb] + case r == 949: // [\u03b5,\u03b5] return 24 + case r == 955: // [\u03bb,\u03bb] + return 25 } return NoState }, @@ -82,7 +84,7 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 97 <= r && r <= 122: // ['a','z'] - return 25 + return 26 } return NoState }, @@ -90,20 +92,20 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case r == 34: // ['"','"'] - return 26 - case r == 92: // ['\','\'] return 27 - default: + case r == 92: // ['\','\'] return 28 + default: + return 29 } }, // S4 func(r rune) int { switch { case r == 92: // ['\','\'] - return 29 - default: return 30 + default: + return 31 } }, // S5 @@ -134,9 +136,9 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case r == 42: // ['*','*'] - return 31 - case r == 47: // ['/','/'] return 32 + case r == 47: // ['/','/'] + return 33 } return NoState }, @@ -156,7 +158,7 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case r == 60: // ['<','<'] - return 33 + return 34 } return NoState }, @@ -164,13 +166,13 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 34 - case 65 <= r && r <= 90: // ['A','Z'] return 35 - case r == 95: // ['_','_'] + case 65 <= r && r <= 90: // ['A','Z'] return 36 - case 97 <= r && r <= 122: // ['a','z'] + case r == 95: // ['_','_'] return 37 + case 97 <= r && r <= 122: // ['a','z'] + return 38 } return NoState }, @@ -190,13 +192,13 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 38 - case 65 <= r && r <= 90: // ['A','Z'] return 39 - case r == 95: // ['_','_'] + case 65 <= r && r <= 90: // ['A','Z'] return 40 - case 97 <= r && r <= 122: // ['a','z'] + case r == 95: // ['_','_'] return 41 + case 97 <= r && r <= 122: // ['a','z'] + return 42 } return NoState }, @@ -204,7 +206,7 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case r == 96: // ['`','`'] - return 42 + return 43 default: return 17 } @@ -213,13 +215,13 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 43 - case 65 <= r && r <= 90: // ['A','Z'] return 44 - case r == 95: // ['_','_'] + case 65 <= r && r <= 90: // ['A','Z'] return 45 - case 97 <= r && r <= 122: // ['a','z'] + case r == 95: // ['_','_'] return 46 + case 97 <= r && r <= 122: // ['a','z'] + return 47 } return NoState }, @@ -227,21 +229,21 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 43 - case 65 <= r && r <= 90: // ['A','Z'] return 44 - case r == 95: // ['_','_'] + case 65 <= r && r <= 90: // ['A','Z'] return 45 - case 97 <= r && r <= 108: // ['a','l'] + case r == 95: // ['_','_'] return 46 - case r == 109: // ['m','m'] + case 97 <= r && r <= 108: // ['a','l'] return 47 + case r == 109: // ['m','m'] + return 48 case 110 <= r && r <= 113: // ['n','q'] - return 46 + return 47 case r == 114: // ['r','r'] - return 48 + return 49 case 115 <= r && r <= 122: // ['s','z'] - return 46 + return 47 } return NoState }, @@ -276,108 +278,106 @@ var TransTab = TransitionTable{ return NoState }, // S25 + func(r rune) int { + switch { + } + return NoState + }, + // S26 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 49 - case 65 <= r && r <= 90: // ['A','Z'] return 50 - case r == 95: // ['_','_'] + case 65 <= r && r <= 90: // ['A','Z'] return 51 - case 97 <= r && r <= 122: // ['a','z'] + case r == 95: // ['_','_'] return 52 + case 97 <= r && r <= 122: // ['a','z'] + return 53 } return NoState }, - // S26 + // S27 func(r rune) int { switch { } return NoState }, - // S27 + // S28 func(r rune) int { switch { case r == 34: // ['"','"'] - return 53 + return 54 case r == 39: // [''','''] - return 53 - case 48 <= r && r <= 55: // ['0','7'] return 54 - case r == 85: // ['U','U'] + case 48 <= r && r <= 55: // ['0','7'] return 55 + case r == 85: // ['U','U'] + return 56 case r == 92: // ['\','\'] - return 53 + return 54 case r == 97: // ['a','a'] - return 53 + return 54 case r == 98: // ['b','b'] - return 53 + return 54 case r == 102: // ['f','f'] - return 53 + return 54 case r == 110: // ['n','n'] - return 53 + return 54 case r == 114: // ['r','r'] - return 53 + return 54 case r == 116: // ['t','t'] - return 53 + return 54 case r == 117: // ['u','u'] - return 56 + return 57 case r == 118: // ['v','v'] - return 53 + return 54 case r == 120: // ['x','x'] - return 57 + return 58 } return NoState }, - // S28 + // S29 func(r rune) int { switch { case r == 34: // ['"','"'] - return 26 - case r == 92: // ['\','\'] return 27 - default: + case r == 92: // ['\','\'] return 28 + default: + return 29 } }, - // S29 + // S30 func(r rune) int { switch { case r == 34: // ['"','"'] - return 58 + return 59 case r == 39: // [''','''] - return 58 - case 48 <= r && r <= 55: // ['0','7'] return 59 - case r == 85: // ['U','U'] + case 48 <= r && r <= 55: // ['0','7'] return 60 + case r == 85: // ['U','U'] + return 61 case r == 92: // ['\','\'] - return 58 + return 59 case r == 97: // ['a','a'] - return 58 + return 59 case r == 98: // ['b','b'] - return 58 + return 59 case r == 102: // ['f','f'] - return 58 + return 59 case r == 110: // ['n','n'] - return 58 + return 59 case r == 114: // ['r','r'] - return 58 + return 59 case r == 116: // ['t','t'] - return 58 + return 59 case r == 117: // ['u','u'] - return 61 + return 62 case r == 118: // ['v','v'] - return 58 + return 59 case r == 120: // ['x','x'] - return 62 - } - return NoState - }, - // S30 - func(r rune) int { - switch { - case r == 39: // [''','''] return 63 } return NoState @@ -385,16 +385,15 @@ var TransTab = TransitionTable{ // S31 func(r rune) int { switch { - case r == 42: // ['*','*'] + case r == 39: // [''','''] return 64 - default: - return 31 } + return NoState }, // S32 func(r rune) int { switch { - case r == 10: // ['\n','\n'] + case r == 42: // ['*','*'] return 65 default: return 32 @@ -403,35 +402,30 @@ var TransTab = TransitionTable{ // S33 func(r rune) int { switch { - default: + case r == 10: // ['\n','\n'] return 66 + default: + return 33 } }, // S34 func(r rune) int { switch { - case 48 <= r && r <= 57: // ['0','9'] - return 34 - case 65 <= r && r <= 90: // ['A','Z'] - return 35 - case r == 95: // ['_','_'] - return 36 - case 97 <= r && r <= 122: // ['a','z'] - return 37 + default: + return 67 } - return NoState }, // S35 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 34 - case 65 <= r && r <= 90: // ['A','Z'] return 35 - case r == 95: // ['_','_'] + case 65 <= r && r <= 90: // ['A','Z'] return 36 - case 97 <= r && r <= 122: // ['a','z'] + case r == 95: // ['_','_'] return 37 + case 97 <= r && r <= 122: // ['a','z'] + return 38 } return NoState }, @@ -439,13 +433,13 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 34 - case 65 <= r && r <= 90: // ['A','Z'] return 35 - case r == 95: // ['_','_'] + case 65 <= r && r <= 90: // ['A','Z'] return 36 - case 97 <= r && r <= 122: // ['a','z'] + case r == 95: // ['_','_'] return 37 + case 97 <= r && r <= 122: // ['a','z'] + return 38 } return NoState }, @@ -453,13 +447,13 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 34 - case 65 <= r && r <= 90: // ['A','Z'] return 35 - case r == 95: // ['_','_'] + case 65 <= r && r <= 90: // ['A','Z'] return 36 - case 97 <= r && r <= 122: // ['a','z'] + case r == 95: // ['_','_'] return 37 + case 97 <= r && r <= 122: // ['a','z'] + return 38 } return NoState }, @@ -467,13 +461,13 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 38 + return 35 case 65 <= r && r <= 90: // ['A','Z'] - return 39 + return 36 case r == 95: // ['_','_'] - return 40 + return 37 case 97 <= r && r <= 122: // ['a','z'] - return 41 + return 38 } return NoState }, @@ -481,13 +475,13 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 38 - case 65 <= r && r <= 90: // ['A','Z'] return 39 - case r == 95: // ['_','_'] + case 65 <= r && r <= 90: // ['A','Z'] return 40 - case 97 <= r && r <= 122: // ['a','z'] + case r == 95: // ['_','_'] return 41 + case 97 <= r && r <= 122: // ['a','z'] + return 42 } return NoState }, @@ -495,13 +489,13 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 38 - case 65 <= r && r <= 90: // ['A','Z'] return 39 - case r == 95: // ['_','_'] + case 65 <= r && r <= 90: // ['A','Z'] return 40 - case 97 <= r && r <= 122: // ['a','z'] + case r == 95: // ['_','_'] return 41 + case 97 <= r && r <= 122: // ['a','z'] + return 42 } return NoState }, @@ -509,33 +503,33 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 38 - case 65 <= r && r <= 90: // ['A','Z'] return 39 - case r == 95: // ['_','_'] + case 65 <= r && r <= 90: // ['A','Z'] return 40 - case 97 <= r && r <= 122: // ['a','z'] + case r == 95: // ['_','_'] return 41 + case 97 <= r && r <= 122: // ['a','z'] + return 42 } return NoState }, // S42 func(r rune) int { switch { + case 48 <= r && r <= 57: // ['0','9'] + return 39 + case 65 <= r && r <= 90: // ['A','Z'] + return 40 + case r == 95: // ['_','_'] + return 41 + case 97 <= r && r <= 122: // ['a','z'] + return 42 } return NoState }, // S43 func(r rune) int { switch { - case 48 <= r && r <= 57: // ['0','9'] - return 43 - case 65 <= r && r <= 90: // ['A','Z'] - return 44 - case r == 95: // ['_','_'] - return 45 - case 97 <= r && r <= 122: // ['a','z'] - return 46 } return NoState }, @@ -543,13 +537,13 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 43 - case 65 <= r && r <= 90: // ['A','Z'] return 44 - case r == 95: // ['_','_'] + case 65 <= r && r <= 90: // ['A','Z'] return 45 - case 97 <= r && r <= 122: // ['a','z'] + case r == 95: // ['_','_'] return 46 + case 97 <= r && r <= 122: // ['a','z'] + return 47 } return NoState }, @@ -557,13 +551,13 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 43 - case 65 <= r && r <= 90: // ['A','Z'] return 44 - case r == 95: // ['_','_'] + case 65 <= r && r <= 90: // ['A','Z'] return 45 - case 97 <= r && r <= 122: // ['a','z'] + case r == 95: // ['_','_'] return 46 + case 97 <= r && r <= 122: // ['a','z'] + return 47 } return NoState }, @@ -571,13 +565,13 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 43 - case 65 <= r && r <= 90: // ['A','Z'] return 44 - case r == 95: // ['_','_'] + case 65 <= r && r <= 90: // ['A','Z'] return 45 - case 97 <= r && r <= 122: // ['a','z'] + case r == 95: // ['_','_'] return 46 + case 97 <= r && r <= 122: // ['a','z'] + return 47 } return NoState }, @@ -585,17 +579,13 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 43 - case 65 <= r && r <= 90: // ['A','Z'] return 44 - case r == 95: // ['_','_'] + case 65 <= r && r <= 90: // ['A','Z'] return 45 - case 97 <= r && r <= 111: // ['a','o'] - return 46 - case r == 112: // ['p','p'] - return 67 - case 113 <= r && r <= 122: // ['q','z'] + case r == 95: // ['_','_'] return 46 + case 97 <= r && r <= 122: // ['a','z'] + return 47 } return NoState }, @@ -603,17 +593,17 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 43 - case 65 <= r && r <= 90: // ['A','Z'] return 44 - case r == 95: // ['_','_'] + case 65 <= r && r <= 90: // ['A','Z'] return 45 - case 97 <= r && r <= 113: // ['a','q'] + case r == 95: // ['_','_'] return 46 - case r == 114: // ['r','r'] + case 97 <= r && r <= 111: // ['a','o'] + return 47 + case r == 112: // ['p','p'] return 68 - case 115 <= r && r <= 122: // ['s','z'] - return 46 + case 113 <= r && r <= 122: // ['q','z'] + return 47 } return NoState }, @@ -621,13 +611,17 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 49 + return 44 case 65 <= r && r <= 90: // ['A','Z'] - return 50 + return 45 case r == 95: // ['_','_'] - return 51 - case 97 <= r && r <= 122: // ['a','z'] - return 52 + return 46 + case 97 <= r && r <= 113: // ['a','q'] + return 47 + case r == 114: // ['r','r'] + return 69 + case 115 <= r && r <= 122: // ['s','z'] + return 47 } return NoState }, @@ -635,13 +629,13 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 49 - case 65 <= r && r <= 90: // ['A','Z'] return 50 - case r == 95: // ['_','_'] + case 65 <= r && r <= 90: // ['A','Z'] return 51 - case 97 <= r && r <= 122: // ['a','z'] + case r == 95: // ['_','_'] return 52 + case 97 <= r && r <= 122: // ['a','z'] + return 53 } return NoState }, @@ -649,13 +643,13 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 49 - case 65 <= r && r <= 90: // ['A','Z'] return 50 - case r == 95: // ['_','_'] + case 65 <= r && r <= 90: // ['A','Z'] return 51 - case 97 <= r && r <= 122: // ['a','z'] + case r == 95: // ['_','_'] return 52 + case 97 <= r && r <= 122: // ['a','z'] + return 53 } return NoState }, @@ -663,43 +657,45 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 49 - case 65 <= r && r <= 90: // ['A','Z'] return 50 - case r == 95: // ['_','_'] + case 65 <= r && r <= 90: // ['A','Z'] return 51 - case 97 <= r && r <= 122: // ['a','z'] + case r == 95: // ['_','_'] return 52 + case 97 <= r && r <= 122: // ['a','z'] + return 53 } return NoState }, // S53 func(r rune) int { switch { - case r == 34: // ['"','"'] - return 26 - case r == 92: // ['\','\'] - return 27 - default: - return 28 + case 48 <= r && r <= 57: // ['0','9'] + return 50 + case 65 <= r && r <= 90: // ['A','Z'] + return 51 + case r == 95: // ['_','_'] + return 52 + case 97 <= r && r <= 122: // ['a','z'] + return 53 } + return NoState }, // S54 func(r rune) int { switch { - case 48 <= r && r <= 55: // ['0','7'] - return 69 + case r == 34: // ['"','"'] + return 27 + case r == 92: // ['\','\'] + return 28 + default: + return 29 } - return NoState }, // S55 func(r rune) int { switch { - case 48 <= r && r <= 57: // ['0','9'] - return 70 - case 65 <= r && r <= 70: // ['A','F'] - return 70 - case 97 <= r && r <= 102: // ['a','f'] + case 48 <= r && r <= 55: // ['0','7'] return 70 } return NoState @@ -731,27 +727,27 @@ var TransTab = TransitionTable{ // S58 func(r rune) int { switch { - case r == 39: // [''','''] - return 63 + case 48 <= r && r <= 57: // ['0','9'] + return 73 + case 65 <= r && r <= 70: // ['A','F'] + return 73 + case 97 <= r && r <= 102: // ['a','f'] + return 73 } return NoState }, // S59 func(r rune) int { switch { - case 48 <= r && r <= 55: // ['0','7'] - return 73 + case r == 39: // [''','''] + return 64 } return NoState }, // S60 func(r rune) int { switch { - case 48 <= r && r <= 57: // ['0','9'] - return 74 - case 65 <= r && r <= 70: // ['A','F'] - return 74 - case 97 <= r && r <= 102: // ['a','f'] + case 48 <= r && r <= 55: // ['0','7'] return 74 } return NoState @@ -772,98 +768,98 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 76 + return 76 + case 65 <= r && r <= 70: // ['A','F'] + return 76 + case 97 <= r && r <= 102: // ['a','f'] + return 76 + } + return NoState + }, + // S63 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 77 case 65 <= r && r <= 70: // ['A','F'] - return 76 + return 77 case 97 <= r && r <= 102: // ['a','f'] - return 76 + return 77 } return NoState }, - // S63 + // S64 func(r rune) int { switch { } return NoState }, - // S64 + // S65 func(r rune) int { switch { case r == 42: // ['*','*'] - return 64 + return 65 case r == 47: // ['/','/'] - return 77 + return 78 default: - return 31 + return 32 } }, - // S65 + // S66 func(r rune) int { switch { } return NoState }, - // S66 + // S67 func(r rune) int { switch { case r == 62: // ['>','>'] - return 78 + return 79 default: - return 66 + return 67 } }, - // S67 + // S68 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 43 - case 65 <= r && r <= 90: // ['A','Z'] return 44 - case r == 95: // ['_','_'] + case 65 <= r && r <= 90: // ['A','Z'] return 45 - case 97 <= r && r <= 115: // ['a','s'] + case r == 95: // ['_','_'] return 46 + case 97 <= r && r <= 115: // ['a','s'] + return 47 case r == 116: // ['t','t'] - return 79 + return 80 case 117 <= r && r <= 122: // ['u','z'] - return 46 + return 47 } return NoState }, - // S68 + // S69 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 43 - case 65 <= r && r <= 90: // ['A','Z'] return 44 - case r == 95: // ['_','_'] + case 65 <= r && r <= 90: // ['A','Z'] return 45 - case 97 <= r && r <= 110: // ['a','n'] + case r == 95: // ['_','_'] return 46 + case 97 <= r && r <= 110: // ['a','n'] + return 47 case r == 111: // ['o','o'] - return 80 - case 112 <= r && r <= 122: // ['p','z'] - return 46 - } - return NoState - }, - // S69 - func(r rune) int { - switch { - case 48 <= r && r <= 55: // ['0','7'] return 81 + case 112 <= r && r <= 122: // ['p','z'] + return 47 } return NoState }, // S70 func(r rune) int { switch { - case 48 <= r && r <= 57: // ['0','9'] - return 82 - case 65 <= r && r <= 70: // ['A','F'] - return 82 - case 97 <= r && r <= 102: // ['a','f'] + case 48 <= r && r <= 55: // ['0','7'] return 82 } return NoState @@ -895,7 +891,11 @@ var TransTab = TransitionTable{ // S73 func(r rune) int { switch { - case 48 <= r && r <= 55: // ['0','7'] + case 48 <= r && r <= 57: // ['0','9'] + return 85 + case 65 <= r && r <= 70: // ['A','F'] + return 85 + case 97 <= r && r <= 102: // ['a','f'] return 85 } return NoState @@ -903,11 +903,7 @@ var TransTab = TransitionTable{ // S74 func(r rune) int { switch { - case 48 <= r && r <= 57: // ['0','9'] - return 86 - case 65 <= r && r <= 70: // ['A','F'] - return 86 - case 97 <= r && r <= 102: // ['a','f'] + case 48 <= r && r <= 55: // ['0','7'] return 86 } return NoState @@ -939,116 +935,116 @@ var TransTab = TransitionTable{ // S77 func(r rune) int { switch { + case 48 <= r && r <= 57: // ['0','9'] + return 89 + case 65 <= r && r <= 70: // ['A','F'] + return 89 + case 97 <= r && r <= 102: // ['a','f'] + return 89 } return NoState }, // S78 func(r rune) int { switch { - case r == 62: // ['>','>'] - return 89 } return NoState }, // S79 + func(r rune) int { + switch { + case r == 62: // ['>','>'] + return 90 + } + return NoState + }, + // S80 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 43 - case 65 <= r && r <= 90: // ['A','Z'] return 44 - case r == 95: // ['_','_'] + case 65 <= r && r <= 90: // ['A','Z'] return 45 - case 97 <= r && r <= 120: // ['a','x'] + case r == 95: // ['_','_'] return 46 + case 97 <= r && r <= 120: // ['a','x'] + return 47 case r == 121: // ['y','y'] - return 90 + return 91 case r == 122: // ['z','z'] - return 46 + return 47 } return NoState }, - // S80 + // S81 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 43 - case 65 <= r && r <= 90: // ['A','Z'] return 44 - case r == 95: // ['_','_'] + case 65 <= r && r <= 90: // ['A','Z'] return 45 - case 97 <= r && r <= 113: // ['a','q'] + case r == 95: // ['_','_'] return 46 + case 97 <= r && r <= 113: // ['a','q'] + return 47 case r == 114: // ['r','r'] - return 91 + return 92 case 115 <= r && r <= 122: // ['s','z'] - return 46 + return 47 } return NoState }, - // S81 + // S82 func(r rune) int { switch { case r == 34: // ['"','"'] - return 26 - case r == 92: // ['\','\'] return 27 - default: + case r == 92: // ['\','\'] return 28 + default: + return 29 } }, - // S82 + // S83 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 92 + return 93 case 65 <= r && r <= 70: // ['A','F'] - return 92 + return 93 case 97 <= r && r <= 102: // ['a','f'] - return 92 + return 93 } return NoState }, - // S83 + // S84 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 93 + return 94 case 65 <= r && r <= 70: // ['A','F'] - return 93 + return 94 case 97 <= r && r <= 102: // ['a','f'] - return 93 + return 94 } return NoState }, - // S84 + // S85 func(r rune) int { switch { case r == 34: // ['"','"'] - return 26 - case r == 92: // ['\','\'] return 27 - default: + case r == 92: // ['\','\'] return 28 + default: + return 29 } }, - // S85 - func(r rune) int { - switch { - case r == 39: // [''','''] - return 63 - } - return NoState - }, // S86 func(r rune) int { switch { - case 48 <= r && r <= 57: // ['0','9'] - return 94 - case 65 <= r && r <= 70: // ['A','F'] - return 94 - case 97 <= r && r <= 102: // ['a','f'] - return 94 + case r == 39: // [''','''] + return 64 } return NoState }, @@ -1067,28 +1063,26 @@ var TransTab = TransitionTable{ // S88 func(r rune) int { switch { - case r == 39: // [''','''] - return 63 + case 48 <= r && r <= 57: // ['0','9'] + return 96 + case 65 <= r && r <= 70: // ['A','F'] + return 96 + case 97 <= r && r <= 102: // ['a','f'] + return 96 } return NoState }, // S89 func(r rune) int { switch { + case r == 39: // [''','''] + return 64 } return NoState }, // S90 func(r rune) int { switch { - case 48 <= r && r <= 57: // ['0','9'] - return 43 - case 65 <= r && r <= 90: // ['A','Z'] - return 44 - case r == 95: // ['_','_'] - return 45 - case 97 <= r && r <= 122: // ['a','z'] - return 46 } return NoState }, @@ -1096,13 +1090,13 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 43 - case 65 <= r && r <= 90: // ['A','Z'] return 44 - case r == 95: // ['_','_'] + case 65 <= r && r <= 90: // ['A','Z'] return 45 - case 97 <= r && r <= 122: // ['a','z'] + case r == 95: // ['_','_'] return 46 + case 97 <= r && r <= 122: // ['a','z'] + return 47 } return NoState }, @@ -1110,11 +1104,13 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 96 - case 65 <= r && r <= 70: // ['A','F'] - return 96 - case 97 <= r && r <= 102: // ['a','f'] - return 96 + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 45 + case r == 95: // ['_','_'] + return 46 + case 97 <= r && r <= 122: // ['a','z'] + return 47 } return NoState }, @@ -1167,17 +1163,6 @@ var TransTab = TransitionTable{ return NoState }, // S97 - func(r rune) int { - switch { - case r == 34: // ['"','"'] - return 26 - case r == 92: // ['\','\'] - return 27 - default: - return 28 - } - }, - // S98 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] @@ -1189,15 +1174,18 @@ var TransTab = TransitionTable{ } return NoState }, - // S99 + // S98 func(r rune) int { switch { - case r == 39: // [''','''] - return 63 + case r == 34: // ['"','"'] + return 27 + case r == 92: // ['\','\'] + return 28 + default: + return 29 } - return NoState }, - // S100 + // S99 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] @@ -1209,6 +1197,14 @@ var TransTab = TransitionTable{ } return NoState }, + // S100 + func(r rune) int { + switch { + case r == 39: // [''','''] + return 64 + } + return NoState + }, // S101 func(r rune) int { switch { @@ -1270,21 +1266,33 @@ var TransTab = TransitionTable{ return NoState }, // S106 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 108 + case 65 <= r && r <= 70: // ['A','F'] + return 108 + case 97 <= r && r <= 102: // ['a','f'] + return 108 + } + return NoState + }, + // S107 func(r rune) int { switch { case r == 34: // ['"','"'] - return 26 - case r == 92: // ['\','\'] return 27 - default: + case r == 92: // ['\','\'] return 28 + default: + return 29 } }, - // S107 + // S108 func(r rune) int { switch { case r == 39: // [''','''] - return 63 + return 64 } return NoState }, diff --git a/internal/fe2/internal/parser/action.go b/internal/frontend/reparsed/internal/parser/action.go similarity index 100% rename from internal/fe2/internal/parser/action.go rename to internal/frontend/reparsed/internal/parser/action.go diff --git a/internal/fe2/internal/parser/actiontable.go b/internal/frontend/reparsed/internal/parser/actiontable.go similarity index 95% rename from internal/fe2/internal/parser/actiontable.go rename to internal/frontend/reparsed/internal/parser/actiontable.go index 72c34760..80b7aeb8 100644 --- a/internal/fe2/internal/parser/actiontable.go +++ b/internal/frontend/reparsed/internal/parser/actiontable.go @@ -25,6 +25,7 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -54,6 +55,7 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -83,6 +85,7 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -112,6 +115,7 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -141,6 +145,7 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -170,6 +175,7 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -199,6 +205,7 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -228,6 +235,7 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -257,6 +265,7 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -286,6 +295,7 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -315,6 +325,7 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -344,6 +355,7 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -373,6 +385,7 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -402,6 +415,7 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -431,6 +445,7 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -460,6 +475,7 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -489,6 +505,7 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -518,6 +535,7 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -546,7 +564,8 @@ var actionTab = actionTable{ nil, // | shift(26), // . shift(27), // char_lit - shift(28), // - + nil, // - + shift(28), // ~ shift(29), // ( nil, // ) shift(30), // [ @@ -575,7 +594,8 @@ var actionTab = actionTable{ nil, // | shift(26), // . shift(27), // char_lit - shift(28), // - + nil, // - + shift(28), // ~ shift(29), // ( nil, // ) shift(30), // [ @@ -604,7 +624,8 @@ var actionTab = actionTable{ nil, // | shift(26), // . shift(27), // char_lit - shift(28), // - + nil, // - + shift(28), // ~ shift(29), // ( nil, // ) shift(30), // [ @@ -634,6 +655,7 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -663,6 +685,7 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -691,7 +714,8 @@ var actionTab = actionTable{ reduce(10), // |, reduce: LexPattern shift(26), // . shift(27), // char_lit - shift(28), // - + nil, // - + shift(28), // ~ shift(29), // ( nil, // ) shift(30), // [ @@ -720,7 +744,8 @@ var actionTab = actionTable{ reduce(12), // |, reduce: LexAlt reduce(12), // ., reduce: LexAlt reduce(12), // char_lit, reduce: LexAlt - reduce(12), // -, reduce: LexAlt + nil, // - + reduce(12), // ~, reduce: LexAlt reduce(12), // (, reduce: LexAlt nil, // ) reduce(12), // [, reduce: LexAlt @@ -749,7 +774,8 @@ var actionTab = actionTable{ reduce(19), // |, reduce: LexTerm reduce(19), // ., reduce: LexTerm reduce(19), // char_lit, reduce: LexTerm - reduce(19), // -, reduce: LexTerm + nil, // - + reduce(19), // ~, reduce: LexTerm reduce(19), // (, reduce: LexTerm nil, // ) reduce(19), // [, reduce: LexTerm @@ -778,7 +804,8 @@ var actionTab = actionTable{ reduce(14), // |, reduce: LexTerm reduce(14), // ., reduce: LexTerm reduce(14), // char_lit, reduce: LexTerm - reduce(14), // -, reduce: LexTerm + nil, // - + reduce(14), // ~, reduce: LexTerm reduce(14), // (, reduce: LexTerm nil, // ) reduce(14), // [, reduce: LexTerm @@ -808,6 +835,7 @@ var actionTab = actionTable{ reduce(15), // ., reduce: LexTerm reduce(15), // char_lit, reduce: LexTerm shift(50), // - + reduce(15), // ~, reduce: LexTerm reduce(15), // (, reduce: LexTerm nil, // ) reduce(15), // [, reduce: LexTerm @@ -837,6 +865,7 @@ var actionTab = actionTable{ nil, // . shift(51), // char_lit nil, // - + nil, // ~ shift(52), // ( nil, // ) nil, // [ @@ -865,7 +894,8 @@ var actionTab = actionTable{ nil, // | shift(57), // . shift(58), // char_lit - shift(59), // - + nil, // - + shift(59), // ~ shift(60), // ( nil, // ) shift(61), // [ @@ -894,7 +924,8 @@ var actionTab = actionTable{ nil, // | shift(67), // . shift(68), // char_lit - shift(69), // - + nil, // - + shift(69), // ~ shift(70), // ( nil, // ) shift(71), // [ @@ -923,7 +954,8 @@ var actionTab = actionTable{ nil, // | shift(77), // . shift(78), // char_lit - shift(79), // - + nil, // - + shift(79), // ~ shift(80), // ( nil, // ) shift(81), // [ @@ -953,6 +985,7 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -982,6 +1015,7 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -1011,6 +1045,7 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -1040,6 +1075,7 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -1069,6 +1105,7 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -1098,6 +1135,7 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -1127,6 +1165,7 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -1156,6 +1195,7 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -1185,6 +1225,7 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -1214,6 +1255,7 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -1243,6 +1285,7 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -1272,6 +1315,7 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -1301,6 +1345,7 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -1330,6 +1375,7 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -1359,6 +1405,7 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -1388,6 +1435,7 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -1416,7 +1464,8 @@ var actionTab = actionTable{ nil, // | shift(26), // . shift(27), // char_lit - shift(28), // - + nil, // - + shift(28), // ~ shift(29), // ( nil, // ) shift(30), // [ @@ -1445,7 +1494,8 @@ var actionTab = actionTable{ reduce(13), // |, reduce: LexAlt reduce(13), // ., reduce: LexAlt reduce(13), // char_lit, reduce: LexAlt - reduce(13), // -, reduce: LexAlt + nil, // - + reduce(13), // ~, reduce: LexAlt reduce(13), // (, reduce: LexAlt nil, // ) reduce(13), // [, reduce: LexAlt @@ -1475,6 +1525,7 @@ var actionTab = actionTable{ nil, // . shift(92), // char_lit nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -1503,7 +1554,8 @@ var actionTab = actionTable{ reduce(17), // |, reduce: LexTerm reduce(17), // ., reduce: LexTerm reduce(17), // char_lit, reduce: LexTerm - reduce(17), // -, reduce: LexTerm + nil, // - + reduce(17), // ~, reduce: LexTerm reduce(17), // (, reduce: LexTerm nil, // ) reduce(17), // [, reduce: LexTerm @@ -1533,6 +1585,7 @@ var actionTab = actionTable{ nil, // . shift(93), // char_lit nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -1562,6 +1615,7 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - + nil, // ~ nil, // ( shift(95), // ) nil, // [ @@ -1590,7 +1644,8 @@ var actionTab = actionTable{ reduce(10), // |, reduce: LexPattern shift(57), // . shift(58), // char_lit - shift(59), // - + nil, // - + shift(59), // ~ shift(60), // ( reduce(10), // ), reduce: LexPattern shift(61), // [ @@ -1619,7 +1674,8 @@ var actionTab = actionTable{ reduce(12), // |, reduce: LexAlt reduce(12), // ., reduce: LexAlt reduce(12), // char_lit, reduce: LexAlt - reduce(12), // -, reduce: LexAlt + nil, // - + reduce(12), // ~, reduce: LexAlt reduce(12), // (, reduce: LexAlt reduce(12), // ), reduce: LexAlt reduce(12), // [, reduce: LexAlt @@ -1648,7 +1704,8 @@ var actionTab = actionTable{ reduce(19), // |, reduce: LexTerm reduce(19), // ., reduce: LexTerm reduce(19), // char_lit, reduce: LexTerm - reduce(19), // -, reduce: LexTerm + nil, // - + reduce(19), // ~, reduce: LexTerm reduce(19), // (, reduce: LexTerm reduce(19), // ), reduce: LexTerm reduce(19), // [, reduce: LexTerm @@ -1677,7 +1734,8 @@ var actionTab = actionTable{ reduce(14), // |, reduce: LexTerm reduce(14), // ., reduce: LexTerm reduce(14), // char_lit, reduce: LexTerm - reduce(14), // -, reduce: LexTerm + nil, // - + reduce(14), // ~, reduce: LexTerm reduce(14), // (, reduce: LexTerm reduce(14), // ), reduce: LexTerm reduce(14), // [, reduce: LexTerm @@ -1707,6 +1765,7 @@ var actionTab = actionTable{ reduce(15), // ., reduce: LexTerm reduce(15), // char_lit, reduce: LexTerm shift(97), // - + reduce(15), // ~, reduce: LexTerm reduce(15), // (, reduce: LexTerm reduce(15), // ), reduce: LexTerm reduce(15), // [, reduce: LexTerm @@ -1736,6 +1795,7 @@ var actionTab = actionTable{ nil, // . shift(98), // char_lit nil, // - + nil, // ~ shift(99), // ( nil, // ) nil, // [ @@ -1764,7 +1824,8 @@ var actionTab = actionTable{ nil, // | shift(57), // . shift(58), // char_lit - shift(59), // - + nil, // - + shift(59), // ~ shift(60), // ( nil, // ) shift(61), // [ @@ -1793,7 +1854,8 @@ var actionTab = actionTable{ nil, // | shift(67), // . shift(68), // char_lit - shift(69), // - + nil, // - + shift(69), // ~ shift(70), // ( nil, // ) shift(71), // [ @@ -1822,7 +1884,8 @@ var actionTab = actionTable{ nil, // | shift(77), // . shift(78), // char_lit - shift(79), // - + nil, // - + shift(79), // ~ shift(80), // ( nil, // ) shift(81), // [ @@ -1852,6 +1915,7 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -1880,7 +1944,8 @@ var actionTab = actionTable{ reduce(10), // |, reduce: LexPattern shift(67), // . shift(68), // char_lit - shift(69), // - + nil, // - + shift(69), // ~ shift(70), // ( nil, // ) shift(71), // [ @@ -1909,7 +1974,8 @@ var actionTab = actionTable{ reduce(12), // |, reduce: LexAlt reduce(12), // ., reduce: LexAlt reduce(12), // char_lit, reduce: LexAlt - reduce(12), // -, reduce: LexAlt + nil, // - + reduce(12), // ~, reduce: LexAlt reduce(12), // (, reduce: LexAlt nil, // ) reduce(12), // [, reduce: LexAlt @@ -1938,7 +2004,8 @@ var actionTab = actionTable{ reduce(19), // |, reduce: LexTerm reduce(19), // ., reduce: LexTerm reduce(19), // char_lit, reduce: LexTerm - reduce(19), // -, reduce: LexTerm + nil, // - + reduce(19), // ~, reduce: LexTerm reduce(19), // (, reduce: LexTerm nil, // ) reduce(19), // [, reduce: LexTerm @@ -1967,7 +2034,8 @@ var actionTab = actionTable{ reduce(14), // |, reduce: LexTerm reduce(14), // ., reduce: LexTerm reduce(14), // char_lit, reduce: LexTerm - reduce(14), // -, reduce: LexTerm + nil, // - + reduce(14), // ~, reduce: LexTerm reduce(14), // (, reduce: LexTerm nil, // ) reduce(14), // [, reduce: LexTerm @@ -1997,6 +2065,7 @@ var actionTab = actionTable{ reduce(15), // ., reduce: LexTerm reduce(15), // char_lit, reduce: LexTerm shift(106), // - + reduce(15), // ~, reduce: LexTerm reduce(15), // (, reduce: LexTerm nil, // ) reduce(15), // [, reduce: LexTerm @@ -2026,6 +2095,7 @@ var actionTab = actionTable{ nil, // . shift(107), // char_lit nil, // - + nil, // ~ shift(108), // ( nil, // ) nil, // [ @@ -2054,7 +2124,8 @@ var actionTab = actionTable{ nil, // | shift(57), // . shift(58), // char_lit - shift(59), // - + nil, // - + shift(59), // ~ shift(60), // ( nil, // ) shift(61), // [ @@ -2083,7 +2154,8 @@ var actionTab = actionTable{ nil, // | shift(67), // . shift(68), // char_lit - shift(69), // - + nil, // - + shift(69), // ~ shift(70), // ( nil, // ) shift(71), // [ @@ -2112,7 +2184,8 @@ var actionTab = actionTable{ nil, // | shift(77), // . shift(78), // char_lit - shift(79), // - + nil, // - + shift(79), // ~ shift(80), // ( nil, // ) shift(81), // [ @@ -2142,6 +2215,7 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -2170,7 +2244,8 @@ var actionTab = actionTable{ reduce(10), // |, reduce: LexPattern shift(77), // . shift(78), // char_lit - shift(79), // - + nil, // - + shift(79), // ~ shift(80), // ( nil, // ) shift(81), // [ @@ -2199,7 +2274,8 @@ var actionTab = actionTable{ reduce(12), // |, reduce: LexAlt reduce(12), // ., reduce: LexAlt reduce(12), // char_lit, reduce: LexAlt - reduce(12), // -, reduce: LexAlt + nil, // - + reduce(12), // ~, reduce: LexAlt reduce(12), // (, reduce: LexAlt nil, // ) reduce(12), // [, reduce: LexAlt @@ -2228,7 +2304,8 @@ var actionTab = actionTable{ reduce(19), // |, reduce: LexTerm reduce(19), // ., reduce: LexTerm reduce(19), // char_lit, reduce: LexTerm - reduce(19), // -, reduce: LexTerm + nil, // - + reduce(19), // ~, reduce: LexTerm reduce(19), // (, reduce: LexTerm nil, // ) reduce(19), // [, reduce: LexTerm @@ -2257,7 +2334,8 @@ var actionTab = actionTable{ reduce(14), // |, reduce: LexTerm reduce(14), // ., reduce: LexTerm reduce(14), // char_lit, reduce: LexTerm - reduce(14), // -, reduce: LexTerm + nil, // - + reduce(14), // ~, reduce: LexTerm reduce(14), // (, reduce: LexTerm nil, // ) reduce(14), // [, reduce: LexTerm @@ -2287,6 +2365,7 @@ var actionTab = actionTable{ reduce(15), // ., reduce: LexTerm reduce(15), // char_lit, reduce: LexTerm shift(115), // - + reduce(15), // ~, reduce: LexTerm reduce(15), // (, reduce: LexTerm nil, // ) reduce(15), // [, reduce: LexTerm @@ -2316,6 +2395,7 @@ var actionTab = actionTable{ nil, // . shift(116), // char_lit nil, // - + nil, // ~ shift(117), // ( nil, // ) nil, // [ @@ -2344,7 +2424,8 @@ var actionTab = actionTable{ nil, // | shift(57), // . shift(58), // char_lit - shift(59), // - + nil, // - + shift(59), // ~ shift(60), // ( nil, // ) shift(61), // [ @@ -2373,7 +2454,8 @@ var actionTab = actionTable{ nil, // | shift(67), // . shift(68), // char_lit - shift(69), // - + nil, // - + shift(69), // ~ shift(70), // ( nil, // ) shift(71), // [ @@ -2402,7 +2484,8 @@ var actionTab = actionTable{ nil, // | shift(77), // . shift(78), // char_lit - shift(79), // - + nil, // - + shift(79), // ~ shift(80), // ( nil, // ) shift(81), // [ @@ -2432,6 +2515,7 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -2461,6 +2545,7 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -2490,6 +2575,7 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -2519,6 +2605,7 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -2548,6 +2635,7 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -2577,6 +2665,7 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -2606,6 +2695,7 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -2635,6 +2725,7 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -2663,7 +2754,8 @@ var actionTab = actionTable{ reduce(11), // |, reduce: LexPattern shift(26), // . shift(27), // char_lit - shift(28), // - + nil, // - + shift(28), // ~ shift(29), // ( nil, // ) shift(30), // [ @@ -2692,7 +2784,8 @@ var actionTab = actionTable{ reduce(16), // |, reduce: LexTerm reduce(16), // ., reduce: LexTerm reduce(16), // char_lit, reduce: LexTerm - reduce(16), // -, reduce: LexTerm + nil, // - + reduce(16), // ~, reduce: LexTerm reduce(16), // (, reduce: LexTerm nil, // ) reduce(16), // [, reduce: LexTerm @@ -2722,6 +2815,7 @@ var actionTab = actionTable{ nil, // . nil, // char_lit shift(123), // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -2750,7 +2844,8 @@ var actionTab = actionTable{ nil, // | shift(57), // . shift(58), // char_lit - shift(59), // - + nil, // - + shift(59), // ~ shift(60), // ( nil, // ) shift(61), // [ @@ -2779,7 +2874,8 @@ var actionTab = actionTable{ reduce(22), // |, reduce: LexTerm reduce(22), // ., reduce: LexTerm reduce(22), // char_lit, reduce: LexTerm - reduce(22), // -, reduce: LexTerm + nil, // - + reduce(22), // ~, reduce: LexTerm reduce(22), // (, reduce: LexTerm nil, // ) reduce(22), // [, reduce: LexTerm @@ -2808,7 +2904,8 @@ var actionTab = actionTable{ reduce(13), // |, reduce: LexAlt reduce(13), // ., reduce: LexAlt reduce(13), // char_lit, reduce: LexAlt - reduce(13), // -, reduce: LexAlt + nil, // - + reduce(13), // ~, reduce: LexAlt reduce(13), // (, reduce: LexAlt reduce(13), // ), reduce: LexAlt reduce(13), // [, reduce: LexAlt @@ -2838,6 +2935,7 @@ var actionTab = actionTable{ nil, // . shift(125), // char_lit nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -2866,7 +2964,8 @@ var actionTab = actionTable{ reduce(17), // |, reduce: LexTerm reduce(17), // ., reduce: LexTerm reduce(17), // char_lit, reduce: LexTerm - reduce(17), // -, reduce: LexTerm + nil, // - + reduce(17), // ~, reduce: LexTerm reduce(17), // (, reduce: LexTerm reduce(17), // ), reduce: LexTerm reduce(17), // [, reduce: LexTerm @@ -2896,6 +2995,7 @@ var actionTab = actionTable{ nil, // . shift(126), // char_lit nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -2925,6 +3025,7 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - + nil, // ~ nil, // ( shift(127), // ) nil, // [ @@ -2954,6 +3055,7 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -2983,6 +3085,7 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -3011,7 +3114,8 @@ var actionTab = actionTable{ nil, // | shift(67), // . shift(68), // char_lit - shift(69), // - + nil, // - + shift(69), // ~ shift(70), // ( nil, // ) shift(71), // [ @@ -3040,7 +3144,8 @@ var actionTab = actionTable{ reduce(20), // |, reduce: LexTerm reduce(20), // ., reduce: LexTerm reduce(20), // char_lit, reduce: LexTerm - reduce(20), // -, reduce: LexTerm + nil, // - + reduce(20), // ~, reduce: LexTerm reduce(20), // (, reduce: LexTerm nil, // ) reduce(20), // [, reduce: LexTerm @@ -3069,7 +3174,8 @@ var actionTab = actionTable{ reduce(13), // |, reduce: LexAlt reduce(13), // ., reduce: LexAlt reduce(13), // char_lit, reduce: LexAlt - reduce(13), // -, reduce: LexAlt + nil, // - + reduce(13), // ~, reduce: LexAlt reduce(13), // (, reduce: LexAlt nil, // ) reduce(13), // [, reduce: LexAlt @@ -3099,6 +3205,7 @@ var actionTab = actionTable{ nil, // . shift(131), // char_lit nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -3127,7 +3234,8 @@ var actionTab = actionTable{ reduce(17), // |, reduce: LexTerm reduce(17), // ., reduce: LexTerm reduce(17), // char_lit, reduce: LexTerm - reduce(17), // -, reduce: LexTerm + nil, // - + reduce(17), // ~, reduce: LexTerm reduce(17), // (, reduce: LexTerm nil, // ) reduce(17), // [, reduce: LexTerm @@ -3157,6 +3265,7 @@ var actionTab = actionTable{ nil, // . shift(132), // char_lit nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -3186,6 +3295,7 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - + nil, // ~ nil, // ( shift(133), // ) nil, // [ @@ -3215,6 +3325,7 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -3244,6 +3355,7 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -3272,7 +3384,8 @@ var actionTab = actionTable{ nil, // | shift(77), // . shift(78), // char_lit - shift(79), // - + nil, // - + shift(79), // ~ shift(80), // ( nil, // ) shift(81), // [ @@ -3301,7 +3414,8 @@ var actionTab = actionTable{ reduce(21), // |, reduce: LexTerm reduce(21), // ., reduce: LexTerm reduce(21), // char_lit, reduce: LexTerm - reduce(21), // -, reduce: LexTerm + nil, // - + reduce(21), // ~, reduce: LexTerm reduce(21), // (, reduce: LexTerm nil, // ) reduce(21), // [, reduce: LexTerm @@ -3330,7 +3444,8 @@ var actionTab = actionTable{ reduce(13), // |, reduce: LexAlt reduce(13), // ., reduce: LexAlt reduce(13), // char_lit, reduce: LexAlt - reduce(13), // -, reduce: LexAlt + nil, // - + reduce(13), // ~, reduce: LexAlt reduce(13), // (, reduce: LexAlt nil, // ) reduce(13), // [, reduce: LexAlt @@ -3360,6 +3475,7 @@ var actionTab = actionTable{ nil, // . shift(137), // char_lit nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -3388,7 +3504,8 @@ var actionTab = actionTable{ reduce(17), // |, reduce: LexTerm reduce(17), // ., reduce: LexTerm reduce(17), // char_lit, reduce: LexTerm - reduce(17), // -, reduce: LexTerm + nil, // - + reduce(17), // ~, reduce: LexTerm reduce(17), // (, reduce: LexTerm nil, // ) reduce(17), // [, reduce: LexTerm @@ -3418,6 +3535,7 @@ var actionTab = actionTable{ nil, // . shift(138), // char_lit nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -3447,6 +3565,7 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - + nil, // ~ nil, // ( shift(139), // ) nil, // [ @@ -3476,6 +3595,7 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -3505,6 +3625,7 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -3534,6 +3655,7 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -3563,6 +3685,7 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -3592,6 +3715,7 @@ var actionTab = actionTable{ nil, // . shift(142), // char_lit nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -3620,7 +3744,8 @@ var actionTab = actionTable{ reduce(11), // |, reduce: LexPattern shift(57), // . shift(58), // char_lit - shift(59), // - + nil, // - + shift(59), // ~ shift(60), // ( reduce(11), // ), reduce: LexPattern shift(61), // [ @@ -3649,7 +3774,8 @@ var actionTab = actionTable{ reduce(16), // |, reduce: LexTerm reduce(16), // ., reduce: LexTerm reduce(16), // char_lit, reduce: LexTerm - reduce(16), // -, reduce: LexTerm + nil, // - + reduce(16), // ~, reduce: LexTerm reduce(16), // (, reduce: LexTerm reduce(16), // ), reduce: LexTerm reduce(16), // [, reduce: LexTerm @@ -3679,6 +3805,7 @@ var actionTab = actionTable{ nil, // . nil, // char_lit shift(143), // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -3707,7 +3834,8 @@ var actionTab = actionTable{ reduce(22), // |, reduce: LexTerm reduce(22), // ., reduce: LexTerm reduce(22), // char_lit, reduce: LexTerm - reduce(22), // -, reduce: LexTerm + nil, // - + reduce(22), // ~, reduce: LexTerm reduce(22), // (, reduce: LexTerm reduce(22), // ), reduce: LexTerm reduce(22), // [, reduce: LexTerm @@ -3736,7 +3864,8 @@ var actionTab = actionTable{ reduce(20), // |, reduce: LexTerm reduce(20), // ., reduce: LexTerm reduce(20), // char_lit, reduce: LexTerm - reduce(20), // -, reduce: LexTerm + nil, // - + reduce(20), // ~, reduce: LexTerm reduce(20), // (, reduce: LexTerm reduce(20), // ), reduce: LexTerm reduce(20), // [, reduce: LexTerm @@ -3765,7 +3894,8 @@ var actionTab = actionTable{ reduce(21), // |, reduce: LexTerm reduce(21), // ., reduce: LexTerm reduce(21), // char_lit, reduce: LexTerm - reduce(21), // -, reduce: LexTerm + nil, // - + reduce(21), // ~, reduce: LexTerm reduce(21), // (, reduce: LexTerm reduce(21), // ), reduce: LexTerm reduce(21), // [, reduce: LexTerm @@ -3794,7 +3924,8 @@ var actionTab = actionTable{ reduce(11), // |, reduce: LexPattern shift(67), // . shift(68), // char_lit - shift(69), // - + nil, // - + shift(69), // ~ shift(70), // ( nil, // ) shift(71), // [ @@ -3823,7 +3954,8 @@ var actionTab = actionTable{ reduce(16), // |, reduce: LexTerm reduce(16), // ., reduce: LexTerm reduce(16), // char_lit, reduce: LexTerm - reduce(16), // -, reduce: LexTerm + nil, // - + reduce(16), // ~, reduce: LexTerm reduce(16), // (, reduce: LexTerm nil, // ) reduce(16), // [, reduce: LexTerm @@ -3853,6 +3985,7 @@ var actionTab = actionTable{ nil, // . nil, // char_lit shift(144), // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -3881,7 +4014,8 @@ var actionTab = actionTable{ reduce(22), // |, reduce: LexTerm reduce(22), // ., reduce: LexTerm reduce(22), // char_lit, reduce: LexTerm - reduce(22), // -, reduce: LexTerm + nil, // - + reduce(22), // ~, reduce: LexTerm reduce(22), // (, reduce: LexTerm nil, // ) reduce(22), // [, reduce: LexTerm @@ -3910,7 +4044,8 @@ var actionTab = actionTable{ reduce(20), // |, reduce: LexTerm reduce(20), // ., reduce: LexTerm reduce(20), // char_lit, reduce: LexTerm - reduce(20), // -, reduce: LexTerm + nil, // - + reduce(20), // ~, reduce: LexTerm reduce(20), // (, reduce: LexTerm nil, // ) reduce(20), // [, reduce: LexTerm @@ -3939,7 +4074,8 @@ var actionTab = actionTable{ reduce(21), // |, reduce: LexTerm reduce(21), // ., reduce: LexTerm reduce(21), // char_lit, reduce: LexTerm - reduce(21), // -, reduce: LexTerm + nil, // - + reduce(21), // ~, reduce: LexTerm reduce(21), // (, reduce: LexTerm nil, // ) reduce(21), // [, reduce: LexTerm @@ -3968,7 +4104,8 @@ var actionTab = actionTable{ reduce(11), // |, reduce: LexPattern shift(77), // . shift(78), // char_lit - shift(79), // - + nil, // - + shift(79), // ~ shift(80), // ( nil, // ) shift(81), // [ @@ -3997,7 +4134,8 @@ var actionTab = actionTable{ reduce(16), // |, reduce: LexTerm reduce(16), // ., reduce: LexTerm reduce(16), // char_lit, reduce: LexTerm - reduce(16), // -, reduce: LexTerm + nil, // - + reduce(16), // ~, reduce: LexTerm reduce(16), // (, reduce: LexTerm nil, // ) reduce(16), // [, reduce: LexTerm @@ -4027,6 +4165,7 @@ var actionTab = actionTable{ nil, // . nil, // char_lit shift(145), // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -4055,7 +4194,8 @@ var actionTab = actionTable{ reduce(22), // |, reduce: LexTerm reduce(22), // ., reduce: LexTerm reduce(22), // char_lit, reduce: LexTerm - reduce(22), // -, reduce: LexTerm + nil, // - + reduce(22), // ~, reduce: LexTerm reduce(22), // (, reduce: LexTerm nil, // ) reduce(22), // [, reduce: LexTerm @@ -4084,7 +4224,8 @@ var actionTab = actionTable{ reduce(20), // |, reduce: LexTerm reduce(20), // ., reduce: LexTerm reduce(20), // char_lit, reduce: LexTerm - reduce(20), // -, reduce: LexTerm + nil, // - + reduce(20), // ~, reduce: LexTerm reduce(20), // (, reduce: LexTerm nil, // ) reduce(20), // [, reduce: LexTerm @@ -4113,7 +4254,8 @@ var actionTab = actionTable{ reduce(21), // |, reduce: LexTerm reduce(21), // ., reduce: LexTerm reduce(21), // char_lit, reduce: LexTerm - reduce(21), // -, reduce: LexTerm + nil, // - + reduce(21), // ~, reduce: LexTerm reduce(21), // (, reduce: LexTerm nil, // ) reduce(21), // [, reduce: LexTerm @@ -4143,6 +4285,7 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - + nil, // ~ nil, // ( shift(146), // ) nil, // [ @@ -4172,6 +4315,7 @@ var actionTab = actionTable{ nil, // . shift(147), // char_lit nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -4201,6 +4345,7 @@ var actionTab = actionTable{ nil, // . shift(148), // char_lit nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -4230,6 +4375,7 @@ var actionTab = actionTable{ nil, // . shift(149), // char_lit nil, // - + nil, // ~ nil, // ( nil, // ) nil, // [ @@ -4258,7 +4404,8 @@ var actionTab = actionTable{ reduce(18), // |, reduce: LexTerm reduce(18), // ., reduce: LexTerm reduce(18), // char_lit, reduce: LexTerm - reduce(18), // -, reduce: LexTerm + nil, // - + reduce(18), // ~, reduce: LexTerm reduce(18), // (, reduce: LexTerm nil, // ) reduce(18), // [, reduce: LexTerm @@ -4288,6 +4435,7 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - + nil, // ~ nil, // ( shift(150), // ) nil, // [ @@ -4317,6 +4465,7 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - + nil, // ~ nil, // ( shift(151), // ) nil, // [ @@ -4346,6 +4495,7 @@ var actionTab = actionTable{ nil, // . nil, // char_lit nil, // - + nil, // ~ nil, // ( shift(152), // ) nil, // [ @@ -4374,7 +4524,8 @@ var actionTab = actionTable{ reduce(18), // |, reduce: LexTerm reduce(18), // ., reduce: LexTerm reduce(18), // char_lit, reduce: LexTerm - reduce(18), // -, reduce: LexTerm + nil, // - + reduce(18), // ~, reduce: LexTerm reduce(18), // (, reduce: LexTerm reduce(18), // ), reduce: LexTerm reduce(18), // [, reduce: LexTerm @@ -4403,7 +4554,8 @@ var actionTab = actionTable{ reduce(18), // |, reduce: LexTerm reduce(18), // ., reduce: LexTerm reduce(18), // char_lit, reduce: LexTerm - reduce(18), // -, reduce: LexTerm + nil, // - + reduce(18), // ~, reduce: LexTerm reduce(18), // (, reduce: LexTerm nil, // ) reduce(18), // [, reduce: LexTerm @@ -4432,7 +4584,8 @@ var actionTab = actionTable{ reduce(18), // |, reduce: LexTerm reduce(18), // ., reduce: LexTerm reduce(18), // char_lit, reduce: LexTerm - reduce(18), // -, reduce: LexTerm + nil, // - + reduce(18), // ~, reduce: LexTerm reduce(18), // (, reduce: LexTerm nil, // ) reduce(18), // [, reduce: LexTerm diff --git a/internal/fe2/internal/parser/gototable.go b/internal/frontend/reparsed/internal/parser/gototable.go similarity index 100% rename from internal/fe2/internal/parser/gototable.go rename to internal/frontend/reparsed/internal/parser/gototable.go diff --git a/internal/fe2/internal/parser/parser.go b/internal/frontend/reparsed/internal/parser/parser.go similarity index 96% rename from internal/fe2/internal/parser/parser.go rename to internal/frontend/reparsed/internal/parser/parser.go index f6410a04..70b713c3 100644 --- a/internal/fe2/internal/parser/parser.go +++ b/internal/frontend/reparsed/internal/parser/parser.go @@ -6,14 +6,14 @@ import ( "fmt" "strings" - parseError "github.com/maxcalandrelli/gocc/internal/fe2/internal/errors" - "github.com/maxcalandrelli/gocc/internal/fe2/internal/token" + parseError "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/internal/errors" + "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/internal/token" ) const ( numProductions = 47 numStates = 153 - numSymbols = 42 + numSymbols = 43 ) // Stack diff --git a/internal/fe2/internal/parser/productionstable.go b/internal/frontend/reparsed/internal/parser/productionstable.go similarity index 99% rename from internal/fe2/internal/parser/productionstable.go rename to internal/frontend/reparsed/internal/parser/productionstable.go index 3cfaaf3a..35f3e548 100644 --- a/internal/fe2/internal/parser/productionstable.go +++ b/internal/frontend/reparsed/internal/parser/productionstable.go @@ -193,7 +193,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `LexTerm : "-" char_lit << ast.NewLexCharLitExt(X[0], true) >>`, + String: `LexTerm : "~" char_lit << ast.NewLexCharLitExt(X[0], true) >>`, Id: "LexTerm", NTType: 7, Index: 17, @@ -203,7 +203,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `LexTerm : "-" "(" char_lit "-" char_lit ")" << ast.NewLexCharRangeExt(X[2], X[4], true) >>`, + String: `LexTerm : "~" "(" char_lit "-" char_lit ")" << ast.NewLexCharRangeExt(X[2], X[4], true) >>`, Id: "LexTerm", NTType: 7, Index: 18, diff --git a/internal/fe2/internal/token/token.go b/internal/frontend/reparsed/internal/token/token.go similarity index 83% rename from internal/fe2/internal/token/token.go rename to internal/frontend/reparsed/internal/token/token.go index 5b72164b..5b588afd 100644 --- a/internal/fe2/internal/token/token.go +++ b/internal/frontend/reparsed/internal/token/token.go @@ -78,6 +78,7 @@ var TokMap = TokenMap{ ".", "char_lit", "-", + "~", "(", ")", "[", @@ -105,18 +106,19 @@ var TokMap = TokenMap{ ".": 8, "char_lit": 9, "-": 10, - "(": 11, - ")": 12, - "[": 13, - "]": 14, - "{": 15, - "}": 16, - "g_sdt_lit": 17, - "prodId": 18, - "string_lit": 19, - "error": 20, - "λ": 21, - "empty": 22, - "ε": 23, + "~": 11, + "(": 12, + ")": 13, + "[": 14, + "]": 15, + "{": 16, + "}": 17, + "g_sdt_lit": 18, + "prodId": 19, + "string_lit": 20, + "error": 21, + "λ": 22, + "empty": 23, + "ε": 24, }, } diff --git a/internal/fe2/internal/util/litconv.go b/internal/frontend/reparsed/internal/util/litconv.go similarity index 100% rename from internal/fe2/internal/util/litconv.go rename to internal/frontend/reparsed/internal/util/litconv.go diff --git a/internal/fe2/internal/util/rune.go b/internal/frontend/reparsed/internal/util/rune.go similarity index 100% rename from internal/fe2/internal/util/rune.go rename to internal/frontend/reparsed/internal/util/rune.go diff --git a/internal/fe2/log/LR1_conflicts.txt b/internal/frontend/reparsed/log/LR1_conflicts.txt similarity index 100% rename from internal/fe2/log/LR1_conflicts.txt rename to internal/frontend/reparsed/log/LR1_conflicts.txt index ed2fa3ed..243241f3 100644 --- a/internal/fe2/log/LR1_conflicts.txt +++ b/internal/frontend/reparsed/log/LR1_conflicts.txt @@ -5,12 +5,12 @@ Reduce(15:LexTerm : char_lit << ast.NewLexCharLitExt(X[0],false) >>) S58 symbol: - - Shift(97) Reduce(15:LexTerm : char_lit << ast.NewLexCharLitExt(X[0],false) >>) + Shift(97) S68 symbol: - - Reduce(15:LexTerm : char_lit << ast.NewLexCharLitExt(X[0],false) >>) Shift(106) + Reduce(15:LexTerm : char_lit << ast.NewLexCharLitExt(X[0],false) >>) S78 symbol: - Reduce(15:LexTerm : char_lit << ast.NewLexCharLitExt(X[0],false) >>) diff --git a/internal/fe2/log/LR1_sets.txt b/internal/frontend/reparsed/log/LR1_sets.txt similarity index 73% rename from internal/fe2/log/LR1_sets.txt rename to internal/frontend/reparsed/log/LR1_sets.txt index e5085957..f7ed442b 100644 --- a/internal/fe2/log/LR1_sets.txt +++ b/internal/frontend/reparsed/log/LR1_sets.txt @@ -279,51 +279,42 @@ S18{ LexTerm : •. «;» LexTerm : •char_lit «;» LexTerm : •char_lit - char_lit «;» - LexTerm : •- char_lit «;» - LexTerm : •- ( char_lit - char_lit ) «;» + LexTerm : •~ char_lit «;» + LexTerm : •~ ( char_lit - char_lit ) «;» LexTerm : •regDefId «;» LexTerm : •[ LexPattern ] «;» LexTerm : •{ LexPattern } «;» LexTerm : •( LexPattern ) «;» LexAlt : •LexTerm «(» - LexAlt : •LexTerm «-» LexAlt : •LexTerm «.» LexAlt : •LexTerm «[» LexAlt : •LexTerm «char_lit» LexAlt : •LexTerm «regDefId» LexAlt : •LexTerm «{» + LexAlt : •LexTerm «~» LexAlt : •LexAlt LexTerm «(» - LexAlt : •LexAlt LexTerm «-» LexAlt : •LexAlt LexTerm «.» LexAlt : •LexAlt LexTerm «[» LexAlt : •LexAlt LexTerm «char_lit» LexAlt : •LexAlt LexTerm «regDefId» LexAlt : •LexAlt LexTerm «{» + LexAlt : •LexAlt LexTerm «~» LexAlt : •LexTerm «|» LexAlt : •LexAlt LexTerm «|» LexTerm : •. «(» LexTerm : •char_lit «(» LexTerm : •char_lit - char_lit «(» - LexTerm : •- char_lit «(» - LexTerm : •- ( char_lit - char_lit ) «(» + LexTerm : •~ char_lit «(» + LexTerm : •~ ( char_lit - char_lit ) «(» LexTerm : •regDefId «(» LexTerm : •[ LexPattern ] «(» LexTerm : •{ LexPattern } «(» LexTerm : •( LexPattern ) «(» - LexTerm : •. «-» - LexTerm : •char_lit «-» - LexTerm : •char_lit - char_lit «-» - LexTerm : •- char_lit «-» - LexTerm : •- ( char_lit - char_lit ) «-» - LexTerm : •regDefId «-» - LexTerm : •[ LexPattern ] «-» - LexTerm : •{ LexPattern } «-» - LexTerm : •( LexPattern ) «-» LexTerm : •. «.» LexTerm : •char_lit «.» LexTerm : •char_lit - char_lit «.» - LexTerm : •- char_lit «.» - LexTerm : •- ( char_lit - char_lit ) «.» + LexTerm : •~ char_lit «.» + LexTerm : •~ ( char_lit - char_lit ) «.» LexTerm : •regDefId «.» LexTerm : •[ LexPattern ] «.» LexTerm : •{ LexPattern } «.» @@ -331,8 +322,8 @@ S18{ LexTerm : •. «[» LexTerm : •char_lit «[» LexTerm : •char_lit - char_lit «[» - LexTerm : •- char_lit «[» - LexTerm : •- ( char_lit - char_lit ) «[» + LexTerm : •~ char_lit «[» + LexTerm : •~ ( char_lit - char_lit ) «[» LexTerm : •regDefId «[» LexTerm : •[ LexPattern ] «[» LexTerm : •{ LexPattern } «[» @@ -340,8 +331,8 @@ S18{ LexTerm : •. «char_lit» LexTerm : •char_lit «char_lit» LexTerm : •char_lit - char_lit «char_lit» - LexTerm : •- char_lit «char_lit» - LexTerm : •- ( char_lit - char_lit ) «char_lit» + LexTerm : •~ char_lit «char_lit» + LexTerm : •~ ( char_lit - char_lit ) «char_lit» LexTerm : •regDefId «char_lit» LexTerm : •[ LexPattern ] «char_lit» LexTerm : •{ LexPattern } «char_lit» @@ -349,8 +340,8 @@ S18{ LexTerm : •. «regDefId» LexTerm : •char_lit «regDefId» LexTerm : •char_lit - char_lit «regDefId» - LexTerm : •- char_lit «regDefId» - LexTerm : •- ( char_lit - char_lit ) «regDefId» + LexTerm : •~ char_lit «regDefId» + LexTerm : •~ ( char_lit - char_lit ) «regDefId» LexTerm : •regDefId «regDefId» LexTerm : •[ LexPattern ] «regDefId» LexTerm : •{ LexPattern } «regDefId» @@ -358,17 +349,26 @@ S18{ LexTerm : •. «{» LexTerm : •char_lit «{» LexTerm : •char_lit - char_lit «{» - LexTerm : •- char_lit «{» - LexTerm : •- ( char_lit - char_lit ) «{» + LexTerm : •~ char_lit «{» + LexTerm : •~ ( char_lit - char_lit ) «{» LexTerm : •regDefId «{» LexTerm : •[ LexPattern ] «{» LexTerm : •{ LexPattern } «{» LexTerm : •( LexPattern ) «{» + LexTerm : •. «~» + LexTerm : •char_lit «~» + LexTerm : •char_lit - char_lit «~» + LexTerm : •~ char_lit «~» + LexTerm : •~ ( char_lit - char_lit ) «~» + LexTerm : •regDefId «~» + LexTerm : •[ LexPattern ] «~» + LexTerm : •{ LexPattern } «~» + LexTerm : •( LexPattern ) «~» LexTerm : •. «|» LexTerm : •char_lit «|» LexTerm : •char_lit - char_lit «|» - LexTerm : •- char_lit «|» - LexTerm : •- ( char_lit - char_lit ) «|» + LexTerm : •~ char_lit «|» + LexTerm : •~ ( char_lit - char_lit ) «|» LexTerm : •regDefId «|» LexTerm : •[ LexPattern ] «|» LexTerm : •{ LexPattern } «|» @@ -381,7 +381,7 @@ Transitions: regDefId -> 25 . -> 26 char_lit -> 27 - - -> 28 + ~ -> 28 ( -> 29 [ -> 30 { -> 31 @@ -403,51 +403,42 @@ S19{ LexTerm : •. «;» LexTerm : •char_lit «;» LexTerm : •char_lit - char_lit «;» - LexTerm : •- char_lit «;» - LexTerm : •- ( char_lit - char_lit ) «;» + LexTerm : •~ char_lit «;» + LexTerm : •~ ( char_lit - char_lit ) «;» LexTerm : •regDefId «;» LexTerm : •[ LexPattern ] «;» LexTerm : •{ LexPattern } «;» LexTerm : •( LexPattern ) «;» LexAlt : •LexTerm «(» - LexAlt : •LexTerm «-» LexAlt : •LexTerm «.» LexAlt : •LexTerm «[» LexAlt : •LexTerm «char_lit» LexAlt : •LexTerm «regDefId» LexAlt : •LexTerm «{» + LexAlt : •LexTerm «~» LexAlt : •LexAlt LexTerm «(» - LexAlt : •LexAlt LexTerm «-» LexAlt : •LexAlt LexTerm «.» LexAlt : •LexAlt LexTerm «[» LexAlt : •LexAlt LexTerm «char_lit» LexAlt : •LexAlt LexTerm «regDefId» LexAlt : •LexAlt LexTerm «{» + LexAlt : •LexAlt LexTerm «~» LexAlt : •LexTerm «|» LexAlt : •LexAlt LexTerm «|» LexTerm : •. «(» LexTerm : •char_lit «(» LexTerm : •char_lit - char_lit «(» - LexTerm : •- char_lit «(» - LexTerm : •- ( char_lit - char_lit ) «(» + LexTerm : •~ char_lit «(» + LexTerm : •~ ( char_lit - char_lit ) «(» LexTerm : •regDefId «(» LexTerm : •[ LexPattern ] «(» LexTerm : •{ LexPattern } «(» LexTerm : •( LexPattern ) «(» - LexTerm : •. «-» - LexTerm : •char_lit «-» - LexTerm : •char_lit - char_lit «-» - LexTerm : •- char_lit «-» - LexTerm : •- ( char_lit - char_lit ) «-» - LexTerm : •regDefId «-» - LexTerm : •[ LexPattern ] «-» - LexTerm : •{ LexPattern } «-» - LexTerm : •( LexPattern ) «-» LexTerm : •. «.» LexTerm : •char_lit «.» LexTerm : •char_lit - char_lit «.» - LexTerm : •- char_lit «.» - LexTerm : •- ( char_lit - char_lit ) «.» + LexTerm : •~ char_lit «.» + LexTerm : •~ ( char_lit - char_lit ) «.» LexTerm : •regDefId «.» LexTerm : •[ LexPattern ] «.» LexTerm : •{ LexPattern } «.» @@ -455,8 +446,8 @@ S19{ LexTerm : •. «[» LexTerm : •char_lit «[» LexTerm : •char_lit - char_lit «[» - LexTerm : •- char_lit «[» - LexTerm : •- ( char_lit - char_lit ) «[» + LexTerm : •~ char_lit «[» + LexTerm : •~ ( char_lit - char_lit ) «[» LexTerm : •regDefId «[» LexTerm : •[ LexPattern ] «[» LexTerm : •{ LexPattern } «[» @@ -464,8 +455,8 @@ S19{ LexTerm : •. «char_lit» LexTerm : •char_lit «char_lit» LexTerm : •char_lit - char_lit «char_lit» - LexTerm : •- char_lit «char_lit» - LexTerm : •- ( char_lit - char_lit ) «char_lit» + LexTerm : •~ char_lit «char_lit» + LexTerm : •~ ( char_lit - char_lit ) «char_lit» LexTerm : •regDefId «char_lit» LexTerm : •[ LexPattern ] «char_lit» LexTerm : •{ LexPattern } «char_lit» @@ -473,8 +464,8 @@ S19{ LexTerm : •. «regDefId» LexTerm : •char_lit «regDefId» LexTerm : •char_lit - char_lit «regDefId» - LexTerm : •- char_lit «regDefId» - LexTerm : •- ( char_lit - char_lit ) «regDefId» + LexTerm : •~ char_lit «regDefId» + LexTerm : •~ ( char_lit - char_lit ) «regDefId» LexTerm : •regDefId «regDefId» LexTerm : •[ LexPattern ] «regDefId» LexTerm : •{ LexPattern } «regDefId» @@ -482,17 +473,26 @@ S19{ LexTerm : •. «{» LexTerm : •char_lit «{» LexTerm : •char_lit - char_lit «{» - LexTerm : •- char_lit «{» - LexTerm : •- ( char_lit - char_lit ) «{» + LexTerm : •~ char_lit «{» + LexTerm : •~ ( char_lit - char_lit ) «{» LexTerm : •regDefId «{» LexTerm : •[ LexPattern ] «{» LexTerm : •{ LexPattern } «{» LexTerm : •( LexPattern ) «{» + LexTerm : •. «~» + LexTerm : •char_lit «~» + LexTerm : •char_lit - char_lit «~» + LexTerm : •~ char_lit «~» + LexTerm : •~ ( char_lit - char_lit ) «~» + LexTerm : •regDefId «~» + LexTerm : •[ LexPattern ] «~» + LexTerm : •{ LexPattern } «~» + LexTerm : •( LexPattern ) «~» LexTerm : •. «|» LexTerm : •char_lit «|» LexTerm : •char_lit - char_lit «|» - LexTerm : •- char_lit «|» - LexTerm : •- ( char_lit - char_lit ) «|» + LexTerm : •~ char_lit «|» + LexTerm : •~ ( char_lit - char_lit ) «|» LexTerm : •regDefId «|» LexTerm : •[ LexPattern ] «|» LexTerm : •{ LexPattern } «|» @@ -504,7 +504,7 @@ Transitions: regDefId -> 25 . -> 26 char_lit -> 27 - - -> 28 + ~ -> 28 ( -> 29 [ -> 30 { -> 31 @@ -527,51 +527,42 @@ S20{ LexTerm : •. «;» LexTerm : •char_lit «;» LexTerm : •char_lit - char_lit «;» - LexTerm : •- char_lit «;» - LexTerm : •- ( char_lit - char_lit ) «;» + LexTerm : •~ char_lit «;» + LexTerm : •~ ( char_lit - char_lit ) «;» LexTerm : •regDefId «;» LexTerm : •[ LexPattern ] «;» LexTerm : •{ LexPattern } «;» LexTerm : •( LexPattern ) «;» LexAlt : •LexTerm «(» - LexAlt : •LexTerm «-» LexAlt : •LexTerm «.» LexAlt : •LexTerm «[» LexAlt : •LexTerm «char_lit» LexAlt : •LexTerm «regDefId» LexAlt : •LexTerm «{» + LexAlt : •LexTerm «~» LexAlt : •LexAlt LexTerm «(» - LexAlt : •LexAlt LexTerm «-» LexAlt : •LexAlt LexTerm «.» LexAlt : •LexAlt LexTerm «[» LexAlt : •LexAlt LexTerm «char_lit» LexAlt : •LexAlt LexTerm «regDefId» LexAlt : •LexAlt LexTerm «{» + LexAlt : •LexAlt LexTerm «~» LexAlt : •LexTerm «|» LexAlt : •LexAlt LexTerm «|» LexTerm : •. «(» LexTerm : •char_lit «(» LexTerm : •char_lit - char_lit «(» - LexTerm : •- char_lit «(» - LexTerm : •- ( char_lit - char_lit ) «(» + LexTerm : •~ char_lit «(» + LexTerm : •~ ( char_lit - char_lit ) «(» LexTerm : •regDefId «(» LexTerm : •[ LexPattern ] «(» LexTerm : •{ LexPattern } «(» LexTerm : •( LexPattern ) «(» - LexTerm : •. «-» - LexTerm : •char_lit «-» - LexTerm : •char_lit - char_lit «-» - LexTerm : •- char_lit «-» - LexTerm : •- ( char_lit - char_lit ) «-» - LexTerm : •regDefId «-» - LexTerm : •[ LexPattern ] «-» - LexTerm : •{ LexPattern } «-» - LexTerm : •( LexPattern ) «-» LexTerm : •. «.» LexTerm : •char_lit «.» LexTerm : •char_lit - char_lit «.» - LexTerm : •- char_lit «.» - LexTerm : •- ( char_lit - char_lit ) «.» + LexTerm : •~ char_lit «.» + LexTerm : •~ ( char_lit - char_lit ) «.» LexTerm : •regDefId «.» LexTerm : •[ LexPattern ] «.» LexTerm : •{ LexPattern } «.» @@ -579,8 +570,8 @@ S20{ LexTerm : •. «[» LexTerm : •char_lit «[» LexTerm : •char_lit - char_lit «[» - LexTerm : •- char_lit «[» - LexTerm : •- ( char_lit - char_lit ) «[» + LexTerm : •~ char_lit «[» + LexTerm : •~ ( char_lit - char_lit ) «[» LexTerm : •regDefId «[» LexTerm : •[ LexPattern ] «[» LexTerm : •{ LexPattern } «[» @@ -588,8 +579,8 @@ S20{ LexTerm : •. «char_lit» LexTerm : •char_lit «char_lit» LexTerm : •char_lit - char_lit «char_lit» - LexTerm : •- char_lit «char_lit» - LexTerm : •- ( char_lit - char_lit ) «char_lit» + LexTerm : •~ char_lit «char_lit» + LexTerm : •~ ( char_lit - char_lit ) «char_lit» LexTerm : •regDefId «char_lit» LexTerm : •[ LexPattern ] «char_lit» LexTerm : •{ LexPattern } «char_lit» @@ -597,8 +588,8 @@ S20{ LexTerm : •. «regDefId» LexTerm : •char_lit «regDefId» LexTerm : •char_lit - char_lit «regDefId» - LexTerm : •- char_lit «regDefId» - LexTerm : •- ( char_lit - char_lit ) «regDefId» + LexTerm : •~ char_lit «regDefId» + LexTerm : •~ ( char_lit - char_lit ) «regDefId» LexTerm : •regDefId «regDefId» LexTerm : •[ LexPattern ] «regDefId» LexTerm : •{ LexPattern } «regDefId» @@ -606,17 +597,26 @@ S20{ LexTerm : •. «{» LexTerm : •char_lit «{» LexTerm : •char_lit - char_lit «{» - LexTerm : •- char_lit «{» - LexTerm : •- ( char_lit - char_lit ) «{» + LexTerm : •~ char_lit «{» + LexTerm : •~ ( char_lit - char_lit ) «{» LexTerm : •regDefId «{» LexTerm : •[ LexPattern ] «{» LexTerm : •{ LexPattern } «{» LexTerm : •( LexPattern ) «{» + LexTerm : •. «~» + LexTerm : •char_lit «~» + LexTerm : •char_lit - char_lit «~» + LexTerm : •~ char_lit «~» + LexTerm : •~ ( char_lit - char_lit ) «~» + LexTerm : •regDefId «~» + LexTerm : •[ LexPattern ] «~» + LexTerm : •{ LexPattern } «~» + LexTerm : •( LexPattern ) «~» LexTerm : •. «|» LexTerm : •char_lit «|» LexTerm : •char_lit - char_lit «|» - LexTerm : •- char_lit «|» - LexTerm : •- ( char_lit - char_lit ) «|» + LexTerm : •~ char_lit «|» + LexTerm : •~ ( char_lit - char_lit ) «|» LexTerm : •regDefId «|» LexTerm : •[ LexPattern ] «|» LexTerm : •{ LexPattern } «|» @@ -628,7 +628,7 @@ Transitions: regDefId -> 25 . -> 26 char_lit -> 27 - - -> 28 + ~ -> 28 ( -> 29 [ -> 30 { -> 31 @@ -739,18 +739,18 @@ S23{ LexAlt : LexAlt •LexTerm «;» LexPattern : LexAlt• «|» LexAlt : LexAlt •LexTerm «(» - LexAlt : LexAlt •LexTerm «-» LexAlt : LexAlt •LexTerm «.» LexAlt : LexAlt •LexTerm «[» LexAlt : LexAlt •LexTerm «char_lit» LexAlt : LexAlt •LexTerm «regDefId» LexAlt : LexAlt •LexTerm «{» + LexAlt : LexAlt •LexTerm «~» LexAlt : LexAlt •LexTerm «|» LexTerm : •. «;» LexTerm : •char_lit «;» LexTerm : •char_lit - char_lit «;» - LexTerm : •- char_lit «;» - LexTerm : •- ( char_lit - char_lit ) «;» + LexTerm : •~ char_lit «;» + LexTerm : •~ ( char_lit - char_lit ) «;» LexTerm : •regDefId «;» LexTerm : •[ LexPattern ] «;» LexTerm : •{ LexPattern } «;» @@ -758,26 +758,17 @@ S23{ LexTerm : •. «(» LexTerm : •char_lit «(» LexTerm : •char_lit - char_lit «(» - LexTerm : •- char_lit «(» - LexTerm : •- ( char_lit - char_lit ) «(» + LexTerm : •~ char_lit «(» + LexTerm : •~ ( char_lit - char_lit ) «(» LexTerm : •regDefId «(» LexTerm : •[ LexPattern ] «(» LexTerm : •{ LexPattern } «(» LexTerm : •( LexPattern ) «(» - LexTerm : •. «-» - LexTerm : •char_lit «-» - LexTerm : •char_lit - char_lit «-» - LexTerm : •- char_lit «-» - LexTerm : •- ( char_lit - char_lit ) «-» - LexTerm : •regDefId «-» - LexTerm : •[ LexPattern ] «-» - LexTerm : •{ LexPattern } «-» - LexTerm : •( LexPattern ) «-» LexTerm : •. «.» LexTerm : •char_lit «.» LexTerm : •char_lit - char_lit «.» - LexTerm : •- char_lit «.» - LexTerm : •- ( char_lit - char_lit ) «.» + LexTerm : •~ char_lit «.» + LexTerm : •~ ( char_lit - char_lit ) «.» LexTerm : •regDefId «.» LexTerm : •[ LexPattern ] «.» LexTerm : •{ LexPattern } «.» @@ -785,8 +776,8 @@ S23{ LexTerm : •. «[» LexTerm : •char_lit «[» LexTerm : •char_lit - char_lit «[» - LexTerm : •- char_lit «[» - LexTerm : •- ( char_lit - char_lit ) «[» + LexTerm : •~ char_lit «[» + LexTerm : •~ ( char_lit - char_lit ) «[» LexTerm : •regDefId «[» LexTerm : •[ LexPattern ] «[» LexTerm : •{ LexPattern } «[» @@ -794,8 +785,8 @@ S23{ LexTerm : •. «char_lit» LexTerm : •char_lit «char_lit» LexTerm : •char_lit - char_lit «char_lit» - LexTerm : •- char_lit «char_lit» - LexTerm : •- ( char_lit - char_lit ) «char_lit» + LexTerm : •~ char_lit «char_lit» + LexTerm : •~ ( char_lit - char_lit ) «char_lit» LexTerm : •regDefId «char_lit» LexTerm : •[ LexPattern ] «char_lit» LexTerm : •{ LexPattern } «char_lit» @@ -803,8 +794,8 @@ S23{ LexTerm : •. «regDefId» LexTerm : •char_lit «regDefId» LexTerm : •char_lit - char_lit «regDefId» - LexTerm : •- char_lit «regDefId» - LexTerm : •- ( char_lit - char_lit ) «regDefId» + LexTerm : •~ char_lit «regDefId» + LexTerm : •~ ( char_lit - char_lit ) «regDefId» LexTerm : •regDefId «regDefId» LexTerm : •[ LexPattern ] «regDefId» LexTerm : •{ LexPattern } «regDefId» @@ -812,17 +803,26 @@ S23{ LexTerm : •. «{» LexTerm : •char_lit «{» LexTerm : •char_lit - char_lit «{» - LexTerm : •- char_lit «{» - LexTerm : •- ( char_lit - char_lit ) «{» + LexTerm : •~ char_lit «{» + LexTerm : •~ ( char_lit - char_lit ) «{» LexTerm : •regDefId «{» LexTerm : •[ LexPattern ] «{» LexTerm : •{ LexPattern } «{» LexTerm : •( LexPattern ) «{» + LexTerm : •. «~» + LexTerm : •char_lit «~» + LexTerm : •char_lit - char_lit «~» + LexTerm : •~ char_lit «~» + LexTerm : •~ ( char_lit - char_lit ) «~» + LexTerm : •regDefId «~» + LexTerm : •[ LexPattern ] «~» + LexTerm : •{ LexPattern } «~» + LexTerm : •( LexPattern ) «~» LexTerm : •. «|» LexTerm : •char_lit «|» LexTerm : •char_lit - char_lit «|» - LexTerm : •- char_lit «|» - LexTerm : •- ( char_lit - char_lit ) «|» + LexTerm : •~ char_lit «|» + LexTerm : •~ ( char_lit - char_lit ) «|» LexTerm : •regDefId «|» LexTerm : •[ LexPattern ] «|» LexTerm : •{ LexPattern } «|» @@ -832,7 +832,7 @@ Transitions: regDefId -> 25 . -> 26 char_lit -> 27 - - -> 28 + ~ -> 28 ( -> 29 [ -> 30 { -> 31 @@ -842,12 +842,12 @@ Transitions: S24{ LexAlt : LexTerm• «;» LexAlt : LexTerm• «(» - LexAlt : LexTerm• «-» LexAlt : LexTerm• «.» LexAlt : LexTerm• «[» LexAlt : LexTerm• «char_lit» LexAlt : LexTerm• «regDefId» LexAlt : LexTerm• «{» + LexAlt : LexTerm• «~» LexAlt : LexTerm• «|» } Transitions: @@ -856,12 +856,12 @@ Transitions: S25{ LexTerm : regDefId• «;» LexTerm : regDefId• «(» - LexTerm : regDefId• «-» LexTerm : regDefId• «.» LexTerm : regDefId• «[» LexTerm : regDefId• «char_lit» LexTerm : regDefId• «regDefId» LexTerm : regDefId• «{» + LexTerm : regDefId• «~» LexTerm : regDefId• «|» } Transitions: @@ -870,12 +870,12 @@ Transitions: S26{ LexTerm : .• «;» LexTerm : .• «(» - LexTerm : .• «-» LexTerm : .• «.» LexTerm : .• «[» LexTerm : .• «char_lit» LexTerm : .• «regDefId» LexTerm : .• «{» + LexTerm : .• «~» LexTerm : .• «|» } Transitions: @@ -886,8 +886,6 @@ S27{ LexTerm : char_lit •- char_lit «;» LexTerm : char_lit• «(» LexTerm : char_lit •- char_lit «(» - LexTerm : char_lit• «-» - LexTerm : char_lit •- char_lit «-» LexTerm : char_lit• «.» LexTerm : char_lit •- char_lit «.» LexTerm : char_lit• «[» @@ -898,6 +896,8 @@ S27{ LexTerm : char_lit •- char_lit «regDefId» LexTerm : char_lit• «{» LexTerm : char_lit •- char_lit «{» + LexTerm : char_lit• «~» + LexTerm : char_lit •- char_lit «~» LexTerm : char_lit• «|» LexTerm : char_lit •- char_lit «|» } @@ -906,24 +906,24 @@ Transitions: S28{ - LexTerm : - •char_lit «;» - LexTerm : - •( char_lit - char_lit ) «;» - LexTerm : - •char_lit «(» - LexTerm : - •( char_lit - char_lit ) «(» - LexTerm : - •char_lit «-» - LexTerm : - •( char_lit - char_lit ) «-» - LexTerm : - •char_lit «.» - LexTerm : - •( char_lit - char_lit ) «.» - LexTerm : - •char_lit «[» - LexTerm : - •( char_lit - char_lit ) «[» - LexTerm : - •char_lit «char_lit» - LexTerm : - •( char_lit - char_lit ) «char_lit» - LexTerm : - •char_lit «regDefId» - LexTerm : - •( char_lit - char_lit ) «regDefId» - LexTerm : - •char_lit «{» - LexTerm : - •( char_lit - char_lit ) «{» - LexTerm : - •char_lit «|» - LexTerm : - •( char_lit - char_lit ) «|» + LexTerm : ~ •char_lit «;» + LexTerm : ~ •( char_lit - char_lit ) «;» + LexTerm : ~ •char_lit «(» + LexTerm : ~ •( char_lit - char_lit ) «(» + LexTerm : ~ •char_lit «.» + LexTerm : ~ •( char_lit - char_lit ) «.» + LexTerm : ~ •char_lit «[» + LexTerm : ~ •( char_lit - char_lit ) «[» + LexTerm : ~ •char_lit «char_lit» + LexTerm : ~ •( char_lit - char_lit ) «char_lit» + LexTerm : ~ •char_lit «regDefId» + LexTerm : ~ •( char_lit - char_lit ) «regDefId» + LexTerm : ~ •char_lit «{» + LexTerm : ~ •( char_lit - char_lit ) «{» + LexTerm : ~ •char_lit «~» + LexTerm : ~ •( char_lit - char_lit ) «~» + LexTerm : ~ •char_lit «|» + LexTerm : ~ •( char_lit - char_lit ) «|» } Transitions: char_lit -> 51 @@ -933,12 +933,12 @@ Transitions: S29{ LexTerm : ( •LexPattern ) «;» LexTerm : ( •LexPattern ) «(» - LexTerm : ( •LexPattern ) «-» LexTerm : ( •LexPattern ) «.» LexTerm : ( •LexPattern ) «[» LexTerm : ( •LexPattern ) «char_lit» LexTerm : ( •LexPattern ) «regDefId» LexTerm : ( •LexPattern ) «{» + LexTerm : ( •LexPattern ) «~» LexTerm : ( •LexPattern ) «|» LexPattern : •LexAlt «)» LexPattern : •LexPattern | LexAlt «)» @@ -949,51 +949,42 @@ S29{ LexTerm : •. «)» LexTerm : •char_lit «)» LexTerm : •char_lit - char_lit «)» - LexTerm : •- char_lit «)» - LexTerm : •- ( char_lit - char_lit ) «)» + LexTerm : •~ char_lit «)» + LexTerm : •~ ( char_lit - char_lit ) «)» LexTerm : •regDefId «)» LexTerm : •[ LexPattern ] «)» LexTerm : •{ LexPattern } «)» LexTerm : •( LexPattern ) «)» LexAlt : •LexTerm «(» - LexAlt : •LexTerm «-» LexAlt : •LexTerm «.» LexAlt : •LexTerm «[» LexAlt : •LexTerm «char_lit» LexAlt : •LexTerm «regDefId» LexAlt : •LexTerm «{» + LexAlt : •LexTerm «~» LexAlt : •LexAlt LexTerm «(» - LexAlt : •LexAlt LexTerm «-» LexAlt : •LexAlt LexTerm «.» LexAlt : •LexAlt LexTerm «[» LexAlt : •LexAlt LexTerm «char_lit» LexAlt : •LexAlt LexTerm «regDefId» LexAlt : •LexAlt LexTerm «{» + LexAlt : •LexAlt LexTerm «~» LexAlt : •LexTerm «|» LexAlt : •LexAlt LexTerm «|» LexTerm : •. «(» LexTerm : •char_lit «(» LexTerm : •char_lit - char_lit «(» - LexTerm : •- char_lit «(» - LexTerm : •- ( char_lit - char_lit ) «(» + LexTerm : •~ char_lit «(» + LexTerm : •~ ( char_lit - char_lit ) «(» LexTerm : •regDefId «(» LexTerm : •[ LexPattern ] «(» LexTerm : •{ LexPattern } «(» LexTerm : •( LexPattern ) «(» - LexTerm : •. «-» - LexTerm : •char_lit «-» - LexTerm : •char_lit - char_lit «-» - LexTerm : •- char_lit «-» - LexTerm : •- ( char_lit - char_lit ) «-» - LexTerm : •regDefId «-» - LexTerm : •[ LexPattern ] «-» - LexTerm : •{ LexPattern } «-» - LexTerm : •( LexPattern ) «-» LexTerm : •. «.» LexTerm : •char_lit «.» LexTerm : •char_lit - char_lit «.» - LexTerm : •- char_lit «.» - LexTerm : •- ( char_lit - char_lit ) «.» + LexTerm : •~ char_lit «.» + LexTerm : •~ ( char_lit - char_lit ) «.» LexTerm : •regDefId «.» LexTerm : •[ LexPattern ] «.» LexTerm : •{ LexPattern } «.» @@ -1001,8 +992,8 @@ S29{ LexTerm : •. «[» LexTerm : •char_lit «[» LexTerm : •char_lit - char_lit «[» - LexTerm : •- char_lit «[» - LexTerm : •- ( char_lit - char_lit ) «[» + LexTerm : •~ char_lit «[» + LexTerm : •~ ( char_lit - char_lit ) «[» LexTerm : •regDefId «[» LexTerm : •[ LexPattern ] «[» LexTerm : •{ LexPattern } «[» @@ -1010,8 +1001,8 @@ S29{ LexTerm : •. «char_lit» LexTerm : •char_lit «char_lit» LexTerm : •char_lit - char_lit «char_lit» - LexTerm : •- char_lit «char_lit» - LexTerm : •- ( char_lit - char_lit ) «char_lit» + LexTerm : •~ char_lit «char_lit» + LexTerm : •~ ( char_lit - char_lit ) «char_lit» LexTerm : •regDefId «char_lit» LexTerm : •[ LexPattern ] «char_lit» LexTerm : •{ LexPattern } «char_lit» @@ -1019,8 +1010,8 @@ S29{ LexTerm : •. «regDefId» LexTerm : •char_lit «regDefId» LexTerm : •char_lit - char_lit «regDefId» - LexTerm : •- char_lit «regDefId» - LexTerm : •- ( char_lit - char_lit ) «regDefId» + LexTerm : •~ char_lit «regDefId» + LexTerm : •~ ( char_lit - char_lit ) «regDefId» LexTerm : •regDefId «regDefId» LexTerm : •[ LexPattern ] «regDefId» LexTerm : •{ LexPattern } «regDefId» @@ -1028,17 +1019,26 @@ S29{ LexTerm : •. «{» LexTerm : •char_lit «{» LexTerm : •char_lit - char_lit «{» - LexTerm : •- char_lit «{» - LexTerm : •- ( char_lit - char_lit ) «{» + LexTerm : •~ char_lit «{» + LexTerm : •~ ( char_lit - char_lit ) «{» LexTerm : •regDefId «{» LexTerm : •[ LexPattern ] «{» LexTerm : •{ LexPattern } «{» LexTerm : •( LexPattern ) «{» + LexTerm : •. «~» + LexTerm : •char_lit «~» + LexTerm : •char_lit - char_lit «~» + LexTerm : •~ char_lit «~» + LexTerm : •~ ( char_lit - char_lit ) «~» + LexTerm : •regDefId «~» + LexTerm : •[ LexPattern ] «~» + LexTerm : •{ LexPattern } «~» + LexTerm : •( LexPattern ) «~» LexTerm : •. «|» LexTerm : •char_lit «|» LexTerm : •char_lit - char_lit «|» - LexTerm : •- char_lit «|» - LexTerm : •- ( char_lit - char_lit ) «|» + LexTerm : •~ char_lit «|» + LexTerm : •~ ( char_lit - char_lit ) «|» LexTerm : •regDefId «|» LexTerm : •[ LexPattern ] «|» LexTerm : •{ LexPattern } «|» @@ -1051,7 +1051,7 @@ Transitions: regDefId -> 56 . -> 57 char_lit -> 58 - - -> 59 + ~ -> 59 ( -> 60 [ -> 61 { -> 62 @@ -1060,12 +1060,12 @@ Transitions: S30{ LexTerm : [ •LexPattern ] «;» LexTerm : [ •LexPattern ] «(» - LexTerm : [ •LexPattern ] «-» LexTerm : [ •LexPattern ] «.» LexTerm : [ •LexPattern ] «[» LexTerm : [ •LexPattern ] «char_lit» LexTerm : [ •LexPattern ] «regDefId» LexTerm : [ •LexPattern ] «{» + LexTerm : [ •LexPattern ] «~» LexTerm : [ •LexPattern ] «|» LexPattern : •LexAlt «]» LexPattern : •LexPattern | LexAlt «]» @@ -1076,51 +1076,42 @@ S30{ LexTerm : •. «]» LexTerm : •char_lit «]» LexTerm : •char_lit - char_lit «]» - LexTerm : •- char_lit «]» - LexTerm : •- ( char_lit - char_lit ) «]» + LexTerm : •~ char_lit «]» + LexTerm : •~ ( char_lit - char_lit ) «]» LexTerm : •regDefId «]» LexTerm : •[ LexPattern ] «]» LexTerm : •{ LexPattern } «]» LexTerm : •( LexPattern ) «]» LexAlt : •LexTerm «(» - LexAlt : •LexTerm «-» LexAlt : •LexTerm «.» LexAlt : •LexTerm «[» LexAlt : •LexTerm «char_lit» LexAlt : •LexTerm «regDefId» LexAlt : •LexTerm «{» + LexAlt : •LexTerm «~» LexAlt : •LexAlt LexTerm «(» - LexAlt : •LexAlt LexTerm «-» LexAlt : •LexAlt LexTerm «.» LexAlt : •LexAlt LexTerm «[» LexAlt : •LexAlt LexTerm «char_lit» LexAlt : •LexAlt LexTerm «regDefId» LexAlt : •LexAlt LexTerm «{» + LexAlt : •LexAlt LexTerm «~» LexAlt : •LexTerm «|» LexAlt : •LexAlt LexTerm «|» LexTerm : •. «(» LexTerm : •char_lit «(» LexTerm : •char_lit - char_lit «(» - LexTerm : •- char_lit «(» - LexTerm : •- ( char_lit - char_lit ) «(» + LexTerm : •~ char_lit «(» + LexTerm : •~ ( char_lit - char_lit ) «(» LexTerm : •regDefId «(» LexTerm : •[ LexPattern ] «(» LexTerm : •{ LexPattern } «(» LexTerm : •( LexPattern ) «(» - LexTerm : •. «-» - LexTerm : •char_lit «-» - LexTerm : •char_lit - char_lit «-» - LexTerm : •- char_lit «-» - LexTerm : •- ( char_lit - char_lit ) «-» - LexTerm : •regDefId «-» - LexTerm : •[ LexPattern ] «-» - LexTerm : •{ LexPattern } «-» - LexTerm : •( LexPattern ) «-» LexTerm : •. «.» LexTerm : •char_lit «.» LexTerm : •char_lit - char_lit «.» - LexTerm : •- char_lit «.» - LexTerm : •- ( char_lit - char_lit ) «.» + LexTerm : •~ char_lit «.» + LexTerm : •~ ( char_lit - char_lit ) «.» LexTerm : •regDefId «.» LexTerm : •[ LexPattern ] «.» LexTerm : •{ LexPattern } «.» @@ -1128,8 +1119,8 @@ S30{ LexTerm : •. «[» LexTerm : •char_lit «[» LexTerm : •char_lit - char_lit «[» - LexTerm : •- char_lit «[» - LexTerm : •- ( char_lit - char_lit ) «[» + LexTerm : •~ char_lit «[» + LexTerm : •~ ( char_lit - char_lit ) «[» LexTerm : •regDefId «[» LexTerm : •[ LexPattern ] «[» LexTerm : •{ LexPattern } «[» @@ -1137,8 +1128,8 @@ S30{ LexTerm : •. «char_lit» LexTerm : •char_lit «char_lit» LexTerm : •char_lit - char_lit «char_lit» - LexTerm : •- char_lit «char_lit» - LexTerm : •- ( char_lit - char_lit ) «char_lit» + LexTerm : •~ char_lit «char_lit» + LexTerm : •~ ( char_lit - char_lit ) «char_lit» LexTerm : •regDefId «char_lit» LexTerm : •[ LexPattern ] «char_lit» LexTerm : •{ LexPattern } «char_lit» @@ -1146,8 +1137,8 @@ S30{ LexTerm : •. «regDefId» LexTerm : •char_lit «regDefId» LexTerm : •char_lit - char_lit «regDefId» - LexTerm : •- char_lit «regDefId» - LexTerm : •- ( char_lit - char_lit ) «regDefId» + LexTerm : •~ char_lit «regDefId» + LexTerm : •~ ( char_lit - char_lit ) «regDefId» LexTerm : •regDefId «regDefId» LexTerm : •[ LexPattern ] «regDefId» LexTerm : •{ LexPattern } «regDefId» @@ -1155,17 +1146,26 @@ S30{ LexTerm : •. «{» LexTerm : •char_lit «{» LexTerm : •char_lit - char_lit «{» - LexTerm : •- char_lit «{» - LexTerm : •- ( char_lit - char_lit ) «{» + LexTerm : •~ char_lit «{» + LexTerm : •~ ( char_lit - char_lit ) «{» LexTerm : •regDefId «{» LexTerm : •[ LexPattern ] «{» LexTerm : •{ LexPattern } «{» LexTerm : •( LexPattern ) «{» + LexTerm : •. «~» + LexTerm : •char_lit «~» + LexTerm : •char_lit - char_lit «~» + LexTerm : •~ char_lit «~» + LexTerm : •~ ( char_lit - char_lit ) «~» + LexTerm : •regDefId «~» + LexTerm : •[ LexPattern ] «~» + LexTerm : •{ LexPattern } «~» + LexTerm : •( LexPattern ) «~» LexTerm : •. «|» LexTerm : •char_lit «|» LexTerm : •char_lit - char_lit «|» - LexTerm : •- char_lit «|» - LexTerm : •- ( char_lit - char_lit ) «|» + LexTerm : •~ char_lit «|» + LexTerm : •~ ( char_lit - char_lit ) «|» LexTerm : •regDefId «|» LexTerm : •[ LexPattern ] «|» LexTerm : •{ LexPattern } «|» @@ -1178,7 +1178,7 @@ Transitions: regDefId -> 66 . -> 67 char_lit -> 68 - - -> 69 + ~ -> 69 ( -> 70 [ -> 71 { -> 72 @@ -1187,12 +1187,12 @@ Transitions: S31{ LexTerm : { •LexPattern } «;» LexTerm : { •LexPattern } «(» - LexTerm : { •LexPattern } «-» LexTerm : { •LexPattern } «.» LexTerm : { •LexPattern } «[» LexTerm : { •LexPattern } «char_lit» LexTerm : { •LexPattern } «regDefId» LexTerm : { •LexPattern } «{» + LexTerm : { •LexPattern } «~» LexTerm : { •LexPattern } «|» LexPattern : •LexAlt «}» LexPattern : •LexPattern | LexAlt «}» @@ -1203,51 +1203,42 @@ S31{ LexTerm : •. «}» LexTerm : •char_lit «}» LexTerm : •char_lit - char_lit «}» - LexTerm : •- char_lit «}» - LexTerm : •- ( char_lit - char_lit ) «}» + LexTerm : •~ char_lit «}» + LexTerm : •~ ( char_lit - char_lit ) «}» LexTerm : •regDefId «}» LexTerm : •[ LexPattern ] «}» LexTerm : •{ LexPattern } «}» LexTerm : •( LexPattern ) «}» LexAlt : •LexTerm «(» - LexAlt : •LexTerm «-» LexAlt : •LexTerm «.» LexAlt : •LexTerm «[» LexAlt : •LexTerm «char_lit» LexAlt : •LexTerm «regDefId» LexAlt : •LexTerm «{» + LexAlt : •LexTerm «~» LexAlt : •LexAlt LexTerm «(» - LexAlt : •LexAlt LexTerm «-» LexAlt : •LexAlt LexTerm «.» LexAlt : •LexAlt LexTerm «[» LexAlt : •LexAlt LexTerm «char_lit» LexAlt : •LexAlt LexTerm «regDefId» LexAlt : •LexAlt LexTerm «{» + LexAlt : •LexAlt LexTerm «~» LexAlt : •LexTerm «|» LexAlt : •LexAlt LexTerm «|» LexTerm : •. «(» LexTerm : •char_lit «(» LexTerm : •char_lit - char_lit «(» - LexTerm : •- char_lit «(» - LexTerm : •- ( char_lit - char_lit ) «(» + LexTerm : •~ char_lit «(» + LexTerm : •~ ( char_lit - char_lit ) «(» LexTerm : •regDefId «(» LexTerm : •[ LexPattern ] «(» LexTerm : •{ LexPattern } «(» LexTerm : •( LexPattern ) «(» - LexTerm : •. «-» - LexTerm : •char_lit «-» - LexTerm : •char_lit - char_lit «-» - LexTerm : •- char_lit «-» - LexTerm : •- ( char_lit - char_lit ) «-» - LexTerm : •regDefId «-» - LexTerm : •[ LexPattern ] «-» - LexTerm : •{ LexPattern } «-» - LexTerm : •( LexPattern ) «-» LexTerm : •. «.» LexTerm : •char_lit «.» LexTerm : •char_lit - char_lit «.» - LexTerm : •- char_lit «.» - LexTerm : •- ( char_lit - char_lit ) «.» + LexTerm : •~ char_lit «.» + LexTerm : •~ ( char_lit - char_lit ) «.» LexTerm : •regDefId «.» LexTerm : •[ LexPattern ] «.» LexTerm : •{ LexPattern } «.» @@ -1255,8 +1246,8 @@ S31{ LexTerm : •. «[» LexTerm : •char_lit «[» LexTerm : •char_lit - char_lit «[» - LexTerm : •- char_lit «[» - LexTerm : •- ( char_lit - char_lit ) «[» + LexTerm : •~ char_lit «[» + LexTerm : •~ ( char_lit - char_lit ) «[» LexTerm : •regDefId «[» LexTerm : •[ LexPattern ] «[» LexTerm : •{ LexPattern } «[» @@ -1264,8 +1255,8 @@ S31{ LexTerm : •. «char_lit» LexTerm : •char_lit «char_lit» LexTerm : •char_lit - char_lit «char_lit» - LexTerm : •- char_lit «char_lit» - LexTerm : •- ( char_lit - char_lit ) «char_lit» + LexTerm : •~ char_lit «char_lit» + LexTerm : •~ ( char_lit - char_lit ) «char_lit» LexTerm : •regDefId «char_lit» LexTerm : •[ LexPattern ] «char_lit» LexTerm : •{ LexPattern } «char_lit» @@ -1273,8 +1264,8 @@ S31{ LexTerm : •. «regDefId» LexTerm : •char_lit «regDefId» LexTerm : •char_lit - char_lit «regDefId» - LexTerm : •- char_lit «regDefId» - LexTerm : •- ( char_lit - char_lit ) «regDefId» + LexTerm : •~ char_lit «regDefId» + LexTerm : •~ ( char_lit - char_lit ) «regDefId» LexTerm : •regDefId «regDefId» LexTerm : •[ LexPattern ] «regDefId» LexTerm : •{ LexPattern } «regDefId» @@ -1282,17 +1273,26 @@ S31{ LexTerm : •. «{» LexTerm : •char_lit «{» LexTerm : •char_lit - char_lit «{» - LexTerm : •- char_lit «{» - LexTerm : •- ( char_lit - char_lit ) «{» + LexTerm : •~ char_lit «{» + LexTerm : •~ ( char_lit - char_lit ) «{» LexTerm : •regDefId «{» LexTerm : •[ LexPattern ] «{» LexTerm : •{ LexPattern } «{» LexTerm : •( LexPattern ) «{» + LexTerm : •. «~» + LexTerm : •char_lit «~» + LexTerm : •char_lit - char_lit «~» + LexTerm : •~ char_lit «~» + LexTerm : •~ ( char_lit - char_lit ) «~» + LexTerm : •regDefId «~» + LexTerm : •[ LexPattern ] «~» + LexTerm : •{ LexPattern } «~» + LexTerm : •( LexPattern ) «~» LexTerm : •. «|» LexTerm : •char_lit «|» LexTerm : •char_lit - char_lit «|» - LexTerm : •- char_lit «|» - LexTerm : •- ( char_lit - char_lit ) «|» + LexTerm : •~ char_lit «|» + LexTerm : •~ ( char_lit - char_lit ) «|» LexTerm : •regDefId «|» LexTerm : •[ LexPattern ] «|» LexTerm : •{ LexPattern } «|» @@ -1305,7 +1305,7 @@ Transitions: regDefId -> 76 . -> 77 char_lit -> 78 - - -> 79 + ~ -> 79 ( -> 80 [ -> 81 { -> 82 @@ -1554,31 +1554,31 @@ S48{ LexTerm : •. «;» LexTerm : •char_lit «;» LexTerm : •char_lit - char_lit «;» - LexTerm : •- char_lit «;» - LexTerm : •- ( char_lit - char_lit ) «;» + LexTerm : •~ char_lit «;» + LexTerm : •~ ( char_lit - char_lit ) «;» LexTerm : •regDefId «;» LexTerm : •[ LexPattern ] «;» LexTerm : •{ LexPattern } «;» LexTerm : •( LexPattern ) «;» LexAlt : •LexTerm «(» - LexAlt : •LexTerm «-» LexAlt : •LexTerm «.» LexAlt : •LexTerm «[» LexAlt : •LexTerm «char_lit» LexAlt : •LexTerm «regDefId» LexAlt : •LexTerm «{» + LexAlt : •LexTerm «~» LexAlt : •LexAlt LexTerm «(» - LexAlt : •LexAlt LexTerm «-» LexAlt : •LexAlt LexTerm «.» LexAlt : •LexAlt LexTerm «[» LexAlt : •LexAlt LexTerm «char_lit» LexAlt : •LexAlt LexTerm «regDefId» LexAlt : •LexAlt LexTerm «{» + LexAlt : •LexAlt LexTerm «~» LexTerm : •. «|» LexTerm : •char_lit «|» LexTerm : •char_lit - char_lit «|» - LexTerm : •- char_lit «|» - LexTerm : •- ( char_lit - char_lit ) «|» + LexTerm : •~ char_lit «|» + LexTerm : •~ ( char_lit - char_lit ) «|» LexTerm : •regDefId «|» LexTerm : •[ LexPattern ] «|» LexTerm : •{ LexPattern } «|» @@ -1586,26 +1586,17 @@ S48{ LexTerm : •. «(» LexTerm : •char_lit «(» LexTerm : •char_lit - char_lit «(» - LexTerm : •- char_lit «(» - LexTerm : •- ( char_lit - char_lit ) «(» + LexTerm : •~ char_lit «(» + LexTerm : •~ ( char_lit - char_lit ) «(» LexTerm : •regDefId «(» LexTerm : •[ LexPattern ] «(» LexTerm : •{ LexPattern } «(» LexTerm : •( LexPattern ) «(» - LexTerm : •. «-» - LexTerm : •char_lit «-» - LexTerm : •char_lit - char_lit «-» - LexTerm : •- char_lit «-» - LexTerm : •- ( char_lit - char_lit ) «-» - LexTerm : •regDefId «-» - LexTerm : •[ LexPattern ] «-» - LexTerm : •{ LexPattern } «-» - LexTerm : •( LexPattern ) «-» LexTerm : •. «.» LexTerm : •char_lit «.» LexTerm : •char_lit - char_lit «.» - LexTerm : •- char_lit «.» - LexTerm : •- ( char_lit - char_lit ) «.» + LexTerm : •~ char_lit «.» + LexTerm : •~ ( char_lit - char_lit ) «.» LexTerm : •regDefId «.» LexTerm : •[ LexPattern ] «.» LexTerm : •{ LexPattern } «.» @@ -1613,8 +1604,8 @@ S48{ LexTerm : •. «[» LexTerm : •char_lit «[» LexTerm : •char_lit - char_lit «[» - LexTerm : •- char_lit «[» - LexTerm : •- ( char_lit - char_lit ) «[» + LexTerm : •~ char_lit «[» + LexTerm : •~ ( char_lit - char_lit ) «[» LexTerm : •regDefId «[» LexTerm : •[ LexPattern ] «[» LexTerm : •{ LexPattern } «[» @@ -1622,8 +1613,8 @@ S48{ LexTerm : •. «char_lit» LexTerm : •char_lit «char_lit» LexTerm : •char_lit - char_lit «char_lit» - LexTerm : •- char_lit «char_lit» - LexTerm : •- ( char_lit - char_lit ) «char_lit» + LexTerm : •~ char_lit «char_lit» + LexTerm : •~ ( char_lit - char_lit ) «char_lit» LexTerm : •regDefId «char_lit» LexTerm : •[ LexPattern ] «char_lit» LexTerm : •{ LexPattern } «char_lit» @@ -1631,8 +1622,8 @@ S48{ LexTerm : •. «regDefId» LexTerm : •char_lit «regDefId» LexTerm : •char_lit - char_lit «regDefId» - LexTerm : •- char_lit «regDefId» - LexTerm : •- ( char_lit - char_lit ) «regDefId» + LexTerm : •~ char_lit «regDefId» + LexTerm : •~ ( char_lit - char_lit ) «regDefId» LexTerm : •regDefId «regDefId» LexTerm : •[ LexPattern ] «regDefId» LexTerm : •{ LexPattern } «regDefId» @@ -1640,19 +1631,28 @@ S48{ LexTerm : •. «{» LexTerm : •char_lit «{» LexTerm : •char_lit - char_lit «{» - LexTerm : •- char_lit «{» - LexTerm : •- ( char_lit - char_lit ) «{» + LexTerm : •~ char_lit «{» + LexTerm : •~ ( char_lit - char_lit ) «{» LexTerm : •regDefId «{» LexTerm : •[ LexPattern ] «{» LexTerm : •{ LexPattern } «{» LexTerm : •( LexPattern ) «{» + LexTerm : •. «~» + LexTerm : •char_lit «~» + LexTerm : •char_lit - char_lit «~» + LexTerm : •~ char_lit «~» + LexTerm : •~ ( char_lit - char_lit ) «~» + LexTerm : •regDefId «~» + LexTerm : •[ LexPattern ] «~» + LexTerm : •{ LexPattern } «~» + LexTerm : •( LexPattern ) «~» } Transitions: LexTerm -> 24 regDefId -> 25 . -> 26 char_lit -> 27 - - -> 28 + ~ -> 28 ( -> 29 [ -> 30 { -> 31 @@ -1662,12 +1662,12 @@ Transitions: S49{ LexAlt : LexAlt LexTerm• «;» LexAlt : LexAlt LexTerm• «(» - LexAlt : LexAlt LexTerm• «-» LexAlt : LexAlt LexTerm• «.» LexAlt : LexAlt LexTerm• «[» LexAlt : LexAlt LexTerm• «char_lit» LexAlt : LexAlt LexTerm• «regDefId» LexAlt : LexAlt LexTerm• «{» + LexAlt : LexAlt LexTerm• «~» LexAlt : LexAlt LexTerm• «|» } Transitions: @@ -1676,12 +1676,12 @@ Transitions: S50{ LexTerm : char_lit - •char_lit «;» LexTerm : char_lit - •char_lit «(» - LexTerm : char_lit - •char_lit «-» LexTerm : char_lit - •char_lit «.» LexTerm : char_lit - •char_lit «[» LexTerm : char_lit - •char_lit «char_lit» LexTerm : char_lit - •char_lit «regDefId» LexTerm : char_lit - •char_lit «{» + LexTerm : char_lit - •char_lit «~» LexTerm : char_lit - •char_lit «|» } Transitions: @@ -1689,29 +1689,29 @@ Transitions: S51{ - LexTerm : - char_lit• «;» - LexTerm : - char_lit• «(» - LexTerm : - char_lit• «-» - LexTerm : - char_lit• «.» - LexTerm : - char_lit• «[» - LexTerm : - char_lit• «char_lit» - LexTerm : - char_lit• «regDefId» - LexTerm : - char_lit• «{» - LexTerm : - char_lit• «|» + LexTerm : ~ char_lit• «;» + LexTerm : ~ char_lit• «(» + LexTerm : ~ char_lit• «.» + LexTerm : ~ char_lit• «[» + LexTerm : ~ char_lit• «char_lit» + LexTerm : ~ char_lit• «regDefId» + LexTerm : ~ char_lit• «{» + LexTerm : ~ char_lit• «~» + LexTerm : ~ char_lit• «|» } Transitions: S52{ - LexTerm : - ( •char_lit - char_lit ) «;» - LexTerm : - ( •char_lit - char_lit ) «(» - LexTerm : - ( •char_lit - char_lit ) «-» - LexTerm : - ( •char_lit - char_lit ) «.» - LexTerm : - ( •char_lit - char_lit ) «[» - LexTerm : - ( •char_lit - char_lit ) «char_lit» - LexTerm : - ( •char_lit - char_lit ) «regDefId» - LexTerm : - ( •char_lit - char_lit ) «{» - LexTerm : - ( •char_lit - char_lit ) «|» + LexTerm : ~ ( •char_lit - char_lit ) «;» + LexTerm : ~ ( •char_lit - char_lit ) «(» + LexTerm : ~ ( •char_lit - char_lit ) «.» + LexTerm : ~ ( •char_lit - char_lit ) «[» + LexTerm : ~ ( •char_lit - char_lit ) «char_lit» + LexTerm : ~ ( •char_lit - char_lit ) «regDefId» + LexTerm : ~ ( •char_lit - char_lit ) «{» + LexTerm : ~ ( •char_lit - char_lit ) «~» + LexTerm : ~ ( •char_lit - char_lit ) «|» } Transitions: char_lit -> 93 @@ -1720,12 +1720,12 @@ Transitions: S53{ LexTerm : ( LexPattern •) «;» LexTerm : ( LexPattern •) «(» - LexTerm : ( LexPattern •) «-» LexTerm : ( LexPattern •) «.» LexTerm : ( LexPattern •) «[» LexTerm : ( LexPattern •) «char_lit» LexTerm : ( LexPattern •) «regDefId» LexTerm : ( LexPattern •) «{» + LexTerm : ( LexPattern •) «~» LexTerm : ( LexPattern •) «|» LexPattern : LexPattern •| LexAlt «)» LexPattern : LexPattern •| LexAlt «|» @@ -1740,18 +1740,18 @@ S54{ LexAlt : LexAlt •LexTerm «)» LexPattern : LexAlt• «|» LexAlt : LexAlt •LexTerm «(» - LexAlt : LexAlt •LexTerm «-» LexAlt : LexAlt •LexTerm «.» LexAlt : LexAlt •LexTerm «[» LexAlt : LexAlt •LexTerm «char_lit» LexAlt : LexAlt •LexTerm «regDefId» LexAlt : LexAlt •LexTerm «{» + LexAlt : LexAlt •LexTerm «~» LexAlt : LexAlt •LexTerm «|» LexTerm : •. «)» LexTerm : •char_lit «)» LexTerm : •char_lit - char_lit «)» - LexTerm : •- char_lit «)» - LexTerm : •- ( char_lit - char_lit ) «)» + LexTerm : •~ char_lit «)» + LexTerm : •~ ( char_lit - char_lit ) «)» LexTerm : •regDefId «)» LexTerm : •[ LexPattern ] «)» LexTerm : •{ LexPattern } «)» @@ -1759,26 +1759,17 @@ S54{ LexTerm : •. «(» LexTerm : •char_lit «(» LexTerm : •char_lit - char_lit «(» - LexTerm : •- char_lit «(» - LexTerm : •- ( char_lit - char_lit ) «(» + LexTerm : •~ char_lit «(» + LexTerm : •~ ( char_lit - char_lit ) «(» LexTerm : •regDefId «(» LexTerm : •[ LexPattern ] «(» LexTerm : •{ LexPattern } «(» LexTerm : •( LexPattern ) «(» - LexTerm : •. «-» - LexTerm : •char_lit «-» - LexTerm : •char_lit - char_lit «-» - LexTerm : •- char_lit «-» - LexTerm : •- ( char_lit - char_lit ) «-» - LexTerm : •regDefId «-» - LexTerm : •[ LexPattern ] «-» - LexTerm : •{ LexPattern } «-» - LexTerm : •( LexPattern ) «-» LexTerm : •. «.» LexTerm : •char_lit «.» LexTerm : •char_lit - char_lit «.» - LexTerm : •- char_lit «.» - LexTerm : •- ( char_lit - char_lit ) «.» + LexTerm : •~ char_lit «.» + LexTerm : •~ ( char_lit - char_lit ) «.» LexTerm : •regDefId «.» LexTerm : •[ LexPattern ] «.» LexTerm : •{ LexPattern } «.» @@ -1786,8 +1777,8 @@ S54{ LexTerm : •. «[» LexTerm : •char_lit «[» LexTerm : •char_lit - char_lit «[» - LexTerm : •- char_lit «[» - LexTerm : •- ( char_lit - char_lit ) «[» + LexTerm : •~ char_lit «[» + LexTerm : •~ ( char_lit - char_lit ) «[» LexTerm : •regDefId «[» LexTerm : •[ LexPattern ] «[» LexTerm : •{ LexPattern } «[» @@ -1795,8 +1786,8 @@ S54{ LexTerm : •. «char_lit» LexTerm : •char_lit «char_lit» LexTerm : •char_lit - char_lit «char_lit» - LexTerm : •- char_lit «char_lit» - LexTerm : •- ( char_lit - char_lit ) «char_lit» + LexTerm : •~ char_lit «char_lit» + LexTerm : •~ ( char_lit - char_lit ) «char_lit» LexTerm : •regDefId «char_lit» LexTerm : •[ LexPattern ] «char_lit» LexTerm : •{ LexPattern } «char_lit» @@ -1804,8 +1795,8 @@ S54{ LexTerm : •. «regDefId» LexTerm : •char_lit «regDefId» LexTerm : •char_lit - char_lit «regDefId» - LexTerm : •- char_lit «regDefId» - LexTerm : •- ( char_lit - char_lit ) «regDefId» + LexTerm : •~ char_lit «regDefId» + LexTerm : •~ ( char_lit - char_lit ) «regDefId» LexTerm : •regDefId «regDefId» LexTerm : •[ LexPattern ] «regDefId» LexTerm : •{ LexPattern } «regDefId» @@ -1813,17 +1804,26 @@ S54{ LexTerm : •. «{» LexTerm : •char_lit «{» LexTerm : •char_lit - char_lit «{» - LexTerm : •- char_lit «{» - LexTerm : •- ( char_lit - char_lit ) «{» + LexTerm : •~ char_lit «{» + LexTerm : •~ ( char_lit - char_lit ) «{» LexTerm : •regDefId «{» LexTerm : •[ LexPattern ] «{» LexTerm : •{ LexPattern } «{» LexTerm : •( LexPattern ) «{» + LexTerm : •. «~» + LexTerm : •char_lit «~» + LexTerm : •char_lit - char_lit «~» + LexTerm : •~ char_lit «~» + LexTerm : •~ ( char_lit - char_lit ) «~» + LexTerm : •regDefId «~» + LexTerm : •[ LexPattern ] «~» + LexTerm : •{ LexPattern } «~» + LexTerm : •( LexPattern ) «~» LexTerm : •. «|» LexTerm : •char_lit «|» LexTerm : •char_lit - char_lit «|» - LexTerm : •- char_lit «|» - LexTerm : •- ( char_lit - char_lit ) «|» + LexTerm : •~ char_lit «|» + LexTerm : •~ ( char_lit - char_lit ) «|» LexTerm : •regDefId «|» LexTerm : •[ LexPattern ] «|» LexTerm : •{ LexPattern } «|» @@ -1833,7 +1833,7 @@ Transitions: regDefId -> 56 . -> 57 char_lit -> 58 - - -> 59 + ~ -> 59 ( -> 60 [ -> 61 { -> 62 @@ -1843,12 +1843,12 @@ Transitions: S55{ LexAlt : LexTerm• «)» LexAlt : LexTerm• «(» - LexAlt : LexTerm• «-» LexAlt : LexTerm• «.» LexAlt : LexTerm• «[» LexAlt : LexTerm• «char_lit» LexAlt : LexTerm• «regDefId» LexAlt : LexTerm• «{» + LexAlt : LexTerm• «~» LexAlt : LexTerm• «|» } Transitions: @@ -1857,12 +1857,12 @@ Transitions: S56{ LexTerm : regDefId• «)» LexTerm : regDefId• «(» - LexTerm : regDefId• «-» LexTerm : regDefId• «.» LexTerm : regDefId• «[» LexTerm : regDefId• «char_lit» LexTerm : regDefId• «regDefId» LexTerm : regDefId• «{» + LexTerm : regDefId• «~» LexTerm : regDefId• «|» } Transitions: @@ -1871,12 +1871,12 @@ Transitions: S57{ LexTerm : .• «)» LexTerm : .• «(» - LexTerm : .• «-» LexTerm : .• «.» LexTerm : .• «[» LexTerm : .• «char_lit» LexTerm : .• «regDefId» LexTerm : .• «{» + LexTerm : .• «~» LexTerm : .• «|» } Transitions: @@ -1887,8 +1887,6 @@ S58{ LexTerm : char_lit •- char_lit «)» LexTerm : char_lit• «(» LexTerm : char_lit •- char_lit «(» - LexTerm : char_lit• «-» - LexTerm : char_lit •- char_lit «-» LexTerm : char_lit• «.» LexTerm : char_lit •- char_lit «.» LexTerm : char_lit• «[» @@ -1899,6 +1897,8 @@ S58{ LexTerm : char_lit •- char_lit «regDefId» LexTerm : char_lit• «{» LexTerm : char_lit •- char_lit «{» + LexTerm : char_lit• «~» + LexTerm : char_lit •- char_lit «~» LexTerm : char_lit• «|» LexTerm : char_lit •- char_lit «|» } @@ -1907,24 +1907,24 @@ Transitions: S59{ - LexTerm : - •char_lit «)» - LexTerm : - •( char_lit - char_lit ) «)» - LexTerm : - •char_lit «(» - LexTerm : - •( char_lit - char_lit ) «(» - LexTerm : - •char_lit «-» - LexTerm : - •( char_lit - char_lit ) «-» - LexTerm : - •char_lit «.» - LexTerm : - •( char_lit - char_lit ) «.» - LexTerm : - •char_lit «[» - LexTerm : - •( char_lit - char_lit ) «[» - LexTerm : - •char_lit «char_lit» - LexTerm : - •( char_lit - char_lit ) «char_lit» - LexTerm : - •char_lit «regDefId» - LexTerm : - •( char_lit - char_lit ) «regDefId» - LexTerm : - •char_lit «{» - LexTerm : - •( char_lit - char_lit ) «{» - LexTerm : - •char_lit «|» - LexTerm : - •( char_lit - char_lit ) «|» + LexTerm : ~ •char_lit «)» + LexTerm : ~ •( char_lit - char_lit ) «)» + LexTerm : ~ •char_lit «(» + LexTerm : ~ •( char_lit - char_lit ) «(» + LexTerm : ~ •char_lit «.» + LexTerm : ~ •( char_lit - char_lit ) «.» + LexTerm : ~ •char_lit «[» + LexTerm : ~ •( char_lit - char_lit ) «[» + LexTerm : ~ •char_lit «char_lit» + LexTerm : ~ •( char_lit - char_lit ) «char_lit» + LexTerm : ~ •char_lit «regDefId» + LexTerm : ~ •( char_lit - char_lit ) «regDefId» + LexTerm : ~ •char_lit «{» + LexTerm : ~ •( char_lit - char_lit ) «{» + LexTerm : ~ •char_lit «~» + LexTerm : ~ •( char_lit - char_lit ) «~» + LexTerm : ~ •char_lit «|» + LexTerm : ~ •( char_lit - char_lit ) «|» } Transitions: char_lit -> 98 @@ -1934,12 +1934,12 @@ Transitions: S60{ LexTerm : ( •LexPattern ) «)» LexTerm : ( •LexPattern ) «(» - LexTerm : ( •LexPattern ) «-» LexTerm : ( •LexPattern ) «.» LexTerm : ( •LexPattern ) «[» LexTerm : ( •LexPattern ) «char_lit» LexTerm : ( •LexPattern ) «regDefId» LexTerm : ( •LexPattern ) «{» + LexTerm : ( •LexPattern ) «~» LexTerm : ( •LexPattern ) «|» LexPattern : •LexAlt «)» LexPattern : •LexPattern | LexAlt «)» @@ -1950,51 +1950,42 @@ S60{ LexTerm : •. «)» LexTerm : •char_lit «)» LexTerm : •char_lit - char_lit «)» - LexTerm : •- char_lit «)» - LexTerm : •- ( char_lit - char_lit ) «)» + LexTerm : •~ char_lit «)» + LexTerm : •~ ( char_lit - char_lit ) «)» LexTerm : •regDefId «)» LexTerm : •[ LexPattern ] «)» LexTerm : •{ LexPattern } «)» LexTerm : •( LexPattern ) «)» LexAlt : •LexTerm «(» - LexAlt : •LexTerm «-» LexAlt : •LexTerm «.» LexAlt : •LexTerm «[» LexAlt : •LexTerm «char_lit» LexAlt : •LexTerm «regDefId» LexAlt : •LexTerm «{» + LexAlt : •LexTerm «~» LexAlt : •LexAlt LexTerm «(» - LexAlt : •LexAlt LexTerm «-» LexAlt : •LexAlt LexTerm «.» LexAlt : •LexAlt LexTerm «[» LexAlt : •LexAlt LexTerm «char_lit» LexAlt : •LexAlt LexTerm «regDefId» LexAlt : •LexAlt LexTerm «{» + LexAlt : •LexAlt LexTerm «~» LexAlt : •LexTerm «|» LexAlt : •LexAlt LexTerm «|» LexTerm : •. «(» LexTerm : •char_lit «(» LexTerm : •char_lit - char_lit «(» - LexTerm : •- char_lit «(» - LexTerm : •- ( char_lit - char_lit ) «(» + LexTerm : •~ char_lit «(» + LexTerm : •~ ( char_lit - char_lit ) «(» LexTerm : •regDefId «(» LexTerm : •[ LexPattern ] «(» LexTerm : •{ LexPattern } «(» LexTerm : •( LexPattern ) «(» - LexTerm : •. «-» - LexTerm : •char_lit «-» - LexTerm : •char_lit - char_lit «-» - LexTerm : •- char_lit «-» - LexTerm : •- ( char_lit - char_lit ) «-» - LexTerm : •regDefId «-» - LexTerm : •[ LexPattern ] «-» - LexTerm : •{ LexPattern } «-» - LexTerm : •( LexPattern ) «-» LexTerm : •. «.» LexTerm : •char_lit «.» LexTerm : •char_lit - char_lit «.» - LexTerm : •- char_lit «.» - LexTerm : •- ( char_lit - char_lit ) «.» + LexTerm : •~ char_lit «.» + LexTerm : •~ ( char_lit - char_lit ) «.» LexTerm : •regDefId «.» LexTerm : •[ LexPattern ] «.» LexTerm : •{ LexPattern } «.» @@ -2002,8 +1993,8 @@ S60{ LexTerm : •. «[» LexTerm : •char_lit «[» LexTerm : •char_lit - char_lit «[» - LexTerm : •- char_lit «[» - LexTerm : •- ( char_lit - char_lit ) «[» + LexTerm : •~ char_lit «[» + LexTerm : •~ ( char_lit - char_lit ) «[» LexTerm : •regDefId «[» LexTerm : •[ LexPattern ] «[» LexTerm : •{ LexPattern } «[» @@ -2011,8 +2002,8 @@ S60{ LexTerm : •. «char_lit» LexTerm : •char_lit «char_lit» LexTerm : •char_lit - char_lit «char_lit» - LexTerm : •- char_lit «char_lit» - LexTerm : •- ( char_lit - char_lit ) «char_lit» + LexTerm : •~ char_lit «char_lit» + LexTerm : •~ ( char_lit - char_lit ) «char_lit» LexTerm : •regDefId «char_lit» LexTerm : •[ LexPattern ] «char_lit» LexTerm : •{ LexPattern } «char_lit» @@ -2020,8 +2011,8 @@ S60{ LexTerm : •. «regDefId» LexTerm : •char_lit «regDefId» LexTerm : •char_lit - char_lit «regDefId» - LexTerm : •- char_lit «regDefId» - LexTerm : •- ( char_lit - char_lit ) «regDefId» + LexTerm : •~ char_lit «regDefId» + LexTerm : •~ ( char_lit - char_lit ) «regDefId» LexTerm : •regDefId «regDefId» LexTerm : •[ LexPattern ] «regDefId» LexTerm : •{ LexPattern } «regDefId» @@ -2029,17 +2020,26 @@ S60{ LexTerm : •. «{» LexTerm : •char_lit «{» LexTerm : •char_lit - char_lit «{» - LexTerm : •- char_lit «{» - LexTerm : •- ( char_lit - char_lit ) «{» + LexTerm : •~ char_lit «{» + LexTerm : •~ ( char_lit - char_lit ) «{» LexTerm : •regDefId «{» LexTerm : •[ LexPattern ] «{» LexTerm : •{ LexPattern } «{» LexTerm : •( LexPattern ) «{» + LexTerm : •. «~» + LexTerm : •char_lit «~» + LexTerm : •char_lit - char_lit «~» + LexTerm : •~ char_lit «~» + LexTerm : •~ ( char_lit - char_lit ) «~» + LexTerm : •regDefId «~» + LexTerm : •[ LexPattern ] «~» + LexTerm : •{ LexPattern } «~» + LexTerm : •( LexPattern ) «~» LexTerm : •. «|» LexTerm : •char_lit «|» LexTerm : •char_lit - char_lit «|» - LexTerm : •- char_lit «|» - LexTerm : •- ( char_lit - char_lit ) «|» + LexTerm : •~ char_lit «|» + LexTerm : •~ ( char_lit - char_lit ) «|» LexTerm : •regDefId «|» LexTerm : •[ LexPattern ] «|» LexTerm : •{ LexPattern } «|» @@ -2051,7 +2051,7 @@ Transitions: regDefId -> 56 . -> 57 char_lit -> 58 - - -> 59 + ~ -> 59 ( -> 60 [ -> 61 { -> 62 @@ -2061,12 +2061,12 @@ Transitions: S61{ LexTerm : [ •LexPattern ] «)» LexTerm : [ •LexPattern ] «(» - LexTerm : [ •LexPattern ] «-» LexTerm : [ •LexPattern ] «.» LexTerm : [ •LexPattern ] «[» LexTerm : [ •LexPattern ] «char_lit» LexTerm : [ •LexPattern ] «regDefId» LexTerm : [ •LexPattern ] «{» + LexTerm : [ •LexPattern ] «~» LexTerm : [ •LexPattern ] «|» LexPattern : •LexAlt «]» LexPattern : •LexPattern | LexAlt «]» @@ -2077,51 +2077,42 @@ S61{ LexTerm : •. «]» LexTerm : •char_lit «]» LexTerm : •char_lit - char_lit «]» - LexTerm : •- char_lit «]» - LexTerm : •- ( char_lit - char_lit ) «]» + LexTerm : •~ char_lit «]» + LexTerm : •~ ( char_lit - char_lit ) «]» LexTerm : •regDefId «]» LexTerm : •[ LexPattern ] «]» LexTerm : •{ LexPattern } «]» LexTerm : •( LexPattern ) «]» LexAlt : •LexTerm «(» - LexAlt : •LexTerm «-» LexAlt : •LexTerm «.» LexAlt : •LexTerm «[» LexAlt : •LexTerm «char_lit» LexAlt : •LexTerm «regDefId» LexAlt : •LexTerm «{» + LexAlt : •LexTerm «~» LexAlt : •LexAlt LexTerm «(» - LexAlt : •LexAlt LexTerm «-» LexAlt : •LexAlt LexTerm «.» LexAlt : •LexAlt LexTerm «[» LexAlt : •LexAlt LexTerm «char_lit» LexAlt : •LexAlt LexTerm «regDefId» LexAlt : •LexAlt LexTerm «{» + LexAlt : •LexAlt LexTerm «~» LexAlt : •LexTerm «|» LexAlt : •LexAlt LexTerm «|» LexTerm : •. «(» LexTerm : •char_lit «(» LexTerm : •char_lit - char_lit «(» - LexTerm : •- char_lit «(» - LexTerm : •- ( char_lit - char_lit ) «(» + LexTerm : •~ char_lit «(» + LexTerm : •~ ( char_lit - char_lit ) «(» LexTerm : •regDefId «(» LexTerm : •[ LexPattern ] «(» LexTerm : •{ LexPattern } «(» LexTerm : •( LexPattern ) «(» - LexTerm : •. «-» - LexTerm : •char_lit «-» - LexTerm : •char_lit - char_lit «-» - LexTerm : •- char_lit «-» - LexTerm : •- ( char_lit - char_lit ) «-» - LexTerm : •regDefId «-» - LexTerm : •[ LexPattern ] «-» - LexTerm : •{ LexPattern } «-» - LexTerm : •( LexPattern ) «-» LexTerm : •. «.» LexTerm : •char_lit «.» LexTerm : •char_lit - char_lit «.» - LexTerm : •- char_lit «.» - LexTerm : •- ( char_lit - char_lit ) «.» + LexTerm : •~ char_lit «.» + LexTerm : •~ ( char_lit - char_lit ) «.» LexTerm : •regDefId «.» LexTerm : •[ LexPattern ] «.» LexTerm : •{ LexPattern } «.» @@ -2129,8 +2120,8 @@ S61{ LexTerm : •. «[» LexTerm : •char_lit «[» LexTerm : •char_lit - char_lit «[» - LexTerm : •- char_lit «[» - LexTerm : •- ( char_lit - char_lit ) «[» + LexTerm : •~ char_lit «[» + LexTerm : •~ ( char_lit - char_lit ) «[» LexTerm : •regDefId «[» LexTerm : •[ LexPattern ] «[» LexTerm : •{ LexPattern } «[» @@ -2138,8 +2129,8 @@ S61{ LexTerm : •. «char_lit» LexTerm : •char_lit «char_lit» LexTerm : •char_lit - char_lit «char_lit» - LexTerm : •- char_lit «char_lit» - LexTerm : •- ( char_lit - char_lit ) «char_lit» + LexTerm : •~ char_lit «char_lit» + LexTerm : •~ ( char_lit - char_lit ) «char_lit» LexTerm : •regDefId «char_lit» LexTerm : •[ LexPattern ] «char_lit» LexTerm : •{ LexPattern } «char_lit» @@ -2147,8 +2138,8 @@ S61{ LexTerm : •. «regDefId» LexTerm : •char_lit «regDefId» LexTerm : •char_lit - char_lit «regDefId» - LexTerm : •- char_lit «regDefId» - LexTerm : •- ( char_lit - char_lit ) «regDefId» + LexTerm : •~ char_lit «regDefId» + LexTerm : •~ ( char_lit - char_lit ) «regDefId» LexTerm : •regDefId «regDefId» LexTerm : •[ LexPattern ] «regDefId» LexTerm : •{ LexPattern } «regDefId» @@ -2156,17 +2147,26 @@ S61{ LexTerm : •. «{» LexTerm : •char_lit «{» LexTerm : •char_lit - char_lit «{» - LexTerm : •- char_lit «{» - LexTerm : •- ( char_lit - char_lit ) «{» + LexTerm : •~ char_lit «{» + LexTerm : •~ ( char_lit - char_lit ) «{» LexTerm : •regDefId «{» LexTerm : •[ LexPattern ] «{» LexTerm : •{ LexPattern } «{» LexTerm : •( LexPattern ) «{» + LexTerm : •. «~» + LexTerm : •char_lit «~» + LexTerm : •char_lit - char_lit «~» + LexTerm : •~ char_lit «~» + LexTerm : •~ ( char_lit - char_lit ) «~» + LexTerm : •regDefId «~» + LexTerm : •[ LexPattern ] «~» + LexTerm : •{ LexPattern } «~» + LexTerm : •( LexPattern ) «~» LexTerm : •. «|» LexTerm : •char_lit «|» LexTerm : •char_lit - char_lit «|» - LexTerm : •- char_lit «|» - LexTerm : •- ( char_lit - char_lit ) «|» + LexTerm : •~ char_lit «|» + LexTerm : •~ ( char_lit - char_lit ) «|» LexTerm : •regDefId «|» LexTerm : •[ LexPattern ] «|» LexTerm : •{ LexPattern } «|» @@ -2178,7 +2178,7 @@ Transitions: regDefId -> 66 . -> 67 char_lit -> 68 - - -> 69 + ~ -> 69 ( -> 70 [ -> 71 { -> 72 @@ -2188,12 +2188,12 @@ Transitions: S62{ LexTerm : { •LexPattern } «)» LexTerm : { •LexPattern } «(» - LexTerm : { •LexPattern } «-» LexTerm : { •LexPattern } «.» LexTerm : { •LexPattern } «[» LexTerm : { •LexPattern } «char_lit» LexTerm : { •LexPattern } «regDefId» LexTerm : { •LexPattern } «{» + LexTerm : { •LexPattern } «~» LexTerm : { •LexPattern } «|» LexPattern : •LexAlt «}» LexPattern : •LexPattern | LexAlt «}» @@ -2204,51 +2204,42 @@ S62{ LexTerm : •. «}» LexTerm : •char_lit «}» LexTerm : •char_lit - char_lit «}» - LexTerm : •- char_lit «}» - LexTerm : •- ( char_lit - char_lit ) «}» + LexTerm : •~ char_lit «}» + LexTerm : •~ ( char_lit - char_lit ) «}» LexTerm : •regDefId «}» LexTerm : •[ LexPattern ] «}» LexTerm : •{ LexPattern } «}» LexTerm : •( LexPattern ) «}» LexAlt : •LexTerm «(» - LexAlt : •LexTerm «-» LexAlt : •LexTerm «.» LexAlt : •LexTerm «[» LexAlt : •LexTerm «char_lit» LexAlt : •LexTerm «regDefId» LexAlt : •LexTerm «{» + LexAlt : •LexTerm «~» LexAlt : •LexAlt LexTerm «(» - LexAlt : •LexAlt LexTerm «-» LexAlt : •LexAlt LexTerm «.» LexAlt : •LexAlt LexTerm «[» LexAlt : •LexAlt LexTerm «char_lit» LexAlt : •LexAlt LexTerm «regDefId» LexAlt : •LexAlt LexTerm «{» + LexAlt : •LexAlt LexTerm «~» LexAlt : •LexTerm «|» LexAlt : •LexAlt LexTerm «|» LexTerm : •. «(» LexTerm : •char_lit «(» LexTerm : •char_lit - char_lit «(» - LexTerm : •- char_lit «(» - LexTerm : •- ( char_lit - char_lit ) «(» + LexTerm : •~ char_lit «(» + LexTerm : •~ ( char_lit - char_lit ) «(» LexTerm : •regDefId «(» LexTerm : •[ LexPattern ] «(» LexTerm : •{ LexPattern } «(» LexTerm : •( LexPattern ) «(» - LexTerm : •. «-» - LexTerm : •char_lit «-» - LexTerm : •char_lit - char_lit «-» - LexTerm : •- char_lit «-» - LexTerm : •- ( char_lit - char_lit ) «-» - LexTerm : •regDefId «-» - LexTerm : •[ LexPattern ] «-» - LexTerm : •{ LexPattern } «-» - LexTerm : •( LexPattern ) «-» LexTerm : •. «.» LexTerm : •char_lit «.» LexTerm : •char_lit - char_lit «.» - LexTerm : •- char_lit «.» - LexTerm : •- ( char_lit - char_lit ) «.» + LexTerm : •~ char_lit «.» + LexTerm : •~ ( char_lit - char_lit ) «.» LexTerm : •regDefId «.» LexTerm : •[ LexPattern ] «.» LexTerm : •{ LexPattern } «.» @@ -2256,8 +2247,8 @@ S62{ LexTerm : •. «[» LexTerm : •char_lit «[» LexTerm : •char_lit - char_lit «[» - LexTerm : •- char_lit «[» - LexTerm : •- ( char_lit - char_lit ) «[» + LexTerm : •~ char_lit «[» + LexTerm : •~ ( char_lit - char_lit ) «[» LexTerm : •regDefId «[» LexTerm : •[ LexPattern ] «[» LexTerm : •{ LexPattern } «[» @@ -2265,8 +2256,8 @@ S62{ LexTerm : •. «char_lit» LexTerm : •char_lit «char_lit» LexTerm : •char_lit - char_lit «char_lit» - LexTerm : •- char_lit «char_lit» - LexTerm : •- ( char_lit - char_lit ) «char_lit» + LexTerm : •~ char_lit «char_lit» + LexTerm : •~ ( char_lit - char_lit ) «char_lit» LexTerm : •regDefId «char_lit» LexTerm : •[ LexPattern ] «char_lit» LexTerm : •{ LexPattern } «char_lit» @@ -2274,8 +2265,8 @@ S62{ LexTerm : •. «regDefId» LexTerm : •char_lit «regDefId» LexTerm : •char_lit - char_lit «regDefId» - LexTerm : •- char_lit «regDefId» - LexTerm : •- ( char_lit - char_lit ) «regDefId» + LexTerm : •~ char_lit «regDefId» + LexTerm : •~ ( char_lit - char_lit ) «regDefId» LexTerm : •regDefId «regDefId» LexTerm : •[ LexPattern ] «regDefId» LexTerm : •{ LexPattern } «regDefId» @@ -2283,17 +2274,26 @@ S62{ LexTerm : •. «{» LexTerm : •char_lit «{» LexTerm : •char_lit - char_lit «{» - LexTerm : •- char_lit «{» - LexTerm : •- ( char_lit - char_lit ) «{» + LexTerm : •~ char_lit «{» + LexTerm : •~ ( char_lit - char_lit ) «{» LexTerm : •regDefId «{» LexTerm : •[ LexPattern ] «{» LexTerm : •{ LexPattern } «{» LexTerm : •( LexPattern ) «{» + LexTerm : •. «~» + LexTerm : •char_lit «~» + LexTerm : •char_lit - char_lit «~» + LexTerm : •~ char_lit «~» + LexTerm : •~ ( char_lit - char_lit ) «~» + LexTerm : •regDefId «~» + LexTerm : •[ LexPattern ] «~» + LexTerm : •{ LexPattern } «~» + LexTerm : •( LexPattern ) «~» LexTerm : •. «|» LexTerm : •char_lit «|» LexTerm : •char_lit - char_lit «|» - LexTerm : •- char_lit «|» - LexTerm : •- ( char_lit - char_lit ) «|» + LexTerm : •~ char_lit «|» + LexTerm : •~ ( char_lit - char_lit ) «|» LexTerm : •regDefId «|» LexTerm : •[ LexPattern ] «|» LexTerm : •{ LexPattern } «|» @@ -2305,7 +2305,7 @@ Transitions: regDefId -> 76 . -> 77 char_lit -> 78 - - -> 79 + ~ -> 79 ( -> 80 [ -> 81 { -> 82 @@ -2315,12 +2315,12 @@ Transitions: S63{ LexTerm : [ LexPattern •] «;» LexTerm : [ LexPattern •] «(» - LexTerm : [ LexPattern •] «-» LexTerm : [ LexPattern •] «.» LexTerm : [ LexPattern •] «[» LexTerm : [ LexPattern •] «char_lit» LexTerm : [ LexPattern •] «regDefId» LexTerm : [ LexPattern •] «{» + LexTerm : [ LexPattern •] «~» LexTerm : [ LexPattern •] «|» LexPattern : LexPattern •| LexAlt «]» LexPattern : LexPattern •| LexAlt «|» @@ -2335,18 +2335,18 @@ S64{ LexAlt : LexAlt •LexTerm «]» LexPattern : LexAlt• «|» LexAlt : LexAlt •LexTerm «(» - LexAlt : LexAlt •LexTerm «-» LexAlt : LexAlt •LexTerm «.» LexAlt : LexAlt •LexTerm «[» LexAlt : LexAlt •LexTerm «char_lit» LexAlt : LexAlt •LexTerm «regDefId» LexAlt : LexAlt •LexTerm «{» + LexAlt : LexAlt •LexTerm «~» LexAlt : LexAlt •LexTerm «|» LexTerm : •. «]» LexTerm : •char_lit «]» LexTerm : •char_lit - char_lit «]» - LexTerm : •- char_lit «]» - LexTerm : •- ( char_lit - char_lit ) «]» + LexTerm : •~ char_lit «]» + LexTerm : •~ ( char_lit - char_lit ) «]» LexTerm : •regDefId «]» LexTerm : •[ LexPattern ] «]» LexTerm : •{ LexPattern } «]» @@ -2354,26 +2354,17 @@ S64{ LexTerm : •. «(» LexTerm : •char_lit «(» LexTerm : •char_lit - char_lit «(» - LexTerm : •- char_lit «(» - LexTerm : •- ( char_lit - char_lit ) «(» + LexTerm : •~ char_lit «(» + LexTerm : •~ ( char_lit - char_lit ) «(» LexTerm : •regDefId «(» LexTerm : •[ LexPattern ] «(» LexTerm : •{ LexPattern } «(» LexTerm : •( LexPattern ) «(» - LexTerm : •. «-» - LexTerm : •char_lit «-» - LexTerm : •char_lit - char_lit «-» - LexTerm : •- char_lit «-» - LexTerm : •- ( char_lit - char_lit ) «-» - LexTerm : •regDefId «-» - LexTerm : •[ LexPattern ] «-» - LexTerm : •{ LexPattern } «-» - LexTerm : •( LexPattern ) «-» LexTerm : •. «.» LexTerm : •char_lit «.» LexTerm : •char_lit - char_lit «.» - LexTerm : •- char_lit «.» - LexTerm : •- ( char_lit - char_lit ) «.» + LexTerm : •~ char_lit «.» + LexTerm : •~ ( char_lit - char_lit ) «.» LexTerm : •regDefId «.» LexTerm : •[ LexPattern ] «.» LexTerm : •{ LexPattern } «.» @@ -2381,8 +2372,8 @@ S64{ LexTerm : •. «[» LexTerm : •char_lit «[» LexTerm : •char_lit - char_lit «[» - LexTerm : •- char_lit «[» - LexTerm : •- ( char_lit - char_lit ) «[» + LexTerm : •~ char_lit «[» + LexTerm : •~ ( char_lit - char_lit ) «[» LexTerm : •regDefId «[» LexTerm : •[ LexPattern ] «[» LexTerm : •{ LexPattern } «[» @@ -2390,8 +2381,8 @@ S64{ LexTerm : •. «char_lit» LexTerm : •char_lit «char_lit» LexTerm : •char_lit - char_lit «char_lit» - LexTerm : •- char_lit «char_lit» - LexTerm : •- ( char_lit - char_lit ) «char_lit» + LexTerm : •~ char_lit «char_lit» + LexTerm : •~ ( char_lit - char_lit ) «char_lit» LexTerm : •regDefId «char_lit» LexTerm : •[ LexPattern ] «char_lit» LexTerm : •{ LexPattern } «char_lit» @@ -2399,8 +2390,8 @@ S64{ LexTerm : •. «regDefId» LexTerm : •char_lit «regDefId» LexTerm : •char_lit - char_lit «regDefId» - LexTerm : •- char_lit «regDefId» - LexTerm : •- ( char_lit - char_lit ) «regDefId» + LexTerm : •~ char_lit «regDefId» + LexTerm : •~ ( char_lit - char_lit ) «regDefId» LexTerm : •regDefId «regDefId» LexTerm : •[ LexPattern ] «regDefId» LexTerm : •{ LexPattern } «regDefId» @@ -2408,17 +2399,26 @@ S64{ LexTerm : •. «{» LexTerm : •char_lit «{» LexTerm : •char_lit - char_lit «{» - LexTerm : •- char_lit «{» - LexTerm : •- ( char_lit - char_lit ) «{» + LexTerm : •~ char_lit «{» + LexTerm : •~ ( char_lit - char_lit ) «{» LexTerm : •regDefId «{» LexTerm : •[ LexPattern ] «{» LexTerm : •{ LexPattern } «{» LexTerm : •( LexPattern ) «{» + LexTerm : •. «~» + LexTerm : •char_lit «~» + LexTerm : •char_lit - char_lit «~» + LexTerm : •~ char_lit «~» + LexTerm : •~ ( char_lit - char_lit ) «~» + LexTerm : •regDefId «~» + LexTerm : •[ LexPattern ] «~» + LexTerm : •{ LexPattern } «~» + LexTerm : •( LexPattern ) «~» LexTerm : •. «|» LexTerm : •char_lit «|» LexTerm : •char_lit - char_lit «|» - LexTerm : •- char_lit «|» - LexTerm : •- ( char_lit - char_lit ) «|» + LexTerm : •~ char_lit «|» + LexTerm : •~ ( char_lit - char_lit ) «|» LexTerm : •regDefId «|» LexTerm : •[ LexPattern ] «|» LexTerm : •{ LexPattern } «|» @@ -2428,7 +2428,7 @@ Transitions: regDefId -> 66 . -> 67 char_lit -> 68 - - -> 69 + ~ -> 69 ( -> 70 [ -> 71 { -> 72 @@ -2438,12 +2438,12 @@ Transitions: S65{ LexAlt : LexTerm• «]» LexAlt : LexTerm• «(» - LexAlt : LexTerm• «-» LexAlt : LexTerm• «.» LexAlt : LexTerm• «[» LexAlt : LexTerm• «char_lit» LexAlt : LexTerm• «regDefId» LexAlt : LexTerm• «{» + LexAlt : LexTerm• «~» LexAlt : LexTerm• «|» } Transitions: @@ -2452,12 +2452,12 @@ Transitions: S66{ LexTerm : regDefId• «]» LexTerm : regDefId• «(» - LexTerm : regDefId• «-» LexTerm : regDefId• «.» LexTerm : regDefId• «[» LexTerm : regDefId• «char_lit» LexTerm : regDefId• «regDefId» LexTerm : regDefId• «{» + LexTerm : regDefId• «~» LexTerm : regDefId• «|» } Transitions: @@ -2466,12 +2466,12 @@ Transitions: S67{ LexTerm : .• «]» LexTerm : .• «(» - LexTerm : .• «-» LexTerm : .• «.» LexTerm : .• «[» LexTerm : .• «char_lit» LexTerm : .• «regDefId» LexTerm : .• «{» + LexTerm : .• «~» LexTerm : .• «|» } Transitions: @@ -2482,8 +2482,6 @@ S68{ LexTerm : char_lit •- char_lit «]» LexTerm : char_lit• «(» LexTerm : char_lit •- char_lit «(» - LexTerm : char_lit• «-» - LexTerm : char_lit •- char_lit «-» LexTerm : char_lit• «.» LexTerm : char_lit •- char_lit «.» LexTerm : char_lit• «[» @@ -2494,6 +2492,8 @@ S68{ LexTerm : char_lit •- char_lit «regDefId» LexTerm : char_lit• «{» LexTerm : char_lit •- char_lit «{» + LexTerm : char_lit• «~» + LexTerm : char_lit •- char_lit «~» LexTerm : char_lit• «|» LexTerm : char_lit •- char_lit «|» } @@ -2502,24 +2502,24 @@ Transitions: S69{ - LexTerm : - •char_lit «]» - LexTerm : - •( char_lit - char_lit ) «]» - LexTerm : - •char_lit «(» - LexTerm : - •( char_lit - char_lit ) «(» - LexTerm : - •char_lit «-» - LexTerm : - •( char_lit - char_lit ) «-» - LexTerm : - •char_lit «.» - LexTerm : - •( char_lit - char_lit ) «.» - LexTerm : - •char_lit «[» - LexTerm : - •( char_lit - char_lit ) «[» - LexTerm : - •char_lit «char_lit» - LexTerm : - •( char_lit - char_lit ) «char_lit» - LexTerm : - •char_lit «regDefId» - LexTerm : - •( char_lit - char_lit ) «regDefId» - LexTerm : - •char_lit «{» - LexTerm : - •( char_lit - char_lit ) «{» - LexTerm : - •char_lit «|» - LexTerm : - •( char_lit - char_lit ) «|» + LexTerm : ~ •char_lit «]» + LexTerm : ~ •( char_lit - char_lit ) «]» + LexTerm : ~ •char_lit «(» + LexTerm : ~ •( char_lit - char_lit ) «(» + LexTerm : ~ •char_lit «.» + LexTerm : ~ •( char_lit - char_lit ) «.» + LexTerm : ~ •char_lit «[» + LexTerm : ~ •( char_lit - char_lit ) «[» + LexTerm : ~ •char_lit «char_lit» + LexTerm : ~ •( char_lit - char_lit ) «char_lit» + LexTerm : ~ •char_lit «regDefId» + LexTerm : ~ •( char_lit - char_lit ) «regDefId» + LexTerm : ~ •char_lit «{» + LexTerm : ~ •( char_lit - char_lit ) «{» + LexTerm : ~ •char_lit «~» + LexTerm : ~ •( char_lit - char_lit ) «~» + LexTerm : ~ •char_lit «|» + LexTerm : ~ •( char_lit - char_lit ) «|» } Transitions: char_lit -> 107 @@ -2529,12 +2529,12 @@ Transitions: S70{ LexTerm : ( •LexPattern ) «]» LexTerm : ( •LexPattern ) «(» - LexTerm : ( •LexPattern ) «-» LexTerm : ( •LexPattern ) «.» LexTerm : ( •LexPattern ) «[» LexTerm : ( •LexPattern ) «char_lit» LexTerm : ( •LexPattern ) «regDefId» LexTerm : ( •LexPattern ) «{» + LexTerm : ( •LexPattern ) «~» LexTerm : ( •LexPattern ) «|» LexPattern : •LexAlt «)» LexPattern : •LexPattern | LexAlt «)» @@ -2545,51 +2545,42 @@ S70{ LexTerm : •. «)» LexTerm : •char_lit «)» LexTerm : •char_lit - char_lit «)» - LexTerm : •- char_lit «)» - LexTerm : •- ( char_lit - char_lit ) «)» + LexTerm : •~ char_lit «)» + LexTerm : •~ ( char_lit - char_lit ) «)» LexTerm : •regDefId «)» LexTerm : •[ LexPattern ] «)» LexTerm : •{ LexPattern } «)» LexTerm : •( LexPattern ) «)» LexAlt : •LexTerm «(» - LexAlt : •LexTerm «-» LexAlt : •LexTerm «.» LexAlt : •LexTerm «[» LexAlt : •LexTerm «char_lit» LexAlt : •LexTerm «regDefId» LexAlt : •LexTerm «{» + LexAlt : •LexTerm «~» LexAlt : •LexAlt LexTerm «(» - LexAlt : •LexAlt LexTerm «-» LexAlt : •LexAlt LexTerm «.» LexAlt : •LexAlt LexTerm «[» LexAlt : •LexAlt LexTerm «char_lit» LexAlt : •LexAlt LexTerm «regDefId» LexAlt : •LexAlt LexTerm «{» + LexAlt : •LexAlt LexTerm «~» LexAlt : •LexTerm «|» LexAlt : •LexAlt LexTerm «|» LexTerm : •. «(» LexTerm : •char_lit «(» LexTerm : •char_lit - char_lit «(» - LexTerm : •- char_lit «(» - LexTerm : •- ( char_lit - char_lit ) «(» + LexTerm : •~ char_lit «(» + LexTerm : •~ ( char_lit - char_lit ) «(» LexTerm : •regDefId «(» LexTerm : •[ LexPattern ] «(» LexTerm : •{ LexPattern } «(» LexTerm : •( LexPattern ) «(» - LexTerm : •. «-» - LexTerm : •char_lit «-» - LexTerm : •char_lit - char_lit «-» - LexTerm : •- char_lit «-» - LexTerm : •- ( char_lit - char_lit ) «-» - LexTerm : •regDefId «-» - LexTerm : •[ LexPattern ] «-» - LexTerm : •{ LexPattern } «-» - LexTerm : •( LexPattern ) «-» LexTerm : •. «.» LexTerm : •char_lit «.» LexTerm : •char_lit - char_lit «.» - LexTerm : •- char_lit «.» - LexTerm : •- ( char_lit - char_lit ) «.» + LexTerm : •~ char_lit «.» + LexTerm : •~ ( char_lit - char_lit ) «.» LexTerm : •regDefId «.» LexTerm : •[ LexPattern ] «.» LexTerm : •{ LexPattern } «.» @@ -2597,8 +2588,8 @@ S70{ LexTerm : •. «[» LexTerm : •char_lit «[» LexTerm : •char_lit - char_lit «[» - LexTerm : •- char_lit «[» - LexTerm : •- ( char_lit - char_lit ) «[» + LexTerm : •~ char_lit «[» + LexTerm : •~ ( char_lit - char_lit ) «[» LexTerm : •regDefId «[» LexTerm : •[ LexPattern ] «[» LexTerm : •{ LexPattern } «[» @@ -2606,8 +2597,8 @@ S70{ LexTerm : •. «char_lit» LexTerm : •char_lit «char_lit» LexTerm : •char_lit - char_lit «char_lit» - LexTerm : •- char_lit «char_lit» - LexTerm : •- ( char_lit - char_lit ) «char_lit» + LexTerm : •~ char_lit «char_lit» + LexTerm : •~ ( char_lit - char_lit ) «char_lit» LexTerm : •regDefId «char_lit» LexTerm : •[ LexPattern ] «char_lit» LexTerm : •{ LexPattern } «char_lit» @@ -2615,8 +2606,8 @@ S70{ LexTerm : •. «regDefId» LexTerm : •char_lit «regDefId» LexTerm : •char_lit - char_lit «regDefId» - LexTerm : •- char_lit «regDefId» - LexTerm : •- ( char_lit - char_lit ) «regDefId» + LexTerm : •~ char_lit «regDefId» + LexTerm : •~ ( char_lit - char_lit ) «regDefId» LexTerm : •regDefId «regDefId» LexTerm : •[ LexPattern ] «regDefId» LexTerm : •{ LexPattern } «regDefId» @@ -2624,17 +2615,26 @@ S70{ LexTerm : •. «{» LexTerm : •char_lit «{» LexTerm : •char_lit - char_lit «{» - LexTerm : •- char_lit «{» - LexTerm : •- ( char_lit - char_lit ) «{» + LexTerm : •~ char_lit «{» + LexTerm : •~ ( char_lit - char_lit ) «{» LexTerm : •regDefId «{» LexTerm : •[ LexPattern ] «{» LexTerm : •{ LexPattern } «{» LexTerm : •( LexPattern ) «{» + LexTerm : •. «~» + LexTerm : •char_lit «~» + LexTerm : •char_lit - char_lit «~» + LexTerm : •~ char_lit «~» + LexTerm : •~ ( char_lit - char_lit ) «~» + LexTerm : •regDefId «~» + LexTerm : •[ LexPattern ] «~» + LexTerm : •{ LexPattern } «~» + LexTerm : •( LexPattern ) «~» LexTerm : •. «|» LexTerm : •char_lit «|» LexTerm : •char_lit - char_lit «|» - LexTerm : •- char_lit «|» - LexTerm : •- ( char_lit - char_lit ) «|» + LexTerm : •~ char_lit «|» + LexTerm : •~ ( char_lit - char_lit ) «|» LexTerm : •regDefId «|» LexTerm : •[ LexPattern ] «|» LexTerm : •{ LexPattern } «|» @@ -2646,7 +2646,7 @@ Transitions: regDefId -> 56 . -> 57 char_lit -> 58 - - -> 59 + ~ -> 59 ( -> 60 [ -> 61 { -> 62 @@ -2656,12 +2656,12 @@ Transitions: S71{ LexTerm : [ •LexPattern ] «]» LexTerm : [ •LexPattern ] «(» - LexTerm : [ •LexPattern ] «-» LexTerm : [ •LexPattern ] «.» LexTerm : [ •LexPattern ] «[» LexTerm : [ •LexPattern ] «char_lit» LexTerm : [ •LexPattern ] «regDefId» LexTerm : [ •LexPattern ] «{» + LexTerm : [ •LexPattern ] «~» LexTerm : [ •LexPattern ] «|» LexPattern : •LexAlt «]» LexPattern : •LexPattern | LexAlt «]» @@ -2672,51 +2672,42 @@ S71{ LexTerm : •. «]» LexTerm : •char_lit «]» LexTerm : •char_lit - char_lit «]» - LexTerm : •- char_lit «]» - LexTerm : •- ( char_lit - char_lit ) «]» + LexTerm : •~ char_lit «]» + LexTerm : •~ ( char_lit - char_lit ) «]» LexTerm : •regDefId «]» LexTerm : •[ LexPattern ] «]» LexTerm : •{ LexPattern } «]» LexTerm : •( LexPattern ) «]» LexAlt : •LexTerm «(» - LexAlt : •LexTerm «-» LexAlt : •LexTerm «.» LexAlt : •LexTerm «[» LexAlt : •LexTerm «char_lit» LexAlt : •LexTerm «regDefId» LexAlt : •LexTerm «{» + LexAlt : •LexTerm «~» LexAlt : •LexAlt LexTerm «(» - LexAlt : •LexAlt LexTerm «-» LexAlt : •LexAlt LexTerm «.» LexAlt : •LexAlt LexTerm «[» LexAlt : •LexAlt LexTerm «char_lit» LexAlt : •LexAlt LexTerm «regDefId» LexAlt : •LexAlt LexTerm «{» + LexAlt : •LexAlt LexTerm «~» LexAlt : •LexTerm «|» LexAlt : •LexAlt LexTerm «|» LexTerm : •. «(» LexTerm : •char_lit «(» LexTerm : •char_lit - char_lit «(» - LexTerm : •- char_lit «(» - LexTerm : •- ( char_lit - char_lit ) «(» + LexTerm : •~ char_lit «(» + LexTerm : •~ ( char_lit - char_lit ) «(» LexTerm : •regDefId «(» LexTerm : •[ LexPattern ] «(» LexTerm : •{ LexPattern } «(» LexTerm : •( LexPattern ) «(» - LexTerm : •. «-» - LexTerm : •char_lit «-» - LexTerm : •char_lit - char_lit «-» - LexTerm : •- char_lit «-» - LexTerm : •- ( char_lit - char_lit ) «-» - LexTerm : •regDefId «-» - LexTerm : •[ LexPattern ] «-» - LexTerm : •{ LexPattern } «-» - LexTerm : •( LexPattern ) «-» LexTerm : •. «.» LexTerm : •char_lit «.» LexTerm : •char_lit - char_lit «.» - LexTerm : •- char_lit «.» - LexTerm : •- ( char_lit - char_lit ) «.» + LexTerm : •~ char_lit «.» + LexTerm : •~ ( char_lit - char_lit ) «.» LexTerm : •regDefId «.» LexTerm : •[ LexPattern ] «.» LexTerm : •{ LexPattern } «.» @@ -2724,8 +2715,8 @@ S71{ LexTerm : •. «[» LexTerm : •char_lit «[» LexTerm : •char_lit - char_lit «[» - LexTerm : •- char_lit «[» - LexTerm : •- ( char_lit - char_lit ) «[» + LexTerm : •~ char_lit «[» + LexTerm : •~ ( char_lit - char_lit ) «[» LexTerm : •regDefId «[» LexTerm : •[ LexPattern ] «[» LexTerm : •{ LexPattern } «[» @@ -2733,8 +2724,8 @@ S71{ LexTerm : •. «char_lit» LexTerm : •char_lit «char_lit» LexTerm : •char_lit - char_lit «char_lit» - LexTerm : •- char_lit «char_lit» - LexTerm : •- ( char_lit - char_lit ) «char_lit» + LexTerm : •~ char_lit «char_lit» + LexTerm : •~ ( char_lit - char_lit ) «char_lit» LexTerm : •regDefId «char_lit» LexTerm : •[ LexPattern ] «char_lit» LexTerm : •{ LexPattern } «char_lit» @@ -2742,8 +2733,8 @@ S71{ LexTerm : •. «regDefId» LexTerm : •char_lit «regDefId» LexTerm : •char_lit - char_lit «regDefId» - LexTerm : •- char_lit «regDefId» - LexTerm : •- ( char_lit - char_lit ) «regDefId» + LexTerm : •~ char_lit «regDefId» + LexTerm : •~ ( char_lit - char_lit ) «regDefId» LexTerm : •regDefId «regDefId» LexTerm : •[ LexPattern ] «regDefId» LexTerm : •{ LexPattern } «regDefId» @@ -2751,17 +2742,26 @@ S71{ LexTerm : •. «{» LexTerm : •char_lit «{» LexTerm : •char_lit - char_lit «{» - LexTerm : •- char_lit «{» - LexTerm : •- ( char_lit - char_lit ) «{» + LexTerm : •~ char_lit «{» + LexTerm : •~ ( char_lit - char_lit ) «{» LexTerm : •regDefId «{» LexTerm : •[ LexPattern ] «{» LexTerm : •{ LexPattern } «{» LexTerm : •( LexPattern ) «{» + LexTerm : •. «~» + LexTerm : •char_lit «~» + LexTerm : •char_lit - char_lit «~» + LexTerm : •~ char_lit «~» + LexTerm : •~ ( char_lit - char_lit ) «~» + LexTerm : •regDefId «~» + LexTerm : •[ LexPattern ] «~» + LexTerm : •{ LexPattern } «~» + LexTerm : •( LexPattern ) «~» LexTerm : •. «|» LexTerm : •char_lit «|» LexTerm : •char_lit - char_lit «|» - LexTerm : •- char_lit «|» - LexTerm : •- ( char_lit - char_lit ) «|» + LexTerm : •~ char_lit «|» + LexTerm : •~ ( char_lit - char_lit ) «|» LexTerm : •regDefId «|» LexTerm : •[ LexPattern ] «|» LexTerm : •{ LexPattern } «|» @@ -2773,7 +2773,7 @@ Transitions: regDefId -> 66 . -> 67 char_lit -> 68 - - -> 69 + ~ -> 69 ( -> 70 [ -> 71 { -> 72 @@ -2783,12 +2783,12 @@ Transitions: S72{ LexTerm : { •LexPattern } «]» LexTerm : { •LexPattern } «(» - LexTerm : { •LexPattern } «-» LexTerm : { •LexPattern } «.» LexTerm : { •LexPattern } «[» LexTerm : { •LexPattern } «char_lit» LexTerm : { •LexPattern } «regDefId» LexTerm : { •LexPattern } «{» + LexTerm : { •LexPattern } «~» LexTerm : { •LexPattern } «|» LexPattern : •LexAlt «}» LexPattern : •LexPattern | LexAlt «}» @@ -2799,51 +2799,42 @@ S72{ LexTerm : •. «}» LexTerm : •char_lit «}» LexTerm : •char_lit - char_lit «}» - LexTerm : •- char_lit «}» - LexTerm : •- ( char_lit - char_lit ) «}» + LexTerm : •~ char_lit «}» + LexTerm : •~ ( char_lit - char_lit ) «}» LexTerm : •regDefId «}» LexTerm : •[ LexPattern ] «}» LexTerm : •{ LexPattern } «}» LexTerm : •( LexPattern ) «}» LexAlt : •LexTerm «(» - LexAlt : •LexTerm «-» LexAlt : •LexTerm «.» LexAlt : •LexTerm «[» LexAlt : •LexTerm «char_lit» LexAlt : •LexTerm «regDefId» LexAlt : •LexTerm «{» + LexAlt : •LexTerm «~» LexAlt : •LexAlt LexTerm «(» - LexAlt : •LexAlt LexTerm «-» LexAlt : •LexAlt LexTerm «.» LexAlt : •LexAlt LexTerm «[» LexAlt : •LexAlt LexTerm «char_lit» LexAlt : •LexAlt LexTerm «regDefId» LexAlt : •LexAlt LexTerm «{» + LexAlt : •LexAlt LexTerm «~» LexAlt : •LexTerm «|» LexAlt : •LexAlt LexTerm «|» LexTerm : •. «(» LexTerm : •char_lit «(» LexTerm : •char_lit - char_lit «(» - LexTerm : •- char_lit «(» - LexTerm : •- ( char_lit - char_lit ) «(» + LexTerm : •~ char_lit «(» + LexTerm : •~ ( char_lit - char_lit ) «(» LexTerm : •regDefId «(» LexTerm : •[ LexPattern ] «(» LexTerm : •{ LexPattern } «(» LexTerm : •( LexPattern ) «(» - LexTerm : •. «-» - LexTerm : •char_lit «-» - LexTerm : •char_lit - char_lit «-» - LexTerm : •- char_lit «-» - LexTerm : •- ( char_lit - char_lit ) «-» - LexTerm : •regDefId «-» - LexTerm : •[ LexPattern ] «-» - LexTerm : •{ LexPattern } «-» - LexTerm : •( LexPattern ) «-» LexTerm : •. «.» LexTerm : •char_lit «.» LexTerm : •char_lit - char_lit «.» - LexTerm : •- char_lit «.» - LexTerm : •- ( char_lit - char_lit ) «.» + LexTerm : •~ char_lit «.» + LexTerm : •~ ( char_lit - char_lit ) «.» LexTerm : •regDefId «.» LexTerm : •[ LexPattern ] «.» LexTerm : •{ LexPattern } «.» @@ -2851,8 +2842,8 @@ S72{ LexTerm : •. «[» LexTerm : •char_lit «[» LexTerm : •char_lit - char_lit «[» - LexTerm : •- char_lit «[» - LexTerm : •- ( char_lit - char_lit ) «[» + LexTerm : •~ char_lit «[» + LexTerm : •~ ( char_lit - char_lit ) «[» LexTerm : •regDefId «[» LexTerm : •[ LexPattern ] «[» LexTerm : •{ LexPattern } «[» @@ -2860,8 +2851,8 @@ S72{ LexTerm : •. «char_lit» LexTerm : •char_lit «char_lit» LexTerm : •char_lit - char_lit «char_lit» - LexTerm : •- char_lit «char_lit» - LexTerm : •- ( char_lit - char_lit ) «char_lit» + LexTerm : •~ char_lit «char_lit» + LexTerm : •~ ( char_lit - char_lit ) «char_lit» LexTerm : •regDefId «char_lit» LexTerm : •[ LexPattern ] «char_lit» LexTerm : •{ LexPattern } «char_lit» @@ -2869,8 +2860,8 @@ S72{ LexTerm : •. «regDefId» LexTerm : •char_lit «regDefId» LexTerm : •char_lit - char_lit «regDefId» - LexTerm : •- char_lit «regDefId» - LexTerm : •- ( char_lit - char_lit ) «regDefId» + LexTerm : •~ char_lit «regDefId» + LexTerm : •~ ( char_lit - char_lit ) «regDefId» LexTerm : •regDefId «regDefId» LexTerm : •[ LexPattern ] «regDefId» LexTerm : •{ LexPattern } «regDefId» @@ -2878,17 +2869,26 @@ S72{ LexTerm : •. «{» LexTerm : •char_lit «{» LexTerm : •char_lit - char_lit «{» - LexTerm : •- char_lit «{» - LexTerm : •- ( char_lit - char_lit ) «{» + LexTerm : •~ char_lit «{» + LexTerm : •~ ( char_lit - char_lit ) «{» LexTerm : •regDefId «{» LexTerm : •[ LexPattern ] «{» LexTerm : •{ LexPattern } «{» LexTerm : •( LexPattern ) «{» + LexTerm : •. «~» + LexTerm : •char_lit «~» + LexTerm : •char_lit - char_lit «~» + LexTerm : •~ char_lit «~» + LexTerm : •~ ( char_lit - char_lit ) «~» + LexTerm : •regDefId «~» + LexTerm : •[ LexPattern ] «~» + LexTerm : •{ LexPattern } «~» + LexTerm : •( LexPattern ) «~» LexTerm : •. «|» LexTerm : •char_lit «|» LexTerm : •char_lit - char_lit «|» - LexTerm : •- char_lit «|» - LexTerm : •- ( char_lit - char_lit ) «|» + LexTerm : •~ char_lit «|» + LexTerm : •~ ( char_lit - char_lit ) «|» LexTerm : •regDefId «|» LexTerm : •[ LexPattern ] «|» LexTerm : •{ LexPattern } «|» @@ -2900,7 +2900,7 @@ Transitions: regDefId -> 76 . -> 77 char_lit -> 78 - - -> 79 + ~ -> 79 ( -> 80 [ -> 81 { -> 82 @@ -2910,12 +2910,12 @@ Transitions: S73{ LexTerm : { LexPattern •} «;» LexTerm : { LexPattern •} «(» - LexTerm : { LexPattern •} «-» LexTerm : { LexPattern •} «.» LexTerm : { LexPattern •} «[» LexTerm : { LexPattern •} «char_lit» LexTerm : { LexPattern •} «regDefId» LexTerm : { LexPattern •} «{» + LexTerm : { LexPattern •} «~» LexTerm : { LexPattern •} «|» LexPattern : LexPattern •| LexAlt «}» LexPattern : LexPattern •| LexAlt «|» @@ -2930,18 +2930,18 @@ S74{ LexAlt : LexAlt •LexTerm «}» LexPattern : LexAlt• «|» LexAlt : LexAlt •LexTerm «(» - LexAlt : LexAlt •LexTerm «-» LexAlt : LexAlt •LexTerm «.» LexAlt : LexAlt •LexTerm «[» LexAlt : LexAlt •LexTerm «char_lit» LexAlt : LexAlt •LexTerm «regDefId» LexAlt : LexAlt •LexTerm «{» + LexAlt : LexAlt •LexTerm «~» LexAlt : LexAlt •LexTerm «|» LexTerm : •. «}» LexTerm : •char_lit «}» LexTerm : •char_lit - char_lit «}» - LexTerm : •- char_lit «}» - LexTerm : •- ( char_lit - char_lit ) «}» + LexTerm : •~ char_lit «}» + LexTerm : •~ ( char_lit - char_lit ) «}» LexTerm : •regDefId «}» LexTerm : •[ LexPattern ] «}» LexTerm : •{ LexPattern } «}» @@ -2949,26 +2949,17 @@ S74{ LexTerm : •. «(» LexTerm : •char_lit «(» LexTerm : •char_lit - char_lit «(» - LexTerm : •- char_lit «(» - LexTerm : •- ( char_lit - char_lit ) «(» + LexTerm : •~ char_lit «(» + LexTerm : •~ ( char_lit - char_lit ) «(» LexTerm : •regDefId «(» LexTerm : •[ LexPattern ] «(» LexTerm : •{ LexPattern } «(» LexTerm : •( LexPattern ) «(» - LexTerm : •. «-» - LexTerm : •char_lit «-» - LexTerm : •char_lit - char_lit «-» - LexTerm : •- char_lit «-» - LexTerm : •- ( char_lit - char_lit ) «-» - LexTerm : •regDefId «-» - LexTerm : •[ LexPattern ] «-» - LexTerm : •{ LexPattern } «-» - LexTerm : •( LexPattern ) «-» LexTerm : •. «.» LexTerm : •char_lit «.» LexTerm : •char_lit - char_lit «.» - LexTerm : •- char_lit «.» - LexTerm : •- ( char_lit - char_lit ) «.» + LexTerm : •~ char_lit «.» + LexTerm : •~ ( char_lit - char_lit ) «.» LexTerm : •regDefId «.» LexTerm : •[ LexPattern ] «.» LexTerm : •{ LexPattern } «.» @@ -2976,8 +2967,8 @@ S74{ LexTerm : •. «[» LexTerm : •char_lit «[» LexTerm : •char_lit - char_lit «[» - LexTerm : •- char_lit «[» - LexTerm : •- ( char_lit - char_lit ) «[» + LexTerm : •~ char_lit «[» + LexTerm : •~ ( char_lit - char_lit ) «[» LexTerm : •regDefId «[» LexTerm : •[ LexPattern ] «[» LexTerm : •{ LexPattern } «[» @@ -2985,8 +2976,8 @@ S74{ LexTerm : •. «char_lit» LexTerm : •char_lit «char_lit» LexTerm : •char_lit - char_lit «char_lit» - LexTerm : •- char_lit «char_lit» - LexTerm : •- ( char_lit - char_lit ) «char_lit» + LexTerm : •~ char_lit «char_lit» + LexTerm : •~ ( char_lit - char_lit ) «char_lit» LexTerm : •regDefId «char_lit» LexTerm : •[ LexPattern ] «char_lit» LexTerm : •{ LexPattern } «char_lit» @@ -2994,8 +2985,8 @@ S74{ LexTerm : •. «regDefId» LexTerm : •char_lit «regDefId» LexTerm : •char_lit - char_lit «regDefId» - LexTerm : •- char_lit «regDefId» - LexTerm : •- ( char_lit - char_lit ) «regDefId» + LexTerm : •~ char_lit «regDefId» + LexTerm : •~ ( char_lit - char_lit ) «regDefId» LexTerm : •regDefId «regDefId» LexTerm : •[ LexPattern ] «regDefId» LexTerm : •{ LexPattern } «regDefId» @@ -3003,17 +2994,26 @@ S74{ LexTerm : •. «{» LexTerm : •char_lit «{» LexTerm : •char_lit - char_lit «{» - LexTerm : •- char_lit «{» - LexTerm : •- ( char_lit - char_lit ) «{» + LexTerm : •~ char_lit «{» + LexTerm : •~ ( char_lit - char_lit ) «{» LexTerm : •regDefId «{» LexTerm : •[ LexPattern ] «{» LexTerm : •{ LexPattern } «{» LexTerm : •( LexPattern ) «{» + LexTerm : •. «~» + LexTerm : •char_lit «~» + LexTerm : •char_lit - char_lit «~» + LexTerm : •~ char_lit «~» + LexTerm : •~ ( char_lit - char_lit ) «~» + LexTerm : •regDefId «~» + LexTerm : •[ LexPattern ] «~» + LexTerm : •{ LexPattern } «~» + LexTerm : •( LexPattern ) «~» LexTerm : •. «|» LexTerm : •char_lit «|» LexTerm : •char_lit - char_lit «|» - LexTerm : •- char_lit «|» - LexTerm : •- ( char_lit - char_lit ) «|» + LexTerm : •~ char_lit «|» + LexTerm : •~ ( char_lit - char_lit ) «|» LexTerm : •regDefId «|» LexTerm : •[ LexPattern ] «|» LexTerm : •{ LexPattern } «|» @@ -3023,7 +3023,7 @@ Transitions: regDefId -> 76 . -> 77 char_lit -> 78 - - -> 79 + ~ -> 79 ( -> 80 [ -> 81 { -> 82 @@ -3033,12 +3033,12 @@ Transitions: S75{ LexAlt : LexTerm• «}» LexAlt : LexTerm• «(» - LexAlt : LexTerm• «-» LexAlt : LexTerm• «.» LexAlt : LexTerm• «[» LexAlt : LexTerm• «char_lit» LexAlt : LexTerm• «regDefId» LexAlt : LexTerm• «{» + LexAlt : LexTerm• «~» LexAlt : LexTerm• «|» } Transitions: @@ -3047,12 +3047,12 @@ Transitions: S76{ LexTerm : regDefId• «}» LexTerm : regDefId• «(» - LexTerm : regDefId• «-» LexTerm : regDefId• «.» LexTerm : regDefId• «[» LexTerm : regDefId• «char_lit» LexTerm : regDefId• «regDefId» LexTerm : regDefId• «{» + LexTerm : regDefId• «~» LexTerm : regDefId• «|» } Transitions: @@ -3061,12 +3061,12 @@ Transitions: S77{ LexTerm : .• «}» LexTerm : .• «(» - LexTerm : .• «-» LexTerm : .• «.» LexTerm : .• «[» LexTerm : .• «char_lit» LexTerm : .• «regDefId» LexTerm : .• «{» + LexTerm : .• «~» LexTerm : .• «|» } Transitions: @@ -3077,8 +3077,6 @@ S78{ LexTerm : char_lit •- char_lit «}» LexTerm : char_lit• «(» LexTerm : char_lit •- char_lit «(» - LexTerm : char_lit• «-» - LexTerm : char_lit •- char_lit «-» LexTerm : char_lit• «.» LexTerm : char_lit •- char_lit «.» LexTerm : char_lit• «[» @@ -3089,6 +3087,8 @@ S78{ LexTerm : char_lit •- char_lit «regDefId» LexTerm : char_lit• «{» LexTerm : char_lit •- char_lit «{» + LexTerm : char_lit• «~» + LexTerm : char_lit •- char_lit «~» LexTerm : char_lit• «|» LexTerm : char_lit •- char_lit «|» } @@ -3097,24 +3097,24 @@ Transitions: S79{ - LexTerm : - •char_lit «}» - LexTerm : - •( char_lit - char_lit ) «}» - LexTerm : - •char_lit «(» - LexTerm : - •( char_lit - char_lit ) «(» - LexTerm : - •char_lit «-» - LexTerm : - •( char_lit - char_lit ) «-» - LexTerm : - •char_lit «.» - LexTerm : - •( char_lit - char_lit ) «.» - LexTerm : - •char_lit «[» - LexTerm : - •( char_lit - char_lit ) «[» - LexTerm : - •char_lit «char_lit» - LexTerm : - •( char_lit - char_lit ) «char_lit» - LexTerm : - •char_lit «regDefId» - LexTerm : - •( char_lit - char_lit ) «regDefId» - LexTerm : - •char_lit «{» - LexTerm : - •( char_lit - char_lit ) «{» - LexTerm : - •char_lit «|» - LexTerm : - •( char_lit - char_lit ) «|» + LexTerm : ~ •char_lit «}» + LexTerm : ~ •( char_lit - char_lit ) «}» + LexTerm : ~ •char_lit «(» + LexTerm : ~ •( char_lit - char_lit ) «(» + LexTerm : ~ •char_lit «.» + LexTerm : ~ •( char_lit - char_lit ) «.» + LexTerm : ~ •char_lit «[» + LexTerm : ~ •( char_lit - char_lit ) «[» + LexTerm : ~ •char_lit «char_lit» + LexTerm : ~ •( char_lit - char_lit ) «char_lit» + LexTerm : ~ •char_lit «regDefId» + LexTerm : ~ •( char_lit - char_lit ) «regDefId» + LexTerm : ~ •char_lit «{» + LexTerm : ~ •( char_lit - char_lit ) «{» + LexTerm : ~ •char_lit «~» + LexTerm : ~ •( char_lit - char_lit ) «~» + LexTerm : ~ •char_lit «|» + LexTerm : ~ •( char_lit - char_lit ) «|» } Transitions: char_lit -> 116 @@ -3124,12 +3124,12 @@ Transitions: S80{ LexTerm : ( •LexPattern ) «}» LexTerm : ( •LexPattern ) «(» - LexTerm : ( •LexPattern ) «-» LexTerm : ( •LexPattern ) «.» LexTerm : ( •LexPattern ) «[» LexTerm : ( •LexPattern ) «char_lit» LexTerm : ( •LexPattern ) «regDefId» LexTerm : ( •LexPattern ) «{» + LexTerm : ( •LexPattern ) «~» LexTerm : ( •LexPattern ) «|» LexPattern : •LexAlt «)» LexPattern : •LexPattern | LexAlt «)» @@ -3140,51 +3140,42 @@ S80{ LexTerm : •. «)» LexTerm : •char_lit «)» LexTerm : •char_lit - char_lit «)» - LexTerm : •- char_lit «)» - LexTerm : •- ( char_lit - char_lit ) «)» + LexTerm : •~ char_lit «)» + LexTerm : •~ ( char_lit - char_lit ) «)» LexTerm : •regDefId «)» LexTerm : •[ LexPattern ] «)» LexTerm : •{ LexPattern } «)» LexTerm : •( LexPattern ) «)» LexAlt : •LexTerm «(» - LexAlt : •LexTerm «-» LexAlt : •LexTerm «.» LexAlt : •LexTerm «[» LexAlt : •LexTerm «char_lit» LexAlt : •LexTerm «regDefId» LexAlt : •LexTerm «{» + LexAlt : •LexTerm «~» LexAlt : •LexAlt LexTerm «(» - LexAlt : •LexAlt LexTerm «-» LexAlt : •LexAlt LexTerm «.» LexAlt : •LexAlt LexTerm «[» LexAlt : •LexAlt LexTerm «char_lit» LexAlt : •LexAlt LexTerm «regDefId» LexAlt : •LexAlt LexTerm «{» + LexAlt : •LexAlt LexTerm «~» LexAlt : •LexTerm «|» LexAlt : •LexAlt LexTerm «|» LexTerm : •. «(» LexTerm : •char_lit «(» LexTerm : •char_lit - char_lit «(» - LexTerm : •- char_lit «(» - LexTerm : •- ( char_lit - char_lit ) «(» + LexTerm : •~ char_lit «(» + LexTerm : •~ ( char_lit - char_lit ) «(» LexTerm : •regDefId «(» LexTerm : •[ LexPattern ] «(» LexTerm : •{ LexPattern } «(» LexTerm : •( LexPattern ) «(» - LexTerm : •. «-» - LexTerm : •char_lit «-» - LexTerm : •char_lit - char_lit «-» - LexTerm : •- char_lit «-» - LexTerm : •- ( char_lit - char_lit ) «-» - LexTerm : •regDefId «-» - LexTerm : •[ LexPattern ] «-» - LexTerm : •{ LexPattern } «-» - LexTerm : •( LexPattern ) «-» LexTerm : •. «.» LexTerm : •char_lit «.» LexTerm : •char_lit - char_lit «.» - LexTerm : •- char_lit «.» - LexTerm : •- ( char_lit - char_lit ) «.» + LexTerm : •~ char_lit «.» + LexTerm : •~ ( char_lit - char_lit ) «.» LexTerm : •regDefId «.» LexTerm : •[ LexPattern ] «.» LexTerm : •{ LexPattern } «.» @@ -3192,8 +3183,8 @@ S80{ LexTerm : •. «[» LexTerm : •char_lit «[» LexTerm : •char_lit - char_lit «[» - LexTerm : •- char_lit «[» - LexTerm : •- ( char_lit - char_lit ) «[» + LexTerm : •~ char_lit «[» + LexTerm : •~ ( char_lit - char_lit ) «[» LexTerm : •regDefId «[» LexTerm : •[ LexPattern ] «[» LexTerm : •{ LexPattern } «[» @@ -3201,8 +3192,8 @@ S80{ LexTerm : •. «char_lit» LexTerm : •char_lit «char_lit» LexTerm : •char_lit - char_lit «char_lit» - LexTerm : •- char_lit «char_lit» - LexTerm : •- ( char_lit - char_lit ) «char_lit» + LexTerm : •~ char_lit «char_lit» + LexTerm : •~ ( char_lit - char_lit ) «char_lit» LexTerm : •regDefId «char_lit» LexTerm : •[ LexPattern ] «char_lit» LexTerm : •{ LexPattern } «char_lit» @@ -3210,8 +3201,8 @@ S80{ LexTerm : •. «regDefId» LexTerm : •char_lit «regDefId» LexTerm : •char_lit - char_lit «regDefId» - LexTerm : •- char_lit «regDefId» - LexTerm : •- ( char_lit - char_lit ) «regDefId» + LexTerm : •~ char_lit «regDefId» + LexTerm : •~ ( char_lit - char_lit ) «regDefId» LexTerm : •regDefId «regDefId» LexTerm : •[ LexPattern ] «regDefId» LexTerm : •{ LexPattern } «regDefId» @@ -3219,17 +3210,26 @@ S80{ LexTerm : •. «{» LexTerm : •char_lit «{» LexTerm : •char_lit - char_lit «{» - LexTerm : •- char_lit «{» - LexTerm : •- ( char_lit - char_lit ) «{» + LexTerm : •~ char_lit «{» + LexTerm : •~ ( char_lit - char_lit ) «{» LexTerm : •regDefId «{» LexTerm : •[ LexPattern ] «{» LexTerm : •{ LexPattern } «{» LexTerm : •( LexPattern ) «{» + LexTerm : •. «~» + LexTerm : •char_lit «~» + LexTerm : •char_lit - char_lit «~» + LexTerm : •~ char_lit «~» + LexTerm : •~ ( char_lit - char_lit ) «~» + LexTerm : •regDefId «~» + LexTerm : •[ LexPattern ] «~» + LexTerm : •{ LexPattern } «~» + LexTerm : •( LexPattern ) «~» LexTerm : •. «|» LexTerm : •char_lit «|» LexTerm : •char_lit - char_lit «|» - LexTerm : •- char_lit «|» - LexTerm : •- ( char_lit - char_lit ) «|» + LexTerm : •~ char_lit «|» + LexTerm : •~ ( char_lit - char_lit ) «|» LexTerm : •regDefId «|» LexTerm : •[ LexPattern ] «|» LexTerm : •{ LexPattern } «|» @@ -3241,7 +3241,7 @@ Transitions: regDefId -> 56 . -> 57 char_lit -> 58 - - -> 59 + ~ -> 59 ( -> 60 [ -> 61 { -> 62 @@ -3251,12 +3251,12 @@ Transitions: S81{ LexTerm : [ •LexPattern ] «}» LexTerm : [ •LexPattern ] «(» - LexTerm : [ •LexPattern ] «-» LexTerm : [ •LexPattern ] «.» LexTerm : [ •LexPattern ] «[» LexTerm : [ •LexPattern ] «char_lit» LexTerm : [ •LexPattern ] «regDefId» LexTerm : [ •LexPattern ] «{» + LexTerm : [ •LexPattern ] «~» LexTerm : [ •LexPattern ] «|» LexPattern : •LexAlt «]» LexPattern : •LexPattern | LexAlt «]» @@ -3267,51 +3267,42 @@ S81{ LexTerm : •. «]» LexTerm : •char_lit «]» LexTerm : •char_lit - char_lit «]» - LexTerm : •- char_lit «]» - LexTerm : •- ( char_lit - char_lit ) «]» + LexTerm : •~ char_lit «]» + LexTerm : •~ ( char_lit - char_lit ) «]» LexTerm : •regDefId «]» LexTerm : •[ LexPattern ] «]» LexTerm : •{ LexPattern } «]» LexTerm : •( LexPattern ) «]» LexAlt : •LexTerm «(» - LexAlt : •LexTerm «-» LexAlt : •LexTerm «.» LexAlt : •LexTerm «[» LexAlt : •LexTerm «char_lit» LexAlt : •LexTerm «regDefId» LexAlt : •LexTerm «{» + LexAlt : •LexTerm «~» LexAlt : •LexAlt LexTerm «(» - LexAlt : •LexAlt LexTerm «-» LexAlt : •LexAlt LexTerm «.» LexAlt : •LexAlt LexTerm «[» LexAlt : •LexAlt LexTerm «char_lit» LexAlt : •LexAlt LexTerm «regDefId» LexAlt : •LexAlt LexTerm «{» + LexAlt : •LexAlt LexTerm «~» LexAlt : •LexTerm «|» LexAlt : •LexAlt LexTerm «|» LexTerm : •. «(» LexTerm : •char_lit «(» LexTerm : •char_lit - char_lit «(» - LexTerm : •- char_lit «(» - LexTerm : •- ( char_lit - char_lit ) «(» + LexTerm : •~ char_lit «(» + LexTerm : •~ ( char_lit - char_lit ) «(» LexTerm : •regDefId «(» LexTerm : •[ LexPattern ] «(» LexTerm : •{ LexPattern } «(» LexTerm : •( LexPattern ) «(» - LexTerm : •. «-» - LexTerm : •char_lit «-» - LexTerm : •char_lit - char_lit «-» - LexTerm : •- char_lit «-» - LexTerm : •- ( char_lit - char_lit ) «-» - LexTerm : •regDefId «-» - LexTerm : •[ LexPattern ] «-» - LexTerm : •{ LexPattern } «-» - LexTerm : •( LexPattern ) «-» LexTerm : •. «.» LexTerm : •char_lit «.» LexTerm : •char_lit - char_lit «.» - LexTerm : •- char_lit «.» - LexTerm : •- ( char_lit - char_lit ) «.» + LexTerm : •~ char_lit «.» + LexTerm : •~ ( char_lit - char_lit ) «.» LexTerm : •regDefId «.» LexTerm : •[ LexPattern ] «.» LexTerm : •{ LexPattern } «.» @@ -3319,8 +3310,8 @@ S81{ LexTerm : •. «[» LexTerm : •char_lit «[» LexTerm : •char_lit - char_lit «[» - LexTerm : •- char_lit «[» - LexTerm : •- ( char_lit - char_lit ) «[» + LexTerm : •~ char_lit «[» + LexTerm : •~ ( char_lit - char_lit ) «[» LexTerm : •regDefId «[» LexTerm : •[ LexPattern ] «[» LexTerm : •{ LexPattern } «[» @@ -3328,8 +3319,8 @@ S81{ LexTerm : •. «char_lit» LexTerm : •char_lit «char_lit» LexTerm : •char_lit - char_lit «char_lit» - LexTerm : •- char_lit «char_lit» - LexTerm : •- ( char_lit - char_lit ) «char_lit» + LexTerm : •~ char_lit «char_lit» + LexTerm : •~ ( char_lit - char_lit ) «char_lit» LexTerm : •regDefId «char_lit» LexTerm : •[ LexPattern ] «char_lit» LexTerm : •{ LexPattern } «char_lit» @@ -3337,8 +3328,8 @@ S81{ LexTerm : •. «regDefId» LexTerm : •char_lit «regDefId» LexTerm : •char_lit - char_lit «regDefId» - LexTerm : •- char_lit «regDefId» - LexTerm : •- ( char_lit - char_lit ) «regDefId» + LexTerm : •~ char_lit «regDefId» + LexTerm : •~ ( char_lit - char_lit ) «regDefId» LexTerm : •regDefId «regDefId» LexTerm : •[ LexPattern ] «regDefId» LexTerm : •{ LexPattern } «regDefId» @@ -3346,17 +3337,26 @@ S81{ LexTerm : •. «{» LexTerm : •char_lit «{» LexTerm : •char_lit - char_lit «{» - LexTerm : •- char_lit «{» - LexTerm : •- ( char_lit - char_lit ) «{» + LexTerm : •~ char_lit «{» + LexTerm : •~ ( char_lit - char_lit ) «{» LexTerm : •regDefId «{» LexTerm : •[ LexPattern ] «{» LexTerm : •{ LexPattern } «{» LexTerm : •( LexPattern ) «{» + LexTerm : •. «~» + LexTerm : •char_lit «~» + LexTerm : •char_lit - char_lit «~» + LexTerm : •~ char_lit «~» + LexTerm : •~ ( char_lit - char_lit ) «~» + LexTerm : •regDefId «~» + LexTerm : •[ LexPattern ] «~» + LexTerm : •{ LexPattern } «~» + LexTerm : •( LexPattern ) «~» LexTerm : •. «|» LexTerm : •char_lit «|» LexTerm : •char_lit - char_lit «|» - LexTerm : •- char_lit «|» - LexTerm : •- ( char_lit - char_lit ) «|» + LexTerm : •~ char_lit «|» + LexTerm : •~ ( char_lit - char_lit ) «|» LexTerm : •regDefId «|» LexTerm : •[ LexPattern ] «|» LexTerm : •{ LexPattern } «|» @@ -3368,7 +3368,7 @@ Transitions: regDefId -> 66 . -> 67 char_lit -> 68 - - -> 69 + ~ -> 69 ( -> 70 [ -> 71 { -> 72 @@ -3378,12 +3378,12 @@ Transitions: S82{ LexTerm : { •LexPattern } «}» LexTerm : { •LexPattern } «(» - LexTerm : { •LexPattern } «-» LexTerm : { •LexPattern } «.» LexTerm : { •LexPattern } «[» LexTerm : { •LexPattern } «char_lit» LexTerm : { •LexPattern } «regDefId» LexTerm : { •LexPattern } «{» + LexTerm : { •LexPattern } «~» LexTerm : { •LexPattern } «|» LexPattern : •LexAlt «}» LexPattern : •LexPattern | LexAlt «}» @@ -3394,51 +3394,42 @@ S82{ LexTerm : •. «}» LexTerm : •char_lit «}» LexTerm : •char_lit - char_lit «}» - LexTerm : •- char_lit «}» - LexTerm : •- ( char_lit - char_lit ) «}» + LexTerm : •~ char_lit «}» + LexTerm : •~ ( char_lit - char_lit ) «}» LexTerm : •regDefId «}» LexTerm : •[ LexPattern ] «}» LexTerm : •{ LexPattern } «}» LexTerm : •( LexPattern ) «}» LexAlt : •LexTerm «(» - LexAlt : •LexTerm «-» LexAlt : •LexTerm «.» LexAlt : •LexTerm «[» LexAlt : •LexTerm «char_lit» LexAlt : •LexTerm «regDefId» LexAlt : •LexTerm «{» + LexAlt : •LexTerm «~» LexAlt : •LexAlt LexTerm «(» - LexAlt : •LexAlt LexTerm «-» LexAlt : •LexAlt LexTerm «.» LexAlt : •LexAlt LexTerm «[» LexAlt : •LexAlt LexTerm «char_lit» LexAlt : •LexAlt LexTerm «regDefId» LexAlt : •LexAlt LexTerm «{» + LexAlt : •LexAlt LexTerm «~» LexAlt : •LexTerm «|» LexAlt : •LexAlt LexTerm «|» LexTerm : •. «(» LexTerm : •char_lit «(» LexTerm : •char_lit - char_lit «(» - LexTerm : •- char_lit «(» - LexTerm : •- ( char_lit - char_lit ) «(» + LexTerm : •~ char_lit «(» + LexTerm : •~ ( char_lit - char_lit ) «(» LexTerm : •regDefId «(» LexTerm : •[ LexPattern ] «(» LexTerm : •{ LexPattern } «(» LexTerm : •( LexPattern ) «(» - LexTerm : •. «-» - LexTerm : •char_lit «-» - LexTerm : •char_lit - char_lit «-» - LexTerm : •- char_lit «-» - LexTerm : •- ( char_lit - char_lit ) «-» - LexTerm : •regDefId «-» - LexTerm : •[ LexPattern ] «-» - LexTerm : •{ LexPattern } «-» - LexTerm : •( LexPattern ) «-» LexTerm : •. «.» LexTerm : •char_lit «.» LexTerm : •char_lit - char_lit «.» - LexTerm : •- char_lit «.» - LexTerm : •- ( char_lit - char_lit ) «.» + LexTerm : •~ char_lit «.» + LexTerm : •~ ( char_lit - char_lit ) «.» LexTerm : •regDefId «.» LexTerm : •[ LexPattern ] «.» LexTerm : •{ LexPattern } «.» @@ -3446,8 +3437,8 @@ S82{ LexTerm : •. «[» LexTerm : •char_lit «[» LexTerm : •char_lit - char_lit «[» - LexTerm : •- char_lit «[» - LexTerm : •- ( char_lit - char_lit ) «[» + LexTerm : •~ char_lit «[» + LexTerm : •~ ( char_lit - char_lit ) «[» LexTerm : •regDefId «[» LexTerm : •[ LexPattern ] «[» LexTerm : •{ LexPattern } «[» @@ -3455,8 +3446,8 @@ S82{ LexTerm : •. «char_lit» LexTerm : •char_lit «char_lit» LexTerm : •char_lit - char_lit «char_lit» - LexTerm : •- char_lit «char_lit» - LexTerm : •- ( char_lit - char_lit ) «char_lit» + LexTerm : •~ char_lit «char_lit» + LexTerm : •~ ( char_lit - char_lit ) «char_lit» LexTerm : •regDefId «char_lit» LexTerm : •[ LexPattern ] «char_lit» LexTerm : •{ LexPattern } «char_lit» @@ -3464,8 +3455,8 @@ S82{ LexTerm : •. «regDefId» LexTerm : •char_lit «regDefId» LexTerm : •char_lit - char_lit «regDefId» - LexTerm : •- char_lit «regDefId» - LexTerm : •- ( char_lit - char_lit ) «regDefId» + LexTerm : •~ char_lit «regDefId» + LexTerm : •~ ( char_lit - char_lit ) «regDefId» LexTerm : •regDefId «regDefId» LexTerm : •[ LexPattern ] «regDefId» LexTerm : •{ LexPattern } «regDefId» @@ -3473,17 +3464,26 @@ S82{ LexTerm : •. «{» LexTerm : •char_lit «{» LexTerm : •char_lit - char_lit «{» - LexTerm : •- char_lit «{» - LexTerm : •- ( char_lit - char_lit ) «{» + LexTerm : •~ char_lit «{» + LexTerm : •~ ( char_lit - char_lit ) «{» LexTerm : •regDefId «{» LexTerm : •[ LexPattern ] «{» LexTerm : •{ LexPattern } «{» LexTerm : •( LexPattern ) «{» + LexTerm : •. «~» + LexTerm : •char_lit «~» + LexTerm : •char_lit - char_lit «~» + LexTerm : •~ char_lit «~» + LexTerm : •~ ( char_lit - char_lit ) «~» + LexTerm : •regDefId «~» + LexTerm : •[ LexPattern ] «~» + LexTerm : •{ LexPattern } «~» + LexTerm : •( LexPattern ) «~» LexTerm : •. «|» LexTerm : •char_lit «|» LexTerm : •char_lit - char_lit «|» - LexTerm : •- char_lit «|» - LexTerm : •- ( char_lit - char_lit ) «|» + LexTerm : •~ char_lit «|» + LexTerm : •~ ( char_lit - char_lit ) «|» LexTerm : •regDefId «|» LexTerm : •[ LexPattern ] «|» LexTerm : •{ LexPattern } «|» @@ -3495,7 +3495,7 @@ Transitions: regDefId -> 76 . -> 77 char_lit -> 78 - - -> 79 + ~ -> 79 ( -> 80 [ -> 81 { -> 82 @@ -3679,17 +3679,17 @@ S91{ LexAlt : LexAlt •LexTerm «;» LexAlt : LexAlt •LexTerm «|» LexAlt : LexAlt •LexTerm «(» - LexAlt : LexAlt •LexTerm «-» LexAlt : LexAlt •LexTerm «.» LexAlt : LexAlt •LexTerm «[» LexAlt : LexAlt •LexTerm «char_lit» LexAlt : LexAlt •LexTerm «regDefId» LexAlt : LexAlt •LexTerm «{» + LexAlt : LexAlt •LexTerm «~» LexTerm : •. «;» LexTerm : •char_lit «;» LexTerm : •char_lit - char_lit «;» - LexTerm : •- char_lit «;» - LexTerm : •- ( char_lit - char_lit ) «;» + LexTerm : •~ char_lit «;» + LexTerm : •~ ( char_lit - char_lit ) «;» LexTerm : •regDefId «;» LexTerm : •[ LexPattern ] «;» LexTerm : •{ LexPattern } «;» @@ -3697,8 +3697,8 @@ S91{ LexTerm : •. «|» LexTerm : •char_lit «|» LexTerm : •char_lit - char_lit «|» - LexTerm : •- char_lit «|» - LexTerm : •- ( char_lit - char_lit ) «|» + LexTerm : •~ char_lit «|» + LexTerm : •~ ( char_lit - char_lit ) «|» LexTerm : •regDefId «|» LexTerm : •[ LexPattern ] «|» LexTerm : •{ LexPattern } «|» @@ -3706,26 +3706,17 @@ S91{ LexTerm : •. «(» LexTerm : •char_lit «(» LexTerm : •char_lit - char_lit «(» - LexTerm : •- char_lit «(» - LexTerm : •- ( char_lit - char_lit ) «(» + LexTerm : •~ char_lit «(» + LexTerm : •~ ( char_lit - char_lit ) «(» LexTerm : •regDefId «(» LexTerm : •[ LexPattern ] «(» LexTerm : •{ LexPattern } «(» LexTerm : •( LexPattern ) «(» - LexTerm : •. «-» - LexTerm : •char_lit «-» - LexTerm : •char_lit - char_lit «-» - LexTerm : •- char_lit «-» - LexTerm : •- ( char_lit - char_lit ) «-» - LexTerm : •regDefId «-» - LexTerm : •[ LexPattern ] «-» - LexTerm : •{ LexPattern } «-» - LexTerm : •( LexPattern ) «-» LexTerm : •. «.» LexTerm : •char_lit «.» LexTerm : •char_lit - char_lit «.» - LexTerm : •- char_lit «.» - LexTerm : •- ( char_lit - char_lit ) «.» + LexTerm : •~ char_lit «.» + LexTerm : •~ ( char_lit - char_lit ) «.» LexTerm : •regDefId «.» LexTerm : •[ LexPattern ] «.» LexTerm : •{ LexPattern } «.» @@ -3733,8 +3724,8 @@ S91{ LexTerm : •. «[» LexTerm : •char_lit «[» LexTerm : •char_lit - char_lit «[» - LexTerm : •- char_lit «[» - LexTerm : •- ( char_lit - char_lit ) «[» + LexTerm : •~ char_lit «[» + LexTerm : •~ ( char_lit - char_lit ) «[» LexTerm : •regDefId «[» LexTerm : •[ LexPattern ] «[» LexTerm : •{ LexPattern } «[» @@ -3742,8 +3733,8 @@ S91{ LexTerm : •. «char_lit» LexTerm : •char_lit «char_lit» LexTerm : •char_lit - char_lit «char_lit» - LexTerm : •- char_lit «char_lit» - LexTerm : •- ( char_lit - char_lit ) «char_lit» + LexTerm : •~ char_lit «char_lit» + LexTerm : •~ ( char_lit - char_lit ) «char_lit» LexTerm : •regDefId «char_lit» LexTerm : •[ LexPattern ] «char_lit» LexTerm : •{ LexPattern } «char_lit» @@ -3751,8 +3742,8 @@ S91{ LexTerm : •. «regDefId» LexTerm : •char_lit «regDefId» LexTerm : •char_lit - char_lit «regDefId» - LexTerm : •- char_lit «regDefId» - LexTerm : •- ( char_lit - char_lit ) «regDefId» + LexTerm : •~ char_lit «regDefId» + LexTerm : •~ ( char_lit - char_lit ) «regDefId» LexTerm : •regDefId «regDefId» LexTerm : •[ LexPattern ] «regDefId» LexTerm : •{ LexPattern } «regDefId» @@ -3760,18 +3751,27 @@ S91{ LexTerm : •. «{» LexTerm : •char_lit «{» LexTerm : •char_lit - char_lit «{» - LexTerm : •- char_lit «{» - LexTerm : •- ( char_lit - char_lit ) «{» + LexTerm : •~ char_lit «{» + LexTerm : •~ ( char_lit - char_lit ) «{» LexTerm : •regDefId «{» LexTerm : •[ LexPattern ] «{» LexTerm : •{ LexPattern } «{» LexTerm : •( LexPattern ) «{» + LexTerm : •. «~» + LexTerm : •char_lit «~» + LexTerm : •char_lit - char_lit «~» + LexTerm : •~ char_lit «~» + LexTerm : •~ ( char_lit - char_lit ) «~» + LexTerm : •regDefId «~» + LexTerm : •[ LexPattern ] «~» + LexTerm : •{ LexPattern } «~» + LexTerm : •( LexPattern ) «~» } Transitions: regDefId -> 25 . -> 26 char_lit -> 27 - - -> 28 + ~ -> 28 ( -> 29 [ -> 30 { -> 31 @@ -3781,27 +3781,27 @@ Transitions: S92{ LexTerm : char_lit - char_lit• «;» LexTerm : char_lit - char_lit• «(» - LexTerm : char_lit - char_lit• «-» LexTerm : char_lit - char_lit• «.» LexTerm : char_lit - char_lit• «[» LexTerm : char_lit - char_lit• «char_lit» LexTerm : char_lit - char_lit• «regDefId» LexTerm : char_lit - char_lit• «{» + LexTerm : char_lit - char_lit• «~» LexTerm : char_lit - char_lit• «|» } Transitions: S93{ - LexTerm : - ( char_lit •- char_lit ) «;» - LexTerm : - ( char_lit •- char_lit ) «(» - LexTerm : - ( char_lit •- char_lit ) «-» - LexTerm : - ( char_lit •- char_lit ) «.» - LexTerm : - ( char_lit •- char_lit ) «[» - LexTerm : - ( char_lit •- char_lit ) «char_lit» - LexTerm : - ( char_lit •- char_lit ) «regDefId» - LexTerm : - ( char_lit •- char_lit ) «{» - LexTerm : - ( char_lit •- char_lit ) «|» + LexTerm : ~ ( char_lit •- char_lit ) «;» + LexTerm : ~ ( char_lit •- char_lit ) «(» + LexTerm : ~ ( char_lit •- char_lit ) «.» + LexTerm : ~ ( char_lit •- char_lit ) «[» + LexTerm : ~ ( char_lit •- char_lit ) «char_lit» + LexTerm : ~ ( char_lit •- char_lit ) «regDefId» + LexTerm : ~ ( char_lit •- char_lit ) «{» + LexTerm : ~ ( char_lit •- char_lit ) «~» + LexTerm : ~ ( char_lit •- char_lit ) «|» } Transitions: - -> 123 @@ -3817,31 +3817,31 @@ S94{ LexTerm : •. «)» LexTerm : •char_lit «)» LexTerm : •char_lit - char_lit «)» - LexTerm : •- char_lit «)» - LexTerm : •- ( char_lit - char_lit ) «)» + LexTerm : •~ char_lit «)» + LexTerm : •~ ( char_lit - char_lit ) «)» LexTerm : •regDefId «)» LexTerm : •[ LexPattern ] «)» LexTerm : •{ LexPattern } «)» LexTerm : •( LexPattern ) «)» LexAlt : •LexTerm «(» - LexAlt : •LexTerm «-» LexAlt : •LexTerm «.» LexAlt : •LexTerm «[» LexAlt : •LexTerm «char_lit» LexAlt : •LexTerm «regDefId» LexAlt : •LexTerm «{» + LexAlt : •LexTerm «~» LexAlt : •LexAlt LexTerm «(» - LexAlt : •LexAlt LexTerm «-» LexAlt : •LexAlt LexTerm «.» LexAlt : •LexAlt LexTerm «[» LexAlt : •LexAlt LexTerm «char_lit» LexAlt : •LexAlt LexTerm «regDefId» LexAlt : •LexAlt LexTerm «{» + LexAlt : •LexAlt LexTerm «~» LexTerm : •. «|» LexTerm : •char_lit «|» LexTerm : •char_lit - char_lit «|» - LexTerm : •- char_lit «|» - LexTerm : •- ( char_lit - char_lit ) «|» + LexTerm : •~ char_lit «|» + LexTerm : •~ ( char_lit - char_lit ) «|» LexTerm : •regDefId «|» LexTerm : •[ LexPattern ] «|» LexTerm : •{ LexPattern } «|» @@ -3849,26 +3849,17 @@ S94{ LexTerm : •. «(» LexTerm : •char_lit «(» LexTerm : •char_lit - char_lit «(» - LexTerm : •- char_lit «(» - LexTerm : •- ( char_lit - char_lit ) «(» + LexTerm : •~ char_lit «(» + LexTerm : •~ ( char_lit - char_lit ) «(» LexTerm : •regDefId «(» LexTerm : •[ LexPattern ] «(» LexTerm : •{ LexPattern } «(» LexTerm : •( LexPattern ) «(» - LexTerm : •. «-» - LexTerm : •char_lit «-» - LexTerm : •char_lit - char_lit «-» - LexTerm : •- char_lit «-» - LexTerm : •- ( char_lit - char_lit ) «-» - LexTerm : •regDefId «-» - LexTerm : •[ LexPattern ] «-» - LexTerm : •{ LexPattern } «-» - LexTerm : •( LexPattern ) «-» LexTerm : •. «.» LexTerm : •char_lit «.» LexTerm : •char_lit - char_lit «.» - LexTerm : •- char_lit «.» - LexTerm : •- ( char_lit - char_lit ) «.» + LexTerm : •~ char_lit «.» + LexTerm : •~ ( char_lit - char_lit ) «.» LexTerm : •regDefId «.» LexTerm : •[ LexPattern ] «.» LexTerm : •{ LexPattern } «.» @@ -3876,8 +3867,8 @@ S94{ LexTerm : •. «[» LexTerm : •char_lit «[» LexTerm : •char_lit - char_lit «[» - LexTerm : •- char_lit «[» - LexTerm : •- ( char_lit - char_lit ) «[» + LexTerm : •~ char_lit «[» + LexTerm : •~ ( char_lit - char_lit ) «[» LexTerm : •regDefId «[» LexTerm : •[ LexPattern ] «[» LexTerm : •{ LexPattern } «[» @@ -3885,8 +3876,8 @@ S94{ LexTerm : •. «char_lit» LexTerm : •char_lit «char_lit» LexTerm : •char_lit - char_lit «char_lit» - LexTerm : •- char_lit «char_lit» - LexTerm : •- ( char_lit - char_lit ) «char_lit» + LexTerm : •~ char_lit «char_lit» + LexTerm : •~ ( char_lit - char_lit ) «char_lit» LexTerm : •regDefId «char_lit» LexTerm : •[ LexPattern ] «char_lit» LexTerm : •{ LexPattern } «char_lit» @@ -3894,8 +3885,8 @@ S94{ LexTerm : •. «regDefId» LexTerm : •char_lit «regDefId» LexTerm : •char_lit - char_lit «regDefId» - LexTerm : •- char_lit «regDefId» - LexTerm : •- ( char_lit - char_lit ) «regDefId» + LexTerm : •~ char_lit «regDefId» + LexTerm : •~ ( char_lit - char_lit ) «regDefId» LexTerm : •regDefId «regDefId» LexTerm : •[ LexPattern ] «regDefId» LexTerm : •{ LexPattern } «regDefId» @@ -3903,19 +3894,28 @@ S94{ LexTerm : •. «{» LexTerm : •char_lit «{» LexTerm : •char_lit - char_lit «{» - LexTerm : •- char_lit «{» - LexTerm : •- ( char_lit - char_lit ) «{» + LexTerm : •~ char_lit «{» + LexTerm : •~ ( char_lit - char_lit ) «{» LexTerm : •regDefId «{» LexTerm : •[ LexPattern ] «{» LexTerm : •{ LexPattern } «{» LexTerm : •( LexPattern ) «{» + LexTerm : •. «~» + LexTerm : •char_lit «~» + LexTerm : •char_lit - char_lit «~» + LexTerm : •~ char_lit «~» + LexTerm : •~ ( char_lit - char_lit ) «~» + LexTerm : •regDefId «~» + LexTerm : •[ LexPattern ] «~» + LexTerm : •{ LexPattern } «~» + LexTerm : •( LexPattern ) «~» } Transitions: LexTerm -> 55 regDefId -> 56 . -> 57 char_lit -> 58 - - -> 59 + ~ -> 59 ( -> 60 [ -> 61 { -> 62 @@ -3925,12 +3925,12 @@ Transitions: S95{ LexTerm : ( LexPattern )• «;» LexTerm : ( LexPattern )• «(» - LexTerm : ( LexPattern )• «-» LexTerm : ( LexPattern )• «.» LexTerm : ( LexPattern )• «[» LexTerm : ( LexPattern )• «char_lit» LexTerm : ( LexPattern )• «regDefId» LexTerm : ( LexPattern )• «{» + LexTerm : ( LexPattern )• «~» LexTerm : ( LexPattern )• «|» } Transitions: @@ -3939,12 +3939,12 @@ Transitions: S96{ LexAlt : LexAlt LexTerm• «)» LexAlt : LexAlt LexTerm• «(» - LexAlt : LexAlt LexTerm• «-» LexAlt : LexAlt LexTerm• «.» LexAlt : LexAlt LexTerm• «[» LexAlt : LexAlt LexTerm• «char_lit» LexAlt : LexAlt LexTerm• «regDefId» LexAlt : LexAlt LexTerm• «{» + LexAlt : LexAlt LexTerm• «~» LexAlt : LexAlt LexTerm• «|» } Transitions: @@ -3953,12 +3953,12 @@ Transitions: S97{ LexTerm : char_lit - •char_lit «)» LexTerm : char_lit - •char_lit «(» - LexTerm : char_lit - •char_lit «-» LexTerm : char_lit - •char_lit «.» LexTerm : char_lit - •char_lit «[» LexTerm : char_lit - •char_lit «char_lit» LexTerm : char_lit - •char_lit «regDefId» LexTerm : char_lit - •char_lit «{» + LexTerm : char_lit - •char_lit «~» LexTerm : char_lit - •char_lit «|» } Transitions: @@ -3966,29 +3966,29 @@ Transitions: S98{ - LexTerm : - char_lit• «)» - LexTerm : - char_lit• «(» - LexTerm : - char_lit• «-» - LexTerm : - char_lit• «.» - LexTerm : - char_lit• «[» - LexTerm : - char_lit• «char_lit» - LexTerm : - char_lit• «regDefId» - LexTerm : - char_lit• «{» - LexTerm : - char_lit• «|» + LexTerm : ~ char_lit• «)» + LexTerm : ~ char_lit• «(» + LexTerm : ~ char_lit• «.» + LexTerm : ~ char_lit• «[» + LexTerm : ~ char_lit• «char_lit» + LexTerm : ~ char_lit• «regDefId» + LexTerm : ~ char_lit• «{» + LexTerm : ~ char_lit• «~» + LexTerm : ~ char_lit• «|» } Transitions: S99{ - LexTerm : - ( •char_lit - char_lit ) «)» - LexTerm : - ( •char_lit - char_lit ) «(» - LexTerm : - ( •char_lit - char_lit ) «-» - LexTerm : - ( •char_lit - char_lit ) «.» - LexTerm : - ( •char_lit - char_lit ) «[» - LexTerm : - ( •char_lit - char_lit ) «char_lit» - LexTerm : - ( •char_lit - char_lit ) «regDefId» - LexTerm : - ( •char_lit - char_lit ) «{» - LexTerm : - ( •char_lit - char_lit ) «|» + LexTerm : ~ ( •char_lit - char_lit ) «)» + LexTerm : ~ ( •char_lit - char_lit ) «(» + LexTerm : ~ ( •char_lit - char_lit ) «.» + LexTerm : ~ ( •char_lit - char_lit ) «[» + LexTerm : ~ ( •char_lit - char_lit ) «char_lit» + LexTerm : ~ ( •char_lit - char_lit ) «regDefId» + LexTerm : ~ ( •char_lit - char_lit ) «{» + LexTerm : ~ ( •char_lit - char_lit ) «~» + LexTerm : ~ ( •char_lit - char_lit ) «|» } Transitions: char_lit -> 126 @@ -3997,12 +3997,12 @@ Transitions: S100{ LexTerm : ( LexPattern •) «)» LexTerm : ( LexPattern •) «(» - LexTerm : ( LexPattern •) «-» LexTerm : ( LexPattern •) «.» LexTerm : ( LexPattern •) «[» LexTerm : ( LexPattern •) «char_lit» LexTerm : ( LexPattern •) «regDefId» LexTerm : ( LexPattern •) «{» + LexTerm : ( LexPattern •) «~» LexTerm : ( LexPattern •) «|» LexPattern : LexPattern •| LexAlt «)» LexPattern : LexPattern •| LexAlt «|» @@ -4015,12 +4015,12 @@ Transitions: S101{ LexTerm : [ LexPattern •] «)» LexTerm : [ LexPattern •] «(» - LexTerm : [ LexPattern •] «-» LexTerm : [ LexPattern •] «.» LexTerm : [ LexPattern •] «[» LexTerm : [ LexPattern •] «char_lit» LexTerm : [ LexPattern •] «regDefId» LexTerm : [ LexPattern •] «{» + LexTerm : [ LexPattern •] «~» LexTerm : [ LexPattern •] «|» LexPattern : LexPattern •| LexAlt «]» LexPattern : LexPattern •| LexAlt «|» @@ -4033,12 +4033,12 @@ Transitions: S102{ LexTerm : { LexPattern •} «)» LexTerm : { LexPattern •} «(» - LexTerm : { LexPattern •} «-» LexTerm : { LexPattern •} «.» LexTerm : { LexPattern •} «[» LexTerm : { LexPattern •} «char_lit» LexTerm : { LexPattern •} «regDefId» LexTerm : { LexPattern •} «{» + LexTerm : { LexPattern •} «~» LexTerm : { LexPattern •} «|» LexPattern : LexPattern •| LexAlt «}» LexPattern : LexPattern •| LexAlt «|» @@ -4058,31 +4058,31 @@ S103{ LexTerm : •. «]» LexTerm : •char_lit «]» LexTerm : •char_lit - char_lit «]» - LexTerm : •- char_lit «]» - LexTerm : •- ( char_lit - char_lit ) «]» + LexTerm : •~ char_lit «]» + LexTerm : •~ ( char_lit - char_lit ) «]» LexTerm : •regDefId «]» LexTerm : •[ LexPattern ] «]» LexTerm : •{ LexPattern } «]» LexTerm : •( LexPattern ) «]» LexAlt : •LexTerm «(» - LexAlt : •LexTerm «-» LexAlt : •LexTerm «.» LexAlt : •LexTerm «[» LexAlt : •LexTerm «char_lit» LexAlt : •LexTerm «regDefId» LexAlt : •LexTerm «{» + LexAlt : •LexTerm «~» LexAlt : •LexAlt LexTerm «(» - LexAlt : •LexAlt LexTerm «-» LexAlt : •LexAlt LexTerm «.» LexAlt : •LexAlt LexTerm «[» LexAlt : •LexAlt LexTerm «char_lit» LexAlt : •LexAlt LexTerm «regDefId» LexAlt : •LexAlt LexTerm «{» + LexAlt : •LexAlt LexTerm «~» LexTerm : •. «|» LexTerm : •char_lit «|» LexTerm : •char_lit - char_lit «|» - LexTerm : •- char_lit «|» - LexTerm : •- ( char_lit - char_lit ) «|» + LexTerm : •~ char_lit «|» + LexTerm : •~ ( char_lit - char_lit ) «|» LexTerm : •regDefId «|» LexTerm : •[ LexPattern ] «|» LexTerm : •{ LexPattern } «|» @@ -4090,26 +4090,17 @@ S103{ LexTerm : •. «(» LexTerm : •char_lit «(» LexTerm : •char_lit - char_lit «(» - LexTerm : •- char_lit «(» - LexTerm : •- ( char_lit - char_lit ) «(» + LexTerm : •~ char_lit «(» + LexTerm : •~ ( char_lit - char_lit ) «(» LexTerm : •regDefId «(» LexTerm : •[ LexPattern ] «(» LexTerm : •{ LexPattern } «(» LexTerm : •( LexPattern ) «(» - LexTerm : •. «-» - LexTerm : •char_lit «-» - LexTerm : •char_lit - char_lit «-» - LexTerm : •- char_lit «-» - LexTerm : •- ( char_lit - char_lit ) «-» - LexTerm : •regDefId «-» - LexTerm : •[ LexPattern ] «-» - LexTerm : •{ LexPattern } «-» - LexTerm : •( LexPattern ) «-» LexTerm : •. «.» LexTerm : •char_lit «.» LexTerm : •char_lit - char_lit «.» - LexTerm : •- char_lit «.» - LexTerm : •- ( char_lit - char_lit ) «.» + LexTerm : •~ char_lit «.» + LexTerm : •~ ( char_lit - char_lit ) «.» LexTerm : •regDefId «.» LexTerm : •[ LexPattern ] «.» LexTerm : •{ LexPattern } «.» @@ -4117,8 +4108,8 @@ S103{ LexTerm : •. «[» LexTerm : •char_lit «[» LexTerm : •char_lit - char_lit «[» - LexTerm : •- char_lit «[» - LexTerm : •- ( char_lit - char_lit ) «[» + LexTerm : •~ char_lit «[» + LexTerm : •~ ( char_lit - char_lit ) «[» LexTerm : •regDefId «[» LexTerm : •[ LexPattern ] «[» LexTerm : •{ LexPattern } «[» @@ -4126,8 +4117,8 @@ S103{ LexTerm : •. «char_lit» LexTerm : •char_lit «char_lit» LexTerm : •char_lit - char_lit «char_lit» - LexTerm : •- char_lit «char_lit» - LexTerm : •- ( char_lit - char_lit ) «char_lit» + LexTerm : •~ char_lit «char_lit» + LexTerm : •~ ( char_lit - char_lit ) «char_lit» LexTerm : •regDefId «char_lit» LexTerm : •[ LexPattern ] «char_lit» LexTerm : •{ LexPattern } «char_lit» @@ -4135,8 +4126,8 @@ S103{ LexTerm : •. «regDefId» LexTerm : •char_lit «regDefId» LexTerm : •char_lit - char_lit «regDefId» - LexTerm : •- char_lit «regDefId» - LexTerm : •- ( char_lit - char_lit ) «regDefId» + LexTerm : •~ char_lit «regDefId» + LexTerm : •~ ( char_lit - char_lit ) «regDefId» LexTerm : •regDefId «regDefId» LexTerm : •[ LexPattern ] «regDefId» LexTerm : •{ LexPattern } «regDefId» @@ -4144,19 +4135,28 @@ S103{ LexTerm : •. «{» LexTerm : •char_lit «{» LexTerm : •char_lit - char_lit «{» - LexTerm : •- char_lit «{» - LexTerm : •- ( char_lit - char_lit ) «{» + LexTerm : •~ char_lit «{» + LexTerm : •~ ( char_lit - char_lit ) «{» LexTerm : •regDefId «{» LexTerm : •[ LexPattern ] «{» LexTerm : •{ LexPattern } «{» LexTerm : •( LexPattern ) «{» + LexTerm : •. «~» + LexTerm : •char_lit «~» + LexTerm : •char_lit - char_lit «~» + LexTerm : •~ char_lit «~» + LexTerm : •~ ( char_lit - char_lit ) «~» + LexTerm : •regDefId «~» + LexTerm : •[ LexPattern ] «~» + LexTerm : •{ LexPattern } «~» + LexTerm : •( LexPattern ) «~» } Transitions: LexTerm -> 65 regDefId -> 66 . -> 67 char_lit -> 68 - - -> 69 + ~ -> 69 ( -> 70 [ -> 71 { -> 72 @@ -4166,12 +4166,12 @@ Transitions: S104{ LexTerm : [ LexPattern ]• «;» LexTerm : [ LexPattern ]• «(» - LexTerm : [ LexPattern ]• «-» LexTerm : [ LexPattern ]• «.» LexTerm : [ LexPattern ]• «[» LexTerm : [ LexPattern ]• «char_lit» LexTerm : [ LexPattern ]• «regDefId» LexTerm : [ LexPattern ]• «{» + LexTerm : [ LexPattern ]• «~» LexTerm : [ LexPattern ]• «|» } Transitions: @@ -4180,12 +4180,12 @@ Transitions: S105{ LexAlt : LexAlt LexTerm• «]» LexAlt : LexAlt LexTerm• «(» - LexAlt : LexAlt LexTerm• «-» LexAlt : LexAlt LexTerm• «.» LexAlt : LexAlt LexTerm• «[» LexAlt : LexAlt LexTerm• «char_lit» LexAlt : LexAlt LexTerm• «regDefId» LexAlt : LexAlt LexTerm• «{» + LexAlt : LexAlt LexTerm• «~» LexAlt : LexAlt LexTerm• «|» } Transitions: @@ -4194,12 +4194,12 @@ Transitions: S106{ LexTerm : char_lit - •char_lit «]» LexTerm : char_lit - •char_lit «(» - LexTerm : char_lit - •char_lit «-» LexTerm : char_lit - •char_lit «.» LexTerm : char_lit - •char_lit «[» LexTerm : char_lit - •char_lit «char_lit» LexTerm : char_lit - •char_lit «regDefId» LexTerm : char_lit - •char_lit «{» + LexTerm : char_lit - •char_lit «~» LexTerm : char_lit - •char_lit «|» } Transitions: @@ -4207,29 +4207,29 @@ Transitions: S107{ - LexTerm : - char_lit• «]» - LexTerm : - char_lit• «(» - LexTerm : - char_lit• «-» - LexTerm : - char_lit• «.» - LexTerm : - char_lit• «[» - LexTerm : - char_lit• «char_lit» - LexTerm : - char_lit• «regDefId» - LexTerm : - char_lit• «{» - LexTerm : - char_lit• «|» + LexTerm : ~ char_lit• «]» + LexTerm : ~ char_lit• «(» + LexTerm : ~ char_lit• «.» + LexTerm : ~ char_lit• «[» + LexTerm : ~ char_lit• «char_lit» + LexTerm : ~ char_lit• «regDefId» + LexTerm : ~ char_lit• «{» + LexTerm : ~ char_lit• «~» + LexTerm : ~ char_lit• «|» } Transitions: S108{ - LexTerm : - ( •char_lit - char_lit ) «]» - LexTerm : - ( •char_lit - char_lit ) «(» - LexTerm : - ( •char_lit - char_lit ) «-» - LexTerm : - ( •char_lit - char_lit ) «.» - LexTerm : - ( •char_lit - char_lit ) «[» - LexTerm : - ( •char_lit - char_lit ) «char_lit» - LexTerm : - ( •char_lit - char_lit ) «regDefId» - LexTerm : - ( •char_lit - char_lit ) «{» - LexTerm : - ( •char_lit - char_lit ) «|» + LexTerm : ~ ( •char_lit - char_lit ) «]» + LexTerm : ~ ( •char_lit - char_lit ) «(» + LexTerm : ~ ( •char_lit - char_lit ) «.» + LexTerm : ~ ( •char_lit - char_lit ) «[» + LexTerm : ~ ( •char_lit - char_lit ) «char_lit» + LexTerm : ~ ( •char_lit - char_lit ) «regDefId» + LexTerm : ~ ( •char_lit - char_lit ) «{» + LexTerm : ~ ( •char_lit - char_lit ) «~» + LexTerm : ~ ( •char_lit - char_lit ) «|» } Transitions: char_lit -> 132 @@ -4238,12 +4238,12 @@ Transitions: S109{ LexTerm : ( LexPattern •) «]» LexTerm : ( LexPattern •) «(» - LexTerm : ( LexPattern •) «-» LexTerm : ( LexPattern •) «.» LexTerm : ( LexPattern •) «[» LexTerm : ( LexPattern •) «char_lit» LexTerm : ( LexPattern •) «regDefId» LexTerm : ( LexPattern •) «{» + LexTerm : ( LexPattern •) «~» LexTerm : ( LexPattern •) «|» LexPattern : LexPattern •| LexAlt «)» LexPattern : LexPattern •| LexAlt «|» @@ -4256,12 +4256,12 @@ Transitions: S110{ LexTerm : [ LexPattern •] «]» LexTerm : [ LexPattern •] «(» - LexTerm : [ LexPattern •] «-» LexTerm : [ LexPattern •] «.» LexTerm : [ LexPattern •] «[» LexTerm : [ LexPattern •] «char_lit» LexTerm : [ LexPattern •] «regDefId» LexTerm : [ LexPattern •] «{» + LexTerm : [ LexPattern •] «~» LexTerm : [ LexPattern •] «|» LexPattern : LexPattern •| LexAlt «]» LexPattern : LexPattern •| LexAlt «|» @@ -4274,12 +4274,12 @@ Transitions: S111{ LexTerm : { LexPattern •} «]» LexTerm : { LexPattern •} «(» - LexTerm : { LexPattern •} «-» LexTerm : { LexPattern •} «.» LexTerm : { LexPattern •} «[» LexTerm : { LexPattern •} «char_lit» LexTerm : { LexPattern •} «regDefId» LexTerm : { LexPattern •} «{» + LexTerm : { LexPattern •} «~» LexTerm : { LexPattern •} «|» LexPattern : LexPattern •| LexAlt «}» LexPattern : LexPattern •| LexAlt «|» @@ -4299,31 +4299,31 @@ S112{ LexTerm : •. «}» LexTerm : •char_lit «}» LexTerm : •char_lit - char_lit «}» - LexTerm : •- char_lit «}» - LexTerm : •- ( char_lit - char_lit ) «}» + LexTerm : •~ char_lit «}» + LexTerm : •~ ( char_lit - char_lit ) «}» LexTerm : •regDefId «}» LexTerm : •[ LexPattern ] «}» LexTerm : •{ LexPattern } «}» LexTerm : •( LexPattern ) «}» LexAlt : •LexTerm «(» - LexAlt : •LexTerm «-» LexAlt : •LexTerm «.» LexAlt : •LexTerm «[» LexAlt : •LexTerm «char_lit» LexAlt : •LexTerm «regDefId» LexAlt : •LexTerm «{» + LexAlt : •LexTerm «~» LexAlt : •LexAlt LexTerm «(» - LexAlt : •LexAlt LexTerm «-» LexAlt : •LexAlt LexTerm «.» LexAlt : •LexAlt LexTerm «[» LexAlt : •LexAlt LexTerm «char_lit» LexAlt : •LexAlt LexTerm «regDefId» LexAlt : •LexAlt LexTerm «{» + LexAlt : •LexAlt LexTerm «~» LexTerm : •. «|» LexTerm : •char_lit «|» LexTerm : •char_lit - char_lit «|» - LexTerm : •- char_lit «|» - LexTerm : •- ( char_lit - char_lit ) «|» + LexTerm : •~ char_lit «|» + LexTerm : •~ ( char_lit - char_lit ) «|» LexTerm : •regDefId «|» LexTerm : •[ LexPattern ] «|» LexTerm : •{ LexPattern } «|» @@ -4331,26 +4331,17 @@ S112{ LexTerm : •. «(» LexTerm : •char_lit «(» LexTerm : •char_lit - char_lit «(» - LexTerm : •- char_lit «(» - LexTerm : •- ( char_lit - char_lit ) «(» + LexTerm : •~ char_lit «(» + LexTerm : •~ ( char_lit - char_lit ) «(» LexTerm : •regDefId «(» LexTerm : •[ LexPattern ] «(» LexTerm : •{ LexPattern } «(» LexTerm : •( LexPattern ) «(» - LexTerm : •. «-» - LexTerm : •char_lit «-» - LexTerm : •char_lit - char_lit «-» - LexTerm : •- char_lit «-» - LexTerm : •- ( char_lit - char_lit ) «-» - LexTerm : •regDefId «-» - LexTerm : •[ LexPattern ] «-» - LexTerm : •{ LexPattern } «-» - LexTerm : •( LexPattern ) «-» LexTerm : •. «.» LexTerm : •char_lit «.» LexTerm : •char_lit - char_lit «.» - LexTerm : •- char_lit «.» - LexTerm : •- ( char_lit - char_lit ) «.» + LexTerm : •~ char_lit «.» + LexTerm : •~ ( char_lit - char_lit ) «.» LexTerm : •regDefId «.» LexTerm : •[ LexPattern ] «.» LexTerm : •{ LexPattern } «.» @@ -4358,8 +4349,8 @@ S112{ LexTerm : •. «[» LexTerm : •char_lit «[» LexTerm : •char_lit - char_lit «[» - LexTerm : •- char_lit «[» - LexTerm : •- ( char_lit - char_lit ) «[» + LexTerm : •~ char_lit «[» + LexTerm : •~ ( char_lit - char_lit ) «[» LexTerm : •regDefId «[» LexTerm : •[ LexPattern ] «[» LexTerm : •{ LexPattern } «[» @@ -4367,8 +4358,8 @@ S112{ LexTerm : •. «char_lit» LexTerm : •char_lit «char_lit» LexTerm : •char_lit - char_lit «char_lit» - LexTerm : •- char_lit «char_lit» - LexTerm : •- ( char_lit - char_lit ) «char_lit» + LexTerm : •~ char_lit «char_lit» + LexTerm : •~ ( char_lit - char_lit ) «char_lit» LexTerm : •regDefId «char_lit» LexTerm : •[ LexPattern ] «char_lit» LexTerm : •{ LexPattern } «char_lit» @@ -4376,8 +4367,8 @@ S112{ LexTerm : •. «regDefId» LexTerm : •char_lit «regDefId» LexTerm : •char_lit - char_lit «regDefId» - LexTerm : •- char_lit «regDefId» - LexTerm : •- ( char_lit - char_lit ) «regDefId» + LexTerm : •~ char_lit «regDefId» + LexTerm : •~ ( char_lit - char_lit ) «regDefId» LexTerm : •regDefId «regDefId» LexTerm : •[ LexPattern ] «regDefId» LexTerm : •{ LexPattern } «regDefId» @@ -4385,19 +4376,28 @@ S112{ LexTerm : •. «{» LexTerm : •char_lit «{» LexTerm : •char_lit - char_lit «{» - LexTerm : •- char_lit «{» - LexTerm : •- ( char_lit - char_lit ) «{» + LexTerm : •~ char_lit «{» + LexTerm : •~ ( char_lit - char_lit ) «{» LexTerm : •regDefId «{» LexTerm : •[ LexPattern ] «{» LexTerm : •{ LexPattern } «{» LexTerm : •( LexPattern ) «{» + LexTerm : •. «~» + LexTerm : •char_lit «~» + LexTerm : •char_lit - char_lit «~» + LexTerm : •~ char_lit «~» + LexTerm : •~ ( char_lit - char_lit ) «~» + LexTerm : •regDefId «~» + LexTerm : •[ LexPattern ] «~» + LexTerm : •{ LexPattern } «~» + LexTerm : •( LexPattern ) «~» } Transitions: LexTerm -> 75 regDefId -> 76 . -> 77 char_lit -> 78 - - -> 79 + ~ -> 79 ( -> 80 [ -> 81 { -> 82 @@ -4407,12 +4407,12 @@ Transitions: S113{ LexTerm : { LexPattern }• «;» LexTerm : { LexPattern }• «(» - LexTerm : { LexPattern }• «-» LexTerm : { LexPattern }• «.» LexTerm : { LexPattern }• «[» LexTerm : { LexPattern }• «char_lit» LexTerm : { LexPattern }• «regDefId» LexTerm : { LexPattern }• «{» + LexTerm : { LexPattern }• «~» LexTerm : { LexPattern }• «|» } Transitions: @@ -4421,12 +4421,12 @@ Transitions: S114{ LexAlt : LexAlt LexTerm• «}» LexAlt : LexAlt LexTerm• «(» - LexAlt : LexAlt LexTerm• «-» LexAlt : LexAlt LexTerm• «.» LexAlt : LexAlt LexTerm• «[» LexAlt : LexAlt LexTerm• «char_lit» LexAlt : LexAlt LexTerm• «regDefId» LexAlt : LexAlt LexTerm• «{» + LexAlt : LexAlt LexTerm• «~» LexAlt : LexAlt LexTerm• «|» } Transitions: @@ -4435,12 +4435,12 @@ Transitions: S115{ LexTerm : char_lit - •char_lit «}» LexTerm : char_lit - •char_lit «(» - LexTerm : char_lit - •char_lit «-» LexTerm : char_lit - •char_lit «.» LexTerm : char_lit - •char_lit «[» LexTerm : char_lit - •char_lit «char_lit» LexTerm : char_lit - •char_lit «regDefId» LexTerm : char_lit - •char_lit «{» + LexTerm : char_lit - •char_lit «~» LexTerm : char_lit - •char_lit «|» } Transitions: @@ -4448,29 +4448,29 @@ Transitions: S116{ - LexTerm : - char_lit• «}» - LexTerm : - char_lit• «(» - LexTerm : - char_lit• «-» - LexTerm : - char_lit• «.» - LexTerm : - char_lit• «[» - LexTerm : - char_lit• «char_lit» - LexTerm : - char_lit• «regDefId» - LexTerm : - char_lit• «{» - LexTerm : - char_lit• «|» + LexTerm : ~ char_lit• «}» + LexTerm : ~ char_lit• «(» + LexTerm : ~ char_lit• «.» + LexTerm : ~ char_lit• «[» + LexTerm : ~ char_lit• «char_lit» + LexTerm : ~ char_lit• «regDefId» + LexTerm : ~ char_lit• «{» + LexTerm : ~ char_lit• «~» + LexTerm : ~ char_lit• «|» } Transitions: S117{ - LexTerm : - ( •char_lit - char_lit ) «}» - LexTerm : - ( •char_lit - char_lit ) «(» - LexTerm : - ( •char_lit - char_lit ) «-» - LexTerm : - ( •char_lit - char_lit ) «.» - LexTerm : - ( •char_lit - char_lit ) «[» - LexTerm : - ( •char_lit - char_lit ) «char_lit» - LexTerm : - ( •char_lit - char_lit ) «regDefId» - LexTerm : - ( •char_lit - char_lit ) «{» - LexTerm : - ( •char_lit - char_lit ) «|» + LexTerm : ~ ( •char_lit - char_lit ) «}» + LexTerm : ~ ( •char_lit - char_lit ) «(» + LexTerm : ~ ( •char_lit - char_lit ) «.» + LexTerm : ~ ( •char_lit - char_lit ) «[» + LexTerm : ~ ( •char_lit - char_lit ) «char_lit» + LexTerm : ~ ( •char_lit - char_lit ) «regDefId» + LexTerm : ~ ( •char_lit - char_lit ) «{» + LexTerm : ~ ( •char_lit - char_lit ) «~» + LexTerm : ~ ( •char_lit - char_lit ) «|» } Transitions: char_lit -> 138 @@ -4479,12 +4479,12 @@ Transitions: S118{ LexTerm : ( LexPattern •) «}» LexTerm : ( LexPattern •) «(» - LexTerm : ( LexPattern •) «-» LexTerm : ( LexPattern •) «.» LexTerm : ( LexPattern •) «[» LexTerm : ( LexPattern •) «char_lit» LexTerm : ( LexPattern •) «regDefId» LexTerm : ( LexPattern •) «{» + LexTerm : ( LexPattern •) «~» LexTerm : ( LexPattern •) «|» LexPattern : LexPattern •| LexAlt «)» LexPattern : LexPattern •| LexAlt «|» @@ -4497,12 +4497,12 @@ Transitions: S119{ LexTerm : [ LexPattern •] «}» LexTerm : [ LexPattern •] «(» - LexTerm : [ LexPattern •] «-» LexTerm : [ LexPattern •] «.» LexTerm : [ LexPattern •] «[» LexTerm : [ LexPattern •] «char_lit» LexTerm : [ LexPattern •] «regDefId» LexTerm : [ LexPattern •] «{» + LexTerm : [ LexPattern •] «~» LexTerm : [ LexPattern •] «|» LexPattern : LexPattern •| LexAlt «]» LexPattern : LexPattern •| LexAlt «|» @@ -4515,12 +4515,12 @@ Transitions: S120{ LexTerm : { LexPattern •} «}» LexTerm : { LexPattern •} «(» - LexTerm : { LexPattern •} «-» LexTerm : { LexPattern •} «.» LexTerm : { LexPattern •} «[» LexTerm : { LexPattern •} «char_lit» LexTerm : { LexPattern •} «regDefId» LexTerm : { LexPattern •} «{» + LexTerm : { LexPattern •} «~» LexTerm : { LexPattern •} «|» LexPattern : LexPattern •| LexAlt «}» LexPattern : LexPattern •| LexAlt «|» @@ -4545,15 +4545,15 @@ Transitions: S123{ - LexTerm : - ( char_lit - •char_lit ) «;» - LexTerm : - ( char_lit - •char_lit ) «(» - LexTerm : - ( char_lit - •char_lit ) «-» - LexTerm : - ( char_lit - •char_lit ) «.» - LexTerm : - ( char_lit - •char_lit ) «[» - LexTerm : - ( char_lit - •char_lit ) «char_lit» - LexTerm : - ( char_lit - •char_lit ) «regDefId» - LexTerm : - ( char_lit - •char_lit ) «{» - LexTerm : - ( char_lit - •char_lit ) «|» + LexTerm : ~ ( char_lit - •char_lit ) «;» + LexTerm : ~ ( char_lit - •char_lit ) «(» + LexTerm : ~ ( char_lit - •char_lit ) «.» + LexTerm : ~ ( char_lit - •char_lit ) «[» + LexTerm : ~ ( char_lit - •char_lit ) «char_lit» + LexTerm : ~ ( char_lit - •char_lit ) «regDefId» + LexTerm : ~ ( char_lit - •char_lit ) «{» + LexTerm : ~ ( char_lit - •char_lit ) «~» + LexTerm : ~ ( char_lit - •char_lit ) «|» } Transitions: char_lit -> 142 @@ -4565,17 +4565,17 @@ S124{ LexAlt : LexAlt •LexTerm «)» LexAlt : LexAlt •LexTerm «|» LexAlt : LexAlt •LexTerm «(» - LexAlt : LexAlt •LexTerm «-» LexAlt : LexAlt •LexTerm «.» LexAlt : LexAlt •LexTerm «[» LexAlt : LexAlt •LexTerm «char_lit» LexAlt : LexAlt •LexTerm «regDefId» LexAlt : LexAlt •LexTerm «{» + LexAlt : LexAlt •LexTerm «~» LexTerm : •. «)» LexTerm : •char_lit «)» LexTerm : •char_lit - char_lit «)» - LexTerm : •- char_lit «)» - LexTerm : •- ( char_lit - char_lit ) «)» + LexTerm : •~ char_lit «)» + LexTerm : •~ ( char_lit - char_lit ) «)» LexTerm : •regDefId «)» LexTerm : •[ LexPattern ] «)» LexTerm : •{ LexPattern } «)» @@ -4583,8 +4583,8 @@ S124{ LexTerm : •. «|» LexTerm : •char_lit «|» LexTerm : •char_lit - char_lit «|» - LexTerm : •- char_lit «|» - LexTerm : •- ( char_lit - char_lit ) «|» + LexTerm : •~ char_lit «|» + LexTerm : •~ ( char_lit - char_lit ) «|» LexTerm : •regDefId «|» LexTerm : •[ LexPattern ] «|» LexTerm : •{ LexPattern } «|» @@ -4592,26 +4592,17 @@ S124{ LexTerm : •. «(» LexTerm : •char_lit «(» LexTerm : •char_lit - char_lit «(» - LexTerm : •- char_lit «(» - LexTerm : •- ( char_lit - char_lit ) «(» + LexTerm : •~ char_lit «(» + LexTerm : •~ ( char_lit - char_lit ) «(» LexTerm : •regDefId «(» LexTerm : •[ LexPattern ] «(» LexTerm : •{ LexPattern } «(» LexTerm : •( LexPattern ) «(» - LexTerm : •. «-» - LexTerm : •char_lit «-» - LexTerm : •char_lit - char_lit «-» - LexTerm : •- char_lit «-» - LexTerm : •- ( char_lit - char_lit ) «-» - LexTerm : •regDefId «-» - LexTerm : •[ LexPattern ] «-» - LexTerm : •{ LexPattern } «-» - LexTerm : •( LexPattern ) «-» LexTerm : •. «.» LexTerm : •char_lit «.» LexTerm : •char_lit - char_lit «.» - LexTerm : •- char_lit «.» - LexTerm : •- ( char_lit - char_lit ) «.» + LexTerm : •~ char_lit «.» + LexTerm : •~ ( char_lit - char_lit ) «.» LexTerm : •regDefId «.» LexTerm : •[ LexPattern ] «.» LexTerm : •{ LexPattern } «.» @@ -4619,8 +4610,8 @@ S124{ LexTerm : •. «[» LexTerm : •char_lit «[» LexTerm : •char_lit - char_lit «[» - LexTerm : •- char_lit «[» - LexTerm : •- ( char_lit - char_lit ) «[» + LexTerm : •~ char_lit «[» + LexTerm : •~ ( char_lit - char_lit ) «[» LexTerm : •regDefId «[» LexTerm : •[ LexPattern ] «[» LexTerm : •{ LexPattern } «[» @@ -4628,8 +4619,8 @@ S124{ LexTerm : •. «char_lit» LexTerm : •char_lit «char_lit» LexTerm : •char_lit - char_lit «char_lit» - LexTerm : •- char_lit «char_lit» - LexTerm : •- ( char_lit - char_lit ) «char_lit» + LexTerm : •~ char_lit «char_lit» + LexTerm : •~ ( char_lit - char_lit ) «char_lit» LexTerm : •regDefId «char_lit» LexTerm : •[ LexPattern ] «char_lit» LexTerm : •{ LexPattern } «char_lit» @@ -4637,8 +4628,8 @@ S124{ LexTerm : •. «regDefId» LexTerm : •char_lit «regDefId» LexTerm : •char_lit - char_lit «regDefId» - LexTerm : •- char_lit «regDefId» - LexTerm : •- ( char_lit - char_lit ) «regDefId» + LexTerm : •~ char_lit «regDefId» + LexTerm : •~ ( char_lit - char_lit ) «regDefId» LexTerm : •regDefId «regDefId» LexTerm : •[ LexPattern ] «regDefId» LexTerm : •{ LexPattern } «regDefId» @@ -4646,18 +4637,27 @@ S124{ LexTerm : •. «{» LexTerm : •char_lit «{» LexTerm : •char_lit - char_lit «{» - LexTerm : •- char_lit «{» - LexTerm : •- ( char_lit - char_lit ) «{» + LexTerm : •~ char_lit «{» + LexTerm : •~ ( char_lit - char_lit ) «{» LexTerm : •regDefId «{» LexTerm : •[ LexPattern ] «{» LexTerm : •{ LexPattern } «{» LexTerm : •( LexPattern ) «{» + LexTerm : •. «~» + LexTerm : •char_lit «~» + LexTerm : •char_lit - char_lit «~» + LexTerm : •~ char_lit «~» + LexTerm : •~ ( char_lit - char_lit ) «~» + LexTerm : •regDefId «~» + LexTerm : •[ LexPattern ] «~» + LexTerm : •{ LexPattern } «~» + LexTerm : •( LexPattern ) «~» } Transitions: regDefId -> 56 . -> 57 char_lit -> 58 - - -> 59 + ~ -> 59 ( -> 60 [ -> 61 { -> 62 @@ -4667,27 +4667,27 @@ Transitions: S125{ LexTerm : char_lit - char_lit• «)» LexTerm : char_lit - char_lit• «(» - LexTerm : char_lit - char_lit• «-» LexTerm : char_lit - char_lit• «.» LexTerm : char_lit - char_lit• «[» LexTerm : char_lit - char_lit• «char_lit» LexTerm : char_lit - char_lit• «regDefId» LexTerm : char_lit - char_lit• «{» + LexTerm : char_lit - char_lit• «~» LexTerm : char_lit - char_lit• «|» } Transitions: S126{ - LexTerm : - ( char_lit •- char_lit ) «)» - LexTerm : - ( char_lit •- char_lit ) «(» - LexTerm : - ( char_lit •- char_lit ) «-» - LexTerm : - ( char_lit •- char_lit ) «.» - LexTerm : - ( char_lit •- char_lit ) «[» - LexTerm : - ( char_lit •- char_lit ) «char_lit» - LexTerm : - ( char_lit •- char_lit ) «regDefId» - LexTerm : - ( char_lit •- char_lit ) «{» - LexTerm : - ( char_lit •- char_lit ) «|» + LexTerm : ~ ( char_lit •- char_lit ) «)» + LexTerm : ~ ( char_lit •- char_lit ) «(» + LexTerm : ~ ( char_lit •- char_lit ) «.» + LexTerm : ~ ( char_lit •- char_lit ) «[» + LexTerm : ~ ( char_lit •- char_lit ) «char_lit» + LexTerm : ~ ( char_lit •- char_lit ) «regDefId» + LexTerm : ~ ( char_lit •- char_lit ) «{» + LexTerm : ~ ( char_lit •- char_lit ) «~» + LexTerm : ~ ( char_lit •- char_lit ) «|» } Transitions: - -> 143 @@ -4696,12 +4696,12 @@ Transitions: S127{ LexTerm : ( LexPattern )• «)» LexTerm : ( LexPattern )• «(» - LexTerm : ( LexPattern )• «-» LexTerm : ( LexPattern )• «.» LexTerm : ( LexPattern )• «[» LexTerm : ( LexPattern )• «char_lit» LexTerm : ( LexPattern )• «regDefId» LexTerm : ( LexPattern )• «{» + LexTerm : ( LexPattern )• «~» LexTerm : ( LexPattern )• «|» } Transitions: @@ -4710,12 +4710,12 @@ Transitions: S128{ LexTerm : [ LexPattern ]• «)» LexTerm : [ LexPattern ]• «(» - LexTerm : [ LexPattern ]• «-» LexTerm : [ LexPattern ]• «.» LexTerm : [ LexPattern ]• «[» LexTerm : [ LexPattern ]• «char_lit» LexTerm : [ LexPattern ]• «regDefId» LexTerm : [ LexPattern ]• «{» + LexTerm : [ LexPattern ]• «~» LexTerm : [ LexPattern ]• «|» } Transitions: @@ -4724,12 +4724,12 @@ Transitions: S129{ LexTerm : { LexPattern }• «)» LexTerm : { LexPattern }• «(» - LexTerm : { LexPattern }• «-» LexTerm : { LexPattern }• «.» LexTerm : { LexPattern }• «[» LexTerm : { LexPattern }• «char_lit» LexTerm : { LexPattern }• «regDefId» LexTerm : { LexPattern }• «{» + LexTerm : { LexPattern }• «~» LexTerm : { LexPattern }• «|» } Transitions: @@ -4741,17 +4741,17 @@ S130{ LexAlt : LexAlt •LexTerm «]» LexAlt : LexAlt •LexTerm «|» LexAlt : LexAlt •LexTerm «(» - LexAlt : LexAlt •LexTerm «-» LexAlt : LexAlt •LexTerm «.» LexAlt : LexAlt •LexTerm «[» LexAlt : LexAlt •LexTerm «char_lit» LexAlt : LexAlt •LexTerm «regDefId» LexAlt : LexAlt •LexTerm «{» + LexAlt : LexAlt •LexTerm «~» LexTerm : •. «]» LexTerm : •char_lit «]» LexTerm : •char_lit - char_lit «]» - LexTerm : •- char_lit «]» - LexTerm : •- ( char_lit - char_lit ) «]» + LexTerm : •~ char_lit «]» + LexTerm : •~ ( char_lit - char_lit ) «]» LexTerm : •regDefId «]» LexTerm : •[ LexPattern ] «]» LexTerm : •{ LexPattern } «]» @@ -4759,8 +4759,8 @@ S130{ LexTerm : •. «|» LexTerm : •char_lit «|» LexTerm : •char_lit - char_lit «|» - LexTerm : •- char_lit «|» - LexTerm : •- ( char_lit - char_lit ) «|» + LexTerm : •~ char_lit «|» + LexTerm : •~ ( char_lit - char_lit ) «|» LexTerm : •regDefId «|» LexTerm : •[ LexPattern ] «|» LexTerm : •{ LexPattern } «|» @@ -4768,26 +4768,17 @@ S130{ LexTerm : •. «(» LexTerm : •char_lit «(» LexTerm : •char_lit - char_lit «(» - LexTerm : •- char_lit «(» - LexTerm : •- ( char_lit - char_lit ) «(» + LexTerm : •~ char_lit «(» + LexTerm : •~ ( char_lit - char_lit ) «(» LexTerm : •regDefId «(» LexTerm : •[ LexPattern ] «(» LexTerm : •{ LexPattern } «(» LexTerm : •( LexPattern ) «(» - LexTerm : •. «-» - LexTerm : •char_lit «-» - LexTerm : •char_lit - char_lit «-» - LexTerm : •- char_lit «-» - LexTerm : •- ( char_lit - char_lit ) «-» - LexTerm : •regDefId «-» - LexTerm : •[ LexPattern ] «-» - LexTerm : •{ LexPattern } «-» - LexTerm : •( LexPattern ) «-» LexTerm : •. «.» LexTerm : •char_lit «.» LexTerm : •char_lit - char_lit «.» - LexTerm : •- char_lit «.» - LexTerm : •- ( char_lit - char_lit ) «.» + LexTerm : •~ char_lit «.» + LexTerm : •~ ( char_lit - char_lit ) «.» LexTerm : •regDefId «.» LexTerm : •[ LexPattern ] «.» LexTerm : •{ LexPattern } «.» @@ -4795,8 +4786,8 @@ S130{ LexTerm : •. «[» LexTerm : •char_lit «[» LexTerm : •char_lit - char_lit «[» - LexTerm : •- char_lit «[» - LexTerm : •- ( char_lit - char_lit ) «[» + LexTerm : •~ char_lit «[» + LexTerm : •~ ( char_lit - char_lit ) «[» LexTerm : •regDefId «[» LexTerm : •[ LexPattern ] «[» LexTerm : •{ LexPattern } «[» @@ -4804,8 +4795,8 @@ S130{ LexTerm : •. «char_lit» LexTerm : •char_lit «char_lit» LexTerm : •char_lit - char_lit «char_lit» - LexTerm : •- char_lit «char_lit» - LexTerm : •- ( char_lit - char_lit ) «char_lit» + LexTerm : •~ char_lit «char_lit» + LexTerm : •~ ( char_lit - char_lit ) «char_lit» LexTerm : •regDefId «char_lit» LexTerm : •[ LexPattern ] «char_lit» LexTerm : •{ LexPattern } «char_lit» @@ -4813,8 +4804,8 @@ S130{ LexTerm : •. «regDefId» LexTerm : •char_lit «regDefId» LexTerm : •char_lit - char_lit «regDefId» - LexTerm : •- char_lit «regDefId» - LexTerm : •- ( char_lit - char_lit ) «regDefId» + LexTerm : •~ char_lit «regDefId» + LexTerm : •~ ( char_lit - char_lit ) «regDefId» LexTerm : •regDefId «regDefId» LexTerm : •[ LexPattern ] «regDefId» LexTerm : •{ LexPattern } «regDefId» @@ -4822,18 +4813,27 @@ S130{ LexTerm : •. «{» LexTerm : •char_lit «{» LexTerm : •char_lit - char_lit «{» - LexTerm : •- char_lit «{» - LexTerm : •- ( char_lit - char_lit ) «{» + LexTerm : •~ char_lit «{» + LexTerm : •~ ( char_lit - char_lit ) «{» LexTerm : •regDefId «{» LexTerm : •[ LexPattern ] «{» LexTerm : •{ LexPattern } «{» LexTerm : •( LexPattern ) «{» + LexTerm : •. «~» + LexTerm : •char_lit «~» + LexTerm : •char_lit - char_lit «~» + LexTerm : •~ char_lit «~» + LexTerm : •~ ( char_lit - char_lit ) «~» + LexTerm : •regDefId «~» + LexTerm : •[ LexPattern ] «~» + LexTerm : •{ LexPattern } «~» + LexTerm : •( LexPattern ) «~» } Transitions: regDefId -> 66 . -> 67 char_lit -> 68 - - -> 69 + ~ -> 69 ( -> 70 [ -> 71 { -> 72 @@ -4843,27 +4843,27 @@ Transitions: S131{ LexTerm : char_lit - char_lit• «]» LexTerm : char_lit - char_lit• «(» - LexTerm : char_lit - char_lit• «-» LexTerm : char_lit - char_lit• «.» LexTerm : char_lit - char_lit• «[» LexTerm : char_lit - char_lit• «char_lit» LexTerm : char_lit - char_lit• «regDefId» LexTerm : char_lit - char_lit• «{» + LexTerm : char_lit - char_lit• «~» LexTerm : char_lit - char_lit• «|» } Transitions: S132{ - LexTerm : - ( char_lit •- char_lit ) «]» - LexTerm : - ( char_lit •- char_lit ) «(» - LexTerm : - ( char_lit •- char_lit ) «-» - LexTerm : - ( char_lit •- char_lit ) «.» - LexTerm : - ( char_lit •- char_lit ) «[» - LexTerm : - ( char_lit •- char_lit ) «char_lit» - LexTerm : - ( char_lit •- char_lit ) «regDefId» - LexTerm : - ( char_lit •- char_lit ) «{» - LexTerm : - ( char_lit •- char_lit ) «|» + LexTerm : ~ ( char_lit •- char_lit ) «]» + LexTerm : ~ ( char_lit •- char_lit ) «(» + LexTerm : ~ ( char_lit •- char_lit ) «.» + LexTerm : ~ ( char_lit •- char_lit ) «[» + LexTerm : ~ ( char_lit •- char_lit ) «char_lit» + LexTerm : ~ ( char_lit •- char_lit ) «regDefId» + LexTerm : ~ ( char_lit •- char_lit ) «{» + LexTerm : ~ ( char_lit •- char_lit ) «~» + LexTerm : ~ ( char_lit •- char_lit ) «|» } Transitions: - -> 144 @@ -4872,12 +4872,12 @@ Transitions: S133{ LexTerm : ( LexPattern )• «]» LexTerm : ( LexPattern )• «(» - LexTerm : ( LexPattern )• «-» LexTerm : ( LexPattern )• «.» LexTerm : ( LexPattern )• «[» LexTerm : ( LexPattern )• «char_lit» LexTerm : ( LexPattern )• «regDefId» LexTerm : ( LexPattern )• «{» + LexTerm : ( LexPattern )• «~» LexTerm : ( LexPattern )• «|» } Transitions: @@ -4886,12 +4886,12 @@ Transitions: S134{ LexTerm : [ LexPattern ]• «]» LexTerm : [ LexPattern ]• «(» - LexTerm : [ LexPattern ]• «-» LexTerm : [ LexPattern ]• «.» LexTerm : [ LexPattern ]• «[» LexTerm : [ LexPattern ]• «char_lit» LexTerm : [ LexPattern ]• «regDefId» LexTerm : [ LexPattern ]• «{» + LexTerm : [ LexPattern ]• «~» LexTerm : [ LexPattern ]• «|» } Transitions: @@ -4900,12 +4900,12 @@ Transitions: S135{ LexTerm : { LexPattern }• «]» LexTerm : { LexPattern }• «(» - LexTerm : { LexPattern }• «-» LexTerm : { LexPattern }• «.» LexTerm : { LexPattern }• «[» LexTerm : { LexPattern }• «char_lit» LexTerm : { LexPattern }• «regDefId» LexTerm : { LexPattern }• «{» + LexTerm : { LexPattern }• «~» LexTerm : { LexPattern }• «|» } Transitions: @@ -4917,17 +4917,17 @@ S136{ LexAlt : LexAlt •LexTerm «}» LexAlt : LexAlt •LexTerm «|» LexAlt : LexAlt •LexTerm «(» - LexAlt : LexAlt •LexTerm «-» LexAlt : LexAlt •LexTerm «.» LexAlt : LexAlt •LexTerm «[» LexAlt : LexAlt •LexTerm «char_lit» LexAlt : LexAlt •LexTerm «regDefId» LexAlt : LexAlt •LexTerm «{» + LexAlt : LexAlt •LexTerm «~» LexTerm : •. «}» LexTerm : •char_lit «}» LexTerm : •char_lit - char_lit «}» - LexTerm : •- char_lit «}» - LexTerm : •- ( char_lit - char_lit ) «}» + LexTerm : •~ char_lit «}» + LexTerm : •~ ( char_lit - char_lit ) «}» LexTerm : •regDefId «}» LexTerm : •[ LexPattern ] «}» LexTerm : •{ LexPattern } «}» @@ -4935,8 +4935,8 @@ S136{ LexTerm : •. «|» LexTerm : •char_lit «|» LexTerm : •char_lit - char_lit «|» - LexTerm : •- char_lit «|» - LexTerm : •- ( char_lit - char_lit ) «|» + LexTerm : •~ char_lit «|» + LexTerm : •~ ( char_lit - char_lit ) «|» LexTerm : •regDefId «|» LexTerm : •[ LexPattern ] «|» LexTerm : •{ LexPattern } «|» @@ -4944,26 +4944,17 @@ S136{ LexTerm : •. «(» LexTerm : •char_lit «(» LexTerm : •char_lit - char_lit «(» - LexTerm : •- char_lit «(» - LexTerm : •- ( char_lit - char_lit ) «(» + LexTerm : •~ char_lit «(» + LexTerm : •~ ( char_lit - char_lit ) «(» LexTerm : •regDefId «(» LexTerm : •[ LexPattern ] «(» LexTerm : •{ LexPattern } «(» LexTerm : •( LexPattern ) «(» - LexTerm : •. «-» - LexTerm : •char_lit «-» - LexTerm : •char_lit - char_lit «-» - LexTerm : •- char_lit «-» - LexTerm : •- ( char_lit - char_lit ) «-» - LexTerm : •regDefId «-» - LexTerm : •[ LexPattern ] «-» - LexTerm : •{ LexPattern } «-» - LexTerm : •( LexPattern ) «-» LexTerm : •. «.» LexTerm : •char_lit «.» LexTerm : •char_lit - char_lit «.» - LexTerm : •- char_lit «.» - LexTerm : •- ( char_lit - char_lit ) «.» + LexTerm : •~ char_lit «.» + LexTerm : •~ ( char_lit - char_lit ) «.» LexTerm : •regDefId «.» LexTerm : •[ LexPattern ] «.» LexTerm : •{ LexPattern } «.» @@ -4971,8 +4962,8 @@ S136{ LexTerm : •. «[» LexTerm : •char_lit «[» LexTerm : •char_lit - char_lit «[» - LexTerm : •- char_lit «[» - LexTerm : •- ( char_lit - char_lit ) «[» + LexTerm : •~ char_lit «[» + LexTerm : •~ ( char_lit - char_lit ) «[» LexTerm : •regDefId «[» LexTerm : •[ LexPattern ] «[» LexTerm : •{ LexPattern } «[» @@ -4980,8 +4971,8 @@ S136{ LexTerm : •. «char_lit» LexTerm : •char_lit «char_lit» LexTerm : •char_lit - char_lit «char_lit» - LexTerm : •- char_lit «char_lit» - LexTerm : •- ( char_lit - char_lit ) «char_lit» + LexTerm : •~ char_lit «char_lit» + LexTerm : •~ ( char_lit - char_lit ) «char_lit» LexTerm : •regDefId «char_lit» LexTerm : •[ LexPattern ] «char_lit» LexTerm : •{ LexPattern } «char_lit» @@ -4989,8 +4980,8 @@ S136{ LexTerm : •. «regDefId» LexTerm : •char_lit «regDefId» LexTerm : •char_lit - char_lit «regDefId» - LexTerm : •- char_lit «regDefId» - LexTerm : •- ( char_lit - char_lit ) «regDefId» + LexTerm : •~ char_lit «regDefId» + LexTerm : •~ ( char_lit - char_lit ) «regDefId» LexTerm : •regDefId «regDefId» LexTerm : •[ LexPattern ] «regDefId» LexTerm : •{ LexPattern } «regDefId» @@ -4998,18 +4989,27 @@ S136{ LexTerm : •. «{» LexTerm : •char_lit «{» LexTerm : •char_lit - char_lit «{» - LexTerm : •- char_lit «{» - LexTerm : •- ( char_lit - char_lit ) «{» + LexTerm : •~ char_lit «{» + LexTerm : •~ ( char_lit - char_lit ) «{» LexTerm : •regDefId «{» LexTerm : •[ LexPattern ] «{» LexTerm : •{ LexPattern } «{» LexTerm : •( LexPattern ) «{» + LexTerm : •. «~» + LexTerm : •char_lit «~» + LexTerm : •char_lit - char_lit «~» + LexTerm : •~ char_lit «~» + LexTerm : •~ ( char_lit - char_lit ) «~» + LexTerm : •regDefId «~» + LexTerm : •[ LexPattern ] «~» + LexTerm : •{ LexPattern } «~» + LexTerm : •( LexPattern ) «~» } Transitions: regDefId -> 76 . -> 77 char_lit -> 78 - - -> 79 + ~ -> 79 ( -> 80 [ -> 81 { -> 82 @@ -5019,27 +5019,27 @@ Transitions: S137{ LexTerm : char_lit - char_lit• «}» LexTerm : char_lit - char_lit• «(» - LexTerm : char_lit - char_lit• «-» LexTerm : char_lit - char_lit• «.» LexTerm : char_lit - char_lit• «[» LexTerm : char_lit - char_lit• «char_lit» LexTerm : char_lit - char_lit• «regDefId» LexTerm : char_lit - char_lit• «{» + LexTerm : char_lit - char_lit• «~» LexTerm : char_lit - char_lit• «|» } Transitions: S138{ - LexTerm : - ( char_lit •- char_lit ) «}» - LexTerm : - ( char_lit •- char_lit ) «(» - LexTerm : - ( char_lit •- char_lit ) «-» - LexTerm : - ( char_lit •- char_lit ) «.» - LexTerm : - ( char_lit •- char_lit ) «[» - LexTerm : - ( char_lit •- char_lit ) «char_lit» - LexTerm : - ( char_lit •- char_lit ) «regDefId» - LexTerm : - ( char_lit •- char_lit ) «{» - LexTerm : - ( char_lit •- char_lit ) «|» + LexTerm : ~ ( char_lit •- char_lit ) «}» + LexTerm : ~ ( char_lit •- char_lit ) «(» + LexTerm : ~ ( char_lit •- char_lit ) «.» + LexTerm : ~ ( char_lit •- char_lit ) «[» + LexTerm : ~ ( char_lit •- char_lit ) «char_lit» + LexTerm : ~ ( char_lit •- char_lit ) «regDefId» + LexTerm : ~ ( char_lit •- char_lit ) «{» + LexTerm : ~ ( char_lit •- char_lit ) «~» + LexTerm : ~ ( char_lit •- char_lit ) «|» } Transitions: - -> 145 @@ -5048,12 +5048,12 @@ Transitions: S139{ LexTerm : ( LexPattern )• «}» LexTerm : ( LexPattern )• «(» - LexTerm : ( LexPattern )• «-» LexTerm : ( LexPattern )• «.» LexTerm : ( LexPattern )• «[» LexTerm : ( LexPattern )• «char_lit» LexTerm : ( LexPattern )• «regDefId» LexTerm : ( LexPattern )• «{» + LexTerm : ( LexPattern )• «~» LexTerm : ( LexPattern )• «|» } Transitions: @@ -5062,12 +5062,12 @@ Transitions: S140{ LexTerm : [ LexPattern ]• «}» LexTerm : [ LexPattern ]• «(» - LexTerm : [ LexPattern ]• «-» LexTerm : [ LexPattern ]• «.» LexTerm : [ LexPattern ]• «[» LexTerm : [ LexPattern ]• «char_lit» LexTerm : [ LexPattern ]• «regDefId» LexTerm : [ LexPattern ]• «{» + LexTerm : [ LexPattern ]• «~» LexTerm : [ LexPattern ]• «|» } Transitions: @@ -5076,174 +5076,174 @@ Transitions: S141{ LexTerm : { LexPattern }• «}» LexTerm : { LexPattern }• «(» - LexTerm : { LexPattern }• «-» LexTerm : { LexPattern }• «.» LexTerm : { LexPattern }• «[» LexTerm : { LexPattern }• «char_lit» LexTerm : { LexPattern }• «regDefId» LexTerm : { LexPattern }• «{» + LexTerm : { LexPattern }• «~» LexTerm : { LexPattern }• «|» } Transitions: S142{ - LexTerm : - ( char_lit - char_lit •) «;» - LexTerm : - ( char_lit - char_lit •) «(» - LexTerm : - ( char_lit - char_lit •) «-» - LexTerm : - ( char_lit - char_lit •) «.» - LexTerm : - ( char_lit - char_lit •) «[» - LexTerm : - ( char_lit - char_lit •) «char_lit» - LexTerm : - ( char_lit - char_lit •) «regDefId» - LexTerm : - ( char_lit - char_lit •) «{» - LexTerm : - ( char_lit - char_lit •) «|» + LexTerm : ~ ( char_lit - char_lit •) «;» + LexTerm : ~ ( char_lit - char_lit •) «(» + LexTerm : ~ ( char_lit - char_lit •) «.» + LexTerm : ~ ( char_lit - char_lit •) «[» + LexTerm : ~ ( char_lit - char_lit •) «char_lit» + LexTerm : ~ ( char_lit - char_lit •) «regDefId» + LexTerm : ~ ( char_lit - char_lit •) «{» + LexTerm : ~ ( char_lit - char_lit •) «~» + LexTerm : ~ ( char_lit - char_lit •) «|» } Transitions: ) -> 146 S143{ - LexTerm : - ( char_lit - •char_lit ) «)» - LexTerm : - ( char_lit - •char_lit ) «(» - LexTerm : - ( char_lit - •char_lit ) «-» - LexTerm : - ( char_lit - •char_lit ) «.» - LexTerm : - ( char_lit - •char_lit ) «[» - LexTerm : - ( char_lit - •char_lit ) «char_lit» - LexTerm : - ( char_lit - •char_lit ) «regDefId» - LexTerm : - ( char_lit - •char_lit ) «{» - LexTerm : - ( char_lit - •char_lit ) «|» + LexTerm : ~ ( char_lit - •char_lit ) «)» + LexTerm : ~ ( char_lit - •char_lit ) «(» + LexTerm : ~ ( char_lit - •char_lit ) «.» + LexTerm : ~ ( char_lit - •char_lit ) «[» + LexTerm : ~ ( char_lit - •char_lit ) «char_lit» + LexTerm : ~ ( char_lit - •char_lit ) «regDefId» + LexTerm : ~ ( char_lit - •char_lit ) «{» + LexTerm : ~ ( char_lit - •char_lit ) «~» + LexTerm : ~ ( char_lit - •char_lit ) «|» } Transitions: char_lit -> 147 S144{ - LexTerm : - ( char_lit - •char_lit ) «]» - LexTerm : - ( char_lit - •char_lit ) «(» - LexTerm : - ( char_lit - •char_lit ) «-» - LexTerm : - ( char_lit - •char_lit ) «.» - LexTerm : - ( char_lit - •char_lit ) «[» - LexTerm : - ( char_lit - •char_lit ) «char_lit» - LexTerm : - ( char_lit - •char_lit ) «regDefId» - LexTerm : - ( char_lit - •char_lit ) «{» - LexTerm : - ( char_lit - •char_lit ) «|» + LexTerm : ~ ( char_lit - •char_lit ) «]» + LexTerm : ~ ( char_lit - •char_lit ) «(» + LexTerm : ~ ( char_lit - •char_lit ) «.» + LexTerm : ~ ( char_lit - •char_lit ) «[» + LexTerm : ~ ( char_lit - •char_lit ) «char_lit» + LexTerm : ~ ( char_lit - •char_lit ) «regDefId» + LexTerm : ~ ( char_lit - •char_lit ) «{» + LexTerm : ~ ( char_lit - •char_lit ) «~» + LexTerm : ~ ( char_lit - •char_lit ) «|» } Transitions: char_lit -> 148 S145{ - LexTerm : - ( char_lit - •char_lit ) «}» - LexTerm : - ( char_lit - •char_lit ) «(» - LexTerm : - ( char_lit - •char_lit ) «-» - LexTerm : - ( char_lit - •char_lit ) «.» - LexTerm : - ( char_lit - •char_lit ) «[» - LexTerm : - ( char_lit - •char_lit ) «char_lit» - LexTerm : - ( char_lit - •char_lit ) «regDefId» - LexTerm : - ( char_lit - •char_lit ) «{» - LexTerm : - ( char_lit - •char_lit ) «|» + LexTerm : ~ ( char_lit - •char_lit ) «}» + LexTerm : ~ ( char_lit - •char_lit ) «(» + LexTerm : ~ ( char_lit - •char_lit ) «.» + LexTerm : ~ ( char_lit - •char_lit ) «[» + LexTerm : ~ ( char_lit - •char_lit ) «char_lit» + LexTerm : ~ ( char_lit - •char_lit ) «regDefId» + LexTerm : ~ ( char_lit - •char_lit ) «{» + LexTerm : ~ ( char_lit - •char_lit ) «~» + LexTerm : ~ ( char_lit - •char_lit ) «|» } Transitions: char_lit -> 149 S146{ - LexTerm : - ( char_lit - char_lit )• «;» - LexTerm : - ( char_lit - char_lit )• «(» - LexTerm : - ( char_lit - char_lit )• «-» - LexTerm : - ( char_lit - char_lit )• «.» - LexTerm : - ( char_lit - char_lit )• «[» - LexTerm : - ( char_lit - char_lit )• «char_lit» - LexTerm : - ( char_lit - char_lit )• «regDefId» - LexTerm : - ( char_lit - char_lit )• «{» - LexTerm : - ( char_lit - char_lit )• «|» + LexTerm : ~ ( char_lit - char_lit )• «;» + LexTerm : ~ ( char_lit - char_lit )• «(» + LexTerm : ~ ( char_lit - char_lit )• «.» + LexTerm : ~ ( char_lit - char_lit )• «[» + LexTerm : ~ ( char_lit - char_lit )• «char_lit» + LexTerm : ~ ( char_lit - char_lit )• «regDefId» + LexTerm : ~ ( char_lit - char_lit )• «{» + LexTerm : ~ ( char_lit - char_lit )• «~» + LexTerm : ~ ( char_lit - char_lit )• «|» } Transitions: S147{ - LexTerm : - ( char_lit - char_lit •) «)» - LexTerm : - ( char_lit - char_lit •) «(» - LexTerm : - ( char_lit - char_lit •) «-» - LexTerm : - ( char_lit - char_lit •) «.» - LexTerm : - ( char_lit - char_lit •) «[» - LexTerm : - ( char_lit - char_lit •) «char_lit» - LexTerm : - ( char_lit - char_lit •) «regDefId» - LexTerm : - ( char_lit - char_lit •) «{» - LexTerm : - ( char_lit - char_lit •) «|» + LexTerm : ~ ( char_lit - char_lit •) «)» + LexTerm : ~ ( char_lit - char_lit •) «(» + LexTerm : ~ ( char_lit - char_lit •) «.» + LexTerm : ~ ( char_lit - char_lit •) «[» + LexTerm : ~ ( char_lit - char_lit •) «char_lit» + LexTerm : ~ ( char_lit - char_lit •) «regDefId» + LexTerm : ~ ( char_lit - char_lit •) «{» + LexTerm : ~ ( char_lit - char_lit •) «~» + LexTerm : ~ ( char_lit - char_lit •) «|» } Transitions: ) -> 150 S148{ - LexTerm : - ( char_lit - char_lit •) «]» - LexTerm : - ( char_lit - char_lit •) «(» - LexTerm : - ( char_lit - char_lit •) «-» - LexTerm : - ( char_lit - char_lit •) «.» - LexTerm : - ( char_lit - char_lit •) «[» - LexTerm : - ( char_lit - char_lit •) «char_lit» - LexTerm : - ( char_lit - char_lit •) «regDefId» - LexTerm : - ( char_lit - char_lit •) «{» - LexTerm : - ( char_lit - char_lit •) «|» + LexTerm : ~ ( char_lit - char_lit •) «]» + LexTerm : ~ ( char_lit - char_lit •) «(» + LexTerm : ~ ( char_lit - char_lit •) «.» + LexTerm : ~ ( char_lit - char_lit •) «[» + LexTerm : ~ ( char_lit - char_lit •) «char_lit» + LexTerm : ~ ( char_lit - char_lit •) «regDefId» + LexTerm : ~ ( char_lit - char_lit •) «{» + LexTerm : ~ ( char_lit - char_lit •) «~» + LexTerm : ~ ( char_lit - char_lit •) «|» } Transitions: ) -> 151 S149{ - LexTerm : - ( char_lit - char_lit •) «}» - LexTerm : - ( char_lit - char_lit •) «(» - LexTerm : - ( char_lit - char_lit •) «-» - LexTerm : - ( char_lit - char_lit •) «.» - LexTerm : - ( char_lit - char_lit •) «[» - LexTerm : - ( char_lit - char_lit •) «char_lit» - LexTerm : - ( char_lit - char_lit •) «regDefId» - LexTerm : - ( char_lit - char_lit •) «{» - LexTerm : - ( char_lit - char_lit •) «|» + LexTerm : ~ ( char_lit - char_lit •) «}» + LexTerm : ~ ( char_lit - char_lit •) «(» + LexTerm : ~ ( char_lit - char_lit •) «.» + LexTerm : ~ ( char_lit - char_lit •) «[» + LexTerm : ~ ( char_lit - char_lit •) «char_lit» + LexTerm : ~ ( char_lit - char_lit •) «regDefId» + LexTerm : ~ ( char_lit - char_lit •) «{» + LexTerm : ~ ( char_lit - char_lit •) «~» + LexTerm : ~ ( char_lit - char_lit •) «|» } Transitions: ) -> 152 S150{ - LexTerm : - ( char_lit - char_lit )• «)» - LexTerm : - ( char_lit - char_lit )• «(» - LexTerm : - ( char_lit - char_lit )• «-» - LexTerm : - ( char_lit - char_lit )• «.» - LexTerm : - ( char_lit - char_lit )• «[» - LexTerm : - ( char_lit - char_lit )• «char_lit» - LexTerm : - ( char_lit - char_lit )• «regDefId» - LexTerm : - ( char_lit - char_lit )• «{» - LexTerm : - ( char_lit - char_lit )• «|» + LexTerm : ~ ( char_lit - char_lit )• «)» + LexTerm : ~ ( char_lit - char_lit )• «(» + LexTerm : ~ ( char_lit - char_lit )• «.» + LexTerm : ~ ( char_lit - char_lit )• «[» + LexTerm : ~ ( char_lit - char_lit )• «char_lit» + LexTerm : ~ ( char_lit - char_lit )• «regDefId» + LexTerm : ~ ( char_lit - char_lit )• «{» + LexTerm : ~ ( char_lit - char_lit )• «~» + LexTerm : ~ ( char_lit - char_lit )• «|» } Transitions: S151{ - LexTerm : - ( char_lit - char_lit )• «]» - LexTerm : - ( char_lit - char_lit )• «(» - LexTerm : - ( char_lit - char_lit )• «-» - LexTerm : - ( char_lit - char_lit )• «.» - LexTerm : - ( char_lit - char_lit )• «[» - LexTerm : - ( char_lit - char_lit )• «char_lit» - LexTerm : - ( char_lit - char_lit )• «regDefId» - LexTerm : - ( char_lit - char_lit )• «{» - LexTerm : - ( char_lit - char_lit )• «|» + LexTerm : ~ ( char_lit - char_lit )• «]» + LexTerm : ~ ( char_lit - char_lit )• «(» + LexTerm : ~ ( char_lit - char_lit )• «.» + LexTerm : ~ ( char_lit - char_lit )• «[» + LexTerm : ~ ( char_lit - char_lit )• «char_lit» + LexTerm : ~ ( char_lit - char_lit )• «regDefId» + LexTerm : ~ ( char_lit - char_lit )• «{» + LexTerm : ~ ( char_lit - char_lit )• «~» + LexTerm : ~ ( char_lit - char_lit )• «|» } Transitions: S152{ - LexTerm : - ( char_lit - char_lit )• «}» - LexTerm : - ( char_lit - char_lit )• «(» - LexTerm : - ( char_lit - char_lit )• «-» - LexTerm : - ( char_lit - char_lit )• «.» - LexTerm : - ( char_lit - char_lit )• «[» - LexTerm : - ( char_lit - char_lit )• «char_lit» - LexTerm : - ( char_lit - char_lit )• «regDefId» - LexTerm : - ( char_lit - char_lit )• «{» - LexTerm : - ( char_lit - char_lit )• «|» + LexTerm : ~ ( char_lit - char_lit )• «}» + LexTerm : ~ ( char_lit - char_lit )• «(» + LexTerm : ~ ( char_lit - char_lit )• «.» + LexTerm : ~ ( char_lit - char_lit )• «[» + LexTerm : ~ ( char_lit - char_lit )• «char_lit» + LexTerm : ~ ( char_lit - char_lit )• «regDefId» + LexTerm : ~ ( char_lit - char_lit )• «{» + LexTerm : ~ ( char_lit - char_lit )• «~» + LexTerm : ~ ( char_lit - char_lit )• «|» } Transitions: diff --git a/internal/fe2/log/first.txt b/internal/frontend/reparsed/log/first.txt similarity index 98% rename from internal/fe2/log/first.txt rename to internal/frontend/reparsed/log/first.txt index d1fec2f2..92d45df7 100644 --- a/internal/fe2/log/first.txt +++ b/internal/frontend/reparsed/log/first.txt @@ -29,30 +29,30 @@ LexProduction: { } LexPattern: { ( - - . [ char_lit regDefId { + ~ } LexAlt: { ( - - . [ char_lit regDefId { + ~ } LexTerm: { ( - - . [ char_lit regDefId { + ~ } SyntaxPart: { g_sdt_lit diff --git a/internal/fe2/log/lexer_sets.txt b/internal/frontend/reparsed/log/lexer_sets.txt similarity index 93% rename from internal/fe2/log/lexer_sets.txt rename to internal/frontend/reparsed/log/lexer_sets.txt index a03a485a..21b9a7c4 100644 --- a/internal/fe2/log/lexer_sets.txt +++ b/internal/frontend/reparsed/log/lexer_sets.txt @@ -19,6 +19,7 @@ S0{ | : • '|' . : • '.' - : • '-' + ~ : • '~' ( : • '(' ) : • ')' [ : • '[' @@ -64,10 +65,11 @@ Transitions: ['{','{'] -> S20 ['|','|'] -> S21 ['}','}'] -> S22 - [\u03b5,\u03b5] -> S23 - [\u03bb,\u03bb] -> S24 + ['~','~'] -> S23 + [\u03b5,\u03b5] -> S24 + [\u03bb,\u03bb] -> S25 Action: nil -Symbols classes: {['\t','\t'], ['\n','\n'], ['\r','\r'], [' ',' '], ['!','!'], ['"','"'], [''','''], ['(','('], [')',')'], ['-','-'], ['.','.'], ['/','/'], [':',':'], [';',';'], ['<','<'], ['A','Z'], ['[','['], [']',']'], ['_','_'], ['`','`'], ['a','d'], ['e','e'], ['f','z'], ['{','{'], ['|','|'], ['}','}'], [\u03b5,\u03b5], [\u03bb,\u03bb]} +Symbols classes: {['\t','\t'], ['\n','\n'], ['\r','\r'], [' ',' '], ['!','!'], ['"','"'], [''','''], ['(','('], [')',')'], ['-','-'], ['.','.'], ['/','/'], [':',':'], [';',';'], ['<','<'], ['A','Z'], ['[','['], [']',']'], ['_','_'], ['`','`'], ['a','d'], ['e','e'], ['f','z'], ['{','{'], ['|','|'], ['}','}'], ['~','~'], [\u03b5,\u03b5], [\u03bb,\u03bb]} S1{ !whitespace : (' ' | '\t' | '\n' | '\r') • @@ -82,7 +84,7 @@ S2{ _lowcase : • 'a'-'z' } Transitions: - ['a','z'] -> S25 + ['a','z'] -> S26 Action: nil Symbols classes: {['a','z']} @@ -104,9 +106,9 @@ S3{ _little_u_value : • '\' 'u' _hex_digit _hex_digit _hex_digit _hex_digit } Transitions: - ['"','"'] -> S26 - ['\','\'] -> S27 -. -> S28 + ['"','"'] -> S27 + ['\','\'] -> S28 +. -> S29 Action: nil Symbols classes: {['"','"'], ['\','\']} @@ -126,8 +128,8 @@ S4{ _little_u_value : • '\' 'u' _hex_digit _hex_digit _hex_digit _hex_digit } Transitions: - ['\','\'] -> S29 -. -> S30 + ['\','\'] -> S30 +. -> S31 Action: nil Symbols classes: {['\','\']} @@ -166,8 +168,8 @@ S9{ !comment : • _lineComment | _blockComment } Transitions: - ['*','*'] -> S31 - ['/','/'] -> S32 + ['*','*'] -> S32 + ['/','/'] -> S33 Action: nil Symbols classes: {['*','*'], ['/','/']} @@ -189,7 +191,7 @@ S12{ g_sdt_lit : '<' • '<' . {.} '>' '>' } Transitions: - ['<','<'] -> S33 + ['<','<'] -> S34 Action: nil Symbols classes: {['<','<']} @@ -206,10 +208,10 @@ S13{ _upcase : • 'A'-'Z' } Transitions: - ['0','9'] -> S34 - ['A','Z'] -> S35 - ['_','_'] -> S36 - ['a','z'] -> S37 + ['0','9'] -> S35 + ['A','Z'] -> S36 + ['_','_'] -> S37 + ['a','z'] -> S38 Action: Accept("prodId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} @@ -239,10 +241,10 @@ S16{ _upcase : • 'A'-'Z' } Transitions: - ['0','9'] -> S38 - ['A','Z'] -> S39 - ['_','_'] -> S40 - ['a','z'] -> S41 + ['0','9'] -> S39 + ['A','Z'] -> S40 + ['_','_'] -> S41 + ['a','z'] -> S42 Action: Accept("regDefId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} @@ -252,7 +254,7 @@ S17{ string_lit : • _raw_string | _interpreted_string } Transitions: - ['`','`'] -> S42 + ['`','`'] -> S43 . -> S17 Action: nil Symbols classes: {['`','`']} @@ -272,10 +274,10 @@ S18{ _upcase : • 'A'-'Z' } Transitions: - ['0','9'] -> S43 - ['A','Z'] -> S44 - ['_','_'] -> S45 - ['a','z'] -> S46 + ['0','9'] -> S44 + ['A','Z'] -> S45 + ['_','_'] -> S46 + ['a','z'] -> S47 Action: Accept("tokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} @@ -296,14 +298,14 @@ S19{ _upcase : • 'A'-'Z' } Transitions: - ['0','9'] -> S43 - ['A','Z'] -> S44 - ['_','_'] -> S45 - ['a','l'] -> S46 - ['m','m'] -> S47 - ['n','q'] -> S46 - ['r','r'] -> S48 - ['s','z'] -> S46 + ['0','9'] -> S44 + ['A','Z'] -> S45 + ['_','_'] -> S46 + ['a','l'] -> S47 + ['m','m'] -> S48 + ['n','q'] -> S47 + ['r','r'] -> S49 + ['s','z'] -> S47 Action: Accept("tokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','l'], ['m','m'], ['n','q'], ['r','r'], ['s','z']} @@ -329,20 +331,27 @@ Action: Accept("}") Symbols classes: {} S23{ + ~ : '~' • +} +Transitions: +Action: Accept("~") +Symbols classes: {} + +S24{ ε : \u03b5 • } Transitions: Action: Accept("ε") Symbols classes: {} -S24{ +S25{ λ : \u03bb • } Transitions: Action: Accept("λ") Symbols classes: {} -S25{ +S26{ _lowcase : 'a'-'z' • _tokId : _lowcase {_id_char} • _tokId : _lowcase {• _id_char} @@ -357,14 +366,14 @@ S25{ _upcase : • 'A'-'Z' } Transitions: - ['0','9'] -> S49 - ['A','Z'] -> S50 - ['_','_'] -> S51 - ['a','z'] -> S52 + ['0','9'] -> S50 + ['A','Z'] -> S51 + ['_','_'] -> S52 + ['a','z'] -> S53 Action: Accept("ignoredTokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} -S26{ +S27{ _interpreted_string : '"' {_unicode_value | _byte_value} '"' • string_lit : (_raw_string | _interpreted_string) • } @@ -372,7 +381,7 @@ Transitions: Action: Accept("string_lit") Symbols classes: {} -S27{ +S28{ _hex_byte_value : '\' • 'x' _hex_digit _hex_digit _octal_byte_value : '\' • _octal_digit _octal_digit _octal_digit _escaped_char : '\' ('a' | 'b' | 'f' | 'n' | 'r' | 't' | 'v' | '\' | ''' | • '"') @@ -398,24 +407,24 @@ S27{ _octal_digit : • '0'-'7' } Transitions: - ['"','"'] -> S53 - [''','''] -> S53 - ['0','7'] -> S54 - ['U','U'] -> S55 - ['\','\'] -> S53 - ['a','a'] -> S53 - ['b','b'] -> S53 - ['f','f'] -> S53 - ['n','n'] -> S53 - ['r','r'] -> S53 - ['t','t'] -> S53 - ['u','u'] -> S56 - ['v','v'] -> S53 - ['x','x'] -> S57 + ['"','"'] -> S54 + [''','''] -> S54 + ['0','7'] -> S55 + ['U','U'] -> S56 + ['\','\'] -> S54 + ['a','a'] -> S54 + ['b','b'] -> S54 + ['f','f'] -> S54 + ['n','n'] -> S54 + ['r','r'] -> S54 + ['t','t'] -> S54 + ['u','u'] -> S57 + ['v','v'] -> S54 + ['x','x'] -> S58 Action: nil Symbols classes: {['"','"'], [''','''], ['0','7'], ['U','U'], ['\','\'], ['a','a'], ['b','b'], ['f','f'], ['n','n'], ['r','r'], ['t','t'], ['u','u'], ['v','v'], ['x','x']} -S28{ +S29{ _unicode_value : (. | _little_u_value | _big_u_value | _escaped_char) • _interpreted_string : '"' {_unicode_value | _byte_value} • '"' _interpreted_string : '"' {_unicode_value | • _byte_value} '"' @@ -434,13 +443,13 @@ S28{ _little_u_value : • '\' 'u' _hex_digit _hex_digit _hex_digit _hex_digit } Transitions: - ['"','"'] -> S26 - ['\','\'] -> S27 -. -> S28 + ['"','"'] -> S27 + ['\','\'] -> S28 +. -> S29 Action: nil Symbols classes: {['"','"'], ['\','\']} -S29{ +S30{ _hex_byte_value : '\' • 'x' _hex_digit _hex_digit _octal_byte_value : '\' • _octal_digit _octal_digit _octal_digit _escaped_char : '\' ('a' | 'b' | 'f' | 'n' | 'r' | 't' | 'v' | '\' | ''' | • '"') @@ -465,64 +474,64 @@ S29{ _octal_digit : • '0'-'7' } Transitions: - ['"','"'] -> S58 - [''','''] -> S58 - ['0','7'] -> S59 - ['U','U'] -> S60 - ['\','\'] -> S58 - ['a','a'] -> S58 - ['b','b'] -> S58 - ['f','f'] -> S58 - ['n','n'] -> S58 - ['r','r'] -> S58 - ['t','t'] -> S58 - ['u','u'] -> S61 - ['v','v'] -> S58 - ['x','x'] -> S62 + ['"','"'] -> S59 + [''','''] -> S59 + ['0','7'] -> S60 + ['U','U'] -> S61 + ['\','\'] -> S59 + ['a','a'] -> S59 + ['b','b'] -> S59 + ['f','f'] -> S59 + ['n','n'] -> S59 + ['r','r'] -> S59 + ['t','t'] -> S59 + ['u','u'] -> S62 + ['v','v'] -> S59 + ['x','x'] -> S63 Action: nil Symbols classes: {['"','"'], [''','''], ['0','7'], ['U','U'], ['\','\'], ['a','a'], ['b','b'], ['f','f'], ['n','n'], ['r','r'], ['t','t'], ['u','u'], ['v','v'], ['x','x']} -S30{ +S31{ _unicode_value : (. | _little_u_value | _big_u_value | _escaped_char) • char_lit : ''' (_unicode_value | _byte_value) • ''' } Transitions: - [''','''] -> S63 + [''','''] -> S64 Action: nil Symbols classes: {[''',''']} -S31{ +S32{ _blockComment : '/' '*' {. | '*'} • '*' '/' _blockComment : '/' '*' {. | • '*'} '*' '/' _blockComment : '/' '*' {• . | '*'} '*' '/' !comment : _lineComment | • _blockComment } Transitions: - ['*','*'] -> S64 -. -> S31 + ['*','*'] -> S65 +. -> S32 Action: nil Symbols classes: {['*','*']} -S32{ +S33{ _lineComment : '/' '/' {.} • '\n' _lineComment : '/' '/' {• .} '\n' !comment : • _lineComment | _blockComment } Transitions: - ['\n','\n'] -> S65 -. -> S32 + ['\n','\n'] -> S66 +. -> S33 Action: nil Symbols classes: {['\n','\n']} -S33{ +S34{ g_sdt_lit : '<' '<' • . {.} '>' '>' } Transitions: -. -> S66 +. -> S67 Action: nil Symbols classes: {} -S34{ +S35{ _digit : '0'-'9' • _id_char : (_upcase | _lowcase | '_' | _digit) • prodId : _upcase {_id_char} • @@ -536,14 +545,14 @@ S34{ _upcase : • 'A'-'Z' } Transitions: - ['0','9'] -> S34 - ['A','Z'] -> S35 - ['_','_'] -> S36 - ['a','z'] -> S37 + ['0','9'] -> S35 + ['A','Z'] -> S36 + ['_','_'] -> S37 + ['a','z'] -> S38 Action: Accept("prodId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} -S35{ +S36{ _upcase : 'A'-'Z' • _id_char : (_upcase | _lowcase | '_' | _digit) • prodId : _upcase {_id_char} • @@ -557,14 +566,14 @@ S35{ _upcase : • 'A'-'Z' } Transitions: - ['0','9'] -> S34 - ['A','Z'] -> S35 - ['_','_'] -> S36 - ['a','z'] -> S37 + ['0','9'] -> S35 + ['A','Z'] -> S36 + ['_','_'] -> S37 + ['a','z'] -> S38 Action: Accept("prodId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} -S36{ +S37{ _id_char : (_upcase | _lowcase | '_' | _digit) • prodId : _upcase {_id_char} • prodId : _upcase {• _id_char} @@ -577,14 +586,14 @@ S36{ _upcase : • 'A'-'Z' } Transitions: - ['0','9'] -> S34 - ['A','Z'] -> S35 - ['_','_'] -> S36 - ['a','z'] -> S37 + ['0','9'] -> S35 + ['A','Z'] -> S36 + ['_','_'] -> S37 + ['a','z'] -> S38 Action: Accept("prodId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} -S37{ +S38{ _lowcase : 'a'-'z' • _id_char : (_upcase | _lowcase | '_' | _digit) • prodId : _upcase {_id_char} • @@ -598,14 +607,14 @@ S37{ _upcase : • 'A'-'Z' } Transitions: - ['0','9'] -> S34 - ['A','Z'] -> S35 - ['_','_'] -> S36 - ['a','z'] -> S37 + ['0','9'] -> S35 + ['A','Z'] -> S36 + ['_','_'] -> S37 + ['a','z'] -> S38 Action: Accept("prodId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} -S38{ +S39{ _digit : '0'-'9' • _id_char : (_upcase | _lowcase | '_' | _digit) • regDefId : '_' {_id_char} • @@ -619,14 +628,14 @@ S38{ _upcase : • 'A'-'Z' } Transitions: - ['0','9'] -> S38 - ['A','Z'] -> S39 - ['_','_'] -> S40 - ['a','z'] -> S41 + ['0','9'] -> S39 + ['A','Z'] -> S40 + ['_','_'] -> S41 + ['a','z'] -> S42 Action: Accept("regDefId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} -S39{ +S40{ _upcase : 'A'-'Z' • _id_char : (_upcase | _lowcase | '_' | _digit) • regDefId : '_' {_id_char} • @@ -640,14 +649,14 @@ S39{ _upcase : • 'A'-'Z' } Transitions: - ['0','9'] -> S38 - ['A','Z'] -> S39 - ['_','_'] -> S40 - ['a','z'] -> S41 + ['0','9'] -> S39 + ['A','Z'] -> S40 + ['_','_'] -> S41 + ['a','z'] -> S42 Action: Accept("regDefId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} -S40{ +S41{ _id_char : (_upcase | _lowcase | '_' | _digit) • regDefId : '_' {_id_char} • regDefId : '_' {• _id_char} @@ -660,14 +669,14 @@ S40{ _upcase : • 'A'-'Z' } Transitions: - ['0','9'] -> S38 - ['A','Z'] -> S39 - ['_','_'] -> S40 - ['a','z'] -> S41 + ['0','9'] -> S39 + ['A','Z'] -> S40 + ['_','_'] -> S41 + ['a','z'] -> S42 Action: Accept("regDefId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} -S41{ +S42{ _lowcase : 'a'-'z' • _id_char : (_upcase | _lowcase | '_' | _digit) • regDefId : '_' {_id_char} • @@ -681,14 +690,14 @@ S41{ _upcase : • 'A'-'Z' } Transitions: - ['0','9'] -> S38 - ['A','Z'] -> S39 - ['_','_'] -> S40 - ['a','z'] -> S41 + ['0','9'] -> S39 + ['A','Z'] -> S40 + ['_','_'] -> S41 + ['a','z'] -> S42 Action: Accept("regDefId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} -S42{ +S43{ _raw_string : '`' {.} '`' • string_lit : (_raw_string | _interpreted_string) • } @@ -696,7 +705,7 @@ Transitions: Action: Accept("string_lit") Symbols classes: {} -S43{ +S44{ _digit : '0'-'9' • _id_char : (_upcase | _lowcase | '_' | _digit) • _tokId : _lowcase {_id_char} • @@ -712,14 +721,14 @@ S43{ _upcase : • 'A'-'Z' } Transitions: - ['0','9'] -> S43 - ['A','Z'] -> S44 - ['_','_'] -> S45 - ['a','z'] -> S46 + ['0','9'] -> S44 + ['A','Z'] -> S45 + ['_','_'] -> S46 + ['a','z'] -> S47 Action: Accept("tokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} -S44{ +S45{ _upcase : 'A'-'Z' • _id_char : (_upcase | _lowcase | '_' | _digit) • _tokId : _lowcase {_id_char} • @@ -735,14 +744,14 @@ S44{ _upcase : • 'A'-'Z' } Transitions: - ['0','9'] -> S43 - ['A','Z'] -> S44 - ['_','_'] -> S45 - ['a','z'] -> S46 + ['0','9'] -> S44 + ['A','Z'] -> S45 + ['_','_'] -> S46 + ['a','z'] -> S47 Action: Accept("tokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} -S45{ +S46{ _id_char : (_upcase | _lowcase | '_' | _digit) • _tokId : _lowcase {_id_char} • _tokId : _lowcase {• _id_char} @@ -757,14 +766,14 @@ S45{ _upcase : • 'A'-'Z' } Transitions: - ['0','9'] -> S43 - ['A','Z'] -> S44 - ['_','_'] -> S45 - ['a','z'] -> S46 + ['0','9'] -> S44 + ['A','Z'] -> S45 + ['_','_'] -> S46 + ['a','z'] -> S47 Action: Accept("tokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} -S46{ +S47{ _lowcase : 'a'-'z' • _id_char : (_upcase | _lowcase | '_' | _digit) • _tokId : _lowcase {_id_char} • @@ -780,14 +789,14 @@ S46{ _upcase : • 'A'-'Z' } Transitions: - ['0','9'] -> S43 - ['A','Z'] -> S44 - ['_','_'] -> S45 - ['a','z'] -> S46 + ['0','9'] -> S44 + ['A','Z'] -> S45 + ['_','_'] -> S46 + ['a','z'] -> S47 Action: Accept("tokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} -S47{ +S48{ empty : 'e' 'm' • 'p' 't' 'y' _lowcase : 'a'-'z' • _id_char : (_upcase | _lowcase | '_' | _digit) • @@ -804,16 +813,16 @@ S47{ _upcase : • 'A'-'Z' } Transitions: - ['0','9'] -> S43 - ['A','Z'] -> S44 - ['_','_'] -> S45 - ['a','o'] -> S46 - ['p','p'] -> S67 - ['q','z'] -> S46 + ['0','9'] -> S44 + ['A','Z'] -> S45 + ['_','_'] -> S46 + ['a','o'] -> S47 + ['p','p'] -> S68 + ['q','z'] -> S47 Action: Accept("tokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','o'], ['p','p'], ['q','z']} -S48{ +S49{ error : 'e' 'r' • 'r' 'o' 'r' _lowcase : 'a'-'z' • _id_char : (_upcase | _lowcase | '_' | _digit) • @@ -830,16 +839,16 @@ S48{ _upcase : • 'A'-'Z' } Transitions: - ['0','9'] -> S43 - ['A','Z'] -> S44 - ['_','_'] -> S45 - ['a','q'] -> S46 - ['r','r'] -> S68 - ['s','z'] -> S46 + ['0','9'] -> S44 + ['A','Z'] -> S45 + ['_','_'] -> S46 + ['a','q'] -> S47 + ['r','r'] -> S69 + ['s','z'] -> S47 Action: Accept("tokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','q'], ['r','r'], ['s','z']} -S49{ +S50{ _digit : '0'-'9' • _id_char : (_upcase | _lowcase | '_' | _digit) • _tokId : _lowcase {_id_char} • @@ -855,14 +864,14 @@ S49{ _upcase : • 'A'-'Z' } Transitions: - ['0','9'] -> S49 - ['A','Z'] -> S50 - ['_','_'] -> S51 - ['a','z'] -> S52 + ['0','9'] -> S50 + ['A','Z'] -> S51 + ['_','_'] -> S52 + ['a','z'] -> S53 Action: Accept("ignoredTokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} -S50{ +S51{ _upcase : 'A'-'Z' • _id_char : (_upcase | _lowcase | '_' | _digit) • _tokId : _lowcase {_id_char} • @@ -878,14 +887,14 @@ S50{ _upcase : • 'A'-'Z' } Transitions: - ['0','9'] -> S49 - ['A','Z'] -> S50 - ['_','_'] -> S51 - ['a','z'] -> S52 + ['0','9'] -> S50 + ['A','Z'] -> S51 + ['_','_'] -> S52 + ['a','z'] -> S53 Action: Accept("ignoredTokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} -S51{ +S52{ _id_char : (_upcase | _lowcase | '_' | _digit) • _tokId : _lowcase {_id_char} • _tokId : _lowcase {• _id_char} @@ -900,14 +909,14 @@ S51{ _upcase : • 'A'-'Z' } Transitions: - ['0','9'] -> S49 - ['A','Z'] -> S50 - ['_','_'] -> S51 - ['a','z'] -> S52 + ['0','9'] -> S50 + ['A','Z'] -> S51 + ['_','_'] -> S52 + ['a','z'] -> S53 Action: Accept("ignoredTokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} -S52{ +S53{ _lowcase : 'a'-'z' • _id_char : (_upcase | _lowcase | '_' | _digit) • _tokId : _lowcase {_id_char} • @@ -923,14 +932,14 @@ S52{ _upcase : • 'A'-'Z' } Transitions: - ['0','9'] -> S49 - ['A','Z'] -> S50 - ['_','_'] -> S51 - ['a','z'] -> S52 + ['0','9'] -> S50 + ['A','Z'] -> S51 + ['_','_'] -> S52 + ['a','z'] -> S53 Action: Accept("ignoredTokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} -S53{ +S54{ _escaped_char : '\' ('a' | 'b' | 'f' | 'n' | 'r' | 't' | 'v' | '\' | ''' | '"') • _unicode_value : (. | _little_u_value | _big_u_value | _escaped_char) • _interpreted_string : '"' {_unicode_value | _byte_value} • '"' @@ -950,13 +959,13 @@ S53{ _little_u_value : • '\' 'u' _hex_digit _hex_digit _hex_digit _hex_digit } Transitions: - ['"','"'] -> S26 - ['\','\'] -> S27 -. -> S28 + ['"','"'] -> S27 + ['\','\'] -> S28 +. -> S29 Action: nil Symbols classes: {['"','"'], ['\','\']} -S54{ +S55{ _octal_digit : '0'-'7' • _octal_byte_value : '\' _octal_digit • _octal_digit _octal_digit _byte_value : • _octal_byte_value | _hex_byte_value @@ -965,11 +974,11 @@ S54{ _octal_digit : • '0'-'7' } Transitions: - ['0','7'] -> S69 + ['0','7'] -> S70 Action: nil Symbols classes: {['0','7']} -S55{ +S56{ _big_u_value : '\' 'U' • _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char _interpreted_string : '"' {• _unicode_value | _byte_value} '"' @@ -979,13 +988,13 @@ S55{ _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' } Transitions: - ['0','9'] -> S70 - ['A','F'] -> S70 - ['a','f'] -> S70 + ['0','9'] -> S71 + ['A','F'] -> S71 + ['a','f'] -> S71 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S56{ +S57{ _little_u_value : '\' 'u' • _hex_digit _hex_digit _hex_digit _hex_digit _unicode_value : . | • _little_u_value | _big_u_value | _escaped_char _interpreted_string : '"' {• _unicode_value | _byte_value} '"' @@ -995,13 +1004,13 @@ S56{ _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' } Transitions: - ['0','9'] -> S71 - ['A','F'] -> S71 - ['a','f'] -> S71 + ['0','9'] -> S72 + ['A','F'] -> S72 + ['a','f'] -> S72 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S57{ +S58{ _hex_byte_value : '\' 'x' • _hex_digit _hex_digit _byte_value : _octal_byte_value | • _hex_byte_value _interpreted_string : '"' {_unicode_value | • _byte_value} '"' @@ -1011,23 +1020,23 @@ S57{ _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' } Transitions: - ['0','9'] -> S72 - ['A','F'] -> S72 - ['a','f'] -> S72 + ['0','9'] -> S73 + ['A','F'] -> S73 + ['a','f'] -> S73 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S58{ +S59{ _escaped_char : '\' ('a' | 'b' | 'f' | 'n' | 'r' | 't' | 'v' | '\' | ''' | '"') • _unicode_value : (. | _little_u_value | _big_u_value | _escaped_char) • char_lit : ''' (_unicode_value | _byte_value) • ''' } Transitions: - [''','''] -> S63 + [''','''] -> S64 Action: nil Symbols classes: {[''',''']} -S59{ +S60{ _octal_digit : '0'-'7' • _octal_byte_value : '\' _octal_digit • _octal_digit _octal_digit _byte_value : • _octal_byte_value | _hex_byte_value @@ -1035,11 +1044,11 @@ S59{ _octal_digit : • '0'-'7' } Transitions: - ['0','7'] -> S73 + ['0','7'] -> S74 Action: nil Symbols classes: {['0','7']} -S60{ +S61{ _big_u_value : '\' 'U' • _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char char_lit : ''' (• _unicode_value | _byte_value) ''' @@ -1048,13 +1057,13 @@ S60{ _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' } Transitions: - ['0','9'] -> S74 - ['A','F'] -> S74 - ['a','f'] -> S74 + ['0','9'] -> S75 + ['A','F'] -> S75 + ['a','f'] -> S75 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S61{ +S62{ _little_u_value : '\' 'u' • _hex_digit _hex_digit _hex_digit _hex_digit _unicode_value : . | • _little_u_value | _big_u_value | _escaped_char char_lit : ''' (• _unicode_value | _byte_value) ''' @@ -1063,13 +1072,13 @@ S61{ _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' } Transitions: - ['0','9'] -> S75 - ['A','F'] -> S75 - ['a','f'] -> S75 + ['0','9'] -> S76 + ['A','F'] -> S76 + ['a','f'] -> S76 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S62{ +S63{ _hex_byte_value : '\' 'x' • _hex_digit _hex_digit _byte_value : _octal_byte_value | • _hex_byte_value char_lit : ''' (_unicode_value | • _byte_value) ''' @@ -1078,20 +1087,20 @@ S62{ _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' } Transitions: - ['0','9'] -> S76 - ['A','F'] -> S76 - ['a','f'] -> S76 + ['0','9'] -> S77 + ['A','F'] -> S77 + ['a','f'] -> S77 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S63{ +S64{ char_lit : ''' (_unicode_value | _byte_value) ''' • } Transitions: Action: Accept("char_lit") Symbols classes: {} -S64{ +S65{ _blockComment : '/' '*' {. | '*'} '*' • '/' _blockComment : '/' '*' {. | '*'} • '*' '/' _blockComment : '/' '*' {. | • '*'} '*' '/' @@ -1099,13 +1108,13 @@ S64{ !comment : _lineComment | • _blockComment } Transitions: - ['*','*'] -> S64 - ['/','/'] -> S77 -. -> S31 + ['*','*'] -> S65 + ['/','/'] -> S78 +. -> S32 Action: nil Symbols classes: {['*','*'], ['/','/']} -S65{ +S66{ _lineComment : '/' '/' {.} '\n' • !comment : (_lineComment | _blockComment) • } @@ -1113,17 +1122,17 @@ Transitions: Action: Ignore("!comment") Symbols classes: {} -S66{ +S67{ g_sdt_lit : '<' '<' . {.} • '>' '>' g_sdt_lit : '<' '<' . {• .} '>' '>' } Transitions: - ['>','>'] -> S78 -. -> S66 + ['>','>'] -> S79 +. -> S67 Action: nil Symbols classes: {['>','>']} -S67{ +S68{ empty : 'e' 'm' 'p' • 't' 'y' _lowcase : 'a'-'z' • _id_char : (_upcase | _lowcase | '_' | _digit) • @@ -1140,16 +1149,16 @@ S67{ _upcase : • 'A'-'Z' } Transitions: - ['0','9'] -> S43 - ['A','Z'] -> S44 - ['_','_'] -> S45 - ['a','s'] -> S46 - ['t','t'] -> S79 - ['u','z'] -> S46 + ['0','9'] -> S44 + ['A','Z'] -> S45 + ['_','_'] -> S46 + ['a','s'] -> S47 + ['t','t'] -> S80 + ['u','z'] -> S47 Action: Accept("tokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','s'], ['t','t'], ['u','z']} -S68{ +S69{ error : 'e' 'r' 'r' • 'o' 'r' _lowcase : 'a'-'z' • _id_char : (_upcase | _lowcase | '_' | _digit) • @@ -1166,16 +1175,16 @@ S68{ _upcase : • 'A'-'Z' } Transitions: - ['0','9'] -> S43 - ['A','Z'] -> S44 - ['_','_'] -> S45 - ['a','n'] -> S46 - ['o','o'] -> S80 - ['p','z'] -> S46 + ['0','9'] -> S44 + ['A','Z'] -> S45 + ['_','_'] -> S46 + ['a','n'] -> S47 + ['o','o'] -> S81 + ['p','z'] -> S47 Action: Accept("tokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','n'], ['o','o'], ['p','z']} -S69{ +S70{ _octal_digit : '0'-'7' • _octal_byte_value : '\' _octal_digit _octal_digit • _octal_digit _byte_value : • _octal_byte_value | _hex_byte_value @@ -1184,11 +1193,11 @@ S69{ _octal_digit : • '0'-'7' } Transitions: - ['0','7'] -> S81 + ['0','7'] -> S82 Action: nil Symbols classes: {['0','7']} -S70{ +S71{ _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _big_u_value : '\' 'U' _hex_digit • _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char @@ -1199,13 +1208,13 @@ S70{ _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' } Transitions: - ['0','9'] -> S82 - ['A','F'] -> S82 - ['a','f'] -> S82 + ['0','9'] -> S83 + ['A','F'] -> S83 + ['a','f'] -> S83 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S71{ +S72{ _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _little_u_value : '\' 'u' _hex_digit • _hex_digit _hex_digit _hex_digit _unicode_value : . | • _little_u_value | _big_u_value | _escaped_char @@ -1216,13 +1225,13 @@ S71{ _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' } Transitions: - ['0','9'] -> S83 - ['A','F'] -> S83 - ['a','f'] -> S83 + ['0','9'] -> S84 + ['A','F'] -> S84 + ['a','f'] -> S84 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S72{ +S73{ _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _hex_byte_value : '\' 'x' _hex_digit • _hex_digit _byte_value : _octal_byte_value | • _hex_byte_value @@ -1233,13 +1242,13 @@ S72{ _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' } Transitions: - ['0','9'] -> S84 - ['A','F'] -> S84 - ['a','f'] -> S84 + ['0','9'] -> S85 + ['A','F'] -> S85 + ['a','f'] -> S85 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S73{ +S74{ _octal_digit : '0'-'7' • _octal_byte_value : '\' _octal_digit _octal_digit • _octal_digit _byte_value : • _octal_byte_value | _hex_byte_value @@ -1247,11 +1256,11 @@ S73{ _octal_digit : • '0'-'7' } Transitions: - ['0','7'] -> S85 + ['0','7'] -> S86 Action: nil Symbols classes: {['0','7']} -S74{ +S75{ _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _big_u_value : '\' 'U' _hex_digit • _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char @@ -1261,13 +1270,13 @@ S74{ _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' } Transitions: - ['0','9'] -> S86 - ['A','F'] -> S86 - ['a','f'] -> S86 + ['0','9'] -> S87 + ['A','F'] -> S87 + ['a','f'] -> S87 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S75{ +S76{ _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _little_u_value : '\' 'u' _hex_digit • _hex_digit _hex_digit _hex_digit _unicode_value : . | • _little_u_value | _big_u_value | _escaped_char @@ -1277,13 +1286,13 @@ S75{ _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' } Transitions: - ['0','9'] -> S87 - ['A','F'] -> S87 - ['a','f'] -> S87 + ['0','9'] -> S88 + ['A','F'] -> S88 + ['a','f'] -> S88 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S76{ +S77{ _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _hex_byte_value : '\' 'x' _hex_digit • _hex_digit _byte_value : _octal_byte_value | • _hex_byte_value @@ -1293,13 +1302,13 @@ S76{ _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' } Transitions: - ['0','9'] -> S88 - ['A','F'] -> S88 - ['a','f'] -> S88 + ['0','9'] -> S89 + ['A','F'] -> S89 + ['a','f'] -> S89 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S77{ +S78{ _blockComment : '/' '*' {. | '*'} '*' '/' • !comment : (_lineComment | _blockComment) • } @@ -1307,15 +1316,15 @@ Transitions: Action: Ignore("!comment") Symbols classes: {} -S78{ +S79{ g_sdt_lit : '<' '<' . {.} '>' • '>' } Transitions: - ['>','>'] -> S89 + ['>','>'] -> S90 Action: nil Symbols classes: {['>','>']} -S79{ +S80{ empty : 'e' 'm' 'p' 't' • 'y' _lowcase : 'a'-'z' • _id_char : (_upcase | _lowcase | '_' | _digit) • @@ -1332,16 +1341,16 @@ S79{ _upcase : • 'A'-'Z' } Transitions: - ['0','9'] -> S43 - ['A','Z'] -> S44 - ['_','_'] -> S45 - ['a','x'] -> S46 - ['y','y'] -> S90 - ['z','z'] -> S46 + ['0','9'] -> S44 + ['A','Z'] -> S45 + ['_','_'] -> S46 + ['a','x'] -> S47 + ['y','y'] -> S91 + ['z','z'] -> S47 Action: Accept("tokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','x'], ['y','y'], ['z','z']} -S80{ +S81{ error : 'e' 'r' 'r' 'o' • 'r' _lowcase : 'a'-'z' • _id_char : (_upcase | _lowcase | '_' | _digit) • @@ -1358,16 +1367,16 @@ S80{ _upcase : • 'A'-'Z' } Transitions: - ['0','9'] -> S43 - ['A','Z'] -> S44 - ['_','_'] -> S45 - ['a','q'] -> S46 - ['r','r'] -> S91 - ['s','z'] -> S46 + ['0','9'] -> S44 + ['A','Z'] -> S45 + ['_','_'] -> S46 + ['a','q'] -> S47 + ['r','r'] -> S92 + ['s','z'] -> S47 Action: Accept("tokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','q'], ['r','r'], ['s','z']} -S81{ +S82{ _octal_digit : '0'-'7' • _octal_byte_value : '\' _octal_digit _octal_digit _octal_digit • _byte_value : (_octal_byte_value | _hex_byte_value) • @@ -1388,13 +1397,13 @@ S81{ _little_u_value : • '\' 'u' _hex_digit _hex_digit _hex_digit _hex_digit } Transitions: - ['"','"'] -> S26 - ['\','\'] -> S27 -. -> S28 + ['"','"'] -> S27 + ['\','\'] -> S28 +. -> S29 Action: nil Symbols classes: {['"','"'], ['\','\']} -S82{ +S83{ _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _big_u_value : '\' 'U' _hex_digit _hex_digit • _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char @@ -1405,13 +1414,13 @@ S82{ _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' } Transitions: - ['0','9'] -> S92 - ['A','F'] -> S92 - ['a','f'] -> S92 + ['0','9'] -> S93 + ['A','F'] -> S93 + ['a','f'] -> S93 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S83{ +S84{ _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _little_u_value : '\' 'u' _hex_digit _hex_digit • _hex_digit _hex_digit _unicode_value : . | • _little_u_value | _big_u_value | _escaped_char @@ -1422,13 +1431,13 @@ S83{ _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' } Transitions: - ['0','9'] -> S93 - ['A','F'] -> S93 - ['a','f'] -> S93 + ['0','9'] -> S94 + ['A','F'] -> S94 + ['a','f'] -> S94 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S84{ +S85{ _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _hex_byte_value : '\' 'x' _hex_digit _hex_digit • _byte_value : (_octal_byte_value | _hex_byte_value) • @@ -1449,24 +1458,24 @@ S84{ _little_u_value : • '\' 'u' _hex_digit _hex_digit _hex_digit _hex_digit } Transitions: - ['"','"'] -> S26 - ['\','\'] -> S27 -. -> S28 + ['"','"'] -> S27 + ['\','\'] -> S28 +. -> S29 Action: nil Symbols classes: {['"','"'], ['\','\']} -S85{ +S86{ _octal_digit : '0'-'7' • _octal_byte_value : '\' _octal_digit _octal_digit _octal_digit • _byte_value : (_octal_byte_value | _hex_byte_value) • char_lit : ''' (_unicode_value | _byte_value) • ''' } Transitions: - [''','''] -> S63 + [''','''] -> S64 Action: nil Symbols classes: {[''',''']} -S86{ +S87{ _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _big_u_value : '\' 'U' _hex_digit _hex_digit • _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char @@ -1476,13 +1485,13 @@ S86{ _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' } Transitions: - ['0','9'] -> S94 - ['A','F'] -> S94 - ['a','f'] -> S94 + ['0','9'] -> S95 + ['A','F'] -> S95 + ['a','f'] -> S95 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S87{ +S88{ _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _little_u_value : '\' 'u' _hex_digit _hex_digit • _hex_digit _hex_digit _unicode_value : . | • _little_u_value | _big_u_value | _escaped_char @@ -1492,31 +1501,31 @@ S87{ _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' } Transitions: - ['0','9'] -> S95 - ['A','F'] -> S95 - ['a','f'] -> S95 + ['0','9'] -> S96 + ['A','F'] -> S96 + ['a','f'] -> S96 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S88{ +S89{ _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _hex_byte_value : '\' 'x' _hex_digit _hex_digit • _byte_value : (_octal_byte_value | _hex_byte_value) • char_lit : ''' (_unicode_value | _byte_value) • ''' } Transitions: - [''','''] -> S63 + [''','''] -> S64 Action: nil Symbols classes: {[''',''']} -S89{ +S90{ g_sdt_lit : '<' '<' . {.} '>' '>' • } Transitions: Action: Accept("g_sdt_lit") Symbols classes: {} -S90{ +S91{ empty : 'e' 'm' 'p' 't' 'y' • _lowcase : 'a'-'z' • _id_char : (_upcase | _lowcase | '_' | _digit) • @@ -1533,14 +1542,14 @@ S90{ _upcase : • 'A'-'Z' } Transitions: - ['0','9'] -> S43 - ['A','Z'] -> S44 - ['_','_'] -> S45 - ['a','z'] -> S46 + ['0','9'] -> S44 + ['A','Z'] -> S45 + ['_','_'] -> S46 + ['a','z'] -> S47 Action: Accept("empty") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} -S91{ +S92{ error : 'e' 'r' 'r' 'o' 'r' • _lowcase : 'a'-'z' • _id_char : (_upcase | _lowcase | '_' | _digit) • @@ -1557,14 +1566,14 @@ S91{ _upcase : • 'A'-'Z' } Transitions: - ['0','9'] -> S43 - ['A','Z'] -> S44 - ['_','_'] -> S45 - ['a','z'] -> S46 + ['0','9'] -> S44 + ['A','Z'] -> S45 + ['_','_'] -> S46 + ['a','z'] -> S47 Action: Accept("error") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} -S92{ +S93{ _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit • _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char @@ -1575,13 +1584,13 @@ S92{ _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' } Transitions: - ['0','9'] -> S96 - ['A','F'] -> S96 - ['a','f'] -> S96 + ['0','9'] -> S97 + ['A','F'] -> S97 + ['a','f'] -> S97 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S93{ +S94{ _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _little_u_value : '\' 'u' _hex_digit _hex_digit _hex_digit • _hex_digit _unicode_value : . | • _little_u_value | _big_u_value | _escaped_char @@ -1592,13 +1601,13 @@ S93{ _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' } Transitions: - ['0','9'] -> S97 - ['A','F'] -> S97 - ['a','f'] -> S97 + ['0','9'] -> S98 + ['A','F'] -> S98 + ['a','f'] -> S98 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S94{ +S95{ _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit • _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char @@ -1608,13 +1617,13 @@ S94{ _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' } Transitions: - ['0','9'] -> S98 - ['A','F'] -> S98 - ['a','f'] -> S98 + ['0','9'] -> S99 + ['A','F'] -> S99 + ['a','f'] -> S99 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S95{ +S96{ _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _little_u_value : '\' 'u' _hex_digit _hex_digit _hex_digit • _hex_digit _unicode_value : . | • _little_u_value | _big_u_value | _escaped_char @@ -1624,13 +1633,13 @@ S95{ _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' } Transitions: - ['0','9'] -> S99 - ['A','F'] -> S99 - ['a','f'] -> S99 + ['0','9'] -> S100 + ['A','F'] -> S100 + ['a','f'] -> S100 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S96{ +S97{ _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit • _hex_digit _hex_digit _hex_digit _hex_digit _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char @@ -1641,13 +1650,13 @@ S96{ _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' } Transitions: - ['0','9'] -> S100 - ['A','F'] -> S100 - ['a','f'] -> S100 + ['0','9'] -> S101 + ['A','F'] -> S101 + ['a','f'] -> S101 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S97{ +S98{ _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _little_u_value : '\' 'u' _hex_digit _hex_digit _hex_digit _hex_digit • _unicode_value : (. | _little_u_value | _big_u_value | _escaped_char) • @@ -1668,13 +1677,13 @@ S97{ _little_u_value : • '\' 'u' _hex_digit _hex_digit _hex_digit _hex_digit } Transitions: - ['"','"'] -> S26 - ['\','\'] -> S27 -. -> S28 + ['"','"'] -> S27 + ['\','\'] -> S28 +. -> S29 Action: nil Symbols classes: {['"','"'], ['\','\']} -S98{ +S99{ _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit • _hex_digit _hex_digit _hex_digit _hex_digit _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char @@ -1684,24 +1693,24 @@ S98{ _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' } Transitions: - ['0','9'] -> S101 - ['A','F'] -> S101 - ['a','f'] -> S101 + ['0','9'] -> S102 + ['A','F'] -> S102 + ['a','f'] -> S102 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S99{ +S100{ _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _little_u_value : '\' 'u' _hex_digit _hex_digit _hex_digit _hex_digit • _unicode_value : (. | _little_u_value | _big_u_value | _escaped_char) • char_lit : ''' (_unicode_value | _byte_value) • ''' } Transitions: - [''','''] -> S63 + [''','''] -> S64 Action: nil Symbols classes: {[''',''']} -S100{ +S101{ _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit • _hex_digit _hex_digit _hex_digit _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char @@ -1711,22 +1720,6 @@ S100{ _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' } -Transitions: - ['0','9'] -> S102 - ['A','F'] -> S102 - ['a','f'] -> S102 -Action: nil -Symbols classes: {['0','9'], ['A','F'], ['a','f']} - -S101{ - _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • - _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit • _hex_digit _hex_digit _hex_digit - _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char - char_lit : ''' (• _unicode_value | _byte_value) ''' - _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' - _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' - _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' -} Transitions: ['0','9'] -> S103 ['A','F'] -> S103 @@ -1736,10 +1729,9 @@ Symbols classes: {['0','9'], ['A','F'], ['a','f']} S102{ _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • - _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit • _hex_digit _hex_digit + _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit • _hex_digit _hex_digit _hex_digit _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char - _interpreted_string : '"' {• _unicode_value | _byte_value} '"' - string_lit : _raw_string | • _interpreted_string + char_lit : ''' (• _unicode_value | _byte_value) ''' _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' @@ -1755,7 +1747,8 @@ S103{ _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit • _hex_digit _hex_digit _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char - char_lit : ''' (• _unicode_value | _byte_value) ''' + _interpreted_string : '"' {• _unicode_value | _byte_value} '"' + string_lit : _raw_string | • _interpreted_string _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' @@ -1769,10 +1762,9 @@ Symbols classes: {['0','9'], ['A','F'], ['a','f']} S104{ _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • - _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit • _hex_digit + _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit • _hex_digit _hex_digit _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char - _interpreted_string : '"' {• _unicode_value | _byte_value} '"' - string_lit : _raw_string | • _interpreted_string + char_lit : ''' (• _unicode_value | _byte_value) ''' _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' @@ -1788,7 +1780,8 @@ S105{ _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit • _hex_digit _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char - char_lit : ''' (• _unicode_value | _byte_value) ''' + _interpreted_string : '"' {• _unicode_value | _byte_value} '"' + string_lit : _raw_string | • _interpreted_string _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' @@ -1801,6 +1794,22 @@ Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} S106{ + _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • + _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit • _hex_digit + _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char + char_lit : ''' (• _unicode_value | _byte_value) ''' + _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' + _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' + _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' +} +Transitions: + ['0','9'] -> S108 + ['A','F'] -> S108 + ['a','f'] -> S108 +Action: nil +Symbols classes: {['0','9'], ['A','F'], ['a','f']} + +S107{ _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit • _unicode_value : (. | _little_u_value | _big_u_value | _escaped_char) • @@ -1821,20 +1830,20 @@ S106{ _little_u_value : • '\' 'u' _hex_digit _hex_digit _hex_digit _hex_digit } Transitions: - ['"','"'] -> S26 - ['\','\'] -> S27 -. -> S28 + ['"','"'] -> S27 + ['\','\'] -> S28 +. -> S29 Action: nil Symbols classes: {['"','"'], ['\','\']} -S107{ +S108{ _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit • _unicode_value : (. | _little_u_value | _big_u_value | _escaped_char) • char_lit : ''' (_unicode_value | _byte_value) • ''' } Transitions: - [''','''] -> S63 + [''','''] -> S64 Action: nil Symbols classes: {[''',''']} diff --git a/internal/fe2/log/terminals.txt b/internal/frontend/reparsed/log/terminals.txt similarity index 98% rename from internal/fe2/log/terminals.txt rename to internal/frontend/reparsed/log/terminals.txt index d8ca280f..423e5ee9 100644 --- a/internal/fe2/log/terminals.txt +++ b/internal/frontend/reparsed/log/terminals.txt @@ -9,6 +9,7 @@ ignoredTokId . char_lit - +~ ( ) [ diff --git a/internal/fe2/main/main.go b/internal/frontend/reparsed/main/main.go similarity index 74% rename from internal/fe2/main/main.go rename to internal/frontend/reparsed/main/main.go index 4e6988f9..86688bb2 100644 --- a/internal/fe2/main/main.go +++ b/internal/frontend/reparsed/main/main.go @@ -6,7 +6,7 @@ import ( "os" "strings" - fe2 "github.com/maxcalandrelli/gocc/internal/fe2" + reparsed "github.com/maxcalandrelli/gocc/internal/frontend/reparsed" ) func showResult(r interface{}, e error) { @@ -27,12 +27,12 @@ func main() { flag.StringVar(&Text, "text", "", "parse also text given with flag") flag.Parse() if Text > "" { - showResult(fe2.ParseText(Text)) + showResult(reparsed.ParseText(Text)) } if File > "" { - showResult(fe2.ParseFile(File)) + showResult(reparsed.ParseFile(File)) } if str := strings.Join(os.Args[1:], " "); str > "" { - showResult(fe2.ParseText(str)) + showResult(reparsed.ParseText(str)) } } diff --git a/internal/fe2/fe2.go b/internal/frontend/reparsed/reparsed.go similarity index 74% rename from internal/fe2/fe2.go rename to internal/frontend/reparsed/reparsed.go index 53849a8e..778fd1e1 100644 --- a/internal/fe2/fe2.go +++ b/internal/frontend/reparsed/reparsed.go @@ -1,14 +1,14 @@ // Code generated by gocc; DO NOT EDIT. -package fe2 +package reparsed import ( "io" - "github.com/maxcalandrelli/gocc/internal/fe2/internal/io/stream" - "github.com/maxcalandrelli/gocc/internal/fe2/internal/lexer" - "github.com/maxcalandrelli/gocc/internal/fe2/internal/parser" - "github.com/maxcalandrelli/gocc/internal/fe2/internal/token" + "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/internal/io/stream" + "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/internal/lexer" + "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/internal/parser" + "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/internal/token" ) type Token = token.Token diff --git a/internal/frontend/errors/errors.go b/internal/frontend/stock/errors/errors.go similarity index 87% rename from internal/frontend/errors/errors.go rename to internal/frontend/stock/errors/errors.go index 5720d5c0..f31a7a20 100644 --- a/internal/frontend/errors/errors.go +++ b/internal/frontend/stock/errors/errors.go @@ -1,6 +1,6 @@ package errors -import "github.com/maxcalandrelli/gocc/internal/frontend/token" +import "github.com/maxcalandrelli/gocc/internal/frontend/stock/token" type ErrorSymbol interface { } diff --git a/internal/frontend/parser/parser.go b/internal/frontend/stock/parser/parser.go similarity index 97% rename from internal/frontend/parser/parser.go rename to internal/frontend/stock/parser/parser.go index 24f87272..984d3b04 100644 --- a/internal/frontend/parser/parser.go +++ b/internal/frontend/stock/parser/parser.go @@ -8,9 +8,9 @@ import ( "github.com/maxcalandrelli/gocc/internal/config" ) -import errs "github.com/maxcalandrelli/gocc/internal/frontend/errors" +import errs "github.com/maxcalandrelli/gocc/internal/frontend/stock/errors" -import "github.com/maxcalandrelli/gocc/internal/frontend/token" +import "github.com/maxcalandrelli/gocc/internal/frontend/stock/token" type ( ActionTab []*ActionRow diff --git a/internal/frontend/parser/parser_ut.go b/internal/frontend/stock/parser/parser_ut.go similarity index 96% rename from internal/frontend/parser/parser_ut.go rename to internal/frontend/stock/parser/parser_ut.go index c65fadb6..c1fbee2a 100644 --- a/internal/frontend/parser/parser_ut.go +++ b/internal/frontend/stock/parser/parser_ut.go @@ -7,9 +7,9 @@ import ( "github.com/maxcalandrelli/gocc/internal/config" ) -import errs "github.com/maxcalandrelli/gocc/internal/frontend/errors" +import errs "github.com/maxcalandrelli/gocc/internal/frontend/stock/errors" -import "github.com/maxcalandrelli/gocc/internal/frontend/token" +import "github.com/maxcalandrelli/gocc/internal/frontend/stock/token" // ParserUTab diff --git a/internal/frontend/parser/tables.go b/internal/frontend/stock/parser/tables.go similarity index 100% rename from internal/frontend/parser/tables.go rename to internal/frontend/stock/parser/tables.go diff --git a/internal/frontend/parser/tables_uncompressed.go b/internal/frontend/stock/parser/tables_uncompressed.go similarity index 100% rename from internal/frontend/parser/tables_uncompressed.go rename to internal/frontend/stock/parser/tables_uncompressed.go diff --git a/internal/frontend/scanner/scanner.go b/internal/frontend/stock/scanner/scanner.go similarity index 99% rename from internal/frontend/scanner/scanner.go rename to internal/frontend/stock/scanner/scanner.go index a10f7a86..8f346886 100644 --- a/internal/frontend/scanner/scanner.go +++ b/internal/frontend/stock/scanner/scanner.go @@ -16,7 +16,7 @@ import ( "github.com/maxcalandrelli/gocc/internal/config" ) -import "github.com/maxcalandrelli/gocc/internal/frontend/token" +import "github.com/maxcalandrelli/gocc/internal/frontend/stock/token" // A Scanner holds the scanner's internal state while processing // a given text. It can be allocated as part of another data diff --git a/internal/frontend/scanner/scanner_test.go b/internal/frontend/stock/scanner/scanner_test.go similarity index 96% rename from internal/frontend/scanner/scanner_test.go rename to internal/frontend/stock/scanner/scanner_test.go index 2fffde8d..4898d237 100644 --- a/internal/frontend/scanner/scanner_test.go +++ b/internal/frontend/stock/scanner/scanner_test.go @@ -4,7 +4,7 @@ import ( "fmt" "testing" - "github.com/maxcalandrelli/gocc/internal/frontend/token" + "github.com/maxcalandrelli/gocc/internal/frontend/stock/token" ) type testRecord struct { diff --git a/internal/frontend/token/token.go b/internal/frontend/stock/token/token.go similarity index 100% rename from internal/frontend/token/token.go rename to internal/frontend/stock/token/token.go diff --git a/internal/frontend/token/tokens.go b/internal/frontend/stock/token/tokens.go similarity index 100% rename from internal/frontend/token/tokens.go rename to internal/frontend/stock/token/tokens.go diff --git a/internal/lexer/items/testutils_test.go b/internal/lexer/items/testutils_test.go index de0e7312..d97a2517 100644 --- a/internal/lexer/items/testutils_test.go +++ b/internal/lexer/items/testutils_test.go @@ -19,9 +19,9 @@ import ( "testing" "github.com/maxcalandrelli/gocc/internal/ast" - "github.com/maxcalandrelli/gocc/internal/frontend/parser" - "github.com/maxcalandrelli/gocc/internal/frontend/scanner" - "github.com/maxcalandrelli/gocc/internal/frontend/token" + "github.com/maxcalandrelli/gocc/internal/frontend/stock/parser" + "github.com/maxcalandrelli/gocc/internal/frontend/stock/scanner" + "github.com/maxcalandrelli/gocc/internal/frontend/stock/token" ) func findSet(sets *ItemSets, items []string) *ItemSet { diff --git a/internal/parser/lr1/items/testdata_test.go b/internal/parser/lr1/items/testdata_test.go index 4ac4b9a0..2dfdfead 100644 --- a/internal/parser/lr1/items/testdata_test.go +++ b/internal/parser/lr1/items/testdata_test.go @@ -18,9 +18,9 @@ import ( "testing" "github.com/maxcalandrelli/gocc/internal/ast" - "github.com/maxcalandrelli/gocc/internal/frontend/parser" - "github.com/maxcalandrelli/gocc/internal/frontend/scanner" - "github.com/maxcalandrelli/gocc/internal/frontend/token" + "github.com/maxcalandrelli/gocc/internal/frontend/stock/parser" + "github.com/maxcalandrelli/gocc/internal/frontend/stock/scanner" + "github.com/maxcalandrelli/gocc/internal/frontend/stock/token" ) const G1 = ` diff --git a/main.go b/main.go index 0deeba78..7cb47e47 100644 --- a/main.go +++ b/main.go @@ -58,7 +58,7 @@ import ( "github.com/maxcalandrelli/gocc/internal/ast" genBase "github.com/maxcalandrelli/gocc/internal/base/gen" "github.com/maxcalandrelli/gocc/internal/config" - altfe "github.com/maxcalandrelli/gocc/internal/fe2" + altfe "github.com/maxcalandrelli/gocc/internal/frontend/reparsed" "github.com/maxcalandrelli/gocc/internal/io" genIo "github.com/maxcalandrelli/gocc/internal/io/gen" genLexer "github.com/maxcalandrelli/gocc/internal/lexer/gen/golang" diff --git a/spec/gocc2.ebnf b/spec/gocc2.ebnf index 8930a746..5fe23775 100644 --- a/spec/gocc2.ebnf +++ b/spec/gocc2.ebnf @@ -184,10 +184,10 @@ LexTerm : char_lit "-" char_lit << ast.NewLexCharRangeExt($0, $2,false) >> | - "-" char_lit + "~" char_lit << ast.NewLexCharLitExt($0, true) >> | - "-" "(" char_lit "-" char_lit ")" + "~" "(" char_lit "-" char_lit ")" << ast.NewLexCharRangeExt($2, $4, true) >> | regDefId diff --git a/spec/test.bnf b/spec/test.bnf index 2e381a72..b8ab7769 100644 --- a/spec/test.bnf +++ b/spec/test.bnf @@ -1,8 +1,7 @@ !space : ' ' | '\t' ; -hexdigit : '0'-'F' | -(':'-'@') ; -_hexdigit2 : '0'-'F' | -(':'-'@') ; +hexdigit : '0'-'F' | ~(':'-'@') ; Test : Test1 diff --git a/stock/main.go b/stock/main.go index 87e4fe40..0550fa98 100644 --- a/stock/main.go +++ b/stock/main.go @@ -29,9 +29,9 @@ import ( "github.com/maxcalandrelli/gocc/internal/ast" genBase "github.com/maxcalandrelli/gocc/internal/base/gen" "github.com/maxcalandrelli/gocc/internal/config" - oldparser "github.com/maxcalandrelli/gocc/internal/frontend/parser" - oldscanner "github.com/maxcalandrelli/gocc/internal/frontend/scanner" - oldtoken "github.com/maxcalandrelli/gocc/internal/frontend/token" + oldparser "github.com/maxcalandrelli/gocc/internal/frontend/stock/parser" + oldscanner "github.com/maxcalandrelli/gocc/internal/frontend/stock/scanner" + oldtoken "github.com/maxcalandrelli/gocc/internal/frontend/stock/token" "github.com/maxcalandrelli/gocc/internal/io" genIo "github.com/maxcalandrelli/gocc/internal/io/gen" genLexer "github.com/maxcalandrelli/gocc/internal/lexer/gen/golang" From 54d0693c8ebd20a1d08044790e5c2713ccbdd927 Mon Sep 17 00:00:00 2001 From: Massimiliano Calandrelli Date: Mon, 7 Oct 2019 08:26:43 +0200 Subject: [PATCH 06/33] WIP --- internal/ast/grammar.go | 18 +++++------ internal/ast/lextokdef.go | 3 +- internal/ast/reconcile.go | 7 ++++- internal/ast/syntaxbody.go | 30 +++++++++---------- internal/ast/syntaxempty.go | 6 ++-- internal/ast/syntaxeof.go | 6 ++-- internal/ast/syntaxerror.go | 6 ++-- internal/ast/syntaxpart.go | 4 +-- internal/ast/syntaxprod.go | 5 ++-- internal/ast/syntaxprodid.go | 4 +++ internal/ast/syntaxstringlit.go | 8 +++++ internal/ast/syntaxsymbol.go | 6 ++-- internal/ast/syntaxsymbols.go | 4 +-- internal/ast/syntaxtokid.go | 4 +++ .../frontend/reparsed/internal/lexer/lexer.go | 10 +++++++ internal/parser/first/first.go | 12 ++++---- internal/parser/first/symbolset.go | 6 ++-- internal/parser/symbols/symbols.go | 17 +++++------ spec/test.bnf | 2 +- stock/main.go | 5 ++++ 20 files changed, 100 insertions(+), 63 deletions(-) diff --git a/internal/ast/grammar.go b/internal/ast/grammar.go index 8dada5bc..a5d4a63f 100644 --- a/internal/ast/grammar.go +++ b/internal/ast/grammar.go @@ -18,8 +18,6 @@ import ( "errors" "fmt" "os" - - "github.com/maxcalandrelli/gocc/internal/config" ) type Grammar struct { @@ -51,26 +49,26 @@ func consistent(g *Grammar) (err error) { return } - defs := make(map[string]bool) - used := make(map[string][]string) + defs := make(map[SyntaxSymbol]struct{}) + used := make(map[SyntaxSymbol][]SyntaxSymbol) for _, tok := range g.LexPart.TokDefsList { - defs[tok.id] = true + defs[SyntaxTokId{tok.id, StdSyntaxSymbol{}}] = struct{}{} } for _, prod := range g.SyntaxPart.ProdList { if prod.Body.Missing() { return fmt.Errorf("empty production alternative: Maybe you are missing the \"empty\" keyword in %q", prod) } - defs[prod.Id] = true + defs[prod.Id] = struct{}{} for _, s := range prod.Body.Symbols { if s.String()[0] == '"' { continue } - used[s.String()] = append(used[s.String()], prod.Id) + used[s] = append(used[s], prod.Id) } } for s := range defs { - if s == "S'" { + if s.SymbolString() == "S'" { continue } if _, ok := used[s]; !ok { @@ -80,10 +78,10 @@ func consistent(g *Grammar) (err error) { for s, in := range used { if _, ok := defs[s]; !ok { switch s { - case config.SYMBOL_EMPTY, config.SYMBOL_ERROR: + case EmptySymbol, ErrorSymbol: continue } - if s[0] >= 'A' && s[0] <= 'Z' { + if !s.IsTerminal() { fmt.Fprintf(os.Stderr, "error: undefined symbol %q used in productions %q\n", s, in) err = errUndefined } else { diff --git a/internal/ast/lextokdef.go b/internal/ast/lextokdef.go index ff7d2b22..37e16c32 100644 --- a/internal/ast/lextokdef.go +++ b/internal/ast/lextokdef.go @@ -40,8 +40,9 @@ func NewLexStringLitTokDef(tokId string) *LexTokDef { alt, _ = AppendLexTerm(alt, newLexCharLitFromRune(runes[i])) } ptrn, _ := NewLexPattern(alt) + id := tokId return &LexTokDef{ - id: tokId, + id: id, pattern: ptrn, } } diff --git a/internal/ast/reconcile.go b/internal/ast/reconcile.go index 09488db6..1f511b08 100644 --- a/internal/ast/reconcile.go +++ b/internal/ast/reconcile.go @@ -10,7 +10,12 @@ var ( func getString(v interface{}) string { if StringGetter == nil { - return string(v.(*token.Token).Lit) + if str, ok := v.(string); ok { + return str + } + if tok, _ := v.(*token.Token); tok != nil { + return string(tok.Lit) + } } return StringGetter(v) } diff --git a/internal/ast/syntaxbody.go b/internal/ast/syntaxbody.go index b68c58f5..ce786fbc 100644 --- a/internal/ast/syntaxbody.go +++ b/internal/ast/syntaxbody.go @@ -33,15 +33,15 @@ func checkSymbols(symbols interface{}) interface{} { for i, s := range syms { switch s.(type) { case SyntaxEmpty: - syms[i] = emptySymbol + syms[i] = EmptySymbol case SyntaxError: - syms[i] = errorSymbol + syms[i] = ErrorSymbol case SyntaxTokId: switch s.SymbolString() { case config.SYMBOL_EMPTY: - syms[i] = emptySymbol + syms[i] = EmptySymbol case config.SYMBOL_ERROR: - syms[i] = errorSymbol + syms[i] = ErrorSymbol } } } @@ -56,9 +56,9 @@ func NewSyntaxBody(symbols, sdtLit interface{}) (*SyntaxBody, error) { for i, s := range syms { switch { case s.IsEpsilon(): - syms[i] = emptySymbol + syms[i] = EmptySymbol case s.IsError(): - syms[i] = errorSymbol + syms[i] = ErrorSymbol } } } @@ -74,9 +74,9 @@ func NewSyntaxBody(symbols, sdtLit interface{}) (*SyntaxBody, error) { if symbols == nil { return nil, fmt.Errorf("empty production alternative!") } - if s, _ := symbols.(SyntaxSymbols); len(s) > 0 && s[0] == emptySymbol { + if s, _ := symbols.(SyntaxSymbols); len(s) > 0 && s[0] == EmptySymbol { //fmt.Printf(" NewBody(Empty) Symbols=%#v(%s)\n", syntaxBody.Symbols, syntaxBody.Symbols.String()) - } else if s, _ := symbols.(SyntaxSymbols); len(s) > 0 && s[0] == errorSymbol { + } else if s, _ := symbols.(SyntaxSymbols); len(s) > 0 && s[0] == ErrorSymbol { //fmt.Printf(" NewBody(Error) Symbols=%#v(%s)\n", syntaxBody.Symbols, syntaxBody.Symbols.String()) } else { //fmt.Printf(" NewBody() Symbols=%#v(%s)\n", syntaxBody.Symbols, syntaxBody.Symbols.String()) @@ -98,9 +98,9 @@ func NewSyntaxBodyGen(symbols, sdtLit interface{}) (*SyntaxBody, error) { if symbols == nil { return nil, fmt.Errorf("empty production alternative!") } - if s, _ := symbols.(SyntaxSymbols); len(s) > 0 && s[0] == emptySymbol { + if s, _ := symbols.(SyntaxSymbols); len(s) > 0 && s[0] == EmptySymbol { //fmt.Printf(" NewBodyGen(Empty) Symbols=%#v(%s)\n", syntaxBody.Symbols, syntaxBody.Symbols.String()) - } else if s, _ := symbols.(SyntaxSymbols); len(s) > 0 && s[0] == errorSymbol { + } else if s, _ := symbols.(SyntaxSymbols); len(s) > 0 && s[0] == ErrorSymbol { //fmt.Printf(" NewBodyGen(Error) Symbols=%#v(%s)\n", syntaxBody.Symbols, syntaxBody.Symbols.String()) } else { //fmt.Printf(" NewBodyGen() Symbols=%#v(%s)\n", syntaxBody.Symbols, syntaxBody.Symbols.String()) @@ -112,7 +112,7 @@ func NewErrorBody(symbols, sdtLit interface{}) (*SyntaxBody, error) { if symbols == nil { return nil, fmt.Errorf("empty production alternative") } else { - symbols.(SyntaxSymbols)[0] = errorSymbol + symbols.(SyntaxSymbols)[0] = ErrorSymbol } //fmt.Printf(" NewErrorBody()\n") if body, err := NewSyntaxBody(symbols, sdtLit); err != nil { @@ -129,7 +129,7 @@ func NewErrorBodyGen(symbols, sdtLit interface{}) (*SyntaxBody, error) { syms = SyntaxSymbols{} } //fmt.Printf(" NewErrorBodyGen()\n") - if body, err := NewSyntaxBodyGen(append(SyntaxSymbols{errorSymbol}, syms...), sdtLit); err != nil { + if body, err := NewSyntaxBodyGen(append(SyntaxSymbols{ErrorSymbol}, syms...), sdtLit); err != nil { return nil, err } else { body.Error = true @@ -139,12 +139,12 @@ func NewErrorBodyGen(symbols, sdtLit interface{}) (*SyntaxBody, error) { func NewEmptyBody() (*SyntaxBody, error) { //fmt.Printf(" NewEmptyBody()\n") - return NewSyntaxBody(SyntaxSymbols{emptySymbol}, nil) + return NewSyntaxBody(SyntaxSymbols{EmptySymbol}, nil) } func NewEmptyBodyGen() (*SyntaxBody, error) { //fmt.Printf(" NewEmptyBodyGen()\n") - return NewSyntaxBodyGen(SyntaxSymbols{emptySymbol}, nil) + return NewSyntaxBodyGen(SyntaxSymbols{EmptySymbol}, nil) } func (this *SyntaxBody) Missing() bool { @@ -152,7 +152,7 @@ func (this *SyntaxBody) Missing() bool { } func (this *SyntaxBody) Empty() bool { - return len(this.Symbols) == 1 && (this.Symbols[0] == emptySymbol) + return len(this.Symbols) == 1 && (this.Symbols[0] == EmptySymbol) } func (this *SyntaxBody) String() string { diff --git a/internal/ast/syntaxempty.go b/internal/ast/syntaxempty.go index d3a17949..328cb3da 100644 --- a/internal/ast/syntaxempty.go +++ b/internal/ast/syntaxempty.go @@ -23,14 +23,14 @@ type SyntaxEmpty struct { StdSyntaxSymbol } -var emptySymbol = SyntaxEmpty{config.SYMBOL_EMPTY, StdSyntaxSymbol{}} +var EmptySymbol = SyntaxEmpty{config.SYMBOL_EMPTY, StdSyntaxSymbol{}} func (SyntaxEmpty) SymbolString() string { - return emptySymbol.string + return EmptySymbol.string } func (SyntaxEmpty) String() string { - return emptySymbol.string + return EmptySymbol.string } func (SyntaxEmpty) IsEpsilon() bool { return true } diff --git a/internal/ast/syntaxeof.go b/internal/ast/syntaxeof.go index 90ef5d51..a9f0924a 100644 --- a/internal/ast/syntaxeof.go +++ b/internal/ast/syntaxeof.go @@ -23,14 +23,14 @@ type SyntaxEof struct { StdSyntaxSymbol } -var eofSymbol = SyntaxEof{config.SYMBOL_EOF, StdSyntaxSymbol{}} +var EofSymbol = SyntaxEof{config.SYMBOL_EOF, StdSyntaxSymbol{}} func (SyntaxEof) SymbolString() string { - return eofSymbol.string + return EofSymbol.string } func (SyntaxEof) String() string { - return eofSymbol.string + return EofSymbol.string } func (SyntaxEof) SymbolName() string { diff --git a/internal/ast/syntaxerror.go b/internal/ast/syntaxerror.go index fc3d5feb..ad8f7aae 100644 --- a/internal/ast/syntaxerror.go +++ b/internal/ast/syntaxerror.go @@ -23,14 +23,14 @@ type SyntaxError struct { StdSyntaxSymbol } -var errorSymbol = SyntaxError{config.SYMBOL_ERROR, StdSyntaxSymbol{}} +var ErrorSymbol = SyntaxError{config.SYMBOL_ERROR, StdSyntaxSymbol{}} func (SyntaxError) SymbolString() string { - return errorSymbol.string + return ErrorSymbol.string } func (SyntaxError) String() string { - return errorSymbol.string + return ErrorSymbol.string } func (SyntaxError) IsError() bool { return true } diff --git a/internal/ast/syntaxpart.go b/internal/ast/syntaxpart.go index b23d70e8..0716c274 100644 --- a/internal/ast/syntaxpart.go +++ b/internal/ast/syntaxpart.go @@ -35,9 +35,9 @@ func NewSyntaxPart(header, prodList interface{}) (*SyntaxPart, error) { func (this *SyntaxPart) augment() *SyntaxPart { startProd := &SyntaxProd{ - Id: "S'", + Id: SyntaxProdId{"S'", StdSyntaxSymbol{}}, Body: &SyntaxBody{ - Symbols: []SyntaxSymbol{SyntaxProdId{this.ProdList[0].Id, StdSyntaxSymbol{}}}, + Symbols: []SyntaxSymbol{SyntaxProdId{this.ProdList[0].Id.SymbolString(), StdSyntaxSymbol{}}}, }, } newProdList := SyntaxProdList{startProd} diff --git a/internal/ast/syntaxprod.go b/internal/ast/syntaxprod.go index 0f62107b..17659e51 100644 --- a/internal/ast/syntaxprod.go +++ b/internal/ast/syntaxprod.go @@ -19,7 +19,7 @@ import ( ) type SyntaxProd struct { - Id string + Id SyntaxProdId Body *SyntaxBody } @@ -29,11 +29,10 @@ func NewSyntaxProd(prodId, alts interface{}) ([]*SyntaxProd, error) { prods := make([]*SyntaxProd, len(alts1)) for i, body := range alts1 { prods[i] = &SyntaxProd{ - Id: pid, + Id: NewSyntaxProdIdFromString(pid), Body: body, } } - //fmt.Printf(" NewProd(%s)\n----------------\n", pid) return prods, nil } diff --git a/internal/ast/syntaxprodid.go b/internal/ast/syntaxprodid.go index fac69198..075afce9 100644 --- a/internal/ast/syntaxprodid.go +++ b/internal/ast/syntaxprodid.go @@ -28,6 +28,10 @@ func NewSyntaxProdId(tok interface{}) (SyntaxProdId, error) { return SyntaxProdId{getString(tok), StdSyntaxSymbol{}}, nil } +func NewSyntaxProdIdFromString(str string) SyntaxProdId { + return SyntaxProdId{str, StdSyntaxSymbol{}} +} + func (this SyntaxProdId) SymbolString() string { return this.string } diff --git a/internal/ast/syntaxstringlit.go b/internal/ast/syntaxstringlit.go index b6741152..e072ffc7 100644 --- a/internal/ast/syntaxstringlit.go +++ b/internal/ast/syntaxstringlit.go @@ -30,6 +30,10 @@ func NewStringLit(tok interface{}) (SyntaxStringLit, error) { return SyntaxStringLit{lit[1 : len(lit)-1], StdSyntaxSymbol{}}, nil } +func NewStringLitFromString(str string) SyntaxStringLit { + return SyntaxStringLit{str, StdSyntaxSymbol{}} +} + func (this SyntaxStringLit) SymbolString() string { return this.string } @@ -45,3 +49,7 @@ func (this SyntaxStringLit) Bytes() []byte { func (this SyntaxStringLit) SymbolName() string { return config.INTERNAL_SYMBOL_LIT + this.string } + +func (this SyntaxStringLit) IsTerminal() bool { + return true +} diff --git a/internal/ast/syntaxsymbol.go b/internal/ast/syntaxsymbol.go index 9f8a5e7c..74b4c7b9 100644 --- a/internal/ast/syntaxsymbol.go +++ b/internal/ast/syntaxsymbol.go @@ -23,13 +23,15 @@ type SyntaxSymbol interface { String() string IsError() bool IsEpsilon() bool + IsTerminal() bool gSymbol() } type StdSyntaxSymbol struct{} -func (StdSyntaxSymbol) IsError() bool { return false } -func (StdSyntaxSymbol) IsEpsilon() bool { return false } +func (StdSyntaxSymbol) IsError() bool { return false } +func (StdSyntaxSymbol) IsEpsilon() bool { return false } +func (StdSyntaxSymbol) IsTerminal() bool { return false } func (SyntaxEmpty) gSymbol() {} func (SyntaxEof) gSymbol() {} diff --git a/internal/ast/syntaxsymbols.go b/internal/ast/syntaxsymbols.go index 40a0a7f8..62e7c9c8 100644 --- a/internal/ast/syntaxsymbols.go +++ b/internal/ast/syntaxsymbols.go @@ -45,9 +45,9 @@ func (this SyntaxSymbols) String() string { func NewSyntaxSymbolsFromToken(tok interface{}) (SyntaxSymbols, error) { switch getString(tok) { case config.SYMBOL_EMPTY: - return SyntaxSymbols{emptySymbol}, nil + return SyntaxSymbols{EmptySymbol}, nil case config.SYMBOL_ERROR: - return SyntaxSymbols{errorSymbol}, nil + return SyntaxSymbols{ErrorSymbol}, nil } sym, err := NewStringLit(tok) return SyntaxSymbols{sym}, err diff --git a/internal/ast/syntaxtokid.go b/internal/ast/syntaxtokid.go index 95fe5975..3cb65c56 100644 --- a/internal/ast/syntaxtokid.go +++ b/internal/ast/syntaxtokid.go @@ -34,3 +34,7 @@ func (this SyntaxTokId) String() string { func (this SyntaxTokId) SymbolName() string { return this.string } + +func (this SyntaxTokId) IsTerminal() bool { + return true +} diff --git a/internal/frontend/reparsed/internal/lexer/lexer.go b/internal/frontend/reparsed/internal/lexer/lexer.go index e22a6757..166da2bd 100644 --- a/internal/frontend/reparsed/internal/lexer/lexer.go +++ b/internal/frontend/reparsed/internal/lexer/lexer.go @@ -3,9 +3,11 @@ package lexer import ( + "fmt" "io/ioutil" "unicode/utf8" + "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/internal/util" "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/internal/token" ) @@ -41,6 +43,7 @@ func NewLexerFile(fpath string) (*Lexer, error) { } func (l *Lexer) Scan() (tok *token.Token) { + fmt.Printf("Lexer.Scan() pos=%d\n", l.pos) tok = new(token.Token) if l.pos >= len(l.src) { tok.Type = token.EOF @@ -51,6 +54,7 @@ func (l *Lexer) Scan() (tok *token.Token) { tok.Type = token.INVALID state, rune1, size := 0, rune(-1), 0 for state != -1 { + fmt.Printf("\tpos=%d, line=%d, col=%d, state=%d\n", l.pos, l.line, l.column, state) if l.pos >= len(l.src) { rune1 = -1 } else { @@ -62,6 +66,11 @@ func (l *Lexer) Scan() (tok *token.Token) { if rune1 != -1 { nextState = TransTab[state](rune1) } + fmt.Printf("\tS%d, : tok=%s, rune == %s(%x), next state == %d\n", state, token.TokMap.Id(tok.Type), util.RuneToString(rune1), rune1, nextState) + fmt.Printf("\t\tpos=%d, size=%d, start=%d, end=%d\n", l.pos, size, start, end) + if nextState != -1 { + fmt.Printf("\t\taction:%s\n", ActTab[nextState].String()) + } state = nextState if state != -1 { @@ -103,6 +112,7 @@ func (l *Lexer) Scan() (tok *token.Token) { tok.Lit = []byte{} } tok.Pos.Offset, tok.Pos.Line, tok.Pos.Column = start, startLine, startColumn + fmt.Printf("Token at %s: %s \"%s\"\n", tok.String(), token.TokMap.Id(tok.Type), tok.Lit) return } diff --git a/internal/parser/first/first.go b/internal/parser/first/first.go index 5938ff1f..fa03e030 100644 --- a/internal/parser/first/first.go +++ b/internal/parser/first/first.go @@ -48,11 +48,11 @@ func GetFirstSets(g *ast.Grammar, symbols *symbols.Symbols) *FirstSets { for _, prod := range g.SyntaxPart.ProdList { switch { case prod.Body.Empty(): - if firstSets.AddToken(prod.Id, config.SYMBOL_EMPTY) { + if firstSets.AddToken(prod.Id, ast.EmptySymbol) { again = true } case symbols.IsTerminal(prod.Body.Symbols[0].SymbolString()): - if firstSets.AddToken(prod.Id, prod.Body.Symbols[0].SymbolString()) { + if firstSets.AddToken(prod.Id, prod.Body.Symbols[0]) { again = true } default: @@ -86,14 +86,14 @@ func (this *FirstSets) AddSet(prodName string, terminals SymbolSet) (symbolsAdde return } -func (this *FirstSets) AddToken(prodName string, terminal string) (symbolAdded bool) { +func (this *FirstSets) AddToken(prodName string, terminal ast.SyntaxSymbol) (symbolAdded bool) { set, ok := this.firstSets[prodName] if !ok { set = make(SymbolSet) this.firstSets[prodName] = set } if _, contain := set[terminal]; !contain { - set[terminal] = true + set[terminal] = struct{}{} symbolAdded = true } return @@ -118,9 +118,9 @@ func (this *FirstSets) String() string { } //Returns the First SymbolSet given the ast.SyntaxSymbol. -func First(fs *FirstSets, sym string) SymbolSet { +func First(fs *FirstSets, sym ast.SyntaxSymbol) SymbolSet { if fs.symbols.IsTerminal(sym) { - return SymbolSet{sym: true} + return SymbolSet{sym: struct{}{}} } return fs.GetSet(sym) } diff --git a/internal/parser/first/symbolset.go b/internal/parser/first/symbolset.go index 78fa6e3e..bc4ce7be 100644 --- a/internal/parser/first/symbolset.go +++ b/internal/parser/first/symbolset.go @@ -18,16 +18,18 @@ import ( "fmt" "sort" "strings" + + "github.com/maxcalandrelli/gocc/internal/ast" ) /* key: symbol string */ -type SymbolSet map[string]bool +type SymbolSet map[ast.SyntaxSymbol]struct{} func (this SymbolSet) AddSet(that SymbolSet) { for id := range that { - this[id] = true + this[id] = struct{}{} } } diff --git a/internal/parser/symbols/symbols.go b/internal/parser/symbols/symbols.go index 7aaf3eaf..d90bf9c1 100644 --- a/internal/parser/symbols/symbols.go +++ b/internal/parser/symbols/symbols.go @@ -43,21 +43,21 @@ type Symbols struct { //key: symbol type //val: symbol id - typeMap []string + typeMap []ast.SyntaxSymbol } func NewSymbols(grammar *ast.Grammar) *Symbols { symbols := &Symbols{ idMap: make(map[string]int), - typeMap: make([]string, 0, 16), + typeMap: make([]ast.SyntaxSymbol, 0, 16), ntIdMap: make(map[string]int), ntTypeMap: make([]string, 0, 16), stringLitIdMap: make(map[string]int), stringLitList: make([]string, 0, 16), } - symbols.Add(config.SYMBOL_INVALID) - symbols.Add(config.SYMBOL_EOF) + symbols.Add(ast.NewStringLitFromString(config.INTERNAL_SYMBOL_INVALID)) + symbols.Add(ast.ErrorSymbol) if grammar.SyntaxPart == nil { return symbols @@ -88,7 +88,7 @@ func NewSymbols(grammar *ast.Grammar) *Symbols { return symbols } -func (this *Symbols) Add(symbols ...string) { +func (this *Symbols) Add(symbols ...ast.SyntaxSymbol) { for _, sym := range symbols { if _, exist := this.idMap[sym]; !exist { this.typeMap = append(this.typeMap, sym) @@ -101,9 +101,8 @@ func (this *Symbols) Id(typ int) string { return this.typeMap[typ] } -func (this *Symbols) IsTerminal(sym string) bool { - _, nt := this.ntIdMap[sym] - return !nt +func (this *Symbols) IsTerminal(sym ast.SyntaxSymbol) bool { + return sym.IsTerminal() } func (this *Symbols) List() []string { @@ -117,7 +116,7 @@ func (this *Symbols) ListStringLitSymbols() []string { return this.stringLitList } -func (this *Symbols) ListTerminals() []string { +func (this *Symbols) ListTerminals() []*ast.SyntaxSymbol { terminals := make([]string, 0, 16) for _, sym := range this.typeMap { if this.IsTerminal(sym) { diff --git a/spec/test.bnf b/spec/test.bnf index b8ab7769..719f9dbd 100644 --- a/spec/test.bnf +++ b/spec/test.bnf @@ -1,5 +1,5 @@ -!space : ' ' | '\t' ; +!space : ' ' | '\t' ; hexdigit : '0'-'F' | ~(':'-'@') ; diff --git a/stock/main.go b/stock/main.go index 0550fa98..5488a06a 100644 --- a/stock/main.go +++ b/stock/main.go @@ -96,6 +96,11 @@ func main() { var tokenMap *outToken.TokenMap + fmt.Printf("token ids: %q\n", g.LexPart.TokenIds()) + fmt.Printf("literals: %q\n", gSymbols.ListStringLitSymbols()) + //fmt.Printf("item sets: %q\n", lexItems.GetItemSets(g.LexPart)) + fmt.Printf("terminals: %q\n", gSymbols.ListTerminals()) + gSymbols.Add(g.LexPart.TokenIds()...) g.LexPart.UpdateStringLitTokens(gSymbols.ListStringLitSymbols()) lexSets := lexItems.GetItemSets(g.LexPart) From eab7a19822a5a36afb8b642dd536a35b49eed96c Mon Sep 17 00:00:00 2001 From: Massimiliano Calandrelli Date: Mon, 7 Oct 2019 18:10:56 +0200 Subject: [PATCH 07/33] ... --- .gitignore | 1 + internal/ast/grammar.go | 2 +- internal/ast/lexnodewalker.go | 1 + internal/ast/lexpart.go | 18 +- internal/ast/lextokdef.go | 6 +- internal/ast/syntaxeof.go | 4 + internal/ast/syntaxpart.go | 2 +- internal/ast/syntaxprodid.go | 13 +- internal/ast/syntaxstringlit.go | 2 +- internal/ast/syntaxsymbol.go | 42 +- internal/ast/syntaxsymbols.go | 18 +- internal/ast/syntaxtokid.go | 4 + internal/config/config.go | 10 +- .../reparsed/internal/lexer/acttab.go | 218 +- .../frontend/reparsed/internal/lexer/lexer.go | 58 +- .../reparsed/internal/parser/actiontable.go | 5260 +++++----- .../reparsed/internal/parser/gototable.go | 5508 +++++------ .../internal/parser/productionstable.go | 136 +- .../frontend/reparsed/internal/token/token.go | 72 +- .../frontend/reparsed/log/LR1_conflicts.txt | 17 - internal/frontend/reparsed/log/LR1_sets.txt | 8466 ++++++++--------- internal/frontend/reparsed/log/first.txt | 101 +- internal/frontend/reparsed/log/lexer_sets.txt | 112 +- internal/frontend/reparsed/log/terminals.txt | 34 +- internal/lexer/gen/golang/acttab.go | 24 +- internal/parser/first/first.go | 32 +- internal/parser/first/symbolset.go | 2 +- internal/parser/gen/golang/gototable.go | 2 +- .../parser/gen/golang/productionstable.go | 4 +- internal/parser/lr1/items/item.go | 37 +- internal/parser/lr1/items/itemset.go | 24 +- internal/parser/lr1/items/itemsets.go | 4 +- internal/parser/lr1/items/rowconflicts.go | 3 +- internal/parser/symbols/symbols.go | 137 +- internal/token/gen/golang/token.go | 18 +- internal/token/tokenmap.go | 12 +- spec/gocc2.ebnf | 2 +- stock/main.go | 9 +- 38 files changed, 10218 insertions(+), 10197 deletions(-) delete mode 100644 internal/frontend/reparsed/log/LR1_conflicts.txt diff --git a/.gitignore b/.gitignore index ff265a63..29a1582c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ gocc sm_* build/ +*.debug diff --git a/internal/ast/grammar.go b/internal/ast/grammar.go index a5d4a63f..b349468f 100644 --- a/internal/ast/grammar.go +++ b/internal/ast/grammar.go @@ -50,7 +50,7 @@ func consistent(g *Grammar) (err error) { } defs := make(map[SyntaxSymbol]struct{}) - used := make(map[SyntaxSymbol][]SyntaxSymbol) + used := make(map[SyntaxSymbol]SyntaxSymbols) for _, tok := range g.LexPart.TokDefsList { defs[SyntaxTokId{tok.id, StdSyntaxSymbol{}}] = struct{}{} diff --git a/internal/ast/lexnodewalker.go b/internal/ast/lexnodewalker.go index 5037c724..ba590bf0 100644 --- a/internal/ast/lexnodewalker.go +++ b/internal/ast/lexnodewalker.go @@ -83,6 +83,7 @@ func (this *LexGroupPattern) Walk(visitor LexNodeVisitor) LexNodeVisitor { } func (this *LexIgnoredTokDef) Walk(visitor LexNodeVisitor) LexNodeVisitor { + fmt.Printf(" walk on: %s\n", this.Id()) return visitor.Visit(this) } diff --git a/internal/ast/lexpart.go b/internal/ast/lexpart.go index 89a29a6b..311f7e3f 100644 --- a/internal/ast/lexpart.go +++ b/internal/ast/lexpart.go @@ -113,22 +113,22 @@ func (this *LexPart) ProdIndex(id string) LexProdIndex { return idx } -func (this *LexPart) TokenIds() []string { - tids := make([]string, 0, len(this.TokDefs)) - for tid := range this.TokDefs { - tids = append(tids, tid) +func (this *LexPart) TokenIds() SyntaxSymbols { + tids := make(SyntaxSymbolsByName, 0, len(this.TokDefs)) + for _, tid := range this.TokDefs { + tids = append(tids, NewTokIdFromString(tid.Id())) } - sort.Strings(tids) - return tids + sort.Sort(&tids) + return SyntaxSymbols(tids) } -func (this *LexPart) UpdateStringLitTokens(tokens []string) { +func (this *LexPart) UpdateStringLitTokens(tokens SyntaxSymbols) { for _, strLit := range tokens { tokDef := NewLexStringLitTokDef(strLit) this.ProdMap.Add(tokDef) this.TokDefsList = append(this.TokDefsList, tokDef) - this.TokDefs[strLit] = tokDef - this.stringLitToks[strLit] = tokDef + this.TokDefs[strLit.SymbolName()] = tokDef + this.stringLitToks[strLit.SymbolName()] = tokDef this.ProdList.Productions = append(this.ProdList.Productions, tokDef) } } diff --git a/internal/ast/lextokdef.go b/internal/ast/lextokdef.go index 37e16c32..b5baa469 100644 --- a/internal/ast/lextokdef.go +++ b/internal/ast/lextokdef.go @@ -33,14 +33,14 @@ func NewLexTokDef(tokId, lexPattern interface{}) (*LexTokDef, error) { return tokDef, nil } -func NewLexStringLitTokDef(tokId string) *LexTokDef { - runes := bytes.Runes([]byte(tokId)) +func NewLexStringLitTokDef(tok SyntaxSymbol) *LexTokDef { + runes := bytes.Runes([]byte(tok.SymbolString())) alt, _ := NewLexAlt(newLexCharLitFromRune(runes[0])) for i := 1; i < len(runes); i++ { alt, _ = AppendLexTerm(alt, newLexCharLitFromRune(runes[i])) } ptrn, _ := NewLexPattern(alt) - id := tokId + id := tok.SymbolName() return &LexTokDef{ id: id, pattern: ptrn, diff --git a/internal/ast/syntaxeof.go b/internal/ast/syntaxeof.go index a9f0924a..a756d122 100644 --- a/internal/ast/syntaxeof.go +++ b/internal/ast/syntaxeof.go @@ -36,3 +36,7 @@ func (SyntaxEof) String() string { func (SyntaxEof) SymbolName() string { return config.INTERNAL_SYMBOL_EOF } + +func (SyntaxEof) IsTerminal() bool { + return true +} diff --git a/internal/ast/syntaxpart.go b/internal/ast/syntaxpart.go index 0716c274..0052a6f8 100644 --- a/internal/ast/syntaxpart.go +++ b/internal/ast/syntaxpart.go @@ -37,7 +37,7 @@ func (this *SyntaxPart) augment() *SyntaxPart { startProd := &SyntaxProd{ Id: SyntaxProdId{"S'", StdSyntaxSymbol{}}, Body: &SyntaxBody{ - Symbols: []SyntaxSymbol{SyntaxProdId{this.ProdList[0].Id.SymbolString(), StdSyntaxSymbol{}}}, + Symbols: SyntaxSymbols{SyntaxProdId{this.ProdList[0].Id.SymbolString(), StdSyntaxSymbol{}}}, }, } newProdList := SyntaxProdList{startProd} diff --git a/internal/ast/syntaxprodid.go b/internal/ast/syntaxprodid.go index 075afce9..a60cf78e 100644 --- a/internal/ast/syntaxprodid.go +++ b/internal/ast/syntaxprodid.go @@ -15,6 +15,8 @@ package ast import ( + "fmt" + "github.com/maxcalandrelli/gocc/internal/config" ) @@ -41,5 +43,14 @@ func (this SyntaxProdId) String() string { } func (this SyntaxProdId) SymbolName() string { - return config.INTERNAL_SYMBOL_PROD + this.string + //return this.SymbolString() + return fmt.Sprintf("%s<%s>", config.INTERNAL_SYMBOL_PROD, this.string) +} + +func (this SyntaxProdId) IsTerminal() bool { + return false +} + +func (this SyntaxProdId) IsNonTerminal() bool { + return true } diff --git a/internal/ast/syntaxstringlit.go b/internal/ast/syntaxstringlit.go index e072ffc7..7f538376 100644 --- a/internal/ast/syntaxstringlit.go +++ b/internal/ast/syntaxstringlit.go @@ -47,7 +47,7 @@ func (this SyntaxStringLit) Bytes() []byte { } func (this SyntaxStringLit) SymbolName() string { - return config.INTERNAL_SYMBOL_LIT + this.string + return fmt.Sprintf("%s<%s>", config.INTERNAL_SYMBOL_LIT, this.string) } func (this SyntaxStringLit) IsTerminal() bool { diff --git a/internal/ast/syntaxsymbol.go b/internal/ast/syntaxsymbol.go index 74b4c7b9..70c6e635 100644 --- a/internal/ast/syntaxsymbol.go +++ b/internal/ast/syntaxsymbol.go @@ -14,6 +14,10 @@ package ast +import ( + "github.com/maxcalandrelli/gocc/internal/config" +) + /* All syntax symbols are types of string */ @@ -24,18 +28,38 @@ type SyntaxSymbol interface { IsError() bool IsEpsilon() bool IsTerminal() bool + IsNonTerminal() bool gSymbol() } type StdSyntaxSymbol struct{} +type InvalidSyntaxSymbol struct{ StdSyntaxSymbol } + +func (StdSyntaxSymbol) IsError() bool { return false } +func (StdSyntaxSymbol) IsEpsilon() bool { return false } +func (StdSyntaxSymbol) IsTerminal() bool { return false } +func (StdSyntaxSymbol) IsNonTerminal() bool { return false } -func (StdSyntaxSymbol) IsError() bool { return false } -func (StdSyntaxSymbol) IsEpsilon() bool { return false } -func (StdSyntaxSymbol) IsTerminal() bool { return false } +func (SyntaxEmpty) gSymbol() {} +func (SyntaxEof) gSymbol() {} +func (SyntaxError) gSymbol() {} +func (SyntaxProdId) gSymbol() {} +func (SyntaxTokId) gSymbol() {} +func (SyntaxStringLit) gSymbol() {} +func (InvalidSyntaxSymbol) gSymbol() {} -func (SyntaxEmpty) gSymbol() {} -func (SyntaxEof) gSymbol() {} -func (SyntaxError) gSymbol() {} -func (SyntaxProdId) gSymbol() {} -func (SyntaxTokId) gSymbol() {} -func (SyntaxStringLit) gSymbol() {} +func (InvalidSyntaxSymbol) SymbolName() string { + return config.INTERNAL_SYMBOL_INVALID +} + +func (InvalidSyntaxSymbol) SymbolString() string { + return config.INTERNAL_SYMBOL_INVALID +} + +func (InvalidSyntaxSymbol) String() string { + return config.SYMBOL_INVALID +} + +func (InvalidSyntaxSymbol) IsTerminal() bool { + return true +} diff --git a/internal/ast/syntaxsymbols.go b/internal/ast/syntaxsymbols.go index 62e7c9c8..0f92a747 100644 --- a/internal/ast/syntaxsymbols.go +++ b/internal/ast/syntaxsymbols.go @@ -37,7 +37,7 @@ func (this SyntaxSymbols) String() string { if i > 0 { fmt.Fprintf(w, " ") } - fmt.Fprintf(w, sym.String()) + fmt.Fprintf(w, sym.SymbolName()) } return w.String() } @@ -52,3 +52,19 @@ func NewSyntaxSymbolsFromToken(tok interface{}) (SyntaxSymbols, error) { sym, err := NewStringLit(tok) return SyntaxSymbols{sym}, err } + +type SyntaxSymbolsByName SyntaxSymbols + +func (s *SyntaxSymbolsByName) Len() int { + return len(*s) +} + +func (s *SyntaxSymbolsByName) Less(i, j int) bool { + return (*s)[i].SymbolString() < (*s)[j].SymbolString() +} + +func (s *SyntaxSymbolsByName) Swap(i, j int) { + t := (*s)[i] + (*s)[i] = (*s)[j] + (*s)[j] = t +} diff --git a/internal/ast/syntaxtokid.go b/internal/ast/syntaxtokid.go index 3cb65c56..4656cd55 100644 --- a/internal/ast/syntaxtokid.go +++ b/internal/ast/syntaxtokid.go @@ -23,6 +23,10 @@ func NewTokId(tokId interface{}) (SyntaxTokId, error) { return SyntaxTokId{getString(tokId), StdSyntaxSymbol{}}, nil } +func NewTokIdFromString(str string) SyntaxTokId { + return SyntaxTokId{str, StdSyntaxSymbol{}} +} + func (this SyntaxTokId) SymbolString() string { return this.string } diff --git a/internal/config/config.go b/internal/config/config.go index 2164be5a..94e81d0f 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -27,14 +27,14 @@ import ( const ( INTERNAL_SYMBOL_EMPTY = "ε" - INTERNAL_SYMBOL_ERROR = "λ" // (λάθος) - INTERNAL_SYMBOL_INVALID = "ά" // (άκυρος) + INTERNAL_SYMBOL_ERROR = "λ" // (λάθος) + INTERNAL_SYMBOL_INVALID = "INVALID" // (άκυρος) INTERNAL_SYMBOL_EOF = "Ω" - INTERNAL_SYMBOL_PROD = "Π:" - INTERNAL_SYMBOL_LIT = "Λ:" + INTERNAL_SYMBOL_PROD = "Π" + INTERNAL_SYMBOL_LIT = "Λ" SYMBOL_EMPTY = "empty" SYMBOL_ERROR = "error" - SYMBOL_INVALID = "" + SYMBOL_INVALID = "ά" SYMBOL_EOF = "Ω" ) diff --git a/internal/frontend/reparsed/internal/lexer/acttab.go b/internal/frontend/reparsed/internal/lexer/acttab.go index 73854767..54ce0506 100644 --- a/internal/frontend/reparsed/internal/lexer/acttab.go +++ b/internal/frontend/reparsed/internal/lexer/acttab.go @@ -20,439 +20,439 @@ func (a ActionRow) String() string { } var ActTab = ActionTable{ - ActionRow{ // S0 + ActionRow{ // S0, Accept: 0, Ignore: "", }, - ActionRow{ // S1 + ActionRow{ // S1, Ignore("!whitespace") Accept: -1, Ignore: "!whitespace", }, - ActionRow{ // S2 + ActionRow{ // S2, Accept: 0, Ignore: "", }, - ActionRow{ // S3 + ActionRow{ // S3, Accept: 0, Ignore: "", }, - ActionRow{ // S4 + ActionRow{ // S4, Accept: 0, Ignore: "", }, - ActionRow{ // S5 + ActionRow{ // S5, Accept("Λ<(>") Accept: 12, Ignore: "", }, - ActionRow{ // S6 + ActionRow{ // S6, Accept("Λ<)>") Accept: 13, Ignore: "", }, - ActionRow{ // S7 + ActionRow{ // S7, Accept("Λ<->") Accept: 10, Ignore: "", }, - ActionRow{ // S8 + ActionRow{ // S8, Accept("Λ<.>") Accept: 8, Ignore: "", }, - ActionRow{ // S9 + ActionRow{ // S9, Accept: 0, Ignore: "", }, - ActionRow{ // S10 + ActionRow{ // S10, Accept("Λ<:>") Accept: 3, Ignore: "", }, - ActionRow{ // S11 + ActionRow{ // S11, Accept("Λ<;>") Accept: 4, Ignore: "", }, - ActionRow{ // S12 + ActionRow{ // S12, Accept: 0, Ignore: "", }, - ActionRow{ // S13 + ActionRow{ // S13, Accept("prodId") Accept: 19, Ignore: "", }, - ActionRow{ // S14 + ActionRow{ // S14, Accept("Λ<[>") Accept: 14, Ignore: "", }, - ActionRow{ // S15 + ActionRow{ // S15, Accept("Λ<]>") Accept: 15, Ignore: "", }, - ActionRow{ // S16 + ActionRow{ // S16, Accept("regDefId") Accept: 5, Ignore: "", }, - ActionRow{ // S17 + ActionRow{ // S17, Accept: 0, Ignore: "", }, - ActionRow{ // S18 + ActionRow{ // S18, Accept("tokId") Accept: 2, Ignore: "", }, - ActionRow{ // S19 + ActionRow{ // S19, Accept("tokId") Accept: 2, Ignore: "", }, - ActionRow{ // S20 + ActionRow{ // S20, Accept("Λ<{>") Accept: 16, Ignore: "", }, - ActionRow{ // S21 + ActionRow{ // S21, Accept("Λ<|>") Accept: 7, Ignore: "", }, - ActionRow{ // S22 + ActionRow{ // S22, Accept("Λ<}>") Accept: 17, Ignore: "", }, - ActionRow{ // S23 + ActionRow{ // S23, Accept("Λ<~>") Accept: 11, Ignore: "", }, - ActionRow{ // S24 + ActionRow{ // S24, Accept("Λ<ε>") Accept: 24, Ignore: "", }, - ActionRow{ // S25 + ActionRow{ // S25, Accept("Λ<λ>") Accept: 22, Ignore: "", }, - ActionRow{ // S26 + ActionRow{ // S26, Accept("ignoredTokId") Accept: 6, Ignore: "", }, - ActionRow{ // S27 + ActionRow{ // S27, Accept("string_lit") Accept: 20, Ignore: "", }, - ActionRow{ // S28 + ActionRow{ // S28, Accept: 0, Ignore: "", }, - ActionRow{ // S29 + ActionRow{ // S29, Accept: 0, Ignore: "", }, - ActionRow{ // S30 + ActionRow{ // S30, Accept: 0, Ignore: "", }, - ActionRow{ // S31 + ActionRow{ // S31, Accept: 0, Ignore: "", }, - ActionRow{ // S32 + ActionRow{ // S32, Accept: 0, Ignore: "", }, - ActionRow{ // S33 + ActionRow{ // S33, Accept: 0, Ignore: "", }, - ActionRow{ // S34 + ActionRow{ // S34, Accept: 0, Ignore: "", }, - ActionRow{ // S35 + ActionRow{ // S35, Accept("prodId") Accept: 19, Ignore: "", }, - ActionRow{ // S36 + ActionRow{ // S36, Accept("prodId") Accept: 19, Ignore: "", }, - ActionRow{ // S37 + ActionRow{ // S37, Accept("prodId") Accept: 19, Ignore: "", }, - ActionRow{ // S38 + ActionRow{ // S38, Accept("prodId") Accept: 19, Ignore: "", }, - ActionRow{ // S39 + ActionRow{ // S39, Accept("regDefId") Accept: 5, Ignore: "", }, - ActionRow{ // S40 + ActionRow{ // S40, Accept("regDefId") Accept: 5, Ignore: "", }, - ActionRow{ // S41 + ActionRow{ // S41, Accept("regDefId") Accept: 5, Ignore: "", }, - ActionRow{ // S42 + ActionRow{ // S42, Accept("regDefId") Accept: 5, Ignore: "", }, - ActionRow{ // S43 + ActionRow{ // S43, Accept("string_lit") Accept: 20, Ignore: "", }, - ActionRow{ // S44 + ActionRow{ // S44, Accept("tokId") Accept: 2, Ignore: "", }, - ActionRow{ // S45 + ActionRow{ // S45, Accept("tokId") Accept: 2, Ignore: "", }, - ActionRow{ // S46 + ActionRow{ // S46, Accept("tokId") Accept: 2, Ignore: "", }, - ActionRow{ // S47 + ActionRow{ // S47, Accept("tokId") Accept: 2, Ignore: "", }, - ActionRow{ // S48 + ActionRow{ // S48, Accept("tokId") Accept: 2, Ignore: "", }, - ActionRow{ // S49 + ActionRow{ // S49, Accept("tokId") Accept: 2, Ignore: "", }, - ActionRow{ // S50 + ActionRow{ // S50, Accept("ignoredTokId") Accept: 6, Ignore: "", }, - ActionRow{ // S51 + ActionRow{ // S51, Accept("ignoredTokId") Accept: 6, Ignore: "", }, - ActionRow{ // S52 + ActionRow{ // S52, Accept("ignoredTokId") Accept: 6, Ignore: "", }, - ActionRow{ // S53 + ActionRow{ // S53, Accept("ignoredTokId") Accept: 6, Ignore: "", }, - ActionRow{ // S54 + ActionRow{ // S54, Accept: 0, Ignore: "", }, - ActionRow{ // S55 + ActionRow{ // S55, Accept: 0, Ignore: "", }, - ActionRow{ // S56 + ActionRow{ // S56, Accept: 0, Ignore: "", }, - ActionRow{ // S57 + ActionRow{ // S57, Accept: 0, Ignore: "", }, - ActionRow{ // S58 + ActionRow{ // S58, Accept: 0, Ignore: "", }, - ActionRow{ // S59 + ActionRow{ // S59, Accept: 0, Ignore: "", }, - ActionRow{ // S60 + ActionRow{ // S60, Accept: 0, Ignore: "", }, - ActionRow{ // S61 + ActionRow{ // S61, Accept: 0, Ignore: "", }, - ActionRow{ // S62 + ActionRow{ // S62, Accept: 0, Ignore: "", }, - ActionRow{ // S63 + ActionRow{ // S63, Accept: 0, Ignore: "", }, - ActionRow{ // S64 + ActionRow{ // S64, Accept("char_lit") Accept: 9, Ignore: "", }, - ActionRow{ // S65 + ActionRow{ // S65, Accept: 0, Ignore: "", }, - ActionRow{ // S66 + ActionRow{ // S66, Ignore("!comment") Accept: -1, Ignore: "!comment", }, - ActionRow{ // S67 + ActionRow{ // S67, Accept: 0, Ignore: "", }, - ActionRow{ // S68 + ActionRow{ // S68, Accept("tokId") Accept: 2, Ignore: "", }, - ActionRow{ // S69 + ActionRow{ // S69, Accept("tokId") Accept: 2, Ignore: "", }, - ActionRow{ // S70 + ActionRow{ // S70, Accept: 0, Ignore: "", }, - ActionRow{ // S71 + ActionRow{ // S71, Accept: 0, Ignore: "", }, - ActionRow{ // S72 + ActionRow{ // S72, Accept: 0, Ignore: "", }, - ActionRow{ // S73 + ActionRow{ // S73, Accept: 0, Ignore: "", }, - ActionRow{ // S74 + ActionRow{ // S74, Accept: 0, Ignore: "", }, - ActionRow{ // S75 + ActionRow{ // S75, Accept: 0, Ignore: "", }, - ActionRow{ // S76 + ActionRow{ // S76, Accept: 0, Ignore: "", }, - ActionRow{ // S77 + ActionRow{ // S77, Accept: 0, Ignore: "", }, - ActionRow{ // S78 + ActionRow{ // S78, Ignore("!comment") Accept: -1, Ignore: "!comment", }, - ActionRow{ // S79 + ActionRow{ // S79, Accept: 0, Ignore: "", }, - ActionRow{ // S80 + ActionRow{ // S80, Accept("tokId") Accept: 2, Ignore: "", }, - ActionRow{ // S81 + ActionRow{ // S81, Accept("tokId") Accept: 2, Ignore: "", }, - ActionRow{ // S82 + ActionRow{ // S82, Accept: 0, Ignore: "", }, - ActionRow{ // S83 + ActionRow{ // S83, Accept: 0, Ignore: "", }, - ActionRow{ // S84 + ActionRow{ // S84, Accept: 0, Ignore: "", }, - ActionRow{ // S85 + ActionRow{ // S85, Accept: 0, Ignore: "", }, - ActionRow{ // S86 + ActionRow{ // S86, Accept: 0, Ignore: "", }, - ActionRow{ // S87 + ActionRow{ // S87, Accept: 0, Ignore: "", }, - ActionRow{ // S88 + ActionRow{ // S88, Accept: 0, Ignore: "", }, - ActionRow{ // S89 + ActionRow{ // S89, Accept: 0, Ignore: "", }, - ActionRow{ // S90 + ActionRow{ // S90, Accept("g_sdt_lit") Accept: 18, Ignore: "", }, - ActionRow{ // S91 + ActionRow{ // S91, Accept("Λ") Accept: 23, Ignore: "", }, - ActionRow{ // S92 + ActionRow{ // S92, Accept("Λ") Accept: 21, Ignore: "", }, - ActionRow{ // S93 + ActionRow{ // S93, Accept: 0, Ignore: "", }, - ActionRow{ // S94 + ActionRow{ // S94, Accept: 0, Ignore: "", }, - ActionRow{ // S95 + ActionRow{ // S95, Accept: 0, Ignore: "", }, - ActionRow{ // S96 + ActionRow{ // S96, Accept: 0, Ignore: "", }, - ActionRow{ // S97 + ActionRow{ // S97, Accept: 0, Ignore: "", }, - ActionRow{ // S98 + ActionRow{ // S98, Accept: 0, Ignore: "", }, - ActionRow{ // S99 + ActionRow{ // S99, Accept: 0, Ignore: "", }, - ActionRow{ // S100 + ActionRow{ // S100, Accept: 0, Ignore: "", }, - ActionRow{ // S101 + ActionRow{ // S101, Accept: 0, Ignore: "", }, - ActionRow{ // S102 + ActionRow{ // S102, Accept: 0, Ignore: "", }, - ActionRow{ // S103 + ActionRow{ // S103, Accept: 0, Ignore: "", }, - ActionRow{ // S104 + ActionRow{ // S104, Accept: 0, Ignore: "", }, - ActionRow{ // S105 + ActionRow{ // S105, Accept: 0, Ignore: "", }, - ActionRow{ // S106 + ActionRow{ // S106, Accept: 0, Ignore: "", }, - ActionRow{ // S107 + ActionRow{ // S107, Accept: 0, Ignore: "", }, - ActionRow{ // S108 + ActionRow{ // S108, Accept: 0, Ignore: "", }, diff --git a/internal/frontend/reparsed/internal/lexer/lexer.go b/internal/frontend/reparsed/internal/lexer/lexer.go index 166da2bd..a1bbeb4f 100644 --- a/internal/frontend/reparsed/internal/lexer/lexer.go +++ b/internal/frontend/reparsed/internal/lexer/lexer.go @@ -3,11 +3,9 @@ package lexer import ( - "fmt" "io/ioutil" "unicode/utf8" - "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/internal/util" "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/internal/token" ) @@ -43,7 +41,6 @@ func NewLexerFile(fpath string) (*Lexer, error) { } func (l *Lexer) Scan() (tok *token.Token) { - fmt.Printf("Lexer.Scan() pos=%d\n", l.pos) tok = new(token.Token) if l.pos >= len(l.src) { tok.Type = token.EOF @@ -54,7 +51,6 @@ func (l *Lexer) Scan() (tok *token.Token) { tok.Type = token.INVALID state, rune1, size := 0, rune(-1), 0 for state != -1 { - fmt.Printf("\tpos=%d, line=%d, col=%d, state=%d\n", l.pos, l.line, l.column, state) if l.pos >= len(l.src) { rune1 = -1 } else { @@ -66,11 +62,6 @@ func (l *Lexer) Scan() (tok *token.Token) { if rune1 != -1 { nextState = TransTab[state](rune1) } - fmt.Printf("\tS%d, : tok=%s, rune == %s(%x), next state == %d\n", state, token.TokMap.Id(tok.Type), util.RuneToString(rune1), rune1, nextState) - fmt.Printf("\t\tpos=%d, size=%d, start=%d, end=%d\n", l.pos, size, start, end) - if nextState != -1 { - fmt.Printf("\t\taction:%s\n", ActTab[nextState].String()) - } state = nextState if state != -1 { @@ -112,7 +103,6 @@ func (l *Lexer) Scan() (tok *token.Token) { tok.Lit = []byte{} } tok.Pos.Offset, tok.Pos.Line, tok.Pos.Column = start, startLine, startColumn - fmt.Printf("Token at %s: %s \"%s\"\n", tok.String(), token.TokMap.Id(tok.Type), tok.Lit) return } @@ -166,30 +156,30 @@ Lexer symbols: 5: '<' 6: '>' 7: '>' -8: ':' -9: ';' -10: '|' -11: '.' -12: '-' -13: '~' -14: '(' -15: ')' -16: '[' -17: ']' -18: '{' -19: '}' -20: 'e' -21: 'r' -22: 'r' -23: 'o' -24: 'r' -25: \u03bb -26: 'e' -27: 'm' -28: 'p' -29: 't' -30: 'y' -31: \u03b5 +8: '~' +9: ']' +10: ':' +11: '|' +12: '[' +13: '-' +14: ')' +15: 'e' +16: 'r' +17: 'r' +18: 'o' +19: 'r' +20: '(' +21: '{' +22: 'e' +23: 'm' +24: 'p' +25: 't' +26: 'y' +27: \u03b5 +28: ';' +29: '}' +30: '.' +31: \u03bb 32: '/' 33: '/' 34: '\n' diff --git a/internal/frontend/reparsed/internal/parser/actiontable.go b/internal/frontend/reparsed/internal/parser/actiontable.go index 80b7aeb8..6dfb93f3 100644 --- a/internal/frontend/reparsed/internal/parser/actiontable.go +++ b/internal/frontend/reparsed/internal/parser/actiontable.go @@ -14,4591 +14,4591 @@ var actionTab = actionTable{ actionRow{ // S0 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω shift(9), // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" shift(10), // regDefId shift(11), // ignoredTokId - nil, // | - nil, // . + nil, // "|" + nil, // "." nil, // char_lit - nil, // - - nil, // ~ - nil, // ( - nil, // ) - nil, // [ - nil, // ] - nil, // { - nil, // } + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" shift(12), // g_sdt_lit shift(13), // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S1 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά accept(true), // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" nil, // regDefId nil, // ignoredTokId - nil, // | - nil, // . + nil, // "|" + nil, // "." nil, // char_lit - nil, // - - nil, // ~ - nil, // ( - nil, // ) - nil, // [ - nil, // ] - nil, // { - nil, // } + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S2 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά reduce(2), // Ω, reduce: Grammar nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" nil, // regDefId nil, // ignoredTokId - nil, // | - nil, // . + nil, // "|" + nil, // "." nil, // char_lit - nil, // - - nil, // ~ - nil, // ( - nil, // ) - nil, // [ - nil, // ] - nil, // { - nil, // } + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" shift(12), // g_sdt_lit shift(13), // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S3 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά + reduce(3), // Ω, reduce: Grammar + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S4 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά reduce(4), // Ω, reduce: LexicalPart shift(9), // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" shift(10), // regDefId shift(11), // ignoredTokId - nil, // | - nil, // . + nil, // "|" + nil, // "." nil, // char_lit - nil, // - - nil, // ~ - nil, // ( - nil, // ) - nil, // [ - nil, // ] - nil, // { - nil, // } + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" reduce(4), // g_sdt_lit, reduce: LexicalPart reduce(4), // prodId, reduce: LexicalPart nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, - actionRow{ // S4 + actionRow{ // S5 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά reduce(5), // Ω, reduce: LexProductions reduce(5), // tokId, reduce: LexProductions - nil, // : - nil, // ; + nil, // ":" + nil, // ";" reduce(5), // regDefId, reduce: LexProductions reduce(5), // ignoredTokId, reduce: LexProductions - nil, // | - nil, // . + nil, // "|" + nil, // "." nil, // char_lit - nil, // - - nil, // ~ - nil, // ( - nil, // ) - nil, // [ - nil, // ] - nil, // { - nil, // } + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" reduce(5), // g_sdt_lit, reduce: LexProductions reduce(5), // prodId, reduce: LexProductions nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε - }, - }, - actionRow{ // S5 - canRecover: false, - actions: [numSymbols]action{ - nil, // - reduce(3), // Ω, reduce: Grammar - nil, // tokId - nil, // : - nil, // ; - nil, // regDefId - nil, // ignoredTokId - nil, // | - nil, // . - nil, // char_lit - nil, // - - nil, // ~ - nil, // ( - nil, // ) - nil, // [ - nil, // ] - nil, // { - nil, // } - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S6 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" nil, // regDefId nil, // ignoredTokId - nil, // | - nil, // . + nil, // "|" + nil, // "." nil, // char_lit - nil, // - - nil, // ~ - nil, // ( - nil, // ) - nil, // [ - nil, // ] - nil, // { - nil, // } + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" nil, // g_sdt_lit shift(13), // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S7 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά reduce(24), // Ω, reduce: SyntaxPart nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" nil, // regDefId nil, // ignoredTokId - nil, // | - nil, // . + nil, // "|" + nil, // "." nil, // char_lit - nil, // - - nil, // ~ - nil, // ( - nil, // ) - nil, // [ - nil, // ] - nil, // { - nil, // } + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" nil, // g_sdt_lit shift(13), // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S8 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά reduce(26), // Ω, reduce: SyntaxProdList nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" nil, // regDefId nil, // ignoredTokId - nil, // | - nil, // . + nil, // "|" + nil, // "." nil, // char_lit - nil, // - - nil, // ~ - nil, // ( - nil, // ) - nil, // [ - nil, // ] - nil, // { - nil, // } + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" nil, // g_sdt_lit reduce(26), // prodId, reduce: SyntaxProdList nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S9 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - shift(18), // : - nil, // ; + shift(18), // ":" + nil, // ";" nil, // regDefId nil, // ignoredTokId - nil, // | - nil, // . + nil, // "|" + nil, // "." nil, // char_lit - nil, // - - nil, // ~ - nil, // ( - nil, // ) - nil, // [ - nil, // ] - nil, // { - nil, // } + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S10 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - shift(19), // : - nil, // ; + shift(19), // ":" + nil, // ";" nil, // regDefId nil, // ignoredTokId - nil, // | - nil, // . + nil, // "|" + nil, // "." nil, // char_lit - nil, // - - nil, // ~ - nil, // ( - nil, // ) - nil, // [ - nil, // ] - nil, // { - nil, // } + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S11 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - shift(20), // : - nil, // ; + shift(20), // ":" + nil, // ";" nil, // regDefId nil, // ignoredTokId - nil, // | - nil, // . + nil, // "|" + nil, // "." nil, // char_lit - nil, // - - nil, // ~ - nil, // ( - nil, // ) - nil, // [ - nil, // ] - nil, // { - nil, // } + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S12 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" nil, // regDefId nil, // ignoredTokId - nil, // | - nil, // . + nil, // "|" + nil, // "." nil, // char_lit - nil, // - - nil, // ~ - nil, // ( - nil, // ) - nil, // [ - nil, // ] - nil, // { - nil, // } + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" nil, // g_sdt_lit reduce(25), // prodId, reduce: FileHeader nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S13 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - shift(21), // : - nil, // ; + shift(21), // ":" + nil, // ";" nil, // regDefId nil, // ignoredTokId - nil, // | - nil, // . + nil, // "|" + nil, // "." nil, // char_lit - nil, // - - nil, // ~ - nil, // ( - nil, // ) - nil, // [ - nil, // ] - nil, // { - nil, // } + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S14 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά reduce(1), // Ω, reduce: Grammar nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" nil, // regDefId nil, // ignoredTokId - nil, // | - nil, // . + nil, // "|" + nil, // "." nil, // char_lit - nil, // - - nil, // ~ - nil, // ( - nil, // ) - nil, // [ - nil, // ] - nil, // { - nil, // } + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S15 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά reduce(6), // Ω, reduce: LexProductions reduce(6), // tokId, reduce: LexProductions - nil, // : - nil, // ; + nil, // ":" + nil, // ";" reduce(6), // regDefId, reduce: LexProductions reduce(6), // ignoredTokId, reduce: LexProductions - nil, // | - nil, // . + nil, // "|" + nil, // "." nil, // char_lit - nil, // - - nil, // ~ - nil, // ( - nil, // ) - nil, // [ - nil, // ] - nil, // { - nil, // } + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" reduce(6), // g_sdt_lit, reduce: LexProductions reduce(6), // prodId, reduce: LexProductions nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S16 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά reduce(23), // Ω, reduce: SyntaxPart nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" nil, // regDefId nil, // ignoredTokId - nil, // | - nil, // . + nil, // "|" + nil, // "." nil, // char_lit - nil, // - - nil, // ~ - nil, // ( - nil, // ) - nil, // [ - nil, // ] - nil, // { - nil, // } + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" nil, // g_sdt_lit shift(13), // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S17 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά reduce(27), // Ω, reduce: SyntaxProdList nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" nil, // regDefId nil, // ignoredTokId - nil, // | - nil, // . + nil, // "|" + nil, // "." nil, // char_lit - nil, // - - nil, // ~ - nil, // ( - nil, // ) - nil, // [ - nil, // ] - nil, // { - nil, // } + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" nil, // g_sdt_lit reduce(27), // prodId, reduce: SyntaxProdList nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S18 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" shift(25), // regDefId nil, // ignoredTokId - nil, // | - shift(26), // . + nil, // "|" + shift(26), // "." shift(27), // char_lit - nil, // - - shift(28), // ~ - shift(29), // ( - nil, // ) - shift(30), // [ - nil, // ] - shift(31), // { - nil, // } + nil, // "-" + shift(28), // "~" + shift(29), // "(" + nil, // ")" + shift(30), // "[" + nil, // "]" + shift(31), // "{" + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S19 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" shift(25), // regDefId nil, // ignoredTokId - nil, // | - shift(26), // . + nil, // "|" + shift(26), // "." shift(27), // char_lit - nil, // - - shift(28), // ~ - shift(29), // ( - nil, // ) - shift(30), // [ - nil, // ] - shift(31), // { - nil, // } + nil, // "-" + shift(28), // "~" + shift(29), // "(" + nil, // ")" + shift(30), // "[" + nil, // "]" + shift(31), // "{" + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S20 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" shift(25), // regDefId nil, // ignoredTokId - nil, // | - shift(26), // . + nil, // "|" + shift(26), // "." shift(27), // char_lit - nil, // - - shift(28), // ~ - shift(29), // ( - nil, // ) - shift(30), // [ - nil, // ] - shift(31), // { - nil, // } + nil, // "-" + shift(28), // "~" + shift(29), // "(" + nil, // ")" + shift(30), // "[" + nil, // "]" + shift(31), // "{" + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S21 - canRecover: true, + canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω shift(40), // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" nil, // regDefId nil, // ignoredTokId - nil, // | - nil, // . + nil, // "|" + nil, // "." nil, // char_lit - nil, // - - nil, // ~ - nil, // ( - nil, // ) - nil, // [ - nil, // ] - nil, // { - nil, // } + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" nil, // g_sdt_lit shift(41), // prodId shift(42), // string_lit - shift(43), // error - shift(44), // λ - shift(45), // empty - shift(46), // ε + shift(43), // "error" + shift(44), // "λ" + shift(45), // "empty" + shift(46), // "ε" }, }, actionRow{ // S22 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - shift(47), // ; + nil, // ":" + shift(47), // ";" nil, // regDefId nil, // ignoredTokId - shift(48), // | - nil, // . + shift(48), // "|" + nil, // "." nil, // char_lit - nil, // - - nil, // ~ - nil, // ( - nil, // ) - nil, // [ - nil, // ] - nil, // { - nil, // } + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S23 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - reduce(10), // ;, reduce: LexPattern + nil, // ":" + reduce(10), // ";", reduce: LexPattern shift(25), // regDefId nil, // ignoredTokId - reduce(10), // |, reduce: LexPattern - shift(26), // . + reduce(10), // "|", reduce: LexPattern + shift(26), // "." shift(27), // char_lit - nil, // - - shift(28), // ~ - shift(29), // ( - nil, // ) - shift(30), // [ - nil, // ] - shift(31), // { - nil, // } + nil, // "-" + shift(28), // "~" + shift(29), // "(" + nil, // ")" + shift(30), // "[" + nil, // "]" + shift(31), // "{" + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S24 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - reduce(12), // ;, reduce: LexAlt + nil, // ":" + reduce(12), // ";", reduce: LexAlt reduce(12), // regDefId, reduce: LexAlt nil, // ignoredTokId - reduce(12), // |, reduce: LexAlt - reduce(12), // ., reduce: LexAlt + reduce(12), // "|", reduce: LexAlt + reduce(12), // ".", reduce: LexAlt reduce(12), // char_lit, reduce: LexAlt - nil, // - - reduce(12), // ~, reduce: LexAlt - reduce(12), // (, reduce: LexAlt - nil, // ) - reduce(12), // [, reduce: LexAlt - nil, // ] - reduce(12), // {, reduce: LexAlt - nil, // } + nil, // "-" + reduce(12), // "~", reduce: LexAlt + reduce(12), // "(", reduce: LexAlt + nil, // ")" + reduce(12), // "[", reduce: LexAlt + nil, // "]" + reduce(12), // "{", reduce: LexAlt + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S25 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - reduce(19), // ;, reduce: LexTerm + nil, // ":" + reduce(19), // ";", reduce: LexTerm reduce(19), // regDefId, reduce: LexTerm nil, // ignoredTokId - reduce(19), // |, reduce: LexTerm - reduce(19), // ., reduce: LexTerm + reduce(19), // "|", reduce: LexTerm + reduce(19), // ".", reduce: LexTerm reduce(19), // char_lit, reduce: LexTerm - nil, // - - reduce(19), // ~, reduce: LexTerm - reduce(19), // (, reduce: LexTerm - nil, // ) - reduce(19), // [, reduce: LexTerm - nil, // ] - reduce(19), // {, reduce: LexTerm - nil, // } + nil, // "-" + reduce(19), // "~", reduce: LexTerm + reduce(19), // "(", reduce: LexTerm + nil, // ")" + reduce(19), // "[", reduce: LexTerm + nil, // "]" + reduce(19), // "{", reduce: LexTerm + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S26 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - reduce(14), // ;, reduce: LexTerm + nil, // ":" + reduce(14), // ";", reduce: LexTerm reduce(14), // regDefId, reduce: LexTerm nil, // ignoredTokId - reduce(14), // |, reduce: LexTerm - reduce(14), // ., reduce: LexTerm + reduce(14), // "|", reduce: LexTerm + reduce(14), // ".", reduce: LexTerm reduce(14), // char_lit, reduce: LexTerm - nil, // - - reduce(14), // ~, reduce: LexTerm - reduce(14), // (, reduce: LexTerm - nil, // ) - reduce(14), // [, reduce: LexTerm - nil, // ] - reduce(14), // {, reduce: LexTerm - nil, // } + nil, // "-" + reduce(14), // "~", reduce: LexTerm + reduce(14), // "(", reduce: LexTerm + nil, // ")" + reduce(14), // "[", reduce: LexTerm + nil, // "]" + reduce(14), // "{", reduce: LexTerm + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S27 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - reduce(15), // ;, reduce: LexTerm + nil, // ":" + reduce(15), // ";", reduce: LexTerm reduce(15), // regDefId, reduce: LexTerm nil, // ignoredTokId - reduce(15), // |, reduce: LexTerm - reduce(15), // ., reduce: LexTerm + reduce(15), // "|", reduce: LexTerm + reduce(15), // ".", reduce: LexTerm reduce(15), // char_lit, reduce: LexTerm - shift(50), // - - reduce(15), // ~, reduce: LexTerm - reduce(15), // (, reduce: LexTerm - nil, // ) - reduce(15), // [, reduce: LexTerm - nil, // ] - reduce(15), // {, reduce: LexTerm - nil, // } + shift(50), // "-" + reduce(15), // "~", reduce: LexTerm + reduce(15), // "(", reduce: LexTerm + nil, // ")" + reduce(15), // "[", reduce: LexTerm + nil, // "]" + reduce(15), // "{", reduce: LexTerm + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S28 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" nil, // regDefId nil, // ignoredTokId - nil, // | - nil, // . + nil, // "|" + nil, // "." shift(51), // char_lit - nil, // - - nil, // ~ - shift(52), // ( - nil, // ) - nil, // [ - nil, // ] - nil, // { - nil, // } + nil, // "-" + nil, // "~" + shift(52), // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S29 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" shift(56), // regDefId nil, // ignoredTokId - nil, // | - shift(57), // . + nil, // "|" + shift(57), // "." shift(58), // char_lit - nil, // - - shift(59), // ~ - shift(60), // ( - nil, // ) - shift(61), // [ - nil, // ] - shift(62), // { - nil, // } + nil, // "-" + shift(59), // "~" + shift(60), // "(" + nil, // ")" + shift(61), // "[" + nil, // "]" + shift(62), // "{" + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S30 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" shift(66), // regDefId nil, // ignoredTokId - nil, // | - shift(67), // . + nil, // "|" + shift(67), // "." shift(68), // char_lit - nil, // - - shift(69), // ~ - shift(70), // ( - nil, // ) - shift(71), // [ - nil, // ] - shift(72), // { - nil, // } + nil, // "-" + shift(69), // "~" + shift(70), // "(" + nil, // ")" + shift(71), // "[" + nil, // "]" + shift(72), // "{" + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S31 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" shift(76), // regDefId nil, // ignoredTokId - nil, // | - shift(77), // . + nil, // "|" + shift(77), // "." shift(78), // char_lit - nil, // - - shift(79), // ~ - shift(80), // ( - nil, // ) - shift(81), // [ - nil, // ] - shift(82), // { - nil, // } + nil, // "-" + shift(79), // "~" + shift(80), // "(" + nil, // ")" + shift(81), // "[" + nil, // "]" + shift(82), // "{" + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S32 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - shift(83), // ; + nil, // ":" + shift(83), // ";" nil, // regDefId nil, // ignoredTokId - shift(48), // | - nil, // . + shift(48), // "|" + nil, // "." nil, // char_lit - nil, // - - nil, // ~ - nil, // ( - nil, // ) - nil, // [ - nil, // ] - nil, // { - nil, // } + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S33 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - shift(84), // ; + nil, // ":" + shift(84), // ";" nil, // regDefId nil, // ignoredTokId - shift(48), // | - nil, // . + shift(48), // "|" + nil, // "." nil, // char_lit - nil, // - - nil, // ~ - nil, // ( - nil, // ) - nil, // [ - nil, // ] - nil, // { - nil, // } + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S34 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - shift(85), // ; + nil, // ":" + shift(85), // ";" nil, // regDefId nil, // ignoredTokId - shift(86), // | - nil, // . + shift(86), // "|" + nil, // "." nil, // char_lit - nil, // - - nil, // ~ - nil, // ( - nil, // ) - nil, // [ - nil, // ] - nil, // { - nil, // } + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S35 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - reduce(29), // ;, reduce: Alternatives + nil, // ":" + reduce(29), // ";", reduce: Alternatives nil, // regDefId nil, // ignoredTokId - reduce(29), // |, reduce: Alternatives - nil, // . + reduce(29), // "|", reduce: Alternatives + nil, // "." nil, // char_lit - nil, // - - nil, // ~ - nil, // ( - nil, // ) - nil, // [ - nil, // ] - nil, // { - nil, // } + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S36 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω shift(40), // tokId - nil, // : - reduce(31), // ;, reduce: SyntaxBody + nil, // ":" + reduce(31), // ";", reduce: SyntaxBody nil, // regDefId nil, // ignoredTokId - reduce(31), // |, reduce: SyntaxBody - nil, // . + reduce(31), // "|", reduce: SyntaxBody + nil, // "." nil, // char_lit - nil, // - - nil, // ~ - nil, // ( - nil, // ) - nil, // [ - nil, // ] - nil, // { - nil, // } + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" shift(88), // g_sdt_lit shift(41), // prodId shift(42), // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S37 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω - reduce(38), // tokId, reduce: Symbols - nil, // : - reduce(38), // ;, reduce: Symbols + shift(40), // tokId + nil, // ":" + reduce(33), // ";", reduce: SyntaxBody nil, // regDefId nil, // ignoredTokId - reduce(38), // |, reduce: Symbols - nil, // . + reduce(33), // "|", reduce: SyntaxBody + nil, // "." nil, // char_lit - nil, // - - nil, // ~ - nil, // ( - nil, // ) - nil, // [ - nil, // ] - nil, // { - nil, // } - reduce(38), // g_sdt_lit, reduce: Symbols - reduce(38), // prodId, reduce: Symbols - reduce(38), // string_lit, reduce: Symbols - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + shift(90), // g_sdt_lit + shift(41), // prodId + shift(42), // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S38 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω - shift(40), // tokId - nil, // : - reduce(33), // ;, reduce: SyntaxBody + nil, // tokId + nil, // ":" + reduce(37), // ";", reduce: SyntaxBody nil, // regDefId nil, // ignoredTokId - reduce(33), // |, reduce: SyntaxBody - nil, // . + reduce(37), // "|", reduce: SyntaxBody + nil, // "." nil, // char_lit - nil, // - - nil, // ~ - nil, // ( - nil, // ) - nil, // [ - nil, // ] - nil, // { - nil, // } - shift(90), // g_sdt_lit - shift(41), // prodId - shift(42), // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S39 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω - nil, // tokId - nil, // : - reduce(37), // ;, reduce: SyntaxBody + reduce(38), // tokId, reduce: Symbols + nil, // ":" + reduce(38), // ";", reduce: Symbols nil, // regDefId nil, // ignoredTokId - reduce(37), // |, reduce: SyntaxBody - nil, // . + reduce(38), // "|", reduce: Symbols + nil, // "." nil, // char_lit - nil, // - - nil, // ~ - nil, // ( - nil, // ) - nil, // [ - nil, // ] - nil, // { - nil, // } - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + reduce(38), // g_sdt_lit, reduce: Symbols + reduce(38), // prodId, reduce: Symbols + reduce(38), // string_lit, reduce: Symbols + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S40 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω reduce(41), // tokId, reduce: Symbol - nil, // : - reduce(41), // ;, reduce: Symbol + nil, // ":" + reduce(41), // ";", reduce: Symbol nil, // regDefId nil, // ignoredTokId - reduce(41), // |, reduce: Symbol - nil, // . + reduce(41), // "|", reduce: Symbol + nil, // "." nil, // char_lit - nil, // - - nil, // ~ - nil, // ( - nil, // ) - nil, // [ - nil, // ] - nil, // { - nil, // } + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" reduce(41), // g_sdt_lit, reduce: Symbol reduce(41), // prodId, reduce: Symbol reduce(41), // string_lit, reduce: Symbol - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S41 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω reduce(40), // tokId, reduce: Symbol - nil, // : - reduce(40), // ;, reduce: Symbol + nil, // ":" + reduce(40), // ";", reduce: Symbol nil, // regDefId nil, // ignoredTokId - reduce(40), // |, reduce: Symbol - nil, // . + reduce(40), // "|", reduce: Symbol + nil, // "." nil, // char_lit - nil, // - - nil, // ~ - nil, // ( - nil, // ) - nil, // [ - nil, // ] - nil, // { - nil, // } + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" reduce(40), // g_sdt_lit, reduce: Symbol reduce(40), // prodId, reduce: Symbol reduce(40), // string_lit, reduce: Symbol - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S42 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω reduce(42), // tokId, reduce: Symbol - nil, // : - reduce(42), // ;, reduce: Symbol + nil, // ":" + reduce(42), // ";", reduce: Symbol nil, // regDefId nil, // ignoredTokId - reduce(42), // |, reduce: Symbol - nil, // . + reduce(42), // "|", reduce: Symbol + nil, // "." nil, // char_lit - nil, // - - nil, // ~ - nil, // ( - nil, // ) - nil, // [ - nil, // ] - nil, // { - nil, // } + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" reduce(42), // g_sdt_lit, reduce: Symbol reduce(42), // prodId, reduce: Symbol reduce(42), // string_lit, reduce: Symbol - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S43 - canRecover: true, + canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω reduce(43), // tokId, reduce: ErrorSymbol - nil, // : - reduce(43), // ;, reduce: ErrorSymbol + nil, // ":" + reduce(43), // ";", reduce: ErrorSymbol nil, // regDefId nil, // ignoredTokId - reduce(43), // |, reduce: ErrorSymbol - nil, // . + reduce(43), // "|", reduce: ErrorSymbol + nil, // "." nil, // char_lit - nil, // - - nil, // ~ - nil, // ( - nil, // ) - nil, // [ - nil, // ] - nil, // { - nil, // } + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" reduce(43), // g_sdt_lit, reduce: ErrorSymbol reduce(43), // prodId, reduce: ErrorSymbol reduce(43), // string_lit, reduce: ErrorSymbol - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S44 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω reduce(44), // tokId, reduce: ErrorSymbol - nil, // : - reduce(44), // ;, reduce: ErrorSymbol + nil, // ":" + reduce(44), // ";", reduce: ErrorSymbol nil, // regDefId nil, // ignoredTokId - reduce(44), // |, reduce: ErrorSymbol - nil, // . + reduce(44), // "|", reduce: ErrorSymbol + nil, // "." nil, // char_lit - nil, // - - nil, // ~ - nil, // ( - nil, // ) - nil, // [ - nil, // ] - nil, // { - nil, // } + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" reduce(44), // g_sdt_lit, reduce: ErrorSymbol reduce(44), // prodId, reduce: ErrorSymbol reduce(44), // string_lit, reduce: ErrorSymbol - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S45 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - reduce(45), // ;, reduce: EpsilonSymbol + nil, // ":" + reduce(45), // ";", reduce: EpsilonSymbol nil, // regDefId nil, // ignoredTokId - reduce(45), // |, reduce: EpsilonSymbol - nil, // . + reduce(45), // "|", reduce: EpsilonSymbol + nil, // "." nil, // char_lit - nil, // - - nil, // ~ - nil, // ( - nil, // ) - nil, // [ - nil, // ] - nil, // { - nil, // } + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S46 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - reduce(46), // ;, reduce: EpsilonSymbol + nil, // ":" + reduce(46), // ";", reduce: EpsilonSymbol nil, // regDefId nil, // ignoredTokId - reduce(46), // |, reduce: EpsilonSymbol - nil, // . + reduce(46), // "|", reduce: EpsilonSymbol + nil, // "." nil, // char_lit - nil, // - - nil, // ~ - nil, // ( - nil, // ) - nil, // [ - nil, // ] - nil, // { - nil, // } + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S47 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά reduce(7), // Ω, reduce: LexProduction reduce(7), // tokId, reduce: LexProduction - nil, // : - nil, // ; + nil, // ":" + nil, // ";" reduce(7), // regDefId, reduce: LexProduction reduce(7), // ignoredTokId, reduce: LexProduction - nil, // | - nil, // . + nil, // "|" + nil, // "." nil, // char_lit - nil, // - - nil, // ~ - nil, // ( - nil, // ) - nil, // [ - nil, // ] - nil, // { - nil, // } + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" reduce(7), // g_sdt_lit, reduce: LexProduction reduce(7), // prodId, reduce: LexProduction nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S48 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" shift(25), // regDefId nil, // ignoredTokId - nil, // | - shift(26), // . + nil, // "|" + shift(26), // "." shift(27), // char_lit - nil, // - - shift(28), // ~ - shift(29), // ( - nil, // ) - shift(30), // [ - nil, // ] - shift(31), // { - nil, // } + nil, // "-" + shift(28), // "~" + shift(29), // "(" + nil, // ")" + shift(30), // "[" + nil, // "]" + shift(31), // "{" + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S49 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - reduce(13), // ;, reduce: LexAlt + nil, // ":" + reduce(13), // ";", reduce: LexAlt reduce(13), // regDefId, reduce: LexAlt nil, // ignoredTokId - reduce(13), // |, reduce: LexAlt - reduce(13), // ., reduce: LexAlt + reduce(13), // "|", reduce: LexAlt + reduce(13), // ".", reduce: LexAlt reduce(13), // char_lit, reduce: LexAlt - nil, // - - reduce(13), // ~, reduce: LexAlt - reduce(13), // (, reduce: LexAlt - nil, // ) - reduce(13), // [, reduce: LexAlt - nil, // ] - reduce(13), // {, reduce: LexAlt - nil, // } + nil, // "-" + reduce(13), // "~", reduce: LexAlt + reduce(13), // "(", reduce: LexAlt + nil, // ")" + reduce(13), // "[", reduce: LexAlt + nil, // "]" + reduce(13), // "{", reduce: LexAlt + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S50 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" nil, // regDefId nil, // ignoredTokId - nil, // | - nil, // . + nil, // "|" + nil, // "." shift(92), // char_lit - nil, // - - nil, // ~ - nil, // ( - nil, // ) - nil, // [ - nil, // ] - nil, // { - nil, // } + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S51 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - reduce(17), // ;, reduce: LexTerm + nil, // ":" + reduce(17), // ";", reduce: LexTerm reduce(17), // regDefId, reduce: LexTerm nil, // ignoredTokId - reduce(17), // |, reduce: LexTerm - reduce(17), // ., reduce: LexTerm + reduce(17), // "|", reduce: LexTerm + reduce(17), // ".", reduce: LexTerm reduce(17), // char_lit, reduce: LexTerm - nil, // - - reduce(17), // ~, reduce: LexTerm - reduce(17), // (, reduce: LexTerm - nil, // ) - reduce(17), // [, reduce: LexTerm - nil, // ] - reduce(17), // {, reduce: LexTerm - nil, // } + nil, // "-" + reduce(17), // "~", reduce: LexTerm + reduce(17), // "(", reduce: LexTerm + nil, // ")" + reduce(17), // "[", reduce: LexTerm + nil, // "]" + reduce(17), // "{", reduce: LexTerm + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S52 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" nil, // regDefId nil, // ignoredTokId - nil, // | - nil, // . + nil, // "|" + nil, // "." shift(93), // char_lit - nil, // - - nil, // ~ - nil, // ( - nil, // ) - nil, // [ - nil, // ] - nil, // { - nil, // } + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S53 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" nil, // regDefId nil, // ignoredTokId - shift(94), // | - nil, // . + shift(94), // "|" + nil, // "." nil, // char_lit - nil, // - - nil, // ~ - nil, // ( - shift(95), // ) - nil, // [ - nil, // ] - nil, // { - nil, // } + nil, // "-" + nil, // "~" + nil, // "(" + shift(95), // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S54 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" shift(56), // regDefId nil, // ignoredTokId - reduce(10), // |, reduce: LexPattern - shift(57), // . + reduce(10), // "|", reduce: LexPattern + shift(57), // "." shift(58), // char_lit - nil, // - - shift(59), // ~ - shift(60), // ( - reduce(10), // ), reduce: LexPattern - shift(61), // [ - nil, // ] - shift(62), // { - nil, // } + nil, // "-" + shift(59), // "~" + shift(60), // "(" + reduce(10), // ")", reduce: LexPattern + shift(61), // "[" + nil, // "]" + shift(62), // "{" + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S55 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" reduce(12), // regDefId, reduce: LexAlt nil, // ignoredTokId - reduce(12), // |, reduce: LexAlt - reduce(12), // ., reduce: LexAlt + reduce(12), // "|", reduce: LexAlt + reduce(12), // ".", reduce: LexAlt reduce(12), // char_lit, reduce: LexAlt - nil, // - - reduce(12), // ~, reduce: LexAlt - reduce(12), // (, reduce: LexAlt - reduce(12), // ), reduce: LexAlt - reduce(12), // [, reduce: LexAlt - nil, // ] - reduce(12), // {, reduce: LexAlt - nil, // } + nil, // "-" + reduce(12), // "~", reduce: LexAlt + reduce(12), // "(", reduce: LexAlt + reduce(12), // ")", reduce: LexAlt + reduce(12), // "[", reduce: LexAlt + nil, // "]" + reduce(12), // "{", reduce: LexAlt + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S56 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" reduce(19), // regDefId, reduce: LexTerm nil, // ignoredTokId - reduce(19), // |, reduce: LexTerm - reduce(19), // ., reduce: LexTerm + reduce(19), // "|", reduce: LexTerm + reduce(19), // ".", reduce: LexTerm reduce(19), // char_lit, reduce: LexTerm - nil, // - - reduce(19), // ~, reduce: LexTerm - reduce(19), // (, reduce: LexTerm - reduce(19), // ), reduce: LexTerm - reduce(19), // [, reduce: LexTerm - nil, // ] - reduce(19), // {, reduce: LexTerm - nil, // } + nil, // "-" + reduce(19), // "~", reduce: LexTerm + reduce(19), // "(", reduce: LexTerm + reduce(19), // ")", reduce: LexTerm + reduce(19), // "[", reduce: LexTerm + nil, // "]" + reduce(19), // "{", reduce: LexTerm + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S57 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" reduce(14), // regDefId, reduce: LexTerm nil, // ignoredTokId - reduce(14), // |, reduce: LexTerm - reduce(14), // ., reduce: LexTerm + reduce(14), // "|", reduce: LexTerm + reduce(14), // ".", reduce: LexTerm reduce(14), // char_lit, reduce: LexTerm - nil, // - - reduce(14), // ~, reduce: LexTerm - reduce(14), // (, reduce: LexTerm - reduce(14), // ), reduce: LexTerm - reduce(14), // [, reduce: LexTerm - nil, // ] - reduce(14), // {, reduce: LexTerm - nil, // } + nil, // "-" + reduce(14), // "~", reduce: LexTerm + reduce(14), // "(", reduce: LexTerm + reduce(14), // ")", reduce: LexTerm + reduce(14), // "[", reduce: LexTerm + nil, // "]" + reduce(14), // "{", reduce: LexTerm + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S58 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" reduce(15), // regDefId, reduce: LexTerm nil, // ignoredTokId - reduce(15), // |, reduce: LexTerm - reduce(15), // ., reduce: LexTerm + reduce(15), // "|", reduce: LexTerm + reduce(15), // ".", reduce: LexTerm reduce(15), // char_lit, reduce: LexTerm - shift(97), // - - reduce(15), // ~, reduce: LexTerm - reduce(15), // (, reduce: LexTerm - reduce(15), // ), reduce: LexTerm - reduce(15), // [, reduce: LexTerm - nil, // ] - reduce(15), // {, reduce: LexTerm - nil, // } + shift(97), // "-" + reduce(15), // "~", reduce: LexTerm + reduce(15), // "(", reduce: LexTerm + reduce(15), // ")", reduce: LexTerm + reduce(15), // "[", reduce: LexTerm + nil, // "]" + reduce(15), // "{", reduce: LexTerm + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S59 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" nil, // regDefId nil, // ignoredTokId - nil, // | - nil, // . + nil, // "|" + nil, // "." shift(98), // char_lit - nil, // - - nil, // ~ - shift(99), // ( - nil, // ) - nil, // [ - nil, // ] - nil, // { - nil, // } + nil, // "-" + nil, // "~" + shift(99), // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S60 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" shift(56), // regDefId nil, // ignoredTokId - nil, // | - shift(57), // . + nil, // "|" + shift(57), // "." shift(58), // char_lit - nil, // - - shift(59), // ~ - shift(60), // ( - nil, // ) - shift(61), // [ - nil, // ] - shift(62), // { - nil, // } + nil, // "-" + shift(59), // "~" + shift(60), // "(" + nil, // ")" + shift(61), // "[" + nil, // "]" + shift(62), // "{" + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S61 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" shift(66), // regDefId nil, // ignoredTokId - nil, // | - shift(67), // . + nil, // "|" + shift(67), // "." shift(68), // char_lit - nil, // - - shift(69), // ~ - shift(70), // ( - nil, // ) - shift(71), // [ - nil, // ] - shift(72), // { - nil, // } + nil, // "-" + shift(69), // "~" + shift(70), // "(" + nil, // ")" + shift(71), // "[" + nil, // "]" + shift(72), // "{" + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S62 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" shift(76), // regDefId nil, // ignoredTokId - nil, // | - shift(77), // . + nil, // "|" + shift(77), // "." shift(78), // char_lit - nil, // - - shift(79), // ~ - shift(80), // ( - nil, // ) - shift(81), // [ - nil, // ] - shift(82), // { - nil, // } + nil, // "-" + shift(79), // "~" + shift(80), // "(" + nil, // ")" + shift(81), // "[" + nil, // "]" + shift(82), // "{" + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S63 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" nil, // regDefId nil, // ignoredTokId - shift(103), // | - nil, // . + shift(103), // "|" + nil, // "." nil, // char_lit - nil, // - - nil, // ~ - nil, // ( - nil, // ) - nil, // [ - shift(104), // ] - nil, // { - nil, // } + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + shift(104), // "]" + nil, // "{" + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S64 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" shift(66), // regDefId nil, // ignoredTokId - reduce(10), // |, reduce: LexPattern - shift(67), // . + reduce(10), // "|", reduce: LexPattern + shift(67), // "." shift(68), // char_lit - nil, // - - shift(69), // ~ - shift(70), // ( - nil, // ) - shift(71), // [ - reduce(10), // ], reduce: LexPattern - shift(72), // { - nil, // } + nil, // "-" + shift(69), // "~" + shift(70), // "(" + nil, // ")" + shift(71), // "[" + reduce(10), // "]", reduce: LexPattern + shift(72), // "{" + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S65 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" reduce(12), // regDefId, reduce: LexAlt nil, // ignoredTokId - reduce(12), // |, reduce: LexAlt - reduce(12), // ., reduce: LexAlt + reduce(12), // "|", reduce: LexAlt + reduce(12), // ".", reduce: LexAlt reduce(12), // char_lit, reduce: LexAlt - nil, // - - reduce(12), // ~, reduce: LexAlt - reduce(12), // (, reduce: LexAlt - nil, // ) - reduce(12), // [, reduce: LexAlt - reduce(12), // ], reduce: LexAlt - reduce(12), // {, reduce: LexAlt - nil, // } + nil, // "-" + reduce(12), // "~", reduce: LexAlt + reduce(12), // "(", reduce: LexAlt + nil, // ")" + reduce(12), // "[", reduce: LexAlt + reduce(12), // "]", reduce: LexAlt + reduce(12), // "{", reduce: LexAlt + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S66 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" reduce(19), // regDefId, reduce: LexTerm nil, // ignoredTokId - reduce(19), // |, reduce: LexTerm - reduce(19), // ., reduce: LexTerm + reduce(19), // "|", reduce: LexTerm + reduce(19), // ".", reduce: LexTerm reduce(19), // char_lit, reduce: LexTerm - nil, // - - reduce(19), // ~, reduce: LexTerm - reduce(19), // (, reduce: LexTerm - nil, // ) - reduce(19), // [, reduce: LexTerm - reduce(19), // ], reduce: LexTerm - reduce(19), // {, reduce: LexTerm - nil, // } + nil, // "-" + reduce(19), // "~", reduce: LexTerm + reduce(19), // "(", reduce: LexTerm + nil, // ")" + reduce(19), // "[", reduce: LexTerm + reduce(19), // "]", reduce: LexTerm + reduce(19), // "{", reduce: LexTerm + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S67 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" reduce(14), // regDefId, reduce: LexTerm nil, // ignoredTokId - reduce(14), // |, reduce: LexTerm - reduce(14), // ., reduce: LexTerm + reduce(14), // "|", reduce: LexTerm + reduce(14), // ".", reduce: LexTerm reduce(14), // char_lit, reduce: LexTerm - nil, // - - reduce(14), // ~, reduce: LexTerm - reduce(14), // (, reduce: LexTerm - nil, // ) - reduce(14), // [, reduce: LexTerm - reduce(14), // ], reduce: LexTerm - reduce(14), // {, reduce: LexTerm - nil, // } + nil, // "-" + reduce(14), // "~", reduce: LexTerm + reduce(14), // "(", reduce: LexTerm + nil, // ")" + reduce(14), // "[", reduce: LexTerm + reduce(14), // "]", reduce: LexTerm + reduce(14), // "{", reduce: LexTerm + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S68 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" reduce(15), // regDefId, reduce: LexTerm nil, // ignoredTokId - reduce(15), // |, reduce: LexTerm - reduce(15), // ., reduce: LexTerm + reduce(15), // "|", reduce: LexTerm + reduce(15), // ".", reduce: LexTerm reduce(15), // char_lit, reduce: LexTerm - shift(106), // - - reduce(15), // ~, reduce: LexTerm - reduce(15), // (, reduce: LexTerm - nil, // ) - reduce(15), // [, reduce: LexTerm - reduce(15), // ], reduce: LexTerm - reduce(15), // {, reduce: LexTerm - nil, // } + shift(106), // "-" + reduce(15), // "~", reduce: LexTerm + reduce(15), // "(", reduce: LexTerm + nil, // ")" + reduce(15), // "[", reduce: LexTerm + reduce(15), // "]", reduce: LexTerm + reduce(15), // "{", reduce: LexTerm + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S69 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" nil, // regDefId nil, // ignoredTokId - nil, // | - nil, // . + nil, // "|" + nil, // "." shift(107), // char_lit - nil, // - - nil, // ~ - shift(108), // ( - nil, // ) - nil, // [ - nil, // ] - nil, // { - nil, // } + nil, // "-" + nil, // "~" + shift(108), // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S70 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" shift(56), // regDefId nil, // ignoredTokId - nil, // | - shift(57), // . + nil, // "|" + shift(57), // "." shift(58), // char_lit - nil, // - - shift(59), // ~ - shift(60), // ( - nil, // ) - shift(61), // [ - nil, // ] - shift(62), // { - nil, // } + nil, // "-" + shift(59), // "~" + shift(60), // "(" + nil, // ")" + shift(61), // "[" + nil, // "]" + shift(62), // "{" + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S71 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" shift(66), // regDefId nil, // ignoredTokId - nil, // | - shift(67), // . + nil, // "|" + shift(67), // "." shift(68), // char_lit - nil, // - - shift(69), // ~ - shift(70), // ( - nil, // ) - shift(71), // [ - nil, // ] - shift(72), // { - nil, // } + nil, // "-" + shift(69), // "~" + shift(70), // "(" + nil, // ")" + shift(71), // "[" + nil, // "]" + shift(72), // "{" + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S72 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" shift(76), // regDefId nil, // ignoredTokId - nil, // | - shift(77), // . + nil, // "|" + shift(77), // "." shift(78), // char_lit - nil, // - - shift(79), // ~ - shift(80), // ( - nil, // ) - shift(81), // [ - nil, // ] - shift(82), // { - nil, // } + nil, // "-" + shift(79), // "~" + shift(80), // "(" + nil, // ")" + shift(81), // "[" + nil, // "]" + shift(82), // "{" + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S73 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" nil, // regDefId nil, // ignoredTokId - shift(112), // | - nil, // . + shift(112), // "|" + nil, // "." nil, // char_lit - nil, // - - nil, // ~ - nil, // ( - nil, // ) - nil, // [ - nil, // ] - nil, // { - shift(113), // } + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + shift(113), // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S74 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" shift(76), // regDefId nil, // ignoredTokId - reduce(10), // |, reduce: LexPattern - shift(77), // . + reduce(10), // "|", reduce: LexPattern + shift(77), // "." shift(78), // char_lit - nil, // - - shift(79), // ~ - shift(80), // ( - nil, // ) - shift(81), // [ - nil, // ] - shift(82), // { - reduce(10), // }, reduce: LexPattern + nil, // "-" + shift(79), // "~" + shift(80), // "(" + nil, // ")" + shift(81), // "[" + nil, // "]" + shift(82), // "{" + reduce(10), // "}", reduce: LexPattern nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S75 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" reduce(12), // regDefId, reduce: LexAlt nil, // ignoredTokId - reduce(12), // |, reduce: LexAlt - reduce(12), // ., reduce: LexAlt + reduce(12), // "|", reduce: LexAlt + reduce(12), // ".", reduce: LexAlt reduce(12), // char_lit, reduce: LexAlt - nil, // - - reduce(12), // ~, reduce: LexAlt - reduce(12), // (, reduce: LexAlt - nil, // ) - reduce(12), // [, reduce: LexAlt - nil, // ] - reduce(12), // {, reduce: LexAlt - reduce(12), // }, reduce: LexAlt + nil, // "-" + reduce(12), // "~", reduce: LexAlt + reduce(12), // "(", reduce: LexAlt + nil, // ")" + reduce(12), // "[", reduce: LexAlt + nil, // "]" + reduce(12), // "{", reduce: LexAlt + reduce(12), // "}", reduce: LexAlt nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S76 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" reduce(19), // regDefId, reduce: LexTerm nil, // ignoredTokId - reduce(19), // |, reduce: LexTerm - reduce(19), // ., reduce: LexTerm + reduce(19), // "|", reduce: LexTerm + reduce(19), // ".", reduce: LexTerm reduce(19), // char_lit, reduce: LexTerm - nil, // - - reduce(19), // ~, reduce: LexTerm - reduce(19), // (, reduce: LexTerm - nil, // ) - reduce(19), // [, reduce: LexTerm - nil, // ] - reduce(19), // {, reduce: LexTerm - reduce(19), // }, reduce: LexTerm + nil, // "-" + reduce(19), // "~", reduce: LexTerm + reduce(19), // "(", reduce: LexTerm + nil, // ")" + reduce(19), // "[", reduce: LexTerm + nil, // "]" + reduce(19), // "{", reduce: LexTerm + reduce(19), // "}", reduce: LexTerm nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S77 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" reduce(14), // regDefId, reduce: LexTerm nil, // ignoredTokId - reduce(14), // |, reduce: LexTerm - reduce(14), // ., reduce: LexTerm + reduce(14), // "|", reduce: LexTerm + reduce(14), // ".", reduce: LexTerm reduce(14), // char_lit, reduce: LexTerm - nil, // - - reduce(14), // ~, reduce: LexTerm - reduce(14), // (, reduce: LexTerm - nil, // ) - reduce(14), // [, reduce: LexTerm - nil, // ] - reduce(14), // {, reduce: LexTerm - reduce(14), // }, reduce: LexTerm + nil, // "-" + reduce(14), // "~", reduce: LexTerm + reduce(14), // "(", reduce: LexTerm + nil, // ")" + reduce(14), // "[", reduce: LexTerm + nil, // "]" + reduce(14), // "{", reduce: LexTerm + reduce(14), // "}", reduce: LexTerm nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S78 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" reduce(15), // regDefId, reduce: LexTerm nil, // ignoredTokId - reduce(15), // |, reduce: LexTerm - reduce(15), // ., reduce: LexTerm + reduce(15), // "|", reduce: LexTerm + reduce(15), // ".", reduce: LexTerm reduce(15), // char_lit, reduce: LexTerm - shift(115), // - - reduce(15), // ~, reduce: LexTerm - reduce(15), // (, reduce: LexTerm - nil, // ) - reduce(15), // [, reduce: LexTerm - nil, // ] - reduce(15), // {, reduce: LexTerm - reduce(15), // }, reduce: LexTerm + shift(115), // "-" + reduce(15), // "~", reduce: LexTerm + reduce(15), // "(", reduce: LexTerm + nil, // ")" + reduce(15), // "[", reduce: LexTerm + nil, // "]" + reduce(15), // "{", reduce: LexTerm + reduce(15), // "}", reduce: LexTerm nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S79 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" nil, // regDefId nil, // ignoredTokId - nil, // | - nil, // . + nil, // "|" + nil, // "." shift(116), // char_lit - nil, // - - nil, // ~ - shift(117), // ( - nil, // ) - nil, // [ - nil, // ] - nil, // { - nil, // } + nil, // "-" + nil, // "~" + shift(117), // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S80 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" shift(56), // regDefId nil, // ignoredTokId - nil, // | - shift(57), // . + nil, // "|" + shift(57), // "." shift(58), // char_lit - nil, // - - shift(59), // ~ - shift(60), // ( - nil, // ) - shift(61), // [ - nil, // ] - shift(62), // { - nil, // } + nil, // "-" + shift(59), // "~" + shift(60), // "(" + nil, // ")" + shift(61), // "[" + nil, // "]" + shift(62), // "{" + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S81 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" shift(66), // regDefId nil, // ignoredTokId - nil, // | - shift(67), // . + nil, // "|" + shift(67), // "." shift(68), // char_lit - nil, // - - shift(69), // ~ - shift(70), // ( - nil, // ) - shift(71), // [ - nil, // ] - shift(72), // { - nil, // } + nil, // "-" + shift(69), // "~" + shift(70), // "(" + nil, // ")" + shift(71), // "[" + nil, // "]" + shift(72), // "{" + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S82 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" shift(76), // regDefId nil, // ignoredTokId - nil, // | - shift(77), // . + nil, // "|" + shift(77), // "." shift(78), // char_lit - nil, // - - shift(79), // ~ - shift(80), // ( - nil, // ) - shift(81), // [ - nil, // ] - shift(82), // { - nil, // } + nil, // "-" + shift(79), // "~" + shift(80), // "(" + nil, // ")" + shift(81), // "[" + nil, // "]" + shift(82), // "{" + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S83 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά reduce(8), // Ω, reduce: LexProduction reduce(8), // tokId, reduce: LexProduction - nil, // : - nil, // ; + nil, // ":" + nil, // ";" reduce(8), // regDefId, reduce: LexProduction reduce(8), // ignoredTokId, reduce: LexProduction - nil, // | - nil, // . + nil, // "|" + nil, // "." nil, // char_lit - nil, // - - nil, // ~ - nil, // ( - nil, // ) - nil, // [ - nil, // ] - nil, // { - nil, // } + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" reduce(8), // g_sdt_lit, reduce: LexProduction reduce(8), // prodId, reduce: LexProduction nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S84 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά reduce(9), // Ω, reduce: LexProduction reduce(9), // tokId, reduce: LexProduction - nil, // : - nil, // ; + nil, // ":" + nil, // ";" reduce(9), // regDefId, reduce: LexProduction reduce(9), // ignoredTokId, reduce: LexProduction - nil, // | - nil, // . + nil, // "|" + nil, // "." nil, // char_lit - nil, // - - nil, // ~ - nil, // ( - nil, // ) - nil, // [ - nil, // ] - nil, // { - nil, // } + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" reduce(9), // g_sdt_lit, reduce: LexProduction reduce(9), // prodId, reduce: LexProduction nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S85 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά reduce(28), // Ω, reduce: SyntaxProduction nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" nil, // regDefId nil, // ignoredTokId - nil, // | - nil, // . + nil, // "|" + nil, // "." nil, // char_lit - nil, // - - nil, // ~ - nil, // ( - nil, // ) - nil, // [ - nil, // ] - nil, // { - nil, // } + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" nil, // g_sdt_lit reduce(28), // prodId, reduce: SyntaxProduction nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S86 - canRecover: true, + canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω shift(40), // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" nil, // regDefId nil, // ignoredTokId - nil, // | - nil, // . + nil, // "|" + nil, // "." nil, // char_lit - nil, // - - nil, // ~ - nil, // ( - nil, // ) - nil, // [ - nil, // ] - nil, // { - nil, // } + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" nil, // g_sdt_lit shift(41), // prodId shift(42), // string_lit - shift(43), // error - shift(44), // λ - shift(45), // empty - shift(46), // ε + shift(43), // "error" + shift(44), // "λ" + shift(45), // "empty" + shift(46), // "ε" }, }, actionRow{ // S87 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω reduce(39), // tokId, reduce: Symbols - nil, // : - reduce(39), // ;, reduce: Symbols + nil, // ":" + reduce(39), // ";", reduce: Symbols nil, // regDefId nil, // ignoredTokId - reduce(39), // |, reduce: Symbols - nil, // . + reduce(39), // "|", reduce: Symbols + nil, // "." nil, // char_lit - nil, // - - nil, // ~ - nil, // ( - nil, // ) - nil, // [ - nil, // ] - nil, // { - nil, // } + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" reduce(39), // g_sdt_lit, reduce: Symbols reduce(39), // prodId, reduce: Symbols reduce(39), // string_lit, reduce: Symbols - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S88 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - reduce(32), // ;, reduce: SyntaxBody + nil, // ":" + reduce(32), // ";", reduce: SyntaxBody nil, // regDefId nil, // ignoredTokId - reduce(32), // |, reduce: SyntaxBody - nil, // . + reduce(32), // "|", reduce: SyntaxBody + nil, // "." nil, // char_lit - nil, // - - nil, // ~ - nil, // ( - nil, // ) - nil, // [ - nil, // ] - nil, // { - nil, // } + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S89 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω shift(40), // tokId - nil, // : - reduce(34), // ;, reduce: SyntaxBody + nil, // ":" + reduce(34), // ";", reduce: SyntaxBody nil, // regDefId nil, // ignoredTokId - reduce(34), // |, reduce: SyntaxBody - nil, // . + reduce(34), // "|", reduce: SyntaxBody + nil, // "." nil, // char_lit - nil, // - - nil, // ~ - nil, // ( - nil, // ) - nil, // [ - nil, // ] - nil, // { - nil, // } + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" shift(122), // g_sdt_lit shift(41), // prodId shift(42), // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S90 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - reduce(36), // ;, reduce: SyntaxBody + nil, // ":" + reduce(36), // ";", reduce: SyntaxBody nil, // regDefId nil, // ignoredTokId - reduce(36), // |, reduce: SyntaxBody - nil, // . + reduce(36), // "|", reduce: SyntaxBody + nil, // "." nil, // char_lit - nil, // - - nil, // ~ - nil, // ( - nil, // ) - nil, // [ - nil, // ] - nil, // { - nil, // } + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S91 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - reduce(11), // ;, reduce: LexPattern + nil, // ":" + reduce(11), // ";", reduce: LexPattern shift(25), // regDefId nil, // ignoredTokId - reduce(11), // |, reduce: LexPattern - shift(26), // . + reduce(11), // "|", reduce: LexPattern + shift(26), // "." shift(27), // char_lit - nil, // - - shift(28), // ~ - shift(29), // ( - nil, // ) - shift(30), // [ - nil, // ] - shift(31), // { - nil, // } + nil, // "-" + shift(28), // "~" + shift(29), // "(" + nil, // ")" + shift(30), // "[" + nil, // "]" + shift(31), // "{" + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S92 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - reduce(16), // ;, reduce: LexTerm + nil, // ":" + reduce(16), // ";", reduce: LexTerm reduce(16), // regDefId, reduce: LexTerm nil, // ignoredTokId - reduce(16), // |, reduce: LexTerm - reduce(16), // ., reduce: LexTerm + reduce(16), // "|", reduce: LexTerm + reduce(16), // ".", reduce: LexTerm reduce(16), // char_lit, reduce: LexTerm - nil, // - - reduce(16), // ~, reduce: LexTerm - reduce(16), // (, reduce: LexTerm - nil, // ) - reduce(16), // [, reduce: LexTerm - nil, // ] - reduce(16), // {, reduce: LexTerm - nil, // } + nil, // "-" + reduce(16), // "~", reduce: LexTerm + reduce(16), // "(", reduce: LexTerm + nil, // ")" + reduce(16), // "[", reduce: LexTerm + nil, // "]" + reduce(16), // "{", reduce: LexTerm + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S93 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" nil, // regDefId nil, // ignoredTokId - nil, // | - nil, // . + nil, // "|" + nil, // "." nil, // char_lit - shift(123), // - - nil, // ~ - nil, // ( - nil, // ) - nil, // [ - nil, // ] - nil, // { - nil, // } + shift(123), // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S94 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" shift(56), // regDefId nil, // ignoredTokId - nil, // | - shift(57), // . + nil, // "|" + shift(57), // "." shift(58), // char_lit - nil, // - - shift(59), // ~ - shift(60), // ( - nil, // ) - shift(61), // [ - nil, // ] - shift(62), // { - nil, // } + nil, // "-" + shift(59), // "~" + shift(60), // "(" + nil, // ")" + shift(61), // "[" + nil, // "]" + shift(62), // "{" + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S95 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - reduce(22), // ;, reduce: LexTerm + nil, // ":" + reduce(22), // ";", reduce: LexTerm reduce(22), // regDefId, reduce: LexTerm nil, // ignoredTokId - reduce(22), // |, reduce: LexTerm - reduce(22), // ., reduce: LexTerm + reduce(22), // "|", reduce: LexTerm + reduce(22), // ".", reduce: LexTerm reduce(22), // char_lit, reduce: LexTerm - nil, // - - reduce(22), // ~, reduce: LexTerm - reduce(22), // (, reduce: LexTerm - nil, // ) - reduce(22), // [, reduce: LexTerm - nil, // ] - reduce(22), // {, reduce: LexTerm - nil, // } + nil, // "-" + reduce(22), // "~", reduce: LexTerm + reduce(22), // "(", reduce: LexTerm + nil, // ")" + reduce(22), // "[", reduce: LexTerm + nil, // "]" + reduce(22), // "{", reduce: LexTerm + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S96 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" reduce(13), // regDefId, reduce: LexAlt nil, // ignoredTokId - reduce(13), // |, reduce: LexAlt - reduce(13), // ., reduce: LexAlt + reduce(13), // "|", reduce: LexAlt + reduce(13), // ".", reduce: LexAlt reduce(13), // char_lit, reduce: LexAlt - nil, // - - reduce(13), // ~, reduce: LexAlt - reduce(13), // (, reduce: LexAlt - reduce(13), // ), reduce: LexAlt - reduce(13), // [, reduce: LexAlt - nil, // ] - reduce(13), // {, reduce: LexAlt - nil, // } + nil, // "-" + reduce(13), // "~", reduce: LexAlt + reduce(13), // "(", reduce: LexAlt + reduce(13), // ")", reduce: LexAlt + reduce(13), // "[", reduce: LexAlt + nil, // "]" + reduce(13), // "{", reduce: LexAlt + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S97 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" nil, // regDefId nil, // ignoredTokId - nil, // | - nil, // . + nil, // "|" + nil, // "." shift(125), // char_lit - nil, // - - nil, // ~ - nil, // ( - nil, // ) - nil, // [ - nil, // ] - nil, // { - nil, // } + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S98 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" reduce(17), // regDefId, reduce: LexTerm nil, // ignoredTokId - reduce(17), // |, reduce: LexTerm - reduce(17), // ., reduce: LexTerm + reduce(17), // "|", reduce: LexTerm + reduce(17), // ".", reduce: LexTerm reduce(17), // char_lit, reduce: LexTerm - nil, // - - reduce(17), // ~, reduce: LexTerm - reduce(17), // (, reduce: LexTerm - reduce(17), // ), reduce: LexTerm - reduce(17), // [, reduce: LexTerm - nil, // ] - reduce(17), // {, reduce: LexTerm - nil, // } + nil, // "-" + reduce(17), // "~", reduce: LexTerm + reduce(17), // "(", reduce: LexTerm + reduce(17), // ")", reduce: LexTerm + reduce(17), // "[", reduce: LexTerm + nil, // "]" + reduce(17), // "{", reduce: LexTerm + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S99 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" nil, // regDefId nil, // ignoredTokId - nil, // | - nil, // . + nil, // "|" + nil, // "." shift(126), // char_lit - nil, // - - nil, // ~ - nil, // ( - nil, // ) - nil, // [ - nil, // ] - nil, // { - nil, // } + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S100 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" nil, // regDefId nil, // ignoredTokId - shift(94), // | - nil, // . + shift(94), // "|" + nil, // "." nil, // char_lit - nil, // - - nil, // ~ - nil, // ( - shift(127), // ) - nil, // [ - nil, // ] - nil, // { - nil, // } + nil, // "-" + nil, // "~" + nil, // "(" + shift(127), // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S101 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" nil, // regDefId nil, // ignoredTokId - shift(103), // | - nil, // . + shift(103), // "|" + nil, // "." nil, // char_lit - nil, // - - nil, // ~ - nil, // ( - nil, // ) - nil, // [ - shift(128), // ] - nil, // { - nil, // } + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + shift(128), // "]" + nil, // "{" + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S102 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" nil, // regDefId nil, // ignoredTokId - shift(112), // | - nil, // . + shift(112), // "|" + nil, // "." nil, // char_lit - nil, // - - nil, // ~ - nil, // ( - nil, // ) - nil, // [ - nil, // ] - nil, // { - shift(129), // } + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + shift(129), // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S103 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" shift(66), // regDefId nil, // ignoredTokId - nil, // | - shift(67), // . + nil, // "|" + shift(67), // "." shift(68), // char_lit - nil, // - - shift(69), // ~ - shift(70), // ( - nil, // ) - shift(71), // [ - nil, // ] - shift(72), // { - nil, // } + nil, // "-" + shift(69), // "~" + shift(70), // "(" + nil, // ")" + shift(71), // "[" + nil, // "]" + shift(72), // "{" + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S104 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - reduce(20), // ;, reduce: LexTerm + nil, // ":" + reduce(20), // ";", reduce: LexTerm reduce(20), // regDefId, reduce: LexTerm nil, // ignoredTokId - reduce(20), // |, reduce: LexTerm - reduce(20), // ., reduce: LexTerm + reduce(20), // "|", reduce: LexTerm + reduce(20), // ".", reduce: LexTerm reduce(20), // char_lit, reduce: LexTerm - nil, // - - reduce(20), // ~, reduce: LexTerm - reduce(20), // (, reduce: LexTerm - nil, // ) - reduce(20), // [, reduce: LexTerm - nil, // ] - reduce(20), // {, reduce: LexTerm - nil, // } + nil, // "-" + reduce(20), // "~", reduce: LexTerm + reduce(20), // "(", reduce: LexTerm + nil, // ")" + reduce(20), // "[", reduce: LexTerm + nil, // "]" + reduce(20), // "{", reduce: LexTerm + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S105 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" reduce(13), // regDefId, reduce: LexAlt nil, // ignoredTokId - reduce(13), // |, reduce: LexAlt - reduce(13), // ., reduce: LexAlt + reduce(13), // "|", reduce: LexAlt + reduce(13), // ".", reduce: LexAlt reduce(13), // char_lit, reduce: LexAlt - nil, // - - reduce(13), // ~, reduce: LexAlt - reduce(13), // (, reduce: LexAlt - nil, // ) - reduce(13), // [, reduce: LexAlt - reduce(13), // ], reduce: LexAlt - reduce(13), // {, reduce: LexAlt - nil, // } + nil, // "-" + reduce(13), // "~", reduce: LexAlt + reduce(13), // "(", reduce: LexAlt + nil, // ")" + reduce(13), // "[", reduce: LexAlt + reduce(13), // "]", reduce: LexAlt + reduce(13), // "{", reduce: LexAlt + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S106 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" nil, // regDefId nil, // ignoredTokId - nil, // | - nil, // . + nil, // "|" + nil, // "." shift(131), // char_lit - nil, // - - nil, // ~ - nil, // ( - nil, // ) - nil, // [ - nil, // ] - nil, // { - nil, // } + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S107 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" reduce(17), // regDefId, reduce: LexTerm nil, // ignoredTokId - reduce(17), // |, reduce: LexTerm - reduce(17), // ., reduce: LexTerm + reduce(17), // "|", reduce: LexTerm + reduce(17), // ".", reduce: LexTerm reduce(17), // char_lit, reduce: LexTerm - nil, // - - reduce(17), // ~, reduce: LexTerm - reduce(17), // (, reduce: LexTerm - nil, // ) - reduce(17), // [, reduce: LexTerm - reduce(17), // ], reduce: LexTerm - reduce(17), // {, reduce: LexTerm - nil, // } + nil, // "-" + reduce(17), // "~", reduce: LexTerm + reduce(17), // "(", reduce: LexTerm + nil, // ")" + reduce(17), // "[", reduce: LexTerm + reduce(17), // "]", reduce: LexTerm + reduce(17), // "{", reduce: LexTerm + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S108 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" nil, // regDefId nil, // ignoredTokId - nil, // | - nil, // . + nil, // "|" + nil, // "." shift(132), // char_lit - nil, // - - nil, // ~ - nil, // ( - nil, // ) - nil, // [ - nil, // ] - nil, // { - nil, // } + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S109 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" nil, // regDefId nil, // ignoredTokId - shift(94), // | - nil, // . + shift(94), // "|" + nil, // "." nil, // char_lit - nil, // - - nil, // ~ - nil, // ( - shift(133), // ) - nil, // [ - nil, // ] - nil, // { - nil, // } + nil, // "-" + nil, // "~" + nil, // "(" + shift(133), // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S110 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" nil, // regDefId nil, // ignoredTokId - shift(103), // | - nil, // . + shift(103), // "|" + nil, // "." nil, // char_lit - nil, // - - nil, // ~ - nil, // ( - nil, // ) - nil, // [ - shift(134), // ] - nil, // { - nil, // } + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + shift(134), // "]" + nil, // "{" + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S111 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" nil, // regDefId nil, // ignoredTokId - shift(112), // | - nil, // . + shift(112), // "|" + nil, // "." nil, // char_lit - nil, // - - nil, // ~ - nil, // ( - nil, // ) - nil, // [ - nil, // ] - nil, // { - shift(135), // } + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + shift(135), // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S112 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" shift(76), // regDefId nil, // ignoredTokId - nil, // | - shift(77), // . + nil, // "|" + shift(77), // "." shift(78), // char_lit - nil, // - - shift(79), // ~ - shift(80), // ( - nil, // ) - shift(81), // [ - nil, // ] - shift(82), // { - nil, // } + nil, // "-" + shift(79), // "~" + shift(80), // "(" + nil, // ")" + shift(81), // "[" + nil, // "]" + shift(82), // "{" + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S113 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - reduce(21), // ;, reduce: LexTerm + nil, // ":" + reduce(21), // ";", reduce: LexTerm reduce(21), // regDefId, reduce: LexTerm nil, // ignoredTokId - reduce(21), // |, reduce: LexTerm - reduce(21), // ., reduce: LexTerm + reduce(21), // "|", reduce: LexTerm + reduce(21), // ".", reduce: LexTerm reduce(21), // char_lit, reduce: LexTerm - nil, // - - reduce(21), // ~, reduce: LexTerm - reduce(21), // (, reduce: LexTerm - nil, // ) - reduce(21), // [, reduce: LexTerm - nil, // ] - reduce(21), // {, reduce: LexTerm - nil, // } + nil, // "-" + reduce(21), // "~", reduce: LexTerm + reduce(21), // "(", reduce: LexTerm + nil, // ")" + reduce(21), // "[", reduce: LexTerm + nil, // "]" + reduce(21), // "{", reduce: LexTerm + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S114 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" reduce(13), // regDefId, reduce: LexAlt nil, // ignoredTokId - reduce(13), // |, reduce: LexAlt - reduce(13), // ., reduce: LexAlt + reduce(13), // "|", reduce: LexAlt + reduce(13), // ".", reduce: LexAlt reduce(13), // char_lit, reduce: LexAlt - nil, // - - reduce(13), // ~, reduce: LexAlt - reduce(13), // (, reduce: LexAlt - nil, // ) - reduce(13), // [, reduce: LexAlt - nil, // ] - reduce(13), // {, reduce: LexAlt - reduce(13), // }, reduce: LexAlt + nil, // "-" + reduce(13), // "~", reduce: LexAlt + reduce(13), // "(", reduce: LexAlt + nil, // ")" + reduce(13), // "[", reduce: LexAlt + nil, // "]" + reduce(13), // "{", reduce: LexAlt + reduce(13), // "}", reduce: LexAlt nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S115 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" nil, // regDefId nil, // ignoredTokId - nil, // | - nil, // . + nil, // "|" + nil, // "." shift(137), // char_lit - nil, // - - nil, // ~ - nil, // ( - nil, // ) - nil, // [ - nil, // ] - nil, // { - nil, // } + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S116 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" reduce(17), // regDefId, reduce: LexTerm nil, // ignoredTokId - reduce(17), // |, reduce: LexTerm - reduce(17), // ., reduce: LexTerm + reduce(17), // "|", reduce: LexTerm + reduce(17), // ".", reduce: LexTerm reduce(17), // char_lit, reduce: LexTerm - nil, // - - reduce(17), // ~, reduce: LexTerm - reduce(17), // (, reduce: LexTerm - nil, // ) - reduce(17), // [, reduce: LexTerm - nil, // ] - reduce(17), // {, reduce: LexTerm - reduce(17), // }, reduce: LexTerm + nil, // "-" + reduce(17), // "~", reduce: LexTerm + reduce(17), // "(", reduce: LexTerm + nil, // ")" + reduce(17), // "[", reduce: LexTerm + nil, // "]" + reduce(17), // "{", reduce: LexTerm + reduce(17), // "}", reduce: LexTerm nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S117 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" nil, // regDefId nil, // ignoredTokId - nil, // | - nil, // . + nil, // "|" + nil, // "." shift(138), // char_lit - nil, // - - nil, // ~ - nil, // ( - nil, // ) - nil, // [ - nil, // ] - nil, // { - nil, // } + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S118 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" nil, // regDefId nil, // ignoredTokId - shift(94), // | - nil, // . + shift(94), // "|" + nil, // "." nil, // char_lit - nil, // - - nil, // ~ - nil, // ( - shift(139), // ) - nil, // [ - nil, // ] - nil, // { - nil, // } + nil, // "-" + nil, // "~" + nil, // "(" + shift(139), // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S119 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" nil, // regDefId nil, // ignoredTokId - shift(103), // | - nil, // . + shift(103), // "|" + nil, // "." nil, // char_lit - nil, // - - nil, // ~ - nil, // ( - nil, // ) - nil, // [ - shift(140), // ] - nil, // { - nil, // } + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + shift(140), // "]" + nil, // "{" + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S120 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" nil, // regDefId nil, // ignoredTokId - shift(112), // | - nil, // . + shift(112), // "|" + nil, // "." nil, // char_lit - nil, // - - nil, // ~ - nil, // ( - nil, // ) - nil, // [ - nil, // ] - nil, // { - shift(141), // } + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + shift(141), // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S121 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - reduce(30), // ;, reduce: Alternatives + nil, // ":" + reduce(30), // ";", reduce: Alternatives nil, // regDefId nil, // ignoredTokId - reduce(30), // |, reduce: Alternatives - nil, // . + reduce(30), // "|", reduce: Alternatives + nil, // "." nil, // char_lit - nil, // - - nil, // ~ - nil, // ( - nil, // ) - nil, // [ - nil, // ] - nil, // { - nil, // } + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S122 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - reduce(35), // ;, reduce: SyntaxBody + nil, // ":" + reduce(35), // ";", reduce: SyntaxBody nil, // regDefId nil, // ignoredTokId - reduce(35), // |, reduce: SyntaxBody - nil, // . + reduce(35), // "|", reduce: SyntaxBody + nil, // "." nil, // char_lit - nil, // - - nil, // ~ - nil, // ( - nil, // ) - nil, // [ - nil, // ] - nil, // { - nil, // } + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S123 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" nil, // regDefId nil, // ignoredTokId - nil, // | - nil, // . + nil, // "|" + nil, // "." shift(142), // char_lit - nil, // - - nil, // ~ - nil, // ( - nil, // ) - nil, // [ - nil, // ] - nil, // { - nil, // } + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S124 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" shift(56), // regDefId nil, // ignoredTokId - reduce(11), // |, reduce: LexPattern - shift(57), // . + reduce(11), // "|", reduce: LexPattern + shift(57), // "." shift(58), // char_lit - nil, // - - shift(59), // ~ - shift(60), // ( - reduce(11), // ), reduce: LexPattern - shift(61), // [ - nil, // ] - shift(62), // { - nil, // } + nil, // "-" + shift(59), // "~" + shift(60), // "(" + reduce(11), // ")", reduce: LexPattern + shift(61), // "[" + nil, // "]" + shift(62), // "{" + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S125 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" reduce(16), // regDefId, reduce: LexTerm nil, // ignoredTokId - reduce(16), // |, reduce: LexTerm - reduce(16), // ., reduce: LexTerm + reduce(16), // "|", reduce: LexTerm + reduce(16), // ".", reduce: LexTerm reduce(16), // char_lit, reduce: LexTerm - nil, // - - reduce(16), // ~, reduce: LexTerm - reduce(16), // (, reduce: LexTerm - reduce(16), // ), reduce: LexTerm - reduce(16), // [, reduce: LexTerm - nil, // ] - reduce(16), // {, reduce: LexTerm - nil, // } + nil, // "-" + reduce(16), // "~", reduce: LexTerm + reduce(16), // "(", reduce: LexTerm + reduce(16), // ")", reduce: LexTerm + reduce(16), // "[", reduce: LexTerm + nil, // "]" + reduce(16), // "{", reduce: LexTerm + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S126 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" nil, // regDefId nil, // ignoredTokId - nil, // | - nil, // . + nil, // "|" + nil, // "." nil, // char_lit - shift(143), // - - nil, // ~ - nil, // ( - nil, // ) - nil, // [ - nil, // ] - nil, // { - nil, // } + shift(143), // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S127 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" reduce(22), // regDefId, reduce: LexTerm nil, // ignoredTokId - reduce(22), // |, reduce: LexTerm - reduce(22), // ., reduce: LexTerm + reduce(22), // "|", reduce: LexTerm + reduce(22), // ".", reduce: LexTerm reduce(22), // char_lit, reduce: LexTerm - nil, // - - reduce(22), // ~, reduce: LexTerm - reduce(22), // (, reduce: LexTerm - reduce(22), // ), reduce: LexTerm - reduce(22), // [, reduce: LexTerm - nil, // ] - reduce(22), // {, reduce: LexTerm - nil, // } + nil, // "-" + reduce(22), // "~", reduce: LexTerm + reduce(22), // "(", reduce: LexTerm + reduce(22), // ")", reduce: LexTerm + reduce(22), // "[", reduce: LexTerm + nil, // "]" + reduce(22), // "{", reduce: LexTerm + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S128 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" reduce(20), // regDefId, reduce: LexTerm nil, // ignoredTokId - reduce(20), // |, reduce: LexTerm - reduce(20), // ., reduce: LexTerm + reduce(20), // "|", reduce: LexTerm + reduce(20), // ".", reduce: LexTerm reduce(20), // char_lit, reduce: LexTerm - nil, // - - reduce(20), // ~, reduce: LexTerm - reduce(20), // (, reduce: LexTerm - reduce(20), // ), reduce: LexTerm - reduce(20), // [, reduce: LexTerm - nil, // ] - reduce(20), // {, reduce: LexTerm - nil, // } + nil, // "-" + reduce(20), // "~", reduce: LexTerm + reduce(20), // "(", reduce: LexTerm + reduce(20), // ")", reduce: LexTerm + reduce(20), // "[", reduce: LexTerm + nil, // "]" + reduce(20), // "{", reduce: LexTerm + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S129 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" reduce(21), // regDefId, reduce: LexTerm nil, // ignoredTokId - reduce(21), // |, reduce: LexTerm - reduce(21), // ., reduce: LexTerm + reduce(21), // "|", reduce: LexTerm + reduce(21), // ".", reduce: LexTerm reduce(21), // char_lit, reduce: LexTerm - nil, // - - reduce(21), // ~, reduce: LexTerm - reduce(21), // (, reduce: LexTerm - reduce(21), // ), reduce: LexTerm - reduce(21), // [, reduce: LexTerm - nil, // ] - reduce(21), // {, reduce: LexTerm - nil, // } + nil, // "-" + reduce(21), // "~", reduce: LexTerm + reduce(21), // "(", reduce: LexTerm + reduce(21), // ")", reduce: LexTerm + reduce(21), // "[", reduce: LexTerm + nil, // "]" + reduce(21), // "{", reduce: LexTerm + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S130 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" shift(66), // regDefId nil, // ignoredTokId - reduce(11), // |, reduce: LexPattern - shift(67), // . + reduce(11), // "|", reduce: LexPattern + shift(67), // "." shift(68), // char_lit - nil, // - - shift(69), // ~ - shift(70), // ( - nil, // ) - shift(71), // [ - reduce(11), // ], reduce: LexPattern - shift(72), // { - nil, // } + nil, // "-" + shift(69), // "~" + shift(70), // "(" + nil, // ")" + shift(71), // "[" + reduce(11), // "]", reduce: LexPattern + shift(72), // "{" + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S131 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" reduce(16), // regDefId, reduce: LexTerm nil, // ignoredTokId - reduce(16), // |, reduce: LexTerm - reduce(16), // ., reduce: LexTerm + reduce(16), // "|", reduce: LexTerm + reduce(16), // ".", reduce: LexTerm reduce(16), // char_lit, reduce: LexTerm - nil, // - - reduce(16), // ~, reduce: LexTerm - reduce(16), // (, reduce: LexTerm - nil, // ) - reduce(16), // [, reduce: LexTerm - reduce(16), // ], reduce: LexTerm - reduce(16), // {, reduce: LexTerm - nil, // } + nil, // "-" + reduce(16), // "~", reduce: LexTerm + reduce(16), // "(", reduce: LexTerm + nil, // ")" + reduce(16), // "[", reduce: LexTerm + reduce(16), // "]", reduce: LexTerm + reduce(16), // "{", reduce: LexTerm + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S132 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" nil, // regDefId nil, // ignoredTokId - nil, // | - nil, // . + nil, // "|" + nil, // "." nil, // char_lit - shift(144), // - - nil, // ~ - nil, // ( - nil, // ) - nil, // [ - nil, // ] - nil, // { - nil, // } + shift(144), // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S133 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" reduce(22), // regDefId, reduce: LexTerm nil, // ignoredTokId - reduce(22), // |, reduce: LexTerm - reduce(22), // ., reduce: LexTerm + reduce(22), // "|", reduce: LexTerm + reduce(22), // ".", reduce: LexTerm reduce(22), // char_lit, reduce: LexTerm - nil, // - - reduce(22), // ~, reduce: LexTerm - reduce(22), // (, reduce: LexTerm - nil, // ) - reduce(22), // [, reduce: LexTerm - reduce(22), // ], reduce: LexTerm - reduce(22), // {, reduce: LexTerm - nil, // } + nil, // "-" + reduce(22), // "~", reduce: LexTerm + reduce(22), // "(", reduce: LexTerm + nil, // ")" + reduce(22), // "[", reduce: LexTerm + reduce(22), // "]", reduce: LexTerm + reduce(22), // "{", reduce: LexTerm + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S134 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" reduce(20), // regDefId, reduce: LexTerm nil, // ignoredTokId - reduce(20), // |, reduce: LexTerm - reduce(20), // ., reduce: LexTerm + reduce(20), // "|", reduce: LexTerm + reduce(20), // ".", reduce: LexTerm reduce(20), // char_lit, reduce: LexTerm - nil, // - - reduce(20), // ~, reduce: LexTerm - reduce(20), // (, reduce: LexTerm - nil, // ) - reduce(20), // [, reduce: LexTerm - reduce(20), // ], reduce: LexTerm - reduce(20), // {, reduce: LexTerm - nil, // } + nil, // "-" + reduce(20), // "~", reduce: LexTerm + reduce(20), // "(", reduce: LexTerm + nil, // ")" + reduce(20), // "[", reduce: LexTerm + reduce(20), // "]", reduce: LexTerm + reduce(20), // "{", reduce: LexTerm + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S135 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" reduce(21), // regDefId, reduce: LexTerm nil, // ignoredTokId - reduce(21), // |, reduce: LexTerm - reduce(21), // ., reduce: LexTerm + reduce(21), // "|", reduce: LexTerm + reduce(21), // ".", reduce: LexTerm reduce(21), // char_lit, reduce: LexTerm - nil, // - - reduce(21), // ~, reduce: LexTerm - reduce(21), // (, reduce: LexTerm - nil, // ) - reduce(21), // [, reduce: LexTerm - reduce(21), // ], reduce: LexTerm - reduce(21), // {, reduce: LexTerm - nil, // } + nil, // "-" + reduce(21), // "~", reduce: LexTerm + reduce(21), // "(", reduce: LexTerm + nil, // ")" + reduce(21), // "[", reduce: LexTerm + reduce(21), // "]", reduce: LexTerm + reduce(21), // "{", reduce: LexTerm + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S136 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" shift(76), // regDefId nil, // ignoredTokId - reduce(11), // |, reduce: LexPattern - shift(77), // . + reduce(11), // "|", reduce: LexPattern + shift(77), // "." shift(78), // char_lit - nil, // - - shift(79), // ~ - shift(80), // ( - nil, // ) - shift(81), // [ - nil, // ] - shift(82), // { - reduce(11), // }, reduce: LexPattern + nil, // "-" + shift(79), // "~" + shift(80), // "(" + nil, // ")" + shift(81), // "[" + nil, // "]" + shift(82), // "{" + reduce(11), // "}", reduce: LexPattern nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S137 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" reduce(16), // regDefId, reduce: LexTerm nil, // ignoredTokId - reduce(16), // |, reduce: LexTerm - reduce(16), // ., reduce: LexTerm + reduce(16), // "|", reduce: LexTerm + reduce(16), // ".", reduce: LexTerm reduce(16), // char_lit, reduce: LexTerm - nil, // - - reduce(16), // ~, reduce: LexTerm - reduce(16), // (, reduce: LexTerm - nil, // ) - reduce(16), // [, reduce: LexTerm - nil, // ] - reduce(16), // {, reduce: LexTerm - reduce(16), // }, reduce: LexTerm + nil, // "-" + reduce(16), // "~", reduce: LexTerm + reduce(16), // "(", reduce: LexTerm + nil, // ")" + reduce(16), // "[", reduce: LexTerm + nil, // "]" + reduce(16), // "{", reduce: LexTerm + reduce(16), // "}", reduce: LexTerm nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S138 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" nil, // regDefId nil, // ignoredTokId - nil, // | - nil, // . + nil, // "|" + nil, // "." nil, // char_lit - shift(145), // - - nil, // ~ - nil, // ( - nil, // ) - nil, // [ - nil, // ] - nil, // { - nil, // } + shift(145), // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S139 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" reduce(22), // regDefId, reduce: LexTerm nil, // ignoredTokId - reduce(22), // |, reduce: LexTerm - reduce(22), // ., reduce: LexTerm + reduce(22), // "|", reduce: LexTerm + reduce(22), // ".", reduce: LexTerm reduce(22), // char_lit, reduce: LexTerm - nil, // - - reduce(22), // ~, reduce: LexTerm - reduce(22), // (, reduce: LexTerm - nil, // ) - reduce(22), // [, reduce: LexTerm - nil, // ] - reduce(22), // {, reduce: LexTerm - reduce(22), // }, reduce: LexTerm + nil, // "-" + reduce(22), // "~", reduce: LexTerm + reduce(22), // "(", reduce: LexTerm + nil, // ")" + reduce(22), // "[", reduce: LexTerm + nil, // "]" + reduce(22), // "{", reduce: LexTerm + reduce(22), // "}", reduce: LexTerm nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S140 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" reduce(20), // regDefId, reduce: LexTerm nil, // ignoredTokId - reduce(20), // |, reduce: LexTerm - reduce(20), // ., reduce: LexTerm + reduce(20), // "|", reduce: LexTerm + reduce(20), // ".", reduce: LexTerm reduce(20), // char_lit, reduce: LexTerm - nil, // - - reduce(20), // ~, reduce: LexTerm - reduce(20), // (, reduce: LexTerm - nil, // ) - reduce(20), // [, reduce: LexTerm - nil, // ] - reduce(20), // {, reduce: LexTerm - reduce(20), // }, reduce: LexTerm + nil, // "-" + reduce(20), // "~", reduce: LexTerm + reduce(20), // "(", reduce: LexTerm + nil, // ")" + reduce(20), // "[", reduce: LexTerm + nil, // "]" + reduce(20), // "{", reduce: LexTerm + reduce(20), // "}", reduce: LexTerm nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S141 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" reduce(21), // regDefId, reduce: LexTerm nil, // ignoredTokId - reduce(21), // |, reduce: LexTerm - reduce(21), // ., reduce: LexTerm + reduce(21), // "|", reduce: LexTerm + reduce(21), // ".", reduce: LexTerm reduce(21), // char_lit, reduce: LexTerm - nil, // - - reduce(21), // ~, reduce: LexTerm - reduce(21), // (, reduce: LexTerm - nil, // ) - reduce(21), // [, reduce: LexTerm - nil, // ] - reduce(21), // {, reduce: LexTerm - reduce(21), // }, reduce: LexTerm + nil, // "-" + reduce(21), // "~", reduce: LexTerm + reduce(21), // "(", reduce: LexTerm + nil, // ")" + reduce(21), // "[", reduce: LexTerm + nil, // "]" + reduce(21), // "{", reduce: LexTerm + reduce(21), // "}", reduce: LexTerm nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S142 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" nil, // regDefId nil, // ignoredTokId - nil, // | - nil, // . + nil, // "|" + nil, // "." nil, // char_lit - nil, // - - nil, // ~ - nil, // ( - shift(146), // ) - nil, // [ - nil, // ] - nil, // { - nil, // } + nil, // "-" + nil, // "~" + nil, // "(" + shift(146), // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S143 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" nil, // regDefId nil, // ignoredTokId - nil, // | - nil, // . + nil, // "|" + nil, // "." shift(147), // char_lit - nil, // - - nil, // ~ - nil, // ( - nil, // ) - nil, // [ - nil, // ] - nil, // { - nil, // } + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S144 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" nil, // regDefId nil, // ignoredTokId - nil, // | - nil, // . + nil, // "|" + nil, // "." shift(148), // char_lit - nil, // - - nil, // ~ - nil, // ( - nil, // ) - nil, // [ - nil, // ] - nil, // { - nil, // } + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S145 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" nil, // regDefId nil, // ignoredTokId - nil, // | - nil, // . + nil, // "|" + nil, // "." shift(149), // char_lit - nil, // - - nil, // ~ - nil, // ( - nil, // ) - nil, // [ - nil, // ] - nil, // { - nil, // } + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S146 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - reduce(18), // ;, reduce: LexTerm + nil, // ":" + reduce(18), // ";", reduce: LexTerm reduce(18), // regDefId, reduce: LexTerm nil, // ignoredTokId - reduce(18), // |, reduce: LexTerm - reduce(18), // ., reduce: LexTerm + reduce(18), // "|", reduce: LexTerm + reduce(18), // ".", reduce: LexTerm reduce(18), // char_lit, reduce: LexTerm - nil, // - - reduce(18), // ~, reduce: LexTerm - reduce(18), // (, reduce: LexTerm - nil, // ) - reduce(18), // [, reduce: LexTerm - nil, // ] - reduce(18), // {, reduce: LexTerm - nil, // } + nil, // "-" + reduce(18), // "~", reduce: LexTerm + reduce(18), // "(", reduce: LexTerm + nil, // ")" + reduce(18), // "[", reduce: LexTerm + nil, // "]" + reduce(18), // "{", reduce: LexTerm + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S147 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" nil, // regDefId nil, // ignoredTokId - nil, // | - nil, // . + nil, // "|" + nil, // "." nil, // char_lit - nil, // - - nil, // ~ - nil, // ( - shift(150), // ) - nil, // [ - nil, // ] - nil, // { - nil, // } + nil, // "-" + nil, // "~" + nil, // "(" + shift(150), // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S148 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" nil, // regDefId nil, // ignoredTokId - nil, // | - nil, // . + nil, // "|" + nil, // "." nil, // char_lit - nil, // - - nil, // ~ - nil, // ( - shift(151), // ) - nil, // [ - nil, // ] - nil, // { - nil, // } + nil, // "-" + nil, // "~" + nil, // "(" + shift(151), // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S149 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" nil, // regDefId nil, // ignoredTokId - nil, // | - nil, // . + nil, // "|" + nil, // "." nil, // char_lit - nil, // - - nil, // ~ - nil, // ( - shift(152), // ) - nil, // [ - nil, // ] - nil, // { - nil, // } + nil, // "-" + nil, // "~" + nil, // "(" + shift(152), // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S150 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" reduce(18), // regDefId, reduce: LexTerm nil, // ignoredTokId - reduce(18), // |, reduce: LexTerm - reduce(18), // ., reduce: LexTerm + reduce(18), // "|", reduce: LexTerm + reduce(18), // ".", reduce: LexTerm reduce(18), // char_lit, reduce: LexTerm - nil, // - - reduce(18), // ~, reduce: LexTerm - reduce(18), // (, reduce: LexTerm - reduce(18), // ), reduce: LexTerm - reduce(18), // [, reduce: LexTerm - nil, // ] - reduce(18), // {, reduce: LexTerm - nil, // } + nil, // "-" + reduce(18), // "~", reduce: LexTerm + reduce(18), // "(", reduce: LexTerm + reduce(18), // ")", reduce: LexTerm + reduce(18), // "[", reduce: LexTerm + nil, // "]" + reduce(18), // "{", reduce: LexTerm + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S151 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" reduce(18), // regDefId, reduce: LexTerm nil, // ignoredTokId - reduce(18), // |, reduce: LexTerm - reduce(18), // ., reduce: LexTerm + reduce(18), // "|", reduce: LexTerm + reduce(18), // ".", reduce: LexTerm reduce(18), // char_lit, reduce: LexTerm - nil, // - - reduce(18), // ~, reduce: LexTerm - reduce(18), // (, reduce: LexTerm - nil, // ) - reduce(18), // [, reduce: LexTerm - reduce(18), // ], reduce: LexTerm - reduce(18), // {, reduce: LexTerm - nil, // } + nil, // "-" + reduce(18), // "~", reduce: LexTerm + reduce(18), // "(", reduce: LexTerm + nil, // ")" + reduce(18), // "[", reduce: LexTerm + reduce(18), // "]", reduce: LexTerm + reduce(18), // "{", reduce: LexTerm + nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, actionRow{ // S152 canRecover: false, actions: [numSymbols]action{ - nil, // + nil, // ά nil, // Ω nil, // tokId - nil, // : - nil, // ; + nil, // ":" + nil, // ";" reduce(18), // regDefId, reduce: LexTerm nil, // ignoredTokId - reduce(18), // |, reduce: LexTerm - reduce(18), // ., reduce: LexTerm + reduce(18), // "|", reduce: LexTerm + reduce(18), // ".", reduce: LexTerm reduce(18), // char_lit, reduce: LexTerm - nil, // - - reduce(18), // ~, reduce: LexTerm - reduce(18), // (, reduce: LexTerm - nil, // ) - reduce(18), // [, reduce: LexTerm - nil, // ] - reduce(18), // {, reduce: LexTerm - reduce(18), // }, reduce: LexTerm + nil, // "-" + reduce(18), // "~", reduce: LexTerm + reduce(18), // "(", reduce: LexTerm + nil, // ")" + reduce(18), // "[", reduce: LexTerm + nil, // "]" + reduce(18), // "{", reduce: LexTerm + reduce(18), // "}", reduce: LexTerm nil, // g_sdt_lit nil, // prodId nil, // string_lit - nil, // error - nil, // λ - nil, // empty - nil, // ε + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, } diff --git a/internal/frontend/reparsed/internal/parser/gototable.go b/internal/frontend/reparsed/internal/parser/gototable.go index 6a1f09c2..6d28aaa3 100644 --- a/internal/frontend/reparsed/internal/parser/gototable.go +++ b/internal/frontend/reparsed/internal/parser/gototable.go @@ -11,3063 +11,3063 @@ type ( var gotoTab = gotoTable{ gotoRow{ // S0 - -1, // S' - 1, // Grammar - 2, // LexicalPart - 3, // LexProductions - 4, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - 5, // SyntaxPart - 6, // FileHeader - 7, // SyntaxProdList - 8, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + 1, // Π + 2, // Π + 3, // Π + 4, // Π + 5, // Π + -1, // Π + -1, // Π + -1, // Π + 6, // Π + 7, // Π + 8, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S1 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S2 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - 14, // SyntaxPart - 6, // FileHeader - 7, // SyntaxProdList - 8, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + 14, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + 6, // Π + 7, // Π + 8, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S3 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - 15, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S4 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + 15, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S5 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S6 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - 16, // SyntaxProdList - 8, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + 16, // Π + 8, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S7 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - 17, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + 17, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S8 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S9 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S10 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S11 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S12 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S13 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S14 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S15 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S16 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - 17, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + 17, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S17 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S18 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - 22, // LexPattern - 23, // LexAlt - 24, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + 22, // Π + 23, // Π + 24, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S19 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - 32, // LexPattern - 23, // LexAlt - 24, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + 32, // Π + 23, // Π + 24, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S20 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - 33, // LexPattern - 23, // LexAlt - 24, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + 33, // Π + 23, // Π + 24, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S21 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - 34, // Alternatives - 35, // SyntaxBody - 36, // Symbols - 37, // Symbol - 38, // ErrorSymbol - 39, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + 34, // Π + 35, // Π + 36, // Π + 37, // Π + 38, // Π + 39, // Π }, gotoRow{ // S22 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S23 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - 49, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + 49, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S24 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S25 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S26 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S27 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S28 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S29 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - 53, // LexPattern - 54, // LexAlt - 55, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + 53, // Π + 54, // Π + 55, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S30 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - 63, // LexPattern - 64, // LexAlt - 65, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + 63, // Π + 64, // Π + 65, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S31 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - 73, // LexPattern - 74, // LexAlt - 75, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + 73, // Π + 74, // Π + 75, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S32 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S33 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S34 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S35 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S36 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - 87, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + 87, // Π }, gotoRow{ // S37 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + 89, // Π + -1, // Π + -1, // Π + 39, // Π }, gotoRow{ // S38 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - 89, // Symbols - 37, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S39 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S40 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S41 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S42 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S43 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S44 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S45 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S46 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S47 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S48 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - 91, // LexAlt - 24, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + 91, // Π + 24, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S49 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S50 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S51 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S52 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S53 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S54 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - 96, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + 96, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S55 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S56 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S57 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S58 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S59 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S60 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - 100, // LexPattern - 54, // LexAlt - 55, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + 100, // Π + 54, // Π + 55, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S61 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - 101, // LexPattern - 64, // LexAlt - 65, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + 101, // Π + 64, // Π + 65, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S62 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - 102, // LexPattern - 74, // LexAlt - 75, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + 102, // Π + 74, // Π + 75, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S63 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S64 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - 105, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + 105, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S65 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S66 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S67 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S68 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S69 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S70 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - 109, // LexPattern - 54, // LexAlt - 55, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + 109, // Π + 54, // Π + 55, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S71 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - 110, // LexPattern - 64, // LexAlt - 65, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + 110, // Π + 64, // Π + 65, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S72 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - 111, // LexPattern - 74, // LexAlt - 75, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + 111, // Π + 74, // Π + 75, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S73 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S74 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - 114, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + 114, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S75 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S76 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S77 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S78 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S79 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S80 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - 118, // LexPattern - 54, // LexAlt - 55, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + 118, // Π + 54, // Π + 55, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S81 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - 119, // LexPattern - 64, // LexAlt - 65, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + 119, // Π + 64, // Π + 65, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S82 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - 120, // LexPattern - 74, // LexAlt - 75, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + 120, // Π + 74, // Π + 75, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S83 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S84 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S85 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S86 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - 121, // SyntaxBody - 36, // Symbols - 37, // Symbol - 38, // ErrorSymbol - 39, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + 121, // Π + 36, // Π + 37, // Π + 38, // Π + 39, // Π }, gotoRow{ // S87 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S88 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S89 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - 87, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + 87, // Π }, gotoRow{ // S90 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S91 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - 49, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + 49, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S92 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S93 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S94 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - 124, // LexAlt - 55, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + 124, // Π + 55, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S95 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S96 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S97 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S98 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S99 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S100 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S101 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S102 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S103 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - 130, // LexAlt - 65, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + 130, // Π + 65, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S104 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S105 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S106 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S107 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S108 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S109 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S110 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S111 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S112 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - 136, // LexAlt - 75, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + 136, // Π + 75, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S113 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S114 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S115 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S116 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S117 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S118 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S119 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S120 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S121 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S122 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S123 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S124 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - 96, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + 96, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S125 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S126 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S127 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S128 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S129 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S130 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - 105, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + 105, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S131 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S132 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S133 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S134 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S135 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S136 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - 114, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + 114, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S137 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S138 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S139 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S140 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S141 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S142 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S143 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S144 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S145 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S146 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S147 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S148 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S149 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S150 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S151 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S152 - -1, // S' - -1, // Grammar - -1, // LexicalPart - -1, // LexProductions - -1, // LexProduction - -1, // LexPattern - -1, // LexAlt - -1, // LexTerm - -1, // SyntaxPart - -1, // FileHeader - -1, // SyntaxProdList - -1, // SyntaxProduction - -1, // Alternatives - -1, // SyntaxBody - -1, // Symbols - -1, // Symbol - -1, // ErrorSymbol - -1, // EpsilonSymbol + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, } diff --git a/internal/frontend/reparsed/internal/parser/productionstable.go b/internal/frontend/reparsed/internal/parser/productionstable.go index 35f3e548..eec97f19 100644 --- a/internal/frontend/reparsed/internal/parser/productionstable.go +++ b/internal/frontend/reparsed/internal/parser/productionstable.go @@ -23,7 +23,7 @@ type ( var productionsTable = ProdTab{ ProdTabEntry{ - String: `S' : Grammar << >>`, + String: `S' : Π << >>`, Id: "S'", NTType: 0, Index: 0, @@ -33,7 +33,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `Grammar : LexicalPart SyntaxPart << ast.NewGrammar(X[0], X[1]) >>`, + String: `Grammar : Π Π << ast.NewGrammar(X[0], X[1]) >>`, Id: "Grammar", NTType: 1, Index: 1, @@ -43,7 +43,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `Grammar : LexicalPart << ast.NewGrammar(X[0], nil) >>`, + String: `Grammar : Π << ast.NewGrammar(X[0], nil) >>`, Id: "Grammar", NTType: 1, Index: 2, @@ -53,7 +53,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `Grammar : SyntaxPart << ast.NewGrammar(nil, X[0]) >>`, + String: `Grammar : Π << ast.NewGrammar(nil, X[0]) >>`, Id: "Grammar", NTType: 1, Index: 3, @@ -63,7 +63,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `LexicalPart : LexProductions << ast.NewLexPart(nil, nil, X[0]) >>`, + String: `LexicalPart : Π << ast.NewLexPart(nil, nil, X[0]) >>`, Id: "LexicalPart", NTType: 2, Index: 4, @@ -73,9 +73,9 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `LexProductions : LexProduction << ast.NewLexProductions(X[0]) >>`, + String: `LexProductions : Π << ast.NewLexProductions(X[0]) >>`, Id: "LexProductions", - NTType: 3, + NTType: 4, Index: 5, NumSymbols: 1, ReduceFunc: func(X []Attrib) (Attrib, error) { @@ -83,9 +83,9 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `LexProductions : LexProductions LexProduction << ast.AppendLexProduction(X[0], X[1]) >>`, + String: `LexProductions : Π Π << ast.AppendLexProduction(X[0], X[1]) >>`, Id: "LexProductions", - NTType: 3, + NTType: 4, Index: 6, NumSymbols: 2, ReduceFunc: func(X []Attrib) (Attrib, error) { @@ -93,9 +93,9 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `LexProduction : tokId ":" LexPattern ";" << ast.NewLexTokDef(X[0], X[2]) >>`, + String: `LexProduction : tokId Λ<:> Π Λ<;> << ast.NewLexTokDef(X[0], X[2]) >>`, Id: "LexProduction", - NTType: 4, + NTType: 5, Index: 7, NumSymbols: 4, ReduceFunc: func(X []Attrib) (Attrib, error) { @@ -103,9 +103,9 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `LexProduction : regDefId ":" LexPattern ";" << ast.NewLexRegDef(X[0], X[2]) >>`, + String: `LexProduction : regDefId Λ<:> Π Λ<;> << ast.NewLexRegDef(X[0], X[2]) >>`, Id: "LexProduction", - NTType: 4, + NTType: 5, Index: 8, NumSymbols: 4, ReduceFunc: func(X []Attrib) (Attrib, error) { @@ -113,9 +113,9 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `LexProduction : ignoredTokId ":" LexPattern ";" << ast.NewLexIgnoredTokDef(X[0], X[2]) >>`, + String: `LexProduction : ignoredTokId Λ<:> Π Λ<;> << ast.NewLexIgnoredTokDef(X[0], X[2]) >>`, Id: "LexProduction", - NTType: 4, + NTType: 5, Index: 9, NumSymbols: 4, ReduceFunc: func(X []Attrib) (Attrib, error) { @@ -123,9 +123,9 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `LexPattern : LexAlt << ast.NewLexPattern(X[0]) >>`, + String: `LexPattern : Π << ast.NewLexPattern(X[0]) >>`, Id: "LexPattern", - NTType: 5, + NTType: 6, Index: 10, NumSymbols: 1, ReduceFunc: func(X []Attrib) (Attrib, error) { @@ -133,9 +133,9 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `LexPattern : LexPattern "|" LexAlt << ast.AppendLexAlt(X[0], X[2]) >>`, + String: `LexPattern : Π Λ<|> Π << ast.AppendLexAlt(X[0], X[2]) >>`, Id: "LexPattern", - NTType: 5, + NTType: 6, Index: 11, NumSymbols: 3, ReduceFunc: func(X []Attrib) (Attrib, error) { @@ -143,9 +143,9 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `LexAlt : LexTerm << ast.NewLexAlt(X[0]) >>`, + String: `LexAlt : Π << ast.NewLexAlt(X[0]) >>`, Id: "LexAlt", - NTType: 6, + NTType: 7, Index: 12, NumSymbols: 1, ReduceFunc: func(X []Attrib) (Attrib, error) { @@ -153,9 +153,9 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `LexAlt : LexAlt LexTerm << ast.AppendLexTerm(X[0], X[1]) >>`, + String: `LexAlt : Π Π << ast.AppendLexTerm(X[0], X[1]) >>`, Id: "LexAlt", - NTType: 6, + NTType: 7, Index: 13, NumSymbols: 2, ReduceFunc: func(X []Attrib) (Attrib, error) { @@ -163,9 +163,9 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `LexTerm : "." << ast.LexDOT, nil >>`, + String: `LexTerm : Λ<.> << ast.LexDOT, nil >>`, Id: "LexTerm", - NTType: 7, + NTType: 8, Index: 14, NumSymbols: 1, ReduceFunc: func(X []Attrib) (Attrib, error) { @@ -175,7 +175,7 @@ var productionsTable = ProdTab{ ProdTabEntry{ String: `LexTerm : char_lit << ast.NewLexCharLitExt(X[0],false) >>`, Id: "LexTerm", - NTType: 7, + NTType: 8, Index: 15, NumSymbols: 1, ReduceFunc: func(X []Attrib) (Attrib, error) { @@ -183,9 +183,9 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `LexTerm : char_lit "-" char_lit << ast.NewLexCharRangeExt(X[0], X[2],false) >>`, + String: `LexTerm : char_lit Λ<-> char_lit << ast.NewLexCharRangeExt(X[0], X[2],false) >>`, Id: "LexTerm", - NTType: 7, + NTType: 8, Index: 16, NumSymbols: 3, ReduceFunc: func(X []Attrib) (Attrib, error) { @@ -193,9 +193,9 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `LexTerm : "~" char_lit << ast.NewLexCharLitExt(X[0], true) >>`, + String: `LexTerm : Λ<~> char_lit << ast.NewLexCharLitExt(X[0], true) >>`, Id: "LexTerm", - NTType: 7, + NTType: 8, Index: 17, NumSymbols: 2, ReduceFunc: func(X []Attrib) (Attrib, error) { @@ -203,9 +203,9 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `LexTerm : "~" "(" char_lit "-" char_lit ")" << ast.NewLexCharRangeExt(X[2], X[4], true) >>`, + String: `LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> << ast.NewLexCharRangeExt(X[2], X[4], true) >>`, Id: "LexTerm", - NTType: 7, + NTType: 8, Index: 18, NumSymbols: 6, ReduceFunc: func(X []Attrib) (Attrib, error) { @@ -215,7 +215,7 @@ var productionsTable = ProdTab{ ProdTabEntry{ String: `LexTerm : regDefId << ast.NewLexRegDefId(X[0]) >>`, Id: "LexTerm", - NTType: 7, + NTType: 8, Index: 19, NumSymbols: 1, ReduceFunc: func(X []Attrib) (Attrib, error) { @@ -223,9 +223,9 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `LexTerm : "[" LexPattern "]" << ast.NewLexOptPattern(X[1]) >>`, + String: `LexTerm : Λ<[> Π Λ<]> << ast.NewLexOptPattern(X[1]) >>`, Id: "LexTerm", - NTType: 7, + NTType: 8, Index: 20, NumSymbols: 3, ReduceFunc: func(X []Attrib) (Attrib, error) { @@ -233,9 +233,9 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `LexTerm : "{" LexPattern "}" << ast.NewLexRepPattern(X[1]) >>`, + String: `LexTerm : Λ<{> Π Λ<}> << ast.NewLexRepPattern(X[1]) >>`, Id: "LexTerm", - NTType: 7, + NTType: 8, Index: 21, NumSymbols: 3, ReduceFunc: func(X []Attrib) (Attrib, error) { @@ -243,9 +243,9 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `LexTerm : "(" LexPattern ")" << ast.NewLexGroupPattern(X[1]) >>`, + String: `LexTerm : Λ<(> Π Λ<)> << ast.NewLexGroupPattern(X[1]) >>`, Id: "LexTerm", - NTType: 7, + NTType: 8, Index: 22, NumSymbols: 3, ReduceFunc: func(X []Attrib) (Attrib, error) { @@ -253,9 +253,9 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `SyntaxPart : FileHeader SyntaxProdList << ast.NewSyntaxPart(X[0], X[1]) >>`, + String: `SyntaxPart : Π Π << ast.NewSyntaxPart(X[0], X[1]) >>`, Id: "SyntaxPart", - NTType: 8, + NTType: 3, Index: 23, NumSymbols: 2, ReduceFunc: func(X []Attrib) (Attrib, error) { @@ -263,9 +263,9 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `SyntaxPart : SyntaxProdList << ast.NewSyntaxPart(nil, X[0]) >>`, + String: `SyntaxPart : Π << ast.NewSyntaxPart(nil, X[0]) >>`, Id: "SyntaxPart", - NTType: 8, + NTType: 3, Index: 24, NumSymbols: 1, ReduceFunc: func(X []Attrib) (Attrib, error) { @@ -283,7 +283,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `SyntaxProdList : SyntaxProduction << ast.NewSyntaxProdList(X[0]) >>`, + String: `SyntaxProdList : Π << ast.NewSyntaxProdList(X[0]) >>`, Id: "SyntaxProdList", NTType: 10, Index: 26, @@ -293,7 +293,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `SyntaxProdList : SyntaxProdList SyntaxProduction << ast.AddSyntaxProds(X[0], X[1]) >>`, + String: `SyntaxProdList : Π Π << ast.AddSyntaxProds(X[0], X[1]) >>`, Id: "SyntaxProdList", NTType: 10, Index: 27, @@ -303,7 +303,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `SyntaxProduction : prodId ":" Alternatives ";" << ast.NewSyntaxProd(X[0], X[2]) >>`, + String: `SyntaxProduction : prodId Λ<:> Π Λ<;> << ast.NewSyntaxProd(X[0], X[2]) >>`, Id: "SyntaxProduction", NTType: 11, Index: 28, @@ -313,7 +313,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `Alternatives : SyntaxBody << ast.NewSyntaxAlts(X[0]) >>`, + String: `Alternatives : Π << ast.NewSyntaxAlts(X[0]) >>`, Id: "Alternatives", NTType: 12, Index: 29, @@ -323,7 +323,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `Alternatives : Alternatives "|" SyntaxBody << ast.AddSyntaxAlt(X[0], X[2]) >>`, + String: `Alternatives : Π Λ<|> Π << ast.AddSyntaxAlt(X[0], X[2]) >>`, Id: "Alternatives", NTType: 12, Index: 30, @@ -333,7 +333,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `SyntaxBody : Symbols << ast.NewSyntaxBodyGen(X[0], nil) >>`, + String: `SyntaxBody : Π << ast.NewSyntaxBodyGen(X[0], nil) >>`, Id: "SyntaxBody", NTType: 13, Index: 31, @@ -343,7 +343,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `SyntaxBody : Symbols g_sdt_lit << ast.NewSyntaxBodyGen(X[0], X[1]) >>`, + String: `SyntaxBody : Π g_sdt_lit << ast.NewSyntaxBodyGen(X[0], X[1]) >>`, Id: "SyntaxBody", NTType: 13, Index: 32, @@ -353,7 +353,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `SyntaxBody : ErrorSymbol << ast.NewErrorBodyGen(nil, nil) >>`, + String: `SyntaxBody : Π << ast.NewErrorBodyGen(nil, nil) >>`, Id: "SyntaxBody", NTType: 13, Index: 33, @@ -363,7 +363,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `SyntaxBody : ErrorSymbol Symbols << ast.NewErrorBodyGen(X[1], nil) >>`, + String: `SyntaxBody : Π Π << ast.NewErrorBodyGen(X[1], nil) >>`, Id: "SyntaxBody", NTType: 13, Index: 34, @@ -373,7 +373,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `SyntaxBody : ErrorSymbol Symbols g_sdt_lit << ast.NewErrorBodyGen(X[1], X[2]) >>`, + String: `SyntaxBody : Π Π g_sdt_lit << ast.NewErrorBodyGen(X[1], X[2]) >>`, Id: "SyntaxBody", NTType: 13, Index: 35, @@ -383,7 +383,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `SyntaxBody : ErrorSymbol g_sdt_lit << ast.NewErrorBodyGen(nil, X[1]) >>`, + String: `SyntaxBody : Π g_sdt_lit << ast.NewErrorBodyGen(nil, X[1]) >>`, Id: "SyntaxBody", NTType: 13, Index: 36, @@ -393,7 +393,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `SyntaxBody : EpsilonSymbol << ast.NewEmptyBodyGen() >>`, + String: `SyntaxBody : Π << ast.NewEmptyBodyGen() >>`, Id: "SyntaxBody", NTType: 13, Index: 37, @@ -403,7 +403,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `Symbols : Symbol << ast.NewSyntaxSymbols(X[0]) >>`, + String: `Symbols : Π << ast.NewSyntaxSymbols(X[0]) >>`, Id: "Symbols", NTType: 14, Index: 38, @@ -413,7 +413,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `Symbols : Symbols Symbol << ast.AddSyntaxSymbol(X[0], X[1]) >>`, + String: `Symbols : Π Π << ast.AddSyntaxSymbol(X[0], X[1]) >>`, Id: "Symbols", NTType: 14, Index: 39, @@ -425,7 +425,7 @@ var productionsTable = ProdTab{ ProdTabEntry{ String: `Symbol : prodId << ast.NewSyntaxProdId(X[0]) >>`, Id: "Symbol", - NTType: 15, + NTType: 17, Index: 40, NumSymbols: 1, ReduceFunc: func(X []Attrib) (Attrib, error) { @@ -435,7 +435,7 @@ var productionsTable = ProdTab{ ProdTabEntry{ String: `Symbol : tokId << ast.NewTokId(X[0]) >>`, Id: "Symbol", - NTType: 15, + NTType: 17, Index: 41, NumSymbols: 1, ReduceFunc: func(X []Attrib) (Attrib, error) { @@ -445,7 +445,7 @@ var productionsTable = ProdTab{ ProdTabEntry{ String: `Symbol : string_lit << ast.NewStringLit(X[0]) >>`, Id: "Symbol", - NTType: 15, + NTType: 17, Index: 42, NumSymbols: 1, ReduceFunc: func(X []Attrib) (Attrib, error) { @@ -453,9 +453,9 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `ErrorSymbol : "error" << >>`, + String: `ErrorSymbol : Λ << >>`, Id: "ErrorSymbol", - NTType: 16, + NTType: 15, Index: 43, NumSymbols: 1, ReduceFunc: func(X []Attrib) (Attrib, error) { @@ -463,9 +463,9 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `ErrorSymbol : "λ" << >>`, + String: `ErrorSymbol : Λ<λ> << >>`, Id: "ErrorSymbol", - NTType: 16, + NTType: 15, Index: 44, NumSymbols: 1, ReduceFunc: func(X []Attrib) (Attrib, error) { @@ -473,9 +473,9 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `EpsilonSymbol : "empty" << >>`, + String: `EpsilonSymbol : Λ << >>`, Id: "EpsilonSymbol", - NTType: 17, + NTType: 16, Index: 45, NumSymbols: 1, ReduceFunc: func(X []Attrib) (Attrib, error) { @@ -483,9 +483,9 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `EpsilonSymbol : "ε" << >>`, + String: `EpsilonSymbol : Λ<ε> << >>`, Id: "EpsilonSymbol", - NTType: 17, + NTType: 16, Index: 46, NumSymbols: 1, ReduceFunc: func(X []Attrib) (Attrib, error) { diff --git a/internal/frontend/reparsed/internal/token/token.go b/internal/frontend/reparsed/internal/token/token.go index 5b588afd..1c9b8ce9 100644 --- a/internal/frontend/reparsed/internal/token/token.go +++ b/internal/frontend/reparsed/internal/token/token.go @@ -67,58 +67,58 @@ func (m TokenMap) StringType(typ Type) string { var TokMap = TokenMap{ typeMap: []string{ - "", - "Ω", + "INVALID", + "Ω", "tokId", - ":", - ";", + "Λ<:>", + "Λ<;>", "regDefId", "ignoredTokId", - "|", - ".", + "Λ<|>", + "Λ<.>", "char_lit", - "-", - "~", - "(", - ")", - "[", - "]", - "{", - "}", + "Λ<->", + "Λ<~>", + "Λ<(>", + "Λ<)>", + "Λ<[>", + "Λ<]>", + "Λ<{>", + "Λ<}>", "g_sdt_lit", "prodId", "string_lit", - "error", - "λ", - "empty", - "ε", + "Λ", + "Λ<λ>", + "Λ", + "Λ<ε>", }, idMap: map[string]Type{ - "": 0, - "Ω": 1, + "INVALID": 0, + "Ω": 1, "tokId": 2, - ":": 3, - ";": 4, + "Λ<:>": 3, + "Λ<;>": 4, "regDefId": 5, "ignoredTokId": 6, - "|": 7, - ".": 8, + "Λ<|>": 7, + "Λ<.>": 8, "char_lit": 9, - "-": 10, - "~": 11, - "(": 12, - ")": 13, - "[": 14, - "]": 15, - "{": 16, - "}": 17, + "Λ<->": 10, + "Λ<~>": 11, + "Λ<(>": 12, + "Λ<)>": 13, + "Λ<[>": 14, + "Λ<]>": 15, + "Λ<{>": 16, + "Λ<}>": 17, "g_sdt_lit": 18, "prodId": 19, "string_lit": 20, - "error": 21, - "λ": 22, - "empty": 23, - "ε": 24, + "Λ": 21, + "Λ<λ>": 22, + "Λ": 23, + "Λ<ε>": 24, }, } diff --git a/internal/frontend/reparsed/log/LR1_conflicts.txt b/internal/frontend/reparsed/log/LR1_conflicts.txt deleted file mode 100644 index 243241f3..00000000 --- a/internal/frontend/reparsed/log/LR1_conflicts.txt +++ /dev/null @@ -1,17 +0,0 @@ -4 LR-1 conflicts: - S27 - symbol: - - Shift(50) - Reduce(15:LexTerm : char_lit << ast.NewLexCharLitExt(X[0],false) >>) - S58 - symbol: - - Reduce(15:LexTerm : char_lit << ast.NewLexCharLitExt(X[0],false) >>) - Shift(97) - S68 - symbol: - - Shift(106) - Reduce(15:LexTerm : char_lit << ast.NewLexCharLitExt(X[0],false) >>) - S78 - symbol: - - Reduce(15:LexTerm : char_lit << ast.NewLexCharLitExt(X[0],false) >>) - Shift(115) diff --git a/internal/frontend/reparsed/log/LR1_sets.txt b/internal/frontend/reparsed/log/LR1_sets.txt index f7ed442b..82a14c89 100644 --- a/internal/frontend/reparsed/log/LR1_sets.txt +++ b/internal/frontend/reparsed/log/LR1_sets.txt @@ -1,60 +1,60 @@ S0{ - S' : •Grammar «Ω» - Grammar : •LexicalPart SyntaxPart «Ω» - Grammar : •LexicalPart «Ω» - Grammar : •SyntaxPart «Ω» - LexicalPart : •LexProductions «g_sdt_lit» - LexicalPart : •LexProductions «prodId» - LexicalPart : •LexProductions «Ω» - SyntaxPart : •FileHeader SyntaxProdList «Ω» - SyntaxPart : •SyntaxProdList «Ω» - LexProductions : •LexProduction «g_sdt_lit» - LexProductions : •LexProductions LexProduction «g_sdt_lit» - LexProductions : •LexProduction «prodId» - LexProductions : •LexProductions LexProduction «prodId» - LexProductions : •LexProduction «Ω» - LexProductions : •LexProductions LexProduction «Ω» + S' : •Π «Ω» + Grammar : •Π Π «Ω» + Grammar : •Π «Ω» + Grammar : •Π «Ω» + LexicalPart : •Π «g_sdt_lit» + LexicalPart : •Π «prodId» + LexicalPart : •Π «Ω» + SyntaxPart : •Π Π «Ω» + SyntaxPart : •Π «Ω» + LexProductions : •Π «g_sdt_lit» + LexProductions : •Π Π «g_sdt_lit» + LexProductions : •Π «prodId» + LexProductions : •Π Π «prodId» + LexProductions : •Π «Ω» + LexProductions : •Π Π «Ω» FileHeader : •g_sdt_lit «prodId» - SyntaxProdList : •SyntaxProduction «Ω» - SyntaxProdList : •SyntaxProdList SyntaxProduction «Ω» - LexProduction : •tokId : LexPattern ; «g_sdt_lit» - LexProduction : •regDefId : LexPattern ; «g_sdt_lit» - LexProduction : •ignoredTokId : LexPattern ; «g_sdt_lit» - LexProductions : •LexProduction «ignoredTokId» - LexProductions : •LexProduction «regDefId» - LexProductions : •LexProduction «tokId» - LexProductions : •LexProductions LexProduction «ignoredTokId» - LexProductions : •LexProductions LexProduction «regDefId» - LexProductions : •LexProductions LexProduction «tokId» - LexProduction : •tokId : LexPattern ; «prodId» - LexProduction : •regDefId : LexPattern ; «prodId» - LexProduction : •ignoredTokId : LexPattern ; «prodId» - LexProduction : •tokId : LexPattern ; «Ω» - LexProduction : •regDefId : LexPattern ; «Ω» - LexProduction : •ignoredTokId : LexPattern ; «Ω» - SyntaxProduction : •prodId : Alternatives ; «Ω» - SyntaxProdList : •SyntaxProduction «prodId» - SyntaxProdList : •SyntaxProdList SyntaxProduction «prodId» - LexProduction : •tokId : LexPattern ; «ignoredTokId» - LexProduction : •regDefId : LexPattern ; «ignoredTokId» - LexProduction : •ignoredTokId : LexPattern ; «ignoredTokId» - LexProduction : •tokId : LexPattern ; «regDefId» - LexProduction : •regDefId : LexPattern ; «regDefId» - LexProduction : •ignoredTokId : LexPattern ; «regDefId» - LexProduction : •tokId : LexPattern ; «tokId» - LexProduction : •regDefId : LexPattern ; «tokId» - LexProduction : •ignoredTokId : LexPattern ; «tokId» - SyntaxProduction : •prodId : Alternatives ; «prodId» -} -Transitions: - Grammar -> 1 - LexicalPart -> 2 - LexProductions -> 3 - LexProduction -> 4 - SyntaxPart -> 5 - FileHeader -> 6 - SyntaxProdList -> 7 - SyntaxProduction -> 8 + SyntaxProdList : •Π «Ω» + SyntaxProdList : •Π Π «Ω» + LexProduction : •tokId Λ<:> Π Λ<;> «g_sdt_lit» + LexProduction : •regDefId Λ<:> Π Λ<;> «g_sdt_lit» + LexProduction : •ignoredTokId Λ<:> Π Λ<;> «g_sdt_lit» + LexProductions : •Π «ignoredTokId» + LexProductions : •Π «regDefId» + LexProductions : •Π «tokId» + LexProductions : •Π Π «ignoredTokId» + LexProductions : •Π Π «regDefId» + LexProductions : •Π Π «tokId» + LexProduction : •tokId Λ<:> Π Λ<;> «prodId» + LexProduction : •regDefId Λ<:> Π Λ<;> «prodId» + LexProduction : •ignoredTokId Λ<:> Π Λ<;> «prodId» + LexProduction : •tokId Λ<:> Π Λ<;> «Ω» + LexProduction : •regDefId Λ<:> Π Λ<;> «Ω» + LexProduction : •ignoredTokId Λ<:> Π Λ<;> «Ω» + SyntaxProduction : •prodId Λ<:> Π Λ<;> «Ω» + SyntaxProdList : •Π «prodId» + SyntaxProdList : •Π Π «prodId» + LexProduction : •tokId Λ<:> Π Λ<;> «ignoredTokId» + LexProduction : •regDefId Λ<:> Π Λ<;> «ignoredTokId» + LexProduction : •ignoredTokId Λ<:> Π Λ<;> «ignoredTokId» + LexProduction : •tokId Λ<:> Π Λ<;> «regDefId» + LexProduction : •regDefId Λ<:> Π Λ<;> «regDefId» + LexProduction : •ignoredTokId Λ<:> Π Λ<;> «regDefId» + LexProduction : •tokId Λ<:> Π Λ<;> «tokId» + LexProduction : •regDefId Λ<:> Π Λ<;> «tokId» + LexProduction : •ignoredTokId Λ<:> Π Λ<;> «tokId» + SyntaxProduction : •prodId Λ<:> Π Λ<;> «prodId» +} +Transitions: + Π -> 1 + Π -> 2 + Π -> 3 + Π -> 4 + Π -> 5 + Π -> 6 + Π -> 7 + Π -> 8 tokId -> 9 regDefId -> 10 ignoredTokId -> 11 @@ -63,154 +63,154 @@ Transitions: S1{ - S' : Grammar• «Ω» + S' : Π• «Ω» } Transitions: S2{ - Grammar : LexicalPart •SyntaxPart «Ω» - Grammar : LexicalPart• «Ω» - SyntaxPart : •FileHeader SyntaxProdList «Ω» - SyntaxPart : •SyntaxProdList «Ω» + Grammar : Π •Π «Ω» + Grammar : Π• «Ω» + SyntaxPart : •Π Π «Ω» + SyntaxPart : •Π «Ω» FileHeader : •g_sdt_lit «prodId» - SyntaxProdList : •SyntaxProduction «Ω» - SyntaxProdList : •SyntaxProdList SyntaxProduction «Ω» - SyntaxProduction : •prodId : Alternatives ; «Ω» - SyntaxProdList : •SyntaxProduction «prodId» - SyntaxProdList : •SyntaxProdList SyntaxProduction «prodId» - SyntaxProduction : •prodId : Alternatives ; «prodId» + SyntaxProdList : •Π «Ω» + SyntaxProdList : •Π Π «Ω» + SyntaxProduction : •prodId Λ<:> Π Λ<;> «Ω» + SyntaxProdList : •Π «prodId» + SyntaxProdList : •Π Π «prodId» + SyntaxProduction : •prodId Λ<:> Π Λ<;> «prodId» } Transitions: - FileHeader -> 6 - SyntaxProdList -> 7 - SyntaxProduction -> 8 + Π -> 6 + Π -> 7 + Π -> 8 g_sdt_lit -> 12 prodId -> 13 - SyntaxPart -> 14 + Π -> 14 S3{ - LexicalPart : LexProductions• «g_sdt_lit» - LexicalPart : LexProductions• «prodId» - LexicalPart : LexProductions• «Ω» - LexProductions : LexProductions •LexProduction «g_sdt_lit» - LexProductions : LexProductions •LexProduction «prodId» - LexProductions : LexProductions •LexProduction «Ω» - LexProductions : LexProductions •LexProduction «ignoredTokId» - LexProductions : LexProductions •LexProduction «regDefId» - LexProductions : LexProductions •LexProduction «tokId» - LexProduction : •tokId : LexPattern ; «g_sdt_lit» - LexProduction : •regDefId : LexPattern ; «g_sdt_lit» - LexProduction : •ignoredTokId : LexPattern ; «g_sdt_lit» - LexProduction : •tokId : LexPattern ; «prodId» - LexProduction : •regDefId : LexPattern ; «prodId» - LexProduction : •ignoredTokId : LexPattern ; «prodId» - LexProduction : •tokId : LexPattern ; «Ω» - LexProduction : •regDefId : LexPattern ; «Ω» - LexProduction : •ignoredTokId : LexPattern ; «Ω» - LexProduction : •tokId : LexPattern ; «ignoredTokId» - LexProduction : •regDefId : LexPattern ; «ignoredTokId» - LexProduction : •ignoredTokId : LexPattern ; «ignoredTokId» - LexProduction : •tokId : LexPattern ; «regDefId» - LexProduction : •regDefId : LexPattern ; «regDefId» - LexProduction : •ignoredTokId : LexPattern ; «regDefId» - LexProduction : •tokId : LexPattern ; «tokId» - LexProduction : •regDefId : LexPattern ; «tokId» - LexProduction : •ignoredTokId : LexPattern ; «tokId» + Grammar : Π• «Ω» } Transitions: - tokId -> 9 - regDefId -> 10 - ignoredTokId -> 11 - LexProduction -> 15 S4{ - LexProductions : LexProduction• «g_sdt_lit» - LexProductions : LexProduction• «prodId» - LexProductions : LexProduction• «Ω» - LexProductions : LexProduction• «ignoredTokId» - LexProductions : LexProduction• «regDefId» - LexProductions : LexProduction• «tokId» + LexicalPart : Π• «g_sdt_lit» + LexicalPart : Π• «prodId» + LexicalPart : Π• «Ω» + LexProductions : Π •Π «g_sdt_lit» + LexProductions : Π •Π «prodId» + LexProductions : Π •Π «Ω» + LexProductions : Π •Π «ignoredTokId» + LexProductions : Π •Π «regDefId» + LexProductions : Π •Π «tokId» + LexProduction : •tokId Λ<:> Π Λ<;> «g_sdt_lit» + LexProduction : •regDefId Λ<:> Π Λ<;> «g_sdt_lit» + LexProduction : •ignoredTokId Λ<:> Π Λ<;> «g_sdt_lit» + LexProduction : •tokId Λ<:> Π Λ<;> «prodId» + LexProduction : •regDefId Λ<:> Π Λ<;> «prodId» + LexProduction : •ignoredTokId Λ<:> Π Λ<;> «prodId» + LexProduction : •tokId Λ<:> Π Λ<;> «Ω» + LexProduction : •regDefId Λ<:> Π Λ<;> «Ω» + LexProduction : •ignoredTokId Λ<:> Π Λ<;> «Ω» + LexProduction : •tokId Λ<:> Π Λ<;> «ignoredTokId» + LexProduction : •regDefId Λ<:> Π Λ<;> «ignoredTokId» + LexProduction : •ignoredTokId Λ<:> Π Λ<;> «ignoredTokId» + LexProduction : •tokId Λ<:> Π Λ<;> «regDefId» + LexProduction : •regDefId Λ<:> Π Λ<;> «regDefId» + LexProduction : •ignoredTokId Λ<:> Π Λ<;> «regDefId» + LexProduction : •tokId Λ<:> Π Λ<;> «tokId» + LexProduction : •regDefId Λ<:> Π Λ<;> «tokId» + LexProduction : •ignoredTokId Λ<:> Π Λ<;> «tokId» } Transitions: + tokId -> 9 + regDefId -> 10 + ignoredTokId -> 11 + Π -> 15 S5{ - Grammar : SyntaxPart• «Ω» + LexProductions : Π• «g_sdt_lit» + LexProductions : Π• «prodId» + LexProductions : Π• «Ω» + LexProductions : Π• «ignoredTokId» + LexProductions : Π• «regDefId» + LexProductions : Π• «tokId» } Transitions: S6{ - SyntaxPart : FileHeader •SyntaxProdList «Ω» - SyntaxProdList : •SyntaxProduction «Ω» - SyntaxProdList : •SyntaxProdList SyntaxProduction «Ω» - SyntaxProduction : •prodId : Alternatives ; «Ω» - SyntaxProdList : •SyntaxProduction «prodId» - SyntaxProdList : •SyntaxProdList SyntaxProduction «prodId» - SyntaxProduction : •prodId : Alternatives ; «prodId» + SyntaxPart : Π •Π «Ω» + SyntaxProdList : •Π «Ω» + SyntaxProdList : •Π Π «Ω» + SyntaxProduction : •prodId Λ<:> Π Λ<;> «Ω» + SyntaxProdList : •Π «prodId» + SyntaxProdList : •Π Π «prodId» + SyntaxProduction : •prodId Λ<:> Π Λ<;> «prodId» } Transitions: - SyntaxProduction -> 8 + Π -> 8 prodId -> 13 - SyntaxProdList -> 16 + Π -> 16 S7{ - SyntaxPart : SyntaxProdList• «Ω» - SyntaxProdList : SyntaxProdList •SyntaxProduction «Ω» - SyntaxProdList : SyntaxProdList •SyntaxProduction «prodId» - SyntaxProduction : •prodId : Alternatives ; «Ω» - SyntaxProduction : •prodId : Alternatives ; «prodId» + SyntaxPart : Π• «Ω» + SyntaxProdList : Π •Π «Ω» + SyntaxProdList : Π •Π «prodId» + SyntaxProduction : •prodId Λ<:> Π Λ<;> «Ω» + SyntaxProduction : •prodId Λ<:> Π Λ<;> «prodId» } Transitions: prodId -> 13 - SyntaxProduction -> 17 + Π -> 17 S8{ - SyntaxProdList : SyntaxProduction• «Ω» - SyntaxProdList : SyntaxProduction• «prodId» + SyntaxProdList : Π• «Ω» + SyntaxProdList : Π• «prodId» } Transitions: S9{ - LexProduction : tokId •: LexPattern ; «g_sdt_lit» - LexProduction : tokId •: LexPattern ; «prodId» - LexProduction : tokId •: LexPattern ; «Ω» - LexProduction : tokId •: LexPattern ; «ignoredTokId» - LexProduction : tokId •: LexPattern ; «regDefId» - LexProduction : tokId •: LexPattern ; «tokId» + LexProduction : tokId •Λ<:> Π Λ<;> «g_sdt_lit» + LexProduction : tokId •Λ<:> Π Λ<;> «prodId» + LexProduction : tokId •Λ<:> Π Λ<;> «Ω» + LexProduction : tokId •Λ<:> Π Λ<;> «ignoredTokId» + LexProduction : tokId •Λ<:> Π Λ<;> «regDefId» + LexProduction : tokId •Λ<:> Π Λ<;> «tokId» } Transitions: - : -> 18 + Λ<:> -> 18 S10{ - LexProduction : regDefId •: LexPattern ; «g_sdt_lit» - LexProduction : regDefId •: LexPattern ; «prodId» - LexProduction : regDefId •: LexPattern ; «Ω» - LexProduction : regDefId •: LexPattern ; «ignoredTokId» - LexProduction : regDefId •: LexPattern ; «regDefId» - LexProduction : regDefId •: LexPattern ; «tokId» + LexProduction : regDefId •Λ<:> Π Λ<;> «g_sdt_lit» + LexProduction : regDefId •Λ<:> Π Λ<;> «prodId» + LexProduction : regDefId •Λ<:> Π Λ<;> «Ω» + LexProduction : regDefId •Λ<:> Π Λ<;> «ignoredTokId» + LexProduction : regDefId •Λ<:> Π Λ<;> «regDefId» + LexProduction : regDefId •Λ<:> Π Λ<;> «tokId» } Transitions: - : -> 19 + Λ<:> -> 19 S11{ - LexProduction : ignoredTokId •: LexPattern ; «g_sdt_lit» - LexProduction : ignoredTokId •: LexPattern ; «prodId» - LexProduction : ignoredTokId •: LexPattern ; «Ω» - LexProduction : ignoredTokId •: LexPattern ; «ignoredTokId» - LexProduction : ignoredTokId •: LexPattern ; «regDefId» - LexProduction : ignoredTokId •: LexPattern ; «tokId» + LexProduction : ignoredTokId •Λ<:> Π Λ<;> «g_sdt_lit» + LexProduction : ignoredTokId •Λ<:> Π Λ<;> «prodId» + LexProduction : ignoredTokId •Λ<:> Π Λ<;> «Ω» + LexProduction : ignoredTokId •Λ<:> Π Λ<;> «ignoredTokId» + LexProduction : ignoredTokId •Λ<:> Π Λ<;> «regDefId» + LexProduction : ignoredTokId •Λ<:> Π Λ<;> «tokId» } Transitions: - : -> 20 + Λ<:> -> 20 S12{ @@ -220,476 +220,476 @@ Transitions: S13{ - SyntaxProduction : prodId •: Alternatives ; «Ω» - SyntaxProduction : prodId •: Alternatives ; «prodId» + SyntaxProduction : prodId •Λ<:> Π Λ<;> «Ω» + SyntaxProduction : prodId •Λ<:> Π Λ<;> «prodId» } Transitions: - : -> 21 + Λ<:> -> 21 S14{ - Grammar : LexicalPart SyntaxPart• «Ω» + Grammar : Π Π• «Ω» } Transitions: S15{ - LexProductions : LexProductions LexProduction• «g_sdt_lit» - LexProductions : LexProductions LexProduction• «prodId» - LexProductions : LexProductions LexProduction• «Ω» - LexProductions : LexProductions LexProduction• «ignoredTokId» - LexProductions : LexProductions LexProduction• «regDefId» - LexProductions : LexProductions LexProduction• «tokId» + LexProductions : Π Π• «g_sdt_lit» + LexProductions : Π Π• «prodId» + LexProductions : Π Π• «Ω» + LexProductions : Π Π• «ignoredTokId» + LexProductions : Π Π• «regDefId» + LexProductions : Π Π• «tokId» } Transitions: S16{ - SyntaxPart : FileHeader SyntaxProdList• «Ω» - SyntaxProdList : SyntaxProdList •SyntaxProduction «Ω» - SyntaxProdList : SyntaxProdList •SyntaxProduction «prodId» - SyntaxProduction : •prodId : Alternatives ; «Ω» - SyntaxProduction : •prodId : Alternatives ; «prodId» + SyntaxPart : Π Π• «Ω» + SyntaxProdList : Π •Π «Ω» + SyntaxProdList : Π •Π «prodId» + SyntaxProduction : •prodId Λ<:> Π Λ<;> «Ω» + SyntaxProduction : •prodId Λ<:> Π Λ<;> «prodId» } Transitions: prodId -> 13 - SyntaxProduction -> 17 + Π -> 17 S17{ - SyntaxProdList : SyntaxProdList SyntaxProduction• «Ω» - SyntaxProdList : SyntaxProdList SyntaxProduction• «prodId» + SyntaxProdList : Π Π• «Ω» + SyntaxProdList : Π Π• «prodId» } Transitions: S18{ - LexProduction : tokId : •LexPattern ; «g_sdt_lit» - LexProduction : tokId : •LexPattern ; «prodId» - LexProduction : tokId : •LexPattern ; «Ω» - LexProduction : tokId : •LexPattern ; «ignoredTokId» - LexProduction : tokId : •LexPattern ; «regDefId» - LexProduction : tokId : •LexPattern ; «tokId» - LexPattern : •LexAlt «;» - LexPattern : •LexPattern | LexAlt «;» - LexAlt : •LexTerm «;» - LexAlt : •LexAlt LexTerm «;» - LexPattern : •LexAlt «|» - LexPattern : •LexPattern | LexAlt «|» - LexTerm : •. «;» - LexTerm : •char_lit «;» - LexTerm : •char_lit - char_lit «;» - LexTerm : •~ char_lit «;» - LexTerm : •~ ( char_lit - char_lit ) «;» - LexTerm : •regDefId «;» - LexTerm : •[ LexPattern ] «;» - LexTerm : •{ LexPattern } «;» - LexTerm : •( LexPattern ) «;» - LexAlt : •LexTerm «(» - LexAlt : •LexTerm «.» - LexAlt : •LexTerm «[» - LexAlt : •LexTerm «char_lit» - LexAlt : •LexTerm «regDefId» - LexAlt : •LexTerm «{» - LexAlt : •LexTerm «~» - LexAlt : •LexAlt LexTerm «(» - LexAlt : •LexAlt LexTerm «.» - LexAlt : •LexAlt LexTerm «[» - LexAlt : •LexAlt LexTerm «char_lit» - LexAlt : •LexAlt LexTerm «regDefId» - LexAlt : •LexAlt LexTerm «{» - LexAlt : •LexAlt LexTerm «~» - LexAlt : •LexTerm «|» - LexAlt : •LexAlt LexTerm «|» - LexTerm : •. «(» - LexTerm : •char_lit «(» - LexTerm : •char_lit - char_lit «(» - LexTerm : •~ char_lit «(» - LexTerm : •~ ( char_lit - char_lit ) «(» - LexTerm : •regDefId «(» - LexTerm : •[ LexPattern ] «(» - LexTerm : •{ LexPattern } «(» - LexTerm : •( LexPattern ) «(» - LexTerm : •. «.» - LexTerm : •char_lit «.» - LexTerm : •char_lit - char_lit «.» - LexTerm : •~ char_lit «.» - LexTerm : •~ ( char_lit - char_lit ) «.» - LexTerm : •regDefId «.» - LexTerm : •[ LexPattern ] «.» - LexTerm : •{ LexPattern } «.» - LexTerm : •( LexPattern ) «.» - LexTerm : •. «[» - LexTerm : •char_lit «[» - LexTerm : •char_lit - char_lit «[» - LexTerm : •~ char_lit «[» - LexTerm : •~ ( char_lit - char_lit ) «[» - LexTerm : •regDefId «[» - LexTerm : •[ LexPattern ] «[» - LexTerm : •{ LexPattern } «[» - LexTerm : •( LexPattern ) «[» - LexTerm : •. «char_lit» + LexProduction : tokId Λ<:> •Π Λ<;> «g_sdt_lit» + LexProduction : tokId Λ<:> •Π Λ<;> «prodId» + LexProduction : tokId Λ<:> •Π Λ<;> «Ω» + LexProduction : tokId Λ<:> •Π Λ<;> «ignoredTokId» + LexProduction : tokId Λ<:> •Π Λ<;> «regDefId» + LexProduction : tokId Λ<:> •Π Λ<;> «tokId» + LexPattern : •Π «";"» + LexPattern : •Π Λ<|> Π «";"» + LexAlt : •Π «";"» + LexAlt : •Π Π «";"» + LexPattern : •Π «"|"» + LexPattern : •Π Λ<|> Π «"|"» + LexTerm : •Λ<.> «";"» + LexTerm : •char_lit «";"» + LexTerm : •char_lit Λ<-> char_lit «";"» + LexTerm : •Λ<~> char_lit «";"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «";"» + LexTerm : •regDefId «";"» + LexTerm : •Λ<[> Π Λ<]> «";"» + LexTerm : •Λ<{> Π Λ<}> «";"» + LexTerm : •Λ<(> Π Λ<)> «";"» + LexAlt : •Π «"("» + LexAlt : •Π «"."» + LexAlt : •Π «"["» + LexAlt : •Π «char_lit» + LexAlt : •Π «regDefId» + LexAlt : •Π «"{"» + LexAlt : •Π «"~"» + LexAlt : •Π Π «"("» + LexAlt : •Π Π «"."» + LexAlt : •Π Π «"["» + LexAlt : •Π Π «char_lit» + LexAlt : •Π Π «regDefId» + LexAlt : •Π Π «"{"» + LexAlt : •Π Π «"~"» + LexAlt : •Π «"|"» + LexAlt : •Π Π «"|"» + LexTerm : •Λ<.> «"("» + LexTerm : •char_lit «"("» + LexTerm : •char_lit Λ<-> char_lit «"("» + LexTerm : •Λ<~> char_lit «"("» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"("» + LexTerm : •regDefId «"("» + LexTerm : •Λ<[> Π Λ<]> «"("» + LexTerm : •Λ<{> Π Λ<}> «"("» + LexTerm : •Λ<(> Π Λ<)> «"("» + LexTerm : •Λ<.> «"."» + LexTerm : •char_lit «"."» + LexTerm : •char_lit Λ<-> char_lit «"."» + LexTerm : •Λ<~> char_lit «"."» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"."» + LexTerm : •regDefId «"."» + LexTerm : •Λ<[> Π Λ<]> «"."» + LexTerm : •Λ<{> Π Λ<}> «"."» + LexTerm : •Λ<(> Π Λ<)> «"."» + LexTerm : •Λ<.> «"["» + LexTerm : •char_lit «"["» + LexTerm : •char_lit Λ<-> char_lit «"["» + LexTerm : •Λ<~> char_lit «"["» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"["» + LexTerm : •regDefId «"["» + LexTerm : •Λ<[> Π Λ<]> «"["» + LexTerm : •Λ<{> Π Λ<}> «"["» + LexTerm : •Λ<(> Π Λ<)> «"["» + LexTerm : •Λ<.> «char_lit» LexTerm : •char_lit «char_lit» - LexTerm : •char_lit - char_lit «char_lit» - LexTerm : •~ char_lit «char_lit» - LexTerm : •~ ( char_lit - char_lit ) «char_lit» + LexTerm : •char_lit Λ<-> char_lit «char_lit» + LexTerm : •Λ<~> char_lit «char_lit» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «char_lit» LexTerm : •regDefId «char_lit» - LexTerm : •[ LexPattern ] «char_lit» - LexTerm : •{ LexPattern } «char_lit» - LexTerm : •( LexPattern ) «char_lit» - LexTerm : •. «regDefId» + LexTerm : •Λ<[> Π Λ<]> «char_lit» + LexTerm : •Λ<{> Π Λ<}> «char_lit» + LexTerm : •Λ<(> Π Λ<)> «char_lit» + LexTerm : •Λ<.> «regDefId» LexTerm : •char_lit «regDefId» - LexTerm : •char_lit - char_lit «regDefId» - LexTerm : •~ char_lit «regDefId» - LexTerm : •~ ( char_lit - char_lit ) «regDefId» + LexTerm : •char_lit Λ<-> char_lit «regDefId» + LexTerm : •Λ<~> char_lit «regDefId» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «regDefId» LexTerm : •regDefId «regDefId» - LexTerm : •[ LexPattern ] «regDefId» - LexTerm : •{ LexPattern } «regDefId» - LexTerm : •( LexPattern ) «regDefId» - LexTerm : •. «{» - LexTerm : •char_lit «{» - LexTerm : •char_lit - char_lit «{» - LexTerm : •~ char_lit «{» - LexTerm : •~ ( char_lit - char_lit ) «{» - LexTerm : •regDefId «{» - LexTerm : •[ LexPattern ] «{» - LexTerm : •{ LexPattern } «{» - LexTerm : •( LexPattern ) «{» - LexTerm : •. «~» - LexTerm : •char_lit «~» - LexTerm : •char_lit - char_lit «~» - LexTerm : •~ char_lit «~» - LexTerm : •~ ( char_lit - char_lit ) «~» - LexTerm : •regDefId «~» - LexTerm : •[ LexPattern ] «~» - LexTerm : •{ LexPattern } «~» - LexTerm : •( LexPattern ) «~» - LexTerm : •. «|» - LexTerm : •char_lit «|» - LexTerm : •char_lit - char_lit «|» - LexTerm : •~ char_lit «|» - LexTerm : •~ ( char_lit - char_lit ) «|» - LexTerm : •regDefId «|» - LexTerm : •[ LexPattern ] «|» - LexTerm : •{ LexPattern } «|» - LexTerm : •( LexPattern ) «|» -} -Transitions: - LexPattern -> 22 - LexAlt -> 23 - LexTerm -> 24 + LexTerm : •Λ<[> Π Λ<]> «regDefId» + LexTerm : •Λ<{> Π Λ<}> «regDefId» + LexTerm : •Λ<(> Π Λ<)> «regDefId» + LexTerm : •Λ<.> «"{"» + LexTerm : •char_lit «"{"» + LexTerm : •char_lit Λ<-> char_lit «"{"» + LexTerm : •Λ<~> char_lit «"{"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"{"» + LexTerm : •regDefId «"{"» + LexTerm : •Λ<[> Π Λ<]> «"{"» + LexTerm : •Λ<{> Π Λ<}> «"{"» + LexTerm : •Λ<(> Π Λ<)> «"{"» + LexTerm : •Λ<.> «"~"» + LexTerm : •char_lit «"~"» + LexTerm : •char_lit Λ<-> char_lit «"~"» + LexTerm : •Λ<~> char_lit «"~"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"~"» + LexTerm : •regDefId «"~"» + LexTerm : •Λ<[> Π Λ<]> «"~"» + LexTerm : •Λ<{> Π Λ<}> «"~"» + LexTerm : •Λ<(> Π Λ<)> «"~"» + LexTerm : •Λ<.> «"|"» + LexTerm : •char_lit «"|"» + LexTerm : •char_lit Λ<-> char_lit «"|"» + LexTerm : •Λ<~> char_lit «"|"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"|"» + LexTerm : •regDefId «"|"» + LexTerm : •Λ<[> Π Λ<]> «"|"» + LexTerm : •Λ<{> Π Λ<}> «"|"» + LexTerm : •Λ<(> Π Λ<)> «"|"» +} +Transitions: + Π -> 22 + Π -> 23 + Π -> 24 regDefId -> 25 - . -> 26 + Λ<.> -> 26 char_lit -> 27 - ~ -> 28 - ( -> 29 - [ -> 30 - { -> 31 + Λ<~> -> 28 + Λ<(> -> 29 + Λ<[> -> 30 + Λ<{> -> 31 S19{ - LexProduction : regDefId : •LexPattern ; «g_sdt_lit» - LexProduction : regDefId : •LexPattern ; «prodId» - LexProduction : regDefId : •LexPattern ; «Ω» - LexProduction : regDefId : •LexPattern ; «ignoredTokId» - LexProduction : regDefId : •LexPattern ; «regDefId» - LexProduction : regDefId : •LexPattern ; «tokId» - LexPattern : •LexAlt «;» - LexPattern : •LexPattern | LexAlt «;» - LexAlt : •LexTerm «;» - LexAlt : •LexAlt LexTerm «;» - LexPattern : •LexAlt «|» - LexPattern : •LexPattern | LexAlt «|» - LexTerm : •. «;» - LexTerm : •char_lit «;» - LexTerm : •char_lit - char_lit «;» - LexTerm : •~ char_lit «;» - LexTerm : •~ ( char_lit - char_lit ) «;» - LexTerm : •regDefId «;» - LexTerm : •[ LexPattern ] «;» - LexTerm : •{ LexPattern } «;» - LexTerm : •( LexPattern ) «;» - LexAlt : •LexTerm «(» - LexAlt : •LexTerm «.» - LexAlt : •LexTerm «[» - LexAlt : •LexTerm «char_lit» - LexAlt : •LexTerm «regDefId» - LexAlt : •LexTerm «{» - LexAlt : •LexTerm «~» - LexAlt : •LexAlt LexTerm «(» - LexAlt : •LexAlt LexTerm «.» - LexAlt : •LexAlt LexTerm «[» - LexAlt : •LexAlt LexTerm «char_lit» - LexAlt : •LexAlt LexTerm «regDefId» - LexAlt : •LexAlt LexTerm «{» - LexAlt : •LexAlt LexTerm «~» - LexAlt : •LexTerm «|» - LexAlt : •LexAlt LexTerm «|» - LexTerm : •. «(» - LexTerm : •char_lit «(» - LexTerm : •char_lit - char_lit «(» - LexTerm : •~ char_lit «(» - LexTerm : •~ ( char_lit - char_lit ) «(» - LexTerm : •regDefId «(» - LexTerm : •[ LexPattern ] «(» - LexTerm : •{ LexPattern } «(» - LexTerm : •( LexPattern ) «(» - LexTerm : •. «.» - LexTerm : •char_lit «.» - LexTerm : •char_lit - char_lit «.» - LexTerm : •~ char_lit «.» - LexTerm : •~ ( char_lit - char_lit ) «.» - LexTerm : •regDefId «.» - LexTerm : •[ LexPattern ] «.» - LexTerm : •{ LexPattern } «.» - LexTerm : •( LexPattern ) «.» - LexTerm : •. «[» - LexTerm : •char_lit «[» - LexTerm : •char_lit - char_lit «[» - LexTerm : •~ char_lit «[» - LexTerm : •~ ( char_lit - char_lit ) «[» - LexTerm : •regDefId «[» - LexTerm : •[ LexPattern ] «[» - LexTerm : •{ LexPattern } «[» - LexTerm : •( LexPattern ) «[» - LexTerm : •. «char_lit» + LexProduction : regDefId Λ<:> •Π Λ<;> «g_sdt_lit» + LexProduction : regDefId Λ<:> •Π Λ<;> «prodId» + LexProduction : regDefId Λ<:> •Π Λ<;> «Ω» + LexProduction : regDefId Λ<:> •Π Λ<;> «ignoredTokId» + LexProduction : regDefId Λ<:> •Π Λ<;> «regDefId» + LexProduction : regDefId Λ<:> •Π Λ<;> «tokId» + LexPattern : •Π «";"» + LexPattern : •Π Λ<|> Π «";"» + LexAlt : •Π «";"» + LexAlt : •Π Π «";"» + LexPattern : •Π «"|"» + LexPattern : •Π Λ<|> Π «"|"» + LexTerm : •Λ<.> «";"» + LexTerm : •char_lit «";"» + LexTerm : •char_lit Λ<-> char_lit «";"» + LexTerm : •Λ<~> char_lit «";"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «";"» + LexTerm : •regDefId «";"» + LexTerm : •Λ<[> Π Λ<]> «";"» + LexTerm : •Λ<{> Π Λ<}> «";"» + LexTerm : •Λ<(> Π Λ<)> «";"» + LexAlt : •Π «"("» + LexAlt : •Π «"."» + LexAlt : •Π «"["» + LexAlt : •Π «char_lit» + LexAlt : •Π «regDefId» + LexAlt : •Π «"{"» + LexAlt : •Π «"~"» + LexAlt : •Π Π «"("» + LexAlt : •Π Π «"."» + LexAlt : •Π Π «"["» + LexAlt : •Π Π «char_lit» + LexAlt : •Π Π «regDefId» + LexAlt : •Π Π «"{"» + LexAlt : •Π Π «"~"» + LexAlt : •Π «"|"» + LexAlt : •Π Π «"|"» + LexTerm : •Λ<.> «"("» + LexTerm : •char_lit «"("» + LexTerm : •char_lit Λ<-> char_lit «"("» + LexTerm : •Λ<~> char_lit «"("» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"("» + LexTerm : •regDefId «"("» + LexTerm : •Λ<[> Π Λ<]> «"("» + LexTerm : •Λ<{> Π Λ<}> «"("» + LexTerm : •Λ<(> Π Λ<)> «"("» + LexTerm : •Λ<.> «"."» + LexTerm : •char_lit «"."» + LexTerm : •char_lit Λ<-> char_lit «"."» + LexTerm : •Λ<~> char_lit «"."» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"."» + LexTerm : •regDefId «"."» + LexTerm : •Λ<[> Π Λ<]> «"."» + LexTerm : •Λ<{> Π Λ<}> «"."» + LexTerm : •Λ<(> Π Λ<)> «"."» + LexTerm : •Λ<.> «"["» + LexTerm : •char_lit «"["» + LexTerm : •char_lit Λ<-> char_lit «"["» + LexTerm : •Λ<~> char_lit «"["» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"["» + LexTerm : •regDefId «"["» + LexTerm : •Λ<[> Π Λ<]> «"["» + LexTerm : •Λ<{> Π Λ<}> «"["» + LexTerm : •Λ<(> Π Λ<)> «"["» + LexTerm : •Λ<.> «char_lit» LexTerm : •char_lit «char_lit» - LexTerm : •char_lit - char_lit «char_lit» - LexTerm : •~ char_lit «char_lit» - LexTerm : •~ ( char_lit - char_lit ) «char_lit» + LexTerm : •char_lit Λ<-> char_lit «char_lit» + LexTerm : •Λ<~> char_lit «char_lit» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «char_lit» LexTerm : •regDefId «char_lit» - LexTerm : •[ LexPattern ] «char_lit» - LexTerm : •{ LexPattern } «char_lit» - LexTerm : •( LexPattern ) «char_lit» - LexTerm : •. «regDefId» + LexTerm : •Λ<[> Π Λ<]> «char_lit» + LexTerm : •Λ<{> Π Λ<}> «char_lit» + LexTerm : •Λ<(> Π Λ<)> «char_lit» + LexTerm : •Λ<.> «regDefId» LexTerm : •char_lit «regDefId» - LexTerm : •char_lit - char_lit «regDefId» - LexTerm : •~ char_lit «regDefId» - LexTerm : •~ ( char_lit - char_lit ) «regDefId» + LexTerm : •char_lit Λ<-> char_lit «regDefId» + LexTerm : •Λ<~> char_lit «regDefId» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «regDefId» LexTerm : •regDefId «regDefId» - LexTerm : •[ LexPattern ] «regDefId» - LexTerm : •{ LexPattern } «regDefId» - LexTerm : •( LexPattern ) «regDefId» - LexTerm : •. «{» - LexTerm : •char_lit «{» - LexTerm : •char_lit - char_lit «{» - LexTerm : •~ char_lit «{» - LexTerm : •~ ( char_lit - char_lit ) «{» - LexTerm : •regDefId «{» - LexTerm : •[ LexPattern ] «{» - LexTerm : •{ LexPattern } «{» - LexTerm : •( LexPattern ) «{» - LexTerm : •. «~» - LexTerm : •char_lit «~» - LexTerm : •char_lit - char_lit «~» - LexTerm : •~ char_lit «~» - LexTerm : •~ ( char_lit - char_lit ) «~» - LexTerm : •regDefId «~» - LexTerm : •[ LexPattern ] «~» - LexTerm : •{ LexPattern } «~» - LexTerm : •( LexPattern ) «~» - LexTerm : •. «|» - LexTerm : •char_lit «|» - LexTerm : •char_lit - char_lit «|» - LexTerm : •~ char_lit «|» - LexTerm : •~ ( char_lit - char_lit ) «|» - LexTerm : •regDefId «|» - LexTerm : •[ LexPattern ] «|» - LexTerm : •{ LexPattern } «|» - LexTerm : •( LexPattern ) «|» -} -Transitions: - LexAlt -> 23 - LexTerm -> 24 + LexTerm : •Λ<[> Π Λ<]> «regDefId» + LexTerm : •Λ<{> Π Λ<}> «regDefId» + LexTerm : •Λ<(> Π Λ<)> «regDefId» + LexTerm : •Λ<.> «"{"» + LexTerm : •char_lit «"{"» + LexTerm : •char_lit Λ<-> char_lit «"{"» + LexTerm : •Λ<~> char_lit «"{"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"{"» + LexTerm : •regDefId «"{"» + LexTerm : •Λ<[> Π Λ<]> «"{"» + LexTerm : •Λ<{> Π Λ<}> «"{"» + LexTerm : •Λ<(> Π Λ<)> «"{"» + LexTerm : •Λ<.> «"~"» + LexTerm : •char_lit «"~"» + LexTerm : •char_lit Λ<-> char_lit «"~"» + LexTerm : •Λ<~> char_lit «"~"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"~"» + LexTerm : •regDefId «"~"» + LexTerm : •Λ<[> Π Λ<]> «"~"» + LexTerm : •Λ<{> Π Λ<}> «"~"» + LexTerm : •Λ<(> Π Λ<)> «"~"» + LexTerm : •Λ<.> «"|"» + LexTerm : •char_lit «"|"» + LexTerm : •char_lit Λ<-> char_lit «"|"» + LexTerm : •Λ<~> char_lit «"|"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"|"» + LexTerm : •regDefId «"|"» + LexTerm : •Λ<[> Π Λ<]> «"|"» + LexTerm : •Λ<{> Π Λ<}> «"|"» + LexTerm : •Λ<(> Π Λ<)> «"|"» +} +Transitions: + Π -> 23 + Π -> 24 regDefId -> 25 - . -> 26 + Λ<.> -> 26 char_lit -> 27 - ~ -> 28 - ( -> 29 - [ -> 30 - { -> 31 - LexPattern -> 32 + Λ<~> -> 28 + Λ<(> -> 29 + Λ<[> -> 30 + Λ<{> -> 31 + Π -> 32 S20{ - LexProduction : ignoredTokId : •LexPattern ; «g_sdt_lit» - LexProduction : ignoredTokId : •LexPattern ; «prodId» - LexProduction : ignoredTokId : •LexPattern ; «Ω» - LexProduction : ignoredTokId : •LexPattern ; «ignoredTokId» - LexProduction : ignoredTokId : •LexPattern ; «regDefId» - LexProduction : ignoredTokId : •LexPattern ; «tokId» - LexPattern : •LexAlt «;» - LexPattern : •LexPattern | LexAlt «;» - LexAlt : •LexTerm «;» - LexAlt : •LexAlt LexTerm «;» - LexPattern : •LexAlt «|» - LexPattern : •LexPattern | LexAlt «|» - LexTerm : •. «;» - LexTerm : •char_lit «;» - LexTerm : •char_lit - char_lit «;» - LexTerm : •~ char_lit «;» - LexTerm : •~ ( char_lit - char_lit ) «;» - LexTerm : •regDefId «;» - LexTerm : •[ LexPattern ] «;» - LexTerm : •{ LexPattern } «;» - LexTerm : •( LexPattern ) «;» - LexAlt : •LexTerm «(» - LexAlt : •LexTerm «.» - LexAlt : •LexTerm «[» - LexAlt : •LexTerm «char_lit» - LexAlt : •LexTerm «regDefId» - LexAlt : •LexTerm «{» - LexAlt : •LexTerm «~» - LexAlt : •LexAlt LexTerm «(» - LexAlt : •LexAlt LexTerm «.» - LexAlt : •LexAlt LexTerm «[» - LexAlt : •LexAlt LexTerm «char_lit» - LexAlt : •LexAlt LexTerm «regDefId» - LexAlt : •LexAlt LexTerm «{» - LexAlt : •LexAlt LexTerm «~» - LexAlt : •LexTerm «|» - LexAlt : •LexAlt LexTerm «|» - LexTerm : •. «(» - LexTerm : •char_lit «(» - LexTerm : •char_lit - char_lit «(» - LexTerm : •~ char_lit «(» - LexTerm : •~ ( char_lit - char_lit ) «(» - LexTerm : •regDefId «(» - LexTerm : •[ LexPattern ] «(» - LexTerm : •{ LexPattern } «(» - LexTerm : •( LexPattern ) «(» - LexTerm : •. «.» - LexTerm : •char_lit «.» - LexTerm : •char_lit - char_lit «.» - LexTerm : •~ char_lit «.» - LexTerm : •~ ( char_lit - char_lit ) «.» - LexTerm : •regDefId «.» - LexTerm : •[ LexPattern ] «.» - LexTerm : •{ LexPattern } «.» - LexTerm : •( LexPattern ) «.» - LexTerm : •. «[» - LexTerm : •char_lit «[» - LexTerm : •char_lit - char_lit «[» - LexTerm : •~ char_lit «[» - LexTerm : •~ ( char_lit - char_lit ) «[» - LexTerm : •regDefId «[» - LexTerm : •[ LexPattern ] «[» - LexTerm : •{ LexPattern } «[» - LexTerm : •( LexPattern ) «[» - LexTerm : •. «char_lit» + LexProduction : ignoredTokId Λ<:> •Π Λ<;> «g_sdt_lit» + LexProduction : ignoredTokId Λ<:> •Π Λ<;> «prodId» + LexProduction : ignoredTokId Λ<:> •Π Λ<;> «Ω» + LexProduction : ignoredTokId Λ<:> •Π Λ<;> «ignoredTokId» + LexProduction : ignoredTokId Λ<:> •Π Λ<;> «regDefId» + LexProduction : ignoredTokId Λ<:> •Π Λ<;> «tokId» + LexPattern : •Π «";"» + LexPattern : •Π Λ<|> Π «";"» + LexAlt : •Π «";"» + LexAlt : •Π Π «";"» + LexPattern : •Π «"|"» + LexPattern : •Π Λ<|> Π «"|"» + LexTerm : •Λ<.> «";"» + LexTerm : •char_lit «";"» + LexTerm : •char_lit Λ<-> char_lit «";"» + LexTerm : •Λ<~> char_lit «";"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «";"» + LexTerm : •regDefId «";"» + LexTerm : •Λ<[> Π Λ<]> «";"» + LexTerm : •Λ<{> Π Λ<}> «";"» + LexTerm : •Λ<(> Π Λ<)> «";"» + LexAlt : •Π «"("» + LexAlt : •Π «"."» + LexAlt : •Π «"["» + LexAlt : •Π «char_lit» + LexAlt : •Π «regDefId» + LexAlt : •Π «"{"» + LexAlt : •Π «"~"» + LexAlt : •Π Π «"("» + LexAlt : •Π Π «"."» + LexAlt : •Π Π «"["» + LexAlt : •Π Π «char_lit» + LexAlt : •Π Π «regDefId» + LexAlt : •Π Π «"{"» + LexAlt : •Π Π «"~"» + LexAlt : •Π «"|"» + LexAlt : •Π Π «"|"» + LexTerm : •Λ<.> «"("» + LexTerm : •char_lit «"("» + LexTerm : •char_lit Λ<-> char_lit «"("» + LexTerm : •Λ<~> char_lit «"("» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"("» + LexTerm : •regDefId «"("» + LexTerm : •Λ<[> Π Λ<]> «"("» + LexTerm : •Λ<{> Π Λ<}> «"("» + LexTerm : •Λ<(> Π Λ<)> «"("» + LexTerm : •Λ<.> «"."» + LexTerm : •char_lit «"."» + LexTerm : •char_lit Λ<-> char_lit «"."» + LexTerm : •Λ<~> char_lit «"."» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"."» + LexTerm : •regDefId «"."» + LexTerm : •Λ<[> Π Λ<]> «"."» + LexTerm : •Λ<{> Π Λ<}> «"."» + LexTerm : •Λ<(> Π Λ<)> «"."» + LexTerm : •Λ<.> «"["» + LexTerm : •char_lit «"["» + LexTerm : •char_lit Λ<-> char_lit «"["» + LexTerm : •Λ<~> char_lit «"["» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"["» + LexTerm : •regDefId «"["» + LexTerm : •Λ<[> Π Λ<]> «"["» + LexTerm : •Λ<{> Π Λ<}> «"["» + LexTerm : •Λ<(> Π Λ<)> «"["» + LexTerm : •Λ<.> «char_lit» LexTerm : •char_lit «char_lit» - LexTerm : •char_lit - char_lit «char_lit» - LexTerm : •~ char_lit «char_lit» - LexTerm : •~ ( char_lit - char_lit ) «char_lit» + LexTerm : •char_lit Λ<-> char_lit «char_lit» + LexTerm : •Λ<~> char_lit «char_lit» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «char_lit» LexTerm : •regDefId «char_lit» - LexTerm : •[ LexPattern ] «char_lit» - LexTerm : •{ LexPattern } «char_lit» - LexTerm : •( LexPattern ) «char_lit» - LexTerm : •. «regDefId» + LexTerm : •Λ<[> Π Λ<]> «char_lit» + LexTerm : •Λ<{> Π Λ<}> «char_lit» + LexTerm : •Λ<(> Π Λ<)> «char_lit» + LexTerm : •Λ<.> «regDefId» LexTerm : •char_lit «regDefId» - LexTerm : •char_lit - char_lit «regDefId» - LexTerm : •~ char_lit «regDefId» - LexTerm : •~ ( char_lit - char_lit ) «regDefId» + LexTerm : •char_lit Λ<-> char_lit «regDefId» + LexTerm : •Λ<~> char_lit «regDefId» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «regDefId» LexTerm : •regDefId «regDefId» - LexTerm : •[ LexPattern ] «regDefId» - LexTerm : •{ LexPattern } «regDefId» - LexTerm : •( LexPattern ) «regDefId» - LexTerm : •. «{» - LexTerm : •char_lit «{» - LexTerm : •char_lit - char_lit «{» - LexTerm : •~ char_lit «{» - LexTerm : •~ ( char_lit - char_lit ) «{» - LexTerm : •regDefId «{» - LexTerm : •[ LexPattern ] «{» - LexTerm : •{ LexPattern } «{» - LexTerm : •( LexPattern ) «{» - LexTerm : •. «~» - LexTerm : •char_lit «~» - LexTerm : •char_lit - char_lit «~» - LexTerm : •~ char_lit «~» - LexTerm : •~ ( char_lit - char_lit ) «~» - LexTerm : •regDefId «~» - LexTerm : •[ LexPattern ] «~» - LexTerm : •{ LexPattern } «~» - LexTerm : •( LexPattern ) «~» - LexTerm : •. «|» - LexTerm : •char_lit «|» - LexTerm : •char_lit - char_lit «|» - LexTerm : •~ char_lit «|» - LexTerm : •~ ( char_lit - char_lit ) «|» - LexTerm : •regDefId «|» - LexTerm : •[ LexPattern ] «|» - LexTerm : •{ LexPattern } «|» - LexTerm : •( LexPattern ) «|» -} -Transitions: - LexAlt -> 23 - LexTerm -> 24 + LexTerm : •Λ<[> Π Λ<]> «regDefId» + LexTerm : •Λ<{> Π Λ<}> «regDefId» + LexTerm : •Λ<(> Π Λ<)> «regDefId» + LexTerm : •Λ<.> «"{"» + LexTerm : •char_lit «"{"» + LexTerm : •char_lit Λ<-> char_lit «"{"» + LexTerm : •Λ<~> char_lit «"{"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"{"» + LexTerm : •regDefId «"{"» + LexTerm : •Λ<[> Π Λ<]> «"{"» + LexTerm : •Λ<{> Π Λ<}> «"{"» + LexTerm : •Λ<(> Π Λ<)> «"{"» + LexTerm : •Λ<.> «"~"» + LexTerm : •char_lit «"~"» + LexTerm : •char_lit Λ<-> char_lit «"~"» + LexTerm : •Λ<~> char_lit «"~"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"~"» + LexTerm : •regDefId «"~"» + LexTerm : •Λ<[> Π Λ<]> «"~"» + LexTerm : •Λ<{> Π Λ<}> «"~"» + LexTerm : •Λ<(> Π Λ<)> «"~"» + LexTerm : •Λ<.> «"|"» + LexTerm : •char_lit «"|"» + LexTerm : •char_lit Λ<-> char_lit «"|"» + LexTerm : •Λ<~> char_lit «"|"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"|"» + LexTerm : •regDefId «"|"» + LexTerm : •Λ<[> Π Λ<]> «"|"» + LexTerm : •Λ<{> Π Λ<}> «"|"» + LexTerm : •Λ<(> Π Λ<)> «"|"» +} +Transitions: + Π -> 23 + Π -> 24 regDefId -> 25 - . -> 26 + Λ<.> -> 26 char_lit -> 27 - ~ -> 28 - ( -> 29 - [ -> 30 - { -> 31 - LexPattern -> 33 + Λ<~> -> 28 + Λ<(> -> 29 + Λ<[> -> 30 + Λ<{> -> 31 + Π -> 33 S21{ - SyntaxProduction : prodId : •Alternatives ; «Ω» - SyntaxProduction : prodId : •Alternatives ; «prodId» - Alternatives : •SyntaxBody «;» - Alternatives : •Alternatives | SyntaxBody «;» - SyntaxBody : •Symbols «;» - SyntaxBody : •Symbols g_sdt_lit «;» - SyntaxBody : •ErrorSymbol «;» - SyntaxBody : •ErrorSymbol Symbols «;» - SyntaxBody : •ErrorSymbol Symbols g_sdt_lit «;» - SyntaxBody : •ErrorSymbol g_sdt_lit «;» - SyntaxBody : •EpsilonSymbol «;» - Alternatives : •SyntaxBody «|» - Alternatives : •Alternatives | SyntaxBody «|» - Symbols : •Symbol «;» - Symbols : •Symbols Symbol «;» - Symbols : •Symbol «g_sdt_lit» - Symbols : •Symbols Symbol «g_sdt_lit» - ErrorSymbol : •error «;» - ErrorSymbol : •λ «;» - ErrorSymbol : •error «prodId» - ErrorSymbol : •error «string_lit» - ErrorSymbol : •error «tokId» - ErrorSymbol : •λ «prodId» - ErrorSymbol : •λ «string_lit» - ErrorSymbol : •λ «tokId» - ErrorSymbol : •error «g_sdt_lit» - ErrorSymbol : •λ «g_sdt_lit» - EpsilonSymbol : •empty «;» - EpsilonSymbol : •ε «;» - SyntaxBody : •Symbols «|» - SyntaxBody : •Symbols g_sdt_lit «|» - SyntaxBody : •ErrorSymbol «|» - SyntaxBody : •ErrorSymbol Symbols «|» - SyntaxBody : •ErrorSymbol Symbols g_sdt_lit «|» - SyntaxBody : •ErrorSymbol g_sdt_lit «|» - SyntaxBody : •EpsilonSymbol «|» - Symbol : •prodId «;» - Symbol : •tokId «;» - Symbol : •string_lit «;» - Symbols : •Symbol «prodId» - Symbols : •Symbol «string_lit» - Symbols : •Symbol «tokId» - Symbols : •Symbols Symbol «prodId» - Symbols : •Symbols Symbol «string_lit» - Symbols : •Symbols Symbol «tokId» + SyntaxProduction : prodId Λ<:> •Π Λ<;> «Ω» + SyntaxProduction : prodId Λ<:> •Π Λ<;> «prodId» + Alternatives : •Π «";"» + Alternatives : •Π Λ<|> Π «";"» + SyntaxBody : •Π «";"» + SyntaxBody : •Π g_sdt_lit «";"» + SyntaxBody : •Π «";"» + SyntaxBody : •Π Π «";"» + SyntaxBody : •Π Π g_sdt_lit «";"» + SyntaxBody : •Π g_sdt_lit «";"» + SyntaxBody : •Π «";"» + Alternatives : •Π «"|"» + Alternatives : •Π Λ<|> Π «"|"» + Symbols : •Π «";"» + Symbols : •Π Π «";"» + Symbols : •Π «g_sdt_lit» + Symbols : •Π Π «g_sdt_lit» + ErrorSymbol : •Λ «";"» + ErrorSymbol : •Λ<λ> «";"» + ErrorSymbol : •Λ «prodId» + ErrorSymbol : •Λ «string_lit» + ErrorSymbol : •Λ «tokId» + ErrorSymbol : •Λ<λ> «prodId» + ErrorSymbol : •Λ<λ> «string_lit» + ErrorSymbol : •Λ<λ> «tokId» + ErrorSymbol : •Λ «g_sdt_lit» + ErrorSymbol : •Λ<λ> «g_sdt_lit» + EpsilonSymbol : •Λ «";"» + EpsilonSymbol : •Λ<ε> «";"» + SyntaxBody : •Π «"|"» + SyntaxBody : •Π g_sdt_lit «"|"» + SyntaxBody : •Π «"|"» + SyntaxBody : •Π Π «"|"» + SyntaxBody : •Π Π g_sdt_lit «"|"» + SyntaxBody : •Π g_sdt_lit «"|"» + SyntaxBody : •Π «"|"» + Symbol : •prodId «";"» + Symbol : •tokId «";"» + Symbol : •string_lit «";"» + Symbols : •Π «prodId» + Symbols : •Π «string_lit» + Symbols : •Π «tokId» + Symbols : •Π Π «prodId» + Symbols : •Π Π «string_lit» + Symbols : •Π Π «tokId» Symbol : •prodId «g_sdt_lit» Symbol : •tokId «g_sdt_lit» Symbol : •string_lit «g_sdt_lit» - Symbols : •Symbol «|» - Symbols : •Symbols Symbol «|» - ErrorSymbol : •error «|» - ErrorSymbol : •λ «|» - EpsilonSymbol : •empty «|» - EpsilonSymbol : •ε «|» + Symbols : •Π «"|"» + Symbols : •Π Π «"|"» + ErrorSymbol : •Λ «"|"» + ErrorSymbol : •Λ<λ> «"|"» + EpsilonSymbol : •Λ «"|"» + EpsilonSymbol : •Λ<ε> «"|"» Symbol : •prodId «prodId» Symbol : •tokId «prodId» Symbol : •string_lit «prodId» @@ -699,680 +699,680 @@ S21{ Symbol : •prodId «tokId» Symbol : •tokId «tokId» Symbol : •string_lit «tokId» - Symbol : •prodId «|» - Symbol : •tokId «|» - Symbol : •string_lit «|» + Symbol : •prodId «"|"» + Symbol : •tokId «"|"» + Symbol : •string_lit «"|"» } Transitions: - Alternatives -> 34 - SyntaxBody -> 35 - Symbols -> 36 - Symbol -> 37 - ErrorSymbol -> 38 - EpsilonSymbol -> 39 + Π -> 34 + Π -> 35 + Π -> 36 + Π -> 37 + Π -> 38 + Π -> 39 tokId -> 40 prodId -> 41 string_lit -> 42 - error -> 43 - λ -> 44 - empty -> 45 - ε -> 46 + Λ -> 43 + Λ<λ> -> 44 + Λ -> 45 + Λ<ε> -> 46 S22{ - LexProduction : tokId : LexPattern •; «g_sdt_lit» - LexProduction : tokId : LexPattern •; «prodId» - LexProduction : tokId : LexPattern •; «Ω» - LexProduction : tokId : LexPattern •; «ignoredTokId» - LexProduction : tokId : LexPattern •; «regDefId» - LexProduction : tokId : LexPattern •; «tokId» - LexPattern : LexPattern •| LexAlt «;» - LexPattern : LexPattern •| LexAlt «|» + LexProduction : tokId Λ<:> Π •Λ<;> «g_sdt_lit» + LexProduction : tokId Λ<:> Π •Λ<;> «prodId» + LexProduction : tokId Λ<:> Π •Λ<;> «Ω» + LexProduction : tokId Λ<:> Π •Λ<;> «ignoredTokId» + LexProduction : tokId Λ<:> Π •Λ<;> «regDefId» + LexProduction : tokId Λ<:> Π •Λ<;> «tokId» + LexPattern : Π •Λ<|> Π «";"» + LexPattern : Π •Λ<|> Π «"|"» } Transitions: - ; -> 47 - | -> 48 + Λ<;> -> 47 + Λ<|> -> 48 S23{ - LexPattern : LexAlt• «;» - LexAlt : LexAlt •LexTerm «;» - LexPattern : LexAlt• «|» - LexAlt : LexAlt •LexTerm «(» - LexAlt : LexAlt •LexTerm «.» - LexAlt : LexAlt •LexTerm «[» - LexAlt : LexAlt •LexTerm «char_lit» - LexAlt : LexAlt •LexTerm «regDefId» - LexAlt : LexAlt •LexTerm «{» - LexAlt : LexAlt •LexTerm «~» - LexAlt : LexAlt •LexTerm «|» - LexTerm : •. «;» - LexTerm : •char_lit «;» - LexTerm : •char_lit - char_lit «;» - LexTerm : •~ char_lit «;» - LexTerm : •~ ( char_lit - char_lit ) «;» - LexTerm : •regDefId «;» - LexTerm : •[ LexPattern ] «;» - LexTerm : •{ LexPattern } «;» - LexTerm : •( LexPattern ) «;» - LexTerm : •. «(» - LexTerm : •char_lit «(» - LexTerm : •char_lit - char_lit «(» - LexTerm : •~ char_lit «(» - LexTerm : •~ ( char_lit - char_lit ) «(» - LexTerm : •regDefId «(» - LexTerm : •[ LexPattern ] «(» - LexTerm : •{ LexPattern } «(» - LexTerm : •( LexPattern ) «(» - LexTerm : •. «.» - LexTerm : •char_lit «.» - LexTerm : •char_lit - char_lit «.» - LexTerm : •~ char_lit «.» - LexTerm : •~ ( char_lit - char_lit ) «.» - LexTerm : •regDefId «.» - LexTerm : •[ LexPattern ] «.» - LexTerm : •{ LexPattern } «.» - LexTerm : •( LexPattern ) «.» - LexTerm : •. «[» - LexTerm : •char_lit «[» - LexTerm : •char_lit - char_lit «[» - LexTerm : •~ char_lit «[» - LexTerm : •~ ( char_lit - char_lit ) «[» - LexTerm : •regDefId «[» - LexTerm : •[ LexPattern ] «[» - LexTerm : •{ LexPattern } «[» - LexTerm : •( LexPattern ) «[» - LexTerm : •. «char_lit» + LexPattern : Π• «";"» + LexAlt : Π •Π «";"» + LexPattern : Π• «"|"» + LexAlt : Π •Π «"("» + LexAlt : Π •Π «"."» + LexAlt : Π •Π «"["» + LexAlt : Π •Π «char_lit» + LexAlt : Π •Π «regDefId» + LexAlt : Π •Π «"{"» + LexAlt : Π •Π «"~"» + LexAlt : Π •Π «"|"» + LexTerm : •Λ<.> «";"» + LexTerm : •char_lit «";"» + LexTerm : •char_lit Λ<-> char_lit «";"» + LexTerm : •Λ<~> char_lit «";"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «";"» + LexTerm : •regDefId «";"» + LexTerm : •Λ<[> Π Λ<]> «";"» + LexTerm : •Λ<{> Π Λ<}> «";"» + LexTerm : •Λ<(> Π Λ<)> «";"» + LexTerm : •Λ<.> «"("» + LexTerm : •char_lit «"("» + LexTerm : •char_lit Λ<-> char_lit «"("» + LexTerm : •Λ<~> char_lit «"("» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"("» + LexTerm : •regDefId «"("» + LexTerm : •Λ<[> Π Λ<]> «"("» + LexTerm : •Λ<{> Π Λ<}> «"("» + LexTerm : •Λ<(> Π Λ<)> «"("» + LexTerm : •Λ<.> «"."» + LexTerm : •char_lit «"."» + LexTerm : •char_lit Λ<-> char_lit «"."» + LexTerm : •Λ<~> char_lit «"."» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"."» + LexTerm : •regDefId «"."» + LexTerm : •Λ<[> Π Λ<]> «"."» + LexTerm : •Λ<{> Π Λ<}> «"."» + LexTerm : •Λ<(> Π Λ<)> «"."» + LexTerm : •Λ<.> «"["» + LexTerm : •char_lit «"["» + LexTerm : •char_lit Λ<-> char_lit «"["» + LexTerm : •Λ<~> char_lit «"["» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"["» + LexTerm : •regDefId «"["» + LexTerm : •Λ<[> Π Λ<]> «"["» + LexTerm : •Λ<{> Π Λ<}> «"["» + LexTerm : •Λ<(> Π Λ<)> «"["» + LexTerm : •Λ<.> «char_lit» LexTerm : •char_lit «char_lit» - LexTerm : •char_lit - char_lit «char_lit» - LexTerm : •~ char_lit «char_lit» - LexTerm : •~ ( char_lit - char_lit ) «char_lit» + LexTerm : •char_lit Λ<-> char_lit «char_lit» + LexTerm : •Λ<~> char_lit «char_lit» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «char_lit» LexTerm : •regDefId «char_lit» - LexTerm : •[ LexPattern ] «char_lit» - LexTerm : •{ LexPattern } «char_lit» - LexTerm : •( LexPattern ) «char_lit» - LexTerm : •. «regDefId» + LexTerm : •Λ<[> Π Λ<]> «char_lit» + LexTerm : •Λ<{> Π Λ<}> «char_lit» + LexTerm : •Λ<(> Π Λ<)> «char_lit» + LexTerm : •Λ<.> «regDefId» LexTerm : •char_lit «regDefId» - LexTerm : •char_lit - char_lit «regDefId» - LexTerm : •~ char_lit «regDefId» - LexTerm : •~ ( char_lit - char_lit ) «regDefId» + LexTerm : •char_lit Λ<-> char_lit «regDefId» + LexTerm : •Λ<~> char_lit «regDefId» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «regDefId» LexTerm : •regDefId «regDefId» - LexTerm : •[ LexPattern ] «regDefId» - LexTerm : •{ LexPattern } «regDefId» - LexTerm : •( LexPattern ) «regDefId» - LexTerm : •. «{» - LexTerm : •char_lit «{» - LexTerm : •char_lit - char_lit «{» - LexTerm : •~ char_lit «{» - LexTerm : •~ ( char_lit - char_lit ) «{» - LexTerm : •regDefId «{» - LexTerm : •[ LexPattern ] «{» - LexTerm : •{ LexPattern } «{» - LexTerm : •( LexPattern ) «{» - LexTerm : •. «~» - LexTerm : •char_lit «~» - LexTerm : •char_lit - char_lit «~» - LexTerm : •~ char_lit «~» - LexTerm : •~ ( char_lit - char_lit ) «~» - LexTerm : •regDefId «~» - LexTerm : •[ LexPattern ] «~» - LexTerm : •{ LexPattern } «~» - LexTerm : •( LexPattern ) «~» - LexTerm : •. «|» - LexTerm : •char_lit «|» - LexTerm : •char_lit - char_lit «|» - LexTerm : •~ char_lit «|» - LexTerm : •~ ( char_lit - char_lit ) «|» - LexTerm : •regDefId «|» - LexTerm : •[ LexPattern ] «|» - LexTerm : •{ LexPattern } «|» - LexTerm : •( LexPattern ) «|» + LexTerm : •Λ<[> Π Λ<]> «regDefId» + LexTerm : •Λ<{> Π Λ<}> «regDefId» + LexTerm : •Λ<(> Π Λ<)> «regDefId» + LexTerm : •Λ<.> «"{"» + LexTerm : •char_lit «"{"» + LexTerm : •char_lit Λ<-> char_lit «"{"» + LexTerm : •Λ<~> char_lit «"{"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"{"» + LexTerm : •regDefId «"{"» + LexTerm : •Λ<[> Π Λ<]> «"{"» + LexTerm : •Λ<{> Π Λ<}> «"{"» + LexTerm : •Λ<(> Π Λ<)> «"{"» + LexTerm : •Λ<.> «"~"» + LexTerm : •char_lit «"~"» + LexTerm : •char_lit Λ<-> char_lit «"~"» + LexTerm : •Λ<~> char_lit «"~"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"~"» + LexTerm : •regDefId «"~"» + LexTerm : •Λ<[> Π Λ<]> «"~"» + LexTerm : •Λ<{> Π Λ<}> «"~"» + LexTerm : •Λ<(> Π Λ<)> «"~"» + LexTerm : •Λ<.> «"|"» + LexTerm : •char_lit «"|"» + LexTerm : •char_lit Λ<-> char_lit «"|"» + LexTerm : •Λ<~> char_lit «"|"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"|"» + LexTerm : •regDefId «"|"» + LexTerm : •Λ<[> Π Λ<]> «"|"» + LexTerm : •Λ<{> Π Λ<}> «"|"» + LexTerm : •Λ<(> Π Λ<)> «"|"» } Transitions: regDefId -> 25 - . -> 26 + Λ<.> -> 26 char_lit -> 27 - ~ -> 28 - ( -> 29 - [ -> 30 - { -> 31 - LexTerm -> 49 + Λ<~> -> 28 + Λ<(> -> 29 + Λ<[> -> 30 + Λ<{> -> 31 + Π -> 49 S24{ - LexAlt : LexTerm• «;» - LexAlt : LexTerm• «(» - LexAlt : LexTerm• «.» - LexAlt : LexTerm• «[» - LexAlt : LexTerm• «char_lit» - LexAlt : LexTerm• «regDefId» - LexAlt : LexTerm• «{» - LexAlt : LexTerm• «~» - LexAlt : LexTerm• «|» + LexAlt : Π• «";"» + LexAlt : Π• «"("» + LexAlt : Π• «"."» + LexAlt : Π• «"["» + LexAlt : Π• «char_lit» + LexAlt : Π• «regDefId» + LexAlt : Π• «"{"» + LexAlt : Π• «"~"» + LexAlt : Π• «"|"» } Transitions: S25{ - LexTerm : regDefId• «;» - LexTerm : regDefId• «(» - LexTerm : regDefId• «.» - LexTerm : regDefId• «[» + LexTerm : regDefId• «";"» + LexTerm : regDefId• «"("» + LexTerm : regDefId• «"."» + LexTerm : regDefId• «"["» LexTerm : regDefId• «char_lit» LexTerm : regDefId• «regDefId» - LexTerm : regDefId• «{» - LexTerm : regDefId• «~» - LexTerm : regDefId• «|» + LexTerm : regDefId• «"{"» + LexTerm : regDefId• «"~"» + LexTerm : regDefId• «"|"» } Transitions: S26{ - LexTerm : .• «;» - LexTerm : .• «(» - LexTerm : .• «.» - LexTerm : .• «[» - LexTerm : .• «char_lit» - LexTerm : .• «regDefId» - LexTerm : .• «{» - LexTerm : .• «~» - LexTerm : .• «|» + LexTerm : Λ<.>• «";"» + LexTerm : Λ<.>• «"("» + LexTerm : Λ<.>• «"."» + LexTerm : Λ<.>• «"["» + LexTerm : Λ<.>• «char_lit» + LexTerm : Λ<.>• «regDefId» + LexTerm : Λ<.>• «"{"» + LexTerm : Λ<.>• «"~"» + LexTerm : Λ<.>• «"|"» } Transitions: S27{ - LexTerm : char_lit• «;» - LexTerm : char_lit •- char_lit «;» - LexTerm : char_lit• «(» - LexTerm : char_lit •- char_lit «(» - LexTerm : char_lit• «.» - LexTerm : char_lit •- char_lit «.» - LexTerm : char_lit• «[» - LexTerm : char_lit •- char_lit «[» + LexTerm : char_lit• «";"» + LexTerm : char_lit •Λ<-> char_lit «";"» + LexTerm : char_lit• «"("» + LexTerm : char_lit •Λ<-> char_lit «"("» + LexTerm : char_lit• «"."» + LexTerm : char_lit •Λ<-> char_lit «"."» + LexTerm : char_lit• «"["» + LexTerm : char_lit •Λ<-> char_lit «"["» LexTerm : char_lit• «char_lit» - LexTerm : char_lit •- char_lit «char_lit» + LexTerm : char_lit •Λ<-> char_lit «char_lit» LexTerm : char_lit• «regDefId» - LexTerm : char_lit •- char_lit «regDefId» - LexTerm : char_lit• «{» - LexTerm : char_lit •- char_lit «{» - LexTerm : char_lit• «~» - LexTerm : char_lit •- char_lit «~» - LexTerm : char_lit• «|» - LexTerm : char_lit •- char_lit «|» + LexTerm : char_lit •Λ<-> char_lit «regDefId» + LexTerm : char_lit• «"{"» + LexTerm : char_lit •Λ<-> char_lit «"{"» + LexTerm : char_lit• «"~"» + LexTerm : char_lit •Λ<-> char_lit «"~"» + LexTerm : char_lit• «"|"» + LexTerm : char_lit •Λ<-> char_lit «"|"» } Transitions: - - -> 50 + Λ<-> -> 50 S28{ - LexTerm : ~ •char_lit «;» - LexTerm : ~ •( char_lit - char_lit ) «;» - LexTerm : ~ •char_lit «(» - LexTerm : ~ •( char_lit - char_lit ) «(» - LexTerm : ~ •char_lit «.» - LexTerm : ~ •( char_lit - char_lit ) «.» - LexTerm : ~ •char_lit «[» - LexTerm : ~ •( char_lit - char_lit ) «[» - LexTerm : ~ •char_lit «char_lit» - LexTerm : ~ •( char_lit - char_lit ) «char_lit» - LexTerm : ~ •char_lit «regDefId» - LexTerm : ~ •( char_lit - char_lit ) «regDefId» - LexTerm : ~ •char_lit «{» - LexTerm : ~ •( char_lit - char_lit ) «{» - LexTerm : ~ •char_lit «~» - LexTerm : ~ •( char_lit - char_lit ) «~» - LexTerm : ~ •char_lit «|» - LexTerm : ~ •( char_lit - char_lit ) «|» + LexTerm : Λ<~> •char_lit «";"» + LexTerm : Λ<~> •Λ<(> char_lit Λ<-> char_lit Λ<)> «";"» + LexTerm : Λ<~> •char_lit «"("» + LexTerm : Λ<~> •Λ<(> char_lit Λ<-> char_lit Λ<)> «"("» + LexTerm : Λ<~> •char_lit «"."» + LexTerm : Λ<~> •Λ<(> char_lit Λ<-> char_lit Λ<)> «"."» + LexTerm : Λ<~> •char_lit «"["» + LexTerm : Λ<~> •Λ<(> char_lit Λ<-> char_lit Λ<)> «"["» + LexTerm : Λ<~> •char_lit «char_lit» + LexTerm : Λ<~> •Λ<(> char_lit Λ<-> char_lit Λ<)> «char_lit» + LexTerm : Λ<~> •char_lit «regDefId» + LexTerm : Λ<~> •Λ<(> char_lit Λ<-> char_lit Λ<)> «regDefId» + LexTerm : Λ<~> •char_lit «"{"» + LexTerm : Λ<~> •Λ<(> char_lit Λ<-> char_lit Λ<)> «"{"» + LexTerm : Λ<~> •char_lit «"~"» + LexTerm : Λ<~> •Λ<(> char_lit Λ<-> char_lit Λ<)> «"~"» + LexTerm : Λ<~> •char_lit «"|"» + LexTerm : Λ<~> •Λ<(> char_lit Λ<-> char_lit Λ<)> «"|"» } Transitions: char_lit -> 51 - ( -> 52 + Λ<(> -> 52 S29{ - LexTerm : ( •LexPattern ) «;» - LexTerm : ( •LexPattern ) «(» - LexTerm : ( •LexPattern ) «.» - LexTerm : ( •LexPattern ) «[» - LexTerm : ( •LexPattern ) «char_lit» - LexTerm : ( •LexPattern ) «regDefId» - LexTerm : ( •LexPattern ) «{» - LexTerm : ( •LexPattern ) «~» - LexTerm : ( •LexPattern ) «|» - LexPattern : •LexAlt «)» - LexPattern : •LexPattern | LexAlt «)» - LexAlt : •LexTerm «)» - LexAlt : •LexAlt LexTerm «)» - LexPattern : •LexAlt «|» - LexPattern : •LexPattern | LexAlt «|» - LexTerm : •. «)» - LexTerm : •char_lit «)» - LexTerm : •char_lit - char_lit «)» - LexTerm : •~ char_lit «)» - LexTerm : •~ ( char_lit - char_lit ) «)» - LexTerm : •regDefId «)» - LexTerm : •[ LexPattern ] «)» - LexTerm : •{ LexPattern } «)» - LexTerm : •( LexPattern ) «)» - LexAlt : •LexTerm «(» - LexAlt : •LexTerm «.» - LexAlt : •LexTerm «[» - LexAlt : •LexTerm «char_lit» - LexAlt : •LexTerm «regDefId» - LexAlt : •LexTerm «{» - LexAlt : •LexTerm «~» - LexAlt : •LexAlt LexTerm «(» - LexAlt : •LexAlt LexTerm «.» - LexAlt : •LexAlt LexTerm «[» - LexAlt : •LexAlt LexTerm «char_lit» - LexAlt : •LexAlt LexTerm «regDefId» - LexAlt : •LexAlt LexTerm «{» - LexAlt : •LexAlt LexTerm «~» - LexAlt : •LexTerm «|» - LexAlt : •LexAlt LexTerm «|» - LexTerm : •. «(» - LexTerm : •char_lit «(» - LexTerm : •char_lit - char_lit «(» - LexTerm : •~ char_lit «(» - LexTerm : •~ ( char_lit - char_lit ) «(» - LexTerm : •regDefId «(» - LexTerm : •[ LexPattern ] «(» - LexTerm : •{ LexPattern } «(» - LexTerm : •( LexPattern ) «(» - LexTerm : •. «.» - LexTerm : •char_lit «.» - LexTerm : •char_lit - char_lit «.» - LexTerm : •~ char_lit «.» - LexTerm : •~ ( char_lit - char_lit ) «.» - LexTerm : •regDefId «.» - LexTerm : •[ LexPattern ] «.» - LexTerm : •{ LexPattern } «.» - LexTerm : •( LexPattern ) «.» - LexTerm : •. «[» - LexTerm : •char_lit «[» - LexTerm : •char_lit - char_lit «[» - LexTerm : •~ char_lit «[» - LexTerm : •~ ( char_lit - char_lit ) «[» - LexTerm : •regDefId «[» - LexTerm : •[ LexPattern ] «[» - LexTerm : •{ LexPattern } «[» - LexTerm : •( LexPattern ) «[» - LexTerm : •. «char_lit» + LexTerm : Λ<(> •Π Λ<)> «";"» + LexTerm : Λ<(> •Π Λ<)> «"("» + LexTerm : Λ<(> •Π Λ<)> «"."» + LexTerm : Λ<(> •Π Λ<)> «"["» + LexTerm : Λ<(> •Π Λ<)> «char_lit» + LexTerm : Λ<(> •Π Λ<)> «regDefId» + LexTerm : Λ<(> •Π Λ<)> «"{"» + LexTerm : Λ<(> •Π Λ<)> «"~"» + LexTerm : Λ<(> •Π Λ<)> «"|"» + LexPattern : •Π «")"» + LexPattern : •Π Λ<|> Π «")"» + LexAlt : •Π «")"» + LexAlt : •Π Π «")"» + LexPattern : •Π «"|"» + LexPattern : •Π Λ<|> Π «"|"» + LexTerm : •Λ<.> «")"» + LexTerm : •char_lit «")"» + LexTerm : •char_lit Λ<-> char_lit «")"» + LexTerm : •Λ<~> char_lit «")"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «")"» + LexTerm : •regDefId «")"» + LexTerm : •Λ<[> Π Λ<]> «")"» + LexTerm : •Λ<{> Π Λ<}> «")"» + LexTerm : •Λ<(> Π Λ<)> «")"» + LexAlt : •Π «"("» + LexAlt : •Π «"."» + LexAlt : •Π «"["» + LexAlt : •Π «char_lit» + LexAlt : •Π «regDefId» + LexAlt : •Π «"{"» + LexAlt : •Π «"~"» + LexAlt : •Π Π «"("» + LexAlt : •Π Π «"."» + LexAlt : •Π Π «"["» + LexAlt : •Π Π «char_lit» + LexAlt : •Π Π «regDefId» + LexAlt : •Π Π «"{"» + LexAlt : •Π Π «"~"» + LexAlt : •Π «"|"» + LexAlt : •Π Π «"|"» + LexTerm : •Λ<.> «"("» + LexTerm : •char_lit «"("» + LexTerm : •char_lit Λ<-> char_lit «"("» + LexTerm : •Λ<~> char_lit «"("» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"("» + LexTerm : •regDefId «"("» + LexTerm : •Λ<[> Π Λ<]> «"("» + LexTerm : •Λ<{> Π Λ<}> «"("» + LexTerm : •Λ<(> Π Λ<)> «"("» + LexTerm : •Λ<.> «"."» + LexTerm : •char_lit «"."» + LexTerm : •char_lit Λ<-> char_lit «"."» + LexTerm : •Λ<~> char_lit «"."» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"."» + LexTerm : •regDefId «"."» + LexTerm : •Λ<[> Π Λ<]> «"."» + LexTerm : •Λ<{> Π Λ<}> «"."» + LexTerm : •Λ<(> Π Λ<)> «"."» + LexTerm : •Λ<.> «"["» + LexTerm : •char_lit «"["» + LexTerm : •char_lit Λ<-> char_lit «"["» + LexTerm : •Λ<~> char_lit «"["» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"["» + LexTerm : •regDefId «"["» + LexTerm : •Λ<[> Π Λ<]> «"["» + LexTerm : •Λ<{> Π Λ<}> «"["» + LexTerm : •Λ<(> Π Λ<)> «"["» + LexTerm : •Λ<.> «char_lit» LexTerm : •char_lit «char_lit» - LexTerm : •char_lit - char_lit «char_lit» - LexTerm : •~ char_lit «char_lit» - LexTerm : •~ ( char_lit - char_lit ) «char_lit» + LexTerm : •char_lit Λ<-> char_lit «char_lit» + LexTerm : •Λ<~> char_lit «char_lit» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «char_lit» LexTerm : •regDefId «char_lit» - LexTerm : •[ LexPattern ] «char_lit» - LexTerm : •{ LexPattern } «char_lit» - LexTerm : •( LexPattern ) «char_lit» - LexTerm : •. «regDefId» + LexTerm : •Λ<[> Π Λ<]> «char_lit» + LexTerm : •Λ<{> Π Λ<}> «char_lit» + LexTerm : •Λ<(> Π Λ<)> «char_lit» + LexTerm : •Λ<.> «regDefId» LexTerm : •char_lit «regDefId» - LexTerm : •char_lit - char_lit «regDefId» - LexTerm : •~ char_lit «regDefId» - LexTerm : •~ ( char_lit - char_lit ) «regDefId» + LexTerm : •char_lit Λ<-> char_lit «regDefId» + LexTerm : •Λ<~> char_lit «regDefId» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «regDefId» LexTerm : •regDefId «regDefId» - LexTerm : •[ LexPattern ] «regDefId» - LexTerm : •{ LexPattern } «regDefId» - LexTerm : •( LexPattern ) «regDefId» - LexTerm : •. «{» - LexTerm : •char_lit «{» - LexTerm : •char_lit - char_lit «{» - LexTerm : •~ char_lit «{» - LexTerm : •~ ( char_lit - char_lit ) «{» - LexTerm : •regDefId «{» - LexTerm : •[ LexPattern ] «{» - LexTerm : •{ LexPattern } «{» - LexTerm : •( LexPattern ) «{» - LexTerm : •. «~» - LexTerm : •char_lit «~» - LexTerm : •char_lit - char_lit «~» - LexTerm : •~ char_lit «~» - LexTerm : •~ ( char_lit - char_lit ) «~» - LexTerm : •regDefId «~» - LexTerm : •[ LexPattern ] «~» - LexTerm : •{ LexPattern } «~» - LexTerm : •( LexPattern ) «~» - LexTerm : •. «|» - LexTerm : •char_lit «|» - LexTerm : •char_lit - char_lit «|» - LexTerm : •~ char_lit «|» - LexTerm : •~ ( char_lit - char_lit ) «|» - LexTerm : •regDefId «|» - LexTerm : •[ LexPattern ] «|» - LexTerm : •{ LexPattern } «|» - LexTerm : •( LexPattern ) «|» -} -Transitions: - LexPattern -> 53 - LexAlt -> 54 - LexTerm -> 55 + LexTerm : •Λ<[> Π Λ<]> «regDefId» + LexTerm : •Λ<{> Π Λ<}> «regDefId» + LexTerm : •Λ<(> Π Λ<)> «regDefId» + LexTerm : •Λ<.> «"{"» + LexTerm : •char_lit «"{"» + LexTerm : •char_lit Λ<-> char_lit «"{"» + LexTerm : •Λ<~> char_lit «"{"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"{"» + LexTerm : •regDefId «"{"» + LexTerm : •Λ<[> Π Λ<]> «"{"» + LexTerm : •Λ<{> Π Λ<}> «"{"» + LexTerm : •Λ<(> Π Λ<)> «"{"» + LexTerm : •Λ<.> «"~"» + LexTerm : •char_lit «"~"» + LexTerm : •char_lit Λ<-> char_lit «"~"» + LexTerm : •Λ<~> char_lit «"~"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"~"» + LexTerm : •regDefId «"~"» + LexTerm : •Λ<[> Π Λ<]> «"~"» + LexTerm : •Λ<{> Π Λ<}> «"~"» + LexTerm : •Λ<(> Π Λ<)> «"~"» + LexTerm : •Λ<.> «"|"» + LexTerm : •char_lit «"|"» + LexTerm : •char_lit Λ<-> char_lit «"|"» + LexTerm : •Λ<~> char_lit «"|"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"|"» + LexTerm : •regDefId «"|"» + LexTerm : •Λ<[> Π Λ<]> «"|"» + LexTerm : •Λ<{> Π Λ<}> «"|"» + LexTerm : •Λ<(> Π Λ<)> «"|"» +} +Transitions: + Π -> 53 + Π -> 54 + Π -> 55 regDefId -> 56 - . -> 57 + Λ<.> -> 57 char_lit -> 58 - ~ -> 59 - ( -> 60 - [ -> 61 - { -> 62 + Λ<~> -> 59 + Λ<(> -> 60 + Λ<[> -> 61 + Λ<{> -> 62 S30{ - LexTerm : [ •LexPattern ] «;» - LexTerm : [ •LexPattern ] «(» - LexTerm : [ •LexPattern ] «.» - LexTerm : [ •LexPattern ] «[» - LexTerm : [ •LexPattern ] «char_lit» - LexTerm : [ •LexPattern ] «regDefId» - LexTerm : [ •LexPattern ] «{» - LexTerm : [ •LexPattern ] «~» - LexTerm : [ •LexPattern ] «|» - LexPattern : •LexAlt «]» - LexPattern : •LexPattern | LexAlt «]» - LexAlt : •LexTerm «]» - LexAlt : •LexAlt LexTerm «]» - LexPattern : •LexAlt «|» - LexPattern : •LexPattern | LexAlt «|» - LexTerm : •. «]» - LexTerm : •char_lit «]» - LexTerm : •char_lit - char_lit «]» - LexTerm : •~ char_lit «]» - LexTerm : •~ ( char_lit - char_lit ) «]» - LexTerm : •regDefId «]» - LexTerm : •[ LexPattern ] «]» - LexTerm : •{ LexPattern } «]» - LexTerm : •( LexPattern ) «]» - LexAlt : •LexTerm «(» - LexAlt : •LexTerm «.» - LexAlt : •LexTerm «[» - LexAlt : •LexTerm «char_lit» - LexAlt : •LexTerm «regDefId» - LexAlt : •LexTerm «{» - LexAlt : •LexTerm «~» - LexAlt : •LexAlt LexTerm «(» - LexAlt : •LexAlt LexTerm «.» - LexAlt : •LexAlt LexTerm «[» - LexAlt : •LexAlt LexTerm «char_lit» - LexAlt : •LexAlt LexTerm «regDefId» - LexAlt : •LexAlt LexTerm «{» - LexAlt : •LexAlt LexTerm «~» - LexAlt : •LexTerm «|» - LexAlt : •LexAlt LexTerm «|» - LexTerm : •. «(» - LexTerm : •char_lit «(» - LexTerm : •char_lit - char_lit «(» - LexTerm : •~ char_lit «(» - LexTerm : •~ ( char_lit - char_lit ) «(» - LexTerm : •regDefId «(» - LexTerm : •[ LexPattern ] «(» - LexTerm : •{ LexPattern } «(» - LexTerm : •( LexPattern ) «(» - LexTerm : •. «.» - LexTerm : •char_lit «.» - LexTerm : •char_lit - char_lit «.» - LexTerm : •~ char_lit «.» - LexTerm : •~ ( char_lit - char_lit ) «.» - LexTerm : •regDefId «.» - LexTerm : •[ LexPattern ] «.» - LexTerm : •{ LexPattern } «.» - LexTerm : •( LexPattern ) «.» - LexTerm : •. «[» - LexTerm : •char_lit «[» - LexTerm : •char_lit - char_lit «[» - LexTerm : •~ char_lit «[» - LexTerm : •~ ( char_lit - char_lit ) «[» - LexTerm : •regDefId «[» - LexTerm : •[ LexPattern ] «[» - LexTerm : •{ LexPattern } «[» - LexTerm : •( LexPattern ) «[» - LexTerm : •. «char_lit» + LexTerm : Λ<[> •Π Λ<]> «";"» + LexTerm : Λ<[> •Π Λ<]> «"("» + LexTerm : Λ<[> •Π Λ<]> «"."» + LexTerm : Λ<[> •Π Λ<]> «"["» + LexTerm : Λ<[> •Π Λ<]> «char_lit» + LexTerm : Λ<[> •Π Λ<]> «regDefId» + LexTerm : Λ<[> •Π Λ<]> «"{"» + LexTerm : Λ<[> •Π Λ<]> «"~"» + LexTerm : Λ<[> •Π Λ<]> «"|"» + LexPattern : •Π «"]"» + LexPattern : •Π Λ<|> Π «"]"» + LexAlt : •Π «"]"» + LexAlt : •Π Π «"]"» + LexPattern : •Π «"|"» + LexPattern : •Π Λ<|> Π «"|"» + LexTerm : •Λ<.> «"]"» + LexTerm : •char_lit «"]"» + LexTerm : •char_lit Λ<-> char_lit «"]"» + LexTerm : •Λ<~> char_lit «"]"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"]"» + LexTerm : •regDefId «"]"» + LexTerm : •Λ<[> Π Λ<]> «"]"» + LexTerm : •Λ<{> Π Λ<}> «"]"» + LexTerm : •Λ<(> Π Λ<)> «"]"» + LexAlt : •Π «"("» + LexAlt : •Π «"."» + LexAlt : •Π «"["» + LexAlt : •Π «char_lit» + LexAlt : •Π «regDefId» + LexAlt : •Π «"{"» + LexAlt : •Π «"~"» + LexAlt : •Π Π «"("» + LexAlt : •Π Π «"."» + LexAlt : •Π Π «"["» + LexAlt : •Π Π «char_lit» + LexAlt : •Π Π «regDefId» + LexAlt : •Π Π «"{"» + LexAlt : •Π Π «"~"» + LexAlt : •Π «"|"» + LexAlt : •Π Π «"|"» + LexTerm : •Λ<.> «"("» + LexTerm : •char_lit «"("» + LexTerm : •char_lit Λ<-> char_lit «"("» + LexTerm : •Λ<~> char_lit «"("» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"("» + LexTerm : •regDefId «"("» + LexTerm : •Λ<[> Π Λ<]> «"("» + LexTerm : •Λ<{> Π Λ<}> «"("» + LexTerm : •Λ<(> Π Λ<)> «"("» + LexTerm : •Λ<.> «"."» + LexTerm : •char_lit «"."» + LexTerm : •char_lit Λ<-> char_lit «"."» + LexTerm : •Λ<~> char_lit «"."» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"."» + LexTerm : •regDefId «"."» + LexTerm : •Λ<[> Π Λ<]> «"."» + LexTerm : •Λ<{> Π Λ<}> «"."» + LexTerm : •Λ<(> Π Λ<)> «"."» + LexTerm : •Λ<.> «"["» + LexTerm : •char_lit «"["» + LexTerm : •char_lit Λ<-> char_lit «"["» + LexTerm : •Λ<~> char_lit «"["» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"["» + LexTerm : •regDefId «"["» + LexTerm : •Λ<[> Π Λ<]> «"["» + LexTerm : •Λ<{> Π Λ<}> «"["» + LexTerm : •Λ<(> Π Λ<)> «"["» + LexTerm : •Λ<.> «char_lit» LexTerm : •char_lit «char_lit» - LexTerm : •char_lit - char_lit «char_lit» - LexTerm : •~ char_lit «char_lit» - LexTerm : •~ ( char_lit - char_lit ) «char_lit» + LexTerm : •char_lit Λ<-> char_lit «char_lit» + LexTerm : •Λ<~> char_lit «char_lit» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «char_lit» LexTerm : •regDefId «char_lit» - LexTerm : •[ LexPattern ] «char_lit» - LexTerm : •{ LexPattern } «char_lit» - LexTerm : •( LexPattern ) «char_lit» - LexTerm : •. «regDefId» + LexTerm : •Λ<[> Π Λ<]> «char_lit» + LexTerm : •Λ<{> Π Λ<}> «char_lit» + LexTerm : •Λ<(> Π Λ<)> «char_lit» + LexTerm : •Λ<.> «regDefId» LexTerm : •char_lit «regDefId» - LexTerm : •char_lit - char_lit «regDefId» - LexTerm : •~ char_lit «regDefId» - LexTerm : •~ ( char_lit - char_lit ) «regDefId» + LexTerm : •char_lit Λ<-> char_lit «regDefId» + LexTerm : •Λ<~> char_lit «regDefId» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «regDefId» LexTerm : •regDefId «regDefId» - LexTerm : •[ LexPattern ] «regDefId» - LexTerm : •{ LexPattern } «regDefId» - LexTerm : •( LexPattern ) «regDefId» - LexTerm : •. «{» - LexTerm : •char_lit «{» - LexTerm : •char_lit - char_lit «{» - LexTerm : •~ char_lit «{» - LexTerm : •~ ( char_lit - char_lit ) «{» - LexTerm : •regDefId «{» - LexTerm : •[ LexPattern ] «{» - LexTerm : •{ LexPattern } «{» - LexTerm : •( LexPattern ) «{» - LexTerm : •. «~» - LexTerm : •char_lit «~» - LexTerm : •char_lit - char_lit «~» - LexTerm : •~ char_lit «~» - LexTerm : •~ ( char_lit - char_lit ) «~» - LexTerm : •regDefId «~» - LexTerm : •[ LexPattern ] «~» - LexTerm : •{ LexPattern } «~» - LexTerm : •( LexPattern ) «~» - LexTerm : •. «|» - LexTerm : •char_lit «|» - LexTerm : •char_lit - char_lit «|» - LexTerm : •~ char_lit «|» - LexTerm : •~ ( char_lit - char_lit ) «|» - LexTerm : •regDefId «|» - LexTerm : •[ LexPattern ] «|» - LexTerm : •{ LexPattern } «|» - LexTerm : •( LexPattern ) «|» -} -Transitions: - LexPattern -> 63 - LexAlt -> 64 - LexTerm -> 65 + LexTerm : •Λ<[> Π Λ<]> «regDefId» + LexTerm : •Λ<{> Π Λ<}> «regDefId» + LexTerm : •Λ<(> Π Λ<)> «regDefId» + LexTerm : •Λ<.> «"{"» + LexTerm : •char_lit «"{"» + LexTerm : •char_lit Λ<-> char_lit «"{"» + LexTerm : •Λ<~> char_lit «"{"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"{"» + LexTerm : •regDefId «"{"» + LexTerm : •Λ<[> Π Λ<]> «"{"» + LexTerm : •Λ<{> Π Λ<}> «"{"» + LexTerm : •Λ<(> Π Λ<)> «"{"» + LexTerm : •Λ<.> «"~"» + LexTerm : •char_lit «"~"» + LexTerm : •char_lit Λ<-> char_lit «"~"» + LexTerm : •Λ<~> char_lit «"~"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"~"» + LexTerm : •regDefId «"~"» + LexTerm : •Λ<[> Π Λ<]> «"~"» + LexTerm : •Λ<{> Π Λ<}> «"~"» + LexTerm : •Λ<(> Π Λ<)> «"~"» + LexTerm : •Λ<.> «"|"» + LexTerm : •char_lit «"|"» + LexTerm : •char_lit Λ<-> char_lit «"|"» + LexTerm : •Λ<~> char_lit «"|"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"|"» + LexTerm : •regDefId «"|"» + LexTerm : •Λ<[> Π Λ<]> «"|"» + LexTerm : •Λ<{> Π Λ<}> «"|"» + LexTerm : •Λ<(> Π Λ<)> «"|"» +} +Transitions: + Π -> 63 + Π -> 64 + Π -> 65 regDefId -> 66 - . -> 67 + Λ<.> -> 67 char_lit -> 68 - ~ -> 69 - ( -> 70 - [ -> 71 - { -> 72 + Λ<~> -> 69 + Λ<(> -> 70 + Λ<[> -> 71 + Λ<{> -> 72 S31{ - LexTerm : { •LexPattern } «;» - LexTerm : { •LexPattern } «(» - LexTerm : { •LexPattern } «.» - LexTerm : { •LexPattern } «[» - LexTerm : { •LexPattern } «char_lit» - LexTerm : { •LexPattern } «regDefId» - LexTerm : { •LexPattern } «{» - LexTerm : { •LexPattern } «~» - LexTerm : { •LexPattern } «|» - LexPattern : •LexAlt «}» - LexPattern : •LexPattern | LexAlt «}» - LexAlt : •LexTerm «}» - LexAlt : •LexAlt LexTerm «}» - LexPattern : •LexAlt «|» - LexPattern : •LexPattern | LexAlt «|» - LexTerm : •. «}» - LexTerm : •char_lit «}» - LexTerm : •char_lit - char_lit «}» - LexTerm : •~ char_lit «}» - LexTerm : •~ ( char_lit - char_lit ) «}» - LexTerm : •regDefId «}» - LexTerm : •[ LexPattern ] «}» - LexTerm : •{ LexPattern } «}» - LexTerm : •( LexPattern ) «}» - LexAlt : •LexTerm «(» - LexAlt : •LexTerm «.» - LexAlt : •LexTerm «[» - LexAlt : •LexTerm «char_lit» - LexAlt : •LexTerm «regDefId» - LexAlt : •LexTerm «{» - LexAlt : •LexTerm «~» - LexAlt : •LexAlt LexTerm «(» - LexAlt : •LexAlt LexTerm «.» - LexAlt : •LexAlt LexTerm «[» - LexAlt : •LexAlt LexTerm «char_lit» - LexAlt : •LexAlt LexTerm «regDefId» - LexAlt : •LexAlt LexTerm «{» - LexAlt : •LexAlt LexTerm «~» - LexAlt : •LexTerm «|» - LexAlt : •LexAlt LexTerm «|» - LexTerm : •. «(» - LexTerm : •char_lit «(» - LexTerm : •char_lit - char_lit «(» - LexTerm : •~ char_lit «(» - LexTerm : •~ ( char_lit - char_lit ) «(» - LexTerm : •regDefId «(» - LexTerm : •[ LexPattern ] «(» - LexTerm : •{ LexPattern } «(» - LexTerm : •( LexPattern ) «(» - LexTerm : •. «.» - LexTerm : •char_lit «.» - LexTerm : •char_lit - char_lit «.» - LexTerm : •~ char_lit «.» - LexTerm : •~ ( char_lit - char_lit ) «.» - LexTerm : •regDefId «.» - LexTerm : •[ LexPattern ] «.» - LexTerm : •{ LexPattern } «.» - LexTerm : •( LexPattern ) «.» - LexTerm : •. «[» - LexTerm : •char_lit «[» - LexTerm : •char_lit - char_lit «[» - LexTerm : •~ char_lit «[» - LexTerm : •~ ( char_lit - char_lit ) «[» - LexTerm : •regDefId «[» - LexTerm : •[ LexPattern ] «[» - LexTerm : •{ LexPattern } «[» - LexTerm : •( LexPattern ) «[» - LexTerm : •. «char_lit» + LexTerm : Λ<{> •Π Λ<}> «";"» + LexTerm : Λ<{> •Π Λ<}> «"("» + LexTerm : Λ<{> •Π Λ<}> «"."» + LexTerm : Λ<{> •Π Λ<}> «"["» + LexTerm : Λ<{> •Π Λ<}> «char_lit» + LexTerm : Λ<{> •Π Λ<}> «regDefId» + LexTerm : Λ<{> •Π Λ<}> «"{"» + LexTerm : Λ<{> •Π Λ<}> «"~"» + LexTerm : Λ<{> •Π Λ<}> «"|"» + LexPattern : •Π «"}"» + LexPattern : •Π Λ<|> Π «"}"» + LexAlt : •Π «"}"» + LexAlt : •Π Π «"}"» + LexPattern : •Π «"|"» + LexPattern : •Π Λ<|> Π «"|"» + LexTerm : •Λ<.> «"}"» + LexTerm : •char_lit «"}"» + LexTerm : •char_lit Λ<-> char_lit «"}"» + LexTerm : •Λ<~> char_lit «"}"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"}"» + LexTerm : •regDefId «"}"» + LexTerm : •Λ<[> Π Λ<]> «"}"» + LexTerm : •Λ<{> Π Λ<}> «"}"» + LexTerm : •Λ<(> Π Λ<)> «"}"» + LexAlt : •Π «"("» + LexAlt : •Π «"."» + LexAlt : •Π «"["» + LexAlt : •Π «char_lit» + LexAlt : •Π «regDefId» + LexAlt : •Π «"{"» + LexAlt : •Π «"~"» + LexAlt : •Π Π «"("» + LexAlt : •Π Π «"."» + LexAlt : •Π Π «"["» + LexAlt : •Π Π «char_lit» + LexAlt : •Π Π «regDefId» + LexAlt : •Π Π «"{"» + LexAlt : •Π Π «"~"» + LexAlt : •Π «"|"» + LexAlt : •Π Π «"|"» + LexTerm : •Λ<.> «"("» + LexTerm : •char_lit «"("» + LexTerm : •char_lit Λ<-> char_lit «"("» + LexTerm : •Λ<~> char_lit «"("» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"("» + LexTerm : •regDefId «"("» + LexTerm : •Λ<[> Π Λ<]> «"("» + LexTerm : •Λ<{> Π Λ<}> «"("» + LexTerm : •Λ<(> Π Λ<)> «"("» + LexTerm : •Λ<.> «"."» + LexTerm : •char_lit «"."» + LexTerm : •char_lit Λ<-> char_lit «"."» + LexTerm : •Λ<~> char_lit «"."» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"."» + LexTerm : •regDefId «"."» + LexTerm : •Λ<[> Π Λ<]> «"."» + LexTerm : •Λ<{> Π Λ<}> «"."» + LexTerm : •Λ<(> Π Λ<)> «"."» + LexTerm : •Λ<.> «"["» + LexTerm : •char_lit «"["» + LexTerm : •char_lit Λ<-> char_lit «"["» + LexTerm : •Λ<~> char_lit «"["» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"["» + LexTerm : •regDefId «"["» + LexTerm : •Λ<[> Π Λ<]> «"["» + LexTerm : •Λ<{> Π Λ<}> «"["» + LexTerm : •Λ<(> Π Λ<)> «"["» + LexTerm : •Λ<.> «char_lit» LexTerm : •char_lit «char_lit» - LexTerm : •char_lit - char_lit «char_lit» - LexTerm : •~ char_lit «char_lit» - LexTerm : •~ ( char_lit - char_lit ) «char_lit» + LexTerm : •char_lit Λ<-> char_lit «char_lit» + LexTerm : •Λ<~> char_lit «char_lit» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «char_lit» LexTerm : •regDefId «char_lit» - LexTerm : •[ LexPattern ] «char_lit» - LexTerm : •{ LexPattern } «char_lit» - LexTerm : •( LexPattern ) «char_lit» - LexTerm : •. «regDefId» + LexTerm : •Λ<[> Π Λ<]> «char_lit» + LexTerm : •Λ<{> Π Λ<}> «char_lit» + LexTerm : •Λ<(> Π Λ<)> «char_lit» + LexTerm : •Λ<.> «regDefId» LexTerm : •char_lit «regDefId» - LexTerm : •char_lit - char_lit «regDefId» - LexTerm : •~ char_lit «regDefId» - LexTerm : •~ ( char_lit - char_lit ) «regDefId» + LexTerm : •char_lit Λ<-> char_lit «regDefId» + LexTerm : •Λ<~> char_lit «regDefId» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «regDefId» LexTerm : •regDefId «regDefId» - LexTerm : •[ LexPattern ] «regDefId» - LexTerm : •{ LexPattern } «regDefId» - LexTerm : •( LexPattern ) «regDefId» - LexTerm : •. «{» - LexTerm : •char_lit «{» - LexTerm : •char_lit - char_lit «{» - LexTerm : •~ char_lit «{» - LexTerm : •~ ( char_lit - char_lit ) «{» - LexTerm : •regDefId «{» - LexTerm : •[ LexPattern ] «{» - LexTerm : •{ LexPattern } «{» - LexTerm : •( LexPattern ) «{» - LexTerm : •. «~» - LexTerm : •char_lit «~» - LexTerm : •char_lit - char_lit «~» - LexTerm : •~ char_lit «~» - LexTerm : •~ ( char_lit - char_lit ) «~» - LexTerm : •regDefId «~» - LexTerm : •[ LexPattern ] «~» - LexTerm : •{ LexPattern } «~» - LexTerm : •( LexPattern ) «~» - LexTerm : •. «|» - LexTerm : •char_lit «|» - LexTerm : •char_lit - char_lit «|» - LexTerm : •~ char_lit «|» - LexTerm : •~ ( char_lit - char_lit ) «|» - LexTerm : •regDefId «|» - LexTerm : •[ LexPattern ] «|» - LexTerm : •{ LexPattern } «|» - LexTerm : •( LexPattern ) «|» -} -Transitions: - LexPattern -> 73 - LexAlt -> 74 - LexTerm -> 75 + LexTerm : •Λ<[> Π Λ<]> «regDefId» + LexTerm : •Λ<{> Π Λ<}> «regDefId» + LexTerm : •Λ<(> Π Λ<)> «regDefId» + LexTerm : •Λ<.> «"{"» + LexTerm : •char_lit «"{"» + LexTerm : •char_lit Λ<-> char_lit «"{"» + LexTerm : •Λ<~> char_lit «"{"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"{"» + LexTerm : •regDefId «"{"» + LexTerm : •Λ<[> Π Λ<]> «"{"» + LexTerm : •Λ<{> Π Λ<}> «"{"» + LexTerm : •Λ<(> Π Λ<)> «"{"» + LexTerm : •Λ<.> «"~"» + LexTerm : •char_lit «"~"» + LexTerm : •char_lit Λ<-> char_lit «"~"» + LexTerm : •Λ<~> char_lit «"~"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"~"» + LexTerm : •regDefId «"~"» + LexTerm : •Λ<[> Π Λ<]> «"~"» + LexTerm : •Λ<{> Π Λ<}> «"~"» + LexTerm : •Λ<(> Π Λ<)> «"~"» + LexTerm : •Λ<.> «"|"» + LexTerm : •char_lit «"|"» + LexTerm : •char_lit Λ<-> char_lit «"|"» + LexTerm : •Λ<~> char_lit «"|"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"|"» + LexTerm : •regDefId «"|"» + LexTerm : •Λ<[> Π Λ<]> «"|"» + LexTerm : •Λ<{> Π Λ<}> «"|"» + LexTerm : •Λ<(> Π Λ<)> «"|"» +} +Transitions: + Π -> 73 + Π -> 74 + Π -> 75 regDefId -> 76 - . -> 77 + Λ<.> -> 77 char_lit -> 78 - ~ -> 79 - ( -> 80 - [ -> 81 - { -> 82 + Λ<~> -> 79 + Λ<(> -> 80 + Λ<[> -> 81 + Λ<{> -> 82 S32{ - LexProduction : regDefId : LexPattern •; «g_sdt_lit» - LexProduction : regDefId : LexPattern •; «prodId» - LexProduction : regDefId : LexPattern •; «Ω» - LexProduction : regDefId : LexPattern •; «ignoredTokId» - LexProduction : regDefId : LexPattern •; «regDefId» - LexProduction : regDefId : LexPattern •; «tokId» - LexPattern : LexPattern •| LexAlt «;» - LexPattern : LexPattern •| LexAlt «|» + LexProduction : regDefId Λ<:> Π •Λ<;> «g_sdt_lit» + LexProduction : regDefId Λ<:> Π •Λ<;> «prodId» + LexProduction : regDefId Λ<:> Π •Λ<;> «Ω» + LexProduction : regDefId Λ<:> Π •Λ<;> «ignoredTokId» + LexProduction : regDefId Λ<:> Π •Λ<;> «regDefId» + LexProduction : regDefId Λ<:> Π •Λ<;> «tokId» + LexPattern : Π •Λ<|> Π «";"» + LexPattern : Π •Λ<|> Π «"|"» } Transitions: - | -> 48 - ; -> 83 + Λ<|> -> 48 + Λ<;> -> 83 S33{ - LexProduction : ignoredTokId : LexPattern •; «g_sdt_lit» - LexProduction : ignoredTokId : LexPattern •; «prodId» - LexProduction : ignoredTokId : LexPattern •; «Ω» - LexProduction : ignoredTokId : LexPattern •; «ignoredTokId» - LexProduction : ignoredTokId : LexPattern •; «regDefId» - LexProduction : ignoredTokId : LexPattern •; «tokId» - LexPattern : LexPattern •| LexAlt «;» - LexPattern : LexPattern •| LexAlt «|» + LexProduction : ignoredTokId Λ<:> Π •Λ<;> «g_sdt_lit» + LexProduction : ignoredTokId Λ<:> Π •Λ<;> «prodId» + LexProduction : ignoredTokId Λ<:> Π •Λ<;> «Ω» + LexProduction : ignoredTokId Λ<:> Π •Λ<;> «ignoredTokId» + LexProduction : ignoredTokId Λ<:> Π •Λ<;> «regDefId» + LexProduction : ignoredTokId Λ<:> Π •Λ<;> «tokId» + LexPattern : Π •Λ<|> Π «";"» + LexPattern : Π •Λ<|> Π «"|"» } Transitions: - | -> 48 - ; -> 84 + Λ<|> -> 48 + Λ<;> -> 84 S34{ - SyntaxProduction : prodId : Alternatives •; «Ω» - SyntaxProduction : prodId : Alternatives •; «prodId» - Alternatives : Alternatives •| SyntaxBody «;» - Alternatives : Alternatives •| SyntaxBody «|» + SyntaxProduction : prodId Λ<:> Π •Λ<;> «Ω» + SyntaxProduction : prodId Λ<:> Π •Λ<;> «prodId» + Alternatives : Π •Λ<|> Π «";"» + Alternatives : Π •Λ<|> Π «"|"» } Transitions: - ; -> 85 - | -> 86 + Λ<;> -> 85 + Λ<|> -> 86 S35{ - Alternatives : SyntaxBody• «;» - Alternatives : SyntaxBody• «|» + Alternatives : Π• «";"» + Alternatives : Π• «"|"» } Transitions: S36{ - SyntaxBody : Symbols• «;» - SyntaxBody : Symbols •g_sdt_lit «;» - Symbols : Symbols •Symbol «;» - Symbols : Symbols •Symbol «g_sdt_lit» - SyntaxBody : Symbols• «|» - SyntaxBody : Symbols •g_sdt_lit «|» - Symbols : Symbols •Symbol «prodId» - Symbols : Symbols •Symbol «string_lit» - Symbols : Symbols •Symbol «tokId» - Symbols : Symbols •Symbol «|» - Symbol : •prodId «;» - Symbol : •tokId «;» - Symbol : •string_lit «;» + SyntaxBody : Π• «";"» + SyntaxBody : Π •g_sdt_lit «";"» + Symbols : Π •Π «";"» + Symbols : Π •Π «g_sdt_lit» + SyntaxBody : Π• «"|"» + SyntaxBody : Π •g_sdt_lit «"|"» + Symbols : Π •Π «prodId» + Symbols : Π •Π «string_lit» + Symbols : Π •Π «tokId» + Symbols : Π •Π «"|"» + Symbol : •prodId «";"» + Symbol : •tokId «";"» + Symbol : •string_lit «";"» Symbol : •prodId «g_sdt_lit» Symbol : •tokId «g_sdt_lit» Symbol : •string_lit «g_sdt_lit» @@ -1385,59 +1385,48 @@ S36{ Symbol : •prodId «tokId» Symbol : •tokId «tokId» Symbol : •string_lit «tokId» - Symbol : •prodId «|» - Symbol : •tokId «|» - Symbol : •string_lit «|» + Symbol : •prodId «"|"» + Symbol : •tokId «"|"» + Symbol : •string_lit «"|"» } Transitions: tokId -> 40 prodId -> 41 string_lit -> 42 - Symbol -> 87 + Π -> 87 g_sdt_lit -> 88 S37{ - Symbols : Symbol• «;» - Symbols : Symbol• «g_sdt_lit» - Symbols : Symbol• «prodId» - Symbols : Symbol• «string_lit» - Symbols : Symbol• «tokId» - Symbols : Symbol• «|» -} -Transitions: - - -S38{ - SyntaxBody : ErrorSymbol• «;» - SyntaxBody : ErrorSymbol •Symbols «;» - SyntaxBody : ErrorSymbol •Symbols g_sdt_lit «;» - SyntaxBody : ErrorSymbol •g_sdt_lit «;» - SyntaxBody : ErrorSymbol• «|» - SyntaxBody : ErrorSymbol •Symbols «|» - SyntaxBody : ErrorSymbol •Symbols g_sdt_lit «|» - SyntaxBody : ErrorSymbol •g_sdt_lit «|» - Symbols : •Symbol «;» - Symbols : •Symbols Symbol «;» - Symbols : •Symbol «g_sdt_lit» - Symbols : •Symbols Symbol «g_sdt_lit» - Symbols : •Symbol «|» - Symbols : •Symbols Symbol «|» - Symbol : •prodId «;» - Symbol : •tokId «;» - Symbol : •string_lit «;» - Symbols : •Symbol «prodId» - Symbols : •Symbol «string_lit» - Symbols : •Symbol «tokId» - Symbols : •Symbols Symbol «prodId» - Symbols : •Symbols Symbol «string_lit» - Symbols : •Symbols Symbol «tokId» + SyntaxBody : Π• «";"» + SyntaxBody : Π •Π «";"» + SyntaxBody : Π •Π g_sdt_lit «";"» + SyntaxBody : Π •g_sdt_lit «";"» + SyntaxBody : Π• «"|"» + SyntaxBody : Π •Π «"|"» + SyntaxBody : Π •Π g_sdt_lit «"|"» + SyntaxBody : Π •g_sdt_lit «"|"» + Symbols : •Π «";"» + Symbols : •Π Π «";"» + Symbols : •Π «g_sdt_lit» + Symbols : •Π Π «g_sdt_lit» + Symbols : •Π «"|"» + Symbols : •Π Π «"|"» + Symbol : •prodId «";"» + Symbol : •tokId «";"» + Symbol : •string_lit «";"» + Symbols : •Π «prodId» + Symbols : •Π «string_lit» + Symbols : •Π «tokId» + Symbols : •Π Π «prodId» + Symbols : •Π Π «string_lit» + Symbols : •Π Π «tokId» Symbol : •prodId «g_sdt_lit» Symbol : •tokId «g_sdt_lit» Symbol : •string_lit «g_sdt_lit» - Symbol : •prodId «|» - Symbol : •tokId «|» - Symbol : •string_lit «|» + Symbol : •prodId «"|"» + Symbol : •tokId «"|"» + Symbol : •string_lit «"|"» Symbol : •prodId «prodId» Symbol : •tokId «prodId» Symbol : •string_lit «prodId» @@ -1449,2142 +1438,2153 @@ S38{ Symbol : •string_lit «tokId» } Transitions: - Symbol -> 37 + Π -> 39 tokId -> 40 prodId -> 41 string_lit -> 42 - Symbols -> 89 + Π -> 89 g_sdt_lit -> 90 +S38{ + SyntaxBody : Π• «";"» + SyntaxBody : Π• «"|"» +} +Transitions: + + S39{ - SyntaxBody : EpsilonSymbol• «;» - SyntaxBody : EpsilonSymbol• «|» + Symbols : Π• «";"» + Symbols : Π• «g_sdt_lit» + Symbols : Π• «prodId» + Symbols : Π• «string_lit» + Symbols : Π• «tokId» + Symbols : Π• «"|"» } Transitions: S40{ - Symbol : tokId• «;» + Symbol : tokId• «";"» Symbol : tokId• «g_sdt_lit» Symbol : tokId• «prodId» Symbol : tokId• «string_lit» Symbol : tokId• «tokId» - Symbol : tokId• «|» + Symbol : tokId• «"|"» } Transitions: S41{ - Symbol : prodId• «;» + Symbol : prodId• «";"» Symbol : prodId• «g_sdt_lit» Symbol : prodId• «prodId» Symbol : prodId• «string_lit» Symbol : prodId• «tokId» - Symbol : prodId• «|» + Symbol : prodId• «"|"» } Transitions: S42{ - Symbol : string_lit• «;» + Symbol : string_lit• «";"» Symbol : string_lit• «g_sdt_lit» Symbol : string_lit• «prodId» Symbol : string_lit• «string_lit» Symbol : string_lit• «tokId» - Symbol : string_lit• «|» + Symbol : string_lit• «"|"» } Transitions: S43{ - ErrorSymbol : error• «;» - ErrorSymbol : error• «prodId» - ErrorSymbol : error• «string_lit» - ErrorSymbol : error• «tokId» - ErrorSymbol : error• «g_sdt_lit» - ErrorSymbol : error• «|» + ErrorSymbol : Λ• «";"» + ErrorSymbol : Λ• «prodId» + ErrorSymbol : Λ• «string_lit» + ErrorSymbol : Λ• «tokId» + ErrorSymbol : Λ• «g_sdt_lit» + ErrorSymbol : Λ• «"|"» } Transitions: S44{ - ErrorSymbol : λ• «;» - ErrorSymbol : λ• «prodId» - ErrorSymbol : λ• «string_lit» - ErrorSymbol : λ• «tokId» - ErrorSymbol : λ• «g_sdt_lit» - ErrorSymbol : λ• «|» + ErrorSymbol : Λ<λ>• «";"» + ErrorSymbol : Λ<λ>• «prodId» + ErrorSymbol : Λ<λ>• «string_lit» + ErrorSymbol : Λ<λ>• «tokId» + ErrorSymbol : Λ<λ>• «g_sdt_lit» + ErrorSymbol : Λ<λ>• «"|"» } Transitions: S45{ - EpsilonSymbol : empty• «;» - EpsilonSymbol : empty• «|» + EpsilonSymbol : Λ• «";"» + EpsilonSymbol : Λ• «"|"» } Transitions: S46{ - EpsilonSymbol : ε• «;» - EpsilonSymbol : ε• «|» + EpsilonSymbol : Λ<ε>• «";"» + EpsilonSymbol : Λ<ε>• «"|"» } Transitions: S47{ - LexProduction : tokId : LexPattern ;• «g_sdt_lit» - LexProduction : tokId : LexPattern ;• «prodId» - LexProduction : tokId : LexPattern ;• «Ω» - LexProduction : tokId : LexPattern ;• «ignoredTokId» - LexProduction : tokId : LexPattern ;• «regDefId» - LexProduction : tokId : LexPattern ;• «tokId» + LexProduction : tokId Λ<:> Π Λ<;>• «g_sdt_lit» + LexProduction : tokId Λ<:> Π Λ<;>• «prodId» + LexProduction : tokId Λ<:> Π Λ<;>• «Ω» + LexProduction : tokId Λ<:> Π Λ<;>• «ignoredTokId» + LexProduction : tokId Λ<:> Π Λ<;>• «regDefId» + LexProduction : tokId Λ<:> Π Λ<;>• «tokId» } Transitions: S48{ - LexPattern : LexPattern | •LexAlt «;» - LexPattern : LexPattern | •LexAlt «|» - LexAlt : •LexTerm «;» - LexAlt : •LexAlt LexTerm «;» - LexAlt : •LexTerm «|» - LexAlt : •LexAlt LexTerm «|» - LexTerm : •. «;» - LexTerm : •char_lit «;» - LexTerm : •char_lit - char_lit «;» - LexTerm : •~ char_lit «;» - LexTerm : •~ ( char_lit - char_lit ) «;» - LexTerm : •regDefId «;» - LexTerm : •[ LexPattern ] «;» - LexTerm : •{ LexPattern } «;» - LexTerm : •( LexPattern ) «;» - LexAlt : •LexTerm «(» - LexAlt : •LexTerm «.» - LexAlt : •LexTerm «[» - LexAlt : •LexTerm «char_lit» - LexAlt : •LexTerm «regDefId» - LexAlt : •LexTerm «{» - LexAlt : •LexTerm «~» - LexAlt : •LexAlt LexTerm «(» - LexAlt : •LexAlt LexTerm «.» - LexAlt : •LexAlt LexTerm «[» - LexAlt : •LexAlt LexTerm «char_lit» - LexAlt : •LexAlt LexTerm «regDefId» - LexAlt : •LexAlt LexTerm «{» - LexAlt : •LexAlt LexTerm «~» - LexTerm : •. «|» - LexTerm : •char_lit «|» - LexTerm : •char_lit - char_lit «|» - LexTerm : •~ char_lit «|» - LexTerm : •~ ( char_lit - char_lit ) «|» - LexTerm : •regDefId «|» - LexTerm : •[ LexPattern ] «|» - LexTerm : •{ LexPattern } «|» - LexTerm : •( LexPattern ) «|» - LexTerm : •. «(» - LexTerm : •char_lit «(» - LexTerm : •char_lit - char_lit «(» - LexTerm : •~ char_lit «(» - LexTerm : •~ ( char_lit - char_lit ) «(» - LexTerm : •regDefId «(» - LexTerm : •[ LexPattern ] «(» - LexTerm : •{ LexPattern } «(» - LexTerm : •( LexPattern ) «(» - LexTerm : •. «.» - LexTerm : •char_lit «.» - LexTerm : •char_lit - char_lit «.» - LexTerm : •~ char_lit «.» - LexTerm : •~ ( char_lit - char_lit ) «.» - LexTerm : •regDefId «.» - LexTerm : •[ LexPattern ] «.» - LexTerm : •{ LexPattern } «.» - LexTerm : •( LexPattern ) «.» - LexTerm : •. «[» - LexTerm : •char_lit «[» - LexTerm : •char_lit - char_lit «[» - LexTerm : •~ char_lit «[» - LexTerm : •~ ( char_lit - char_lit ) «[» - LexTerm : •regDefId «[» - LexTerm : •[ LexPattern ] «[» - LexTerm : •{ LexPattern } «[» - LexTerm : •( LexPattern ) «[» - LexTerm : •. «char_lit» + LexPattern : Π Λ<|> •Π «";"» + LexPattern : Π Λ<|> •Π «"|"» + LexAlt : •Π «";"» + LexAlt : •Π Π «";"» + LexAlt : •Π «"|"» + LexAlt : •Π Π «"|"» + LexTerm : •Λ<.> «";"» + LexTerm : •char_lit «";"» + LexTerm : •char_lit Λ<-> char_lit «";"» + LexTerm : •Λ<~> char_lit «";"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «";"» + LexTerm : •regDefId «";"» + LexTerm : •Λ<[> Π Λ<]> «";"» + LexTerm : •Λ<{> Π Λ<}> «";"» + LexTerm : •Λ<(> Π Λ<)> «";"» + LexAlt : •Π «"("» + LexAlt : •Π «"."» + LexAlt : •Π «"["» + LexAlt : •Π «char_lit» + LexAlt : •Π «regDefId» + LexAlt : •Π «"{"» + LexAlt : •Π «"~"» + LexAlt : •Π Π «"("» + LexAlt : •Π Π «"."» + LexAlt : •Π Π «"["» + LexAlt : •Π Π «char_lit» + LexAlt : •Π Π «regDefId» + LexAlt : •Π Π «"{"» + LexAlt : •Π Π «"~"» + LexTerm : •Λ<.> «"|"» + LexTerm : •char_lit «"|"» + LexTerm : •char_lit Λ<-> char_lit «"|"» + LexTerm : •Λ<~> char_lit «"|"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"|"» + LexTerm : •regDefId «"|"» + LexTerm : •Λ<[> Π Λ<]> «"|"» + LexTerm : •Λ<{> Π Λ<}> «"|"» + LexTerm : •Λ<(> Π Λ<)> «"|"» + LexTerm : •Λ<.> «"("» + LexTerm : •char_lit «"("» + LexTerm : •char_lit Λ<-> char_lit «"("» + LexTerm : •Λ<~> char_lit «"("» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"("» + LexTerm : •regDefId «"("» + LexTerm : •Λ<[> Π Λ<]> «"("» + LexTerm : •Λ<{> Π Λ<}> «"("» + LexTerm : •Λ<(> Π Λ<)> «"("» + LexTerm : •Λ<.> «"."» + LexTerm : •char_lit «"."» + LexTerm : •char_lit Λ<-> char_lit «"."» + LexTerm : •Λ<~> char_lit «"."» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"."» + LexTerm : •regDefId «"."» + LexTerm : •Λ<[> Π Λ<]> «"."» + LexTerm : •Λ<{> Π Λ<}> «"."» + LexTerm : •Λ<(> Π Λ<)> «"."» + LexTerm : •Λ<.> «"["» + LexTerm : •char_lit «"["» + LexTerm : •char_lit Λ<-> char_lit «"["» + LexTerm : •Λ<~> char_lit «"["» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"["» + LexTerm : •regDefId «"["» + LexTerm : •Λ<[> Π Λ<]> «"["» + LexTerm : •Λ<{> Π Λ<}> «"["» + LexTerm : •Λ<(> Π Λ<)> «"["» + LexTerm : •Λ<.> «char_lit» LexTerm : •char_lit «char_lit» - LexTerm : •char_lit - char_lit «char_lit» - LexTerm : •~ char_lit «char_lit» - LexTerm : •~ ( char_lit - char_lit ) «char_lit» + LexTerm : •char_lit Λ<-> char_lit «char_lit» + LexTerm : •Λ<~> char_lit «char_lit» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «char_lit» LexTerm : •regDefId «char_lit» - LexTerm : •[ LexPattern ] «char_lit» - LexTerm : •{ LexPattern } «char_lit» - LexTerm : •( LexPattern ) «char_lit» - LexTerm : •. «regDefId» + LexTerm : •Λ<[> Π Λ<]> «char_lit» + LexTerm : •Λ<{> Π Λ<}> «char_lit» + LexTerm : •Λ<(> Π Λ<)> «char_lit» + LexTerm : •Λ<.> «regDefId» LexTerm : •char_lit «regDefId» - LexTerm : •char_lit - char_lit «regDefId» - LexTerm : •~ char_lit «regDefId» - LexTerm : •~ ( char_lit - char_lit ) «regDefId» + LexTerm : •char_lit Λ<-> char_lit «regDefId» + LexTerm : •Λ<~> char_lit «regDefId» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «regDefId» LexTerm : •regDefId «regDefId» - LexTerm : •[ LexPattern ] «regDefId» - LexTerm : •{ LexPattern } «regDefId» - LexTerm : •( LexPattern ) «regDefId» - LexTerm : •. «{» - LexTerm : •char_lit «{» - LexTerm : •char_lit - char_lit «{» - LexTerm : •~ char_lit «{» - LexTerm : •~ ( char_lit - char_lit ) «{» - LexTerm : •regDefId «{» - LexTerm : •[ LexPattern ] «{» - LexTerm : •{ LexPattern } «{» - LexTerm : •( LexPattern ) «{» - LexTerm : •. «~» - LexTerm : •char_lit «~» - LexTerm : •char_lit - char_lit «~» - LexTerm : •~ char_lit «~» - LexTerm : •~ ( char_lit - char_lit ) «~» - LexTerm : •regDefId «~» - LexTerm : •[ LexPattern ] «~» - LexTerm : •{ LexPattern } «~» - LexTerm : •( LexPattern ) «~» -} -Transitions: - LexTerm -> 24 + LexTerm : •Λ<[> Π Λ<]> «regDefId» + LexTerm : •Λ<{> Π Λ<}> «regDefId» + LexTerm : •Λ<(> Π Λ<)> «regDefId» + LexTerm : •Λ<.> «"{"» + LexTerm : •char_lit «"{"» + LexTerm : •char_lit Λ<-> char_lit «"{"» + LexTerm : •Λ<~> char_lit «"{"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"{"» + LexTerm : •regDefId «"{"» + LexTerm : •Λ<[> Π Λ<]> «"{"» + LexTerm : •Λ<{> Π Λ<}> «"{"» + LexTerm : •Λ<(> Π Λ<)> «"{"» + LexTerm : •Λ<.> «"~"» + LexTerm : •char_lit «"~"» + LexTerm : •char_lit Λ<-> char_lit «"~"» + LexTerm : •Λ<~> char_lit «"~"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"~"» + LexTerm : •regDefId «"~"» + LexTerm : •Λ<[> Π Λ<]> «"~"» + LexTerm : •Λ<{> Π Λ<}> «"~"» + LexTerm : •Λ<(> Π Λ<)> «"~"» +} +Transitions: + Π -> 24 regDefId -> 25 - . -> 26 + Λ<.> -> 26 char_lit -> 27 - ~ -> 28 - ( -> 29 - [ -> 30 - { -> 31 - LexAlt -> 91 + Λ<~> -> 28 + Λ<(> -> 29 + Λ<[> -> 30 + Λ<{> -> 31 + Π -> 91 S49{ - LexAlt : LexAlt LexTerm• «;» - LexAlt : LexAlt LexTerm• «(» - LexAlt : LexAlt LexTerm• «.» - LexAlt : LexAlt LexTerm• «[» - LexAlt : LexAlt LexTerm• «char_lit» - LexAlt : LexAlt LexTerm• «regDefId» - LexAlt : LexAlt LexTerm• «{» - LexAlt : LexAlt LexTerm• «~» - LexAlt : LexAlt LexTerm• «|» + LexAlt : Π Π• «";"» + LexAlt : Π Π• «"("» + LexAlt : Π Π• «"."» + LexAlt : Π Π• «"["» + LexAlt : Π Π• «char_lit» + LexAlt : Π Π• «regDefId» + LexAlt : Π Π• «"{"» + LexAlt : Π Π• «"~"» + LexAlt : Π Π• «"|"» } Transitions: S50{ - LexTerm : char_lit - •char_lit «;» - LexTerm : char_lit - •char_lit «(» - LexTerm : char_lit - •char_lit «.» - LexTerm : char_lit - •char_lit «[» - LexTerm : char_lit - •char_lit «char_lit» - LexTerm : char_lit - •char_lit «regDefId» - LexTerm : char_lit - •char_lit «{» - LexTerm : char_lit - •char_lit «~» - LexTerm : char_lit - •char_lit «|» + LexTerm : char_lit Λ<-> •char_lit «";"» + LexTerm : char_lit Λ<-> •char_lit «"("» + LexTerm : char_lit Λ<-> •char_lit «"."» + LexTerm : char_lit Λ<-> •char_lit «"["» + LexTerm : char_lit Λ<-> •char_lit «char_lit» + LexTerm : char_lit Λ<-> •char_lit «regDefId» + LexTerm : char_lit Λ<-> •char_lit «"{"» + LexTerm : char_lit Λ<-> •char_lit «"~"» + LexTerm : char_lit Λ<-> •char_lit «"|"» } Transitions: char_lit -> 92 S51{ - LexTerm : ~ char_lit• «;» - LexTerm : ~ char_lit• «(» - LexTerm : ~ char_lit• «.» - LexTerm : ~ char_lit• «[» - LexTerm : ~ char_lit• «char_lit» - LexTerm : ~ char_lit• «regDefId» - LexTerm : ~ char_lit• «{» - LexTerm : ~ char_lit• «~» - LexTerm : ~ char_lit• «|» + LexTerm : Λ<~> char_lit• «";"» + LexTerm : Λ<~> char_lit• «"("» + LexTerm : Λ<~> char_lit• «"."» + LexTerm : Λ<~> char_lit• «"["» + LexTerm : Λ<~> char_lit• «char_lit» + LexTerm : Λ<~> char_lit• «regDefId» + LexTerm : Λ<~> char_lit• «"{"» + LexTerm : Λ<~> char_lit• «"~"» + LexTerm : Λ<~> char_lit• «"|"» } Transitions: S52{ - LexTerm : ~ ( •char_lit - char_lit ) «;» - LexTerm : ~ ( •char_lit - char_lit ) «(» - LexTerm : ~ ( •char_lit - char_lit ) «.» - LexTerm : ~ ( •char_lit - char_lit ) «[» - LexTerm : ~ ( •char_lit - char_lit ) «char_lit» - LexTerm : ~ ( •char_lit - char_lit ) «regDefId» - LexTerm : ~ ( •char_lit - char_lit ) «{» - LexTerm : ~ ( •char_lit - char_lit ) «~» - LexTerm : ~ ( •char_lit - char_lit ) «|» + LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «";"» + LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «"("» + LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «"."» + LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «"["» + LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «char_lit» + LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «regDefId» + LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «"{"» + LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «"~"» + LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «"|"» } Transitions: char_lit -> 93 S53{ - LexTerm : ( LexPattern •) «;» - LexTerm : ( LexPattern •) «(» - LexTerm : ( LexPattern •) «.» - LexTerm : ( LexPattern •) «[» - LexTerm : ( LexPattern •) «char_lit» - LexTerm : ( LexPattern •) «regDefId» - LexTerm : ( LexPattern •) «{» - LexTerm : ( LexPattern •) «~» - LexTerm : ( LexPattern •) «|» - LexPattern : LexPattern •| LexAlt «)» - LexPattern : LexPattern •| LexAlt «|» + LexTerm : Λ<(> Π •Λ<)> «";"» + LexTerm : Λ<(> Π •Λ<)> «"("» + LexTerm : Λ<(> Π •Λ<)> «"."» + LexTerm : Λ<(> Π •Λ<)> «"["» + LexTerm : Λ<(> Π •Λ<)> «char_lit» + LexTerm : Λ<(> Π •Λ<)> «regDefId» + LexTerm : Λ<(> Π •Λ<)> «"{"» + LexTerm : Λ<(> Π •Λ<)> «"~"» + LexTerm : Λ<(> Π •Λ<)> «"|"» + LexPattern : Π •Λ<|> Π «")"» + LexPattern : Π •Λ<|> Π «"|"» } Transitions: - | -> 94 - ) -> 95 + Λ<|> -> 94 + Λ<)> -> 95 S54{ - LexPattern : LexAlt• «)» - LexAlt : LexAlt •LexTerm «)» - LexPattern : LexAlt• «|» - LexAlt : LexAlt •LexTerm «(» - LexAlt : LexAlt •LexTerm «.» - LexAlt : LexAlt •LexTerm «[» - LexAlt : LexAlt •LexTerm «char_lit» - LexAlt : LexAlt •LexTerm «regDefId» - LexAlt : LexAlt •LexTerm «{» - LexAlt : LexAlt •LexTerm «~» - LexAlt : LexAlt •LexTerm «|» - LexTerm : •. «)» - LexTerm : •char_lit «)» - LexTerm : •char_lit - char_lit «)» - LexTerm : •~ char_lit «)» - LexTerm : •~ ( char_lit - char_lit ) «)» - LexTerm : •regDefId «)» - LexTerm : •[ LexPattern ] «)» - LexTerm : •{ LexPattern } «)» - LexTerm : •( LexPattern ) «)» - LexTerm : •. «(» - LexTerm : •char_lit «(» - LexTerm : •char_lit - char_lit «(» - LexTerm : •~ char_lit «(» - LexTerm : •~ ( char_lit - char_lit ) «(» - LexTerm : •regDefId «(» - LexTerm : •[ LexPattern ] «(» - LexTerm : •{ LexPattern } «(» - LexTerm : •( LexPattern ) «(» - LexTerm : •. «.» - LexTerm : •char_lit «.» - LexTerm : •char_lit - char_lit «.» - LexTerm : •~ char_lit «.» - LexTerm : •~ ( char_lit - char_lit ) «.» - LexTerm : •regDefId «.» - LexTerm : •[ LexPattern ] «.» - LexTerm : •{ LexPattern } «.» - LexTerm : •( LexPattern ) «.» - LexTerm : •. «[» - LexTerm : •char_lit «[» - LexTerm : •char_lit - char_lit «[» - LexTerm : •~ char_lit «[» - LexTerm : •~ ( char_lit - char_lit ) «[» - LexTerm : •regDefId «[» - LexTerm : •[ LexPattern ] «[» - LexTerm : •{ LexPattern } «[» - LexTerm : •( LexPattern ) «[» - LexTerm : •. «char_lit» + LexPattern : Π• «")"» + LexAlt : Π •Π «")"» + LexPattern : Π• «"|"» + LexAlt : Π •Π «"("» + LexAlt : Π •Π «"."» + LexAlt : Π •Π «"["» + LexAlt : Π •Π «char_lit» + LexAlt : Π •Π «regDefId» + LexAlt : Π •Π «"{"» + LexAlt : Π •Π «"~"» + LexAlt : Π •Π «"|"» + LexTerm : •Λ<.> «")"» + LexTerm : •char_lit «")"» + LexTerm : •char_lit Λ<-> char_lit «")"» + LexTerm : •Λ<~> char_lit «")"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «")"» + LexTerm : •regDefId «")"» + LexTerm : •Λ<[> Π Λ<]> «")"» + LexTerm : •Λ<{> Π Λ<}> «")"» + LexTerm : •Λ<(> Π Λ<)> «")"» + LexTerm : •Λ<.> «"("» + LexTerm : •char_lit «"("» + LexTerm : •char_lit Λ<-> char_lit «"("» + LexTerm : •Λ<~> char_lit «"("» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"("» + LexTerm : •regDefId «"("» + LexTerm : •Λ<[> Π Λ<]> «"("» + LexTerm : •Λ<{> Π Λ<}> «"("» + LexTerm : •Λ<(> Π Λ<)> «"("» + LexTerm : •Λ<.> «"."» + LexTerm : •char_lit «"."» + LexTerm : •char_lit Λ<-> char_lit «"."» + LexTerm : •Λ<~> char_lit «"."» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"."» + LexTerm : •regDefId «"."» + LexTerm : •Λ<[> Π Λ<]> «"."» + LexTerm : •Λ<{> Π Λ<}> «"."» + LexTerm : •Λ<(> Π Λ<)> «"."» + LexTerm : •Λ<.> «"["» + LexTerm : •char_lit «"["» + LexTerm : •char_lit Λ<-> char_lit «"["» + LexTerm : •Λ<~> char_lit «"["» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"["» + LexTerm : •regDefId «"["» + LexTerm : •Λ<[> Π Λ<]> «"["» + LexTerm : •Λ<{> Π Λ<}> «"["» + LexTerm : •Λ<(> Π Λ<)> «"["» + LexTerm : •Λ<.> «char_lit» LexTerm : •char_lit «char_lit» - LexTerm : •char_lit - char_lit «char_lit» - LexTerm : •~ char_lit «char_lit» - LexTerm : •~ ( char_lit - char_lit ) «char_lit» + LexTerm : •char_lit Λ<-> char_lit «char_lit» + LexTerm : •Λ<~> char_lit «char_lit» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «char_lit» LexTerm : •regDefId «char_lit» - LexTerm : •[ LexPattern ] «char_lit» - LexTerm : •{ LexPattern } «char_lit» - LexTerm : •( LexPattern ) «char_lit» - LexTerm : •. «regDefId» + LexTerm : •Λ<[> Π Λ<]> «char_lit» + LexTerm : •Λ<{> Π Λ<}> «char_lit» + LexTerm : •Λ<(> Π Λ<)> «char_lit» + LexTerm : •Λ<.> «regDefId» LexTerm : •char_lit «regDefId» - LexTerm : •char_lit - char_lit «regDefId» - LexTerm : •~ char_lit «regDefId» - LexTerm : •~ ( char_lit - char_lit ) «regDefId» + LexTerm : •char_lit Λ<-> char_lit «regDefId» + LexTerm : •Λ<~> char_lit «regDefId» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «regDefId» LexTerm : •regDefId «regDefId» - LexTerm : •[ LexPattern ] «regDefId» - LexTerm : •{ LexPattern } «regDefId» - LexTerm : •( LexPattern ) «regDefId» - LexTerm : •. «{» - LexTerm : •char_lit «{» - LexTerm : •char_lit - char_lit «{» - LexTerm : •~ char_lit «{» - LexTerm : •~ ( char_lit - char_lit ) «{» - LexTerm : •regDefId «{» - LexTerm : •[ LexPattern ] «{» - LexTerm : •{ LexPattern } «{» - LexTerm : •( LexPattern ) «{» - LexTerm : •. «~» - LexTerm : •char_lit «~» - LexTerm : •char_lit - char_lit «~» - LexTerm : •~ char_lit «~» - LexTerm : •~ ( char_lit - char_lit ) «~» - LexTerm : •regDefId «~» - LexTerm : •[ LexPattern ] «~» - LexTerm : •{ LexPattern } «~» - LexTerm : •( LexPattern ) «~» - LexTerm : •. «|» - LexTerm : •char_lit «|» - LexTerm : •char_lit - char_lit «|» - LexTerm : •~ char_lit «|» - LexTerm : •~ ( char_lit - char_lit ) «|» - LexTerm : •regDefId «|» - LexTerm : •[ LexPattern ] «|» - LexTerm : •{ LexPattern } «|» - LexTerm : •( LexPattern ) «|» + LexTerm : •Λ<[> Π Λ<]> «regDefId» + LexTerm : •Λ<{> Π Λ<}> «regDefId» + LexTerm : •Λ<(> Π Λ<)> «regDefId» + LexTerm : •Λ<.> «"{"» + LexTerm : •char_lit «"{"» + LexTerm : •char_lit Λ<-> char_lit «"{"» + LexTerm : •Λ<~> char_lit «"{"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"{"» + LexTerm : •regDefId «"{"» + LexTerm : •Λ<[> Π Λ<]> «"{"» + LexTerm : •Λ<{> Π Λ<}> «"{"» + LexTerm : •Λ<(> Π Λ<)> «"{"» + LexTerm : •Λ<.> «"~"» + LexTerm : •char_lit «"~"» + LexTerm : •char_lit Λ<-> char_lit «"~"» + LexTerm : •Λ<~> char_lit «"~"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"~"» + LexTerm : •regDefId «"~"» + LexTerm : •Λ<[> Π Λ<]> «"~"» + LexTerm : •Λ<{> Π Λ<}> «"~"» + LexTerm : •Λ<(> Π Λ<)> «"~"» + LexTerm : •Λ<.> «"|"» + LexTerm : •char_lit «"|"» + LexTerm : •char_lit Λ<-> char_lit «"|"» + LexTerm : •Λ<~> char_lit «"|"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"|"» + LexTerm : •regDefId «"|"» + LexTerm : •Λ<[> Π Λ<]> «"|"» + LexTerm : •Λ<{> Π Λ<}> «"|"» + LexTerm : •Λ<(> Π Λ<)> «"|"» } Transitions: regDefId -> 56 - . -> 57 + Λ<.> -> 57 char_lit -> 58 - ~ -> 59 - ( -> 60 - [ -> 61 - { -> 62 - LexTerm -> 96 + Λ<~> -> 59 + Λ<(> -> 60 + Λ<[> -> 61 + Λ<{> -> 62 + Π -> 96 S55{ - LexAlt : LexTerm• «)» - LexAlt : LexTerm• «(» - LexAlt : LexTerm• «.» - LexAlt : LexTerm• «[» - LexAlt : LexTerm• «char_lit» - LexAlt : LexTerm• «regDefId» - LexAlt : LexTerm• «{» - LexAlt : LexTerm• «~» - LexAlt : LexTerm• «|» + LexAlt : Π• «")"» + LexAlt : Π• «"("» + LexAlt : Π• «"."» + LexAlt : Π• «"["» + LexAlt : Π• «char_lit» + LexAlt : Π• «regDefId» + LexAlt : Π• «"{"» + LexAlt : Π• «"~"» + LexAlt : Π• «"|"» } Transitions: S56{ - LexTerm : regDefId• «)» - LexTerm : regDefId• «(» - LexTerm : regDefId• «.» - LexTerm : regDefId• «[» + LexTerm : regDefId• «")"» + LexTerm : regDefId• «"("» + LexTerm : regDefId• «"."» + LexTerm : regDefId• «"["» LexTerm : regDefId• «char_lit» LexTerm : regDefId• «regDefId» - LexTerm : regDefId• «{» - LexTerm : regDefId• «~» - LexTerm : regDefId• «|» + LexTerm : regDefId• «"{"» + LexTerm : regDefId• «"~"» + LexTerm : regDefId• «"|"» } Transitions: S57{ - LexTerm : .• «)» - LexTerm : .• «(» - LexTerm : .• «.» - LexTerm : .• «[» - LexTerm : .• «char_lit» - LexTerm : .• «regDefId» - LexTerm : .• «{» - LexTerm : .• «~» - LexTerm : .• «|» + LexTerm : Λ<.>• «")"» + LexTerm : Λ<.>• «"("» + LexTerm : Λ<.>• «"."» + LexTerm : Λ<.>• «"["» + LexTerm : Λ<.>• «char_lit» + LexTerm : Λ<.>• «regDefId» + LexTerm : Λ<.>• «"{"» + LexTerm : Λ<.>• «"~"» + LexTerm : Λ<.>• «"|"» } Transitions: S58{ - LexTerm : char_lit• «)» - LexTerm : char_lit •- char_lit «)» - LexTerm : char_lit• «(» - LexTerm : char_lit •- char_lit «(» - LexTerm : char_lit• «.» - LexTerm : char_lit •- char_lit «.» - LexTerm : char_lit• «[» - LexTerm : char_lit •- char_lit «[» + LexTerm : char_lit• «")"» + LexTerm : char_lit •Λ<-> char_lit «")"» + LexTerm : char_lit• «"("» + LexTerm : char_lit •Λ<-> char_lit «"("» + LexTerm : char_lit• «"."» + LexTerm : char_lit •Λ<-> char_lit «"."» + LexTerm : char_lit• «"["» + LexTerm : char_lit •Λ<-> char_lit «"["» LexTerm : char_lit• «char_lit» - LexTerm : char_lit •- char_lit «char_lit» + LexTerm : char_lit •Λ<-> char_lit «char_lit» LexTerm : char_lit• «regDefId» - LexTerm : char_lit •- char_lit «regDefId» - LexTerm : char_lit• «{» - LexTerm : char_lit •- char_lit «{» - LexTerm : char_lit• «~» - LexTerm : char_lit •- char_lit «~» - LexTerm : char_lit• «|» - LexTerm : char_lit •- char_lit «|» + LexTerm : char_lit •Λ<-> char_lit «regDefId» + LexTerm : char_lit• «"{"» + LexTerm : char_lit •Λ<-> char_lit «"{"» + LexTerm : char_lit• «"~"» + LexTerm : char_lit •Λ<-> char_lit «"~"» + LexTerm : char_lit• «"|"» + LexTerm : char_lit •Λ<-> char_lit «"|"» } Transitions: - - -> 97 + Λ<-> -> 97 S59{ - LexTerm : ~ •char_lit «)» - LexTerm : ~ •( char_lit - char_lit ) «)» - LexTerm : ~ •char_lit «(» - LexTerm : ~ •( char_lit - char_lit ) «(» - LexTerm : ~ •char_lit «.» - LexTerm : ~ •( char_lit - char_lit ) «.» - LexTerm : ~ •char_lit «[» - LexTerm : ~ •( char_lit - char_lit ) «[» - LexTerm : ~ •char_lit «char_lit» - LexTerm : ~ •( char_lit - char_lit ) «char_lit» - LexTerm : ~ •char_lit «regDefId» - LexTerm : ~ •( char_lit - char_lit ) «regDefId» - LexTerm : ~ •char_lit «{» - LexTerm : ~ •( char_lit - char_lit ) «{» - LexTerm : ~ •char_lit «~» - LexTerm : ~ •( char_lit - char_lit ) «~» - LexTerm : ~ •char_lit «|» - LexTerm : ~ •( char_lit - char_lit ) «|» + LexTerm : Λ<~> •char_lit «")"» + LexTerm : Λ<~> •Λ<(> char_lit Λ<-> char_lit Λ<)> «")"» + LexTerm : Λ<~> •char_lit «"("» + LexTerm : Λ<~> •Λ<(> char_lit Λ<-> char_lit Λ<)> «"("» + LexTerm : Λ<~> •char_lit «"."» + LexTerm : Λ<~> •Λ<(> char_lit Λ<-> char_lit Λ<)> «"."» + LexTerm : Λ<~> •char_lit «"["» + LexTerm : Λ<~> •Λ<(> char_lit Λ<-> char_lit Λ<)> «"["» + LexTerm : Λ<~> •char_lit «char_lit» + LexTerm : Λ<~> •Λ<(> char_lit Λ<-> char_lit Λ<)> «char_lit» + LexTerm : Λ<~> •char_lit «regDefId» + LexTerm : Λ<~> •Λ<(> char_lit Λ<-> char_lit Λ<)> «regDefId» + LexTerm : Λ<~> •char_lit «"{"» + LexTerm : Λ<~> •Λ<(> char_lit Λ<-> char_lit Λ<)> «"{"» + LexTerm : Λ<~> •char_lit «"~"» + LexTerm : Λ<~> •Λ<(> char_lit Λ<-> char_lit Λ<)> «"~"» + LexTerm : Λ<~> •char_lit «"|"» + LexTerm : Λ<~> •Λ<(> char_lit Λ<-> char_lit Λ<)> «"|"» } Transitions: char_lit -> 98 - ( -> 99 + Λ<(> -> 99 S60{ - LexTerm : ( •LexPattern ) «)» - LexTerm : ( •LexPattern ) «(» - LexTerm : ( •LexPattern ) «.» - LexTerm : ( •LexPattern ) «[» - LexTerm : ( •LexPattern ) «char_lit» - LexTerm : ( •LexPattern ) «regDefId» - LexTerm : ( •LexPattern ) «{» - LexTerm : ( •LexPattern ) «~» - LexTerm : ( •LexPattern ) «|» - LexPattern : •LexAlt «)» - LexPattern : •LexPattern | LexAlt «)» - LexAlt : •LexTerm «)» - LexAlt : •LexAlt LexTerm «)» - LexPattern : •LexAlt «|» - LexPattern : •LexPattern | LexAlt «|» - LexTerm : •. «)» - LexTerm : •char_lit «)» - LexTerm : •char_lit - char_lit «)» - LexTerm : •~ char_lit «)» - LexTerm : •~ ( char_lit - char_lit ) «)» - LexTerm : •regDefId «)» - LexTerm : •[ LexPattern ] «)» - LexTerm : •{ LexPattern } «)» - LexTerm : •( LexPattern ) «)» - LexAlt : •LexTerm «(» - LexAlt : •LexTerm «.» - LexAlt : •LexTerm «[» - LexAlt : •LexTerm «char_lit» - LexAlt : •LexTerm «regDefId» - LexAlt : •LexTerm «{» - LexAlt : •LexTerm «~» - LexAlt : •LexAlt LexTerm «(» - LexAlt : •LexAlt LexTerm «.» - LexAlt : •LexAlt LexTerm «[» - LexAlt : •LexAlt LexTerm «char_lit» - LexAlt : •LexAlt LexTerm «regDefId» - LexAlt : •LexAlt LexTerm «{» - LexAlt : •LexAlt LexTerm «~» - LexAlt : •LexTerm «|» - LexAlt : •LexAlt LexTerm «|» - LexTerm : •. «(» - LexTerm : •char_lit «(» - LexTerm : •char_lit - char_lit «(» - LexTerm : •~ char_lit «(» - LexTerm : •~ ( char_lit - char_lit ) «(» - LexTerm : •regDefId «(» - LexTerm : •[ LexPattern ] «(» - LexTerm : •{ LexPattern } «(» - LexTerm : •( LexPattern ) «(» - LexTerm : •. «.» - LexTerm : •char_lit «.» - LexTerm : •char_lit - char_lit «.» - LexTerm : •~ char_lit «.» - LexTerm : •~ ( char_lit - char_lit ) «.» - LexTerm : •regDefId «.» - LexTerm : •[ LexPattern ] «.» - LexTerm : •{ LexPattern } «.» - LexTerm : •( LexPattern ) «.» - LexTerm : •. «[» - LexTerm : •char_lit «[» - LexTerm : •char_lit - char_lit «[» - LexTerm : •~ char_lit «[» - LexTerm : •~ ( char_lit - char_lit ) «[» - LexTerm : •regDefId «[» - LexTerm : •[ LexPattern ] «[» - LexTerm : •{ LexPattern } «[» - LexTerm : •( LexPattern ) «[» - LexTerm : •. «char_lit» + LexTerm : Λ<(> •Π Λ<)> «")"» + LexTerm : Λ<(> •Π Λ<)> «"("» + LexTerm : Λ<(> •Π Λ<)> «"."» + LexTerm : Λ<(> •Π Λ<)> «"["» + LexTerm : Λ<(> •Π Λ<)> «char_lit» + LexTerm : Λ<(> •Π Λ<)> «regDefId» + LexTerm : Λ<(> •Π Λ<)> «"{"» + LexTerm : Λ<(> •Π Λ<)> «"~"» + LexTerm : Λ<(> •Π Λ<)> «"|"» + LexPattern : •Π «")"» + LexPattern : •Π Λ<|> Π «")"» + LexAlt : •Π «")"» + LexAlt : •Π Π «")"» + LexPattern : •Π «"|"» + LexPattern : •Π Λ<|> Π «"|"» + LexTerm : •Λ<.> «")"» + LexTerm : •char_lit «")"» + LexTerm : •char_lit Λ<-> char_lit «")"» + LexTerm : •Λ<~> char_lit «")"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «")"» + LexTerm : •regDefId «")"» + LexTerm : •Λ<[> Π Λ<]> «")"» + LexTerm : •Λ<{> Π Λ<}> «")"» + LexTerm : •Λ<(> Π Λ<)> «")"» + LexAlt : •Π «"("» + LexAlt : •Π «"."» + LexAlt : •Π «"["» + LexAlt : •Π «char_lit» + LexAlt : •Π «regDefId» + LexAlt : •Π «"{"» + LexAlt : •Π «"~"» + LexAlt : •Π Π «"("» + LexAlt : •Π Π «"."» + LexAlt : •Π Π «"["» + LexAlt : •Π Π «char_lit» + LexAlt : •Π Π «regDefId» + LexAlt : •Π Π «"{"» + LexAlt : •Π Π «"~"» + LexAlt : •Π «"|"» + LexAlt : •Π Π «"|"» + LexTerm : •Λ<.> «"("» + LexTerm : •char_lit «"("» + LexTerm : •char_lit Λ<-> char_lit «"("» + LexTerm : •Λ<~> char_lit «"("» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"("» + LexTerm : •regDefId «"("» + LexTerm : •Λ<[> Π Λ<]> «"("» + LexTerm : •Λ<{> Π Λ<}> «"("» + LexTerm : •Λ<(> Π Λ<)> «"("» + LexTerm : •Λ<.> «"."» + LexTerm : •char_lit «"."» + LexTerm : •char_lit Λ<-> char_lit «"."» + LexTerm : •Λ<~> char_lit «"."» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"."» + LexTerm : •regDefId «"."» + LexTerm : •Λ<[> Π Λ<]> «"."» + LexTerm : •Λ<{> Π Λ<}> «"."» + LexTerm : •Λ<(> Π Λ<)> «"."» + LexTerm : •Λ<.> «"["» + LexTerm : •char_lit «"["» + LexTerm : •char_lit Λ<-> char_lit «"["» + LexTerm : •Λ<~> char_lit «"["» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"["» + LexTerm : •regDefId «"["» + LexTerm : •Λ<[> Π Λ<]> «"["» + LexTerm : •Λ<{> Π Λ<}> «"["» + LexTerm : •Λ<(> Π Λ<)> «"["» + LexTerm : •Λ<.> «char_lit» LexTerm : •char_lit «char_lit» - LexTerm : •char_lit - char_lit «char_lit» - LexTerm : •~ char_lit «char_lit» - LexTerm : •~ ( char_lit - char_lit ) «char_lit» + LexTerm : •char_lit Λ<-> char_lit «char_lit» + LexTerm : •Λ<~> char_lit «char_lit» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «char_lit» LexTerm : •regDefId «char_lit» - LexTerm : •[ LexPattern ] «char_lit» - LexTerm : •{ LexPattern } «char_lit» - LexTerm : •( LexPattern ) «char_lit» - LexTerm : •. «regDefId» + LexTerm : •Λ<[> Π Λ<]> «char_lit» + LexTerm : •Λ<{> Π Λ<}> «char_lit» + LexTerm : •Λ<(> Π Λ<)> «char_lit» + LexTerm : •Λ<.> «regDefId» LexTerm : •char_lit «regDefId» - LexTerm : •char_lit - char_lit «regDefId» - LexTerm : •~ char_lit «regDefId» - LexTerm : •~ ( char_lit - char_lit ) «regDefId» + LexTerm : •char_lit Λ<-> char_lit «regDefId» + LexTerm : •Λ<~> char_lit «regDefId» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «regDefId» LexTerm : •regDefId «regDefId» - LexTerm : •[ LexPattern ] «regDefId» - LexTerm : •{ LexPattern } «regDefId» - LexTerm : •( LexPattern ) «regDefId» - LexTerm : •. «{» - LexTerm : •char_lit «{» - LexTerm : •char_lit - char_lit «{» - LexTerm : •~ char_lit «{» - LexTerm : •~ ( char_lit - char_lit ) «{» - LexTerm : •regDefId «{» - LexTerm : •[ LexPattern ] «{» - LexTerm : •{ LexPattern } «{» - LexTerm : •( LexPattern ) «{» - LexTerm : •. «~» - LexTerm : •char_lit «~» - LexTerm : •char_lit - char_lit «~» - LexTerm : •~ char_lit «~» - LexTerm : •~ ( char_lit - char_lit ) «~» - LexTerm : •regDefId «~» - LexTerm : •[ LexPattern ] «~» - LexTerm : •{ LexPattern } «~» - LexTerm : •( LexPattern ) «~» - LexTerm : •. «|» - LexTerm : •char_lit «|» - LexTerm : •char_lit - char_lit «|» - LexTerm : •~ char_lit «|» - LexTerm : •~ ( char_lit - char_lit ) «|» - LexTerm : •regDefId «|» - LexTerm : •[ LexPattern ] «|» - LexTerm : •{ LexPattern } «|» - LexTerm : •( LexPattern ) «|» -} -Transitions: - LexAlt -> 54 - LexTerm -> 55 + LexTerm : •Λ<[> Π Λ<]> «regDefId» + LexTerm : •Λ<{> Π Λ<}> «regDefId» + LexTerm : •Λ<(> Π Λ<)> «regDefId» + LexTerm : •Λ<.> «"{"» + LexTerm : •char_lit «"{"» + LexTerm : •char_lit Λ<-> char_lit «"{"» + LexTerm : •Λ<~> char_lit «"{"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"{"» + LexTerm : •regDefId «"{"» + LexTerm : •Λ<[> Π Λ<]> «"{"» + LexTerm : •Λ<{> Π Λ<}> «"{"» + LexTerm : •Λ<(> Π Λ<)> «"{"» + LexTerm : •Λ<.> «"~"» + LexTerm : •char_lit «"~"» + LexTerm : •char_lit Λ<-> char_lit «"~"» + LexTerm : •Λ<~> char_lit «"~"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"~"» + LexTerm : •regDefId «"~"» + LexTerm : •Λ<[> Π Λ<]> «"~"» + LexTerm : •Λ<{> Π Λ<}> «"~"» + LexTerm : •Λ<(> Π Λ<)> «"~"» + LexTerm : •Λ<.> «"|"» + LexTerm : •char_lit «"|"» + LexTerm : •char_lit Λ<-> char_lit «"|"» + LexTerm : •Λ<~> char_lit «"|"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"|"» + LexTerm : •regDefId «"|"» + LexTerm : •Λ<[> Π Λ<]> «"|"» + LexTerm : •Λ<{> Π Λ<}> «"|"» + LexTerm : •Λ<(> Π Λ<)> «"|"» +} +Transitions: + Π -> 54 + Π -> 55 regDefId -> 56 - . -> 57 + Λ<.> -> 57 char_lit -> 58 - ~ -> 59 - ( -> 60 - [ -> 61 - { -> 62 - LexPattern -> 100 + Λ<~> -> 59 + Λ<(> -> 60 + Λ<[> -> 61 + Λ<{> -> 62 + Π -> 100 S61{ - LexTerm : [ •LexPattern ] «)» - LexTerm : [ •LexPattern ] «(» - LexTerm : [ •LexPattern ] «.» - LexTerm : [ •LexPattern ] «[» - LexTerm : [ •LexPattern ] «char_lit» - LexTerm : [ •LexPattern ] «regDefId» - LexTerm : [ •LexPattern ] «{» - LexTerm : [ •LexPattern ] «~» - LexTerm : [ •LexPattern ] «|» - LexPattern : •LexAlt «]» - LexPattern : •LexPattern | LexAlt «]» - LexAlt : •LexTerm «]» - LexAlt : •LexAlt LexTerm «]» - LexPattern : •LexAlt «|» - LexPattern : •LexPattern | LexAlt «|» - LexTerm : •. «]» - LexTerm : •char_lit «]» - LexTerm : •char_lit - char_lit «]» - LexTerm : •~ char_lit «]» - LexTerm : •~ ( char_lit - char_lit ) «]» - LexTerm : •regDefId «]» - LexTerm : •[ LexPattern ] «]» - LexTerm : •{ LexPattern } «]» - LexTerm : •( LexPattern ) «]» - LexAlt : •LexTerm «(» - LexAlt : •LexTerm «.» - LexAlt : •LexTerm «[» - LexAlt : •LexTerm «char_lit» - LexAlt : •LexTerm «regDefId» - LexAlt : •LexTerm «{» - LexAlt : •LexTerm «~» - LexAlt : •LexAlt LexTerm «(» - LexAlt : •LexAlt LexTerm «.» - LexAlt : •LexAlt LexTerm «[» - LexAlt : •LexAlt LexTerm «char_lit» - LexAlt : •LexAlt LexTerm «regDefId» - LexAlt : •LexAlt LexTerm «{» - LexAlt : •LexAlt LexTerm «~» - LexAlt : •LexTerm «|» - LexAlt : •LexAlt LexTerm «|» - LexTerm : •. «(» - LexTerm : •char_lit «(» - LexTerm : •char_lit - char_lit «(» - LexTerm : •~ char_lit «(» - LexTerm : •~ ( char_lit - char_lit ) «(» - LexTerm : •regDefId «(» - LexTerm : •[ LexPattern ] «(» - LexTerm : •{ LexPattern } «(» - LexTerm : •( LexPattern ) «(» - LexTerm : •. «.» - LexTerm : •char_lit «.» - LexTerm : •char_lit - char_lit «.» - LexTerm : •~ char_lit «.» - LexTerm : •~ ( char_lit - char_lit ) «.» - LexTerm : •regDefId «.» - LexTerm : •[ LexPattern ] «.» - LexTerm : •{ LexPattern } «.» - LexTerm : •( LexPattern ) «.» - LexTerm : •. «[» - LexTerm : •char_lit «[» - LexTerm : •char_lit - char_lit «[» - LexTerm : •~ char_lit «[» - LexTerm : •~ ( char_lit - char_lit ) «[» - LexTerm : •regDefId «[» - LexTerm : •[ LexPattern ] «[» - LexTerm : •{ LexPattern } «[» - LexTerm : •( LexPattern ) «[» - LexTerm : •. «char_lit» + LexTerm : Λ<[> •Π Λ<]> «")"» + LexTerm : Λ<[> •Π Λ<]> «"("» + LexTerm : Λ<[> •Π Λ<]> «"."» + LexTerm : Λ<[> •Π Λ<]> «"["» + LexTerm : Λ<[> •Π Λ<]> «char_lit» + LexTerm : Λ<[> •Π Λ<]> «regDefId» + LexTerm : Λ<[> •Π Λ<]> «"{"» + LexTerm : Λ<[> •Π Λ<]> «"~"» + LexTerm : Λ<[> •Π Λ<]> «"|"» + LexPattern : •Π «"]"» + LexPattern : •Π Λ<|> Π «"]"» + LexAlt : •Π «"]"» + LexAlt : •Π Π «"]"» + LexPattern : •Π «"|"» + LexPattern : •Π Λ<|> Π «"|"» + LexTerm : •Λ<.> «"]"» + LexTerm : •char_lit «"]"» + LexTerm : •char_lit Λ<-> char_lit «"]"» + LexTerm : •Λ<~> char_lit «"]"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"]"» + LexTerm : •regDefId «"]"» + LexTerm : •Λ<[> Π Λ<]> «"]"» + LexTerm : •Λ<{> Π Λ<}> «"]"» + LexTerm : •Λ<(> Π Λ<)> «"]"» + LexAlt : •Π «"("» + LexAlt : •Π «"."» + LexAlt : •Π «"["» + LexAlt : •Π «char_lit» + LexAlt : •Π «regDefId» + LexAlt : •Π «"{"» + LexAlt : •Π «"~"» + LexAlt : •Π Π «"("» + LexAlt : •Π Π «"."» + LexAlt : •Π Π «"["» + LexAlt : •Π Π «char_lit» + LexAlt : •Π Π «regDefId» + LexAlt : •Π Π «"{"» + LexAlt : •Π Π «"~"» + LexAlt : •Π «"|"» + LexAlt : •Π Π «"|"» + LexTerm : •Λ<.> «"("» + LexTerm : •char_lit «"("» + LexTerm : •char_lit Λ<-> char_lit «"("» + LexTerm : •Λ<~> char_lit «"("» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"("» + LexTerm : •regDefId «"("» + LexTerm : •Λ<[> Π Λ<]> «"("» + LexTerm : •Λ<{> Π Λ<}> «"("» + LexTerm : •Λ<(> Π Λ<)> «"("» + LexTerm : •Λ<.> «"."» + LexTerm : •char_lit «"."» + LexTerm : •char_lit Λ<-> char_lit «"."» + LexTerm : •Λ<~> char_lit «"."» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"."» + LexTerm : •regDefId «"."» + LexTerm : •Λ<[> Π Λ<]> «"."» + LexTerm : •Λ<{> Π Λ<}> «"."» + LexTerm : •Λ<(> Π Λ<)> «"."» + LexTerm : •Λ<.> «"["» + LexTerm : •char_lit «"["» + LexTerm : •char_lit Λ<-> char_lit «"["» + LexTerm : •Λ<~> char_lit «"["» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"["» + LexTerm : •regDefId «"["» + LexTerm : •Λ<[> Π Λ<]> «"["» + LexTerm : •Λ<{> Π Λ<}> «"["» + LexTerm : •Λ<(> Π Λ<)> «"["» + LexTerm : •Λ<.> «char_lit» LexTerm : •char_lit «char_lit» - LexTerm : •char_lit - char_lit «char_lit» - LexTerm : •~ char_lit «char_lit» - LexTerm : •~ ( char_lit - char_lit ) «char_lit» + LexTerm : •char_lit Λ<-> char_lit «char_lit» + LexTerm : •Λ<~> char_lit «char_lit» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «char_lit» LexTerm : •regDefId «char_lit» - LexTerm : •[ LexPattern ] «char_lit» - LexTerm : •{ LexPattern } «char_lit» - LexTerm : •( LexPattern ) «char_lit» - LexTerm : •. «regDefId» + LexTerm : •Λ<[> Π Λ<]> «char_lit» + LexTerm : •Λ<{> Π Λ<}> «char_lit» + LexTerm : •Λ<(> Π Λ<)> «char_lit» + LexTerm : •Λ<.> «regDefId» LexTerm : •char_lit «regDefId» - LexTerm : •char_lit - char_lit «regDefId» - LexTerm : •~ char_lit «regDefId» - LexTerm : •~ ( char_lit - char_lit ) «regDefId» + LexTerm : •char_lit Λ<-> char_lit «regDefId» + LexTerm : •Λ<~> char_lit «regDefId» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «regDefId» LexTerm : •regDefId «regDefId» - LexTerm : •[ LexPattern ] «regDefId» - LexTerm : •{ LexPattern } «regDefId» - LexTerm : •( LexPattern ) «regDefId» - LexTerm : •. «{» - LexTerm : •char_lit «{» - LexTerm : •char_lit - char_lit «{» - LexTerm : •~ char_lit «{» - LexTerm : •~ ( char_lit - char_lit ) «{» - LexTerm : •regDefId «{» - LexTerm : •[ LexPattern ] «{» - LexTerm : •{ LexPattern } «{» - LexTerm : •( LexPattern ) «{» - LexTerm : •. «~» - LexTerm : •char_lit «~» - LexTerm : •char_lit - char_lit «~» - LexTerm : •~ char_lit «~» - LexTerm : •~ ( char_lit - char_lit ) «~» - LexTerm : •regDefId «~» - LexTerm : •[ LexPattern ] «~» - LexTerm : •{ LexPattern } «~» - LexTerm : •( LexPattern ) «~» - LexTerm : •. «|» - LexTerm : •char_lit «|» - LexTerm : •char_lit - char_lit «|» - LexTerm : •~ char_lit «|» - LexTerm : •~ ( char_lit - char_lit ) «|» - LexTerm : •regDefId «|» - LexTerm : •[ LexPattern ] «|» - LexTerm : •{ LexPattern } «|» - LexTerm : •( LexPattern ) «|» -} -Transitions: - LexAlt -> 64 - LexTerm -> 65 + LexTerm : •Λ<[> Π Λ<]> «regDefId» + LexTerm : •Λ<{> Π Λ<}> «regDefId» + LexTerm : •Λ<(> Π Λ<)> «regDefId» + LexTerm : •Λ<.> «"{"» + LexTerm : •char_lit «"{"» + LexTerm : •char_lit Λ<-> char_lit «"{"» + LexTerm : •Λ<~> char_lit «"{"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"{"» + LexTerm : •regDefId «"{"» + LexTerm : •Λ<[> Π Λ<]> «"{"» + LexTerm : •Λ<{> Π Λ<}> «"{"» + LexTerm : •Λ<(> Π Λ<)> «"{"» + LexTerm : •Λ<.> «"~"» + LexTerm : •char_lit «"~"» + LexTerm : •char_lit Λ<-> char_lit «"~"» + LexTerm : •Λ<~> char_lit «"~"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"~"» + LexTerm : •regDefId «"~"» + LexTerm : •Λ<[> Π Λ<]> «"~"» + LexTerm : •Λ<{> Π Λ<}> «"~"» + LexTerm : •Λ<(> Π Λ<)> «"~"» + LexTerm : •Λ<.> «"|"» + LexTerm : •char_lit «"|"» + LexTerm : •char_lit Λ<-> char_lit «"|"» + LexTerm : •Λ<~> char_lit «"|"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"|"» + LexTerm : •regDefId «"|"» + LexTerm : •Λ<[> Π Λ<]> «"|"» + LexTerm : •Λ<{> Π Λ<}> «"|"» + LexTerm : •Λ<(> Π Λ<)> «"|"» +} +Transitions: + Π -> 64 + Π -> 65 regDefId -> 66 - . -> 67 + Λ<.> -> 67 char_lit -> 68 - ~ -> 69 - ( -> 70 - [ -> 71 - { -> 72 - LexPattern -> 101 + Λ<~> -> 69 + Λ<(> -> 70 + Λ<[> -> 71 + Λ<{> -> 72 + Π -> 101 S62{ - LexTerm : { •LexPattern } «)» - LexTerm : { •LexPattern } «(» - LexTerm : { •LexPattern } «.» - LexTerm : { •LexPattern } «[» - LexTerm : { •LexPattern } «char_lit» - LexTerm : { •LexPattern } «regDefId» - LexTerm : { •LexPattern } «{» - LexTerm : { •LexPattern } «~» - LexTerm : { •LexPattern } «|» - LexPattern : •LexAlt «}» - LexPattern : •LexPattern | LexAlt «}» - LexAlt : •LexTerm «}» - LexAlt : •LexAlt LexTerm «}» - LexPattern : •LexAlt «|» - LexPattern : •LexPattern | LexAlt «|» - LexTerm : •. «}» - LexTerm : •char_lit «}» - LexTerm : •char_lit - char_lit «}» - LexTerm : •~ char_lit «}» - LexTerm : •~ ( char_lit - char_lit ) «}» - LexTerm : •regDefId «}» - LexTerm : •[ LexPattern ] «}» - LexTerm : •{ LexPattern } «}» - LexTerm : •( LexPattern ) «}» - LexAlt : •LexTerm «(» - LexAlt : •LexTerm «.» - LexAlt : •LexTerm «[» - LexAlt : •LexTerm «char_lit» - LexAlt : •LexTerm «regDefId» - LexAlt : •LexTerm «{» - LexAlt : •LexTerm «~» - LexAlt : •LexAlt LexTerm «(» - LexAlt : •LexAlt LexTerm «.» - LexAlt : •LexAlt LexTerm «[» - LexAlt : •LexAlt LexTerm «char_lit» - LexAlt : •LexAlt LexTerm «regDefId» - LexAlt : •LexAlt LexTerm «{» - LexAlt : •LexAlt LexTerm «~» - LexAlt : •LexTerm «|» - LexAlt : •LexAlt LexTerm «|» - LexTerm : •. «(» - LexTerm : •char_lit «(» - LexTerm : •char_lit - char_lit «(» - LexTerm : •~ char_lit «(» - LexTerm : •~ ( char_lit - char_lit ) «(» - LexTerm : •regDefId «(» - LexTerm : •[ LexPattern ] «(» - LexTerm : •{ LexPattern } «(» - LexTerm : •( LexPattern ) «(» - LexTerm : •. «.» - LexTerm : •char_lit «.» - LexTerm : •char_lit - char_lit «.» - LexTerm : •~ char_lit «.» - LexTerm : •~ ( char_lit - char_lit ) «.» - LexTerm : •regDefId «.» - LexTerm : •[ LexPattern ] «.» - LexTerm : •{ LexPattern } «.» - LexTerm : •( LexPattern ) «.» - LexTerm : •. «[» - LexTerm : •char_lit «[» - LexTerm : •char_lit - char_lit «[» - LexTerm : •~ char_lit «[» - LexTerm : •~ ( char_lit - char_lit ) «[» - LexTerm : •regDefId «[» - LexTerm : •[ LexPattern ] «[» - LexTerm : •{ LexPattern } «[» - LexTerm : •( LexPattern ) «[» - LexTerm : •. «char_lit» + LexTerm : Λ<{> •Π Λ<}> «")"» + LexTerm : Λ<{> •Π Λ<}> «"("» + LexTerm : Λ<{> •Π Λ<}> «"."» + LexTerm : Λ<{> •Π Λ<}> «"["» + LexTerm : Λ<{> •Π Λ<}> «char_lit» + LexTerm : Λ<{> •Π Λ<}> «regDefId» + LexTerm : Λ<{> •Π Λ<}> «"{"» + LexTerm : Λ<{> •Π Λ<}> «"~"» + LexTerm : Λ<{> •Π Λ<}> «"|"» + LexPattern : •Π «"}"» + LexPattern : •Π Λ<|> Π «"}"» + LexAlt : •Π «"}"» + LexAlt : •Π Π «"}"» + LexPattern : •Π «"|"» + LexPattern : •Π Λ<|> Π «"|"» + LexTerm : •Λ<.> «"}"» + LexTerm : •char_lit «"}"» + LexTerm : •char_lit Λ<-> char_lit «"}"» + LexTerm : •Λ<~> char_lit «"}"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"}"» + LexTerm : •regDefId «"}"» + LexTerm : •Λ<[> Π Λ<]> «"}"» + LexTerm : •Λ<{> Π Λ<}> «"}"» + LexTerm : •Λ<(> Π Λ<)> «"}"» + LexAlt : •Π «"("» + LexAlt : •Π «"."» + LexAlt : •Π «"["» + LexAlt : •Π «char_lit» + LexAlt : •Π «regDefId» + LexAlt : •Π «"{"» + LexAlt : •Π «"~"» + LexAlt : •Π Π «"("» + LexAlt : •Π Π «"."» + LexAlt : •Π Π «"["» + LexAlt : •Π Π «char_lit» + LexAlt : •Π Π «regDefId» + LexAlt : •Π Π «"{"» + LexAlt : •Π Π «"~"» + LexAlt : •Π «"|"» + LexAlt : •Π Π «"|"» + LexTerm : •Λ<.> «"("» + LexTerm : •char_lit «"("» + LexTerm : •char_lit Λ<-> char_lit «"("» + LexTerm : •Λ<~> char_lit «"("» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"("» + LexTerm : •regDefId «"("» + LexTerm : •Λ<[> Π Λ<]> «"("» + LexTerm : •Λ<{> Π Λ<}> «"("» + LexTerm : •Λ<(> Π Λ<)> «"("» + LexTerm : •Λ<.> «"."» + LexTerm : •char_lit «"."» + LexTerm : •char_lit Λ<-> char_lit «"."» + LexTerm : •Λ<~> char_lit «"."» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"."» + LexTerm : •regDefId «"."» + LexTerm : •Λ<[> Π Λ<]> «"."» + LexTerm : •Λ<{> Π Λ<}> «"."» + LexTerm : •Λ<(> Π Λ<)> «"."» + LexTerm : •Λ<.> «"["» + LexTerm : •char_lit «"["» + LexTerm : •char_lit Λ<-> char_lit «"["» + LexTerm : •Λ<~> char_lit «"["» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"["» + LexTerm : •regDefId «"["» + LexTerm : •Λ<[> Π Λ<]> «"["» + LexTerm : •Λ<{> Π Λ<}> «"["» + LexTerm : •Λ<(> Π Λ<)> «"["» + LexTerm : •Λ<.> «char_lit» LexTerm : •char_lit «char_lit» - LexTerm : •char_lit - char_lit «char_lit» - LexTerm : •~ char_lit «char_lit» - LexTerm : •~ ( char_lit - char_lit ) «char_lit» + LexTerm : •char_lit Λ<-> char_lit «char_lit» + LexTerm : •Λ<~> char_lit «char_lit» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «char_lit» LexTerm : •regDefId «char_lit» - LexTerm : •[ LexPattern ] «char_lit» - LexTerm : •{ LexPattern } «char_lit» - LexTerm : •( LexPattern ) «char_lit» - LexTerm : •. «regDefId» + LexTerm : •Λ<[> Π Λ<]> «char_lit» + LexTerm : •Λ<{> Π Λ<}> «char_lit» + LexTerm : •Λ<(> Π Λ<)> «char_lit» + LexTerm : •Λ<.> «regDefId» LexTerm : •char_lit «regDefId» - LexTerm : •char_lit - char_lit «regDefId» - LexTerm : •~ char_lit «regDefId» - LexTerm : •~ ( char_lit - char_lit ) «regDefId» + LexTerm : •char_lit Λ<-> char_lit «regDefId» + LexTerm : •Λ<~> char_lit «regDefId» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «regDefId» LexTerm : •regDefId «regDefId» - LexTerm : •[ LexPattern ] «regDefId» - LexTerm : •{ LexPattern } «regDefId» - LexTerm : •( LexPattern ) «regDefId» - LexTerm : •. «{» - LexTerm : •char_lit «{» - LexTerm : •char_lit - char_lit «{» - LexTerm : •~ char_lit «{» - LexTerm : •~ ( char_lit - char_lit ) «{» - LexTerm : •regDefId «{» - LexTerm : •[ LexPattern ] «{» - LexTerm : •{ LexPattern } «{» - LexTerm : •( LexPattern ) «{» - LexTerm : •. «~» - LexTerm : •char_lit «~» - LexTerm : •char_lit - char_lit «~» - LexTerm : •~ char_lit «~» - LexTerm : •~ ( char_lit - char_lit ) «~» - LexTerm : •regDefId «~» - LexTerm : •[ LexPattern ] «~» - LexTerm : •{ LexPattern } «~» - LexTerm : •( LexPattern ) «~» - LexTerm : •. «|» - LexTerm : •char_lit «|» - LexTerm : •char_lit - char_lit «|» - LexTerm : •~ char_lit «|» - LexTerm : •~ ( char_lit - char_lit ) «|» - LexTerm : •regDefId «|» - LexTerm : •[ LexPattern ] «|» - LexTerm : •{ LexPattern } «|» - LexTerm : •( LexPattern ) «|» -} -Transitions: - LexAlt -> 74 - LexTerm -> 75 + LexTerm : •Λ<[> Π Λ<]> «regDefId» + LexTerm : •Λ<{> Π Λ<}> «regDefId» + LexTerm : •Λ<(> Π Λ<)> «regDefId» + LexTerm : •Λ<.> «"{"» + LexTerm : •char_lit «"{"» + LexTerm : •char_lit Λ<-> char_lit «"{"» + LexTerm : •Λ<~> char_lit «"{"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"{"» + LexTerm : •regDefId «"{"» + LexTerm : •Λ<[> Π Λ<]> «"{"» + LexTerm : •Λ<{> Π Λ<}> «"{"» + LexTerm : •Λ<(> Π Λ<)> «"{"» + LexTerm : •Λ<.> «"~"» + LexTerm : •char_lit «"~"» + LexTerm : •char_lit Λ<-> char_lit «"~"» + LexTerm : •Λ<~> char_lit «"~"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"~"» + LexTerm : •regDefId «"~"» + LexTerm : •Λ<[> Π Λ<]> «"~"» + LexTerm : •Λ<{> Π Λ<}> «"~"» + LexTerm : •Λ<(> Π Λ<)> «"~"» + LexTerm : •Λ<.> «"|"» + LexTerm : •char_lit «"|"» + LexTerm : •char_lit Λ<-> char_lit «"|"» + LexTerm : •Λ<~> char_lit «"|"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"|"» + LexTerm : •regDefId «"|"» + LexTerm : •Λ<[> Π Λ<]> «"|"» + LexTerm : •Λ<{> Π Λ<}> «"|"» + LexTerm : •Λ<(> Π Λ<)> «"|"» +} +Transitions: + Π -> 74 + Π -> 75 regDefId -> 76 - . -> 77 + Λ<.> -> 77 char_lit -> 78 - ~ -> 79 - ( -> 80 - [ -> 81 - { -> 82 - LexPattern -> 102 + Λ<~> -> 79 + Λ<(> -> 80 + Λ<[> -> 81 + Λ<{> -> 82 + Π -> 102 S63{ - LexTerm : [ LexPattern •] «;» - LexTerm : [ LexPattern •] «(» - LexTerm : [ LexPattern •] «.» - LexTerm : [ LexPattern •] «[» - LexTerm : [ LexPattern •] «char_lit» - LexTerm : [ LexPattern •] «regDefId» - LexTerm : [ LexPattern •] «{» - LexTerm : [ LexPattern •] «~» - LexTerm : [ LexPattern •] «|» - LexPattern : LexPattern •| LexAlt «]» - LexPattern : LexPattern •| LexAlt «|» + LexTerm : Λ<[> Π •Λ<]> «";"» + LexTerm : Λ<[> Π •Λ<]> «"("» + LexTerm : Λ<[> Π •Λ<]> «"."» + LexTerm : Λ<[> Π •Λ<]> «"["» + LexTerm : Λ<[> Π •Λ<]> «char_lit» + LexTerm : Λ<[> Π •Λ<]> «regDefId» + LexTerm : Λ<[> Π •Λ<]> «"{"» + LexTerm : Λ<[> Π •Λ<]> «"~"» + LexTerm : Λ<[> Π •Λ<]> «"|"» + LexPattern : Π •Λ<|> Π «"]"» + LexPattern : Π •Λ<|> Π «"|"» } Transitions: - | -> 103 - ] -> 104 + Λ<|> -> 103 + Λ<]> -> 104 S64{ - LexPattern : LexAlt• «]» - LexAlt : LexAlt •LexTerm «]» - LexPattern : LexAlt• «|» - LexAlt : LexAlt •LexTerm «(» - LexAlt : LexAlt •LexTerm «.» - LexAlt : LexAlt •LexTerm «[» - LexAlt : LexAlt •LexTerm «char_lit» - LexAlt : LexAlt •LexTerm «regDefId» - LexAlt : LexAlt •LexTerm «{» - LexAlt : LexAlt •LexTerm «~» - LexAlt : LexAlt •LexTerm «|» - LexTerm : •. «]» - LexTerm : •char_lit «]» - LexTerm : •char_lit - char_lit «]» - LexTerm : •~ char_lit «]» - LexTerm : •~ ( char_lit - char_lit ) «]» - LexTerm : •regDefId «]» - LexTerm : •[ LexPattern ] «]» - LexTerm : •{ LexPattern } «]» - LexTerm : •( LexPattern ) «]» - LexTerm : •. «(» - LexTerm : •char_lit «(» - LexTerm : •char_lit - char_lit «(» - LexTerm : •~ char_lit «(» - LexTerm : •~ ( char_lit - char_lit ) «(» - LexTerm : •regDefId «(» - LexTerm : •[ LexPattern ] «(» - LexTerm : •{ LexPattern } «(» - LexTerm : •( LexPattern ) «(» - LexTerm : •. «.» - LexTerm : •char_lit «.» - LexTerm : •char_lit - char_lit «.» - LexTerm : •~ char_lit «.» - LexTerm : •~ ( char_lit - char_lit ) «.» - LexTerm : •regDefId «.» - LexTerm : •[ LexPattern ] «.» - LexTerm : •{ LexPattern } «.» - LexTerm : •( LexPattern ) «.» - LexTerm : •. «[» - LexTerm : •char_lit «[» - LexTerm : •char_lit - char_lit «[» - LexTerm : •~ char_lit «[» - LexTerm : •~ ( char_lit - char_lit ) «[» - LexTerm : •regDefId «[» - LexTerm : •[ LexPattern ] «[» - LexTerm : •{ LexPattern } «[» - LexTerm : •( LexPattern ) «[» - LexTerm : •. «char_lit» + LexPattern : Π• «"]"» + LexAlt : Π •Π «"]"» + LexPattern : Π• «"|"» + LexAlt : Π •Π «"("» + LexAlt : Π •Π «"."» + LexAlt : Π •Π «"["» + LexAlt : Π •Π «char_lit» + LexAlt : Π •Π «regDefId» + LexAlt : Π •Π «"{"» + LexAlt : Π •Π «"~"» + LexAlt : Π •Π «"|"» + LexTerm : •Λ<.> «"]"» + LexTerm : •char_lit «"]"» + LexTerm : •char_lit Λ<-> char_lit «"]"» + LexTerm : •Λ<~> char_lit «"]"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"]"» + LexTerm : •regDefId «"]"» + LexTerm : •Λ<[> Π Λ<]> «"]"» + LexTerm : •Λ<{> Π Λ<}> «"]"» + LexTerm : •Λ<(> Π Λ<)> «"]"» + LexTerm : •Λ<.> «"("» + LexTerm : •char_lit «"("» + LexTerm : •char_lit Λ<-> char_lit «"("» + LexTerm : •Λ<~> char_lit «"("» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"("» + LexTerm : •regDefId «"("» + LexTerm : •Λ<[> Π Λ<]> «"("» + LexTerm : •Λ<{> Π Λ<}> «"("» + LexTerm : •Λ<(> Π Λ<)> «"("» + LexTerm : •Λ<.> «"."» + LexTerm : •char_lit «"."» + LexTerm : •char_lit Λ<-> char_lit «"."» + LexTerm : •Λ<~> char_lit «"."» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"."» + LexTerm : •regDefId «"."» + LexTerm : •Λ<[> Π Λ<]> «"."» + LexTerm : •Λ<{> Π Λ<}> «"."» + LexTerm : •Λ<(> Π Λ<)> «"."» + LexTerm : •Λ<.> «"["» + LexTerm : •char_lit «"["» + LexTerm : •char_lit Λ<-> char_lit «"["» + LexTerm : •Λ<~> char_lit «"["» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"["» + LexTerm : •regDefId «"["» + LexTerm : •Λ<[> Π Λ<]> «"["» + LexTerm : •Λ<{> Π Λ<}> «"["» + LexTerm : •Λ<(> Π Λ<)> «"["» + LexTerm : •Λ<.> «char_lit» LexTerm : •char_lit «char_lit» - LexTerm : •char_lit - char_lit «char_lit» - LexTerm : •~ char_lit «char_lit» - LexTerm : •~ ( char_lit - char_lit ) «char_lit» + LexTerm : •char_lit Λ<-> char_lit «char_lit» + LexTerm : •Λ<~> char_lit «char_lit» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «char_lit» LexTerm : •regDefId «char_lit» - LexTerm : •[ LexPattern ] «char_lit» - LexTerm : •{ LexPattern } «char_lit» - LexTerm : •( LexPattern ) «char_lit» - LexTerm : •. «regDefId» + LexTerm : •Λ<[> Π Λ<]> «char_lit» + LexTerm : •Λ<{> Π Λ<}> «char_lit» + LexTerm : •Λ<(> Π Λ<)> «char_lit» + LexTerm : •Λ<.> «regDefId» LexTerm : •char_lit «regDefId» - LexTerm : •char_lit - char_lit «regDefId» - LexTerm : •~ char_lit «regDefId» - LexTerm : •~ ( char_lit - char_lit ) «regDefId» + LexTerm : •char_lit Λ<-> char_lit «regDefId» + LexTerm : •Λ<~> char_lit «regDefId» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «regDefId» LexTerm : •regDefId «regDefId» - LexTerm : •[ LexPattern ] «regDefId» - LexTerm : •{ LexPattern } «regDefId» - LexTerm : •( LexPattern ) «regDefId» - LexTerm : •. «{» - LexTerm : •char_lit «{» - LexTerm : •char_lit - char_lit «{» - LexTerm : •~ char_lit «{» - LexTerm : •~ ( char_lit - char_lit ) «{» - LexTerm : •regDefId «{» - LexTerm : •[ LexPattern ] «{» - LexTerm : •{ LexPattern } «{» - LexTerm : •( LexPattern ) «{» - LexTerm : •. «~» - LexTerm : •char_lit «~» - LexTerm : •char_lit - char_lit «~» - LexTerm : •~ char_lit «~» - LexTerm : •~ ( char_lit - char_lit ) «~» - LexTerm : •regDefId «~» - LexTerm : •[ LexPattern ] «~» - LexTerm : •{ LexPattern } «~» - LexTerm : •( LexPattern ) «~» - LexTerm : •. «|» - LexTerm : •char_lit «|» - LexTerm : •char_lit - char_lit «|» - LexTerm : •~ char_lit «|» - LexTerm : •~ ( char_lit - char_lit ) «|» - LexTerm : •regDefId «|» - LexTerm : •[ LexPattern ] «|» - LexTerm : •{ LexPattern } «|» - LexTerm : •( LexPattern ) «|» + LexTerm : •Λ<[> Π Λ<]> «regDefId» + LexTerm : •Λ<{> Π Λ<}> «regDefId» + LexTerm : •Λ<(> Π Λ<)> «regDefId» + LexTerm : •Λ<.> «"{"» + LexTerm : •char_lit «"{"» + LexTerm : •char_lit Λ<-> char_lit «"{"» + LexTerm : •Λ<~> char_lit «"{"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"{"» + LexTerm : •regDefId «"{"» + LexTerm : •Λ<[> Π Λ<]> «"{"» + LexTerm : •Λ<{> Π Λ<}> «"{"» + LexTerm : •Λ<(> Π Λ<)> «"{"» + LexTerm : •Λ<.> «"~"» + LexTerm : •char_lit «"~"» + LexTerm : •char_lit Λ<-> char_lit «"~"» + LexTerm : •Λ<~> char_lit «"~"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"~"» + LexTerm : •regDefId «"~"» + LexTerm : •Λ<[> Π Λ<]> «"~"» + LexTerm : •Λ<{> Π Λ<}> «"~"» + LexTerm : •Λ<(> Π Λ<)> «"~"» + LexTerm : •Λ<.> «"|"» + LexTerm : •char_lit «"|"» + LexTerm : •char_lit Λ<-> char_lit «"|"» + LexTerm : •Λ<~> char_lit «"|"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"|"» + LexTerm : •regDefId «"|"» + LexTerm : •Λ<[> Π Λ<]> «"|"» + LexTerm : •Λ<{> Π Λ<}> «"|"» + LexTerm : •Λ<(> Π Λ<)> «"|"» } Transitions: regDefId -> 66 - . -> 67 + Λ<.> -> 67 char_lit -> 68 - ~ -> 69 - ( -> 70 - [ -> 71 - { -> 72 - LexTerm -> 105 + Λ<~> -> 69 + Λ<(> -> 70 + Λ<[> -> 71 + Λ<{> -> 72 + Π -> 105 S65{ - LexAlt : LexTerm• «]» - LexAlt : LexTerm• «(» - LexAlt : LexTerm• «.» - LexAlt : LexTerm• «[» - LexAlt : LexTerm• «char_lit» - LexAlt : LexTerm• «regDefId» - LexAlt : LexTerm• «{» - LexAlt : LexTerm• «~» - LexAlt : LexTerm• «|» + LexAlt : Π• «"]"» + LexAlt : Π• «"("» + LexAlt : Π• «"."» + LexAlt : Π• «"["» + LexAlt : Π• «char_lit» + LexAlt : Π• «regDefId» + LexAlt : Π• «"{"» + LexAlt : Π• «"~"» + LexAlt : Π• «"|"» } Transitions: S66{ - LexTerm : regDefId• «]» - LexTerm : regDefId• «(» - LexTerm : regDefId• «.» - LexTerm : regDefId• «[» + LexTerm : regDefId• «"]"» + LexTerm : regDefId• «"("» + LexTerm : regDefId• «"."» + LexTerm : regDefId• «"["» LexTerm : regDefId• «char_lit» LexTerm : regDefId• «regDefId» - LexTerm : regDefId• «{» - LexTerm : regDefId• «~» - LexTerm : regDefId• «|» + LexTerm : regDefId• «"{"» + LexTerm : regDefId• «"~"» + LexTerm : regDefId• «"|"» } Transitions: S67{ - LexTerm : .• «]» - LexTerm : .• «(» - LexTerm : .• «.» - LexTerm : .• «[» - LexTerm : .• «char_lit» - LexTerm : .• «regDefId» - LexTerm : .• «{» - LexTerm : .• «~» - LexTerm : .• «|» + LexTerm : Λ<.>• «"]"» + LexTerm : Λ<.>• «"("» + LexTerm : Λ<.>• «"."» + LexTerm : Λ<.>• «"["» + LexTerm : Λ<.>• «char_lit» + LexTerm : Λ<.>• «regDefId» + LexTerm : Λ<.>• «"{"» + LexTerm : Λ<.>• «"~"» + LexTerm : Λ<.>• «"|"» } Transitions: S68{ - LexTerm : char_lit• «]» - LexTerm : char_lit •- char_lit «]» - LexTerm : char_lit• «(» - LexTerm : char_lit •- char_lit «(» - LexTerm : char_lit• «.» - LexTerm : char_lit •- char_lit «.» - LexTerm : char_lit• «[» - LexTerm : char_lit •- char_lit «[» + LexTerm : char_lit• «"]"» + LexTerm : char_lit •Λ<-> char_lit «"]"» + LexTerm : char_lit• «"("» + LexTerm : char_lit •Λ<-> char_lit «"("» + LexTerm : char_lit• «"."» + LexTerm : char_lit •Λ<-> char_lit «"."» + LexTerm : char_lit• «"["» + LexTerm : char_lit •Λ<-> char_lit «"["» LexTerm : char_lit• «char_lit» - LexTerm : char_lit •- char_lit «char_lit» + LexTerm : char_lit •Λ<-> char_lit «char_lit» LexTerm : char_lit• «regDefId» - LexTerm : char_lit •- char_lit «regDefId» - LexTerm : char_lit• «{» - LexTerm : char_lit •- char_lit «{» - LexTerm : char_lit• «~» - LexTerm : char_lit •- char_lit «~» - LexTerm : char_lit• «|» - LexTerm : char_lit •- char_lit «|» + LexTerm : char_lit •Λ<-> char_lit «regDefId» + LexTerm : char_lit• «"{"» + LexTerm : char_lit •Λ<-> char_lit «"{"» + LexTerm : char_lit• «"~"» + LexTerm : char_lit •Λ<-> char_lit «"~"» + LexTerm : char_lit• «"|"» + LexTerm : char_lit •Λ<-> char_lit «"|"» } Transitions: - - -> 106 + Λ<-> -> 106 S69{ - LexTerm : ~ •char_lit «]» - LexTerm : ~ •( char_lit - char_lit ) «]» - LexTerm : ~ •char_lit «(» - LexTerm : ~ •( char_lit - char_lit ) «(» - LexTerm : ~ •char_lit «.» - LexTerm : ~ •( char_lit - char_lit ) «.» - LexTerm : ~ •char_lit «[» - LexTerm : ~ •( char_lit - char_lit ) «[» - LexTerm : ~ •char_lit «char_lit» - LexTerm : ~ •( char_lit - char_lit ) «char_lit» - LexTerm : ~ •char_lit «regDefId» - LexTerm : ~ •( char_lit - char_lit ) «regDefId» - LexTerm : ~ •char_lit «{» - LexTerm : ~ •( char_lit - char_lit ) «{» - LexTerm : ~ •char_lit «~» - LexTerm : ~ •( char_lit - char_lit ) «~» - LexTerm : ~ •char_lit «|» - LexTerm : ~ •( char_lit - char_lit ) «|» + LexTerm : Λ<~> •char_lit «"]"» + LexTerm : Λ<~> •Λ<(> char_lit Λ<-> char_lit Λ<)> «"]"» + LexTerm : Λ<~> •char_lit «"("» + LexTerm : Λ<~> •Λ<(> char_lit Λ<-> char_lit Λ<)> «"("» + LexTerm : Λ<~> •char_lit «"."» + LexTerm : Λ<~> •Λ<(> char_lit Λ<-> char_lit Λ<)> «"."» + LexTerm : Λ<~> •char_lit «"["» + LexTerm : Λ<~> •Λ<(> char_lit Λ<-> char_lit Λ<)> «"["» + LexTerm : Λ<~> •char_lit «char_lit» + LexTerm : Λ<~> •Λ<(> char_lit Λ<-> char_lit Λ<)> «char_lit» + LexTerm : Λ<~> •char_lit «regDefId» + LexTerm : Λ<~> •Λ<(> char_lit Λ<-> char_lit Λ<)> «regDefId» + LexTerm : Λ<~> •char_lit «"{"» + LexTerm : Λ<~> •Λ<(> char_lit Λ<-> char_lit Λ<)> «"{"» + LexTerm : Λ<~> •char_lit «"~"» + LexTerm : Λ<~> •Λ<(> char_lit Λ<-> char_lit Λ<)> «"~"» + LexTerm : Λ<~> •char_lit «"|"» + LexTerm : Λ<~> •Λ<(> char_lit Λ<-> char_lit Λ<)> «"|"» } Transitions: char_lit -> 107 - ( -> 108 + Λ<(> -> 108 S70{ - LexTerm : ( •LexPattern ) «]» - LexTerm : ( •LexPattern ) «(» - LexTerm : ( •LexPattern ) «.» - LexTerm : ( •LexPattern ) «[» - LexTerm : ( •LexPattern ) «char_lit» - LexTerm : ( •LexPattern ) «regDefId» - LexTerm : ( •LexPattern ) «{» - LexTerm : ( •LexPattern ) «~» - LexTerm : ( •LexPattern ) «|» - LexPattern : •LexAlt «)» - LexPattern : •LexPattern | LexAlt «)» - LexAlt : •LexTerm «)» - LexAlt : •LexAlt LexTerm «)» - LexPattern : •LexAlt «|» - LexPattern : •LexPattern | LexAlt «|» - LexTerm : •. «)» - LexTerm : •char_lit «)» - LexTerm : •char_lit - char_lit «)» - LexTerm : •~ char_lit «)» - LexTerm : •~ ( char_lit - char_lit ) «)» - LexTerm : •regDefId «)» - LexTerm : •[ LexPattern ] «)» - LexTerm : •{ LexPattern } «)» - LexTerm : •( LexPattern ) «)» - LexAlt : •LexTerm «(» - LexAlt : •LexTerm «.» - LexAlt : •LexTerm «[» - LexAlt : •LexTerm «char_lit» - LexAlt : •LexTerm «regDefId» - LexAlt : •LexTerm «{» - LexAlt : •LexTerm «~» - LexAlt : •LexAlt LexTerm «(» - LexAlt : •LexAlt LexTerm «.» - LexAlt : •LexAlt LexTerm «[» - LexAlt : •LexAlt LexTerm «char_lit» - LexAlt : •LexAlt LexTerm «regDefId» - LexAlt : •LexAlt LexTerm «{» - LexAlt : •LexAlt LexTerm «~» - LexAlt : •LexTerm «|» - LexAlt : •LexAlt LexTerm «|» - LexTerm : •. «(» - LexTerm : •char_lit «(» - LexTerm : •char_lit - char_lit «(» - LexTerm : •~ char_lit «(» - LexTerm : •~ ( char_lit - char_lit ) «(» - LexTerm : •regDefId «(» - LexTerm : •[ LexPattern ] «(» - LexTerm : •{ LexPattern } «(» - LexTerm : •( LexPattern ) «(» - LexTerm : •. «.» - LexTerm : •char_lit «.» - LexTerm : •char_lit - char_lit «.» - LexTerm : •~ char_lit «.» - LexTerm : •~ ( char_lit - char_lit ) «.» - LexTerm : •regDefId «.» - LexTerm : •[ LexPattern ] «.» - LexTerm : •{ LexPattern } «.» - LexTerm : •( LexPattern ) «.» - LexTerm : •. «[» - LexTerm : •char_lit «[» - LexTerm : •char_lit - char_lit «[» - LexTerm : •~ char_lit «[» - LexTerm : •~ ( char_lit - char_lit ) «[» - LexTerm : •regDefId «[» - LexTerm : •[ LexPattern ] «[» - LexTerm : •{ LexPattern } «[» - LexTerm : •( LexPattern ) «[» - LexTerm : •. «char_lit» + LexTerm : Λ<(> •Π Λ<)> «"]"» + LexTerm : Λ<(> •Π Λ<)> «"("» + LexTerm : Λ<(> •Π Λ<)> «"."» + LexTerm : Λ<(> •Π Λ<)> «"["» + LexTerm : Λ<(> •Π Λ<)> «char_lit» + LexTerm : Λ<(> •Π Λ<)> «regDefId» + LexTerm : Λ<(> •Π Λ<)> «"{"» + LexTerm : Λ<(> •Π Λ<)> «"~"» + LexTerm : Λ<(> •Π Λ<)> «"|"» + LexPattern : •Π «")"» + LexPattern : •Π Λ<|> Π «")"» + LexAlt : •Π «")"» + LexAlt : •Π Π «")"» + LexPattern : •Π «"|"» + LexPattern : •Π Λ<|> Π «"|"» + LexTerm : •Λ<.> «")"» + LexTerm : •char_lit «")"» + LexTerm : •char_lit Λ<-> char_lit «")"» + LexTerm : •Λ<~> char_lit «")"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «")"» + LexTerm : •regDefId «")"» + LexTerm : •Λ<[> Π Λ<]> «")"» + LexTerm : •Λ<{> Π Λ<}> «")"» + LexTerm : •Λ<(> Π Λ<)> «")"» + LexAlt : •Π «"("» + LexAlt : •Π «"."» + LexAlt : •Π «"["» + LexAlt : •Π «char_lit» + LexAlt : •Π «regDefId» + LexAlt : •Π «"{"» + LexAlt : •Π «"~"» + LexAlt : •Π Π «"("» + LexAlt : •Π Π «"."» + LexAlt : •Π Π «"["» + LexAlt : •Π Π «char_lit» + LexAlt : •Π Π «regDefId» + LexAlt : •Π Π «"{"» + LexAlt : •Π Π «"~"» + LexAlt : •Π «"|"» + LexAlt : •Π Π «"|"» + LexTerm : •Λ<.> «"("» + LexTerm : •char_lit «"("» + LexTerm : •char_lit Λ<-> char_lit «"("» + LexTerm : •Λ<~> char_lit «"("» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"("» + LexTerm : •regDefId «"("» + LexTerm : •Λ<[> Π Λ<]> «"("» + LexTerm : •Λ<{> Π Λ<}> «"("» + LexTerm : •Λ<(> Π Λ<)> «"("» + LexTerm : •Λ<.> «"."» + LexTerm : •char_lit «"."» + LexTerm : •char_lit Λ<-> char_lit «"."» + LexTerm : •Λ<~> char_lit «"."» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"."» + LexTerm : •regDefId «"."» + LexTerm : •Λ<[> Π Λ<]> «"."» + LexTerm : •Λ<{> Π Λ<}> «"."» + LexTerm : •Λ<(> Π Λ<)> «"."» + LexTerm : •Λ<.> «"["» + LexTerm : •char_lit «"["» + LexTerm : •char_lit Λ<-> char_lit «"["» + LexTerm : •Λ<~> char_lit «"["» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"["» + LexTerm : •regDefId «"["» + LexTerm : •Λ<[> Π Λ<]> «"["» + LexTerm : •Λ<{> Π Λ<}> «"["» + LexTerm : •Λ<(> Π Λ<)> «"["» + LexTerm : •Λ<.> «char_lit» LexTerm : •char_lit «char_lit» - LexTerm : •char_lit - char_lit «char_lit» - LexTerm : •~ char_lit «char_lit» - LexTerm : •~ ( char_lit - char_lit ) «char_lit» + LexTerm : •char_lit Λ<-> char_lit «char_lit» + LexTerm : •Λ<~> char_lit «char_lit» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «char_lit» LexTerm : •regDefId «char_lit» - LexTerm : •[ LexPattern ] «char_lit» - LexTerm : •{ LexPattern } «char_lit» - LexTerm : •( LexPattern ) «char_lit» - LexTerm : •. «regDefId» + LexTerm : •Λ<[> Π Λ<]> «char_lit» + LexTerm : •Λ<{> Π Λ<}> «char_lit» + LexTerm : •Λ<(> Π Λ<)> «char_lit» + LexTerm : •Λ<.> «regDefId» LexTerm : •char_lit «regDefId» - LexTerm : •char_lit - char_lit «regDefId» - LexTerm : •~ char_lit «regDefId» - LexTerm : •~ ( char_lit - char_lit ) «regDefId» + LexTerm : •char_lit Λ<-> char_lit «regDefId» + LexTerm : •Λ<~> char_lit «regDefId» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «regDefId» LexTerm : •regDefId «regDefId» - LexTerm : •[ LexPattern ] «regDefId» - LexTerm : •{ LexPattern } «regDefId» - LexTerm : •( LexPattern ) «regDefId» - LexTerm : •. «{» - LexTerm : •char_lit «{» - LexTerm : •char_lit - char_lit «{» - LexTerm : •~ char_lit «{» - LexTerm : •~ ( char_lit - char_lit ) «{» - LexTerm : •regDefId «{» - LexTerm : •[ LexPattern ] «{» - LexTerm : •{ LexPattern } «{» - LexTerm : •( LexPattern ) «{» - LexTerm : •. «~» - LexTerm : •char_lit «~» - LexTerm : •char_lit - char_lit «~» - LexTerm : •~ char_lit «~» - LexTerm : •~ ( char_lit - char_lit ) «~» - LexTerm : •regDefId «~» - LexTerm : •[ LexPattern ] «~» - LexTerm : •{ LexPattern } «~» - LexTerm : •( LexPattern ) «~» - LexTerm : •. «|» - LexTerm : •char_lit «|» - LexTerm : •char_lit - char_lit «|» - LexTerm : •~ char_lit «|» - LexTerm : •~ ( char_lit - char_lit ) «|» - LexTerm : •regDefId «|» - LexTerm : •[ LexPattern ] «|» - LexTerm : •{ LexPattern } «|» - LexTerm : •( LexPattern ) «|» -} -Transitions: - LexAlt -> 54 - LexTerm -> 55 + LexTerm : •Λ<[> Π Λ<]> «regDefId» + LexTerm : •Λ<{> Π Λ<}> «regDefId» + LexTerm : •Λ<(> Π Λ<)> «regDefId» + LexTerm : •Λ<.> «"{"» + LexTerm : •char_lit «"{"» + LexTerm : •char_lit Λ<-> char_lit «"{"» + LexTerm : •Λ<~> char_lit «"{"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"{"» + LexTerm : •regDefId «"{"» + LexTerm : •Λ<[> Π Λ<]> «"{"» + LexTerm : •Λ<{> Π Λ<}> «"{"» + LexTerm : •Λ<(> Π Λ<)> «"{"» + LexTerm : •Λ<.> «"~"» + LexTerm : •char_lit «"~"» + LexTerm : •char_lit Λ<-> char_lit «"~"» + LexTerm : •Λ<~> char_lit «"~"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"~"» + LexTerm : •regDefId «"~"» + LexTerm : •Λ<[> Π Λ<]> «"~"» + LexTerm : •Λ<{> Π Λ<}> «"~"» + LexTerm : •Λ<(> Π Λ<)> «"~"» + LexTerm : •Λ<.> «"|"» + LexTerm : •char_lit «"|"» + LexTerm : •char_lit Λ<-> char_lit «"|"» + LexTerm : •Λ<~> char_lit «"|"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"|"» + LexTerm : •regDefId «"|"» + LexTerm : •Λ<[> Π Λ<]> «"|"» + LexTerm : •Λ<{> Π Λ<}> «"|"» + LexTerm : •Λ<(> Π Λ<)> «"|"» +} +Transitions: + Π -> 54 + Π -> 55 regDefId -> 56 - . -> 57 + Λ<.> -> 57 char_lit -> 58 - ~ -> 59 - ( -> 60 - [ -> 61 - { -> 62 - LexPattern -> 109 + Λ<~> -> 59 + Λ<(> -> 60 + Λ<[> -> 61 + Λ<{> -> 62 + Π -> 109 S71{ - LexTerm : [ •LexPattern ] «]» - LexTerm : [ •LexPattern ] «(» - LexTerm : [ •LexPattern ] «.» - LexTerm : [ •LexPattern ] «[» - LexTerm : [ •LexPattern ] «char_lit» - LexTerm : [ •LexPattern ] «regDefId» - LexTerm : [ •LexPattern ] «{» - LexTerm : [ •LexPattern ] «~» - LexTerm : [ •LexPattern ] «|» - LexPattern : •LexAlt «]» - LexPattern : •LexPattern | LexAlt «]» - LexAlt : •LexTerm «]» - LexAlt : •LexAlt LexTerm «]» - LexPattern : •LexAlt «|» - LexPattern : •LexPattern | LexAlt «|» - LexTerm : •. «]» - LexTerm : •char_lit «]» - LexTerm : •char_lit - char_lit «]» - LexTerm : •~ char_lit «]» - LexTerm : •~ ( char_lit - char_lit ) «]» - LexTerm : •regDefId «]» - LexTerm : •[ LexPattern ] «]» - LexTerm : •{ LexPattern } «]» - LexTerm : •( LexPattern ) «]» - LexAlt : •LexTerm «(» - LexAlt : •LexTerm «.» - LexAlt : •LexTerm «[» - LexAlt : •LexTerm «char_lit» - LexAlt : •LexTerm «regDefId» - LexAlt : •LexTerm «{» - LexAlt : •LexTerm «~» - LexAlt : •LexAlt LexTerm «(» - LexAlt : •LexAlt LexTerm «.» - LexAlt : •LexAlt LexTerm «[» - LexAlt : •LexAlt LexTerm «char_lit» - LexAlt : •LexAlt LexTerm «regDefId» - LexAlt : •LexAlt LexTerm «{» - LexAlt : •LexAlt LexTerm «~» - LexAlt : •LexTerm «|» - LexAlt : •LexAlt LexTerm «|» - LexTerm : •. «(» - LexTerm : •char_lit «(» - LexTerm : •char_lit - char_lit «(» - LexTerm : •~ char_lit «(» - LexTerm : •~ ( char_lit - char_lit ) «(» - LexTerm : •regDefId «(» - LexTerm : •[ LexPattern ] «(» - LexTerm : •{ LexPattern } «(» - LexTerm : •( LexPattern ) «(» - LexTerm : •. «.» - LexTerm : •char_lit «.» - LexTerm : •char_lit - char_lit «.» - LexTerm : •~ char_lit «.» - LexTerm : •~ ( char_lit - char_lit ) «.» - LexTerm : •regDefId «.» - LexTerm : •[ LexPattern ] «.» - LexTerm : •{ LexPattern } «.» - LexTerm : •( LexPattern ) «.» - LexTerm : •. «[» - LexTerm : •char_lit «[» - LexTerm : •char_lit - char_lit «[» - LexTerm : •~ char_lit «[» - LexTerm : •~ ( char_lit - char_lit ) «[» - LexTerm : •regDefId «[» - LexTerm : •[ LexPattern ] «[» - LexTerm : •{ LexPattern } «[» - LexTerm : •( LexPattern ) «[» - LexTerm : •. «char_lit» + LexTerm : Λ<[> •Π Λ<]> «"]"» + LexTerm : Λ<[> •Π Λ<]> «"("» + LexTerm : Λ<[> •Π Λ<]> «"."» + LexTerm : Λ<[> •Π Λ<]> «"["» + LexTerm : Λ<[> •Π Λ<]> «char_lit» + LexTerm : Λ<[> •Π Λ<]> «regDefId» + LexTerm : Λ<[> •Π Λ<]> «"{"» + LexTerm : Λ<[> •Π Λ<]> «"~"» + LexTerm : Λ<[> •Π Λ<]> «"|"» + LexPattern : •Π «"]"» + LexPattern : •Π Λ<|> Π «"]"» + LexAlt : •Π «"]"» + LexAlt : •Π Π «"]"» + LexPattern : •Π «"|"» + LexPattern : •Π Λ<|> Π «"|"» + LexTerm : •Λ<.> «"]"» + LexTerm : •char_lit «"]"» + LexTerm : •char_lit Λ<-> char_lit «"]"» + LexTerm : •Λ<~> char_lit «"]"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"]"» + LexTerm : •regDefId «"]"» + LexTerm : •Λ<[> Π Λ<]> «"]"» + LexTerm : •Λ<{> Π Λ<}> «"]"» + LexTerm : •Λ<(> Π Λ<)> «"]"» + LexAlt : •Π «"("» + LexAlt : •Π «"."» + LexAlt : •Π «"["» + LexAlt : •Π «char_lit» + LexAlt : •Π «regDefId» + LexAlt : •Π «"{"» + LexAlt : •Π «"~"» + LexAlt : •Π Π «"("» + LexAlt : •Π Π «"."» + LexAlt : •Π Π «"["» + LexAlt : •Π Π «char_lit» + LexAlt : •Π Π «regDefId» + LexAlt : •Π Π «"{"» + LexAlt : •Π Π «"~"» + LexAlt : •Π «"|"» + LexAlt : •Π Π «"|"» + LexTerm : •Λ<.> «"("» + LexTerm : •char_lit «"("» + LexTerm : •char_lit Λ<-> char_lit «"("» + LexTerm : •Λ<~> char_lit «"("» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"("» + LexTerm : •regDefId «"("» + LexTerm : •Λ<[> Π Λ<]> «"("» + LexTerm : •Λ<{> Π Λ<}> «"("» + LexTerm : •Λ<(> Π Λ<)> «"("» + LexTerm : •Λ<.> «"."» + LexTerm : •char_lit «"."» + LexTerm : •char_lit Λ<-> char_lit «"."» + LexTerm : •Λ<~> char_lit «"."» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"."» + LexTerm : •regDefId «"."» + LexTerm : •Λ<[> Π Λ<]> «"."» + LexTerm : •Λ<{> Π Λ<}> «"."» + LexTerm : •Λ<(> Π Λ<)> «"."» + LexTerm : •Λ<.> «"["» + LexTerm : •char_lit «"["» + LexTerm : •char_lit Λ<-> char_lit «"["» + LexTerm : •Λ<~> char_lit «"["» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"["» + LexTerm : •regDefId «"["» + LexTerm : •Λ<[> Π Λ<]> «"["» + LexTerm : •Λ<{> Π Λ<}> «"["» + LexTerm : •Λ<(> Π Λ<)> «"["» + LexTerm : •Λ<.> «char_lit» LexTerm : •char_lit «char_lit» - LexTerm : •char_lit - char_lit «char_lit» - LexTerm : •~ char_lit «char_lit» - LexTerm : •~ ( char_lit - char_lit ) «char_lit» + LexTerm : •char_lit Λ<-> char_lit «char_lit» + LexTerm : •Λ<~> char_lit «char_lit» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «char_lit» LexTerm : •regDefId «char_lit» - LexTerm : •[ LexPattern ] «char_lit» - LexTerm : •{ LexPattern } «char_lit» - LexTerm : •( LexPattern ) «char_lit» - LexTerm : •. «regDefId» + LexTerm : •Λ<[> Π Λ<]> «char_lit» + LexTerm : •Λ<{> Π Λ<}> «char_lit» + LexTerm : •Λ<(> Π Λ<)> «char_lit» + LexTerm : •Λ<.> «regDefId» LexTerm : •char_lit «regDefId» - LexTerm : •char_lit - char_lit «regDefId» - LexTerm : •~ char_lit «regDefId» - LexTerm : •~ ( char_lit - char_lit ) «regDefId» + LexTerm : •char_lit Λ<-> char_lit «regDefId» + LexTerm : •Λ<~> char_lit «regDefId» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «regDefId» LexTerm : •regDefId «regDefId» - LexTerm : •[ LexPattern ] «regDefId» - LexTerm : •{ LexPattern } «regDefId» - LexTerm : •( LexPattern ) «regDefId» - LexTerm : •. «{» - LexTerm : •char_lit «{» - LexTerm : •char_lit - char_lit «{» - LexTerm : •~ char_lit «{» - LexTerm : •~ ( char_lit - char_lit ) «{» - LexTerm : •regDefId «{» - LexTerm : •[ LexPattern ] «{» - LexTerm : •{ LexPattern } «{» - LexTerm : •( LexPattern ) «{» - LexTerm : •. «~» - LexTerm : •char_lit «~» - LexTerm : •char_lit - char_lit «~» - LexTerm : •~ char_lit «~» - LexTerm : •~ ( char_lit - char_lit ) «~» - LexTerm : •regDefId «~» - LexTerm : •[ LexPattern ] «~» - LexTerm : •{ LexPattern } «~» - LexTerm : •( LexPattern ) «~» - LexTerm : •. «|» - LexTerm : •char_lit «|» - LexTerm : •char_lit - char_lit «|» - LexTerm : •~ char_lit «|» - LexTerm : •~ ( char_lit - char_lit ) «|» - LexTerm : •regDefId «|» - LexTerm : •[ LexPattern ] «|» - LexTerm : •{ LexPattern } «|» - LexTerm : •( LexPattern ) «|» -} -Transitions: - LexAlt -> 64 - LexTerm -> 65 + LexTerm : •Λ<[> Π Λ<]> «regDefId» + LexTerm : •Λ<{> Π Λ<}> «regDefId» + LexTerm : •Λ<(> Π Λ<)> «regDefId» + LexTerm : •Λ<.> «"{"» + LexTerm : •char_lit «"{"» + LexTerm : •char_lit Λ<-> char_lit «"{"» + LexTerm : •Λ<~> char_lit «"{"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"{"» + LexTerm : •regDefId «"{"» + LexTerm : •Λ<[> Π Λ<]> «"{"» + LexTerm : •Λ<{> Π Λ<}> «"{"» + LexTerm : •Λ<(> Π Λ<)> «"{"» + LexTerm : •Λ<.> «"~"» + LexTerm : •char_lit «"~"» + LexTerm : •char_lit Λ<-> char_lit «"~"» + LexTerm : •Λ<~> char_lit «"~"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"~"» + LexTerm : •regDefId «"~"» + LexTerm : •Λ<[> Π Λ<]> «"~"» + LexTerm : •Λ<{> Π Λ<}> «"~"» + LexTerm : •Λ<(> Π Λ<)> «"~"» + LexTerm : •Λ<.> «"|"» + LexTerm : •char_lit «"|"» + LexTerm : •char_lit Λ<-> char_lit «"|"» + LexTerm : •Λ<~> char_lit «"|"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"|"» + LexTerm : •regDefId «"|"» + LexTerm : •Λ<[> Π Λ<]> «"|"» + LexTerm : •Λ<{> Π Λ<}> «"|"» + LexTerm : •Λ<(> Π Λ<)> «"|"» +} +Transitions: + Π -> 64 + Π -> 65 regDefId -> 66 - . -> 67 + Λ<.> -> 67 char_lit -> 68 - ~ -> 69 - ( -> 70 - [ -> 71 - { -> 72 - LexPattern -> 110 + Λ<~> -> 69 + Λ<(> -> 70 + Λ<[> -> 71 + Λ<{> -> 72 + Π -> 110 S72{ - LexTerm : { •LexPattern } «]» - LexTerm : { •LexPattern } «(» - LexTerm : { •LexPattern } «.» - LexTerm : { •LexPattern } «[» - LexTerm : { •LexPattern } «char_lit» - LexTerm : { •LexPattern } «regDefId» - LexTerm : { •LexPattern } «{» - LexTerm : { •LexPattern } «~» - LexTerm : { •LexPattern } «|» - LexPattern : •LexAlt «}» - LexPattern : •LexPattern | LexAlt «}» - LexAlt : •LexTerm «}» - LexAlt : •LexAlt LexTerm «}» - LexPattern : •LexAlt «|» - LexPattern : •LexPattern | LexAlt «|» - LexTerm : •. «}» - LexTerm : •char_lit «}» - LexTerm : •char_lit - char_lit «}» - LexTerm : •~ char_lit «}» - LexTerm : •~ ( char_lit - char_lit ) «}» - LexTerm : •regDefId «}» - LexTerm : •[ LexPattern ] «}» - LexTerm : •{ LexPattern } «}» - LexTerm : •( LexPattern ) «}» - LexAlt : •LexTerm «(» - LexAlt : •LexTerm «.» - LexAlt : •LexTerm «[» - LexAlt : •LexTerm «char_lit» - LexAlt : •LexTerm «regDefId» - LexAlt : •LexTerm «{» - LexAlt : •LexTerm «~» - LexAlt : •LexAlt LexTerm «(» - LexAlt : •LexAlt LexTerm «.» - LexAlt : •LexAlt LexTerm «[» - LexAlt : •LexAlt LexTerm «char_lit» - LexAlt : •LexAlt LexTerm «regDefId» - LexAlt : •LexAlt LexTerm «{» - LexAlt : •LexAlt LexTerm «~» - LexAlt : •LexTerm «|» - LexAlt : •LexAlt LexTerm «|» - LexTerm : •. «(» - LexTerm : •char_lit «(» - LexTerm : •char_lit - char_lit «(» - LexTerm : •~ char_lit «(» - LexTerm : •~ ( char_lit - char_lit ) «(» - LexTerm : •regDefId «(» - LexTerm : •[ LexPattern ] «(» - LexTerm : •{ LexPattern } «(» - LexTerm : •( LexPattern ) «(» - LexTerm : •. «.» - LexTerm : •char_lit «.» - LexTerm : •char_lit - char_lit «.» - LexTerm : •~ char_lit «.» - LexTerm : •~ ( char_lit - char_lit ) «.» - LexTerm : •regDefId «.» - LexTerm : •[ LexPattern ] «.» - LexTerm : •{ LexPattern } «.» - LexTerm : •( LexPattern ) «.» - LexTerm : •. «[» - LexTerm : •char_lit «[» - LexTerm : •char_lit - char_lit «[» - LexTerm : •~ char_lit «[» - LexTerm : •~ ( char_lit - char_lit ) «[» - LexTerm : •regDefId «[» - LexTerm : •[ LexPattern ] «[» - LexTerm : •{ LexPattern } «[» - LexTerm : •( LexPattern ) «[» - LexTerm : •. «char_lit» + LexTerm : Λ<{> •Π Λ<}> «"]"» + LexTerm : Λ<{> •Π Λ<}> «"("» + LexTerm : Λ<{> •Π Λ<}> «"."» + LexTerm : Λ<{> •Π Λ<}> «"["» + LexTerm : Λ<{> •Π Λ<}> «char_lit» + LexTerm : Λ<{> •Π Λ<}> «regDefId» + LexTerm : Λ<{> •Π Λ<}> «"{"» + LexTerm : Λ<{> •Π Λ<}> «"~"» + LexTerm : Λ<{> •Π Λ<}> «"|"» + LexPattern : •Π «"}"» + LexPattern : •Π Λ<|> Π «"}"» + LexAlt : •Π «"}"» + LexAlt : •Π Π «"}"» + LexPattern : •Π «"|"» + LexPattern : •Π Λ<|> Π «"|"» + LexTerm : •Λ<.> «"}"» + LexTerm : •char_lit «"}"» + LexTerm : •char_lit Λ<-> char_lit «"}"» + LexTerm : •Λ<~> char_lit «"}"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"}"» + LexTerm : •regDefId «"}"» + LexTerm : •Λ<[> Π Λ<]> «"}"» + LexTerm : •Λ<{> Π Λ<}> «"}"» + LexTerm : •Λ<(> Π Λ<)> «"}"» + LexAlt : •Π «"("» + LexAlt : •Π «"."» + LexAlt : •Π «"["» + LexAlt : •Π «char_lit» + LexAlt : •Π «regDefId» + LexAlt : •Π «"{"» + LexAlt : •Π «"~"» + LexAlt : •Π Π «"("» + LexAlt : •Π Π «"."» + LexAlt : •Π Π «"["» + LexAlt : •Π Π «char_lit» + LexAlt : •Π Π «regDefId» + LexAlt : •Π Π «"{"» + LexAlt : •Π Π «"~"» + LexAlt : •Π «"|"» + LexAlt : •Π Π «"|"» + LexTerm : •Λ<.> «"("» + LexTerm : •char_lit «"("» + LexTerm : •char_lit Λ<-> char_lit «"("» + LexTerm : •Λ<~> char_lit «"("» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"("» + LexTerm : •regDefId «"("» + LexTerm : •Λ<[> Π Λ<]> «"("» + LexTerm : •Λ<{> Π Λ<}> «"("» + LexTerm : •Λ<(> Π Λ<)> «"("» + LexTerm : •Λ<.> «"."» + LexTerm : •char_lit «"."» + LexTerm : •char_lit Λ<-> char_lit «"."» + LexTerm : •Λ<~> char_lit «"."» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"."» + LexTerm : •regDefId «"."» + LexTerm : •Λ<[> Π Λ<]> «"."» + LexTerm : •Λ<{> Π Λ<}> «"."» + LexTerm : •Λ<(> Π Λ<)> «"."» + LexTerm : •Λ<.> «"["» + LexTerm : •char_lit «"["» + LexTerm : •char_lit Λ<-> char_lit «"["» + LexTerm : •Λ<~> char_lit «"["» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"["» + LexTerm : •regDefId «"["» + LexTerm : •Λ<[> Π Λ<]> «"["» + LexTerm : •Λ<{> Π Λ<}> «"["» + LexTerm : •Λ<(> Π Λ<)> «"["» + LexTerm : •Λ<.> «char_lit» LexTerm : •char_lit «char_lit» - LexTerm : •char_lit - char_lit «char_lit» - LexTerm : •~ char_lit «char_lit» - LexTerm : •~ ( char_lit - char_lit ) «char_lit» + LexTerm : •char_lit Λ<-> char_lit «char_lit» + LexTerm : •Λ<~> char_lit «char_lit» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «char_lit» LexTerm : •regDefId «char_lit» - LexTerm : •[ LexPattern ] «char_lit» - LexTerm : •{ LexPattern } «char_lit» - LexTerm : •( LexPattern ) «char_lit» - LexTerm : •. «regDefId» + LexTerm : •Λ<[> Π Λ<]> «char_lit» + LexTerm : •Λ<{> Π Λ<}> «char_lit» + LexTerm : •Λ<(> Π Λ<)> «char_lit» + LexTerm : •Λ<.> «regDefId» LexTerm : •char_lit «regDefId» - LexTerm : •char_lit - char_lit «regDefId» - LexTerm : •~ char_lit «regDefId» - LexTerm : •~ ( char_lit - char_lit ) «regDefId» + LexTerm : •char_lit Λ<-> char_lit «regDefId» + LexTerm : •Λ<~> char_lit «regDefId» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «regDefId» LexTerm : •regDefId «regDefId» - LexTerm : •[ LexPattern ] «regDefId» - LexTerm : •{ LexPattern } «regDefId» - LexTerm : •( LexPattern ) «regDefId» - LexTerm : •. «{» - LexTerm : •char_lit «{» - LexTerm : •char_lit - char_lit «{» - LexTerm : •~ char_lit «{» - LexTerm : •~ ( char_lit - char_lit ) «{» - LexTerm : •regDefId «{» - LexTerm : •[ LexPattern ] «{» - LexTerm : •{ LexPattern } «{» - LexTerm : •( LexPattern ) «{» - LexTerm : •. «~» - LexTerm : •char_lit «~» - LexTerm : •char_lit - char_lit «~» - LexTerm : •~ char_lit «~» - LexTerm : •~ ( char_lit - char_lit ) «~» - LexTerm : •regDefId «~» - LexTerm : •[ LexPattern ] «~» - LexTerm : •{ LexPattern } «~» - LexTerm : •( LexPattern ) «~» - LexTerm : •. «|» - LexTerm : •char_lit «|» - LexTerm : •char_lit - char_lit «|» - LexTerm : •~ char_lit «|» - LexTerm : •~ ( char_lit - char_lit ) «|» - LexTerm : •regDefId «|» - LexTerm : •[ LexPattern ] «|» - LexTerm : •{ LexPattern } «|» - LexTerm : •( LexPattern ) «|» -} -Transitions: - LexAlt -> 74 - LexTerm -> 75 + LexTerm : •Λ<[> Π Λ<]> «regDefId» + LexTerm : •Λ<{> Π Λ<}> «regDefId» + LexTerm : •Λ<(> Π Λ<)> «regDefId» + LexTerm : •Λ<.> «"{"» + LexTerm : •char_lit «"{"» + LexTerm : •char_lit Λ<-> char_lit «"{"» + LexTerm : •Λ<~> char_lit «"{"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"{"» + LexTerm : •regDefId «"{"» + LexTerm : •Λ<[> Π Λ<]> «"{"» + LexTerm : •Λ<{> Π Λ<}> «"{"» + LexTerm : •Λ<(> Π Λ<)> «"{"» + LexTerm : •Λ<.> «"~"» + LexTerm : •char_lit «"~"» + LexTerm : •char_lit Λ<-> char_lit «"~"» + LexTerm : •Λ<~> char_lit «"~"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"~"» + LexTerm : •regDefId «"~"» + LexTerm : •Λ<[> Π Λ<]> «"~"» + LexTerm : •Λ<{> Π Λ<}> «"~"» + LexTerm : •Λ<(> Π Λ<)> «"~"» + LexTerm : •Λ<.> «"|"» + LexTerm : •char_lit «"|"» + LexTerm : •char_lit Λ<-> char_lit «"|"» + LexTerm : •Λ<~> char_lit «"|"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"|"» + LexTerm : •regDefId «"|"» + LexTerm : •Λ<[> Π Λ<]> «"|"» + LexTerm : •Λ<{> Π Λ<}> «"|"» + LexTerm : •Λ<(> Π Λ<)> «"|"» +} +Transitions: + Π -> 74 + Π -> 75 regDefId -> 76 - . -> 77 + Λ<.> -> 77 char_lit -> 78 - ~ -> 79 - ( -> 80 - [ -> 81 - { -> 82 - LexPattern -> 111 + Λ<~> -> 79 + Λ<(> -> 80 + Λ<[> -> 81 + Λ<{> -> 82 + Π -> 111 S73{ - LexTerm : { LexPattern •} «;» - LexTerm : { LexPattern •} «(» - LexTerm : { LexPattern •} «.» - LexTerm : { LexPattern •} «[» - LexTerm : { LexPattern •} «char_lit» - LexTerm : { LexPattern •} «regDefId» - LexTerm : { LexPattern •} «{» - LexTerm : { LexPattern •} «~» - LexTerm : { LexPattern •} «|» - LexPattern : LexPattern •| LexAlt «}» - LexPattern : LexPattern •| LexAlt «|» + LexTerm : Λ<{> Π •Λ<}> «";"» + LexTerm : Λ<{> Π •Λ<}> «"("» + LexTerm : Λ<{> Π •Λ<}> «"."» + LexTerm : Λ<{> Π •Λ<}> «"["» + LexTerm : Λ<{> Π •Λ<}> «char_lit» + LexTerm : Λ<{> Π •Λ<}> «regDefId» + LexTerm : Λ<{> Π •Λ<}> «"{"» + LexTerm : Λ<{> Π •Λ<}> «"~"» + LexTerm : Λ<{> Π •Λ<}> «"|"» + LexPattern : Π •Λ<|> Π «"}"» + LexPattern : Π •Λ<|> Π «"|"» } Transitions: - | -> 112 - } -> 113 + Λ<|> -> 112 + Λ<}> -> 113 S74{ - LexPattern : LexAlt• «}» - LexAlt : LexAlt •LexTerm «}» - LexPattern : LexAlt• «|» - LexAlt : LexAlt •LexTerm «(» - LexAlt : LexAlt •LexTerm «.» - LexAlt : LexAlt •LexTerm «[» - LexAlt : LexAlt •LexTerm «char_lit» - LexAlt : LexAlt •LexTerm «regDefId» - LexAlt : LexAlt •LexTerm «{» - LexAlt : LexAlt •LexTerm «~» - LexAlt : LexAlt •LexTerm «|» - LexTerm : •. «}» - LexTerm : •char_lit «}» - LexTerm : •char_lit - char_lit «}» - LexTerm : •~ char_lit «}» - LexTerm : •~ ( char_lit - char_lit ) «}» - LexTerm : •regDefId «}» - LexTerm : •[ LexPattern ] «}» - LexTerm : •{ LexPattern } «}» - LexTerm : •( LexPattern ) «}» - LexTerm : •. «(» - LexTerm : •char_lit «(» - LexTerm : •char_lit - char_lit «(» - LexTerm : •~ char_lit «(» - LexTerm : •~ ( char_lit - char_lit ) «(» - LexTerm : •regDefId «(» - LexTerm : •[ LexPattern ] «(» - LexTerm : •{ LexPattern } «(» - LexTerm : •( LexPattern ) «(» - LexTerm : •. «.» - LexTerm : •char_lit «.» - LexTerm : •char_lit - char_lit «.» - LexTerm : •~ char_lit «.» - LexTerm : •~ ( char_lit - char_lit ) «.» - LexTerm : •regDefId «.» - LexTerm : •[ LexPattern ] «.» - LexTerm : •{ LexPattern } «.» - LexTerm : •( LexPattern ) «.» - LexTerm : •. «[» - LexTerm : •char_lit «[» - LexTerm : •char_lit - char_lit «[» - LexTerm : •~ char_lit «[» - LexTerm : •~ ( char_lit - char_lit ) «[» - LexTerm : •regDefId «[» - LexTerm : •[ LexPattern ] «[» - LexTerm : •{ LexPattern } «[» - LexTerm : •( LexPattern ) «[» - LexTerm : •. «char_lit» + LexPattern : Π• «"}"» + LexAlt : Π •Π «"}"» + LexPattern : Π• «"|"» + LexAlt : Π •Π «"("» + LexAlt : Π •Π «"."» + LexAlt : Π •Π «"["» + LexAlt : Π •Π «char_lit» + LexAlt : Π •Π «regDefId» + LexAlt : Π •Π «"{"» + LexAlt : Π •Π «"~"» + LexAlt : Π •Π «"|"» + LexTerm : •Λ<.> «"}"» + LexTerm : •char_lit «"}"» + LexTerm : •char_lit Λ<-> char_lit «"}"» + LexTerm : •Λ<~> char_lit «"}"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"}"» + LexTerm : •regDefId «"}"» + LexTerm : •Λ<[> Π Λ<]> «"}"» + LexTerm : •Λ<{> Π Λ<}> «"}"» + LexTerm : •Λ<(> Π Λ<)> «"}"» + LexTerm : •Λ<.> «"("» + LexTerm : •char_lit «"("» + LexTerm : •char_lit Λ<-> char_lit «"("» + LexTerm : •Λ<~> char_lit «"("» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"("» + LexTerm : •regDefId «"("» + LexTerm : •Λ<[> Π Λ<]> «"("» + LexTerm : •Λ<{> Π Λ<}> «"("» + LexTerm : •Λ<(> Π Λ<)> «"("» + LexTerm : •Λ<.> «"."» + LexTerm : •char_lit «"."» + LexTerm : •char_lit Λ<-> char_lit «"."» + LexTerm : •Λ<~> char_lit «"."» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"."» + LexTerm : •regDefId «"."» + LexTerm : •Λ<[> Π Λ<]> «"."» + LexTerm : •Λ<{> Π Λ<}> «"."» + LexTerm : •Λ<(> Π Λ<)> «"."» + LexTerm : •Λ<.> «"["» + LexTerm : •char_lit «"["» + LexTerm : •char_lit Λ<-> char_lit «"["» + LexTerm : •Λ<~> char_lit «"["» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"["» + LexTerm : •regDefId «"["» + LexTerm : •Λ<[> Π Λ<]> «"["» + LexTerm : •Λ<{> Π Λ<}> «"["» + LexTerm : •Λ<(> Π Λ<)> «"["» + LexTerm : •Λ<.> «char_lit» LexTerm : •char_lit «char_lit» - LexTerm : •char_lit - char_lit «char_lit» - LexTerm : •~ char_lit «char_lit» - LexTerm : •~ ( char_lit - char_lit ) «char_lit» + LexTerm : •char_lit Λ<-> char_lit «char_lit» + LexTerm : •Λ<~> char_lit «char_lit» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «char_lit» LexTerm : •regDefId «char_lit» - LexTerm : •[ LexPattern ] «char_lit» - LexTerm : •{ LexPattern } «char_lit» - LexTerm : •( LexPattern ) «char_lit» - LexTerm : •. «regDefId» + LexTerm : •Λ<[> Π Λ<]> «char_lit» + LexTerm : •Λ<{> Π Λ<}> «char_lit» + LexTerm : •Λ<(> Π Λ<)> «char_lit» + LexTerm : •Λ<.> «regDefId» LexTerm : •char_lit «regDefId» - LexTerm : •char_lit - char_lit «regDefId» - LexTerm : •~ char_lit «regDefId» - LexTerm : •~ ( char_lit - char_lit ) «regDefId» + LexTerm : •char_lit Λ<-> char_lit «regDefId» + LexTerm : •Λ<~> char_lit «regDefId» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «regDefId» LexTerm : •regDefId «regDefId» - LexTerm : •[ LexPattern ] «regDefId» - LexTerm : •{ LexPattern } «regDefId» - LexTerm : •( LexPattern ) «regDefId» - LexTerm : •. «{» - LexTerm : •char_lit «{» - LexTerm : •char_lit - char_lit «{» - LexTerm : •~ char_lit «{» - LexTerm : •~ ( char_lit - char_lit ) «{» - LexTerm : •regDefId «{» - LexTerm : •[ LexPattern ] «{» - LexTerm : •{ LexPattern } «{» - LexTerm : •( LexPattern ) «{» - LexTerm : •. «~» - LexTerm : •char_lit «~» - LexTerm : •char_lit - char_lit «~» - LexTerm : •~ char_lit «~» - LexTerm : •~ ( char_lit - char_lit ) «~» - LexTerm : •regDefId «~» - LexTerm : •[ LexPattern ] «~» - LexTerm : •{ LexPattern } «~» - LexTerm : •( LexPattern ) «~» - LexTerm : •. «|» - LexTerm : •char_lit «|» - LexTerm : •char_lit - char_lit «|» - LexTerm : •~ char_lit «|» - LexTerm : •~ ( char_lit - char_lit ) «|» - LexTerm : •regDefId «|» - LexTerm : •[ LexPattern ] «|» - LexTerm : •{ LexPattern } «|» - LexTerm : •( LexPattern ) «|» + LexTerm : •Λ<[> Π Λ<]> «regDefId» + LexTerm : •Λ<{> Π Λ<}> «regDefId» + LexTerm : •Λ<(> Π Λ<)> «regDefId» + LexTerm : •Λ<.> «"{"» + LexTerm : •char_lit «"{"» + LexTerm : •char_lit Λ<-> char_lit «"{"» + LexTerm : •Λ<~> char_lit «"{"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"{"» + LexTerm : •regDefId «"{"» + LexTerm : •Λ<[> Π Λ<]> «"{"» + LexTerm : •Λ<{> Π Λ<}> «"{"» + LexTerm : •Λ<(> Π Λ<)> «"{"» + LexTerm : •Λ<.> «"~"» + LexTerm : •char_lit «"~"» + LexTerm : •char_lit Λ<-> char_lit «"~"» + LexTerm : •Λ<~> char_lit «"~"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"~"» + LexTerm : •regDefId «"~"» + LexTerm : •Λ<[> Π Λ<]> «"~"» + LexTerm : •Λ<{> Π Λ<}> «"~"» + LexTerm : •Λ<(> Π Λ<)> «"~"» + LexTerm : •Λ<.> «"|"» + LexTerm : •char_lit «"|"» + LexTerm : •char_lit Λ<-> char_lit «"|"» + LexTerm : •Λ<~> char_lit «"|"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"|"» + LexTerm : •regDefId «"|"» + LexTerm : •Λ<[> Π Λ<]> «"|"» + LexTerm : •Λ<{> Π Λ<}> «"|"» + LexTerm : •Λ<(> Π Λ<)> «"|"» } Transitions: regDefId -> 76 - . -> 77 + Λ<.> -> 77 char_lit -> 78 - ~ -> 79 - ( -> 80 - [ -> 81 - { -> 82 - LexTerm -> 114 + Λ<~> -> 79 + Λ<(> -> 80 + Λ<[> -> 81 + Λ<{> -> 82 + Π -> 114 S75{ - LexAlt : LexTerm• «}» - LexAlt : LexTerm• «(» - LexAlt : LexTerm• «.» - LexAlt : LexTerm• «[» - LexAlt : LexTerm• «char_lit» - LexAlt : LexTerm• «regDefId» - LexAlt : LexTerm• «{» - LexAlt : LexTerm• «~» - LexAlt : LexTerm• «|» + LexAlt : Π• «"}"» + LexAlt : Π• «"("» + LexAlt : Π• «"."» + LexAlt : Π• «"["» + LexAlt : Π• «char_lit» + LexAlt : Π• «regDefId» + LexAlt : Π• «"{"» + LexAlt : Π• «"~"» + LexAlt : Π• «"|"» } Transitions: S76{ - LexTerm : regDefId• «}» - LexTerm : regDefId• «(» - LexTerm : regDefId• «.» - LexTerm : regDefId• «[» + LexTerm : regDefId• «"}"» + LexTerm : regDefId• «"("» + LexTerm : regDefId• «"."» + LexTerm : regDefId• «"["» LexTerm : regDefId• «char_lit» LexTerm : regDefId• «regDefId» - LexTerm : regDefId• «{» - LexTerm : regDefId• «~» - LexTerm : regDefId• «|» + LexTerm : regDefId• «"{"» + LexTerm : regDefId• «"~"» + LexTerm : regDefId• «"|"» } Transitions: S77{ - LexTerm : .• «}» - LexTerm : .• «(» - LexTerm : .• «.» - LexTerm : .• «[» - LexTerm : .• «char_lit» - LexTerm : .• «regDefId» - LexTerm : .• «{» - LexTerm : .• «~» - LexTerm : .• «|» + LexTerm : Λ<.>• «"}"» + LexTerm : Λ<.>• «"("» + LexTerm : Λ<.>• «"."» + LexTerm : Λ<.>• «"["» + LexTerm : Λ<.>• «char_lit» + LexTerm : Λ<.>• «regDefId» + LexTerm : Λ<.>• «"{"» + LexTerm : Λ<.>• «"~"» + LexTerm : Λ<.>• «"|"» } Transitions: S78{ - LexTerm : char_lit• «}» - LexTerm : char_lit •- char_lit «}» - LexTerm : char_lit• «(» - LexTerm : char_lit •- char_lit «(» - LexTerm : char_lit• «.» - LexTerm : char_lit •- char_lit «.» - LexTerm : char_lit• «[» - LexTerm : char_lit •- char_lit «[» + LexTerm : char_lit• «"}"» + LexTerm : char_lit •Λ<-> char_lit «"}"» + LexTerm : char_lit• «"("» + LexTerm : char_lit •Λ<-> char_lit «"("» + LexTerm : char_lit• «"."» + LexTerm : char_lit •Λ<-> char_lit «"."» + LexTerm : char_lit• «"["» + LexTerm : char_lit •Λ<-> char_lit «"["» LexTerm : char_lit• «char_lit» - LexTerm : char_lit •- char_lit «char_lit» + LexTerm : char_lit •Λ<-> char_lit «char_lit» LexTerm : char_lit• «regDefId» - LexTerm : char_lit •- char_lit «regDefId» - LexTerm : char_lit• «{» - LexTerm : char_lit •- char_lit «{» - LexTerm : char_lit• «~» - LexTerm : char_lit •- char_lit «~» - LexTerm : char_lit• «|» - LexTerm : char_lit •- char_lit «|» + LexTerm : char_lit •Λ<-> char_lit «regDefId» + LexTerm : char_lit• «"{"» + LexTerm : char_lit •Λ<-> char_lit «"{"» + LexTerm : char_lit• «"~"» + LexTerm : char_lit •Λ<-> char_lit «"~"» + LexTerm : char_lit• «"|"» + LexTerm : char_lit •Λ<-> char_lit «"|"» } Transitions: - - -> 115 + Λ<-> -> 115 S79{ - LexTerm : ~ •char_lit «}» - LexTerm : ~ •( char_lit - char_lit ) «}» - LexTerm : ~ •char_lit «(» - LexTerm : ~ •( char_lit - char_lit ) «(» - LexTerm : ~ •char_lit «.» - LexTerm : ~ •( char_lit - char_lit ) «.» - LexTerm : ~ •char_lit «[» - LexTerm : ~ •( char_lit - char_lit ) «[» - LexTerm : ~ •char_lit «char_lit» - LexTerm : ~ •( char_lit - char_lit ) «char_lit» - LexTerm : ~ •char_lit «regDefId» - LexTerm : ~ •( char_lit - char_lit ) «regDefId» - LexTerm : ~ •char_lit «{» - LexTerm : ~ •( char_lit - char_lit ) «{» - LexTerm : ~ •char_lit «~» - LexTerm : ~ •( char_lit - char_lit ) «~» - LexTerm : ~ •char_lit «|» - LexTerm : ~ •( char_lit - char_lit ) «|» + LexTerm : Λ<~> •char_lit «"}"» + LexTerm : Λ<~> •Λ<(> char_lit Λ<-> char_lit Λ<)> «"}"» + LexTerm : Λ<~> •char_lit «"("» + LexTerm : Λ<~> •Λ<(> char_lit Λ<-> char_lit Λ<)> «"("» + LexTerm : Λ<~> •char_lit «"."» + LexTerm : Λ<~> •Λ<(> char_lit Λ<-> char_lit Λ<)> «"."» + LexTerm : Λ<~> •char_lit «"["» + LexTerm : Λ<~> •Λ<(> char_lit Λ<-> char_lit Λ<)> «"["» + LexTerm : Λ<~> •char_lit «char_lit» + LexTerm : Λ<~> •Λ<(> char_lit Λ<-> char_lit Λ<)> «char_lit» + LexTerm : Λ<~> •char_lit «regDefId» + LexTerm : Λ<~> •Λ<(> char_lit Λ<-> char_lit Λ<)> «regDefId» + LexTerm : Λ<~> •char_lit «"{"» + LexTerm : Λ<~> •Λ<(> char_lit Λ<-> char_lit Λ<)> «"{"» + LexTerm : Λ<~> •char_lit «"~"» + LexTerm : Λ<~> •Λ<(> char_lit Λ<-> char_lit Λ<)> «"~"» + LexTerm : Λ<~> •char_lit «"|"» + LexTerm : Λ<~> •Λ<(> char_lit Λ<-> char_lit Λ<)> «"|"» } Transitions: char_lit -> 116 - ( -> 117 + Λ<(> -> 117 S80{ - LexTerm : ( •LexPattern ) «}» - LexTerm : ( •LexPattern ) «(» - LexTerm : ( •LexPattern ) «.» - LexTerm : ( •LexPattern ) «[» - LexTerm : ( •LexPattern ) «char_lit» - LexTerm : ( •LexPattern ) «regDefId» - LexTerm : ( •LexPattern ) «{» - LexTerm : ( •LexPattern ) «~» - LexTerm : ( •LexPattern ) «|» - LexPattern : •LexAlt «)» - LexPattern : •LexPattern | LexAlt «)» - LexAlt : •LexTerm «)» - LexAlt : •LexAlt LexTerm «)» - LexPattern : •LexAlt «|» - LexPattern : •LexPattern | LexAlt «|» - LexTerm : •. «)» - LexTerm : •char_lit «)» - LexTerm : •char_lit - char_lit «)» - LexTerm : •~ char_lit «)» - LexTerm : •~ ( char_lit - char_lit ) «)» - LexTerm : •regDefId «)» - LexTerm : •[ LexPattern ] «)» - LexTerm : •{ LexPattern } «)» - LexTerm : •( LexPattern ) «)» - LexAlt : •LexTerm «(» - LexAlt : •LexTerm «.» - LexAlt : •LexTerm «[» - LexAlt : •LexTerm «char_lit» - LexAlt : •LexTerm «regDefId» - LexAlt : •LexTerm «{» - LexAlt : •LexTerm «~» - LexAlt : •LexAlt LexTerm «(» - LexAlt : •LexAlt LexTerm «.» - LexAlt : •LexAlt LexTerm «[» - LexAlt : •LexAlt LexTerm «char_lit» - LexAlt : •LexAlt LexTerm «regDefId» - LexAlt : •LexAlt LexTerm «{» - LexAlt : •LexAlt LexTerm «~» - LexAlt : •LexTerm «|» - LexAlt : •LexAlt LexTerm «|» - LexTerm : •. «(» - LexTerm : •char_lit «(» - LexTerm : •char_lit - char_lit «(» - LexTerm : •~ char_lit «(» - LexTerm : •~ ( char_lit - char_lit ) «(» - LexTerm : •regDefId «(» - LexTerm : •[ LexPattern ] «(» - LexTerm : •{ LexPattern } «(» - LexTerm : •( LexPattern ) «(» - LexTerm : •. «.» - LexTerm : •char_lit «.» - LexTerm : •char_lit - char_lit «.» - LexTerm : •~ char_lit «.» - LexTerm : •~ ( char_lit - char_lit ) «.» - LexTerm : •regDefId «.» - LexTerm : •[ LexPattern ] «.» - LexTerm : •{ LexPattern } «.» - LexTerm : •( LexPattern ) «.» - LexTerm : •. «[» - LexTerm : •char_lit «[» - LexTerm : •char_lit - char_lit «[» - LexTerm : •~ char_lit «[» - LexTerm : •~ ( char_lit - char_lit ) «[» - LexTerm : •regDefId «[» - LexTerm : •[ LexPattern ] «[» - LexTerm : •{ LexPattern } «[» - LexTerm : •( LexPattern ) «[» - LexTerm : •. «char_lit» + LexTerm : Λ<(> •Π Λ<)> «"}"» + LexTerm : Λ<(> •Π Λ<)> «"("» + LexTerm : Λ<(> •Π Λ<)> «"."» + LexTerm : Λ<(> •Π Λ<)> «"["» + LexTerm : Λ<(> •Π Λ<)> «char_lit» + LexTerm : Λ<(> •Π Λ<)> «regDefId» + LexTerm : Λ<(> •Π Λ<)> «"{"» + LexTerm : Λ<(> •Π Λ<)> «"~"» + LexTerm : Λ<(> •Π Λ<)> «"|"» + LexPattern : •Π «")"» + LexPattern : •Π Λ<|> Π «")"» + LexAlt : •Π «")"» + LexAlt : •Π Π «")"» + LexPattern : •Π «"|"» + LexPattern : •Π Λ<|> Π «"|"» + LexTerm : •Λ<.> «")"» + LexTerm : •char_lit «")"» + LexTerm : •char_lit Λ<-> char_lit «")"» + LexTerm : •Λ<~> char_lit «")"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «")"» + LexTerm : •regDefId «")"» + LexTerm : •Λ<[> Π Λ<]> «")"» + LexTerm : •Λ<{> Π Λ<}> «")"» + LexTerm : •Λ<(> Π Λ<)> «")"» + LexAlt : •Π «"("» + LexAlt : •Π «"."» + LexAlt : •Π «"["» + LexAlt : •Π «char_lit» + LexAlt : •Π «regDefId» + LexAlt : •Π «"{"» + LexAlt : •Π «"~"» + LexAlt : •Π Π «"("» + LexAlt : •Π Π «"."» + LexAlt : •Π Π «"["» + LexAlt : •Π Π «char_lit» + LexAlt : •Π Π «regDefId» + LexAlt : •Π Π «"{"» + LexAlt : •Π Π «"~"» + LexAlt : •Π «"|"» + LexAlt : •Π Π «"|"» + LexTerm : •Λ<.> «"("» + LexTerm : •char_lit «"("» + LexTerm : •char_lit Λ<-> char_lit «"("» + LexTerm : •Λ<~> char_lit «"("» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"("» + LexTerm : •regDefId «"("» + LexTerm : •Λ<[> Π Λ<]> «"("» + LexTerm : •Λ<{> Π Λ<}> «"("» + LexTerm : •Λ<(> Π Λ<)> «"("» + LexTerm : •Λ<.> «"."» + LexTerm : •char_lit «"."» + LexTerm : •char_lit Λ<-> char_lit «"."» + LexTerm : •Λ<~> char_lit «"."» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"."» + LexTerm : •regDefId «"."» + LexTerm : •Λ<[> Π Λ<]> «"."» + LexTerm : •Λ<{> Π Λ<}> «"."» + LexTerm : •Λ<(> Π Λ<)> «"."» + LexTerm : •Λ<.> «"["» + LexTerm : •char_lit «"["» + LexTerm : •char_lit Λ<-> char_lit «"["» + LexTerm : •Λ<~> char_lit «"["» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"["» + LexTerm : •regDefId «"["» + LexTerm : •Λ<[> Π Λ<]> «"["» + LexTerm : •Λ<{> Π Λ<}> «"["» + LexTerm : •Λ<(> Π Λ<)> «"["» + LexTerm : •Λ<.> «char_lit» LexTerm : •char_lit «char_lit» - LexTerm : •char_lit - char_lit «char_lit» - LexTerm : •~ char_lit «char_lit» - LexTerm : •~ ( char_lit - char_lit ) «char_lit» + LexTerm : •char_lit Λ<-> char_lit «char_lit» + LexTerm : •Λ<~> char_lit «char_lit» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «char_lit» LexTerm : •regDefId «char_lit» - LexTerm : •[ LexPattern ] «char_lit» - LexTerm : •{ LexPattern } «char_lit» - LexTerm : •( LexPattern ) «char_lit» - LexTerm : •. «regDefId» + LexTerm : •Λ<[> Π Λ<]> «char_lit» + LexTerm : •Λ<{> Π Λ<}> «char_lit» + LexTerm : •Λ<(> Π Λ<)> «char_lit» + LexTerm : •Λ<.> «regDefId» LexTerm : •char_lit «regDefId» - LexTerm : •char_lit - char_lit «regDefId» - LexTerm : •~ char_lit «regDefId» - LexTerm : •~ ( char_lit - char_lit ) «regDefId» + LexTerm : •char_lit Λ<-> char_lit «regDefId» + LexTerm : •Λ<~> char_lit «regDefId» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «regDefId» LexTerm : •regDefId «regDefId» - LexTerm : •[ LexPattern ] «regDefId» - LexTerm : •{ LexPattern } «regDefId» - LexTerm : •( LexPattern ) «regDefId» - LexTerm : •. «{» - LexTerm : •char_lit «{» - LexTerm : •char_lit - char_lit «{» - LexTerm : •~ char_lit «{» - LexTerm : •~ ( char_lit - char_lit ) «{» - LexTerm : •regDefId «{» - LexTerm : •[ LexPattern ] «{» - LexTerm : •{ LexPattern } «{» - LexTerm : •( LexPattern ) «{» - LexTerm : •. «~» - LexTerm : •char_lit «~» - LexTerm : •char_lit - char_lit «~» - LexTerm : •~ char_lit «~» - LexTerm : •~ ( char_lit - char_lit ) «~» - LexTerm : •regDefId «~» - LexTerm : •[ LexPattern ] «~» - LexTerm : •{ LexPattern } «~» - LexTerm : •( LexPattern ) «~» - LexTerm : •. «|» - LexTerm : •char_lit «|» - LexTerm : •char_lit - char_lit «|» - LexTerm : •~ char_lit «|» - LexTerm : •~ ( char_lit - char_lit ) «|» - LexTerm : •regDefId «|» - LexTerm : •[ LexPattern ] «|» - LexTerm : •{ LexPattern } «|» - LexTerm : •( LexPattern ) «|» -} -Transitions: - LexAlt -> 54 - LexTerm -> 55 + LexTerm : •Λ<[> Π Λ<]> «regDefId» + LexTerm : •Λ<{> Π Λ<}> «regDefId» + LexTerm : •Λ<(> Π Λ<)> «regDefId» + LexTerm : •Λ<.> «"{"» + LexTerm : •char_lit «"{"» + LexTerm : •char_lit Λ<-> char_lit «"{"» + LexTerm : •Λ<~> char_lit «"{"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"{"» + LexTerm : •regDefId «"{"» + LexTerm : •Λ<[> Π Λ<]> «"{"» + LexTerm : •Λ<{> Π Λ<}> «"{"» + LexTerm : •Λ<(> Π Λ<)> «"{"» + LexTerm : •Λ<.> «"~"» + LexTerm : •char_lit «"~"» + LexTerm : •char_lit Λ<-> char_lit «"~"» + LexTerm : •Λ<~> char_lit «"~"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"~"» + LexTerm : •regDefId «"~"» + LexTerm : •Λ<[> Π Λ<]> «"~"» + LexTerm : •Λ<{> Π Λ<}> «"~"» + LexTerm : •Λ<(> Π Λ<)> «"~"» + LexTerm : •Λ<.> «"|"» + LexTerm : •char_lit «"|"» + LexTerm : •char_lit Λ<-> char_lit «"|"» + LexTerm : •Λ<~> char_lit «"|"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"|"» + LexTerm : •regDefId «"|"» + LexTerm : •Λ<[> Π Λ<]> «"|"» + LexTerm : •Λ<{> Π Λ<}> «"|"» + LexTerm : •Λ<(> Π Λ<)> «"|"» +} +Transitions: + Π -> 54 + Π -> 55 regDefId -> 56 - . -> 57 + Λ<.> -> 57 char_lit -> 58 - ~ -> 59 - ( -> 60 - [ -> 61 - { -> 62 - LexPattern -> 118 + Λ<~> -> 59 + Λ<(> -> 60 + Λ<[> -> 61 + Λ<{> -> 62 + Π -> 118 S81{ - LexTerm : [ •LexPattern ] «}» - LexTerm : [ •LexPattern ] «(» - LexTerm : [ •LexPattern ] «.» - LexTerm : [ •LexPattern ] «[» - LexTerm : [ •LexPattern ] «char_lit» - LexTerm : [ •LexPattern ] «regDefId» - LexTerm : [ •LexPattern ] «{» - LexTerm : [ •LexPattern ] «~» - LexTerm : [ •LexPattern ] «|» - LexPattern : •LexAlt «]» - LexPattern : •LexPattern | LexAlt «]» - LexAlt : •LexTerm «]» - LexAlt : •LexAlt LexTerm «]» - LexPattern : •LexAlt «|» - LexPattern : •LexPattern | LexAlt «|» - LexTerm : •. «]» - LexTerm : •char_lit «]» - LexTerm : •char_lit - char_lit «]» - LexTerm : •~ char_lit «]» - LexTerm : •~ ( char_lit - char_lit ) «]» - LexTerm : •regDefId «]» - LexTerm : •[ LexPattern ] «]» - LexTerm : •{ LexPattern } «]» - LexTerm : •( LexPattern ) «]» - LexAlt : •LexTerm «(» - LexAlt : •LexTerm «.» - LexAlt : •LexTerm «[» - LexAlt : •LexTerm «char_lit» - LexAlt : •LexTerm «regDefId» - LexAlt : •LexTerm «{» - LexAlt : •LexTerm «~» - LexAlt : •LexAlt LexTerm «(» - LexAlt : •LexAlt LexTerm «.» - LexAlt : •LexAlt LexTerm «[» - LexAlt : •LexAlt LexTerm «char_lit» - LexAlt : •LexAlt LexTerm «regDefId» - LexAlt : •LexAlt LexTerm «{» - LexAlt : •LexAlt LexTerm «~» - LexAlt : •LexTerm «|» - LexAlt : •LexAlt LexTerm «|» - LexTerm : •. «(» - LexTerm : •char_lit «(» - LexTerm : •char_lit - char_lit «(» - LexTerm : •~ char_lit «(» - LexTerm : •~ ( char_lit - char_lit ) «(» - LexTerm : •regDefId «(» - LexTerm : •[ LexPattern ] «(» - LexTerm : •{ LexPattern } «(» - LexTerm : •( LexPattern ) «(» - LexTerm : •. «.» - LexTerm : •char_lit «.» - LexTerm : •char_lit - char_lit «.» - LexTerm : •~ char_lit «.» - LexTerm : •~ ( char_lit - char_lit ) «.» - LexTerm : •regDefId «.» - LexTerm : •[ LexPattern ] «.» - LexTerm : •{ LexPattern } «.» - LexTerm : •( LexPattern ) «.» - LexTerm : •. «[» - LexTerm : •char_lit «[» - LexTerm : •char_lit - char_lit «[» - LexTerm : •~ char_lit «[» - LexTerm : •~ ( char_lit - char_lit ) «[» - LexTerm : •regDefId «[» - LexTerm : •[ LexPattern ] «[» - LexTerm : •{ LexPattern } «[» - LexTerm : •( LexPattern ) «[» - LexTerm : •. «char_lit» + LexTerm : Λ<[> •Π Λ<]> «"}"» + LexTerm : Λ<[> •Π Λ<]> «"("» + LexTerm : Λ<[> •Π Λ<]> «"."» + LexTerm : Λ<[> •Π Λ<]> «"["» + LexTerm : Λ<[> •Π Λ<]> «char_lit» + LexTerm : Λ<[> •Π Λ<]> «regDefId» + LexTerm : Λ<[> •Π Λ<]> «"{"» + LexTerm : Λ<[> •Π Λ<]> «"~"» + LexTerm : Λ<[> •Π Λ<]> «"|"» + LexPattern : •Π «"]"» + LexPattern : •Π Λ<|> Π «"]"» + LexAlt : •Π «"]"» + LexAlt : •Π Π «"]"» + LexPattern : •Π «"|"» + LexPattern : •Π Λ<|> Π «"|"» + LexTerm : •Λ<.> «"]"» + LexTerm : •char_lit «"]"» + LexTerm : •char_lit Λ<-> char_lit «"]"» + LexTerm : •Λ<~> char_lit «"]"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"]"» + LexTerm : •regDefId «"]"» + LexTerm : •Λ<[> Π Λ<]> «"]"» + LexTerm : •Λ<{> Π Λ<}> «"]"» + LexTerm : •Λ<(> Π Λ<)> «"]"» + LexAlt : •Π «"("» + LexAlt : •Π «"."» + LexAlt : •Π «"["» + LexAlt : •Π «char_lit» + LexAlt : •Π «regDefId» + LexAlt : •Π «"{"» + LexAlt : •Π «"~"» + LexAlt : •Π Π «"("» + LexAlt : •Π Π «"."» + LexAlt : •Π Π «"["» + LexAlt : •Π Π «char_lit» + LexAlt : •Π Π «regDefId» + LexAlt : •Π Π «"{"» + LexAlt : •Π Π «"~"» + LexAlt : •Π «"|"» + LexAlt : •Π Π «"|"» + LexTerm : •Λ<.> «"("» + LexTerm : •char_lit «"("» + LexTerm : •char_lit Λ<-> char_lit «"("» + LexTerm : •Λ<~> char_lit «"("» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"("» + LexTerm : •regDefId «"("» + LexTerm : •Λ<[> Π Λ<]> «"("» + LexTerm : •Λ<{> Π Λ<}> «"("» + LexTerm : •Λ<(> Π Λ<)> «"("» + LexTerm : •Λ<.> «"."» + LexTerm : •char_lit «"."» + LexTerm : •char_lit Λ<-> char_lit «"."» + LexTerm : •Λ<~> char_lit «"."» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"."» + LexTerm : •regDefId «"."» + LexTerm : •Λ<[> Π Λ<]> «"."» + LexTerm : •Λ<{> Π Λ<}> «"."» + LexTerm : •Λ<(> Π Λ<)> «"."» + LexTerm : •Λ<.> «"["» + LexTerm : •char_lit «"["» + LexTerm : •char_lit Λ<-> char_lit «"["» + LexTerm : •Λ<~> char_lit «"["» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"["» + LexTerm : •regDefId «"["» + LexTerm : •Λ<[> Π Λ<]> «"["» + LexTerm : •Λ<{> Π Λ<}> «"["» + LexTerm : •Λ<(> Π Λ<)> «"["» + LexTerm : •Λ<.> «char_lit» LexTerm : •char_lit «char_lit» - LexTerm : •char_lit - char_lit «char_lit» - LexTerm : •~ char_lit «char_lit» - LexTerm : •~ ( char_lit - char_lit ) «char_lit» + LexTerm : •char_lit Λ<-> char_lit «char_lit» + LexTerm : •Λ<~> char_lit «char_lit» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «char_lit» LexTerm : •regDefId «char_lit» - LexTerm : •[ LexPattern ] «char_lit» - LexTerm : •{ LexPattern } «char_lit» - LexTerm : •( LexPattern ) «char_lit» - LexTerm : •. «regDefId» + LexTerm : •Λ<[> Π Λ<]> «char_lit» + LexTerm : •Λ<{> Π Λ<}> «char_lit» + LexTerm : •Λ<(> Π Λ<)> «char_lit» + LexTerm : •Λ<.> «regDefId» LexTerm : •char_lit «regDefId» - LexTerm : •char_lit - char_lit «regDefId» - LexTerm : •~ char_lit «regDefId» - LexTerm : •~ ( char_lit - char_lit ) «regDefId» + LexTerm : •char_lit Λ<-> char_lit «regDefId» + LexTerm : •Λ<~> char_lit «regDefId» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «regDefId» LexTerm : •regDefId «regDefId» - LexTerm : •[ LexPattern ] «regDefId» - LexTerm : •{ LexPattern } «regDefId» - LexTerm : •( LexPattern ) «regDefId» - LexTerm : •. «{» - LexTerm : •char_lit «{» - LexTerm : •char_lit - char_lit «{» - LexTerm : •~ char_lit «{» - LexTerm : •~ ( char_lit - char_lit ) «{» - LexTerm : •regDefId «{» - LexTerm : •[ LexPattern ] «{» - LexTerm : •{ LexPattern } «{» - LexTerm : •( LexPattern ) «{» - LexTerm : •. «~» - LexTerm : •char_lit «~» - LexTerm : •char_lit - char_lit «~» - LexTerm : •~ char_lit «~» - LexTerm : •~ ( char_lit - char_lit ) «~» - LexTerm : •regDefId «~» - LexTerm : •[ LexPattern ] «~» - LexTerm : •{ LexPattern } «~» - LexTerm : •( LexPattern ) «~» - LexTerm : •. «|» - LexTerm : •char_lit «|» - LexTerm : •char_lit - char_lit «|» - LexTerm : •~ char_lit «|» - LexTerm : •~ ( char_lit - char_lit ) «|» - LexTerm : •regDefId «|» - LexTerm : •[ LexPattern ] «|» - LexTerm : •{ LexPattern } «|» - LexTerm : •( LexPattern ) «|» -} -Transitions: - LexAlt -> 64 - LexTerm -> 65 + LexTerm : •Λ<[> Π Λ<]> «regDefId» + LexTerm : •Λ<{> Π Λ<}> «regDefId» + LexTerm : •Λ<(> Π Λ<)> «regDefId» + LexTerm : •Λ<.> «"{"» + LexTerm : •char_lit «"{"» + LexTerm : •char_lit Λ<-> char_lit «"{"» + LexTerm : •Λ<~> char_lit «"{"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"{"» + LexTerm : •regDefId «"{"» + LexTerm : •Λ<[> Π Λ<]> «"{"» + LexTerm : •Λ<{> Π Λ<}> «"{"» + LexTerm : •Λ<(> Π Λ<)> «"{"» + LexTerm : •Λ<.> «"~"» + LexTerm : •char_lit «"~"» + LexTerm : •char_lit Λ<-> char_lit «"~"» + LexTerm : •Λ<~> char_lit «"~"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"~"» + LexTerm : •regDefId «"~"» + LexTerm : •Λ<[> Π Λ<]> «"~"» + LexTerm : •Λ<{> Π Λ<}> «"~"» + LexTerm : •Λ<(> Π Λ<)> «"~"» + LexTerm : •Λ<.> «"|"» + LexTerm : •char_lit «"|"» + LexTerm : •char_lit Λ<-> char_lit «"|"» + LexTerm : •Λ<~> char_lit «"|"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"|"» + LexTerm : •regDefId «"|"» + LexTerm : •Λ<[> Π Λ<]> «"|"» + LexTerm : •Λ<{> Π Λ<}> «"|"» + LexTerm : •Λ<(> Π Λ<)> «"|"» +} +Transitions: + Π -> 64 + Π -> 65 regDefId -> 66 - . -> 67 + Λ<.> -> 67 char_lit -> 68 - ~ -> 69 - ( -> 70 - [ -> 71 - { -> 72 - LexPattern -> 119 + Λ<~> -> 69 + Λ<(> -> 70 + Λ<[> -> 71 + Λ<{> -> 72 + Π -> 119 S82{ - LexTerm : { •LexPattern } «}» - LexTerm : { •LexPattern } «(» - LexTerm : { •LexPattern } «.» - LexTerm : { •LexPattern } «[» - LexTerm : { •LexPattern } «char_lit» - LexTerm : { •LexPattern } «regDefId» - LexTerm : { •LexPattern } «{» - LexTerm : { •LexPattern } «~» - LexTerm : { •LexPattern } «|» - LexPattern : •LexAlt «}» - LexPattern : •LexPattern | LexAlt «}» - LexAlt : •LexTerm «}» - LexAlt : •LexAlt LexTerm «}» - LexPattern : •LexAlt «|» - LexPattern : •LexPattern | LexAlt «|» - LexTerm : •. «}» - LexTerm : •char_lit «}» - LexTerm : •char_lit - char_lit «}» - LexTerm : •~ char_lit «}» - LexTerm : •~ ( char_lit - char_lit ) «}» - LexTerm : •regDefId «}» - LexTerm : •[ LexPattern ] «}» - LexTerm : •{ LexPattern } «}» - LexTerm : •( LexPattern ) «}» - LexAlt : •LexTerm «(» - LexAlt : •LexTerm «.» - LexAlt : •LexTerm «[» - LexAlt : •LexTerm «char_lit» - LexAlt : •LexTerm «regDefId» - LexAlt : •LexTerm «{» - LexAlt : •LexTerm «~» - LexAlt : •LexAlt LexTerm «(» - LexAlt : •LexAlt LexTerm «.» - LexAlt : •LexAlt LexTerm «[» - LexAlt : •LexAlt LexTerm «char_lit» - LexAlt : •LexAlt LexTerm «regDefId» - LexAlt : •LexAlt LexTerm «{» - LexAlt : •LexAlt LexTerm «~» - LexAlt : •LexTerm «|» - LexAlt : •LexAlt LexTerm «|» - LexTerm : •. «(» - LexTerm : •char_lit «(» - LexTerm : •char_lit - char_lit «(» - LexTerm : •~ char_lit «(» - LexTerm : •~ ( char_lit - char_lit ) «(» - LexTerm : •regDefId «(» - LexTerm : •[ LexPattern ] «(» - LexTerm : •{ LexPattern } «(» - LexTerm : •( LexPattern ) «(» - LexTerm : •. «.» - LexTerm : •char_lit «.» - LexTerm : •char_lit - char_lit «.» - LexTerm : •~ char_lit «.» - LexTerm : •~ ( char_lit - char_lit ) «.» - LexTerm : •regDefId «.» - LexTerm : •[ LexPattern ] «.» - LexTerm : •{ LexPattern } «.» - LexTerm : •( LexPattern ) «.» - LexTerm : •. «[» - LexTerm : •char_lit «[» - LexTerm : •char_lit - char_lit «[» - LexTerm : •~ char_lit «[» - LexTerm : •~ ( char_lit - char_lit ) «[» - LexTerm : •regDefId «[» - LexTerm : •[ LexPattern ] «[» - LexTerm : •{ LexPattern } «[» - LexTerm : •( LexPattern ) «[» - LexTerm : •. «char_lit» + LexTerm : Λ<{> •Π Λ<}> «"}"» + LexTerm : Λ<{> •Π Λ<}> «"("» + LexTerm : Λ<{> •Π Λ<}> «"."» + LexTerm : Λ<{> •Π Λ<}> «"["» + LexTerm : Λ<{> •Π Λ<}> «char_lit» + LexTerm : Λ<{> •Π Λ<}> «regDefId» + LexTerm : Λ<{> •Π Λ<}> «"{"» + LexTerm : Λ<{> •Π Λ<}> «"~"» + LexTerm : Λ<{> •Π Λ<}> «"|"» + LexPattern : •Π «"}"» + LexPattern : •Π Λ<|> Π «"}"» + LexAlt : •Π «"}"» + LexAlt : •Π Π «"}"» + LexPattern : •Π «"|"» + LexPattern : •Π Λ<|> Π «"|"» + LexTerm : •Λ<.> «"}"» + LexTerm : •char_lit «"}"» + LexTerm : •char_lit Λ<-> char_lit «"}"» + LexTerm : •Λ<~> char_lit «"}"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"}"» + LexTerm : •regDefId «"}"» + LexTerm : •Λ<[> Π Λ<]> «"}"» + LexTerm : •Λ<{> Π Λ<}> «"}"» + LexTerm : •Λ<(> Π Λ<)> «"}"» + LexAlt : •Π «"("» + LexAlt : •Π «"."» + LexAlt : •Π «"["» + LexAlt : •Π «char_lit» + LexAlt : •Π «regDefId» + LexAlt : •Π «"{"» + LexAlt : •Π «"~"» + LexAlt : •Π Π «"("» + LexAlt : •Π Π «"."» + LexAlt : •Π Π «"["» + LexAlt : •Π Π «char_lit» + LexAlt : •Π Π «regDefId» + LexAlt : •Π Π «"{"» + LexAlt : •Π Π «"~"» + LexAlt : •Π «"|"» + LexAlt : •Π Π «"|"» + LexTerm : •Λ<.> «"("» + LexTerm : •char_lit «"("» + LexTerm : •char_lit Λ<-> char_lit «"("» + LexTerm : •Λ<~> char_lit «"("» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"("» + LexTerm : •regDefId «"("» + LexTerm : •Λ<[> Π Λ<]> «"("» + LexTerm : •Λ<{> Π Λ<}> «"("» + LexTerm : •Λ<(> Π Λ<)> «"("» + LexTerm : •Λ<.> «"."» + LexTerm : •char_lit «"."» + LexTerm : •char_lit Λ<-> char_lit «"."» + LexTerm : •Λ<~> char_lit «"."» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"."» + LexTerm : •regDefId «"."» + LexTerm : •Λ<[> Π Λ<]> «"."» + LexTerm : •Λ<{> Π Λ<}> «"."» + LexTerm : •Λ<(> Π Λ<)> «"."» + LexTerm : •Λ<.> «"["» + LexTerm : •char_lit «"["» + LexTerm : •char_lit Λ<-> char_lit «"["» + LexTerm : •Λ<~> char_lit «"["» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"["» + LexTerm : •regDefId «"["» + LexTerm : •Λ<[> Π Λ<]> «"["» + LexTerm : •Λ<{> Π Λ<}> «"["» + LexTerm : •Λ<(> Π Λ<)> «"["» + LexTerm : •Λ<.> «char_lit» LexTerm : •char_lit «char_lit» - LexTerm : •char_lit - char_lit «char_lit» - LexTerm : •~ char_lit «char_lit» - LexTerm : •~ ( char_lit - char_lit ) «char_lit» + LexTerm : •char_lit Λ<-> char_lit «char_lit» + LexTerm : •Λ<~> char_lit «char_lit» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «char_lit» LexTerm : •regDefId «char_lit» - LexTerm : •[ LexPattern ] «char_lit» - LexTerm : •{ LexPattern } «char_lit» - LexTerm : •( LexPattern ) «char_lit» - LexTerm : •. «regDefId» + LexTerm : •Λ<[> Π Λ<]> «char_lit» + LexTerm : •Λ<{> Π Λ<}> «char_lit» + LexTerm : •Λ<(> Π Λ<)> «char_lit» + LexTerm : •Λ<.> «regDefId» LexTerm : •char_lit «regDefId» - LexTerm : •char_lit - char_lit «regDefId» - LexTerm : •~ char_lit «regDefId» - LexTerm : •~ ( char_lit - char_lit ) «regDefId» + LexTerm : •char_lit Λ<-> char_lit «regDefId» + LexTerm : •Λ<~> char_lit «regDefId» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «regDefId» LexTerm : •regDefId «regDefId» - LexTerm : •[ LexPattern ] «regDefId» - LexTerm : •{ LexPattern } «regDefId» - LexTerm : •( LexPattern ) «regDefId» - LexTerm : •. «{» - LexTerm : •char_lit «{» - LexTerm : •char_lit - char_lit «{» - LexTerm : •~ char_lit «{» - LexTerm : •~ ( char_lit - char_lit ) «{» - LexTerm : •regDefId «{» - LexTerm : •[ LexPattern ] «{» - LexTerm : •{ LexPattern } «{» - LexTerm : •( LexPattern ) «{» - LexTerm : •. «~» - LexTerm : •char_lit «~» - LexTerm : •char_lit - char_lit «~» - LexTerm : •~ char_lit «~» - LexTerm : •~ ( char_lit - char_lit ) «~» - LexTerm : •regDefId «~» - LexTerm : •[ LexPattern ] «~» - LexTerm : •{ LexPattern } «~» - LexTerm : •( LexPattern ) «~» - LexTerm : •. «|» - LexTerm : •char_lit «|» - LexTerm : •char_lit - char_lit «|» - LexTerm : •~ char_lit «|» - LexTerm : •~ ( char_lit - char_lit ) «|» - LexTerm : •regDefId «|» - LexTerm : •[ LexPattern ] «|» - LexTerm : •{ LexPattern } «|» - LexTerm : •( LexPattern ) «|» -} -Transitions: - LexAlt -> 74 - LexTerm -> 75 + LexTerm : •Λ<[> Π Λ<]> «regDefId» + LexTerm : •Λ<{> Π Λ<}> «regDefId» + LexTerm : •Λ<(> Π Λ<)> «regDefId» + LexTerm : •Λ<.> «"{"» + LexTerm : •char_lit «"{"» + LexTerm : •char_lit Λ<-> char_lit «"{"» + LexTerm : •Λ<~> char_lit «"{"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"{"» + LexTerm : •regDefId «"{"» + LexTerm : •Λ<[> Π Λ<]> «"{"» + LexTerm : •Λ<{> Π Λ<}> «"{"» + LexTerm : •Λ<(> Π Λ<)> «"{"» + LexTerm : •Λ<.> «"~"» + LexTerm : •char_lit «"~"» + LexTerm : •char_lit Λ<-> char_lit «"~"» + LexTerm : •Λ<~> char_lit «"~"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"~"» + LexTerm : •regDefId «"~"» + LexTerm : •Λ<[> Π Λ<]> «"~"» + LexTerm : •Λ<{> Π Λ<}> «"~"» + LexTerm : •Λ<(> Π Λ<)> «"~"» + LexTerm : •Λ<.> «"|"» + LexTerm : •char_lit «"|"» + LexTerm : •char_lit Λ<-> char_lit «"|"» + LexTerm : •Λ<~> char_lit «"|"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"|"» + LexTerm : •regDefId «"|"» + LexTerm : •Λ<[> Π Λ<]> «"|"» + LexTerm : •Λ<{> Π Λ<}> «"|"» + LexTerm : •Λ<(> Π Λ<)> «"|"» +} +Transitions: + Π -> 74 + Π -> 75 regDefId -> 76 - . -> 77 + Λ<.> -> 77 char_lit -> 78 - ~ -> 79 - ( -> 80 - [ -> 81 - { -> 82 - LexPattern -> 120 + Λ<~> -> 79 + Λ<(> -> 80 + Λ<[> -> 81 + Λ<{> -> 82 + Π -> 120 S83{ - LexProduction : regDefId : LexPattern ;• «g_sdt_lit» - LexProduction : regDefId : LexPattern ;• «prodId» - LexProduction : regDefId : LexPattern ;• «Ω» - LexProduction : regDefId : LexPattern ;• «ignoredTokId» - LexProduction : regDefId : LexPattern ;• «regDefId» - LexProduction : regDefId : LexPattern ;• «tokId» + LexProduction : regDefId Λ<:> Π Λ<;>• «g_sdt_lit» + LexProduction : regDefId Λ<:> Π Λ<;>• «prodId» + LexProduction : regDefId Λ<:> Π Λ<;>• «Ω» + LexProduction : regDefId Λ<:> Π Λ<;>• «ignoredTokId» + LexProduction : regDefId Λ<:> Π Λ<;>• «regDefId» + LexProduction : regDefId Λ<:> Π Λ<;>• «tokId» } Transitions: S84{ - LexProduction : ignoredTokId : LexPattern ;• «g_sdt_lit» - LexProduction : ignoredTokId : LexPattern ;• «prodId» - LexProduction : ignoredTokId : LexPattern ;• «Ω» - LexProduction : ignoredTokId : LexPattern ;• «ignoredTokId» - LexProduction : ignoredTokId : LexPattern ;• «regDefId» - LexProduction : ignoredTokId : LexPattern ;• «tokId» + LexProduction : ignoredTokId Λ<:> Π Λ<;>• «g_sdt_lit» + LexProduction : ignoredTokId Λ<:> Π Λ<;>• «prodId» + LexProduction : ignoredTokId Λ<:> Π Λ<;>• «Ω» + LexProduction : ignoredTokId Λ<:> Π Λ<;>• «ignoredTokId» + LexProduction : ignoredTokId Λ<:> Π Λ<;>• «regDefId» + LexProduction : ignoredTokId Λ<:> Π Λ<;>• «tokId» } Transitions: S85{ - SyntaxProduction : prodId : Alternatives ;• «Ω» - SyntaxProduction : prodId : Alternatives ;• «prodId» + SyntaxProduction : prodId Λ<:> Π Λ<;>• «Ω» + SyntaxProduction : prodId Λ<:> Π Λ<;>• «prodId» } Transitions: S86{ - Alternatives : Alternatives | •SyntaxBody «;» - Alternatives : Alternatives | •SyntaxBody «|» - SyntaxBody : •Symbols «;» - SyntaxBody : •Symbols g_sdt_lit «;» - SyntaxBody : •ErrorSymbol «;» - SyntaxBody : •ErrorSymbol Symbols «;» - SyntaxBody : •ErrorSymbol Symbols g_sdt_lit «;» - SyntaxBody : •ErrorSymbol g_sdt_lit «;» - SyntaxBody : •EpsilonSymbol «;» - SyntaxBody : •Symbols «|» - SyntaxBody : •Symbols g_sdt_lit «|» - SyntaxBody : •ErrorSymbol «|» - SyntaxBody : •ErrorSymbol Symbols «|» - SyntaxBody : •ErrorSymbol Symbols g_sdt_lit «|» - SyntaxBody : •ErrorSymbol g_sdt_lit «|» - SyntaxBody : •EpsilonSymbol «|» - Symbols : •Symbol «;» - Symbols : •Symbols Symbol «;» - Symbols : •Symbol «g_sdt_lit» - Symbols : •Symbols Symbol «g_sdt_lit» - ErrorSymbol : •error «;» - ErrorSymbol : •λ «;» - ErrorSymbol : •error «prodId» - ErrorSymbol : •error «string_lit» - ErrorSymbol : •error «tokId» - ErrorSymbol : •λ «prodId» - ErrorSymbol : •λ «string_lit» - ErrorSymbol : •λ «tokId» - ErrorSymbol : •error «g_sdt_lit» - ErrorSymbol : •λ «g_sdt_lit» - EpsilonSymbol : •empty «;» - EpsilonSymbol : •ε «;» - Symbols : •Symbol «|» - Symbols : •Symbols Symbol «|» - ErrorSymbol : •error «|» - ErrorSymbol : •λ «|» - EpsilonSymbol : •empty «|» - EpsilonSymbol : •ε «|» - Symbol : •prodId «;» - Symbol : •tokId «;» - Symbol : •string_lit «;» - Symbols : •Symbol «prodId» - Symbols : •Symbol «string_lit» - Symbols : •Symbol «tokId» - Symbols : •Symbols Symbol «prodId» - Symbols : •Symbols Symbol «string_lit» - Symbols : •Symbols Symbol «tokId» + Alternatives : Π Λ<|> •Π «";"» + Alternatives : Π Λ<|> •Π «"|"» + SyntaxBody : •Π «";"» + SyntaxBody : •Π g_sdt_lit «";"» + SyntaxBody : •Π «";"» + SyntaxBody : •Π Π «";"» + SyntaxBody : •Π Π g_sdt_lit «";"» + SyntaxBody : •Π g_sdt_lit «";"» + SyntaxBody : •Π «";"» + SyntaxBody : •Π «"|"» + SyntaxBody : •Π g_sdt_lit «"|"» + SyntaxBody : •Π «"|"» + SyntaxBody : •Π Π «"|"» + SyntaxBody : •Π Π g_sdt_lit «"|"» + SyntaxBody : •Π g_sdt_lit «"|"» + SyntaxBody : •Π «"|"» + Symbols : •Π «";"» + Symbols : •Π Π «";"» + Symbols : •Π «g_sdt_lit» + Symbols : •Π Π «g_sdt_lit» + ErrorSymbol : •Λ «";"» + ErrorSymbol : •Λ<λ> «";"» + ErrorSymbol : •Λ «prodId» + ErrorSymbol : •Λ «string_lit» + ErrorSymbol : •Λ «tokId» + ErrorSymbol : •Λ<λ> «prodId» + ErrorSymbol : •Λ<λ> «string_lit» + ErrorSymbol : •Λ<λ> «tokId» + ErrorSymbol : •Λ «g_sdt_lit» + ErrorSymbol : •Λ<λ> «g_sdt_lit» + EpsilonSymbol : •Λ «";"» + EpsilonSymbol : •Λ<ε> «";"» + Symbols : •Π «"|"» + Symbols : •Π Π «"|"» + ErrorSymbol : •Λ «"|"» + ErrorSymbol : •Λ<λ> «"|"» + EpsilonSymbol : •Λ «"|"» + EpsilonSymbol : •Λ<ε> «"|"» + Symbol : •prodId «";"» + Symbol : •tokId «";"» + Symbol : •string_lit «";"» + Symbols : •Π «prodId» + Symbols : •Π «string_lit» + Symbols : •Π «tokId» + Symbols : •Π Π «prodId» + Symbols : •Π Π «string_lit» + Symbols : •Π Π «tokId» Symbol : •prodId «g_sdt_lit» Symbol : •tokId «g_sdt_lit» Symbol : •string_lit «g_sdt_lit» - Symbol : •prodId «|» - Symbol : •tokId «|» - Symbol : •string_lit «|» + Symbol : •prodId «"|"» + Symbol : •tokId «"|"» + Symbol : •string_lit «"|"» Symbol : •prodId «prodId» Symbol : •tokId «prodId» Symbol : •string_lit «prodId» @@ -3596,58 +3596,58 @@ S86{ Symbol : •string_lit «tokId» } Transitions: - Symbols -> 36 - Symbol -> 37 - ErrorSymbol -> 38 - EpsilonSymbol -> 39 + Π -> 36 + Π -> 37 + Π -> 38 + Π -> 39 tokId -> 40 prodId -> 41 string_lit -> 42 - error -> 43 - λ -> 44 - empty -> 45 - ε -> 46 - SyntaxBody -> 121 + Λ -> 43 + Λ<λ> -> 44 + Λ -> 45 + Λ<ε> -> 46 + Π -> 121 S87{ - Symbols : Symbols Symbol• «;» - Symbols : Symbols Symbol• «g_sdt_lit» - Symbols : Symbols Symbol• «prodId» - Symbols : Symbols Symbol• «string_lit» - Symbols : Symbols Symbol• «tokId» - Symbols : Symbols Symbol• «|» + Symbols : Π Π• «";"» + Symbols : Π Π• «g_sdt_lit» + Symbols : Π Π• «prodId» + Symbols : Π Π• «string_lit» + Symbols : Π Π• «tokId» + Symbols : Π Π• «"|"» } Transitions: S88{ - SyntaxBody : Symbols g_sdt_lit• «;» - SyntaxBody : Symbols g_sdt_lit• «|» + SyntaxBody : Π g_sdt_lit• «";"» + SyntaxBody : Π g_sdt_lit• «"|"» } Transitions: S89{ - SyntaxBody : ErrorSymbol Symbols• «;» - SyntaxBody : ErrorSymbol Symbols •g_sdt_lit «;» - SyntaxBody : ErrorSymbol Symbols• «|» - SyntaxBody : ErrorSymbol Symbols •g_sdt_lit «|» - Symbols : Symbols •Symbol «;» - Symbols : Symbols •Symbol «g_sdt_lit» - Symbols : Symbols •Symbol «|» - Symbols : Symbols •Symbol «prodId» - Symbols : Symbols •Symbol «string_lit» - Symbols : Symbols •Symbol «tokId» - Symbol : •prodId «;» - Symbol : •tokId «;» - Symbol : •string_lit «;» + SyntaxBody : Π Π• «";"» + SyntaxBody : Π Π •g_sdt_lit «";"» + SyntaxBody : Π Π• «"|"» + SyntaxBody : Π Π •g_sdt_lit «"|"» + Symbols : Π •Π «";"» + Symbols : Π •Π «g_sdt_lit» + Symbols : Π •Π «"|"» + Symbols : Π •Π «prodId» + Symbols : Π •Π «string_lit» + Symbols : Π •Π «tokId» + Symbol : •prodId «";"» + Symbol : •tokId «";"» + Symbol : •string_lit «";"» Symbol : •prodId «g_sdt_lit» Symbol : •tokId «g_sdt_lit» Symbol : •string_lit «g_sdt_lit» - Symbol : •prodId «|» - Symbol : •tokId «|» - Symbol : •string_lit «|» + Symbol : •prodId «"|"» + Symbol : •tokId «"|"» + Symbol : •string_lit «"|"» Symbol : •prodId «prodId» Symbol : •tokId «prodId» Symbol : •string_lit «prodId» @@ -3662,1588 +3662,1588 @@ Transitions: tokId -> 40 prodId -> 41 string_lit -> 42 - Symbol -> 87 + Π -> 87 g_sdt_lit -> 122 S90{ - SyntaxBody : ErrorSymbol g_sdt_lit• «;» - SyntaxBody : ErrorSymbol g_sdt_lit• «|» + SyntaxBody : Π g_sdt_lit• «";"» + SyntaxBody : Π g_sdt_lit• «"|"» } Transitions: S91{ - LexPattern : LexPattern | LexAlt• «;» - LexPattern : LexPattern | LexAlt• «|» - LexAlt : LexAlt •LexTerm «;» - LexAlt : LexAlt •LexTerm «|» - LexAlt : LexAlt •LexTerm «(» - LexAlt : LexAlt •LexTerm «.» - LexAlt : LexAlt •LexTerm «[» - LexAlt : LexAlt •LexTerm «char_lit» - LexAlt : LexAlt •LexTerm «regDefId» - LexAlt : LexAlt •LexTerm «{» - LexAlt : LexAlt •LexTerm «~» - LexTerm : •. «;» - LexTerm : •char_lit «;» - LexTerm : •char_lit - char_lit «;» - LexTerm : •~ char_lit «;» - LexTerm : •~ ( char_lit - char_lit ) «;» - LexTerm : •regDefId «;» - LexTerm : •[ LexPattern ] «;» - LexTerm : •{ LexPattern } «;» - LexTerm : •( LexPattern ) «;» - LexTerm : •. «|» - LexTerm : •char_lit «|» - LexTerm : •char_lit - char_lit «|» - LexTerm : •~ char_lit «|» - LexTerm : •~ ( char_lit - char_lit ) «|» - LexTerm : •regDefId «|» - LexTerm : •[ LexPattern ] «|» - LexTerm : •{ LexPattern } «|» - LexTerm : •( LexPattern ) «|» - LexTerm : •. «(» - LexTerm : •char_lit «(» - LexTerm : •char_lit - char_lit «(» - LexTerm : •~ char_lit «(» - LexTerm : •~ ( char_lit - char_lit ) «(» - LexTerm : •regDefId «(» - LexTerm : •[ LexPattern ] «(» - LexTerm : •{ LexPattern } «(» - LexTerm : •( LexPattern ) «(» - LexTerm : •. «.» - LexTerm : •char_lit «.» - LexTerm : •char_lit - char_lit «.» - LexTerm : •~ char_lit «.» - LexTerm : •~ ( char_lit - char_lit ) «.» - LexTerm : •regDefId «.» - LexTerm : •[ LexPattern ] «.» - LexTerm : •{ LexPattern } «.» - LexTerm : •( LexPattern ) «.» - LexTerm : •. «[» - LexTerm : •char_lit «[» - LexTerm : •char_lit - char_lit «[» - LexTerm : •~ char_lit «[» - LexTerm : •~ ( char_lit - char_lit ) «[» - LexTerm : •regDefId «[» - LexTerm : •[ LexPattern ] «[» - LexTerm : •{ LexPattern } «[» - LexTerm : •( LexPattern ) «[» - LexTerm : •. «char_lit» + LexPattern : Π Λ<|> Π• «";"» + LexPattern : Π Λ<|> Π• «"|"» + LexAlt : Π •Π «";"» + LexAlt : Π •Π «"|"» + LexAlt : Π •Π «"("» + LexAlt : Π •Π «"."» + LexAlt : Π •Π «"["» + LexAlt : Π •Π «char_lit» + LexAlt : Π •Π «regDefId» + LexAlt : Π •Π «"{"» + LexAlt : Π •Π «"~"» + LexTerm : •Λ<.> «";"» + LexTerm : •char_lit «";"» + LexTerm : •char_lit Λ<-> char_lit «";"» + LexTerm : •Λ<~> char_lit «";"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «";"» + LexTerm : •regDefId «";"» + LexTerm : •Λ<[> Π Λ<]> «";"» + LexTerm : •Λ<{> Π Λ<}> «";"» + LexTerm : •Λ<(> Π Λ<)> «";"» + LexTerm : •Λ<.> «"|"» + LexTerm : •char_lit «"|"» + LexTerm : •char_lit Λ<-> char_lit «"|"» + LexTerm : •Λ<~> char_lit «"|"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"|"» + LexTerm : •regDefId «"|"» + LexTerm : •Λ<[> Π Λ<]> «"|"» + LexTerm : •Λ<{> Π Λ<}> «"|"» + LexTerm : •Λ<(> Π Λ<)> «"|"» + LexTerm : •Λ<.> «"("» + LexTerm : •char_lit «"("» + LexTerm : •char_lit Λ<-> char_lit «"("» + LexTerm : •Λ<~> char_lit «"("» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"("» + LexTerm : •regDefId «"("» + LexTerm : •Λ<[> Π Λ<]> «"("» + LexTerm : •Λ<{> Π Λ<}> «"("» + LexTerm : •Λ<(> Π Λ<)> «"("» + LexTerm : •Λ<.> «"."» + LexTerm : •char_lit «"."» + LexTerm : •char_lit Λ<-> char_lit «"."» + LexTerm : •Λ<~> char_lit «"."» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"."» + LexTerm : •regDefId «"."» + LexTerm : •Λ<[> Π Λ<]> «"."» + LexTerm : •Λ<{> Π Λ<}> «"."» + LexTerm : •Λ<(> Π Λ<)> «"."» + LexTerm : •Λ<.> «"["» + LexTerm : •char_lit «"["» + LexTerm : •char_lit Λ<-> char_lit «"["» + LexTerm : •Λ<~> char_lit «"["» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"["» + LexTerm : •regDefId «"["» + LexTerm : •Λ<[> Π Λ<]> «"["» + LexTerm : •Λ<{> Π Λ<}> «"["» + LexTerm : •Λ<(> Π Λ<)> «"["» + LexTerm : •Λ<.> «char_lit» LexTerm : •char_lit «char_lit» - LexTerm : •char_lit - char_lit «char_lit» - LexTerm : •~ char_lit «char_lit» - LexTerm : •~ ( char_lit - char_lit ) «char_lit» + LexTerm : •char_lit Λ<-> char_lit «char_lit» + LexTerm : •Λ<~> char_lit «char_lit» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «char_lit» LexTerm : •regDefId «char_lit» - LexTerm : •[ LexPattern ] «char_lit» - LexTerm : •{ LexPattern } «char_lit» - LexTerm : •( LexPattern ) «char_lit» - LexTerm : •. «regDefId» + LexTerm : •Λ<[> Π Λ<]> «char_lit» + LexTerm : •Λ<{> Π Λ<}> «char_lit» + LexTerm : •Λ<(> Π Λ<)> «char_lit» + LexTerm : •Λ<.> «regDefId» LexTerm : •char_lit «regDefId» - LexTerm : •char_lit - char_lit «regDefId» - LexTerm : •~ char_lit «regDefId» - LexTerm : •~ ( char_lit - char_lit ) «regDefId» + LexTerm : •char_lit Λ<-> char_lit «regDefId» + LexTerm : •Λ<~> char_lit «regDefId» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «regDefId» LexTerm : •regDefId «regDefId» - LexTerm : •[ LexPattern ] «regDefId» - LexTerm : •{ LexPattern } «regDefId» - LexTerm : •( LexPattern ) «regDefId» - LexTerm : •. «{» - LexTerm : •char_lit «{» - LexTerm : •char_lit - char_lit «{» - LexTerm : •~ char_lit «{» - LexTerm : •~ ( char_lit - char_lit ) «{» - LexTerm : •regDefId «{» - LexTerm : •[ LexPattern ] «{» - LexTerm : •{ LexPattern } «{» - LexTerm : •( LexPattern ) «{» - LexTerm : •. «~» - LexTerm : •char_lit «~» - LexTerm : •char_lit - char_lit «~» - LexTerm : •~ char_lit «~» - LexTerm : •~ ( char_lit - char_lit ) «~» - LexTerm : •regDefId «~» - LexTerm : •[ LexPattern ] «~» - LexTerm : •{ LexPattern } «~» - LexTerm : •( LexPattern ) «~» + LexTerm : •Λ<[> Π Λ<]> «regDefId» + LexTerm : •Λ<{> Π Λ<}> «regDefId» + LexTerm : •Λ<(> Π Λ<)> «regDefId» + LexTerm : •Λ<.> «"{"» + LexTerm : •char_lit «"{"» + LexTerm : •char_lit Λ<-> char_lit «"{"» + LexTerm : •Λ<~> char_lit «"{"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"{"» + LexTerm : •regDefId «"{"» + LexTerm : •Λ<[> Π Λ<]> «"{"» + LexTerm : •Λ<{> Π Λ<}> «"{"» + LexTerm : •Λ<(> Π Λ<)> «"{"» + LexTerm : •Λ<.> «"~"» + LexTerm : •char_lit «"~"» + LexTerm : •char_lit Λ<-> char_lit «"~"» + LexTerm : •Λ<~> char_lit «"~"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"~"» + LexTerm : •regDefId «"~"» + LexTerm : •Λ<[> Π Λ<]> «"~"» + LexTerm : •Λ<{> Π Λ<}> «"~"» + LexTerm : •Λ<(> Π Λ<)> «"~"» } Transitions: regDefId -> 25 - . -> 26 + Λ<.> -> 26 char_lit -> 27 - ~ -> 28 - ( -> 29 - [ -> 30 - { -> 31 - LexTerm -> 49 + Λ<~> -> 28 + Λ<(> -> 29 + Λ<[> -> 30 + Λ<{> -> 31 + Π -> 49 S92{ - LexTerm : char_lit - char_lit• «;» - LexTerm : char_lit - char_lit• «(» - LexTerm : char_lit - char_lit• «.» - LexTerm : char_lit - char_lit• «[» - LexTerm : char_lit - char_lit• «char_lit» - LexTerm : char_lit - char_lit• «regDefId» - LexTerm : char_lit - char_lit• «{» - LexTerm : char_lit - char_lit• «~» - LexTerm : char_lit - char_lit• «|» + LexTerm : char_lit Λ<-> char_lit• «";"» + LexTerm : char_lit Λ<-> char_lit• «"("» + LexTerm : char_lit Λ<-> char_lit• «"."» + LexTerm : char_lit Λ<-> char_lit• «"["» + LexTerm : char_lit Λ<-> char_lit• «char_lit» + LexTerm : char_lit Λ<-> char_lit• «regDefId» + LexTerm : char_lit Λ<-> char_lit• «"{"» + LexTerm : char_lit Λ<-> char_lit• «"~"» + LexTerm : char_lit Λ<-> char_lit• «"|"» } Transitions: S93{ - LexTerm : ~ ( char_lit •- char_lit ) «;» - LexTerm : ~ ( char_lit •- char_lit ) «(» - LexTerm : ~ ( char_lit •- char_lit ) «.» - LexTerm : ~ ( char_lit •- char_lit ) «[» - LexTerm : ~ ( char_lit •- char_lit ) «char_lit» - LexTerm : ~ ( char_lit •- char_lit ) «regDefId» - LexTerm : ~ ( char_lit •- char_lit ) «{» - LexTerm : ~ ( char_lit •- char_lit ) «~» - LexTerm : ~ ( char_lit •- char_lit ) «|» + LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «";"» + LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «"("» + LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «"."» + LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «"["» + LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «char_lit» + LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «regDefId» + LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «"{"» + LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «"~"» + LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «"|"» } Transitions: - - -> 123 + Λ<-> -> 123 S94{ - LexPattern : LexPattern | •LexAlt «)» - LexPattern : LexPattern | •LexAlt «|» - LexAlt : •LexTerm «)» - LexAlt : •LexAlt LexTerm «)» - LexAlt : •LexTerm «|» - LexAlt : •LexAlt LexTerm «|» - LexTerm : •. «)» - LexTerm : •char_lit «)» - LexTerm : •char_lit - char_lit «)» - LexTerm : •~ char_lit «)» - LexTerm : •~ ( char_lit - char_lit ) «)» - LexTerm : •regDefId «)» - LexTerm : •[ LexPattern ] «)» - LexTerm : •{ LexPattern } «)» - LexTerm : •( LexPattern ) «)» - LexAlt : •LexTerm «(» - LexAlt : •LexTerm «.» - LexAlt : •LexTerm «[» - LexAlt : •LexTerm «char_lit» - LexAlt : •LexTerm «regDefId» - LexAlt : •LexTerm «{» - LexAlt : •LexTerm «~» - LexAlt : •LexAlt LexTerm «(» - LexAlt : •LexAlt LexTerm «.» - LexAlt : •LexAlt LexTerm «[» - LexAlt : •LexAlt LexTerm «char_lit» - LexAlt : •LexAlt LexTerm «regDefId» - LexAlt : •LexAlt LexTerm «{» - LexAlt : •LexAlt LexTerm «~» - LexTerm : •. «|» - LexTerm : •char_lit «|» - LexTerm : •char_lit - char_lit «|» - LexTerm : •~ char_lit «|» - LexTerm : •~ ( char_lit - char_lit ) «|» - LexTerm : •regDefId «|» - LexTerm : •[ LexPattern ] «|» - LexTerm : •{ LexPattern } «|» - LexTerm : •( LexPattern ) «|» - LexTerm : •. «(» - LexTerm : •char_lit «(» - LexTerm : •char_lit - char_lit «(» - LexTerm : •~ char_lit «(» - LexTerm : •~ ( char_lit - char_lit ) «(» - LexTerm : •regDefId «(» - LexTerm : •[ LexPattern ] «(» - LexTerm : •{ LexPattern } «(» - LexTerm : •( LexPattern ) «(» - LexTerm : •. «.» - LexTerm : •char_lit «.» - LexTerm : •char_lit - char_lit «.» - LexTerm : •~ char_lit «.» - LexTerm : •~ ( char_lit - char_lit ) «.» - LexTerm : •regDefId «.» - LexTerm : •[ LexPattern ] «.» - LexTerm : •{ LexPattern } «.» - LexTerm : •( LexPattern ) «.» - LexTerm : •. «[» - LexTerm : •char_lit «[» - LexTerm : •char_lit - char_lit «[» - LexTerm : •~ char_lit «[» - LexTerm : •~ ( char_lit - char_lit ) «[» - LexTerm : •regDefId «[» - LexTerm : •[ LexPattern ] «[» - LexTerm : •{ LexPattern } «[» - LexTerm : •( LexPattern ) «[» - LexTerm : •. «char_lit» + LexPattern : Π Λ<|> •Π «")"» + LexPattern : Π Λ<|> •Π «"|"» + LexAlt : •Π «")"» + LexAlt : •Π Π «")"» + LexAlt : •Π «"|"» + LexAlt : •Π Π «"|"» + LexTerm : •Λ<.> «")"» + LexTerm : •char_lit «")"» + LexTerm : •char_lit Λ<-> char_lit «")"» + LexTerm : •Λ<~> char_lit «")"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «")"» + LexTerm : •regDefId «")"» + LexTerm : •Λ<[> Π Λ<]> «")"» + LexTerm : •Λ<{> Π Λ<}> «")"» + LexTerm : •Λ<(> Π Λ<)> «")"» + LexAlt : •Π «"("» + LexAlt : •Π «"."» + LexAlt : •Π «"["» + LexAlt : •Π «char_lit» + LexAlt : •Π «regDefId» + LexAlt : •Π «"{"» + LexAlt : •Π «"~"» + LexAlt : •Π Π «"("» + LexAlt : •Π Π «"."» + LexAlt : •Π Π «"["» + LexAlt : •Π Π «char_lit» + LexAlt : •Π Π «regDefId» + LexAlt : •Π Π «"{"» + LexAlt : •Π Π «"~"» + LexTerm : •Λ<.> «"|"» + LexTerm : •char_lit «"|"» + LexTerm : •char_lit Λ<-> char_lit «"|"» + LexTerm : •Λ<~> char_lit «"|"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"|"» + LexTerm : •regDefId «"|"» + LexTerm : •Λ<[> Π Λ<]> «"|"» + LexTerm : •Λ<{> Π Λ<}> «"|"» + LexTerm : •Λ<(> Π Λ<)> «"|"» + LexTerm : •Λ<.> «"("» + LexTerm : •char_lit «"("» + LexTerm : •char_lit Λ<-> char_lit «"("» + LexTerm : •Λ<~> char_lit «"("» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"("» + LexTerm : •regDefId «"("» + LexTerm : •Λ<[> Π Λ<]> «"("» + LexTerm : •Λ<{> Π Λ<}> «"("» + LexTerm : •Λ<(> Π Λ<)> «"("» + LexTerm : •Λ<.> «"."» + LexTerm : •char_lit «"."» + LexTerm : •char_lit Λ<-> char_lit «"."» + LexTerm : •Λ<~> char_lit «"."» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"."» + LexTerm : •regDefId «"."» + LexTerm : •Λ<[> Π Λ<]> «"."» + LexTerm : •Λ<{> Π Λ<}> «"."» + LexTerm : •Λ<(> Π Λ<)> «"."» + LexTerm : •Λ<.> «"["» + LexTerm : •char_lit «"["» + LexTerm : •char_lit Λ<-> char_lit «"["» + LexTerm : •Λ<~> char_lit «"["» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"["» + LexTerm : •regDefId «"["» + LexTerm : •Λ<[> Π Λ<]> «"["» + LexTerm : •Λ<{> Π Λ<}> «"["» + LexTerm : •Λ<(> Π Λ<)> «"["» + LexTerm : •Λ<.> «char_lit» LexTerm : •char_lit «char_lit» - LexTerm : •char_lit - char_lit «char_lit» - LexTerm : •~ char_lit «char_lit» - LexTerm : •~ ( char_lit - char_lit ) «char_lit» + LexTerm : •char_lit Λ<-> char_lit «char_lit» + LexTerm : •Λ<~> char_lit «char_lit» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «char_lit» LexTerm : •regDefId «char_lit» - LexTerm : •[ LexPattern ] «char_lit» - LexTerm : •{ LexPattern } «char_lit» - LexTerm : •( LexPattern ) «char_lit» - LexTerm : •. «regDefId» + LexTerm : •Λ<[> Π Λ<]> «char_lit» + LexTerm : •Λ<{> Π Λ<}> «char_lit» + LexTerm : •Λ<(> Π Λ<)> «char_lit» + LexTerm : •Λ<.> «regDefId» LexTerm : •char_lit «regDefId» - LexTerm : •char_lit - char_lit «regDefId» - LexTerm : •~ char_lit «regDefId» - LexTerm : •~ ( char_lit - char_lit ) «regDefId» + LexTerm : •char_lit Λ<-> char_lit «regDefId» + LexTerm : •Λ<~> char_lit «regDefId» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «regDefId» LexTerm : •regDefId «regDefId» - LexTerm : •[ LexPattern ] «regDefId» - LexTerm : •{ LexPattern } «regDefId» - LexTerm : •( LexPattern ) «regDefId» - LexTerm : •. «{» - LexTerm : •char_lit «{» - LexTerm : •char_lit - char_lit «{» - LexTerm : •~ char_lit «{» - LexTerm : •~ ( char_lit - char_lit ) «{» - LexTerm : •regDefId «{» - LexTerm : •[ LexPattern ] «{» - LexTerm : •{ LexPattern } «{» - LexTerm : •( LexPattern ) «{» - LexTerm : •. «~» - LexTerm : •char_lit «~» - LexTerm : •char_lit - char_lit «~» - LexTerm : •~ char_lit «~» - LexTerm : •~ ( char_lit - char_lit ) «~» - LexTerm : •regDefId «~» - LexTerm : •[ LexPattern ] «~» - LexTerm : •{ LexPattern } «~» - LexTerm : •( LexPattern ) «~» -} -Transitions: - LexTerm -> 55 + LexTerm : •Λ<[> Π Λ<]> «regDefId» + LexTerm : •Λ<{> Π Λ<}> «regDefId» + LexTerm : •Λ<(> Π Λ<)> «regDefId» + LexTerm : •Λ<.> «"{"» + LexTerm : •char_lit «"{"» + LexTerm : •char_lit Λ<-> char_lit «"{"» + LexTerm : •Λ<~> char_lit «"{"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"{"» + LexTerm : •regDefId «"{"» + LexTerm : •Λ<[> Π Λ<]> «"{"» + LexTerm : •Λ<{> Π Λ<}> «"{"» + LexTerm : •Λ<(> Π Λ<)> «"{"» + LexTerm : •Λ<.> «"~"» + LexTerm : •char_lit «"~"» + LexTerm : •char_lit Λ<-> char_lit «"~"» + LexTerm : •Λ<~> char_lit «"~"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"~"» + LexTerm : •regDefId «"~"» + LexTerm : •Λ<[> Π Λ<]> «"~"» + LexTerm : •Λ<{> Π Λ<}> «"~"» + LexTerm : •Λ<(> Π Λ<)> «"~"» +} +Transitions: + Π -> 55 regDefId -> 56 - . -> 57 + Λ<.> -> 57 char_lit -> 58 - ~ -> 59 - ( -> 60 - [ -> 61 - { -> 62 - LexAlt -> 124 + Λ<~> -> 59 + Λ<(> -> 60 + Λ<[> -> 61 + Λ<{> -> 62 + Π -> 124 S95{ - LexTerm : ( LexPattern )• «;» - LexTerm : ( LexPattern )• «(» - LexTerm : ( LexPattern )• «.» - LexTerm : ( LexPattern )• «[» - LexTerm : ( LexPattern )• «char_lit» - LexTerm : ( LexPattern )• «regDefId» - LexTerm : ( LexPattern )• «{» - LexTerm : ( LexPattern )• «~» - LexTerm : ( LexPattern )• «|» + LexTerm : Λ<(> Π Λ<)>• «";"» + LexTerm : Λ<(> Π Λ<)>• «"("» + LexTerm : Λ<(> Π Λ<)>• «"."» + LexTerm : Λ<(> Π Λ<)>• «"["» + LexTerm : Λ<(> Π Λ<)>• «char_lit» + LexTerm : Λ<(> Π Λ<)>• «regDefId» + LexTerm : Λ<(> Π Λ<)>• «"{"» + LexTerm : Λ<(> Π Λ<)>• «"~"» + LexTerm : Λ<(> Π Λ<)>• «"|"» } Transitions: S96{ - LexAlt : LexAlt LexTerm• «)» - LexAlt : LexAlt LexTerm• «(» - LexAlt : LexAlt LexTerm• «.» - LexAlt : LexAlt LexTerm• «[» - LexAlt : LexAlt LexTerm• «char_lit» - LexAlt : LexAlt LexTerm• «regDefId» - LexAlt : LexAlt LexTerm• «{» - LexAlt : LexAlt LexTerm• «~» - LexAlt : LexAlt LexTerm• «|» + LexAlt : Π Π• «")"» + LexAlt : Π Π• «"("» + LexAlt : Π Π• «"."» + LexAlt : Π Π• «"["» + LexAlt : Π Π• «char_lit» + LexAlt : Π Π• «regDefId» + LexAlt : Π Π• «"{"» + LexAlt : Π Π• «"~"» + LexAlt : Π Π• «"|"» } Transitions: S97{ - LexTerm : char_lit - •char_lit «)» - LexTerm : char_lit - •char_lit «(» - LexTerm : char_lit - •char_lit «.» - LexTerm : char_lit - •char_lit «[» - LexTerm : char_lit - •char_lit «char_lit» - LexTerm : char_lit - •char_lit «regDefId» - LexTerm : char_lit - •char_lit «{» - LexTerm : char_lit - •char_lit «~» - LexTerm : char_lit - •char_lit «|» + LexTerm : char_lit Λ<-> •char_lit «")"» + LexTerm : char_lit Λ<-> •char_lit «"("» + LexTerm : char_lit Λ<-> •char_lit «"."» + LexTerm : char_lit Λ<-> •char_lit «"["» + LexTerm : char_lit Λ<-> •char_lit «char_lit» + LexTerm : char_lit Λ<-> •char_lit «regDefId» + LexTerm : char_lit Λ<-> •char_lit «"{"» + LexTerm : char_lit Λ<-> •char_lit «"~"» + LexTerm : char_lit Λ<-> •char_lit «"|"» } Transitions: char_lit -> 125 S98{ - LexTerm : ~ char_lit• «)» - LexTerm : ~ char_lit• «(» - LexTerm : ~ char_lit• «.» - LexTerm : ~ char_lit• «[» - LexTerm : ~ char_lit• «char_lit» - LexTerm : ~ char_lit• «regDefId» - LexTerm : ~ char_lit• «{» - LexTerm : ~ char_lit• «~» - LexTerm : ~ char_lit• «|» + LexTerm : Λ<~> char_lit• «")"» + LexTerm : Λ<~> char_lit• «"("» + LexTerm : Λ<~> char_lit• «"."» + LexTerm : Λ<~> char_lit• «"["» + LexTerm : Λ<~> char_lit• «char_lit» + LexTerm : Λ<~> char_lit• «regDefId» + LexTerm : Λ<~> char_lit• «"{"» + LexTerm : Λ<~> char_lit• «"~"» + LexTerm : Λ<~> char_lit• «"|"» } Transitions: S99{ - LexTerm : ~ ( •char_lit - char_lit ) «)» - LexTerm : ~ ( •char_lit - char_lit ) «(» - LexTerm : ~ ( •char_lit - char_lit ) «.» - LexTerm : ~ ( •char_lit - char_lit ) «[» - LexTerm : ~ ( •char_lit - char_lit ) «char_lit» - LexTerm : ~ ( •char_lit - char_lit ) «regDefId» - LexTerm : ~ ( •char_lit - char_lit ) «{» - LexTerm : ~ ( •char_lit - char_lit ) «~» - LexTerm : ~ ( •char_lit - char_lit ) «|» + LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «")"» + LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «"("» + LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «"."» + LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «"["» + LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «char_lit» + LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «regDefId» + LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «"{"» + LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «"~"» + LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «"|"» } Transitions: char_lit -> 126 S100{ - LexTerm : ( LexPattern •) «)» - LexTerm : ( LexPattern •) «(» - LexTerm : ( LexPattern •) «.» - LexTerm : ( LexPattern •) «[» - LexTerm : ( LexPattern •) «char_lit» - LexTerm : ( LexPattern •) «regDefId» - LexTerm : ( LexPattern •) «{» - LexTerm : ( LexPattern •) «~» - LexTerm : ( LexPattern •) «|» - LexPattern : LexPattern •| LexAlt «)» - LexPattern : LexPattern •| LexAlt «|» + LexTerm : Λ<(> Π •Λ<)> «")"» + LexTerm : Λ<(> Π •Λ<)> «"("» + LexTerm : Λ<(> Π •Λ<)> «"."» + LexTerm : Λ<(> Π •Λ<)> «"["» + LexTerm : Λ<(> Π •Λ<)> «char_lit» + LexTerm : Λ<(> Π •Λ<)> «regDefId» + LexTerm : Λ<(> Π •Λ<)> «"{"» + LexTerm : Λ<(> Π •Λ<)> «"~"» + LexTerm : Λ<(> Π •Λ<)> «"|"» + LexPattern : Π •Λ<|> Π «")"» + LexPattern : Π •Λ<|> Π «"|"» } Transitions: - | -> 94 - ) -> 127 + Λ<|> -> 94 + Λ<)> -> 127 S101{ - LexTerm : [ LexPattern •] «)» - LexTerm : [ LexPattern •] «(» - LexTerm : [ LexPattern •] «.» - LexTerm : [ LexPattern •] «[» - LexTerm : [ LexPattern •] «char_lit» - LexTerm : [ LexPattern •] «regDefId» - LexTerm : [ LexPattern •] «{» - LexTerm : [ LexPattern •] «~» - LexTerm : [ LexPattern •] «|» - LexPattern : LexPattern •| LexAlt «]» - LexPattern : LexPattern •| LexAlt «|» + LexTerm : Λ<[> Π •Λ<]> «")"» + LexTerm : Λ<[> Π •Λ<]> «"("» + LexTerm : Λ<[> Π •Λ<]> «"."» + LexTerm : Λ<[> Π •Λ<]> «"["» + LexTerm : Λ<[> Π •Λ<]> «char_lit» + LexTerm : Λ<[> Π •Λ<]> «regDefId» + LexTerm : Λ<[> Π •Λ<]> «"{"» + LexTerm : Λ<[> Π •Λ<]> «"~"» + LexTerm : Λ<[> Π •Λ<]> «"|"» + LexPattern : Π •Λ<|> Π «"]"» + LexPattern : Π •Λ<|> Π «"|"» } Transitions: - | -> 103 - ] -> 128 + Λ<|> -> 103 + Λ<]> -> 128 S102{ - LexTerm : { LexPattern •} «)» - LexTerm : { LexPattern •} «(» - LexTerm : { LexPattern •} «.» - LexTerm : { LexPattern •} «[» - LexTerm : { LexPattern •} «char_lit» - LexTerm : { LexPattern •} «regDefId» - LexTerm : { LexPattern •} «{» - LexTerm : { LexPattern •} «~» - LexTerm : { LexPattern •} «|» - LexPattern : LexPattern •| LexAlt «}» - LexPattern : LexPattern •| LexAlt «|» + LexTerm : Λ<{> Π •Λ<}> «")"» + LexTerm : Λ<{> Π •Λ<}> «"("» + LexTerm : Λ<{> Π •Λ<}> «"."» + LexTerm : Λ<{> Π •Λ<}> «"["» + LexTerm : Λ<{> Π •Λ<}> «char_lit» + LexTerm : Λ<{> Π •Λ<}> «regDefId» + LexTerm : Λ<{> Π •Λ<}> «"{"» + LexTerm : Λ<{> Π •Λ<}> «"~"» + LexTerm : Λ<{> Π •Λ<}> «"|"» + LexPattern : Π •Λ<|> Π «"}"» + LexPattern : Π •Λ<|> Π «"|"» } Transitions: - | -> 112 - } -> 129 + Λ<|> -> 112 + Λ<}> -> 129 S103{ - LexPattern : LexPattern | •LexAlt «]» - LexPattern : LexPattern | •LexAlt «|» - LexAlt : •LexTerm «]» - LexAlt : •LexAlt LexTerm «]» - LexAlt : •LexTerm «|» - LexAlt : •LexAlt LexTerm «|» - LexTerm : •. «]» - LexTerm : •char_lit «]» - LexTerm : •char_lit - char_lit «]» - LexTerm : •~ char_lit «]» - LexTerm : •~ ( char_lit - char_lit ) «]» - LexTerm : •regDefId «]» - LexTerm : •[ LexPattern ] «]» - LexTerm : •{ LexPattern } «]» - LexTerm : •( LexPattern ) «]» - LexAlt : •LexTerm «(» - LexAlt : •LexTerm «.» - LexAlt : •LexTerm «[» - LexAlt : •LexTerm «char_lit» - LexAlt : •LexTerm «regDefId» - LexAlt : •LexTerm «{» - LexAlt : •LexTerm «~» - LexAlt : •LexAlt LexTerm «(» - LexAlt : •LexAlt LexTerm «.» - LexAlt : •LexAlt LexTerm «[» - LexAlt : •LexAlt LexTerm «char_lit» - LexAlt : •LexAlt LexTerm «regDefId» - LexAlt : •LexAlt LexTerm «{» - LexAlt : •LexAlt LexTerm «~» - LexTerm : •. «|» - LexTerm : •char_lit «|» - LexTerm : •char_lit - char_lit «|» - LexTerm : •~ char_lit «|» - LexTerm : •~ ( char_lit - char_lit ) «|» - LexTerm : •regDefId «|» - LexTerm : •[ LexPattern ] «|» - LexTerm : •{ LexPattern } «|» - LexTerm : •( LexPattern ) «|» - LexTerm : •. «(» - LexTerm : •char_lit «(» - LexTerm : •char_lit - char_lit «(» - LexTerm : •~ char_lit «(» - LexTerm : •~ ( char_lit - char_lit ) «(» - LexTerm : •regDefId «(» - LexTerm : •[ LexPattern ] «(» - LexTerm : •{ LexPattern } «(» - LexTerm : •( LexPattern ) «(» - LexTerm : •. «.» - LexTerm : •char_lit «.» - LexTerm : •char_lit - char_lit «.» - LexTerm : •~ char_lit «.» - LexTerm : •~ ( char_lit - char_lit ) «.» - LexTerm : •regDefId «.» - LexTerm : •[ LexPattern ] «.» - LexTerm : •{ LexPattern } «.» - LexTerm : •( LexPattern ) «.» - LexTerm : •. «[» - LexTerm : •char_lit «[» - LexTerm : •char_lit - char_lit «[» - LexTerm : •~ char_lit «[» - LexTerm : •~ ( char_lit - char_lit ) «[» - LexTerm : •regDefId «[» - LexTerm : •[ LexPattern ] «[» - LexTerm : •{ LexPattern } «[» - LexTerm : •( LexPattern ) «[» - LexTerm : •. «char_lit» + LexPattern : Π Λ<|> •Π «"]"» + LexPattern : Π Λ<|> •Π «"|"» + LexAlt : •Π «"]"» + LexAlt : •Π Π «"]"» + LexAlt : •Π «"|"» + LexAlt : •Π Π «"|"» + LexTerm : •Λ<.> «"]"» + LexTerm : •char_lit «"]"» + LexTerm : •char_lit Λ<-> char_lit «"]"» + LexTerm : •Λ<~> char_lit «"]"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"]"» + LexTerm : •regDefId «"]"» + LexTerm : •Λ<[> Π Λ<]> «"]"» + LexTerm : •Λ<{> Π Λ<}> «"]"» + LexTerm : •Λ<(> Π Λ<)> «"]"» + LexAlt : •Π «"("» + LexAlt : •Π «"."» + LexAlt : •Π «"["» + LexAlt : •Π «char_lit» + LexAlt : •Π «regDefId» + LexAlt : •Π «"{"» + LexAlt : •Π «"~"» + LexAlt : •Π Π «"("» + LexAlt : •Π Π «"."» + LexAlt : •Π Π «"["» + LexAlt : •Π Π «char_lit» + LexAlt : •Π Π «regDefId» + LexAlt : •Π Π «"{"» + LexAlt : •Π Π «"~"» + LexTerm : •Λ<.> «"|"» + LexTerm : •char_lit «"|"» + LexTerm : •char_lit Λ<-> char_lit «"|"» + LexTerm : •Λ<~> char_lit «"|"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"|"» + LexTerm : •regDefId «"|"» + LexTerm : •Λ<[> Π Λ<]> «"|"» + LexTerm : •Λ<{> Π Λ<}> «"|"» + LexTerm : •Λ<(> Π Λ<)> «"|"» + LexTerm : •Λ<.> «"("» + LexTerm : •char_lit «"("» + LexTerm : •char_lit Λ<-> char_lit «"("» + LexTerm : •Λ<~> char_lit «"("» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"("» + LexTerm : •regDefId «"("» + LexTerm : •Λ<[> Π Λ<]> «"("» + LexTerm : •Λ<{> Π Λ<}> «"("» + LexTerm : •Λ<(> Π Λ<)> «"("» + LexTerm : •Λ<.> «"."» + LexTerm : •char_lit «"."» + LexTerm : •char_lit Λ<-> char_lit «"."» + LexTerm : •Λ<~> char_lit «"."» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"."» + LexTerm : •regDefId «"."» + LexTerm : •Λ<[> Π Λ<]> «"."» + LexTerm : •Λ<{> Π Λ<}> «"."» + LexTerm : •Λ<(> Π Λ<)> «"."» + LexTerm : •Λ<.> «"["» + LexTerm : •char_lit «"["» + LexTerm : •char_lit Λ<-> char_lit «"["» + LexTerm : •Λ<~> char_lit «"["» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"["» + LexTerm : •regDefId «"["» + LexTerm : •Λ<[> Π Λ<]> «"["» + LexTerm : •Λ<{> Π Λ<}> «"["» + LexTerm : •Λ<(> Π Λ<)> «"["» + LexTerm : •Λ<.> «char_lit» LexTerm : •char_lit «char_lit» - LexTerm : •char_lit - char_lit «char_lit» - LexTerm : •~ char_lit «char_lit» - LexTerm : •~ ( char_lit - char_lit ) «char_lit» + LexTerm : •char_lit Λ<-> char_lit «char_lit» + LexTerm : •Λ<~> char_lit «char_lit» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «char_lit» LexTerm : •regDefId «char_lit» - LexTerm : •[ LexPattern ] «char_lit» - LexTerm : •{ LexPattern } «char_lit» - LexTerm : •( LexPattern ) «char_lit» - LexTerm : •. «regDefId» + LexTerm : •Λ<[> Π Λ<]> «char_lit» + LexTerm : •Λ<{> Π Λ<}> «char_lit» + LexTerm : •Λ<(> Π Λ<)> «char_lit» + LexTerm : •Λ<.> «regDefId» LexTerm : •char_lit «regDefId» - LexTerm : •char_lit - char_lit «regDefId» - LexTerm : •~ char_lit «regDefId» - LexTerm : •~ ( char_lit - char_lit ) «regDefId» + LexTerm : •char_lit Λ<-> char_lit «regDefId» + LexTerm : •Λ<~> char_lit «regDefId» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «regDefId» LexTerm : •regDefId «regDefId» - LexTerm : •[ LexPattern ] «regDefId» - LexTerm : •{ LexPattern } «regDefId» - LexTerm : •( LexPattern ) «regDefId» - LexTerm : •. «{» - LexTerm : •char_lit «{» - LexTerm : •char_lit - char_lit «{» - LexTerm : •~ char_lit «{» - LexTerm : •~ ( char_lit - char_lit ) «{» - LexTerm : •regDefId «{» - LexTerm : •[ LexPattern ] «{» - LexTerm : •{ LexPattern } «{» - LexTerm : •( LexPattern ) «{» - LexTerm : •. «~» - LexTerm : •char_lit «~» - LexTerm : •char_lit - char_lit «~» - LexTerm : •~ char_lit «~» - LexTerm : •~ ( char_lit - char_lit ) «~» - LexTerm : •regDefId «~» - LexTerm : •[ LexPattern ] «~» - LexTerm : •{ LexPattern } «~» - LexTerm : •( LexPattern ) «~» -} -Transitions: - LexTerm -> 65 + LexTerm : •Λ<[> Π Λ<]> «regDefId» + LexTerm : •Λ<{> Π Λ<}> «regDefId» + LexTerm : •Λ<(> Π Λ<)> «regDefId» + LexTerm : •Λ<.> «"{"» + LexTerm : •char_lit «"{"» + LexTerm : •char_lit Λ<-> char_lit «"{"» + LexTerm : •Λ<~> char_lit «"{"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"{"» + LexTerm : •regDefId «"{"» + LexTerm : •Λ<[> Π Λ<]> «"{"» + LexTerm : •Λ<{> Π Λ<}> «"{"» + LexTerm : •Λ<(> Π Λ<)> «"{"» + LexTerm : •Λ<.> «"~"» + LexTerm : •char_lit «"~"» + LexTerm : •char_lit Λ<-> char_lit «"~"» + LexTerm : •Λ<~> char_lit «"~"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"~"» + LexTerm : •regDefId «"~"» + LexTerm : •Λ<[> Π Λ<]> «"~"» + LexTerm : •Λ<{> Π Λ<}> «"~"» + LexTerm : •Λ<(> Π Λ<)> «"~"» +} +Transitions: + Π -> 65 regDefId -> 66 - . -> 67 + Λ<.> -> 67 char_lit -> 68 - ~ -> 69 - ( -> 70 - [ -> 71 - { -> 72 - LexAlt -> 130 + Λ<~> -> 69 + Λ<(> -> 70 + Λ<[> -> 71 + Λ<{> -> 72 + Π -> 130 S104{ - LexTerm : [ LexPattern ]• «;» - LexTerm : [ LexPattern ]• «(» - LexTerm : [ LexPattern ]• «.» - LexTerm : [ LexPattern ]• «[» - LexTerm : [ LexPattern ]• «char_lit» - LexTerm : [ LexPattern ]• «regDefId» - LexTerm : [ LexPattern ]• «{» - LexTerm : [ LexPattern ]• «~» - LexTerm : [ LexPattern ]• «|» + LexTerm : Λ<[> Π Λ<]>• «";"» + LexTerm : Λ<[> Π Λ<]>• «"("» + LexTerm : Λ<[> Π Λ<]>• «"."» + LexTerm : Λ<[> Π Λ<]>• «"["» + LexTerm : Λ<[> Π Λ<]>• «char_lit» + LexTerm : Λ<[> Π Λ<]>• «regDefId» + LexTerm : Λ<[> Π Λ<]>• «"{"» + LexTerm : Λ<[> Π Λ<]>• «"~"» + LexTerm : Λ<[> Π Λ<]>• «"|"» } Transitions: S105{ - LexAlt : LexAlt LexTerm• «]» - LexAlt : LexAlt LexTerm• «(» - LexAlt : LexAlt LexTerm• «.» - LexAlt : LexAlt LexTerm• «[» - LexAlt : LexAlt LexTerm• «char_lit» - LexAlt : LexAlt LexTerm• «regDefId» - LexAlt : LexAlt LexTerm• «{» - LexAlt : LexAlt LexTerm• «~» - LexAlt : LexAlt LexTerm• «|» + LexAlt : Π Π• «"]"» + LexAlt : Π Π• «"("» + LexAlt : Π Π• «"."» + LexAlt : Π Π• «"["» + LexAlt : Π Π• «char_lit» + LexAlt : Π Π• «regDefId» + LexAlt : Π Π• «"{"» + LexAlt : Π Π• «"~"» + LexAlt : Π Π• «"|"» } Transitions: S106{ - LexTerm : char_lit - •char_lit «]» - LexTerm : char_lit - •char_lit «(» - LexTerm : char_lit - •char_lit «.» - LexTerm : char_lit - •char_lit «[» - LexTerm : char_lit - •char_lit «char_lit» - LexTerm : char_lit - •char_lit «regDefId» - LexTerm : char_lit - •char_lit «{» - LexTerm : char_lit - •char_lit «~» - LexTerm : char_lit - •char_lit «|» + LexTerm : char_lit Λ<-> •char_lit «"]"» + LexTerm : char_lit Λ<-> •char_lit «"("» + LexTerm : char_lit Λ<-> •char_lit «"."» + LexTerm : char_lit Λ<-> •char_lit «"["» + LexTerm : char_lit Λ<-> •char_lit «char_lit» + LexTerm : char_lit Λ<-> •char_lit «regDefId» + LexTerm : char_lit Λ<-> •char_lit «"{"» + LexTerm : char_lit Λ<-> •char_lit «"~"» + LexTerm : char_lit Λ<-> •char_lit «"|"» } Transitions: char_lit -> 131 S107{ - LexTerm : ~ char_lit• «]» - LexTerm : ~ char_lit• «(» - LexTerm : ~ char_lit• «.» - LexTerm : ~ char_lit• «[» - LexTerm : ~ char_lit• «char_lit» - LexTerm : ~ char_lit• «regDefId» - LexTerm : ~ char_lit• «{» - LexTerm : ~ char_lit• «~» - LexTerm : ~ char_lit• «|» + LexTerm : Λ<~> char_lit• «"]"» + LexTerm : Λ<~> char_lit• «"("» + LexTerm : Λ<~> char_lit• «"."» + LexTerm : Λ<~> char_lit• «"["» + LexTerm : Λ<~> char_lit• «char_lit» + LexTerm : Λ<~> char_lit• «regDefId» + LexTerm : Λ<~> char_lit• «"{"» + LexTerm : Λ<~> char_lit• «"~"» + LexTerm : Λ<~> char_lit• «"|"» } Transitions: S108{ - LexTerm : ~ ( •char_lit - char_lit ) «]» - LexTerm : ~ ( •char_lit - char_lit ) «(» - LexTerm : ~ ( •char_lit - char_lit ) «.» - LexTerm : ~ ( •char_lit - char_lit ) «[» - LexTerm : ~ ( •char_lit - char_lit ) «char_lit» - LexTerm : ~ ( •char_lit - char_lit ) «regDefId» - LexTerm : ~ ( •char_lit - char_lit ) «{» - LexTerm : ~ ( •char_lit - char_lit ) «~» - LexTerm : ~ ( •char_lit - char_lit ) «|» + LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «"]"» + LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «"("» + LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «"."» + LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «"["» + LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «char_lit» + LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «regDefId» + LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «"{"» + LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «"~"» + LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «"|"» } Transitions: char_lit -> 132 S109{ - LexTerm : ( LexPattern •) «]» - LexTerm : ( LexPattern •) «(» - LexTerm : ( LexPattern •) «.» - LexTerm : ( LexPattern •) «[» - LexTerm : ( LexPattern •) «char_lit» - LexTerm : ( LexPattern •) «regDefId» - LexTerm : ( LexPattern •) «{» - LexTerm : ( LexPattern •) «~» - LexTerm : ( LexPattern •) «|» - LexPattern : LexPattern •| LexAlt «)» - LexPattern : LexPattern •| LexAlt «|» + LexTerm : Λ<(> Π •Λ<)> «"]"» + LexTerm : Λ<(> Π •Λ<)> «"("» + LexTerm : Λ<(> Π •Λ<)> «"."» + LexTerm : Λ<(> Π •Λ<)> «"["» + LexTerm : Λ<(> Π •Λ<)> «char_lit» + LexTerm : Λ<(> Π •Λ<)> «regDefId» + LexTerm : Λ<(> Π •Λ<)> «"{"» + LexTerm : Λ<(> Π •Λ<)> «"~"» + LexTerm : Λ<(> Π •Λ<)> «"|"» + LexPattern : Π •Λ<|> Π «")"» + LexPattern : Π •Λ<|> Π «"|"» } Transitions: - | -> 94 - ) -> 133 + Λ<|> -> 94 + Λ<)> -> 133 S110{ - LexTerm : [ LexPattern •] «]» - LexTerm : [ LexPattern •] «(» - LexTerm : [ LexPattern •] «.» - LexTerm : [ LexPattern •] «[» - LexTerm : [ LexPattern •] «char_lit» - LexTerm : [ LexPattern •] «regDefId» - LexTerm : [ LexPattern •] «{» - LexTerm : [ LexPattern •] «~» - LexTerm : [ LexPattern •] «|» - LexPattern : LexPattern •| LexAlt «]» - LexPattern : LexPattern •| LexAlt «|» + LexTerm : Λ<[> Π •Λ<]> «"]"» + LexTerm : Λ<[> Π •Λ<]> «"("» + LexTerm : Λ<[> Π •Λ<]> «"."» + LexTerm : Λ<[> Π •Λ<]> «"["» + LexTerm : Λ<[> Π •Λ<]> «char_lit» + LexTerm : Λ<[> Π •Λ<]> «regDefId» + LexTerm : Λ<[> Π •Λ<]> «"{"» + LexTerm : Λ<[> Π •Λ<]> «"~"» + LexTerm : Λ<[> Π •Λ<]> «"|"» + LexPattern : Π •Λ<|> Π «"]"» + LexPattern : Π •Λ<|> Π «"|"» } Transitions: - | -> 103 - ] -> 134 + Λ<|> -> 103 + Λ<]> -> 134 S111{ - LexTerm : { LexPattern •} «]» - LexTerm : { LexPattern •} «(» - LexTerm : { LexPattern •} «.» - LexTerm : { LexPattern •} «[» - LexTerm : { LexPattern •} «char_lit» - LexTerm : { LexPattern •} «regDefId» - LexTerm : { LexPattern •} «{» - LexTerm : { LexPattern •} «~» - LexTerm : { LexPattern •} «|» - LexPattern : LexPattern •| LexAlt «}» - LexPattern : LexPattern •| LexAlt «|» + LexTerm : Λ<{> Π •Λ<}> «"]"» + LexTerm : Λ<{> Π •Λ<}> «"("» + LexTerm : Λ<{> Π •Λ<}> «"."» + LexTerm : Λ<{> Π •Λ<}> «"["» + LexTerm : Λ<{> Π •Λ<}> «char_lit» + LexTerm : Λ<{> Π •Λ<}> «regDefId» + LexTerm : Λ<{> Π •Λ<}> «"{"» + LexTerm : Λ<{> Π •Λ<}> «"~"» + LexTerm : Λ<{> Π •Λ<}> «"|"» + LexPattern : Π •Λ<|> Π «"}"» + LexPattern : Π •Λ<|> Π «"|"» } Transitions: - | -> 112 - } -> 135 + Λ<|> -> 112 + Λ<}> -> 135 S112{ - LexPattern : LexPattern | •LexAlt «}» - LexPattern : LexPattern | •LexAlt «|» - LexAlt : •LexTerm «}» - LexAlt : •LexAlt LexTerm «}» - LexAlt : •LexTerm «|» - LexAlt : •LexAlt LexTerm «|» - LexTerm : •. «}» - LexTerm : •char_lit «}» - LexTerm : •char_lit - char_lit «}» - LexTerm : •~ char_lit «}» - LexTerm : •~ ( char_lit - char_lit ) «}» - LexTerm : •regDefId «}» - LexTerm : •[ LexPattern ] «}» - LexTerm : •{ LexPattern } «}» - LexTerm : •( LexPattern ) «}» - LexAlt : •LexTerm «(» - LexAlt : •LexTerm «.» - LexAlt : •LexTerm «[» - LexAlt : •LexTerm «char_lit» - LexAlt : •LexTerm «regDefId» - LexAlt : •LexTerm «{» - LexAlt : •LexTerm «~» - LexAlt : •LexAlt LexTerm «(» - LexAlt : •LexAlt LexTerm «.» - LexAlt : •LexAlt LexTerm «[» - LexAlt : •LexAlt LexTerm «char_lit» - LexAlt : •LexAlt LexTerm «regDefId» - LexAlt : •LexAlt LexTerm «{» - LexAlt : •LexAlt LexTerm «~» - LexTerm : •. «|» - LexTerm : •char_lit «|» - LexTerm : •char_lit - char_lit «|» - LexTerm : •~ char_lit «|» - LexTerm : •~ ( char_lit - char_lit ) «|» - LexTerm : •regDefId «|» - LexTerm : •[ LexPattern ] «|» - LexTerm : •{ LexPattern } «|» - LexTerm : •( LexPattern ) «|» - LexTerm : •. «(» - LexTerm : •char_lit «(» - LexTerm : •char_lit - char_lit «(» - LexTerm : •~ char_lit «(» - LexTerm : •~ ( char_lit - char_lit ) «(» - LexTerm : •regDefId «(» - LexTerm : •[ LexPattern ] «(» - LexTerm : •{ LexPattern } «(» - LexTerm : •( LexPattern ) «(» - LexTerm : •. «.» - LexTerm : •char_lit «.» - LexTerm : •char_lit - char_lit «.» - LexTerm : •~ char_lit «.» - LexTerm : •~ ( char_lit - char_lit ) «.» - LexTerm : •regDefId «.» - LexTerm : •[ LexPattern ] «.» - LexTerm : •{ LexPattern } «.» - LexTerm : •( LexPattern ) «.» - LexTerm : •. «[» - LexTerm : •char_lit «[» - LexTerm : •char_lit - char_lit «[» - LexTerm : •~ char_lit «[» - LexTerm : •~ ( char_lit - char_lit ) «[» - LexTerm : •regDefId «[» - LexTerm : •[ LexPattern ] «[» - LexTerm : •{ LexPattern } «[» - LexTerm : •( LexPattern ) «[» - LexTerm : •. «char_lit» + LexPattern : Π Λ<|> •Π «"}"» + LexPattern : Π Λ<|> •Π «"|"» + LexAlt : •Π «"}"» + LexAlt : •Π Π «"}"» + LexAlt : •Π «"|"» + LexAlt : •Π Π «"|"» + LexTerm : •Λ<.> «"}"» + LexTerm : •char_lit «"}"» + LexTerm : •char_lit Λ<-> char_lit «"}"» + LexTerm : •Λ<~> char_lit «"}"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"}"» + LexTerm : •regDefId «"}"» + LexTerm : •Λ<[> Π Λ<]> «"}"» + LexTerm : •Λ<{> Π Λ<}> «"}"» + LexTerm : •Λ<(> Π Λ<)> «"}"» + LexAlt : •Π «"("» + LexAlt : •Π «"."» + LexAlt : •Π «"["» + LexAlt : •Π «char_lit» + LexAlt : •Π «regDefId» + LexAlt : •Π «"{"» + LexAlt : •Π «"~"» + LexAlt : •Π Π «"("» + LexAlt : •Π Π «"."» + LexAlt : •Π Π «"["» + LexAlt : •Π Π «char_lit» + LexAlt : •Π Π «regDefId» + LexAlt : •Π Π «"{"» + LexAlt : •Π Π «"~"» + LexTerm : •Λ<.> «"|"» + LexTerm : •char_lit «"|"» + LexTerm : •char_lit Λ<-> char_lit «"|"» + LexTerm : •Λ<~> char_lit «"|"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"|"» + LexTerm : •regDefId «"|"» + LexTerm : •Λ<[> Π Λ<]> «"|"» + LexTerm : •Λ<{> Π Λ<}> «"|"» + LexTerm : •Λ<(> Π Λ<)> «"|"» + LexTerm : •Λ<.> «"("» + LexTerm : •char_lit «"("» + LexTerm : •char_lit Λ<-> char_lit «"("» + LexTerm : •Λ<~> char_lit «"("» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"("» + LexTerm : •regDefId «"("» + LexTerm : •Λ<[> Π Λ<]> «"("» + LexTerm : •Λ<{> Π Λ<}> «"("» + LexTerm : •Λ<(> Π Λ<)> «"("» + LexTerm : •Λ<.> «"."» + LexTerm : •char_lit «"."» + LexTerm : •char_lit Λ<-> char_lit «"."» + LexTerm : •Λ<~> char_lit «"."» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"."» + LexTerm : •regDefId «"."» + LexTerm : •Λ<[> Π Λ<]> «"."» + LexTerm : •Λ<{> Π Λ<}> «"."» + LexTerm : •Λ<(> Π Λ<)> «"."» + LexTerm : •Λ<.> «"["» + LexTerm : •char_lit «"["» + LexTerm : •char_lit Λ<-> char_lit «"["» + LexTerm : •Λ<~> char_lit «"["» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"["» + LexTerm : •regDefId «"["» + LexTerm : •Λ<[> Π Λ<]> «"["» + LexTerm : •Λ<{> Π Λ<}> «"["» + LexTerm : •Λ<(> Π Λ<)> «"["» + LexTerm : •Λ<.> «char_lit» LexTerm : •char_lit «char_lit» - LexTerm : •char_lit - char_lit «char_lit» - LexTerm : •~ char_lit «char_lit» - LexTerm : •~ ( char_lit - char_lit ) «char_lit» + LexTerm : •char_lit Λ<-> char_lit «char_lit» + LexTerm : •Λ<~> char_lit «char_lit» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «char_lit» LexTerm : •regDefId «char_lit» - LexTerm : •[ LexPattern ] «char_lit» - LexTerm : •{ LexPattern } «char_lit» - LexTerm : •( LexPattern ) «char_lit» - LexTerm : •. «regDefId» + LexTerm : •Λ<[> Π Λ<]> «char_lit» + LexTerm : •Λ<{> Π Λ<}> «char_lit» + LexTerm : •Λ<(> Π Λ<)> «char_lit» + LexTerm : •Λ<.> «regDefId» LexTerm : •char_lit «regDefId» - LexTerm : •char_lit - char_lit «regDefId» - LexTerm : •~ char_lit «regDefId» - LexTerm : •~ ( char_lit - char_lit ) «regDefId» + LexTerm : •char_lit Λ<-> char_lit «regDefId» + LexTerm : •Λ<~> char_lit «regDefId» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «regDefId» LexTerm : •regDefId «regDefId» - LexTerm : •[ LexPattern ] «regDefId» - LexTerm : •{ LexPattern } «regDefId» - LexTerm : •( LexPattern ) «regDefId» - LexTerm : •. «{» - LexTerm : •char_lit «{» - LexTerm : •char_lit - char_lit «{» - LexTerm : •~ char_lit «{» - LexTerm : •~ ( char_lit - char_lit ) «{» - LexTerm : •regDefId «{» - LexTerm : •[ LexPattern ] «{» - LexTerm : •{ LexPattern } «{» - LexTerm : •( LexPattern ) «{» - LexTerm : •. «~» - LexTerm : •char_lit «~» - LexTerm : •char_lit - char_lit «~» - LexTerm : •~ char_lit «~» - LexTerm : •~ ( char_lit - char_lit ) «~» - LexTerm : •regDefId «~» - LexTerm : •[ LexPattern ] «~» - LexTerm : •{ LexPattern } «~» - LexTerm : •( LexPattern ) «~» -} -Transitions: - LexTerm -> 75 + LexTerm : •Λ<[> Π Λ<]> «regDefId» + LexTerm : •Λ<{> Π Λ<}> «regDefId» + LexTerm : •Λ<(> Π Λ<)> «regDefId» + LexTerm : •Λ<.> «"{"» + LexTerm : •char_lit «"{"» + LexTerm : •char_lit Λ<-> char_lit «"{"» + LexTerm : •Λ<~> char_lit «"{"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"{"» + LexTerm : •regDefId «"{"» + LexTerm : •Λ<[> Π Λ<]> «"{"» + LexTerm : •Λ<{> Π Λ<}> «"{"» + LexTerm : •Λ<(> Π Λ<)> «"{"» + LexTerm : •Λ<.> «"~"» + LexTerm : •char_lit «"~"» + LexTerm : •char_lit Λ<-> char_lit «"~"» + LexTerm : •Λ<~> char_lit «"~"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"~"» + LexTerm : •regDefId «"~"» + LexTerm : •Λ<[> Π Λ<]> «"~"» + LexTerm : •Λ<{> Π Λ<}> «"~"» + LexTerm : •Λ<(> Π Λ<)> «"~"» +} +Transitions: + Π -> 75 regDefId -> 76 - . -> 77 + Λ<.> -> 77 char_lit -> 78 - ~ -> 79 - ( -> 80 - [ -> 81 - { -> 82 - LexAlt -> 136 + Λ<~> -> 79 + Λ<(> -> 80 + Λ<[> -> 81 + Λ<{> -> 82 + Π -> 136 S113{ - LexTerm : { LexPattern }• «;» - LexTerm : { LexPattern }• «(» - LexTerm : { LexPattern }• «.» - LexTerm : { LexPattern }• «[» - LexTerm : { LexPattern }• «char_lit» - LexTerm : { LexPattern }• «regDefId» - LexTerm : { LexPattern }• «{» - LexTerm : { LexPattern }• «~» - LexTerm : { LexPattern }• «|» + LexTerm : Λ<{> Π Λ<}>• «";"» + LexTerm : Λ<{> Π Λ<}>• «"("» + LexTerm : Λ<{> Π Λ<}>• «"."» + LexTerm : Λ<{> Π Λ<}>• «"["» + LexTerm : Λ<{> Π Λ<}>• «char_lit» + LexTerm : Λ<{> Π Λ<}>• «regDefId» + LexTerm : Λ<{> Π Λ<}>• «"{"» + LexTerm : Λ<{> Π Λ<}>• «"~"» + LexTerm : Λ<{> Π Λ<}>• «"|"» } Transitions: S114{ - LexAlt : LexAlt LexTerm• «}» - LexAlt : LexAlt LexTerm• «(» - LexAlt : LexAlt LexTerm• «.» - LexAlt : LexAlt LexTerm• «[» - LexAlt : LexAlt LexTerm• «char_lit» - LexAlt : LexAlt LexTerm• «regDefId» - LexAlt : LexAlt LexTerm• «{» - LexAlt : LexAlt LexTerm• «~» - LexAlt : LexAlt LexTerm• «|» + LexAlt : Π Π• «"}"» + LexAlt : Π Π• «"("» + LexAlt : Π Π• «"."» + LexAlt : Π Π• «"["» + LexAlt : Π Π• «char_lit» + LexAlt : Π Π• «regDefId» + LexAlt : Π Π• «"{"» + LexAlt : Π Π• «"~"» + LexAlt : Π Π• «"|"» } Transitions: S115{ - LexTerm : char_lit - •char_lit «}» - LexTerm : char_lit - •char_lit «(» - LexTerm : char_lit - •char_lit «.» - LexTerm : char_lit - •char_lit «[» - LexTerm : char_lit - •char_lit «char_lit» - LexTerm : char_lit - •char_lit «regDefId» - LexTerm : char_lit - •char_lit «{» - LexTerm : char_lit - •char_lit «~» - LexTerm : char_lit - •char_lit «|» + LexTerm : char_lit Λ<-> •char_lit «"}"» + LexTerm : char_lit Λ<-> •char_lit «"("» + LexTerm : char_lit Λ<-> •char_lit «"."» + LexTerm : char_lit Λ<-> •char_lit «"["» + LexTerm : char_lit Λ<-> •char_lit «char_lit» + LexTerm : char_lit Λ<-> •char_lit «regDefId» + LexTerm : char_lit Λ<-> •char_lit «"{"» + LexTerm : char_lit Λ<-> •char_lit «"~"» + LexTerm : char_lit Λ<-> •char_lit «"|"» } Transitions: char_lit -> 137 S116{ - LexTerm : ~ char_lit• «}» - LexTerm : ~ char_lit• «(» - LexTerm : ~ char_lit• «.» - LexTerm : ~ char_lit• «[» - LexTerm : ~ char_lit• «char_lit» - LexTerm : ~ char_lit• «regDefId» - LexTerm : ~ char_lit• «{» - LexTerm : ~ char_lit• «~» - LexTerm : ~ char_lit• «|» + LexTerm : Λ<~> char_lit• «"}"» + LexTerm : Λ<~> char_lit• «"("» + LexTerm : Λ<~> char_lit• «"."» + LexTerm : Λ<~> char_lit• «"["» + LexTerm : Λ<~> char_lit• «char_lit» + LexTerm : Λ<~> char_lit• «regDefId» + LexTerm : Λ<~> char_lit• «"{"» + LexTerm : Λ<~> char_lit• «"~"» + LexTerm : Λ<~> char_lit• «"|"» } Transitions: S117{ - LexTerm : ~ ( •char_lit - char_lit ) «}» - LexTerm : ~ ( •char_lit - char_lit ) «(» - LexTerm : ~ ( •char_lit - char_lit ) «.» - LexTerm : ~ ( •char_lit - char_lit ) «[» - LexTerm : ~ ( •char_lit - char_lit ) «char_lit» - LexTerm : ~ ( •char_lit - char_lit ) «regDefId» - LexTerm : ~ ( •char_lit - char_lit ) «{» - LexTerm : ~ ( •char_lit - char_lit ) «~» - LexTerm : ~ ( •char_lit - char_lit ) «|» + LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «"}"» + LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «"("» + LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «"."» + LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «"["» + LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «char_lit» + LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «regDefId» + LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «"{"» + LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «"~"» + LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «"|"» } Transitions: char_lit -> 138 S118{ - LexTerm : ( LexPattern •) «}» - LexTerm : ( LexPattern •) «(» - LexTerm : ( LexPattern •) «.» - LexTerm : ( LexPattern •) «[» - LexTerm : ( LexPattern •) «char_lit» - LexTerm : ( LexPattern •) «regDefId» - LexTerm : ( LexPattern •) «{» - LexTerm : ( LexPattern •) «~» - LexTerm : ( LexPattern •) «|» - LexPattern : LexPattern •| LexAlt «)» - LexPattern : LexPattern •| LexAlt «|» + LexTerm : Λ<(> Π •Λ<)> «"}"» + LexTerm : Λ<(> Π •Λ<)> «"("» + LexTerm : Λ<(> Π •Λ<)> «"."» + LexTerm : Λ<(> Π •Λ<)> «"["» + LexTerm : Λ<(> Π •Λ<)> «char_lit» + LexTerm : Λ<(> Π •Λ<)> «regDefId» + LexTerm : Λ<(> Π •Λ<)> «"{"» + LexTerm : Λ<(> Π •Λ<)> «"~"» + LexTerm : Λ<(> Π •Λ<)> «"|"» + LexPattern : Π •Λ<|> Π «")"» + LexPattern : Π •Λ<|> Π «"|"» } Transitions: - | -> 94 - ) -> 139 + Λ<|> -> 94 + Λ<)> -> 139 S119{ - LexTerm : [ LexPattern •] «}» - LexTerm : [ LexPattern •] «(» - LexTerm : [ LexPattern •] «.» - LexTerm : [ LexPattern •] «[» - LexTerm : [ LexPattern •] «char_lit» - LexTerm : [ LexPattern •] «regDefId» - LexTerm : [ LexPattern •] «{» - LexTerm : [ LexPattern •] «~» - LexTerm : [ LexPattern •] «|» - LexPattern : LexPattern •| LexAlt «]» - LexPattern : LexPattern •| LexAlt «|» + LexTerm : Λ<[> Π •Λ<]> «"}"» + LexTerm : Λ<[> Π •Λ<]> «"("» + LexTerm : Λ<[> Π •Λ<]> «"."» + LexTerm : Λ<[> Π •Λ<]> «"["» + LexTerm : Λ<[> Π •Λ<]> «char_lit» + LexTerm : Λ<[> Π •Λ<]> «regDefId» + LexTerm : Λ<[> Π •Λ<]> «"{"» + LexTerm : Λ<[> Π •Λ<]> «"~"» + LexTerm : Λ<[> Π •Λ<]> «"|"» + LexPattern : Π •Λ<|> Π «"]"» + LexPattern : Π •Λ<|> Π «"|"» } Transitions: - | -> 103 - ] -> 140 + Λ<|> -> 103 + Λ<]> -> 140 S120{ - LexTerm : { LexPattern •} «}» - LexTerm : { LexPattern •} «(» - LexTerm : { LexPattern •} «.» - LexTerm : { LexPattern •} «[» - LexTerm : { LexPattern •} «char_lit» - LexTerm : { LexPattern •} «regDefId» - LexTerm : { LexPattern •} «{» - LexTerm : { LexPattern •} «~» - LexTerm : { LexPattern •} «|» - LexPattern : LexPattern •| LexAlt «}» - LexPattern : LexPattern •| LexAlt «|» + LexTerm : Λ<{> Π •Λ<}> «"}"» + LexTerm : Λ<{> Π •Λ<}> «"("» + LexTerm : Λ<{> Π •Λ<}> «"."» + LexTerm : Λ<{> Π •Λ<}> «"["» + LexTerm : Λ<{> Π •Λ<}> «char_lit» + LexTerm : Λ<{> Π •Λ<}> «regDefId» + LexTerm : Λ<{> Π •Λ<}> «"{"» + LexTerm : Λ<{> Π •Λ<}> «"~"» + LexTerm : Λ<{> Π •Λ<}> «"|"» + LexPattern : Π •Λ<|> Π «"}"» + LexPattern : Π •Λ<|> Π «"|"» } Transitions: - | -> 112 - } -> 141 + Λ<|> -> 112 + Λ<}> -> 141 S121{ - Alternatives : Alternatives | SyntaxBody• «;» - Alternatives : Alternatives | SyntaxBody• «|» + Alternatives : Π Λ<|> Π• «";"» + Alternatives : Π Λ<|> Π• «"|"» } Transitions: S122{ - SyntaxBody : ErrorSymbol Symbols g_sdt_lit• «;» - SyntaxBody : ErrorSymbol Symbols g_sdt_lit• «|» + SyntaxBody : Π Π g_sdt_lit• «";"» + SyntaxBody : Π Π g_sdt_lit• «"|"» } Transitions: S123{ - LexTerm : ~ ( char_lit - •char_lit ) «;» - LexTerm : ~ ( char_lit - •char_lit ) «(» - LexTerm : ~ ( char_lit - •char_lit ) «.» - LexTerm : ~ ( char_lit - •char_lit ) «[» - LexTerm : ~ ( char_lit - •char_lit ) «char_lit» - LexTerm : ~ ( char_lit - •char_lit ) «regDefId» - LexTerm : ~ ( char_lit - •char_lit ) «{» - LexTerm : ~ ( char_lit - •char_lit ) «~» - LexTerm : ~ ( char_lit - •char_lit ) «|» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «";"» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «"("» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «"."» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «"["» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «char_lit» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «regDefId» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «"{"» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «"~"» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «"|"» } Transitions: char_lit -> 142 S124{ - LexPattern : LexPattern | LexAlt• «)» - LexPattern : LexPattern | LexAlt• «|» - LexAlt : LexAlt •LexTerm «)» - LexAlt : LexAlt •LexTerm «|» - LexAlt : LexAlt •LexTerm «(» - LexAlt : LexAlt •LexTerm «.» - LexAlt : LexAlt •LexTerm «[» - LexAlt : LexAlt •LexTerm «char_lit» - LexAlt : LexAlt •LexTerm «regDefId» - LexAlt : LexAlt •LexTerm «{» - LexAlt : LexAlt •LexTerm «~» - LexTerm : •. «)» - LexTerm : •char_lit «)» - LexTerm : •char_lit - char_lit «)» - LexTerm : •~ char_lit «)» - LexTerm : •~ ( char_lit - char_lit ) «)» - LexTerm : •regDefId «)» - LexTerm : •[ LexPattern ] «)» - LexTerm : •{ LexPattern } «)» - LexTerm : •( LexPattern ) «)» - LexTerm : •. «|» - LexTerm : •char_lit «|» - LexTerm : •char_lit - char_lit «|» - LexTerm : •~ char_lit «|» - LexTerm : •~ ( char_lit - char_lit ) «|» - LexTerm : •regDefId «|» - LexTerm : •[ LexPattern ] «|» - LexTerm : •{ LexPattern } «|» - LexTerm : •( LexPattern ) «|» - LexTerm : •. «(» - LexTerm : •char_lit «(» - LexTerm : •char_lit - char_lit «(» - LexTerm : •~ char_lit «(» - LexTerm : •~ ( char_lit - char_lit ) «(» - LexTerm : •regDefId «(» - LexTerm : •[ LexPattern ] «(» - LexTerm : •{ LexPattern } «(» - LexTerm : •( LexPattern ) «(» - LexTerm : •. «.» - LexTerm : •char_lit «.» - LexTerm : •char_lit - char_lit «.» - LexTerm : •~ char_lit «.» - LexTerm : •~ ( char_lit - char_lit ) «.» - LexTerm : •regDefId «.» - LexTerm : •[ LexPattern ] «.» - LexTerm : •{ LexPattern } «.» - LexTerm : •( LexPattern ) «.» - LexTerm : •. «[» - LexTerm : •char_lit «[» - LexTerm : •char_lit - char_lit «[» - LexTerm : •~ char_lit «[» - LexTerm : •~ ( char_lit - char_lit ) «[» - LexTerm : •regDefId «[» - LexTerm : •[ LexPattern ] «[» - LexTerm : •{ LexPattern } «[» - LexTerm : •( LexPattern ) «[» - LexTerm : •. «char_lit» + LexPattern : Π Λ<|> Π• «")"» + LexPattern : Π Λ<|> Π• «"|"» + LexAlt : Π •Π «")"» + LexAlt : Π •Π «"|"» + LexAlt : Π •Π «"("» + LexAlt : Π •Π «"."» + LexAlt : Π •Π «"["» + LexAlt : Π •Π «char_lit» + LexAlt : Π •Π «regDefId» + LexAlt : Π •Π «"{"» + LexAlt : Π •Π «"~"» + LexTerm : •Λ<.> «")"» + LexTerm : •char_lit «")"» + LexTerm : •char_lit Λ<-> char_lit «")"» + LexTerm : •Λ<~> char_lit «")"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «")"» + LexTerm : •regDefId «")"» + LexTerm : •Λ<[> Π Λ<]> «")"» + LexTerm : •Λ<{> Π Λ<}> «")"» + LexTerm : •Λ<(> Π Λ<)> «")"» + LexTerm : •Λ<.> «"|"» + LexTerm : •char_lit «"|"» + LexTerm : •char_lit Λ<-> char_lit «"|"» + LexTerm : •Λ<~> char_lit «"|"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"|"» + LexTerm : •regDefId «"|"» + LexTerm : •Λ<[> Π Λ<]> «"|"» + LexTerm : •Λ<{> Π Λ<}> «"|"» + LexTerm : •Λ<(> Π Λ<)> «"|"» + LexTerm : •Λ<.> «"("» + LexTerm : •char_lit «"("» + LexTerm : •char_lit Λ<-> char_lit «"("» + LexTerm : •Λ<~> char_lit «"("» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"("» + LexTerm : •regDefId «"("» + LexTerm : •Λ<[> Π Λ<]> «"("» + LexTerm : •Λ<{> Π Λ<}> «"("» + LexTerm : •Λ<(> Π Λ<)> «"("» + LexTerm : •Λ<.> «"."» + LexTerm : •char_lit «"."» + LexTerm : •char_lit Λ<-> char_lit «"."» + LexTerm : •Λ<~> char_lit «"."» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"."» + LexTerm : •regDefId «"."» + LexTerm : •Λ<[> Π Λ<]> «"."» + LexTerm : •Λ<{> Π Λ<}> «"."» + LexTerm : •Λ<(> Π Λ<)> «"."» + LexTerm : •Λ<.> «"["» + LexTerm : •char_lit «"["» + LexTerm : •char_lit Λ<-> char_lit «"["» + LexTerm : •Λ<~> char_lit «"["» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"["» + LexTerm : •regDefId «"["» + LexTerm : •Λ<[> Π Λ<]> «"["» + LexTerm : •Λ<{> Π Λ<}> «"["» + LexTerm : •Λ<(> Π Λ<)> «"["» + LexTerm : •Λ<.> «char_lit» LexTerm : •char_lit «char_lit» - LexTerm : •char_lit - char_lit «char_lit» - LexTerm : •~ char_lit «char_lit» - LexTerm : •~ ( char_lit - char_lit ) «char_lit» + LexTerm : •char_lit Λ<-> char_lit «char_lit» + LexTerm : •Λ<~> char_lit «char_lit» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «char_lit» LexTerm : •regDefId «char_lit» - LexTerm : •[ LexPattern ] «char_lit» - LexTerm : •{ LexPattern } «char_lit» - LexTerm : •( LexPattern ) «char_lit» - LexTerm : •. «regDefId» + LexTerm : •Λ<[> Π Λ<]> «char_lit» + LexTerm : •Λ<{> Π Λ<}> «char_lit» + LexTerm : •Λ<(> Π Λ<)> «char_lit» + LexTerm : •Λ<.> «regDefId» LexTerm : •char_lit «regDefId» - LexTerm : •char_lit - char_lit «regDefId» - LexTerm : •~ char_lit «regDefId» - LexTerm : •~ ( char_lit - char_lit ) «regDefId» + LexTerm : •char_lit Λ<-> char_lit «regDefId» + LexTerm : •Λ<~> char_lit «regDefId» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «regDefId» LexTerm : •regDefId «regDefId» - LexTerm : •[ LexPattern ] «regDefId» - LexTerm : •{ LexPattern } «regDefId» - LexTerm : •( LexPattern ) «regDefId» - LexTerm : •. «{» - LexTerm : •char_lit «{» - LexTerm : •char_lit - char_lit «{» - LexTerm : •~ char_lit «{» - LexTerm : •~ ( char_lit - char_lit ) «{» - LexTerm : •regDefId «{» - LexTerm : •[ LexPattern ] «{» - LexTerm : •{ LexPattern } «{» - LexTerm : •( LexPattern ) «{» - LexTerm : •. «~» - LexTerm : •char_lit «~» - LexTerm : •char_lit - char_lit «~» - LexTerm : •~ char_lit «~» - LexTerm : •~ ( char_lit - char_lit ) «~» - LexTerm : •regDefId «~» - LexTerm : •[ LexPattern ] «~» - LexTerm : •{ LexPattern } «~» - LexTerm : •( LexPattern ) «~» + LexTerm : •Λ<[> Π Λ<]> «regDefId» + LexTerm : •Λ<{> Π Λ<}> «regDefId» + LexTerm : •Λ<(> Π Λ<)> «regDefId» + LexTerm : •Λ<.> «"{"» + LexTerm : •char_lit «"{"» + LexTerm : •char_lit Λ<-> char_lit «"{"» + LexTerm : •Λ<~> char_lit «"{"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"{"» + LexTerm : •regDefId «"{"» + LexTerm : •Λ<[> Π Λ<]> «"{"» + LexTerm : •Λ<{> Π Λ<}> «"{"» + LexTerm : •Λ<(> Π Λ<)> «"{"» + LexTerm : •Λ<.> «"~"» + LexTerm : •char_lit «"~"» + LexTerm : •char_lit Λ<-> char_lit «"~"» + LexTerm : •Λ<~> char_lit «"~"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"~"» + LexTerm : •regDefId «"~"» + LexTerm : •Λ<[> Π Λ<]> «"~"» + LexTerm : •Λ<{> Π Λ<}> «"~"» + LexTerm : •Λ<(> Π Λ<)> «"~"» } Transitions: regDefId -> 56 - . -> 57 + Λ<.> -> 57 char_lit -> 58 - ~ -> 59 - ( -> 60 - [ -> 61 - { -> 62 - LexTerm -> 96 + Λ<~> -> 59 + Λ<(> -> 60 + Λ<[> -> 61 + Λ<{> -> 62 + Π -> 96 S125{ - LexTerm : char_lit - char_lit• «)» - LexTerm : char_lit - char_lit• «(» - LexTerm : char_lit - char_lit• «.» - LexTerm : char_lit - char_lit• «[» - LexTerm : char_lit - char_lit• «char_lit» - LexTerm : char_lit - char_lit• «regDefId» - LexTerm : char_lit - char_lit• «{» - LexTerm : char_lit - char_lit• «~» - LexTerm : char_lit - char_lit• «|» + LexTerm : char_lit Λ<-> char_lit• «")"» + LexTerm : char_lit Λ<-> char_lit• «"("» + LexTerm : char_lit Λ<-> char_lit• «"."» + LexTerm : char_lit Λ<-> char_lit• «"["» + LexTerm : char_lit Λ<-> char_lit• «char_lit» + LexTerm : char_lit Λ<-> char_lit• «regDefId» + LexTerm : char_lit Λ<-> char_lit• «"{"» + LexTerm : char_lit Λ<-> char_lit• «"~"» + LexTerm : char_lit Λ<-> char_lit• «"|"» } Transitions: S126{ - LexTerm : ~ ( char_lit •- char_lit ) «)» - LexTerm : ~ ( char_lit •- char_lit ) «(» - LexTerm : ~ ( char_lit •- char_lit ) «.» - LexTerm : ~ ( char_lit •- char_lit ) «[» - LexTerm : ~ ( char_lit •- char_lit ) «char_lit» - LexTerm : ~ ( char_lit •- char_lit ) «regDefId» - LexTerm : ~ ( char_lit •- char_lit ) «{» - LexTerm : ~ ( char_lit •- char_lit ) «~» - LexTerm : ~ ( char_lit •- char_lit ) «|» + LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «")"» + LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «"("» + LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «"."» + LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «"["» + LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «char_lit» + LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «regDefId» + LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «"{"» + LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «"~"» + LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «"|"» } Transitions: - - -> 143 + Λ<-> -> 143 S127{ - LexTerm : ( LexPattern )• «)» - LexTerm : ( LexPattern )• «(» - LexTerm : ( LexPattern )• «.» - LexTerm : ( LexPattern )• «[» - LexTerm : ( LexPattern )• «char_lit» - LexTerm : ( LexPattern )• «regDefId» - LexTerm : ( LexPattern )• «{» - LexTerm : ( LexPattern )• «~» - LexTerm : ( LexPattern )• «|» + LexTerm : Λ<(> Π Λ<)>• «")"» + LexTerm : Λ<(> Π Λ<)>• «"("» + LexTerm : Λ<(> Π Λ<)>• «"."» + LexTerm : Λ<(> Π Λ<)>• «"["» + LexTerm : Λ<(> Π Λ<)>• «char_lit» + LexTerm : Λ<(> Π Λ<)>• «regDefId» + LexTerm : Λ<(> Π Λ<)>• «"{"» + LexTerm : Λ<(> Π Λ<)>• «"~"» + LexTerm : Λ<(> Π Λ<)>• «"|"» } Transitions: S128{ - LexTerm : [ LexPattern ]• «)» - LexTerm : [ LexPattern ]• «(» - LexTerm : [ LexPattern ]• «.» - LexTerm : [ LexPattern ]• «[» - LexTerm : [ LexPattern ]• «char_lit» - LexTerm : [ LexPattern ]• «regDefId» - LexTerm : [ LexPattern ]• «{» - LexTerm : [ LexPattern ]• «~» - LexTerm : [ LexPattern ]• «|» + LexTerm : Λ<[> Π Λ<]>• «")"» + LexTerm : Λ<[> Π Λ<]>• «"("» + LexTerm : Λ<[> Π Λ<]>• «"."» + LexTerm : Λ<[> Π Λ<]>• «"["» + LexTerm : Λ<[> Π Λ<]>• «char_lit» + LexTerm : Λ<[> Π Λ<]>• «regDefId» + LexTerm : Λ<[> Π Λ<]>• «"{"» + LexTerm : Λ<[> Π Λ<]>• «"~"» + LexTerm : Λ<[> Π Λ<]>• «"|"» } Transitions: S129{ - LexTerm : { LexPattern }• «)» - LexTerm : { LexPattern }• «(» - LexTerm : { LexPattern }• «.» - LexTerm : { LexPattern }• «[» - LexTerm : { LexPattern }• «char_lit» - LexTerm : { LexPattern }• «regDefId» - LexTerm : { LexPattern }• «{» - LexTerm : { LexPattern }• «~» - LexTerm : { LexPattern }• «|» + LexTerm : Λ<{> Π Λ<}>• «")"» + LexTerm : Λ<{> Π Λ<}>• «"("» + LexTerm : Λ<{> Π Λ<}>• «"."» + LexTerm : Λ<{> Π Λ<}>• «"["» + LexTerm : Λ<{> Π Λ<}>• «char_lit» + LexTerm : Λ<{> Π Λ<}>• «regDefId» + LexTerm : Λ<{> Π Λ<}>• «"{"» + LexTerm : Λ<{> Π Λ<}>• «"~"» + LexTerm : Λ<{> Π Λ<}>• «"|"» } Transitions: S130{ - LexPattern : LexPattern | LexAlt• «]» - LexPattern : LexPattern | LexAlt• «|» - LexAlt : LexAlt •LexTerm «]» - LexAlt : LexAlt •LexTerm «|» - LexAlt : LexAlt •LexTerm «(» - LexAlt : LexAlt •LexTerm «.» - LexAlt : LexAlt •LexTerm «[» - LexAlt : LexAlt •LexTerm «char_lit» - LexAlt : LexAlt •LexTerm «regDefId» - LexAlt : LexAlt •LexTerm «{» - LexAlt : LexAlt •LexTerm «~» - LexTerm : •. «]» - LexTerm : •char_lit «]» - LexTerm : •char_lit - char_lit «]» - LexTerm : •~ char_lit «]» - LexTerm : •~ ( char_lit - char_lit ) «]» - LexTerm : •regDefId «]» - LexTerm : •[ LexPattern ] «]» - LexTerm : •{ LexPattern } «]» - LexTerm : •( LexPattern ) «]» - LexTerm : •. «|» - LexTerm : •char_lit «|» - LexTerm : •char_lit - char_lit «|» - LexTerm : •~ char_lit «|» - LexTerm : •~ ( char_lit - char_lit ) «|» - LexTerm : •regDefId «|» - LexTerm : •[ LexPattern ] «|» - LexTerm : •{ LexPattern } «|» - LexTerm : •( LexPattern ) «|» - LexTerm : •. «(» - LexTerm : •char_lit «(» - LexTerm : •char_lit - char_lit «(» - LexTerm : •~ char_lit «(» - LexTerm : •~ ( char_lit - char_lit ) «(» - LexTerm : •regDefId «(» - LexTerm : •[ LexPattern ] «(» - LexTerm : •{ LexPattern } «(» - LexTerm : •( LexPattern ) «(» - LexTerm : •. «.» - LexTerm : •char_lit «.» - LexTerm : •char_lit - char_lit «.» - LexTerm : •~ char_lit «.» - LexTerm : •~ ( char_lit - char_lit ) «.» - LexTerm : •regDefId «.» - LexTerm : •[ LexPattern ] «.» - LexTerm : •{ LexPattern } «.» - LexTerm : •( LexPattern ) «.» - LexTerm : •. «[» - LexTerm : •char_lit «[» - LexTerm : •char_lit - char_lit «[» - LexTerm : •~ char_lit «[» - LexTerm : •~ ( char_lit - char_lit ) «[» - LexTerm : •regDefId «[» - LexTerm : •[ LexPattern ] «[» - LexTerm : •{ LexPattern } «[» - LexTerm : •( LexPattern ) «[» - LexTerm : •. «char_lit» + LexPattern : Π Λ<|> Π• «"]"» + LexPattern : Π Λ<|> Π• «"|"» + LexAlt : Π •Π «"]"» + LexAlt : Π •Π «"|"» + LexAlt : Π •Π «"("» + LexAlt : Π •Π «"."» + LexAlt : Π •Π «"["» + LexAlt : Π •Π «char_lit» + LexAlt : Π •Π «regDefId» + LexAlt : Π •Π «"{"» + LexAlt : Π •Π «"~"» + LexTerm : •Λ<.> «"]"» + LexTerm : •char_lit «"]"» + LexTerm : •char_lit Λ<-> char_lit «"]"» + LexTerm : •Λ<~> char_lit «"]"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"]"» + LexTerm : •regDefId «"]"» + LexTerm : •Λ<[> Π Λ<]> «"]"» + LexTerm : •Λ<{> Π Λ<}> «"]"» + LexTerm : •Λ<(> Π Λ<)> «"]"» + LexTerm : •Λ<.> «"|"» + LexTerm : •char_lit «"|"» + LexTerm : •char_lit Λ<-> char_lit «"|"» + LexTerm : •Λ<~> char_lit «"|"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"|"» + LexTerm : •regDefId «"|"» + LexTerm : •Λ<[> Π Λ<]> «"|"» + LexTerm : •Λ<{> Π Λ<}> «"|"» + LexTerm : •Λ<(> Π Λ<)> «"|"» + LexTerm : •Λ<.> «"("» + LexTerm : •char_lit «"("» + LexTerm : •char_lit Λ<-> char_lit «"("» + LexTerm : •Λ<~> char_lit «"("» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"("» + LexTerm : •regDefId «"("» + LexTerm : •Λ<[> Π Λ<]> «"("» + LexTerm : •Λ<{> Π Λ<}> «"("» + LexTerm : •Λ<(> Π Λ<)> «"("» + LexTerm : •Λ<.> «"."» + LexTerm : •char_lit «"."» + LexTerm : •char_lit Λ<-> char_lit «"."» + LexTerm : •Λ<~> char_lit «"."» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"."» + LexTerm : •regDefId «"."» + LexTerm : •Λ<[> Π Λ<]> «"."» + LexTerm : •Λ<{> Π Λ<}> «"."» + LexTerm : •Λ<(> Π Λ<)> «"."» + LexTerm : •Λ<.> «"["» + LexTerm : •char_lit «"["» + LexTerm : •char_lit Λ<-> char_lit «"["» + LexTerm : •Λ<~> char_lit «"["» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"["» + LexTerm : •regDefId «"["» + LexTerm : •Λ<[> Π Λ<]> «"["» + LexTerm : •Λ<{> Π Λ<}> «"["» + LexTerm : •Λ<(> Π Λ<)> «"["» + LexTerm : •Λ<.> «char_lit» LexTerm : •char_lit «char_lit» - LexTerm : •char_lit - char_lit «char_lit» - LexTerm : •~ char_lit «char_lit» - LexTerm : •~ ( char_lit - char_lit ) «char_lit» + LexTerm : •char_lit Λ<-> char_lit «char_lit» + LexTerm : •Λ<~> char_lit «char_lit» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «char_lit» LexTerm : •regDefId «char_lit» - LexTerm : •[ LexPattern ] «char_lit» - LexTerm : •{ LexPattern } «char_lit» - LexTerm : •( LexPattern ) «char_lit» - LexTerm : •. «regDefId» + LexTerm : •Λ<[> Π Λ<]> «char_lit» + LexTerm : •Λ<{> Π Λ<}> «char_lit» + LexTerm : •Λ<(> Π Λ<)> «char_lit» + LexTerm : •Λ<.> «regDefId» LexTerm : •char_lit «regDefId» - LexTerm : •char_lit - char_lit «regDefId» - LexTerm : •~ char_lit «regDefId» - LexTerm : •~ ( char_lit - char_lit ) «regDefId» + LexTerm : •char_lit Λ<-> char_lit «regDefId» + LexTerm : •Λ<~> char_lit «regDefId» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «regDefId» LexTerm : •regDefId «regDefId» - LexTerm : •[ LexPattern ] «regDefId» - LexTerm : •{ LexPattern } «regDefId» - LexTerm : •( LexPattern ) «regDefId» - LexTerm : •. «{» - LexTerm : •char_lit «{» - LexTerm : •char_lit - char_lit «{» - LexTerm : •~ char_lit «{» - LexTerm : •~ ( char_lit - char_lit ) «{» - LexTerm : •regDefId «{» - LexTerm : •[ LexPattern ] «{» - LexTerm : •{ LexPattern } «{» - LexTerm : •( LexPattern ) «{» - LexTerm : •. «~» - LexTerm : •char_lit «~» - LexTerm : •char_lit - char_lit «~» - LexTerm : •~ char_lit «~» - LexTerm : •~ ( char_lit - char_lit ) «~» - LexTerm : •regDefId «~» - LexTerm : •[ LexPattern ] «~» - LexTerm : •{ LexPattern } «~» - LexTerm : •( LexPattern ) «~» + LexTerm : •Λ<[> Π Λ<]> «regDefId» + LexTerm : •Λ<{> Π Λ<}> «regDefId» + LexTerm : •Λ<(> Π Λ<)> «regDefId» + LexTerm : •Λ<.> «"{"» + LexTerm : •char_lit «"{"» + LexTerm : •char_lit Λ<-> char_lit «"{"» + LexTerm : •Λ<~> char_lit «"{"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"{"» + LexTerm : •regDefId «"{"» + LexTerm : •Λ<[> Π Λ<]> «"{"» + LexTerm : •Λ<{> Π Λ<}> «"{"» + LexTerm : •Λ<(> Π Λ<)> «"{"» + LexTerm : •Λ<.> «"~"» + LexTerm : •char_lit «"~"» + LexTerm : •char_lit Λ<-> char_lit «"~"» + LexTerm : •Λ<~> char_lit «"~"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"~"» + LexTerm : •regDefId «"~"» + LexTerm : •Λ<[> Π Λ<]> «"~"» + LexTerm : •Λ<{> Π Λ<}> «"~"» + LexTerm : •Λ<(> Π Λ<)> «"~"» } Transitions: regDefId -> 66 - . -> 67 + Λ<.> -> 67 char_lit -> 68 - ~ -> 69 - ( -> 70 - [ -> 71 - { -> 72 - LexTerm -> 105 + Λ<~> -> 69 + Λ<(> -> 70 + Λ<[> -> 71 + Λ<{> -> 72 + Π -> 105 S131{ - LexTerm : char_lit - char_lit• «]» - LexTerm : char_lit - char_lit• «(» - LexTerm : char_lit - char_lit• «.» - LexTerm : char_lit - char_lit• «[» - LexTerm : char_lit - char_lit• «char_lit» - LexTerm : char_lit - char_lit• «regDefId» - LexTerm : char_lit - char_lit• «{» - LexTerm : char_lit - char_lit• «~» - LexTerm : char_lit - char_lit• «|» + LexTerm : char_lit Λ<-> char_lit• «"]"» + LexTerm : char_lit Λ<-> char_lit• «"("» + LexTerm : char_lit Λ<-> char_lit• «"."» + LexTerm : char_lit Λ<-> char_lit• «"["» + LexTerm : char_lit Λ<-> char_lit• «char_lit» + LexTerm : char_lit Λ<-> char_lit• «regDefId» + LexTerm : char_lit Λ<-> char_lit• «"{"» + LexTerm : char_lit Λ<-> char_lit• «"~"» + LexTerm : char_lit Λ<-> char_lit• «"|"» } Transitions: S132{ - LexTerm : ~ ( char_lit •- char_lit ) «]» - LexTerm : ~ ( char_lit •- char_lit ) «(» - LexTerm : ~ ( char_lit •- char_lit ) «.» - LexTerm : ~ ( char_lit •- char_lit ) «[» - LexTerm : ~ ( char_lit •- char_lit ) «char_lit» - LexTerm : ~ ( char_lit •- char_lit ) «regDefId» - LexTerm : ~ ( char_lit •- char_lit ) «{» - LexTerm : ~ ( char_lit •- char_lit ) «~» - LexTerm : ~ ( char_lit •- char_lit ) «|» + LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «"]"» + LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «"("» + LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «"."» + LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «"["» + LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «char_lit» + LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «regDefId» + LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «"{"» + LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «"~"» + LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «"|"» } Transitions: - - -> 144 + Λ<-> -> 144 S133{ - LexTerm : ( LexPattern )• «]» - LexTerm : ( LexPattern )• «(» - LexTerm : ( LexPattern )• «.» - LexTerm : ( LexPattern )• «[» - LexTerm : ( LexPattern )• «char_lit» - LexTerm : ( LexPattern )• «regDefId» - LexTerm : ( LexPattern )• «{» - LexTerm : ( LexPattern )• «~» - LexTerm : ( LexPattern )• «|» + LexTerm : Λ<(> Π Λ<)>• «"]"» + LexTerm : Λ<(> Π Λ<)>• «"("» + LexTerm : Λ<(> Π Λ<)>• «"."» + LexTerm : Λ<(> Π Λ<)>• «"["» + LexTerm : Λ<(> Π Λ<)>• «char_lit» + LexTerm : Λ<(> Π Λ<)>• «regDefId» + LexTerm : Λ<(> Π Λ<)>• «"{"» + LexTerm : Λ<(> Π Λ<)>• «"~"» + LexTerm : Λ<(> Π Λ<)>• «"|"» } Transitions: S134{ - LexTerm : [ LexPattern ]• «]» - LexTerm : [ LexPattern ]• «(» - LexTerm : [ LexPattern ]• «.» - LexTerm : [ LexPattern ]• «[» - LexTerm : [ LexPattern ]• «char_lit» - LexTerm : [ LexPattern ]• «regDefId» - LexTerm : [ LexPattern ]• «{» - LexTerm : [ LexPattern ]• «~» - LexTerm : [ LexPattern ]• «|» + LexTerm : Λ<[> Π Λ<]>• «"]"» + LexTerm : Λ<[> Π Λ<]>• «"("» + LexTerm : Λ<[> Π Λ<]>• «"."» + LexTerm : Λ<[> Π Λ<]>• «"["» + LexTerm : Λ<[> Π Λ<]>• «char_lit» + LexTerm : Λ<[> Π Λ<]>• «regDefId» + LexTerm : Λ<[> Π Λ<]>• «"{"» + LexTerm : Λ<[> Π Λ<]>• «"~"» + LexTerm : Λ<[> Π Λ<]>• «"|"» } Transitions: S135{ - LexTerm : { LexPattern }• «]» - LexTerm : { LexPattern }• «(» - LexTerm : { LexPattern }• «.» - LexTerm : { LexPattern }• «[» - LexTerm : { LexPattern }• «char_lit» - LexTerm : { LexPattern }• «regDefId» - LexTerm : { LexPattern }• «{» - LexTerm : { LexPattern }• «~» - LexTerm : { LexPattern }• «|» + LexTerm : Λ<{> Π Λ<}>• «"]"» + LexTerm : Λ<{> Π Λ<}>• «"("» + LexTerm : Λ<{> Π Λ<}>• «"."» + LexTerm : Λ<{> Π Λ<}>• «"["» + LexTerm : Λ<{> Π Λ<}>• «char_lit» + LexTerm : Λ<{> Π Λ<}>• «regDefId» + LexTerm : Λ<{> Π Λ<}>• «"{"» + LexTerm : Λ<{> Π Λ<}>• «"~"» + LexTerm : Λ<{> Π Λ<}>• «"|"» } Transitions: S136{ - LexPattern : LexPattern | LexAlt• «}» - LexPattern : LexPattern | LexAlt• «|» - LexAlt : LexAlt •LexTerm «}» - LexAlt : LexAlt •LexTerm «|» - LexAlt : LexAlt •LexTerm «(» - LexAlt : LexAlt •LexTerm «.» - LexAlt : LexAlt •LexTerm «[» - LexAlt : LexAlt •LexTerm «char_lit» - LexAlt : LexAlt •LexTerm «regDefId» - LexAlt : LexAlt •LexTerm «{» - LexAlt : LexAlt •LexTerm «~» - LexTerm : •. «}» - LexTerm : •char_lit «}» - LexTerm : •char_lit - char_lit «}» - LexTerm : •~ char_lit «}» - LexTerm : •~ ( char_lit - char_lit ) «}» - LexTerm : •regDefId «}» - LexTerm : •[ LexPattern ] «}» - LexTerm : •{ LexPattern } «}» - LexTerm : •( LexPattern ) «}» - LexTerm : •. «|» - LexTerm : •char_lit «|» - LexTerm : •char_lit - char_lit «|» - LexTerm : •~ char_lit «|» - LexTerm : •~ ( char_lit - char_lit ) «|» - LexTerm : •regDefId «|» - LexTerm : •[ LexPattern ] «|» - LexTerm : •{ LexPattern } «|» - LexTerm : •( LexPattern ) «|» - LexTerm : •. «(» - LexTerm : •char_lit «(» - LexTerm : •char_lit - char_lit «(» - LexTerm : •~ char_lit «(» - LexTerm : •~ ( char_lit - char_lit ) «(» - LexTerm : •regDefId «(» - LexTerm : •[ LexPattern ] «(» - LexTerm : •{ LexPattern } «(» - LexTerm : •( LexPattern ) «(» - LexTerm : •. «.» - LexTerm : •char_lit «.» - LexTerm : •char_lit - char_lit «.» - LexTerm : •~ char_lit «.» - LexTerm : •~ ( char_lit - char_lit ) «.» - LexTerm : •regDefId «.» - LexTerm : •[ LexPattern ] «.» - LexTerm : •{ LexPattern } «.» - LexTerm : •( LexPattern ) «.» - LexTerm : •. «[» - LexTerm : •char_lit «[» - LexTerm : •char_lit - char_lit «[» - LexTerm : •~ char_lit «[» - LexTerm : •~ ( char_lit - char_lit ) «[» - LexTerm : •regDefId «[» - LexTerm : •[ LexPattern ] «[» - LexTerm : •{ LexPattern } «[» - LexTerm : •( LexPattern ) «[» - LexTerm : •. «char_lit» + LexPattern : Π Λ<|> Π• «"}"» + LexPattern : Π Λ<|> Π• «"|"» + LexAlt : Π •Π «"}"» + LexAlt : Π •Π «"|"» + LexAlt : Π •Π «"("» + LexAlt : Π •Π «"."» + LexAlt : Π •Π «"["» + LexAlt : Π •Π «char_lit» + LexAlt : Π •Π «regDefId» + LexAlt : Π •Π «"{"» + LexAlt : Π •Π «"~"» + LexTerm : •Λ<.> «"}"» + LexTerm : •char_lit «"}"» + LexTerm : •char_lit Λ<-> char_lit «"}"» + LexTerm : •Λ<~> char_lit «"}"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"}"» + LexTerm : •regDefId «"}"» + LexTerm : •Λ<[> Π Λ<]> «"}"» + LexTerm : •Λ<{> Π Λ<}> «"}"» + LexTerm : •Λ<(> Π Λ<)> «"}"» + LexTerm : •Λ<.> «"|"» + LexTerm : •char_lit «"|"» + LexTerm : •char_lit Λ<-> char_lit «"|"» + LexTerm : •Λ<~> char_lit «"|"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"|"» + LexTerm : •regDefId «"|"» + LexTerm : •Λ<[> Π Λ<]> «"|"» + LexTerm : •Λ<{> Π Λ<}> «"|"» + LexTerm : •Λ<(> Π Λ<)> «"|"» + LexTerm : •Λ<.> «"("» + LexTerm : •char_lit «"("» + LexTerm : •char_lit Λ<-> char_lit «"("» + LexTerm : •Λ<~> char_lit «"("» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"("» + LexTerm : •regDefId «"("» + LexTerm : •Λ<[> Π Λ<]> «"("» + LexTerm : •Λ<{> Π Λ<}> «"("» + LexTerm : •Λ<(> Π Λ<)> «"("» + LexTerm : •Λ<.> «"."» + LexTerm : •char_lit «"."» + LexTerm : •char_lit Λ<-> char_lit «"."» + LexTerm : •Λ<~> char_lit «"."» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"."» + LexTerm : •regDefId «"."» + LexTerm : •Λ<[> Π Λ<]> «"."» + LexTerm : •Λ<{> Π Λ<}> «"."» + LexTerm : •Λ<(> Π Λ<)> «"."» + LexTerm : •Λ<.> «"["» + LexTerm : •char_lit «"["» + LexTerm : •char_lit Λ<-> char_lit «"["» + LexTerm : •Λ<~> char_lit «"["» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"["» + LexTerm : •regDefId «"["» + LexTerm : •Λ<[> Π Λ<]> «"["» + LexTerm : •Λ<{> Π Λ<}> «"["» + LexTerm : •Λ<(> Π Λ<)> «"["» + LexTerm : •Λ<.> «char_lit» LexTerm : •char_lit «char_lit» - LexTerm : •char_lit - char_lit «char_lit» - LexTerm : •~ char_lit «char_lit» - LexTerm : •~ ( char_lit - char_lit ) «char_lit» + LexTerm : •char_lit Λ<-> char_lit «char_lit» + LexTerm : •Λ<~> char_lit «char_lit» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «char_lit» LexTerm : •regDefId «char_lit» - LexTerm : •[ LexPattern ] «char_lit» - LexTerm : •{ LexPattern } «char_lit» - LexTerm : •( LexPattern ) «char_lit» - LexTerm : •. «regDefId» + LexTerm : •Λ<[> Π Λ<]> «char_lit» + LexTerm : •Λ<{> Π Λ<}> «char_lit» + LexTerm : •Λ<(> Π Λ<)> «char_lit» + LexTerm : •Λ<.> «regDefId» LexTerm : •char_lit «regDefId» - LexTerm : •char_lit - char_lit «regDefId» - LexTerm : •~ char_lit «regDefId» - LexTerm : •~ ( char_lit - char_lit ) «regDefId» + LexTerm : •char_lit Λ<-> char_lit «regDefId» + LexTerm : •Λ<~> char_lit «regDefId» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «regDefId» LexTerm : •regDefId «regDefId» - LexTerm : •[ LexPattern ] «regDefId» - LexTerm : •{ LexPattern } «regDefId» - LexTerm : •( LexPattern ) «regDefId» - LexTerm : •. «{» - LexTerm : •char_lit «{» - LexTerm : •char_lit - char_lit «{» - LexTerm : •~ char_lit «{» - LexTerm : •~ ( char_lit - char_lit ) «{» - LexTerm : •regDefId «{» - LexTerm : •[ LexPattern ] «{» - LexTerm : •{ LexPattern } «{» - LexTerm : •( LexPattern ) «{» - LexTerm : •. «~» - LexTerm : •char_lit «~» - LexTerm : •char_lit - char_lit «~» - LexTerm : •~ char_lit «~» - LexTerm : •~ ( char_lit - char_lit ) «~» - LexTerm : •regDefId «~» - LexTerm : •[ LexPattern ] «~» - LexTerm : •{ LexPattern } «~» - LexTerm : •( LexPattern ) «~» + LexTerm : •Λ<[> Π Λ<]> «regDefId» + LexTerm : •Λ<{> Π Λ<}> «regDefId» + LexTerm : •Λ<(> Π Λ<)> «regDefId» + LexTerm : •Λ<.> «"{"» + LexTerm : •char_lit «"{"» + LexTerm : •char_lit Λ<-> char_lit «"{"» + LexTerm : •Λ<~> char_lit «"{"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"{"» + LexTerm : •regDefId «"{"» + LexTerm : •Λ<[> Π Λ<]> «"{"» + LexTerm : •Λ<{> Π Λ<}> «"{"» + LexTerm : •Λ<(> Π Λ<)> «"{"» + LexTerm : •Λ<.> «"~"» + LexTerm : •char_lit «"~"» + LexTerm : •char_lit Λ<-> char_lit «"~"» + LexTerm : •Λ<~> char_lit «"~"» + LexTerm : •Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> «"~"» + LexTerm : •regDefId «"~"» + LexTerm : •Λ<[> Π Λ<]> «"~"» + LexTerm : •Λ<{> Π Λ<}> «"~"» + LexTerm : •Λ<(> Π Λ<)> «"~"» } Transitions: regDefId -> 76 - . -> 77 + Λ<.> -> 77 char_lit -> 78 - ~ -> 79 - ( -> 80 - [ -> 81 - { -> 82 - LexTerm -> 114 + Λ<~> -> 79 + Λ<(> -> 80 + Λ<[> -> 81 + Λ<{> -> 82 + Π -> 114 S137{ - LexTerm : char_lit - char_lit• «}» - LexTerm : char_lit - char_lit• «(» - LexTerm : char_lit - char_lit• «.» - LexTerm : char_lit - char_lit• «[» - LexTerm : char_lit - char_lit• «char_lit» - LexTerm : char_lit - char_lit• «regDefId» - LexTerm : char_lit - char_lit• «{» - LexTerm : char_lit - char_lit• «~» - LexTerm : char_lit - char_lit• «|» + LexTerm : char_lit Λ<-> char_lit• «"}"» + LexTerm : char_lit Λ<-> char_lit• «"("» + LexTerm : char_lit Λ<-> char_lit• «"."» + LexTerm : char_lit Λ<-> char_lit• «"["» + LexTerm : char_lit Λ<-> char_lit• «char_lit» + LexTerm : char_lit Λ<-> char_lit• «regDefId» + LexTerm : char_lit Λ<-> char_lit• «"{"» + LexTerm : char_lit Λ<-> char_lit• «"~"» + LexTerm : char_lit Λ<-> char_lit• «"|"» } Transitions: S138{ - LexTerm : ~ ( char_lit •- char_lit ) «}» - LexTerm : ~ ( char_lit •- char_lit ) «(» - LexTerm : ~ ( char_lit •- char_lit ) «.» - LexTerm : ~ ( char_lit •- char_lit ) «[» - LexTerm : ~ ( char_lit •- char_lit ) «char_lit» - LexTerm : ~ ( char_lit •- char_lit ) «regDefId» - LexTerm : ~ ( char_lit •- char_lit ) «{» - LexTerm : ~ ( char_lit •- char_lit ) «~» - LexTerm : ~ ( char_lit •- char_lit ) «|» + LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «"}"» + LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «"("» + LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «"."» + LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «"["» + LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «char_lit» + LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «regDefId» + LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «"{"» + LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «"~"» + LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «"|"» } Transitions: - - -> 145 + Λ<-> -> 145 S139{ - LexTerm : ( LexPattern )• «}» - LexTerm : ( LexPattern )• «(» - LexTerm : ( LexPattern )• «.» - LexTerm : ( LexPattern )• «[» - LexTerm : ( LexPattern )• «char_lit» - LexTerm : ( LexPattern )• «regDefId» - LexTerm : ( LexPattern )• «{» - LexTerm : ( LexPattern )• «~» - LexTerm : ( LexPattern )• «|» + LexTerm : Λ<(> Π Λ<)>• «"}"» + LexTerm : Λ<(> Π Λ<)>• «"("» + LexTerm : Λ<(> Π Λ<)>• «"."» + LexTerm : Λ<(> Π Λ<)>• «"["» + LexTerm : Λ<(> Π Λ<)>• «char_lit» + LexTerm : Λ<(> Π Λ<)>• «regDefId» + LexTerm : Λ<(> Π Λ<)>• «"{"» + LexTerm : Λ<(> Π Λ<)>• «"~"» + LexTerm : Λ<(> Π Λ<)>• «"|"» } Transitions: S140{ - LexTerm : [ LexPattern ]• «}» - LexTerm : [ LexPattern ]• «(» - LexTerm : [ LexPattern ]• «.» - LexTerm : [ LexPattern ]• «[» - LexTerm : [ LexPattern ]• «char_lit» - LexTerm : [ LexPattern ]• «regDefId» - LexTerm : [ LexPattern ]• «{» - LexTerm : [ LexPattern ]• «~» - LexTerm : [ LexPattern ]• «|» + LexTerm : Λ<[> Π Λ<]>• «"}"» + LexTerm : Λ<[> Π Λ<]>• «"("» + LexTerm : Λ<[> Π Λ<]>• «"."» + LexTerm : Λ<[> Π Λ<]>• «"["» + LexTerm : Λ<[> Π Λ<]>• «char_lit» + LexTerm : Λ<[> Π Λ<]>• «regDefId» + LexTerm : Λ<[> Π Λ<]>• «"{"» + LexTerm : Λ<[> Π Λ<]>• «"~"» + LexTerm : Λ<[> Π Λ<]>• «"|"» } Transitions: S141{ - LexTerm : { LexPattern }• «}» - LexTerm : { LexPattern }• «(» - LexTerm : { LexPattern }• «.» - LexTerm : { LexPattern }• «[» - LexTerm : { LexPattern }• «char_lit» - LexTerm : { LexPattern }• «regDefId» - LexTerm : { LexPattern }• «{» - LexTerm : { LexPattern }• «~» - LexTerm : { LexPattern }• «|» + LexTerm : Λ<{> Π Λ<}>• «"}"» + LexTerm : Λ<{> Π Λ<}>• «"("» + LexTerm : Λ<{> Π Λ<}>• «"."» + LexTerm : Λ<{> Π Λ<}>• «"["» + LexTerm : Λ<{> Π Λ<}>• «char_lit» + LexTerm : Λ<{> Π Λ<}>• «regDefId» + LexTerm : Λ<{> Π Λ<}>• «"{"» + LexTerm : Λ<{> Π Λ<}>• «"~"» + LexTerm : Λ<{> Π Λ<}>• «"|"» } Transitions: S142{ - LexTerm : ~ ( char_lit - char_lit •) «;» - LexTerm : ~ ( char_lit - char_lit •) «(» - LexTerm : ~ ( char_lit - char_lit •) «.» - LexTerm : ~ ( char_lit - char_lit •) «[» - LexTerm : ~ ( char_lit - char_lit •) «char_lit» - LexTerm : ~ ( char_lit - char_lit •) «regDefId» - LexTerm : ~ ( char_lit - char_lit •) «{» - LexTerm : ~ ( char_lit - char_lit •) «~» - LexTerm : ~ ( char_lit - char_lit •) «|» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «";"» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «"("» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «"."» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «"["» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «char_lit» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «regDefId» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «"{"» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «"~"» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «"|"» } Transitions: - ) -> 146 + Λ<)> -> 146 S143{ - LexTerm : ~ ( char_lit - •char_lit ) «)» - LexTerm : ~ ( char_lit - •char_lit ) «(» - LexTerm : ~ ( char_lit - •char_lit ) «.» - LexTerm : ~ ( char_lit - •char_lit ) «[» - LexTerm : ~ ( char_lit - •char_lit ) «char_lit» - LexTerm : ~ ( char_lit - •char_lit ) «regDefId» - LexTerm : ~ ( char_lit - •char_lit ) «{» - LexTerm : ~ ( char_lit - •char_lit ) «~» - LexTerm : ~ ( char_lit - •char_lit ) «|» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «")"» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «"("» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «"."» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «"["» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «char_lit» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «regDefId» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «"{"» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «"~"» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «"|"» } Transitions: char_lit -> 147 S144{ - LexTerm : ~ ( char_lit - •char_lit ) «]» - LexTerm : ~ ( char_lit - •char_lit ) «(» - LexTerm : ~ ( char_lit - •char_lit ) «.» - LexTerm : ~ ( char_lit - •char_lit ) «[» - LexTerm : ~ ( char_lit - •char_lit ) «char_lit» - LexTerm : ~ ( char_lit - •char_lit ) «regDefId» - LexTerm : ~ ( char_lit - •char_lit ) «{» - LexTerm : ~ ( char_lit - •char_lit ) «~» - LexTerm : ~ ( char_lit - •char_lit ) «|» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «"]"» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «"("» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «"."» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «"["» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «char_lit» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «regDefId» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «"{"» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «"~"» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «"|"» } Transitions: char_lit -> 148 S145{ - LexTerm : ~ ( char_lit - •char_lit ) «}» - LexTerm : ~ ( char_lit - •char_lit ) «(» - LexTerm : ~ ( char_lit - •char_lit ) «.» - LexTerm : ~ ( char_lit - •char_lit ) «[» - LexTerm : ~ ( char_lit - •char_lit ) «char_lit» - LexTerm : ~ ( char_lit - •char_lit ) «regDefId» - LexTerm : ~ ( char_lit - •char_lit ) «{» - LexTerm : ~ ( char_lit - •char_lit ) «~» - LexTerm : ~ ( char_lit - •char_lit ) «|» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «"}"» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «"("» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «"."» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «"["» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «char_lit» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «regDefId» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «"{"» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «"~"» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «"|"» } Transitions: char_lit -> 149 S146{ - LexTerm : ~ ( char_lit - char_lit )• «;» - LexTerm : ~ ( char_lit - char_lit )• «(» - LexTerm : ~ ( char_lit - char_lit )• «.» - LexTerm : ~ ( char_lit - char_lit )• «[» - LexTerm : ~ ( char_lit - char_lit )• «char_lit» - LexTerm : ~ ( char_lit - char_lit )• «regDefId» - LexTerm : ~ ( char_lit - char_lit )• «{» - LexTerm : ~ ( char_lit - char_lit )• «~» - LexTerm : ~ ( char_lit - char_lit )• «|» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)>• «";"» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)>• «"("» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)>• «"."» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)>• «"["» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)>• «char_lit» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)>• «regDefId» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)>• «"{"» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)>• «"~"» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)>• «"|"» } Transitions: S147{ - LexTerm : ~ ( char_lit - char_lit •) «)» - LexTerm : ~ ( char_lit - char_lit •) «(» - LexTerm : ~ ( char_lit - char_lit •) «.» - LexTerm : ~ ( char_lit - char_lit •) «[» - LexTerm : ~ ( char_lit - char_lit •) «char_lit» - LexTerm : ~ ( char_lit - char_lit •) «regDefId» - LexTerm : ~ ( char_lit - char_lit •) «{» - LexTerm : ~ ( char_lit - char_lit •) «~» - LexTerm : ~ ( char_lit - char_lit •) «|» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «")"» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «"("» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «"."» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «"["» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «char_lit» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «regDefId» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «"{"» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «"~"» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «"|"» } Transitions: - ) -> 150 + Λ<)> -> 150 S148{ - LexTerm : ~ ( char_lit - char_lit •) «]» - LexTerm : ~ ( char_lit - char_lit •) «(» - LexTerm : ~ ( char_lit - char_lit •) «.» - LexTerm : ~ ( char_lit - char_lit •) «[» - LexTerm : ~ ( char_lit - char_lit •) «char_lit» - LexTerm : ~ ( char_lit - char_lit •) «regDefId» - LexTerm : ~ ( char_lit - char_lit •) «{» - LexTerm : ~ ( char_lit - char_lit •) «~» - LexTerm : ~ ( char_lit - char_lit •) «|» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «"]"» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «"("» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «"."» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «"["» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «char_lit» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «regDefId» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «"{"» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «"~"» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «"|"» } Transitions: - ) -> 151 + Λ<)> -> 151 S149{ - LexTerm : ~ ( char_lit - char_lit •) «}» - LexTerm : ~ ( char_lit - char_lit •) «(» - LexTerm : ~ ( char_lit - char_lit •) «.» - LexTerm : ~ ( char_lit - char_lit •) «[» - LexTerm : ~ ( char_lit - char_lit •) «char_lit» - LexTerm : ~ ( char_lit - char_lit •) «regDefId» - LexTerm : ~ ( char_lit - char_lit •) «{» - LexTerm : ~ ( char_lit - char_lit •) «~» - LexTerm : ~ ( char_lit - char_lit •) «|» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «"}"» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «"("» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «"."» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «"["» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «char_lit» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «regDefId» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «"{"» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «"~"» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «"|"» } Transitions: - ) -> 152 + Λ<)> -> 152 S150{ - LexTerm : ~ ( char_lit - char_lit )• «)» - LexTerm : ~ ( char_lit - char_lit )• «(» - LexTerm : ~ ( char_lit - char_lit )• «.» - LexTerm : ~ ( char_lit - char_lit )• «[» - LexTerm : ~ ( char_lit - char_lit )• «char_lit» - LexTerm : ~ ( char_lit - char_lit )• «regDefId» - LexTerm : ~ ( char_lit - char_lit )• «{» - LexTerm : ~ ( char_lit - char_lit )• «~» - LexTerm : ~ ( char_lit - char_lit )• «|» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)>• «")"» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)>• «"("» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)>• «"."» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)>• «"["» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)>• «char_lit» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)>• «regDefId» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)>• «"{"» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)>• «"~"» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)>• «"|"» } Transitions: S151{ - LexTerm : ~ ( char_lit - char_lit )• «]» - LexTerm : ~ ( char_lit - char_lit )• «(» - LexTerm : ~ ( char_lit - char_lit )• «.» - LexTerm : ~ ( char_lit - char_lit )• «[» - LexTerm : ~ ( char_lit - char_lit )• «char_lit» - LexTerm : ~ ( char_lit - char_lit )• «regDefId» - LexTerm : ~ ( char_lit - char_lit )• «{» - LexTerm : ~ ( char_lit - char_lit )• «~» - LexTerm : ~ ( char_lit - char_lit )• «|» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)>• «"]"» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)>• «"("» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)>• «"."» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)>• «"["» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)>• «char_lit» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)>• «regDefId» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)>• «"{"» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)>• «"~"» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)>• «"|"» } Transitions: S152{ - LexTerm : ~ ( char_lit - char_lit )• «}» - LexTerm : ~ ( char_lit - char_lit )• «(» - LexTerm : ~ ( char_lit - char_lit )• «.» - LexTerm : ~ ( char_lit - char_lit )• «[» - LexTerm : ~ ( char_lit - char_lit )• «char_lit» - LexTerm : ~ ( char_lit - char_lit )• «regDefId» - LexTerm : ~ ( char_lit - char_lit )• «{» - LexTerm : ~ ( char_lit - char_lit )• «~» - LexTerm : ~ ( char_lit - char_lit )• «|» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)>• «"}"» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)>• «"("» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)>• «"."» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)>• «"["» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)>• «char_lit» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)>• «regDefId» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)>• «"{"» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)>• «"~"» + LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)>• «"|"» } Transitions: diff --git a/internal/frontend/reparsed/log/first.txt b/internal/frontend/reparsed/log/first.txt index 92d45df7..7cb6a40c 100644 --- a/internal/frontend/reparsed/log/first.txt +++ b/internal/frontend/reparsed/log/first.txt @@ -1,106 +1,105 @@ -S': { +Π: { g_sdt_lit ignoredTokId prodId regDefId tokId } -Grammar: { +Π: { g_sdt_lit ignoredTokId prodId regDefId tokId } -LexicalPart: { +Π: { ignoredTokId regDefId tokId } -LexProductions: { +Π: { + g_sdt_lit + prodId +} +Π: { ignoredTokId regDefId tokId } -LexProduction: { +Π: { ignoredTokId regDefId tokId } -LexPattern: { - ( - . - [ +Π: { char_lit regDefId - { - ~ + Λ<(> + Λ<.> + Λ<[> + Λ<{> + Λ<~> } -LexAlt: { - ( - . - [ +Π: { char_lit regDefId - { - ~ + Λ<(> + Λ<.> + Λ<[> + Λ<{> + Λ<~> } -LexTerm: { - ( - . - [ +Π: { char_lit regDefId - { - ~ -} -SyntaxPart: { - g_sdt_lit - prodId + Λ<(> + Λ<.> + Λ<[> + Λ<{> + Λ<~> } -FileHeader: { +Π: { g_sdt_lit } -SyntaxProdList: { +Π: { prodId } -SyntaxProduction: { +Π: { prodId } -Alternatives: { - empty - error +Π: { prodId string_lit tokId - | - ε - λ + Λ + Λ + Λ<ε> + Λ<λ> } -SyntaxBody: { - empty - error +Π: { prodId string_lit tokId - ε - λ + Λ + Λ + Λ<ε> + Λ<λ> } -Symbols: { +Π: { prodId string_lit tokId } -Symbol: { +Π: { + Λ + Λ<λ> +} +Π: { + Λ + Λ<ε> +} +Π: { prodId string_lit tokId } -ErrorSymbol: { - error - λ -} -EpsilonSymbol: { - empty - ε -} diff --git a/internal/frontend/reparsed/log/lexer_sets.txt b/internal/frontend/reparsed/log/lexer_sets.txt index 21b9a7c4..010eca47 100644 --- a/internal/frontend/reparsed/log/lexer_sets.txt +++ b/internal/frontend/reparsed/log/lexer_sets.txt @@ -14,22 +14,22 @@ S0{ g_sdt_lit : • '<' '<' . {.} '>' '>' string_lit : _raw_string | • _interpreted_string string_lit : • _raw_string | _interpreted_string - : : • ':' - ; : • ';' - | : • '|' - . : • '.' - - : • '-' - ~ : • '~' - ( : • '(' - ) : • ')' - [ : • '[' - ] : • ']' - { : • '{' - } : • '}' - error : • 'e' 'r' 'r' 'o' 'r' - λ : • \u03bb - empty : • 'e' 'm' 'p' 't' 'y' - ε : • \u03b5 + Λ<~> : • '~' + Λ<]> : • ']' + Λ<:> : • ':' + Λ<|> : • '|' + Λ<[> : • '[' + Λ<-> : • '-' + Λ<)> : • ')' + Λ : • 'e' 'r' 'r' 'o' 'r' + Λ<(> : • '(' + Λ<{> : • '{' + Λ : • 'e' 'm' 'p' 't' 'y' + Λ<ε> : • \u03b5 + Λ<;> : • ';' + Λ<}> : • '}' + Λ<.> : • '.' + Λ<λ> : • \u03bb _blockComment : • '/' '*' {. | '*'} '*' '/' _lineComment : • '/' '/' {.} '\n' _tokId : • _lowcase {_id_char} @@ -134,31 +134,31 @@ Action: nil Symbols classes: {['\','\']} S5{ - ( : '(' • + Λ<(> : '(' • } Transitions: -Action: Accept("(") +Action: Accept("Λ<(>") Symbols classes: {} S6{ - ) : ')' • + Λ<)> : ')' • } Transitions: -Action: Accept(")") +Action: Accept("Λ<)>") Symbols classes: {} S7{ - - : '-' • + Λ<-> : '-' • } Transitions: -Action: Accept("-") +Action: Accept("Λ<->") Symbols classes: {} S8{ - . : '.' • + Λ<.> : '.' • } Transitions: -Action: Accept(".") +Action: Accept("Λ<.>") Symbols classes: {} S9{ @@ -174,17 +174,17 @@ Action: nil Symbols classes: {['*','*'], ['/','/']} S10{ - : : ':' • + Λ<:> : ':' • } Transitions: -Action: Accept(":") +Action: Accept("Λ<:>") Symbols classes: {} S11{ - ; : ';' • + Λ<;> : ';' • } Transitions: -Action: Accept(";") +Action: Accept("Λ<;>") Symbols classes: {} S12{ @@ -216,17 +216,17 @@ Action: Accept("prodId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} S14{ - [ : '[' • + Λ<[> : '[' • } Transitions: -Action: Accept("[") +Action: Accept("Λ<[>") Symbols classes: {} S15{ - ] : ']' • + Λ<]> : ']' • } Transitions: -Action: Accept("]") +Action: Accept("Λ<]>") Symbols classes: {} S16{ @@ -282,8 +282,8 @@ Action: Accept("tokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} S19{ - error : 'e' • 'r' 'r' 'o' 'r' - empty : 'e' • 'm' 'p' 't' 'y' + Λ : 'e' • 'r' 'r' 'o' 'r' + Λ : 'e' • 'm' 'p' 't' 'y' _lowcase : 'a'-'z' • _tokId : _lowcase {_id_char} • _tokId : _lowcase {• _id_char} @@ -310,45 +310,45 @@ Action: Accept("tokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','l'], ['m','m'], ['n','q'], ['r','r'], ['s','z']} S20{ - { : '{' • + Λ<{> : '{' • } Transitions: -Action: Accept("{") +Action: Accept("Λ<{>") Symbols classes: {} S21{ - | : '|' • + Λ<|> : '|' • } Transitions: -Action: Accept("|") +Action: Accept("Λ<|>") Symbols classes: {} S22{ - } : '}' • + Λ<}> : '}' • } Transitions: -Action: Accept("}") +Action: Accept("Λ<}>") Symbols classes: {} S23{ - ~ : '~' • + Λ<~> : '~' • } Transitions: -Action: Accept("~") +Action: Accept("Λ<~>") Symbols classes: {} S24{ - ε : \u03b5 • + Λ<ε> : \u03b5 • } Transitions: -Action: Accept("ε") +Action: Accept("Λ<ε>") Symbols classes: {} S25{ - λ : \u03bb • + Λ<λ> : \u03bb • } Transitions: -Action: Accept("λ") +Action: Accept("Λ<λ>") Symbols classes: {} S26{ @@ -797,7 +797,7 @@ Action: Accept("tokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} S48{ - empty : 'e' 'm' • 'p' 't' 'y' + Λ : 'e' 'm' • 'p' 't' 'y' _lowcase : 'a'-'z' • _id_char : (_upcase | _lowcase | '_' | _digit) • _tokId : _lowcase {_id_char} • @@ -823,7 +823,7 @@ Action: Accept("tokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','o'], ['p','p'], ['q','z']} S49{ - error : 'e' 'r' • 'r' 'o' 'r' + Λ : 'e' 'r' • 'r' 'o' 'r' _lowcase : 'a'-'z' • _id_char : (_upcase | _lowcase | '_' | _digit) • _tokId : _lowcase {_id_char} • @@ -1133,7 +1133,7 @@ Action: nil Symbols classes: {['>','>']} S68{ - empty : 'e' 'm' 'p' • 't' 'y' + Λ : 'e' 'm' 'p' • 't' 'y' _lowcase : 'a'-'z' • _id_char : (_upcase | _lowcase | '_' | _digit) • _tokId : _lowcase {_id_char} • @@ -1159,7 +1159,7 @@ Action: Accept("tokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','s'], ['t','t'], ['u','z']} S69{ - error : 'e' 'r' 'r' • 'o' 'r' + Λ : 'e' 'r' 'r' • 'o' 'r' _lowcase : 'a'-'z' • _id_char : (_upcase | _lowcase | '_' | _digit) • _tokId : _lowcase {_id_char} • @@ -1325,7 +1325,7 @@ Action: nil Symbols classes: {['>','>']} S80{ - empty : 'e' 'm' 'p' 't' • 'y' + Λ : 'e' 'm' 'p' 't' • 'y' _lowcase : 'a'-'z' • _id_char : (_upcase | _lowcase | '_' | _digit) • _tokId : _lowcase {_id_char} • @@ -1351,7 +1351,7 @@ Action: Accept("tokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','x'], ['y','y'], ['z','z']} S81{ - error : 'e' 'r' 'r' 'o' • 'r' + Λ : 'e' 'r' 'r' 'o' • 'r' _lowcase : 'a'-'z' • _id_char : (_upcase | _lowcase | '_' | _digit) • _tokId : _lowcase {_id_char} • @@ -1526,7 +1526,7 @@ Action: Accept("g_sdt_lit") Symbols classes: {} S91{ - empty : 'e' 'm' 'p' 't' 'y' • + Λ : 'e' 'm' 'p' 't' 'y' • _lowcase : 'a'-'z' • _id_char : (_upcase | _lowcase | '_' | _digit) • _tokId : _lowcase {_id_char} • @@ -1546,11 +1546,11 @@ Transitions: ['A','Z'] -> S45 ['_','_'] -> S46 ['a','z'] -> S47 -Action: Accept("empty") +Action: Accept("Λ") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} S92{ - error : 'e' 'r' 'r' 'o' 'r' • + Λ : 'e' 'r' 'r' 'o' 'r' • _lowcase : 'a'-'z' • _id_char : (_upcase | _lowcase | '_' | _digit) • _tokId : _lowcase {_id_char} • @@ -1570,7 +1570,7 @@ Transitions: ['A','Z'] -> S45 ['_','_'] -> S46 ['a','z'] -> S47 -Action: Accept("error") +Action: Accept("Λ") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} S93{ diff --git a/internal/frontend/reparsed/log/terminals.txt b/internal/frontend/reparsed/log/terminals.txt index 423e5ee9..528a8226 100644 --- a/internal/frontend/reparsed/log/terminals.txt +++ b/internal/frontend/reparsed/log/terminals.txt @@ -1,25 +1,25 @@ - Ω tokId -: -; +":" +";" regDefId ignoredTokId -| -. +"|" +"." char_lit -- -~ -( -) -[ -] -{ -} +"-" +"~" +"(" +")" +"[" +"]" +"{" +"}" g_sdt_lit prodId string_lit -error -λ -empty -ε +"error" +"λ" +"empty" +"ε" diff --git a/internal/lexer/gen/golang/acttab.go b/internal/lexer/gen/golang/acttab.go index fd23eb5f..df60f248 100644 --- a/internal/lexer/gen/golang/acttab.go +++ b/internal/lexer/gen/golang/acttab.go @@ -40,26 +40,32 @@ func genActionTable(pkg, outDir string, itemsets *items.ItemSets, tokMap *token. func getActTab(pkg, subpath string, itemsets *items.ItemSets, tokMap *token.TokenMap) *actTab { actab := &actTab{ TokenImport: path.Join(pkg, subpath, "token"), - Actions: make([]action, itemsets.Size()), + Actions: make([]actTabEntry, itemsets.Size()), } for sno, set := range itemsets.List() { if act := set.Action(); act != nil { switch act1 := act.(type) { case items.Accept: - actab.Actions[sno].Accept = tokMap.IdMap[string(act1)] - actab.Actions[sno].Ignore = "" + actab.Actions[sno].Symbol = act1.String() + actab.Actions[sno].Action.Accept = tokMap.IdMap[string(act1)] + actab.Actions[sno].Action.Ignore = "" case items.Ignore: - actab.Actions[sno].Accept = -1 - actab.Actions[sno].Ignore = string(act1) + actab.Actions[sno].Symbol = act1.String() + actab.Actions[sno].Action.Accept = -1 + actab.Actions[sno].Action.Ignore = string(act1) } } } return actab } +type actTabEntry struct { + Action action + Symbol string +} type actTab struct { TokenImport string - Actions []action + Actions []actTabEntry } type action struct { @@ -91,9 +97,9 @@ func (a ActionRow) String() string { var ActTab = ActionTable{ {{- range $s, $act := .Actions}} - ActionRow{ // S{{$s}} - Accept: {{$act.Accept}}, - Ignore: "{{$act.Ignore}}", + ActionRow{ // S{{$s}}, {{$act.Symbol}} + Accept: {{$act.Action.Accept}}, + Ignore: "{{$act.Action.Ignore}}", }, {{- end}} } diff --git a/internal/parser/first/first.go b/internal/parser/first/first.go index fa03e030..0330c8fd 100644 --- a/internal/parser/first/first.go +++ b/internal/parser/first/first.go @@ -18,8 +18,6 @@ import ( "fmt" "strings" - "github.com/maxcalandrelli/gocc/internal/config" - "github.com/maxcalandrelli/gocc/internal/ast" "github.com/maxcalandrelli/gocc/internal/parser/symbols" ) @@ -48,17 +46,17 @@ func GetFirstSets(g *ast.Grammar, symbols *symbols.Symbols) *FirstSets { for _, prod := range g.SyntaxPart.ProdList { switch { case prod.Body.Empty(): - if firstSets.AddToken(prod.Id, ast.EmptySymbol) { + if firstSets.AddToken(prod.Id.SymbolName(), ast.EmptySymbol) { again = true } - case symbols.IsTerminal(prod.Body.Symbols[0].SymbolString()): - if firstSets.AddToken(prod.Id, prod.Body.Symbols[0]) { + case prod.Body.Symbols[0].IsTerminal(): + if firstSets.AddToken(prod.Id.SymbolName(), prod.Body.Symbols[0]) { again = true } default: - first := FirstS(firstSets, stringList(prod.Body.Symbols)) - if !first.Equal(firstSets.GetSet(prod.Id)) { - if firstSets.AddSet(prod.Id, first) { + first := FirstS(firstSets, prod.Body.Symbols) + if !first.Equal(firstSets.GetSet(prod.Id.SymbolName())) { + if firstSets.AddSet(prod.Id.SymbolName(), first) { again = true } } @@ -69,7 +67,7 @@ func GetFirstSets(g *ast.Grammar, symbols *symbols.Symbols) *FirstSets { return firstSets } -func stringList(symbols []ast.SyntaxSymbol) []string { +func stringList(symbols ast.SyntaxSymbols) []string { sl := make([]string, len(symbols)) for i, sym := range symbols { sl[i] = sym.SymbolString() @@ -111,18 +109,18 @@ func (this *FirstSets) GetSet(prodName string) SymbolSet { func (this *FirstSets) String() string { buf := new(strings.Builder) for _, nt := range this.symbols.NTList() { - set := this.firstSets[nt] - fmt.Fprintf(buf, "%s: %s\n", nt, set) + set := this.firstSets[nt.SymbolName()] + fmt.Fprintf(buf, "%s: %s\n", nt.SymbolName(), set) } return buf.String() } //Returns the First SymbolSet given the ast.SyntaxSymbol. func First(fs *FirstSets, sym ast.SyntaxSymbol) SymbolSet { - if fs.symbols.IsTerminal(sym) { + if sym.IsTerminal() { return SymbolSet{sym: struct{}{}} } - return fs.GetSet(sym) + return fs.GetSet(sym.SymbolName()) } /* @@ -137,21 +135,21 @@ Returns First of the string, xyz, e.g.: for the item, ... First(x) + First(y) + ... + First(z) */ -func FirstS(firstSets *FirstSets, symbols []string) (first SymbolSet) { +func FirstS(firstSets *FirstSets, symbols ast.SyntaxSymbols) (first SymbolSet) { first = make(SymbolSet) if len(symbols) == 0 { return } fst := First(firstSets, symbols[0]) first.AddSet(fst) - _, containEmpty := fst[config.SYMBOL_EMPTY] + _, containEmpty := fst[ast.EmptySymbol] for i := 1; i < len(symbols) && containEmpty; i++ { fst = First(firstSets, symbols[i]) first.AddSet(fst) - _, containEmpty = fst[config.SYMBOL_EMPTY] + _, containEmpty = fst[ast.EmptySymbol] } if !containEmpty { - delete(first, config.SYMBOL_EMPTY) + delete(first, ast.EmptySymbol) } return } diff --git a/internal/parser/first/symbolset.go b/internal/parser/first/symbolset.go index bc4ce7be..d35613c5 100644 --- a/internal/parser/first/symbolset.go +++ b/internal/parser/first/symbolset.go @@ -50,7 +50,7 @@ func (this SymbolSet) String() string { fmt.Fprintf(buf, "{\n") var keys []string for key := range this { - keys = append(keys, key) + keys = append(keys, key.SymbolName()) } sort.Strings(keys) for _, str := range keys { diff --git a/internal/parser/gen/golang/gototable.go b/internal/parser/gen/golang/gototable.go index 83d48b2f..54878c13 100644 --- a/internal/parser/gen/golang/gototable.go +++ b/internal/parser/gen/golang/gototable.go @@ -69,7 +69,7 @@ func getGotoRowData(itemSet *items.ItemSet, sym *symbols.Symbols) []gotoRowEleme row := make([]gotoRowElement, sym.NumNTSymbols()) var max int for i, nt := range sym.NTList() { - row[i].NT = nt + row[i].NT = nt.SymbolName() row[i].State = itemSet.NextSetIndex(nt) n := nbytes(row[i].State) if n > max { diff --git a/internal/parser/gen/golang/productionstable.go b/internal/parser/gen/golang/productionstable.go index 9dab7562..70e6368f 100644 --- a/internal/parser/gen/golang/productionstable.go +++ b/internal/parser/gen/golang/productionstable.go @@ -51,8 +51,8 @@ func getProdsTab(header string, prods ast.SyntaxProdList, symbols *symbols.Symbo } for i, prod := range prods { data.ProdTab[i].String = fmt.Sprintf("`%s`", prod.String()) - data.ProdTab[i].Id = prod.Id - data.ProdTab[i].NTType = symbols.NTType(prod.Id) + data.ProdTab[i].Id = prod.Id.SymbolString() + data.ProdTab[i].NTType = symbols.NTType(prod.Id.SymbolString()) isEmpty := prod.Body.Empty() if isEmpty { data.ProdTab[i].NumSymbols = 0 diff --git a/internal/parser/lr1/items/item.go b/internal/parser/lr1/items/item.go index bf060e66..8978c2fc 100644 --- a/internal/parser/lr1/items/item.go +++ b/internal/parser/lr1/items/item.go @@ -28,19 +28,19 @@ import ( type Item struct { ProdIdx int // index in list of productions in Grammar.Prod Prod *ast.SyntaxProd // The syntax production of this item - Id string - Body []string - Pos int // position of • in the item - ExpectedSymbol string // the next exptect symbol in the item, if this isn't a reduce item. - FollowingSymbol string // The next expected symbol after the item has been recognised - Len int // the number of symbols making up the body + Id ast.SyntaxSymbol + Body ast.SyntaxSymbols + Pos int // position of • in the item + ExpectedSymbol ast.SyntaxSymbol // the next expected symbol in the item, if this isn't a reduce item. + FollowingSymbol ast.SyntaxSymbol // The next expected symbol after the item has been recognised + Len int // the number of symbols making up the body str string } /* following symbol: the symbol expected after this item has been reduced */ -func NewItem(prodIdx int, prod *ast.SyntaxProd, pos int, followingSymbol string) *Item { +func NewItem(prodIdx int, prod *ast.SyntaxProd, pos int, followingSymbol ast.SyntaxSymbol) *Item { item := &Item{ ProdIdx: prodIdx, Prod: prod, @@ -56,34 +56,31 @@ func NewItem(prodIdx int, prod *ast.SyntaxProd, pos int, followingSymbol string) if pos > item.Len { panic(fmt.Sprintf("%s : %s, pos=%d", item.Id, item.Body, item.Pos)) } - item.Body = make([]string, item.Len) + item.Body = make(ast.SyntaxSymbols, item.Len) if item.Len > 0 { for i, sym := range prod.Body.Symbols { - item.Body[i] = sym.SymbolString() + item.Body[i] = sym } } if item.Len > 0 && item.Pos < item.Len { item.ExpectedSymbol = item.Body[item.Pos] } else { - item.ExpectedSymbol = "" + item.ExpectedSymbol = nil } item.str = item.getString() return item } -func (this *Item) accept(sym string) bool { - return this.ProdIdx == 0 && - this.Pos >= this.Len && - config.SYMBOL_EOF == this.FollowingSymbol && - config.SYMBOL_EOF == sym +func (this *Item) accept(sym ast.SyntaxSymbol) bool { + return this.ProdIdx == 0 && this.Pos >= this.Len && ast.EofSymbol == this.FollowingSymbol && ast.EofSymbol == sym } /* If the action is shift the next state is nextState */ -func (this *Item) action(sym string, nextState int) action.Action { +func (this *Item) action(sym ast.SyntaxSymbol, nextState int) action.Action { switch { - case config.SYMBOL_INVALID == sym: + case ast.InvalidSyntaxSymbol{} == sym: return action.ERROR case this.accept(sym): return action.ACCEPT @@ -96,7 +93,7 @@ func (this *Item) action(sym string, nextState int) action.Action { } func (this *Item) canRecover() bool { - return this.Len > 0 && config.SYMBOL_ERROR == this.Body[0] + return this.Len > 0 && ast.ErrorSymbol == this.Body[0] } //Returns whether two Items are equal based on their ProdIdx, Pos and NextToken. @@ -121,7 +118,7 @@ func (this *Item) reduce() bool { return this.Len == 0 || this.Pos >= this.Len } -func (this *Item) Symbol(i int) string { +func (this *Item) Symbol(i int) ast.SyntaxSymbol { return this.Body[i] } @@ -135,7 +132,7 @@ func (this *Item) getString() string { if this.Pos == i { fmt.Fprintf(buf, "•") } - fmt.Fprintf(buf, s) + fmt.Fprintf(buf, s.SymbolName()) if i < this.Len-1 { fmt.Fprintf(buf, " ") } diff --git a/internal/parser/lr1/items/itemset.go b/internal/parser/lr1/items/itemset.go index 5c76ca95..de757087 100644 --- a/internal/parser/lr1/items/itemset.go +++ b/internal/parser/lr1/items/itemset.go @@ -30,7 +30,7 @@ type ItemSet struct { imap map[string]*Item Items []*Item // string: symbol, int: nextState - Transitions map[string]int + Transitions map[ast.SyntaxSymbol]int Symbols *symbols.Symbols Prods ast.SyntaxProdList @@ -43,14 +43,14 @@ func NewItemSet(symbols *symbols.Symbols, prods ast.SyntaxProdList, fs *first.Fi SetNo: -1, imap: make(map[string]*Item), Items: make([]*Item, 0, 16), - Transitions: make(map[string]int), + Transitions: make(map[ast.SyntaxSymbol]int), Symbols: symbols, Prods: prods, FS: fs, } } -func (this *ItemSet) Action(symbol string) (act1 action.Action, conflicts []action.Action) { +func (this *ItemSet) Action(symbol ast.SyntaxSymbol) (act1 action.Action, conflicts []action.Action) { conflictMap := make(map[string]action.Action) act1 = action.ERROR for _, item := range this.Items { @@ -85,7 +85,7 @@ func (this *ItemSet) AddItem(items ...*Item) { } -func (this *ItemSet) AddTransition(symbol string, nextSet int) { +func (this *ItemSet) AddTransition(symbol ast.SyntaxSymbol, nextSet int) { if _, exist := this.Transitions[symbol]; exist { panic(fmt.Sprintf("Transition %s -> %d already exists", symbol, nextSet)) } @@ -101,7 +101,7 @@ func (this *ItemSet) CanRecover() bool { return false } -func (this *ItemSet) NextSetIndex(symbol string) int { +func (this *ItemSet) NextSetIndex(symbol ast.SyntaxSymbol) int { if nextSet, exist := this.Transitions[symbol]; exist { return nextSet } @@ -130,7 +130,7 @@ func (this *ItemSet) Closure() (c *ItemSet) { again = false for idx, i := range c.Items { if idx > included { - if i.Pos >= i.Len || this.Symbols.IsTerminal(i.ExpectedSymbol) { + if i.Pos >= i.Len || i.ExpectedSymbol.IsTerminal() { continue } for pi, prod := range this.Prods { @@ -182,18 +182,18 @@ func (this *ItemSet) Equal(that *ItemSet) bool { // first1 returns the characters contained within the first set, sorted in // alphabetical order. -func first1(firstSets *first.FirstSets, symbols []string, following string) []string { +func first1(firstSets *first.FirstSets, symbols ast.SyntaxSymbols, following ast.SyntaxSymbol) ast.SyntaxSymbols { firsts := first.FirstS(firstSets, append(symbols, following)) - var keys []string + keys := ast.SyntaxSymbolsByName{} for key := range firsts { keys = append(keys, key) } - sort.Strings(keys) - return keys + sort.Sort(&keys) + return ast.SyntaxSymbols(keys) } // Dragon book, 2nd ed, section 4.7.2, p261 -func (I *ItemSet) Goto(X string) *ItemSet { +func (I *ItemSet) Goto(X ast.SyntaxSymbol) *ItemSet { J := NewItemSet(I.Symbols, I.Prods, I.FS) for _, item := range I.Items { if item.Pos < item.Len && X == item.ExpectedSymbol { @@ -224,7 +224,7 @@ func (this *ItemSet) String() string { fmt.Fprintf(buf, "Transitions:\n") var keys transitions for sym, set := range this.Transitions { - key := transition{symbol: sym, nextState: set} + key := transition{symbol: sym.SymbolName(), nextState: set} keys = append(keys, key) } sort.Sort(keys) diff --git a/internal/parser/lr1/items/itemsets.go b/internal/parser/lr1/items/itemsets.go index 2212e7c8..ff5e3ea5 100644 --- a/internal/parser/lr1/items/itemsets.go +++ b/internal/parser/lr1/items/itemsets.go @@ -18,8 +18,6 @@ import ( "fmt" "strings" - "github.com/maxcalandrelli/gocc/internal/config" - "github.com/maxcalandrelli/gocc/internal/ast" "github.com/maxcalandrelli/gocc/internal/parser/first" "github.com/maxcalandrelli/gocc/internal/parser/symbols" @@ -120,6 +118,6 @@ func InitialItemSet(g *ast.Grammar, symbols *symbols.Symbols, fs *first.FirstSet set := NewItemSet(symbols, g.SyntaxPart.ProdList, fs) set.SetNo = 0 prod := g.SyntaxPart.ProdList[0] - set.AddItem(NewItem(0, prod, 0, config.SYMBOL_EOF)) + set.AddItem(NewItem(0, prod, 0, ast.EofSymbol)) return set } diff --git a/internal/parser/lr1/items/rowconflicts.go b/internal/parser/lr1/items/rowconflicts.go index b5697b00..2af790b5 100644 --- a/internal/parser/lr1/items/rowconflicts.go +++ b/internal/parser/lr1/items/rowconflicts.go @@ -15,6 +15,7 @@ package items import ( + "github.com/maxcalandrelli/gocc/internal/ast" "github.com/maxcalandrelli/gocc/internal/parser/lr1/action" ) @@ -22,4 +23,4 @@ import ( key: symbol value: list of actions */ -type RowConflicts map[string][]action.Action +type RowConflicts map[ast.SyntaxSymbol][]action.Action diff --git a/internal/parser/symbols/symbols.go b/internal/parser/symbols/symbols.go index d90bf9c1..b9cd4e67 100644 --- a/internal/parser/symbols/symbols.go +++ b/internal/parser/symbols/symbols.go @@ -21,68 +21,37 @@ import ( "fmt" "strings" - "github.com/maxcalandrelli/gocc/internal/config" - "github.com/maxcalandrelli/gocc/internal/ast" ) type Symbols struct { - //key: symbol id - //val: symbol type - idMap map[string]int - - //key: symbol ntTypeMap index - //val: symbol type - ntIdMap map[string]int - ntTypeMap []string - - //key: symbol id - //val: symbol type - stringLitIdMap map[string]int - stringLitList []string - - //key: symbol type - //val: symbol id - typeMap []ast.SyntaxSymbol + tSymbols ast.SyntaxSymbols + ntSymbols ast.SyntaxSymbols + symbols map[ast.SyntaxSymbol]struct{} + literalType map[string]int + nonTerminalType map[string]int } func NewSymbols(grammar *ast.Grammar) *Symbols { symbols := &Symbols{ - idMap: make(map[string]int), - typeMap: make([]ast.SyntaxSymbol, 0, 16), - ntIdMap: make(map[string]int), - ntTypeMap: make([]string, 0, 16), - stringLitIdMap: make(map[string]int), - stringLitList: make([]string, 0, 16), + symbols: make(map[ast.SyntaxSymbol]struct{}), + tSymbols: make(ast.SyntaxSymbols, 0, 16), + ntSymbols: make(ast.SyntaxSymbols, 0, 16), + literalType: make(map[string]int), + nonTerminalType: make(map[string]int), } - symbols.Add(ast.NewStringLitFromString(config.INTERNAL_SYMBOL_INVALID)) - symbols.Add(ast.ErrorSymbol) + symbols.Add(ast.InvalidSyntaxSymbol{}) + symbols.Add(ast.EofSymbol) if grammar.SyntaxPart == nil { return symbols } for _, p := range grammar.SyntaxPart.ProdList { - if _, exist := symbols.ntIdMap[p.Id]; !exist { - symbols.ntTypeMap = append(symbols.ntTypeMap, p.Id) - symbols.ntIdMap[p.Id] = len(symbols.ntTypeMap) - 1 - } symbols.Add(p.Id) - } - for _, p := range grammar.SyntaxPart.ProdList { for _, sym := range p.Body.Symbols { - symStr := sym.SymbolString() - symbols.Add(symStr) - if _, ok := sym.(ast.SyntaxStringLit); ok { - if _, exist := symbols.ntIdMap[symStr]; exist { - panic(fmt.Sprintf("string_lit \"%s\" conflicts with production name %s", symStr, symStr)) - } - if _, exist := symbols.stringLitIdMap[symStr]; !exist { - symbols.stringLitIdMap[symStr] = symbols.Type(symStr) - symbols.stringLitList = append(symbols.stringLitList, symStr) - } - } + symbols.Add(sym) } } return symbols @@ -90,44 +59,54 @@ func NewSymbols(grammar *ast.Grammar) *Symbols { func (this *Symbols) Add(symbols ...ast.SyntaxSymbol) { for _, sym := range symbols { - if _, exist := this.idMap[sym]; !exist { - this.typeMap = append(this.typeMap, sym) - this.idMap[sym] = len(this.typeMap) - 1 + if _, exist := this.symbols[sym]; !exist { + if sym.IsTerminal() { + id := len(this.tSymbols) + this.symbols[sym] = struct{}{} + this.tSymbols = append(this.tSymbols, sym) + this.literalType[sym.SymbolString()] = id + } else if sym.IsNonTerminal() { + id := len(this.ntSymbols) + this.symbols[sym] = struct{}{} + this.ntSymbols = append(this.ntSymbols, sym) + this.nonTerminalType[sym.SymbolString()] = id + } } } } -func (this *Symbols) Id(typ int) string { - return this.typeMap[typ] -} - -func (this *Symbols) IsTerminal(sym ast.SyntaxSymbol) bool { - return sym.IsTerminal() +func (this *Symbols) List() ast.SyntaxSymbols { + return append(this.ntSymbols, this.tSymbols...) } -func (this *Symbols) List() []string { - return this.typeMap +func (this *Symbols) listMatchingSymbols(match func(ast.SyntaxSymbol) bool) ast.SyntaxSymbols { + res := make(ast.SyntaxSymbols, 0, 16) + for sym := range this.symbols { + if match(sym) { + res = append(res, sym) + } + } + return res } /* Return a slice containing the ids of all symbols declared as string literals in the grammar. */ -func (this *Symbols) ListStringLitSymbols() []string { - return this.stringLitList +func (this *Symbols) ListStringLitSymbols() ast.SyntaxSymbols { + return this.listMatchingSymbols(func(s ast.SyntaxSymbol) bool { + _, r := s.(ast.SyntaxStringLit) + return r + }) } -func (this *Symbols) ListTerminals() []*ast.SyntaxSymbol { - terminals := make([]string, 0, 16) - for _, sym := range this.typeMap { - if this.IsTerminal(sym) { - terminals = append(terminals, sym) - } - } - return terminals +func (this *Symbols) ListTerminals() ast.SyntaxSymbols { + ret := ast.SyntaxSymbolsByName(this.tSymbols) + //sort.Sort(&ret) + return ast.SyntaxSymbols(ret) } func (this *Symbols) StringLitType(id string) int { - if typ, exist := this.stringLitIdMap[id]; exist { + if typ, exist := this.literalType[id]; exist { return typ } return -1 @@ -137,31 +116,33 @@ func (this *Symbols) StringLitType(id string) int { Return the id of the NT with index idx, or "" if there is no NT symbol with index, idx. */ func (this *Symbols) NTId(idx int) string { - if idx < 0 || idx >= len(this.ntTypeMap) { + if idx < 0 || idx >= len(this.nonTerminalType) { return "" } - return this.ntTypeMap[idx] + return this.ntSymbols[idx].SymbolName() } /* Return the number of NT symbols in the grammar */ func (this *Symbols) NumNTSymbols() int { - return len(this.ntTypeMap) + return len(this.ntSymbols) } /* Returns a slice containing all the non-terminal symbols of the grammar. */ -func (this *Symbols) NTList() []string { - return this.ntTypeMap +func (this *Symbols) NTList() ast.SyntaxSymbols { + ret := ast.SyntaxSymbolsByName(this.ntSymbols) + //sort.Sort(&ret) + return ast.SyntaxSymbols(ret) } /* Returns the NT index of a symbol (index in 0..|NT|-1) or -1 if the symbol is not in NT. */ func (this *Symbols) NTType(symbol string) int { - if idx, exist := this.ntIdMap[symbol]; exist { + if idx, exist := this.nonTerminalType[symbol]; exist { return idx } return -1 @@ -171,20 +152,22 @@ func (this *Symbols) NTType(symbol string) int { Returns the total number of symbols in grammar: the sum of the terminals and non-terminals. */ func (this *Symbols) NumSymbols() int { - return len(this.typeMap) + return len(this.symbols) } func (this *Symbols) String() string { w := new(strings.Builder) - for i, sym := range this.typeMap { - fmt.Fprintf(w, "%3d: %s\n", i, sym) + for i, sym := range this.List() { + fmt.Fprintf(w, "%3d: %s\n", i, sym.SymbolName()) } return w.String() } -func (this *Symbols) Type(id string) int { - if typ, ok := this.idMap[id]; ok { +/* +func (this *Symbols) Type(id ast.SyntaxSymbol) int { + if typ, ok := this.idMap[id.SymbolName()]; ok { return typ } return -1 } +*/ diff --git a/internal/token/gen/golang/token.go b/internal/token/gen/golang/token.go index d8cc6a54..0a60aeb6 100644 --- a/internal/token/gen/golang/token.go +++ b/internal/token/gen/golang/token.go @@ -32,19 +32,27 @@ func GenToken(pkg, outdir string, tokMap *token.TokenMap, subpath string) { panic(err) } buf := new(bytes.Buffer) - err = tmpl.Execute(buf, TokenData{TypMap: tokMap.TypeMap, IdMap: typeMap(tokMap)}) + err = tmpl.Execute(buf, TokenData{TypMap: makeTypeMap(tokMap), IdMap: makeIdMap(tokMap)}) // Use go/format to indent the idMap literal correctly. source, err := format.Source(buf.Bytes()) if err != nil { - panic(err) + panic(fmt.Sprintf("%s in \n%s", err.Error(), buf.String())) } io.WriteFile(tokenPath, source) } -func typeMap(tokMap *token.TokenMap) []string { +func makeIdMap(tokMap *token.TokenMap) []string { + tm := make([]string, len(tokMap.TypeMap)) + for i, sym := range tokMap.TypeMap { + tm[i] = fmt.Sprintf("\"%s\": %d", sym.SymbolName(), i) + } + return tm +} + +func makeTypeMap(tokMap *token.TokenMap) []string { tm := make([]string, len(tokMap.TypeMap)) for i, sym := range tokMap.TypeMap { - tm[i] = fmt.Sprintf("\"%s\": %d", sym, i) + tm[i] = fmt.Sprintf("\"%s\"", sym.SymbolName()) } return tm } @@ -125,7 +133,7 @@ func (m TokenMap) StringType(typ Type) string { var TokMap = TokenMap{ typeMap: []string{ {{- range .TypMap }} - {{printf "%q" .}}, + {{printf "%s" .}}, {{- end }} }, diff --git a/internal/token/tokenmap.go b/internal/token/tokenmap.go index 1fa15b5a..a6023900 100644 --- a/internal/token/tokenmap.go +++ b/internal/token/tokenmap.go @@ -14,19 +14,23 @@ package token +import ( + "github.com/maxcalandrelli/gocc/internal/ast" +) + type TokenMap struct { IdMap map[string]int - TypeMap []string + TypeMap []ast.SyntaxSymbol } -func NewTokenMap(symbols []string) *TokenMap { +func NewTokenMap(symbols ast.SyntaxSymbols) *TokenMap { tm := &TokenMap{ IdMap: make(map[string]int), - TypeMap: make([]string, len(symbols)), + TypeMap: make([]ast.SyntaxSymbol, len(symbols)), } for i, sym := range symbols { - tm.IdMap[sym] = i + tm.IdMap[sym.SymbolName()] = i tm.TypeMap[i] = sym } return tm diff --git a/spec/gocc2.ebnf b/spec/gocc2.ebnf index 5fe23775..9ec40c87 100644 --- a/spec/gocc2.ebnf +++ b/spec/gocc2.ebnf @@ -15,7 +15,7 @@ -!comment : _lineComment | _blockComment ; +!comment : _lineComment | _blockComment ; !whitespace : ' ' | '\t' | '\n' | '\r' ; _lineComment : '/' '/' {.} '\n' ; diff --git a/stock/main.go b/stock/main.go index 5488a06a..4d67da50 100644 --- a/stock/main.go +++ b/stock/main.go @@ -94,20 +94,13 @@ func main() { writeTerminals(gSymbols, cfg, outdir_log) } - var tokenMap *outToken.TokenMap - - fmt.Printf("token ids: %q\n", g.LexPart.TokenIds()) - fmt.Printf("literals: %q\n", gSymbols.ListStringLitSymbols()) - //fmt.Printf("item sets: %q\n", lexItems.GetItemSets(g.LexPart)) - fmt.Printf("terminals: %q\n", gSymbols.ListTerminals()) - gSymbols.Add(g.LexPart.TokenIds()...) g.LexPart.UpdateStringLitTokens(gSymbols.ListStringLitSymbols()) lexSets := lexItems.GetItemSets(g.LexPart) if cfg.Verbose() { io.WriteFileString(path.Join(outdir_log, "lexer_sets.txt"), lexSets.String()) } - tokenMap = outToken.NewTokenMap(gSymbols.ListTerminals()) + tokenMap := outToken.NewTokenMap(gSymbols.ListTerminals()) if !cfg.NoLexer() { genLexer.Gen(cfg.Package(), outdir_base, g.LexPart.Header.SDTLit, lexSets, tokenMap, cfg, subpath) } From f2cdbd9baf894fb6e2536a0ddc98dc751be35e98 Mon Sep 17 00:00:00 2001 From: Massimiliano Calandrelli Date: Mon, 7 Oct 2019 18:25:41 +0200 Subject: [PATCH 08/33] ... --- .../frontend/reparsed/internal/lexer/lexer.go | 79 ------------------- internal/frontend/reparsed/log/lexer_sets.txt | 22 +++--- internal/lexer/gen/golang/lexer.go | 2 + spec/test.bnf | 4 +- 4 files changed, 15 insertions(+), 92 deletions(-) diff --git a/internal/frontend/reparsed/internal/lexer/lexer.go b/internal/frontend/reparsed/internal/lexer/lexer.go index a1bbeb4f..cb532e91 100644 --- a/internal/frontend/reparsed/internal/lexer/lexer.go +++ b/internal/frontend/reparsed/internal/lexer/lexer.go @@ -145,82 +145,3 @@ func (p *Position) Reset() { p.line = 1 p.column = 1 } - -/* -Lexer symbols: -0: '_' -1: '!' -2: ''' -3: ''' -4: '<' -5: '<' -6: '>' -7: '>' -8: '~' -9: ']' -10: ':' -11: '|' -12: '[' -13: '-' -14: ')' -15: 'e' -16: 'r' -17: 'r' -18: 'o' -19: 'r' -20: '(' -21: '{' -22: 'e' -23: 'm' -24: 'p' -25: 't' -26: 'y' -27: \u03b5 -28: ';' -29: '}' -30: '.' -31: \u03bb -32: '/' -33: '/' -34: '\n' -35: '/' -36: '*' -37: '*' -38: '*' -39: '/' -40: '_' -41: '\' -42: 'u' -43: '\' -44: 'U' -45: '\' -46: 'a' -47: 'b' -48: 'f' -49: 'n' -50: 'r' -51: 't' -52: 'v' -53: '\' -54: ''' -55: '"' -56: '\' -57: '\' -58: 'x' -59: '`' -60: '`' -61: '"' -62: '"' -63: ' ' -64: '\t' -65: '\n' -66: '\r' -67: 'a'-'z' -68: 'A'-'Z' -69: '0'-'9' -70: '0'-'7' -71: '0'-'9' -72: 'A'-'F' -73: 'a'-'f' -74: . -*/ diff --git a/internal/frontend/reparsed/log/lexer_sets.txt b/internal/frontend/reparsed/log/lexer_sets.txt index 010eca47..44bc5fc1 100644 --- a/internal/frontend/reparsed/log/lexer_sets.txt +++ b/internal/frontend/reparsed/log/lexer_sets.txt @@ -14,22 +14,22 @@ S0{ g_sdt_lit : • '<' '<' . {.} '>' '>' string_lit : _raw_string | • _interpreted_string string_lit : • _raw_string | _interpreted_string + Λ<{> : • '{' + Λ : • 'e' 'm' 'p' 't' 'y' + Λ<-> : • '-' + Λ<λ> : • \u03bb + Λ<;> : • ';' + Λ<ε> : • \u03b5 Λ<~> : • '~' Λ<]> : • ']' Λ<:> : • ':' - Λ<|> : • '|' - Λ<[> : • '[' - Λ<-> : • '-' - Λ<)> : • ')' - Λ : • 'e' 'r' 'r' 'o' 'r' Λ<(> : • '(' - Λ<{> : • '{' - Λ : • 'e' 'm' 'p' 't' 'y' - Λ<ε> : • \u03b5 - Λ<;> : • ';' + Λ<)> : • ')' + Λ<[> : • '[' Λ<}> : • '}' + Λ : • 'e' 'r' 'r' 'o' 'r' + Λ<|> : • '|' Λ<.> : • '.' - Λ<λ> : • \u03bb _blockComment : • '/' '*' {. | '*'} '*' '/' _lineComment : • '/' '/' {.} '\n' _tokId : • _lowcase {_id_char} @@ -282,8 +282,8 @@ Action: Accept("tokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} S19{ - Λ : 'e' • 'r' 'r' 'o' 'r' Λ : 'e' • 'm' 'p' 't' 'y' + Λ : 'e' • 'r' 'r' 'o' 'r' _lowcase : 'a'-'z' • _tokId : _lowcase {_id_char} • _tokId : _lowcase {• _id_char} diff --git a/internal/lexer/gen/golang/lexer.go b/internal/lexer/gen/golang/lexer.go index 9d6d4b6d..2980c279 100644 --- a/internal/lexer/gen/golang/lexer.go +++ b/internal/lexer/gen/golang/lexer.go @@ -226,7 +226,9 @@ func (p *Position) Reset() { p.line = 1 p.column = 1 } +` +const dbgInfo = ` /* Lexer symbols: {{- range $i, $sym := .Symbols}} diff --git a/spec/test.bnf b/spec/test.bnf index 719f9dbd..d1e2914f 100644 --- a/spec/test.bnf +++ b/spec/test.bnf @@ -21,9 +21,9 @@ T hexdigit ; -T : "a" | "X" | ProdX ; +T : "a" | "X" | ProdX | "λ1"; ProdX : "empty" | "ε" | "λ" | empty | ε ; -// X0: "!" | "hexdigit"; +X: "!" | "hexdigit"; From 386171084d4044aa3ba886a2f1c26d8e21c2594e Mon Sep 17 00:00:00 2001 From: Massimiliano Calandrelli Date: Mon, 7 Oct 2019 19:09:12 +0200 Subject: [PATCH 09/33] ... --- internal/frontend/reparsed/log/lexer_sets.txt | 924 +++++++++--------- internal/lexer/items/itemlist.go | 14 + internal/lexer/items/itemsets.go | 5 +- 3 files changed, 480 insertions(+), 463 deletions(-) diff --git a/internal/frontend/reparsed/log/lexer_sets.txt b/internal/frontend/reparsed/log/lexer_sets.txt index 44bc5fc1..5d358dce 100644 --- a/internal/frontend/reparsed/log/lexer_sets.txt +++ b/internal/frontend/reparsed/log/lexer_sets.txt @@ -6,37 +6,37 @@ S0{ !whitespace : ' ' | '\t' | • '\n' | '\r' !whitespace : ' ' | • '\t' | '\n' | '\r' !whitespace : • ' ' | '\t' | '\n' | '\r' - tokId : • _tokId - regDefId : • '_' {_id_char} - ignoredTokId : • '!' _tokId + _blockComment : • '/' '*' {. | '*'} '*' '/' + _interpreted_string : • '"' {_unicode_value | _byte_value} '"' + _lineComment : • '/' '/' {.} '\n' + _lowcase : • 'a'-'z' + _raw_string : • '`' {.} '`' + _tokId : • _lowcase {_id_char} + _upcase : • 'A'-'Z' char_lit : • ''' (_unicode_value | _byte_value) ''' - prodId : • _upcase {_id_char} g_sdt_lit : • '<' '<' . {.} '>' '>' + ignoredTokId : • '!' _tokId + prodId : • _upcase {_id_char} + regDefId : • '_' {_id_char} string_lit : _raw_string | • _interpreted_string string_lit : • _raw_string | _interpreted_string - Λ<{> : • '{' - Λ : • 'e' 'm' 'p' 't' 'y' - Λ<-> : • '-' - Λ<λ> : • \u03bb - Λ<;> : • ';' - Λ<ε> : • \u03b5 - Λ<~> : • '~' - Λ<]> : • ']' - Λ<:> : • ':' + tokId : • _tokId Λ<(> : • '(' Λ<)> : • ')' + Λ<-> : • '-' + Λ<.> : • '.' + Λ<:> : • ':' + Λ<;> : • ';' Λ<[> : • '[' - Λ<}> : • '}' + Λ<]> : • ']' + Λ : • 'e' 'm' 'p' 't' 'y' Λ : • 'e' 'r' 'r' 'o' 'r' + Λ<{> : • '{' Λ<|> : • '|' - Λ<.> : • '.' - _blockComment : • '/' '*' {. | '*'} '*' '/' - _lineComment : • '/' '/' {.} '\n' - _tokId : • _lowcase {_id_char} - _upcase : • 'A'-'Z' - _interpreted_string : • '"' {_unicode_value | _byte_value} '"' - _raw_string : • '`' {.} '`' - _lowcase : • 'a'-'z' + Λ<}> : • '}' + Λ<~> : • '~' + Λ<ε> : • \u03b5 + Λ<λ> : • \u03bb } Transitions: ['\t','\t'] -> S1 @@ -79,9 +79,9 @@ Action: Ignore("!whitespace") Symbols classes: {} S2{ - ignoredTokId : '!' • _tokId - _tokId : • _lowcase {_id_char} _lowcase : • 'a'-'z' + _tokId : • _lowcase {_id_char} + ignoredTokId : '!' • _tokId } Transitions: ['a','z'] -> S26 @@ -89,21 +89,21 @@ Action: nil Symbols classes: {['a','z']} S3{ - _interpreted_string : '"' {_unicode_value | _byte_value} • '"' - _interpreted_string : '"' {_unicode_value | • _byte_value} '"' - _interpreted_string : '"' {• _unicode_value | _byte_value} '"' - string_lit : _raw_string | • _interpreted_string + _big_u_value : • '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _byte_value : _octal_byte_value | • _hex_byte_value _byte_value : • _octal_byte_value | _hex_byte_value - _unicode_value : . | _little_u_value | _big_u_value | • _escaped_char - _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char - _unicode_value : . | • _little_u_value | _big_u_value | _escaped_char - _unicode_value : • . | _little_u_value | _big_u_value | _escaped_char - _hex_byte_value : • '\' 'x' _hex_digit _hex_digit - _octal_byte_value : • '\' _octal_digit _octal_digit _octal_digit _escaped_char : • '\' ('a' | 'b' | 'f' | 'n' | 'r' | 't' | 'v' | '\' | ''' | '"') - _big_u_value : • '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit + _hex_byte_value : • '\' 'x' _hex_digit _hex_digit + _interpreted_string : '"' {_unicode_value | • _byte_value} '"' + _interpreted_string : '"' {• _unicode_value | _byte_value} '"' + _interpreted_string : '"' {_unicode_value | _byte_value} • '"' _little_u_value : • '\' 'u' _hex_digit _hex_digit _hex_digit _hex_digit + _octal_byte_value : • '\' _octal_digit _octal_digit _octal_digit + _unicode_value : • . | _little_u_value | _big_u_value | _escaped_char + _unicode_value : . | • _little_u_value | _big_u_value | _escaped_char + _unicode_value : . | _little_u_value | _big_u_value | • _escaped_char + _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char + string_lit : _raw_string | • _interpreted_string } Transitions: ['"','"'] -> S27 @@ -113,19 +113,19 @@ Action: nil Symbols classes: {['"','"'], ['\','\']} S4{ - char_lit : ''' (_unicode_value | • _byte_value) ''' - char_lit : ''' (• _unicode_value | _byte_value) ''' + _big_u_value : • '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _byte_value : _octal_byte_value | • _hex_byte_value _byte_value : • _octal_byte_value | _hex_byte_value - _unicode_value : . | _little_u_value | _big_u_value | • _escaped_char - _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char - _unicode_value : . | • _little_u_value | _big_u_value | _escaped_char - _unicode_value : • . | _little_u_value | _big_u_value | _escaped_char - _hex_byte_value : • '\' 'x' _hex_digit _hex_digit - _octal_byte_value : • '\' _octal_digit _octal_digit _octal_digit _escaped_char : • '\' ('a' | 'b' | 'f' | 'n' | 'r' | 't' | 'v' | '\' | ''' | '"') - _big_u_value : • '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit + _hex_byte_value : • '\' 'x' _hex_digit _hex_digit _little_u_value : • '\' 'u' _hex_digit _hex_digit _hex_digit _hex_digit + _octal_byte_value : • '\' _octal_digit _octal_digit _octal_digit + _unicode_value : . | • _little_u_value | _big_u_value | _escaped_char + _unicode_value : • . | _little_u_value | _big_u_value | _escaped_char + _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char + _unicode_value : . | _little_u_value | _big_u_value | • _escaped_char + char_lit : ''' (• _unicode_value | _byte_value) ''' + char_lit : ''' (_unicode_value | • _byte_value) ''' } Transitions: ['\','\'] -> S30 @@ -162,10 +162,10 @@ Action: Accept("Λ<.>") Symbols classes: {} S9{ - _blockComment : '/' • '*' {. | '*'} '*' '/' - _lineComment : '/' • '/' {.} '\n' !comment : _lineComment | • _blockComment !comment : • _lineComment | _blockComment + _blockComment : '/' • '*' {. | '*'} '*' '/' + _lineComment : '/' • '/' {.} '\n' } Transitions: ['*','*'] -> S32 @@ -196,16 +196,16 @@ Action: nil Symbols classes: {['<','<']} S13{ - _upcase : 'A'-'Z' • - prodId : _upcase {_id_char} • - prodId : _upcase {• _id_char} + _digit : • '0'-'9' + _id_char : • _upcase | _lowcase | '_' | _digit _id_char : _upcase | _lowcase | '_' | • _digit _id_char : _upcase | _lowcase | • '_' | _digit _id_char : _upcase | • _lowcase | '_' | _digit - _id_char : • _upcase | _lowcase | '_' | _digit - _digit : • '0'-'9' _lowcase : • 'a'-'z' + _upcase : 'A'-'Z' • _upcase : • 'A'-'Z' + prodId : _upcase {_id_char} • + prodId : _upcase {• _id_char} } Transitions: ['0','9'] -> S35 @@ -230,15 +230,15 @@ Action: Accept("Λ<]>") Symbols classes: {} S16{ - regDefId : '_' {_id_char} • - regDefId : '_' {• _id_char} + _digit : • '0'-'9' _id_char : _upcase | _lowcase | '_' | • _digit _id_char : _upcase | _lowcase | • '_' | _digit _id_char : _upcase | • _lowcase | '_' | _digit _id_char : • _upcase | _lowcase | '_' | _digit - _digit : • '0'-'9' _lowcase : • 'a'-'z' _upcase : • 'A'-'Z' + regDefId : '_' {_id_char} • + regDefId : '_' {• _id_char} } Transitions: ['0','9'] -> S39 @@ -260,18 +260,18 @@ Action: nil Symbols classes: {['`','`']} S18{ - _lowcase : 'a'-'z' • - _tokId : _lowcase {_id_char} • - _tokId : _lowcase {• _id_char} - tokId : _tokId • - tokId : • _tokId - _id_char : _upcase | _lowcase | '_' | • _digit + _digit : • '0'-'9' _id_char : _upcase | _lowcase | • '_' | _digit _id_char : _upcase | • _lowcase | '_' | _digit _id_char : • _upcase | _lowcase | '_' | _digit - _digit : • '0'-'9' + _id_char : _upcase | _lowcase | '_' | • _digit _lowcase : • 'a'-'z' + _lowcase : 'a'-'z' • + _tokId : _lowcase {_id_char} • + _tokId : _lowcase {• _id_char} _upcase : • 'A'-'Z' + tokId : _tokId • + tokId : • _tokId } Transitions: ['0','9'] -> S44 @@ -282,20 +282,20 @@ Action: Accept("tokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} S19{ - Λ : 'e' • 'm' 'p' 't' 'y' - Λ : 'e' • 'r' 'r' 'o' 'r' - _lowcase : 'a'-'z' • - _tokId : _lowcase {_id_char} • - _tokId : _lowcase {• _id_char} - tokId : _tokId • - tokId : • _tokId + _digit : • '0'-'9' + _id_char : _upcase | • _lowcase | '_' | _digit _id_char : _upcase | _lowcase | '_' | • _digit _id_char : _upcase | _lowcase | • '_' | _digit - _id_char : _upcase | • _lowcase | '_' | _digit _id_char : • _upcase | _lowcase | '_' | _digit - _digit : • '0'-'9' _lowcase : • 'a'-'z' + _lowcase : 'a'-'z' • + _tokId : _lowcase {_id_char} • + _tokId : _lowcase {• _id_char} _upcase : • 'A'-'Z' + tokId : • _tokId + tokId : _tokId • + Λ : 'e' • 'm' 'p' 't' 'y' + Λ : 'e' • 'r' 'r' 'o' 'r' } Transitions: ['0','9'] -> S44 @@ -352,18 +352,18 @@ Action: Accept("Λ<λ>") Symbols classes: {} S26{ - _lowcase : 'a'-'z' • - _tokId : _lowcase {_id_char} • - _tokId : _lowcase {• _id_char} - ignoredTokId : '!' _tokId • - ignoredTokId : '!' • _tokId - _id_char : _upcase | _lowcase | '_' | • _digit + _digit : • '0'-'9' _id_char : _upcase | _lowcase | • '_' | _digit _id_char : _upcase | • _lowcase | '_' | _digit _id_char : • _upcase | _lowcase | '_' | _digit - _digit : • '0'-'9' + _id_char : _upcase | _lowcase | '_' | • _digit _lowcase : • 'a'-'z' + _lowcase : 'a'-'z' • + _tokId : _lowcase {_id_char} • + _tokId : _lowcase {• _id_char} _upcase : • 'A'-'Z' + ignoredTokId : '!' _tokId • + ignoredTokId : '!' • _tokId } Transitions: ['0','9'] -> S50 @@ -382,29 +382,29 @@ Action: Accept("string_lit") Symbols classes: {} S28{ - _hex_byte_value : '\' • 'x' _hex_digit _hex_digit - _octal_byte_value : '\' • _octal_digit _octal_digit _octal_digit - _escaped_char : '\' ('a' | 'b' | 'f' | 'n' | 'r' | 't' | 'v' | '\' | ''' | • '"') + _big_u_value : '\' • 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit + _byte_value : • _octal_byte_value | _hex_byte_value + _byte_value : _octal_byte_value | • _hex_byte_value _escaped_char : '\' ('a' | 'b' | 'f' | 'n' | 'r' | 't' | 'v' | '\' | • ''' | '"') _escaped_char : '\' ('a' | 'b' | 'f' | 'n' | 'r' | 't' | 'v' | • '\' | ''' | '"') _escaped_char : '\' ('a' | 'b' | 'f' | 'n' | 'r' | 't' | • 'v' | '\' | ''' | '"') - _escaped_char : '\' ('a' | 'b' | 'f' | 'n' | 'r' | • 't' | 'v' | '\' | ''' | '"') + _escaped_char : '\' ('a' | 'b' | 'f' | 'n' | 'r' | 't' | 'v' | '\' | ''' | • '"') _escaped_char : '\' ('a' | 'b' | 'f' | 'n' | • 'r' | 't' | 'v' | '\' | ''' | '"') _escaped_char : '\' ('a' | 'b' | 'f' | • 'n' | 'r' | 't' | 'v' | '\' | ''' | '"') _escaped_char : '\' ('a' | 'b' | • 'f' | 'n' | 'r' | 't' | 'v' | '\' | ''' | '"') _escaped_char : '\' ('a' | • 'b' | 'f' | 'n' | 'r' | 't' | 'v' | '\' | ''' | '"') _escaped_char : '\' (• 'a' | 'b' | 'f' | 'n' | 'r' | 't' | 'v' | '\' | ''' | '"') - _big_u_value : '\' • 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit + _escaped_char : '\' ('a' | 'b' | 'f' | 'n' | 'r' | • 't' | 'v' | '\' | ''' | '"') + _hex_byte_value : '\' • 'x' _hex_digit _hex_digit + _interpreted_string : '"' {• _unicode_value | _byte_value} '"' + _interpreted_string : '"' {_unicode_value | • _byte_value} '"' _little_u_value : '\' • 'u' _hex_digit _hex_digit _hex_digit _hex_digit - _byte_value : _octal_byte_value | • _hex_byte_value - _byte_value : • _octal_byte_value | _hex_byte_value - _unicode_value : . | _little_u_value | _big_u_value | • _escaped_char + _octal_byte_value : '\' • _octal_digit _octal_digit _octal_digit + _octal_digit : • '0'-'7' _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char _unicode_value : . | • _little_u_value | _big_u_value | _escaped_char - _interpreted_string : '"' {_unicode_value | • _byte_value} '"' - _interpreted_string : '"' {• _unicode_value | _byte_value} '"' + _unicode_value : . | _little_u_value | _big_u_value | • _escaped_char string_lit : _raw_string | • _interpreted_string - _octal_digit : • '0'-'7' } Transitions: ['"','"'] -> S54 @@ -425,22 +425,22 @@ Action: nil Symbols classes: {['"','"'], [''','''], ['0','7'], ['U','U'], ['\','\'], ['a','a'], ['b','b'], ['f','f'], ['n','n'], ['r','r'], ['t','t'], ['u','u'], ['v','v'], ['x','x']} S29{ - _unicode_value : (. | _little_u_value | _big_u_value | _escaped_char) • - _interpreted_string : '"' {_unicode_value | _byte_value} • '"' + _big_u_value : • '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit + _byte_value : • _octal_byte_value | _hex_byte_value + _byte_value : _octal_byte_value | • _hex_byte_value + _escaped_char : • '\' ('a' | 'b' | 'f' | 'n' | 'r' | 't' | 'v' | '\' | ''' | '"') + _hex_byte_value : • '\' 'x' _hex_digit _hex_digit _interpreted_string : '"' {_unicode_value | • _byte_value} '"' _interpreted_string : '"' {• _unicode_value | _byte_value} '"' - string_lit : _raw_string | • _interpreted_string - _byte_value : _octal_byte_value | • _hex_byte_value - _byte_value : • _octal_byte_value | _hex_byte_value - _unicode_value : . | _little_u_value | _big_u_value | • _escaped_char + _interpreted_string : '"' {_unicode_value | _byte_value} • '"' + _little_u_value : • '\' 'u' _hex_digit _hex_digit _hex_digit _hex_digit + _octal_byte_value : • '\' _octal_digit _octal_digit _octal_digit _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char - _unicode_value : . | • _little_u_value | _big_u_value | _escaped_char _unicode_value : • . | _little_u_value | _big_u_value | _escaped_char - _hex_byte_value : • '\' 'x' _hex_digit _hex_digit - _octal_byte_value : • '\' _octal_digit _octal_digit _octal_digit - _escaped_char : • '\' ('a' | 'b' | 'f' | 'n' | 'r' | 't' | 'v' | '\' | ''' | '"') - _big_u_value : • '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit - _little_u_value : • '\' 'u' _hex_digit _hex_digit _hex_digit _hex_digit + _unicode_value : . | • _little_u_value | _big_u_value | _escaped_char + _unicode_value : . | _little_u_value | _big_u_value | • _escaped_char + _unicode_value : (. | _little_u_value | _big_u_value | _escaped_char) • + string_lit : _raw_string | • _interpreted_string } Transitions: ['"','"'] -> S27 @@ -450,28 +450,28 @@ Action: nil Symbols classes: {['"','"'], ['\','\']} S30{ - _hex_byte_value : '\' • 'x' _hex_digit _hex_digit - _octal_byte_value : '\' • _octal_digit _octal_digit _octal_digit - _escaped_char : '\' ('a' | 'b' | 'f' | 'n' | 'r' | 't' | 'v' | '\' | ''' | • '"') + _big_u_value : '\' • 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit + _byte_value : • _octal_byte_value | _hex_byte_value + _byte_value : _octal_byte_value | • _hex_byte_value _escaped_char : '\' ('a' | 'b' | 'f' | 'n' | 'r' | 't' | 'v' | '\' | • ''' | '"') _escaped_char : '\' ('a' | 'b' | 'f' | 'n' | 'r' | 't' | 'v' | • '\' | ''' | '"') _escaped_char : '\' ('a' | 'b' | 'f' | 'n' | 'r' | 't' | • 'v' | '\' | ''' | '"') - _escaped_char : '\' ('a' | 'b' | 'f' | 'n' | 'r' | • 't' | 'v' | '\' | ''' | '"') + _escaped_char : '\' ('a' | 'b' | 'f' | 'n' | 'r' | 't' | 'v' | '\' | ''' | • '"') _escaped_char : '\' ('a' | 'b' | 'f' | 'n' | • 'r' | 't' | 'v' | '\' | ''' | '"') _escaped_char : '\' ('a' | 'b' | 'f' | • 'n' | 'r' | 't' | 'v' | '\' | ''' | '"') _escaped_char : '\' ('a' | 'b' | • 'f' | 'n' | 'r' | 't' | 'v' | '\' | ''' | '"') _escaped_char : '\' ('a' | • 'b' | 'f' | 'n' | 'r' | 't' | 'v' | '\' | ''' | '"') _escaped_char : '\' (• 'a' | 'b' | 'f' | 'n' | 'r' | 't' | 'v' | '\' | ''' | '"') - _big_u_value : '\' • 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit + _escaped_char : '\' ('a' | 'b' | 'f' | 'n' | 'r' | • 't' | 'v' | '\' | ''' | '"') + _hex_byte_value : '\' • 'x' _hex_digit _hex_digit _little_u_value : '\' • 'u' _hex_digit _hex_digit _hex_digit _hex_digit - _byte_value : _octal_byte_value | • _hex_byte_value - _byte_value : • _octal_byte_value | _hex_byte_value + _octal_byte_value : '\' • _octal_digit _octal_digit _octal_digit + _octal_digit : • '0'-'7' _unicode_value : . | _little_u_value | _big_u_value | • _escaped_char _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char _unicode_value : . | • _little_u_value | _big_u_value | _escaped_char char_lit : ''' (_unicode_value | • _byte_value) ''' char_lit : ''' (• _unicode_value | _byte_value) ''' - _octal_digit : • '0'-'7' } Transitions: ['"','"'] -> S59 @@ -501,10 +501,10 @@ Action: nil Symbols classes: {[''',''']} S32{ + !comment : _lineComment | • _blockComment _blockComment : '/' '*' {. | '*'} • '*' '/' _blockComment : '/' '*' {. | • '*'} '*' '/' _blockComment : '/' '*' {• . | '*'} '*' '/' - !comment : _lineComment | • _blockComment } Transitions: ['*','*'] -> S65 @@ -513,9 +513,9 @@ Action: nil Symbols classes: {['*','*']} S33{ + !comment : • _lineComment | _blockComment _lineComment : '/' '/' {.} • '\n' _lineComment : '/' '/' {• .} '\n' - !comment : • _lineComment | _blockComment } Transitions: ['\n','\n'] -> S66 @@ -533,16 +533,16 @@ Symbols classes: {} S35{ _digit : '0'-'9' • + _digit : • '0'-'9' _id_char : (_upcase | _lowcase | '_' | _digit) • - prodId : _upcase {_id_char} • - prodId : _upcase {• _id_char} _id_char : _upcase | _lowcase | '_' | • _digit _id_char : _upcase | _lowcase | • '_' | _digit _id_char : _upcase | • _lowcase | '_' | _digit _id_char : • _upcase | _lowcase | '_' | _digit - _digit : • '0'-'9' _lowcase : • 'a'-'z' _upcase : • 'A'-'Z' + prodId : _upcase {_id_char} • + prodId : _upcase {• _id_char} } Transitions: ['0','9'] -> S35 @@ -553,17 +553,17 @@ Action: Accept("prodId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} S36{ - _upcase : 'A'-'Z' • + _digit : • '0'-'9' + _id_char : _upcase | • _lowcase | '_' | _digit _id_char : (_upcase | _lowcase | '_' | _digit) • - prodId : _upcase {_id_char} • - prodId : _upcase {• _id_char} _id_char : _upcase | _lowcase | '_' | • _digit _id_char : _upcase | _lowcase | • '_' | _digit - _id_char : _upcase | • _lowcase | '_' | _digit _id_char : • _upcase | _lowcase | '_' | _digit - _digit : • '0'-'9' _lowcase : • 'a'-'z' + _upcase : 'A'-'Z' • _upcase : • 'A'-'Z' + prodId : _upcase {_id_char} • + prodId : _upcase {• _id_char} } Transitions: ['0','9'] -> S35 @@ -574,16 +574,16 @@ Action: Accept("prodId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} S37{ + _digit : • '0'-'9' _id_char : (_upcase | _lowcase | '_' | _digit) • - prodId : _upcase {_id_char} • - prodId : _upcase {• _id_char} _id_char : _upcase | _lowcase | '_' | • _digit _id_char : _upcase | _lowcase | • '_' | _digit _id_char : _upcase | • _lowcase | '_' | _digit _id_char : • _upcase | _lowcase | '_' | _digit - _digit : • '0'-'9' _lowcase : • 'a'-'z' _upcase : • 'A'-'Z' + prodId : _upcase {_id_char} • + prodId : _upcase {• _id_char} } Transitions: ['0','9'] -> S35 @@ -594,17 +594,17 @@ Action: Accept("prodId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} S38{ - _lowcase : 'a'-'z' • + _digit : • '0'-'9' + _id_char : _upcase | • _lowcase | '_' | _digit _id_char : (_upcase | _lowcase | '_' | _digit) • - prodId : _upcase {_id_char} • - prodId : _upcase {• _id_char} _id_char : _upcase | _lowcase | '_' | • _digit _id_char : _upcase | _lowcase | • '_' | _digit - _id_char : _upcase | • _lowcase | '_' | _digit _id_char : • _upcase | _lowcase | '_' | _digit - _digit : • '0'-'9' _lowcase : • 'a'-'z' + _lowcase : 'a'-'z' • _upcase : • 'A'-'Z' + prodId : _upcase {_id_char} • + prodId : _upcase {• _id_char} } Transitions: ['0','9'] -> S35 @@ -616,16 +616,16 @@ Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} S39{ _digit : '0'-'9' • + _digit : • '0'-'9' _id_char : (_upcase | _lowcase | '_' | _digit) • - regDefId : '_' {_id_char} • - regDefId : '_' {• _id_char} _id_char : _upcase | _lowcase | '_' | • _digit _id_char : _upcase | _lowcase | • '_' | _digit _id_char : _upcase | • _lowcase | '_' | _digit _id_char : • _upcase | _lowcase | '_' | _digit - _digit : • '0'-'9' _lowcase : • 'a'-'z' _upcase : • 'A'-'Z' + regDefId : '_' {_id_char} • + regDefId : '_' {• _id_char} } Transitions: ['0','9'] -> S39 @@ -636,17 +636,17 @@ Action: Accept("regDefId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} S40{ - _upcase : 'A'-'Z' • + _digit : • '0'-'9' + _id_char : _upcase | • _lowcase | '_' | _digit _id_char : (_upcase | _lowcase | '_' | _digit) • - regDefId : '_' {_id_char} • - regDefId : '_' {• _id_char} _id_char : _upcase | _lowcase | '_' | • _digit _id_char : _upcase | _lowcase | • '_' | _digit - _id_char : _upcase | • _lowcase | '_' | _digit _id_char : • _upcase | _lowcase | '_' | _digit - _digit : • '0'-'9' _lowcase : • 'a'-'z' + _upcase : 'A'-'Z' • _upcase : • 'A'-'Z' + regDefId : '_' {_id_char} • + regDefId : '_' {• _id_char} } Transitions: ['0','9'] -> S39 @@ -657,16 +657,16 @@ Action: Accept("regDefId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} S41{ + _digit : • '0'-'9' _id_char : (_upcase | _lowcase | '_' | _digit) • - regDefId : '_' {_id_char} • - regDefId : '_' {• _id_char} _id_char : _upcase | _lowcase | '_' | • _digit _id_char : _upcase | _lowcase | • '_' | _digit _id_char : _upcase | • _lowcase | '_' | _digit _id_char : • _upcase | _lowcase | '_' | _digit - _digit : • '0'-'9' _lowcase : • 'a'-'z' _upcase : • 'A'-'Z' + regDefId : '_' {_id_char} • + regDefId : '_' {• _id_char} } Transitions: ['0','9'] -> S39 @@ -677,17 +677,17 @@ Action: Accept("regDefId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} S42{ - _lowcase : 'a'-'z' • + _digit : • '0'-'9' + _id_char : _upcase | • _lowcase | '_' | _digit _id_char : (_upcase | _lowcase | '_' | _digit) • - regDefId : '_' {_id_char} • - regDefId : '_' {• _id_char} _id_char : _upcase | _lowcase | '_' | • _digit _id_char : _upcase | _lowcase | • '_' | _digit - _id_char : _upcase | • _lowcase | '_' | _digit _id_char : • _upcase | _lowcase | '_' | _digit - _digit : • '0'-'9' _lowcase : • 'a'-'z' + _lowcase : 'a'-'z' • _upcase : • 'A'-'Z' + regDefId : '_' {_id_char} • + regDefId : '_' {• _id_char} } Transitions: ['0','9'] -> S39 @@ -707,18 +707,18 @@ Symbols classes: {} S44{ _digit : '0'-'9' • + _digit : • '0'-'9' _id_char : (_upcase | _lowcase | '_' | _digit) • - _tokId : _lowcase {_id_char} • - _tokId : _lowcase {• _id_char} - tokId : _tokId • - tokId : • _tokId - _id_char : _upcase | _lowcase | '_' | • _digit - _id_char : _upcase | _lowcase | • '_' | _digit - _id_char : _upcase | • _lowcase | '_' | _digit _id_char : • _upcase | _lowcase | '_' | _digit - _digit : • '0'-'9' + _id_char : _upcase | • _lowcase | '_' | _digit + _id_char : _upcase | _lowcase | • '_' | _digit + _id_char : _upcase | _lowcase | '_' | • _digit _lowcase : • 'a'-'z' + _tokId : _lowcase {• _id_char} + _tokId : _lowcase {_id_char} • _upcase : • 'A'-'Z' + tokId : • _tokId + tokId : _tokId • } Transitions: ['0','9'] -> S44 @@ -729,19 +729,19 @@ Action: Accept("tokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} S45{ - _upcase : 'A'-'Z' • + _digit : • '0'-'9' + _id_char : • _upcase | _lowcase | '_' | _digit _id_char : (_upcase | _lowcase | '_' | _digit) • - _tokId : _lowcase {_id_char} • - _tokId : _lowcase {• _id_char} - tokId : _tokId • - tokId : • _tokId + _id_char : _upcase | • _lowcase | '_' | _digit _id_char : _upcase | _lowcase | '_' | • _digit _id_char : _upcase | _lowcase | • '_' | _digit - _id_char : _upcase | • _lowcase | '_' | _digit - _id_char : • _upcase | _lowcase | '_' | _digit - _digit : • '0'-'9' _lowcase : • 'a'-'z' + _tokId : _lowcase {• _id_char} + _tokId : _lowcase {_id_char} • + _upcase : 'A'-'Z' • _upcase : • 'A'-'Z' + tokId : • _tokId + tokId : _tokId • } Transitions: ['0','9'] -> S44 @@ -752,18 +752,18 @@ Action: Accept("tokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} S46{ + _digit : • '0'-'9' _id_char : (_upcase | _lowcase | '_' | _digit) • - _tokId : _lowcase {_id_char} • - _tokId : _lowcase {• _id_char} - tokId : _tokId • - tokId : • _tokId - _id_char : _upcase | _lowcase | '_' | • _digit - _id_char : _upcase | _lowcase | • '_' | _digit _id_char : _upcase | • _lowcase | '_' | _digit _id_char : • _upcase | _lowcase | '_' | _digit - _digit : • '0'-'9' + _id_char : _upcase | _lowcase | '_' | • _digit + _id_char : _upcase | _lowcase | • '_' | _digit _lowcase : • 'a'-'z' + _tokId : _lowcase {_id_char} • + _tokId : _lowcase {• _id_char} _upcase : • 'A'-'Z' + tokId : _tokId • + tokId : • _tokId } Transitions: ['0','9'] -> S44 @@ -774,19 +774,19 @@ Action: Accept("tokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} S47{ - _lowcase : 'a'-'z' • - _id_char : (_upcase | _lowcase | '_' | _digit) • - _tokId : _lowcase {_id_char} • - _tokId : _lowcase {• _id_char} - tokId : _tokId • - tokId : • _tokId - _id_char : _upcase | _lowcase | '_' | • _digit + _digit : • '0'-'9' _id_char : _upcase | _lowcase | • '_' | _digit - _id_char : _upcase | • _lowcase | '_' | _digit + _id_char : (_upcase | _lowcase | '_' | _digit) • _id_char : • _upcase | _lowcase | '_' | _digit - _digit : • '0'-'9' + _id_char : _upcase | • _lowcase | '_' | _digit + _id_char : _upcase | _lowcase | '_' | • _digit _lowcase : • 'a'-'z' + _lowcase : 'a'-'z' • + _tokId : _lowcase {• _id_char} + _tokId : _lowcase {_id_char} • _upcase : • 'A'-'Z' + tokId : • _tokId + tokId : _tokId • } Transitions: ['0','9'] -> S44 @@ -797,20 +797,20 @@ Action: Accept("tokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} S48{ - Λ : 'e' 'm' • 'p' 't' 'y' - _lowcase : 'a'-'z' • - _id_char : (_upcase | _lowcase | '_' | _digit) • - _tokId : _lowcase {_id_char} • - _tokId : _lowcase {• _id_char} - tokId : _tokId • - tokId : • _tokId + _digit : • '0'-'9' _id_char : _upcase | _lowcase | '_' | • _digit - _id_char : _upcase | _lowcase | • '_' | _digit + _id_char : (_upcase | _lowcase | '_' | _digit) • _id_char : _upcase | • _lowcase | '_' | _digit _id_char : • _upcase | _lowcase | '_' | _digit - _digit : • '0'-'9' + _id_char : _upcase | _lowcase | • '_' | _digit _lowcase : • 'a'-'z' + _lowcase : 'a'-'z' • + _tokId : _lowcase {• _id_char} + _tokId : _lowcase {_id_char} • _upcase : • 'A'-'Z' + tokId : • _tokId + tokId : _tokId • + Λ : 'e' 'm' • 'p' 't' 'y' } Transitions: ['0','9'] -> S44 @@ -823,20 +823,20 @@ Action: Accept("tokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','o'], ['p','p'], ['q','z']} S49{ - Λ : 'e' 'r' • 'r' 'o' 'r' - _lowcase : 'a'-'z' • - _id_char : (_upcase | _lowcase | '_' | _digit) • - _tokId : _lowcase {_id_char} • - _tokId : _lowcase {• _id_char} - tokId : _tokId • - tokId : • _tokId + _digit : • '0'-'9' _id_char : _upcase | _lowcase | '_' | • _digit - _id_char : _upcase | _lowcase | • '_' | _digit + _id_char : (_upcase | _lowcase | '_' | _digit) • _id_char : _upcase | • _lowcase | '_' | _digit _id_char : • _upcase | _lowcase | '_' | _digit - _digit : • '0'-'9' + _id_char : _upcase | _lowcase | • '_' | _digit _lowcase : • 'a'-'z' + _lowcase : 'a'-'z' • + _tokId : _lowcase {• _id_char} + _tokId : _lowcase {_id_char} • _upcase : • 'A'-'Z' + tokId : • _tokId + tokId : _tokId • + Λ : 'e' 'r' • 'r' 'o' 'r' } Transitions: ['0','9'] -> S44 @@ -850,18 +850,18 @@ Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','q'], ['r','r'], ['s','z S50{ _digit : '0'-'9' • + _digit : • '0'-'9' _id_char : (_upcase | _lowcase | '_' | _digit) • - _tokId : _lowcase {_id_char} • - _tokId : _lowcase {• _id_char} - ignoredTokId : '!' _tokId • - ignoredTokId : '!' • _tokId - _id_char : _upcase | _lowcase | '_' | • _digit - _id_char : _upcase | _lowcase | • '_' | _digit - _id_char : _upcase | • _lowcase | '_' | _digit _id_char : • _upcase | _lowcase | '_' | _digit - _digit : • '0'-'9' + _id_char : _upcase | • _lowcase | '_' | _digit + _id_char : _upcase | _lowcase | • '_' | _digit + _id_char : _upcase | _lowcase | '_' | • _digit _lowcase : • 'a'-'z' + _tokId : _lowcase {• _id_char} + _tokId : _lowcase {_id_char} • _upcase : • 'A'-'Z' + ignoredTokId : '!' • _tokId + ignoredTokId : '!' _tokId • } Transitions: ['0','9'] -> S50 @@ -872,19 +872,19 @@ Action: Accept("ignoredTokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} S51{ - _upcase : 'A'-'Z' • + _digit : • '0'-'9' + _id_char : • _upcase | _lowcase | '_' | _digit _id_char : (_upcase | _lowcase | '_' | _digit) • - _tokId : _lowcase {_id_char} • - _tokId : _lowcase {• _id_char} - ignoredTokId : '!' _tokId • - ignoredTokId : '!' • _tokId + _id_char : _upcase | • _lowcase | '_' | _digit _id_char : _upcase | _lowcase | '_' | • _digit _id_char : _upcase | _lowcase | • '_' | _digit - _id_char : _upcase | • _lowcase | '_' | _digit - _id_char : • _upcase | _lowcase | '_' | _digit - _digit : • '0'-'9' _lowcase : • 'a'-'z' + _tokId : _lowcase {• _id_char} + _tokId : _lowcase {_id_char} • + _upcase : 'A'-'Z' • _upcase : • 'A'-'Z' + ignoredTokId : '!' • _tokId + ignoredTokId : '!' _tokId • } Transitions: ['0','9'] -> S50 @@ -895,18 +895,18 @@ Action: Accept("ignoredTokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} S52{ + _digit : • '0'-'9' _id_char : (_upcase | _lowcase | '_' | _digit) • - _tokId : _lowcase {_id_char} • - _tokId : _lowcase {• _id_char} - ignoredTokId : '!' _tokId • - ignoredTokId : '!' • _tokId - _id_char : _upcase | _lowcase | '_' | • _digit - _id_char : _upcase | _lowcase | • '_' | _digit _id_char : _upcase | • _lowcase | '_' | _digit _id_char : • _upcase | _lowcase | '_' | _digit - _digit : • '0'-'9' + _id_char : _upcase | _lowcase | '_' | • _digit + _id_char : _upcase | _lowcase | • '_' | _digit _lowcase : • 'a'-'z' + _tokId : _lowcase {_id_char} • + _tokId : _lowcase {• _id_char} _upcase : • 'A'-'Z' + ignoredTokId : '!' _tokId • + ignoredTokId : '!' • _tokId } Transitions: ['0','9'] -> S50 @@ -917,19 +917,19 @@ Action: Accept("ignoredTokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} S53{ - _lowcase : 'a'-'z' • - _id_char : (_upcase | _lowcase | '_' | _digit) • - _tokId : _lowcase {_id_char} • - _tokId : _lowcase {• _id_char} - ignoredTokId : '!' _tokId • - ignoredTokId : '!' • _tokId - _id_char : _upcase | _lowcase | '_' | • _digit + _digit : • '0'-'9' _id_char : _upcase | _lowcase | • '_' | _digit - _id_char : _upcase | • _lowcase | '_' | _digit + _id_char : (_upcase | _lowcase | '_' | _digit) • _id_char : • _upcase | _lowcase | '_' | _digit - _digit : • '0'-'9' + _id_char : _upcase | • _lowcase | '_' | _digit + _id_char : _upcase | _lowcase | '_' | • _digit _lowcase : • 'a'-'z' + _lowcase : 'a'-'z' • + _tokId : _lowcase {• _id_char} + _tokId : _lowcase {_id_char} • _upcase : • 'A'-'Z' + ignoredTokId : '!' • _tokId + ignoredTokId : '!' _tokId • } Transitions: ['0','9'] -> S50 @@ -940,23 +940,23 @@ Action: Accept("ignoredTokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} S54{ + _big_u_value : • '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit + _byte_value : _octal_byte_value | • _hex_byte_value + _byte_value : • _octal_byte_value | _hex_byte_value _escaped_char : '\' ('a' | 'b' | 'f' | 'n' | 'r' | 't' | 'v' | '\' | ''' | '"') • - _unicode_value : (. | _little_u_value | _big_u_value | _escaped_char) • - _interpreted_string : '"' {_unicode_value | _byte_value} • '"' + _escaped_char : • '\' ('a' | 'b' | 'f' | 'n' | 'r' | 't' | 'v' | '\' | ''' | '"') + _hex_byte_value : • '\' 'x' _hex_digit _hex_digit _interpreted_string : '"' {_unicode_value | • _byte_value} '"' _interpreted_string : '"' {• _unicode_value | _byte_value} '"' - string_lit : _raw_string | • _interpreted_string - _byte_value : _octal_byte_value | • _hex_byte_value - _byte_value : • _octal_byte_value | _hex_byte_value - _unicode_value : . | _little_u_value | _big_u_value | • _escaped_char - _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char + _interpreted_string : '"' {_unicode_value | _byte_value} • '"' + _little_u_value : • '\' 'u' _hex_digit _hex_digit _hex_digit _hex_digit + _octal_byte_value : • '\' _octal_digit _octal_digit _octal_digit _unicode_value : . | • _little_u_value | _big_u_value | _escaped_char _unicode_value : • . | _little_u_value | _big_u_value | _escaped_char - _hex_byte_value : • '\' 'x' _hex_digit _hex_digit - _octal_byte_value : • '\' _octal_digit _octal_digit _octal_digit - _escaped_char : • '\' ('a' | 'b' | 'f' | 'n' | 'r' | 't' | 'v' | '\' | ''' | '"') - _big_u_value : • '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit - _little_u_value : • '\' 'u' _hex_digit _hex_digit _hex_digit _hex_digit + _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char + _unicode_value : (. | _little_u_value | _big_u_value | _escaped_char) • + _unicode_value : . | _little_u_value | _big_u_value | • _escaped_char + string_lit : _raw_string | • _interpreted_string } Transitions: ['"','"'] -> S27 @@ -966,12 +966,12 @@ Action: nil Symbols classes: {['"','"'], ['\','\']} S55{ - _octal_digit : '0'-'7' • - _octal_byte_value : '\' _octal_digit • _octal_digit _octal_digit _byte_value : • _octal_byte_value | _hex_byte_value _interpreted_string : '"' {_unicode_value | • _byte_value} '"' - string_lit : _raw_string | • _interpreted_string + _octal_byte_value : '\' _octal_digit • _octal_digit _octal_digit + _octal_digit : '0'-'7' • _octal_digit : • '0'-'7' + string_lit : _raw_string | • _interpreted_string } Transitions: ['0','7'] -> S70 @@ -980,12 +980,12 @@ Symbols classes: {['0','7']} S56{ _big_u_value : '\' 'U' • _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit - _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char - _interpreted_string : '"' {• _unicode_value | _byte_value} '"' - string_lit : _raw_string | • _interpreted_string _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' + _interpreted_string : '"' {• _unicode_value | _byte_value} '"' + _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char + string_lit : _raw_string | • _interpreted_string } Transitions: ['0','9'] -> S71 @@ -995,13 +995,13 @@ Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} S57{ + _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' + _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' + _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' + _interpreted_string : '"' {• _unicode_value | _byte_value} '"' _little_u_value : '\' 'u' • _hex_digit _hex_digit _hex_digit _hex_digit _unicode_value : . | • _little_u_value | _big_u_value | _escaped_char - _interpreted_string : '"' {• _unicode_value | _byte_value} '"' string_lit : _raw_string | • _interpreted_string - _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' - _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' - _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' } Transitions: ['0','9'] -> S72 @@ -1011,13 +1011,13 @@ Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} S58{ - _hex_byte_value : '\' 'x' • _hex_digit _hex_digit _byte_value : _octal_byte_value | • _hex_byte_value - _interpreted_string : '"' {_unicode_value | • _byte_value} '"' - string_lit : _raw_string | • _interpreted_string + _hex_byte_value : '\' 'x' • _hex_digit _hex_digit _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' + _interpreted_string : '"' {_unicode_value | • _byte_value} '"' + string_lit : _raw_string | • _interpreted_string } Transitions: ['0','9'] -> S73 @@ -1037,11 +1037,11 @@ Action: nil Symbols classes: {[''',''']} S60{ - _octal_digit : '0'-'7' • - _octal_byte_value : '\' _octal_digit • _octal_digit _octal_digit _byte_value : • _octal_byte_value | _hex_byte_value - char_lit : ''' (_unicode_value | • _byte_value) ''' + _octal_byte_value : '\' _octal_digit • _octal_digit _octal_digit + _octal_digit : '0'-'7' • _octal_digit : • '0'-'7' + char_lit : ''' (_unicode_value | • _byte_value) ''' } Transitions: ['0','7'] -> S74 @@ -1050,11 +1050,11 @@ Symbols classes: {['0','7']} S61{ _big_u_value : '\' 'U' • _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit - _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char - char_lit : ''' (• _unicode_value | _byte_value) ''' _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' + _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char + char_lit : ''' (• _unicode_value | _byte_value) ''' } Transitions: ['0','9'] -> S75 @@ -1064,12 +1064,12 @@ Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} S62{ - _little_u_value : '\' 'u' • _hex_digit _hex_digit _hex_digit _hex_digit - _unicode_value : . | • _little_u_value | _big_u_value | _escaped_char - char_lit : ''' (• _unicode_value | _byte_value) ''' _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' + _little_u_value : '\' 'u' • _hex_digit _hex_digit _hex_digit _hex_digit + _unicode_value : . | • _little_u_value | _big_u_value | _escaped_char + char_lit : ''' (• _unicode_value | _byte_value) ''' } Transitions: ['0','9'] -> S76 @@ -1079,12 +1079,12 @@ Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} S63{ - _hex_byte_value : '\' 'x' • _hex_digit _hex_digit _byte_value : _octal_byte_value | • _hex_byte_value - char_lit : ''' (_unicode_value | • _byte_value) ''' + _hex_byte_value : '\' 'x' • _hex_digit _hex_digit _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' + char_lit : ''' (_unicode_value | • _byte_value) ''' } Transitions: ['0','9'] -> S77 @@ -1101,11 +1101,11 @@ Action: Accept("char_lit") Symbols classes: {} S65{ + !comment : _lineComment | • _blockComment _blockComment : '/' '*' {. | '*'} '*' • '/' _blockComment : '/' '*' {. | '*'} • '*' '/' _blockComment : '/' '*' {. | • '*'} '*' '/' _blockComment : '/' '*' {• . | '*'} '*' '/' - !comment : _lineComment | • _blockComment } Transitions: ['*','*'] -> S65 @@ -1115,8 +1115,8 @@ Action: nil Symbols classes: {['*','*'], ['/','/']} S66{ - _lineComment : '/' '/' {.} '\n' • !comment : (_lineComment | _blockComment) • + _lineComment : '/' '/' {.} '\n' • } Transitions: Action: Ignore("!comment") @@ -1133,20 +1133,20 @@ Action: nil Symbols classes: {['>','>']} S68{ - Λ : 'e' 'm' 'p' • 't' 'y' - _lowcase : 'a'-'z' • - _id_char : (_upcase | _lowcase | '_' | _digit) • - _tokId : _lowcase {_id_char} • - _tokId : _lowcase {• _id_char} - tokId : _tokId • - tokId : • _tokId + _digit : • '0'-'9' _id_char : _upcase | _lowcase | '_' | • _digit - _id_char : _upcase | _lowcase | • '_' | _digit + _id_char : (_upcase | _lowcase | '_' | _digit) • _id_char : _upcase | • _lowcase | '_' | _digit _id_char : • _upcase | _lowcase | '_' | _digit - _digit : • '0'-'9' + _id_char : _upcase | _lowcase | • '_' | _digit _lowcase : • 'a'-'z' + _lowcase : 'a'-'z' • + _tokId : _lowcase {• _id_char} + _tokId : _lowcase {_id_char} • _upcase : • 'A'-'Z' + tokId : • _tokId + tokId : _tokId • + Λ : 'e' 'm' 'p' • 't' 'y' } Transitions: ['0','9'] -> S44 @@ -1159,20 +1159,20 @@ Action: Accept("tokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','s'], ['t','t'], ['u','z']} S69{ - Λ : 'e' 'r' 'r' • 'o' 'r' - _lowcase : 'a'-'z' • - _id_char : (_upcase | _lowcase | '_' | _digit) • - _tokId : _lowcase {_id_char} • - _tokId : _lowcase {• _id_char} - tokId : _tokId • - tokId : • _tokId + _digit : • '0'-'9' _id_char : _upcase | _lowcase | '_' | • _digit - _id_char : _upcase | _lowcase | • '_' | _digit + _id_char : (_upcase | _lowcase | '_' | _digit) • _id_char : _upcase | • _lowcase | '_' | _digit _id_char : • _upcase | _lowcase | '_' | _digit - _digit : • '0'-'9' + _id_char : _upcase | _lowcase | • '_' | _digit _lowcase : • 'a'-'z' + _lowcase : 'a'-'z' • + _tokId : _lowcase {• _id_char} + _tokId : _lowcase {_id_char} • _upcase : • 'A'-'Z' + tokId : • _tokId + tokId : _tokId • + Λ : 'e' 'r' 'r' • 'o' 'r' } Transitions: ['0','9'] -> S44 @@ -1185,12 +1185,12 @@ Action: Accept("tokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','n'], ['o','o'], ['p','z']} S70{ - _octal_digit : '0'-'7' • - _octal_byte_value : '\' _octal_digit _octal_digit • _octal_digit _byte_value : • _octal_byte_value | _hex_byte_value _interpreted_string : '"' {_unicode_value | • _byte_value} '"' - string_lit : _raw_string | • _interpreted_string + _octal_byte_value : '\' _octal_digit _octal_digit • _octal_digit + _octal_digit : '0'-'7' • _octal_digit : • '0'-'7' + string_lit : _raw_string | • _interpreted_string } Transitions: ['0','7'] -> S82 @@ -1198,14 +1198,14 @@ Action: nil Symbols classes: {['0','7']} S71{ - _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _big_u_value : '\' 'U' _hex_digit • _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit - _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char - _interpreted_string : '"' {• _unicode_value | _byte_value} '"' - string_lit : _raw_string | • _interpreted_string + _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' + _interpreted_string : '"' {• _unicode_value | _byte_value} '"' + _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char + string_lit : _raw_string | • _interpreted_string } Transitions: ['0','9'] -> S83 @@ -1216,13 +1216,13 @@ Symbols classes: {['0','9'], ['A','F'], ['a','f']} S72{ _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • + _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' + _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' + _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' + _interpreted_string : '"' {• _unicode_value | _byte_value} '"' _little_u_value : '\' 'u' _hex_digit • _hex_digit _hex_digit _hex_digit _unicode_value : . | • _little_u_value | _big_u_value | _escaped_char - _interpreted_string : '"' {• _unicode_value | _byte_value} '"' string_lit : _raw_string | • _interpreted_string - _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' - _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' - _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' } Transitions: ['0','9'] -> S84 @@ -1232,14 +1232,14 @@ Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} S73{ - _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • - _hex_byte_value : '\' 'x' _hex_digit • _hex_digit _byte_value : _octal_byte_value | • _hex_byte_value - _interpreted_string : '"' {_unicode_value | • _byte_value} '"' - string_lit : _raw_string | • _interpreted_string + _hex_byte_value : '\' 'x' _hex_digit • _hex_digit + _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' + _interpreted_string : '"' {_unicode_value | • _byte_value} '"' + string_lit : _raw_string | • _interpreted_string } Transitions: ['0','9'] -> S85 @@ -1249,11 +1249,11 @@ Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} S74{ - _octal_digit : '0'-'7' • - _octal_byte_value : '\' _octal_digit _octal_digit • _octal_digit _byte_value : • _octal_byte_value | _hex_byte_value - char_lit : ''' (_unicode_value | • _byte_value) ''' + _octal_byte_value : '\' _octal_digit _octal_digit • _octal_digit + _octal_digit : '0'-'7' • _octal_digit : • '0'-'7' + char_lit : ''' (_unicode_value | • _byte_value) ''' } Transitions: ['0','7'] -> S86 @@ -1261,13 +1261,13 @@ Action: nil Symbols classes: {['0','7']} S75{ - _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _big_u_value : '\' 'U' _hex_digit • _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit - _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char - char_lit : ''' (• _unicode_value | _byte_value) ''' + _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' + _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char + char_lit : ''' (• _unicode_value | _byte_value) ''' } Transitions: ['0','9'] -> S87 @@ -1278,12 +1278,12 @@ Symbols classes: {['0','9'], ['A','F'], ['a','f']} S76{ _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • - _little_u_value : '\' 'u' _hex_digit • _hex_digit _hex_digit _hex_digit - _unicode_value : . | • _little_u_value | _big_u_value | _escaped_char - char_lit : ''' (• _unicode_value | _byte_value) ''' _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' + _little_u_value : '\' 'u' _hex_digit • _hex_digit _hex_digit _hex_digit + _unicode_value : . | • _little_u_value | _big_u_value | _escaped_char + char_lit : ''' (• _unicode_value | _byte_value) ''' } Transitions: ['0','9'] -> S88 @@ -1293,13 +1293,13 @@ Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} S77{ - _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • - _hex_byte_value : '\' 'x' _hex_digit • _hex_digit _byte_value : _octal_byte_value | • _hex_byte_value - char_lit : ''' (_unicode_value | • _byte_value) ''' + _hex_byte_value : '\' 'x' _hex_digit • _hex_digit + _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' + char_lit : ''' (_unicode_value | • _byte_value) ''' } Transitions: ['0','9'] -> S89 @@ -1309,8 +1309,8 @@ Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} S78{ - _blockComment : '/' '*' {. | '*'} '*' '/' • !comment : (_lineComment | _blockComment) • + _blockComment : '/' '*' {. | '*'} '*' '/' • } Transitions: Action: Ignore("!comment") @@ -1325,20 +1325,20 @@ Action: nil Symbols classes: {['>','>']} S80{ - Λ : 'e' 'm' 'p' 't' • 'y' - _lowcase : 'a'-'z' • - _id_char : (_upcase | _lowcase | '_' | _digit) • - _tokId : _lowcase {_id_char} • - _tokId : _lowcase {• _id_char} - tokId : _tokId • - tokId : • _tokId + _digit : • '0'-'9' _id_char : _upcase | _lowcase | '_' | • _digit - _id_char : _upcase | _lowcase | • '_' | _digit + _id_char : (_upcase | _lowcase | '_' | _digit) • _id_char : _upcase | • _lowcase | '_' | _digit _id_char : • _upcase | _lowcase | '_' | _digit - _digit : • '0'-'9' + _id_char : _upcase | _lowcase | • '_' | _digit _lowcase : • 'a'-'z' + _lowcase : 'a'-'z' • + _tokId : _lowcase {• _id_char} + _tokId : _lowcase {_id_char} • _upcase : • 'A'-'Z' + tokId : • _tokId + tokId : _tokId • + Λ : 'e' 'm' 'p' 't' • 'y' } Transitions: ['0','9'] -> S44 @@ -1351,20 +1351,20 @@ Action: Accept("tokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','x'], ['y','y'], ['z','z']} S81{ - Λ : 'e' 'r' 'r' 'o' • 'r' - _lowcase : 'a'-'z' • - _id_char : (_upcase | _lowcase | '_' | _digit) • - _tokId : _lowcase {_id_char} • - _tokId : _lowcase {• _id_char} - tokId : _tokId • - tokId : • _tokId + _digit : • '0'-'9' _id_char : _upcase | _lowcase | '_' | • _digit - _id_char : _upcase | _lowcase | • '_' | _digit + _id_char : (_upcase | _lowcase | '_' | _digit) • _id_char : _upcase | • _lowcase | '_' | _digit _id_char : • _upcase | _lowcase | '_' | _digit - _digit : • '0'-'9' + _id_char : _upcase | _lowcase | • '_' | _digit _lowcase : • 'a'-'z' + _lowcase : 'a'-'z' • + _tokId : _lowcase {• _id_char} + _tokId : _lowcase {_id_char} • _upcase : • 'A'-'Z' + tokId : • _tokId + tokId : _tokId • + Λ : 'e' 'r' 'r' 'o' • 'r' } Transitions: ['0','9'] -> S44 @@ -1375,26 +1375,26 @@ Transitions: ['s','z'] -> S47 Action: Accept("tokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','q'], ['r','r'], ['s','z']} - -S82{ - _octal_digit : '0'-'7' • - _octal_byte_value : '\' _octal_digit _octal_digit _octal_digit • - _byte_value : (_octal_byte_value | _hex_byte_value) • - _interpreted_string : '"' {_unicode_value | _byte_value} • '"' - _interpreted_string : '"' {_unicode_value | • _byte_value} '"' - _interpreted_string : '"' {• _unicode_value | _byte_value} '"' - string_lit : _raw_string | • _interpreted_string - _byte_value : _octal_byte_value | • _hex_byte_value - _byte_value : • _octal_byte_value | _hex_byte_value - _unicode_value : . | _little_u_value | _big_u_value | • _escaped_char - _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char - _unicode_value : . | • _little_u_value | _big_u_value | _escaped_char - _unicode_value : • . | _little_u_value | _big_u_value | _escaped_char - _hex_byte_value : • '\' 'x' _hex_digit _hex_digit - _octal_byte_value : • '\' _octal_digit _octal_digit _octal_digit - _escaped_char : • '\' ('a' | 'b' | 'f' | 'n' | 'r' | 't' | 'v' | '\' | ''' | '"') + +S82{ _big_u_value : • '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit + _byte_value : _octal_byte_value | • _hex_byte_value + _byte_value : (_octal_byte_value | _hex_byte_value) • + _byte_value : • _octal_byte_value | _hex_byte_value + _escaped_char : • '\' ('a' | 'b' | 'f' | 'n' | 'r' | 't' | 'v' | '\' | ''' | '"') + _hex_byte_value : • '\' 'x' _hex_digit _hex_digit + _interpreted_string : '"' {_unicode_value | _byte_value} • '"' + _interpreted_string : '"' {• _unicode_value | _byte_value} '"' + _interpreted_string : '"' {_unicode_value | • _byte_value} '"' _little_u_value : • '\' 'u' _hex_digit _hex_digit _hex_digit _hex_digit + _octal_byte_value : '\' _octal_digit _octal_digit _octal_digit • + _octal_byte_value : • '\' _octal_digit _octal_digit _octal_digit + _octal_digit : '0'-'7' • + _unicode_value : • . | _little_u_value | _big_u_value | _escaped_char + _unicode_value : . | • _little_u_value | _big_u_value | _escaped_char + _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char + _unicode_value : . | _little_u_value | _big_u_value | • _escaped_char + string_lit : _raw_string | • _interpreted_string } Transitions: ['"','"'] -> S27 @@ -1404,14 +1404,14 @@ Action: nil Symbols classes: {['"','"'], ['\','\']} S83{ - _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _big_u_value : '\' 'U' _hex_digit _hex_digit • _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit - _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char - _interpreted_string : '"' {• _unicode_value | _byte_value} '"' - string_lit : _raw_string | • _interpreted_string + _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' + _interpreted_string : '"' {• _unicode_value | _byte_value} '"' + _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char + string_lit : _raw_string | • _interpreted_string } Transitions: ['0','9'] -> S93 @@ -1422,13 +1422,13 @@ Symbols classes: {['0','9'], ['A','F'], ['a','f']} S84{ _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • + _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' + _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' + _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' + _interpreted_string : '"' {• _unicode_value | _byte_value} '"' _little_u_value : '\' 'u' _hex_digit _hex_digit • _hex_digit _hex_digit _unicode_value : . | • _little_u_value | _big_u_value | _escaped_char - _interpreted_string : '"' {• _unicode_value | _byte_value} '"' string_lit : _raw_string | • _interpreted_string - _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' - _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' - _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' } Transitions: ['0','9'] -> S94 @@ -1438,24 +1438,24 @@ Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} S85{ - _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • - _hex_byte_value : '\' 'x' _hex_digit _hex_digit • - _byte_value : (_octal_byte_value | _hex_byte_value) • - _interpreted_string : '"' {_unicode_value | _byte_value} • '"' - _interpreted_string : '"' {_unicode_value | • _byte_value} '"' - _interpreted_string : '"' {• _unicode_value | _byte_value} '"' - string_lit : _raw_string | • _interpreted_string + _big_u_value : • '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _byte_value : _octal_byte_value | • _hex_byte_value + _byte_value : (_octal_byte_value | _hex_byte_value) • _byte_value : • _octal_byte_value | _hex_byte_value - _unicode_value : . | _little_u_value | _big_u_value | • _escaped_char - _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char - _unicode_value : . | • _little_u_value | _big_u_value | _escaped_char - _unicode_value : • . | _little_u_value | _big_u_value | _escaped_char - _hex_byte_value : • '\' 'x' _hex_digit _hex_digit - _octal_byte_value : • '\' _octal_digit _octal_digit _octal_digit _escaped_char : • '\' ('a' | 'b' | 'f' | 'n' | 'r' | 't' | 'v' | '\' | ''' | '"') - _big_u_value : • '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit + _hex_byte_value : • '\' 'x' _hex_digit _hex_digit + _hex_byte_value : '\' 'x' _hex_digit _hex_digit • + _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • + _interpreted_string : '"' {• _unicode_value | _byte_value} '"' + _interpreted_string : '"' {_unicode_value | _byte_value} • '"' + _interpreted_string : '"' {_unicode_value | • _byte_value} '"' _little_u_value : • '\' 'u' _hex_digit _hex_digit _hex_digit _hex_digit + _octal_byte_value : • '\' _octal_digit _octal_digit _octal_digit + _unicode_value : • . | _little_u_value | _big_u_value | _escaped_char + _unicode_value : . | • _little_u_value | _big_u_value | _escaped_char + _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char + _unicode_value : . | _little_u_value | _big_u_value | • _escaped_char + string_lit : _raw_string | • _interpreted_string } Transitions: ['"','"'] -> S27 @@ -1465,9 +1465,9 @@ Action: nil Symbols classes: {['"','"'], ['\','\']} S86{ - _octal_digit : '0'-'7' • - _octal_byte_value : '\' _octal_digit _octal_digit _octal_digit • _byte_value : (_octal_byte_value | _hex_byte_value) • + _octal_byte_value : '\' _octal_digit _octal_digit _octal_digit • + _octal_digit : '0'-'7' • char_lit : ''' (_unicode_value | _byte_value) • ''' } Transitions: @@ -1476,13 +1476,13 @@ Action: nil Symbols classes: {[''',''']} S87{ - _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _big_u_value : '\' 'U' _hex_digit _hex_digit • _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit - _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char - char_lit : ''' (• _unicode_value | _byte_value) ''' + _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' + _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char + char_lit : ''' (• _unicode_value | _byte_value) ''' } Transitions: ['0','9'] -> S95 @@ -1493,12 +1493,12 @@ Symbols classes: {['0','9'], ['A','F'], ['a','f']} S88{ _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • - _little_u_value : '\' 'u' _hex_digit _hex_digit • _hex_digit _hex_digit - _unicode_value : . | • _little_u_value | _big_u_value | _escaped_char - char_lit : ''' (• _unicode_value | _byte_value) ''' _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' + _little_u_value : '\' 'u' _hex_digit _hex_digit • _hex_digit _hex_digit + _unicode_value : . | • _little_u_value | _big_u_value | _escaped_char + char_lit : ''' (• _unicode_value | _byte_value) ''' } Transitions: ['0','9'] -> S96 @@ -1508,9 +1508,9 @@ Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} S89{ - _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • - _hex_byte_value : '\' 'x' _hex_digit _hex_digit • _byte_value : (_octal_byte_value | _hex_byte_value) • + _hex_byte_value : '\' 'x' _hex_digit _hex_digit • + _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • char_lit : ''' (_unicode_value | _byte_value) • ''' } Transitions: @@ -1526,20 +1526,20 @@ Action: Accept("g_sdt_lit") Symbols classes: {} S91{ - Λ : 'e' 'm' 'p' 't' 'y' • - _lowcase : 'a'-'z' • - _id_char : (_upcase | _lowcase | '_' | _digit) • - _tokId : _lowcase {_id_char} • - _tokId : _lowcase {• _id_char} - tokId : _tokId • - tokId : • _tokId + _digit : • '0'-'9' _id_char : _upcase | _lowcase | '_' | • _digit - _id_char : _upcase | _lowcase | • '_' | _digit + _id_char : (_upcase | _lowcase | '_' | _digit) • _id_char : _upcase | • _lowcase | '_' | _digit _id_char : • _upcase | _lowcase | '_' | _digit - _digit : • '0'-'9' + _id_char : _upcase | _lowcase | • '_' | _digit _lowcase : • 'a'-'z' + _lowcase : 'a'-'z' • + _tokId : _lowcase {• _id_char} + _tokId : _lowcase {_id_char} • _upcase : • 'A'-'Z' + tokId : • _tokId + tokId : _tokId • + Λ : 'e' 'm' 'p' 't' 'y' • } Transitions: ['0','9'] -> S44 @@ -1550,20 +1550,20 @@ Action: Accept("Λ") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} S92{ - Λ : 'e' 'r' 'r' 'o' 'r' • - _lowcase : 'a'-'z' • - _id_char : (_upcase | _lowcase | '_' | _digit) • - _tokId : _lowcase {_id_char} • - _tokId : _lowcase {• _id_char} - tokId : _tokId • - tokId : • _tokId + _digit : • '0'-'9' _id_char : _upcase | _lowcase | '_' | • _digit - _id_char : _upcase | _lowcase | • '_' | _digit + _id_char : (_upcase | _lowcase | '_' | _digit) • _id_char : _upcase | • _lowcase | '_' | _digit _id_char : • _upcase | _lowcase | '_' | _digit - _digit : • '0'-'9' + _id_char : _upcase | _lowcase | • '_' | _digit _lowcase : • 'a'-'z' + _lowcase : 'a'-'z' • + _tokId : _lowcase {• _id_char} + _tokId : _lowcase {_id_char} • _upcase : • 'A'-'Z' + tokId : • _tokId + tokId : _tokId • + Λ : 'e' 'r' 'r' 'o' 'r' • } Transitions: ['0','9'] -> S44 @@ -1574,14 +1574,14 @@ Action: Accept("Λ") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} S93{ - _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit • _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit - _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char - _interpreted_string : '"' {• _unicode_value | _byte_value} '"' - string_lit : _raw_string | • _interpreted_string + _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' + _interpreted_string : '"' {• _unicode_value | _byte_value} '"' + _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char + string_lit : _raw_string | • _interpreted_string } Transitions: ['0','9'] -> S97 @@ -1592,13 +1592,13 @@ Symbols classes: {['0','9'], ['A','F'], ['a','f']} S94{ _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • + _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' + _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' + _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' + _interpreted_string : '"' {• _unicode_value | _byte_value} '"' _little_u_value : '\' 'u' _hex_digit _hex_digit _hex_digit • _hex_digit _unicode_value : . | • _little_u_value | _big_u_value | _escaped_char - _interpreted_string : '"' {• _unicode_value | _byte_value} '"' string_lit : _raw_string | • _interpreted_string - _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' - _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' - _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' } Transitions: ['0','9'] -> S98 @@ -1608,13 +1608,13 @@ Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} S95{ - _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit • _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit - _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char - char_lit : ''' (• _unicode_value | _byte_value) ''' + _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' + _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char + char_lit : ''' (• _unicode_value | _byte_value) ''' } Transitions: ['0','9'] -> S99 @@ -1625,12 +1625,12 @@ Symbols classes: {['0','9'], ['A','F'], ['a','f']} S96{ _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • - _little_u_value : '\' 'u' _hex_digit _hex_digit _hex_digit • _hex_digit - _unicode_value : . | • _little_u_value | _big_u_value | _escaped_char - char_lit : ''' (• _unicode_value | _byte_value) ''' _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' + _little_u_value : '\' 'u' _hex_digit _hex_digit _hex_digit • _hex_digit + _unicode_value : . | • _little_u_value | _big_u_value | _escaped_char + char_lit : ''' (• _unicode_value | _byte_value) ''' } Transitions: ['0','9'] -> S100 @@ -1640,14 +1640,14 @@ Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} S97{ - _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit • _hex_digit _hex_digit _hex_digit _hex_digit - _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char - _interpreted_string : '"' {• _unicode_value | _byte_value} '"' - string_lit : _raw_string | • _interpreted_string + _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' + _interpreted_string : '"' {• _unicode_value | _byte_value} '"' + _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char + string_lit : _raw_string | • _interpreted_string } Transitions: ['0','9'] -> S101 @@ -1657,24 +1657,24 @@ Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} S98{ + _big_u_value : • '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit + _byte_value : _octal_byte_value | • _hex_byte_value + _byte_value : • _octal_byte_value | _hex_byte_value + _escaped_char : • '\' ('a' | 'b' | 'f' | 'n' | 'r' | 't' | 'v' | '\' | ''' | '"') + _hex_byte_value : • '\' 'x' _hex_digit _hex_digit _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • - _little_u_value : '\' 'u' _hex_digit _hex_digit _hex_digit _hex_digit • - _unicode_value : (. | _little_u_value | _big_u_value | _escaped_char) • - _interpreted_string : '"' {_unicode_value | _byte_value} • '"' _interpreted_string : '"' {_unicode_value | • _byte_value} '"' _interpreted_string : '"' {• _unicode_value | _byte_value} '"' - string_lit : _raw_string | • _interpreted_string - _byte_value : _octal_byte_value | • _hex_byte_value - _byte_value : • _octal_byte_value | _hex_byte_value - _unicode_value : . | _little_u_value | _big_u_value | • _escaped_char - _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char + _interpreted_string : '"' {_unicode_value | _byte_value} • '"' + _little_u_value : '\' 'u' _hex_digit _hex_digit _hex_digit _hex_digit • + _little_u_value : • '\' 'u' _hex_digit _hex_digit _hex_digit _hex_digit + _octal_byte_value : • '\' _octal_digit _octal_digit _octal_digit _unicode_value : . | • _little_u_value | _big_u_value | _escaped_char _unicode_value : • . | _little_u_value | _big_u_value | _escaped_char - _hex_byte_value : • '\' 'x' _hex_digit _hex_digit - _octal_byte_value : • '\' _octal_digit _octal_digit _octal_digit - _escaped_char : • '\' ('a' | 'b' | 'f' | 'n' | 'r' | 't' | 'v' | '\' | ''' | '"') - _big_u_value : • '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit - _little_u_value : • '\' 'u' _hex_digit _hex_digit _hex_digit _hex_digit + _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char + _unicode_value : (. | _little_u_value | _big_u_value | _escaped_char) • + _unicode_value : . | _little_u_value | _big_u_value | • _escaped_char + string_lit : _raw_string | • _interpreted_string } Transitions: ['"','"'] -> S27 @@ -1684,13 +1684,13 @@ Action: nil Symbols classes: {['"','"'], ['\','\']} S99{ - _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit • _hex_digit _hex_digit _hex_digit _hex_digit - _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char - char_lit : ''' (• _unicode_value | _byte_value) ''' + _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' + _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char + char_lit : ''' (• _unicode_value | _byte_value) ''' } Transitions: ['0','9'] -> S102 @@ -1711,14 +1711,14 @@ Action: nil Symbols classes: {[''',''']} S101{ - _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit • _hex_digit _hex_digit _hex_digit - _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char - _interpreted_string : '"' {• _unicode_value | _byte_value} '"' - string_lit : _raw_string | • _interpreted_string + _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' + _interpreted_string : '"' {• _unicode_value | _byte_value} '"' + _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char + string_lit : _raw_string | • _interpreted_string } Transitions: ['0','9'] -> S103 @@ -1728,13 +1728,13 @@ Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} S102{ - _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit • _hex_digit _hex_digit _hex_digit - _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char - char_lit : ''' (• _unicode_value | _byte_value) ''' + _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' + _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char + char_lit : ''' (• _unicode_value | _byte_value) ''' } Transitions: ['0','9'] -> S104 @@ -1744,14 +1744,14 @@ Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} S103{ - _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit • _hex_digit _hex_digit - _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char - _interpreted_string : '"' {• _unicode_value | _byte_value} '"' - string_lit : _raw_string | • _interpreted_string + _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' + _interpreted_string : '"' {• _unicode_value | _byte_value} '"' + _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char + string_lit : _raw_string | • _interpreted_string } Transitions: ['0','9'] -> S105 @@ -1761,13 +1761,13 @@ Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} S104{ - _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit • _hex_digit _hex_digit - _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char - char_lit : ''' (• _unicode_value | _byte_value) ''' + _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' + _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char + char_lit : ''' (• _unicode_value | _byte_value) ''' } Transitions: ['0','9'] -> S106 @@ -1777,14 +1777,14 @@ Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} S105{ - _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit • _hex_digit - _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char - _interpreted_string : '"' {• _unicode_value | _byte_value} '"' - string_lit : _raw_string | • _interpreted_string + _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' + _interpreted_string : '"' {• _unicode_value | _byte_value} '"' + _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char + string_lit : _raw_string | • _interpreted_string } Transitions: ['0','9'] -> S107 @@ -1794,13 +1794,13 @@ Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} S106{ - _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit • _hex_digit - _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char - char_lit : ''' (• _unicode_value | _byte_value) ''' + _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' + _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char + char_lit : ''' (• _unicode_value | _byte_value) ''' } Transitions: ['0','9'] -> S108 @@ -1810,24 +1810,24 @@ Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} S107{ - _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit • - _unicode_value : (. | _little_u_value | _big_u_value | _escaped_char) • - _interpreted_string : '"' {_unicode_value | _byte_value} • '"' - _interpreted_string : '"' {_unicode_value | • _byte_value} '"' - _interpreted_string : '"' {• _unicode_value | _byte_value} '"' - string_lit : _raw_string | • _interpreted_string + _big_u_value : • '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _byte_value : _octal_byte_value | • _hex_byte_value _byte_value : • _octal_byte_value | _hex_byte_value - _unicode_value : . | _little_u_value | _big_u_value | • _escaped_char - _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char - _unicode_value : . | • _little_u_value | _big_u_value | _escaped_char - _unicode_value : • . | _little_u_value | _big_u_value | _escaped_char - _hex_byte_value : • '\' 'x' _hex_digit _hex_digit - _octal_byte_value : • '\' _octal_digit _octal_digit _octal_digit _escaped_char : • '\' ('a' | 'b' | 'f' | 'n' | 'r' | 't' | 'v' | '\' | ''' | '"') - _big_u_value : • '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit + _hex_byte_value : • '\' 'x' _hex_digit _hex_digit + _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • + _interpreted_string : '"' {_unicode_value | • _byte_value} '"' + _interpreted_string : '"' {• _unicode_value | _byte_value} '"' + _interpreted_string : '"' {_unicode_value | _byte_value} • '"' _little_u_value : • '\' 'u' _hex_digit _hex_digit _hex_digit _hex_digit + _octal_byte_value : • '\' _octal_digit _octal_digit _octal_digit + _unicode_value : . | • _little_u_value | _big_u_value | _escaped_char + _unicode_value : • . | _little_u_value | _big_u_value | _escaped_char + _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char + _unicode_value : (. | _little_u_value | _big_u_value | _escaped_char) • + _unicode_value : . | _little_u_value | _big_u_value | • _escaped_char + string_lit : _raw_string | • _interpreted_string } Transitions: ['"','"'] -> S27 @@ -1837,8 +1837,8 @@ Action: nil Symbols classes: {['"','"'], ['\','\']} S108{ - _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit • + _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _unicode_value : (. | _little_u_value | _big_u_value | _escaped_char) • char_lit : ''' (_unicode_value | _byte_value) • ''' } diff --git a/internal/lexer/items/itemlist.go b/internal/lexer/items/itemlist.go index ede7a52f..d6bbb666 100644 --- a/internal/lexer/items/itemlist.go +++ b/internal/lexer/items/itemlist.go @@ -26,6 +26,20 @@ import ( // Each Itemset element is a ItemList type ItemList []*Item +func (l ItemList) Len() int { + return len(l) +} + +func (l ItemList) Less(i, j int) bool { + return l[i].Id < l[j].Id +} + +func (l ItemList) Swap(i, j int) { + t := l[i] + l[i] = l[j] + l[j] = t +} + func NewItemList(len int) ItemList { if len < 8 { len = 8 diff --git a/internal/lexer/items/itemsets.go b/internal/lexer/items/itemsets.go index 919cef7f..7c293cef 100644 --- a/internal/lexer/items/itemsets.go +++ b/internal/lexer/items/itemsets.go @@ -16,6 +16,7 @@ package items import ( "fmt" + "sort" "strings" "github.com/maxcalandrelli/gocc/internal/ast" @@ -103,7 +104,9 @@ func (this *ItemSets) String() string { fmt.Fprintf(buf, "Item sets:\n") for i, s := range this.sets { fmt.Fprintf(buf, "S%d{\n", i) - for _, item := range s.Items { + s_items := s.Items + sort.Sort(s_items) + for _, item := range s_items { fmt.Fprintf(buf, "\t%s\n", item) } fmt.Fprintf(buf, "}\n") From b9f1c3fd9a8754b91840bcd184b69ec05cfee49c Mon Sep 17 00:00:00 2001 From: Massimiliano Calandrelli Date: Mon, 7 Oct 2019 19:11:29 +0200 Subject: [PATCH 10/33] ... --- internal/frontend/reparsed/log/lexer_sets.txt | 312 +++++++++--------- internal/lexer/items/itemlist.go | 2 +- 2 files changed, 157 insertions(+), 157 deletions(-) diff --git a/internal/frontend/reparsed/log/lexer_sets.txt b/internal/frontend/reparsed/log/lexer_sets.txt index 5d358dce..62753eca 100644 --- a/internal/frontend/reparsed/log/lexer_sets.txt +++ b/internal/frontend/reparsed/log/lexer_sets.txt @@ -94,15 +94,15 @@ S3{ _byte_value : • _octal_byte_value | _hex_byte_value _escaped_char : • '\' ('a' | 'b' | 'f' | 'n' | 'r' | 't' | 'v' | '\' | ''' | '"') _hex_byte_value : • '\' 'x' _hex_digit _hex_digit + _interpreted_string : '"' {_unicode_value | _byte_value} • '"' _interpreted_string : '"' {_unicode_value | • _byte_value} '"' _interpreted_string : '"' {• _unicode_value | _byte_value} '"' - _interpreted_string : '"' {_unicode_value | _byte_value} • '"' _little_u_value : • '\' 'u' _hex_digit _hex_digit _hex_digit _hex_digit _octal_byte_value : • '\' _octal_digit _octal_digit _octal_digit - _unicode_value : • . | _little_u_value | _big_u_value | _escaped_char - _unicode_value : . | • _little_u_value | _big_u_value | _escaped_char _unicode_value : . | _little_u_value | _big_u_value | • _escaped_char _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char + _unicode_value : . | • _little_u_value | _big_u_value | _escaped_char + _unicode_value : • . | _little_u_value | _big_u_value | _escaped_char string_lit : _raw_string | • _interpreted_string } Transitions: @@ -120,12 +120,12 @@ S4{ _hex_byte_value : • '\' 'x' _hex_digit _hex_digit _little_u_value : • '\' 'u' _hex_digit _hex_digit _hex_digit _hex_digit _octal_byte_value : • '\' _octal_digit _octal_digit _octal_digit + _unicode_value : . | _little_u_value | _big_u_value | • _escaped_char + _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char _unicode_value : . | • _little_u_value | _big_u_value | _escaped_char _unicode_value : • . | _little_u_value | _big_u_value | _escaped_char - _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char - _unicode_value : . | _little_u_value | _big_u_value | • _escaped_char - char_lit : ''' (• _unicode_value | _byte_value) ''' char_lit : ''' (_unicode_value | • _byte_value) ''' + char_lit : ''' (• _unicode_value | _byte_value) ''' } Transitions: ['\','\'] -> S30 @@ -197,10 +197,10 @@ Symbols classes: {['<','<']} S13{ _digit : • '0'-'9' - _id_char : • _upcase | _lowcase | '_' | _digit _id_char : _upcase | _lowcase | '_' | • _digit _id_char : _upcase | _lowcase | • '_' | _digit _id_char : _upcase | • _lowcase | '_' | _digit + _id_char : • _upcase | _lowcase | '_' | _digit _lowcase : • 'a'-'z' _upcase : 'A'-'Z' • _upcase : • 'A'-'Z' @@ -261,12 +261,12 @@ Symbols classes: {['`','`']} S18{ _digit : • '0'-'9' + _id_char : _upcase | _lowcase | '_' | • _digit _id_char : _upcase | _lowcase | • '_' | _digit _id_char : _upcase | • _lowcase | '_' | _digit _id_char : • _upcase | _lowcase | '_' | _digit - _id_char : _upcase | _lowcase | '_' | • _digit - _lowcase : • 'a'-'z' _lowcase : 'a'-'z' • + _lowcase : • 'a'-'z' _tokId : _lowcase {_id_char} • _tokId : _lowcase {• _id_char} _upcase : • 'A'-'Z' @@ -283,17 +283,17 @@ Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} S19{ _digit : • '0'-'9' - _id_char : _upcase | • _lowcase | '_' | _digit _id_char : _upcase | _lowcase | '_' | • _digit _id_char : _upcase | _lowcase | • '_' | _digit + _id_char : _upcase | • _lowcase | '_' | _digit _id_char : • _upcase | _lowcase | '_' | _digit - _lowcase : • 'a'-'z' _lowcase : 'a'-'z' • + _lowcase : • 'a'-'z' _tokId : _lowcase {_id_char} • _tokId : _lowcase {• _id_char} _upcase : • 'A'-'Z' - tokId : • _tokId tokId : _tokId • + tokId : • _tokId Λ : 'e' • 'm' 'p' 't' 'y' Λ : 'e' • 'r' 'r' 'o' 'r' } @@ -353,12 +353,12 @@ Symbols classes: {} S26{ _digit : • '0'-'9' + _id_char : _upcase | _lowcase | '_' | • _digit _id_char : _upcase | _lowcase | • '_' | _digit _id_char : _upcase | • _lowcase | '_' | _digit _id_char : • _upcase | _lowcase | '_' | _digit - _id_char : _upcase | _lowcase | '_' | • _digit - _lowcase : • 'a'-'z' _lowcase : 'a'-'z' • + _lowcase : • 'a'-'z' _tokId : _lowcase {_id_char} • _tokId : _lowcase {• _id_char} _upcase : • 'A'-'Z' @@ -383,27 +383,27 @@ Symbols classes: {} S28{ _big_u_value : '\' • 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit - _byte_value : • _octal_byte_value | _hex_byte_value _byte_value : _octal_byte_value | • _hex_byte_value + _byte_value : • _octal_byte_value | _hex_byte_value + _escaped_char : '\' ('a' | 'b' | 'f' | 'n' | 'r' | 't' | 'v' | '\' | ''' | • '"') _escaped_char : '\' ('a' | 'b' | 'f' | 'n' | 'r' | 't' | 'v' | '\' | • ''' | '"') _escaped_char : '\' ('a' | 'b' | 'f' | 'n' | 'r' | 't' | 'v' | • '\' | ''' | '"') _escaped_char : '\' ('a' | 'b' | 'f' | 'n' | 'r' | 't' | • 'v' | '\' | ''' | '"') - _escaped_char : '\' ('a' | 'b' | 'f' | 'n' | 'r' | 't' | 'v' | '\' | ''' | • '"') + _escaped_char : '\' ('a' | 'b' | 'f' | 'n' | 'r' | • 't' | 'v' | '\' | ''' | '"') _escaped_char : '\' ('a' | 'b' | 'f' | 'n' | • 'r' | 't' | 'v' | '\' | ''' | '"') _escaped_char : '\' ('a' | 'b' | 'f' | • 'n' | 'r' | 't' | 'v' | '\' | ''' | '"') _escaped_char : '\' ('a' | 'b' | • 'f' | 'n' | 'r' | 't' | 'v' | '\' | ''' | '"') _escaped_char : '\' ('a' | • 'b' | 'f' | 'n' | 'r' | 't' | 'v' | '\' | ''' | '"') _escaped_char : '\' (• 'a' | 'b' | 'f' | 'n' | 'r' | 't' | 'v' | '\' | ''' | '"') - _escaped_char : '\' ('a' | 'b' | 'f' | 'n' | 'r' | • 't' | 'v' | '\' | ''' | '"') _hex_byte_value : '\' • 'x' _hex_digit _hex_digit - _interpreted_string : '"' {• _unicode_value | _byte_value} '"' _interpreted_string : '"' {_unicode_value | • _byte_value} '"' + _interpreted_string : '"' {• _unicode_value | _byte_value} '"' _little_u_value : '\' • 'u' _hex_digit _hex_digit _hex_digit _hex_digit _octal_byte_value : '\' • _octal_digit _octal_digit _octal_digit _octal_digit : • '0'-'7' + _unicode_value : . | _little_u_value | _big_u_value | • _escaped_char _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char _unicode_value : . | • _little_u_value | _big_u_value | _escaped_char - _unicode_value : . | _little_u_value | _big_u_value | • _escaped_char string_lit : _raw_string | • _interpreted_string } Transitions: @@ -426,20 +426,20 @@ Symbols classes: {['"','"'], [''','''], ['0','7'], ['U','U'], ['\','\'], ['a','a S29{ _big_u_value : • '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit - _byte_value : • _octal_byte_value | _hex_byte_value _byte_value : _octal_byte_value | • _hex_byte_value + _byte_value : • _octal_byte_value | _hex_byte_value _escaped_char : • '\' ('a' | 'b' | 'f' | 'n' | 'r' | 't' | 'v' | '\' | ''' | '"') _hex_byte_value : • '\' 'x' _hex_digit _hex_digit + _interpreted_string : '"' {_unicode_value | _byte_value} • '"' _interpreted_string : '"' {_unicode_value | • _byte_value} '"' _interpreted_string : '"' {• _unicode_value | _byte_value} '"' - _interpreted_string : '"' {_unicode_value | _byte_value} • '"' _little_u_value : • '\' 'u' _hex_digit _hex_digit _hex_digit _hex_digit _octal_byte_value : • '\' _octal_digit _octal_digit _octal_digit + _unicode_value : (. | _little_u_value | _big_u_value | _escaped_char) • + _unicode_value : . | _little_u_value | _big_u_value | • _escaped_char _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char - _unicode_value : • . | _little_u_value | _big_u_value | _escaped_char _unicode_value : . | • _little_u_value | _big_u_value | _escaped_char - _unicode_value : . | _little_u_value | _big_u_value | • _escaped_char - _unicode_value : (. | _little_u_value | _big_u_value | _escaped_char) • + _unicode_value : • . | _little_u_value | _big_u_value | _escaped_char string_lit : _raw_string | • _interpreted_string } Transitions: @@ -451,18 +451,18 @@ Symbols classes: {['"','"'], ['\','\']} S30{ _big_u_value : '\' • 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit - _byte_value : • _octal_byte_value | _hex_byte_value _byte_value : _octal_byte_value | • _hex_byte_value + _byte_value : • _octal_byte_value | _hex_byte_value + _escaped_char : '\' ('a' | 'b' | 'f' | 'n' | 'r' | 't' | 'v' | '\' | ''' | • '"') _escaped_char : '\' ('a' | 'b' | 'f' | 'n' | 'r' | 't' | 'v' | '\' | • ''' | '"') _escaped_char : '\' ('a' | 'b' | 'f' | 'n' | 'r' | 't' | 'v' | • '\' | ''' | '"') _escaped_char : '\' ('a' | 'b' | 'f' | 'n' | 'r' | 't' | • 'v' | '\' | ''' | '"') - _escaped_char : '\' ('a' | 'b' | 'f' | 'n' | 'r' | 't' | 'v' | '\' | ''' | • '"') + _escaped_char : '\' ('a' | 'b' | 'f' | 'n' | 'r' | • 't' | 'v' | '\' | ''' | '"') _escaped_char : '\' ('a' | 'b' | 'f' | 'n' | • 'r' | 't' | 'v' | '\' | ''' | '"') _escaped_char : '\' ('a' | 'b' | 'f' | • 'n' | 'r' | 't' | 'v' | '\' | ''' | '"') _escaped_char : '\' ('a' | 'b' | • 'f' | 'n' | 'r' | 't' | 'v' | '\' | ''' | '"') _escaped_char : '\' ('a' | • 'b' | 'f' | 'n' | 'r' | 't' | 'v' | '\' | ''' | '"') _escaped_char : '\' (• 'a' | 'b' | 'f' | 'n' | 'r' | 't' | 'v' | '\' | ''' | '"') - _escaped_char : '\' ('a' | 'b' | 'f' | 'n' | 'r' | • 't' | 'v' | '\' | ''' | '"') _hex_byte_value : '\' • 'x' _hex_digit _hex_digit _little_u_value : '\' • 'u' _hex_digit _hex_digit _hex_digit _hex_digit _octal_byte_value : '\' • _octal_digit _octal_digit _octal_digit @@ -554,10 +554,10 @@ Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} S36{ _digit : • '0'-'9' - _id_char : _upcase | • _lowcase | '_' | _digit _id_char : (_upcase | _lowcase | '_' | _digit) • _id_char : _upcase | _lowcase | '_' | • _digit _id_char : _upcase | _lowcase | • '_' | _digit + _id_char : _upcase | • _lowcase | '_' | _digit _id_char : • _upcase | _lowcase | '_' | _digit _lowcase : • 'a'-'z' _upcase : 'A'-'Z' • @@ -595,13 +595,13 @@ Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} S38{ _digit : • '0'-'9' - _id_char : _upcase | • _lowcase | '_' | _digit _id_char : (_upcase | _lowcase | '_' | _digit) • _id_char : _upcase | _lowcase | '_' | • _digit _id_char : _upcase | _lowcase | • '_' | _digit + _id_char : _upcase | • _lowcase | '_' | _digit _id_char : • _upcase | _lowcase | '_' | _digit - _lowcase : • 'a'-'z' _lowcase : 'a'-'z' • + _lowcase : • 'a'-'z' _upcase : • 'A'-'Z' prodId : _upcase {_id_char} • prodId : _upcase {• _id_char} @@ -637,10 +637,10 @@ Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} S40{ _digit : • '0'-'9' - _id_char : _upcase | • _lowcase | '_' | _digit _id_char : (_upcase | _lowcase | '_' | _digit) • _id_char : _upcase | _lowcase | '_' | • _digit _id_char : _upcase | _lowcase | • '_' | _digit + _id_char : _upcase | • _lowcase | '_' | _digit _id_char : • _upcase | _lowcase | '_' | _digit _lowcase : • 'a'-'z' _upcase : 'A'-'Z' • @@ -678,13 +678,13 @@ Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} S42{ _digit : • '0'-'9' - _id_char : _upcase | • _lowcase | '_' | _digit _id_char : (_upcase | _lowcase | '_' | _digit) • _id_char : _upcase | _lowcase | '_' | • _digit _id_char : _upcase | _lowcase | • '_' | _digit + _id_char : _upcase | • _lowcase | '_' | _digit _id_char : • _upcase | _lowcase | '_' | _digit - _lowcase : • 'a'-'z' _lowcase : 'a'-'z' • + _lowcase : • 'a'-'z' _upcase : • 'A'-'Z' regDefId : '_' {_id_char} • regDefId : '_' {• _id_char} @@ -709,16 +709,16 @@ S44{ _digit : '0'-'9' • _digit : • '0'-'9' _id_char : (_upcase | _lowcase | '_' | _digit) • - _id_char : • _upcase | _lowcase | '_' | _digit - _id_char : _upcase | • _lowcase | '_' | _digit - _id_char : _upcase | _lowcase | • '_' | _digit _id_char : _upcase | _lowcase | '_' | • _digit + _id_char : _upcase | _lowcase | • '_' | _digit + _id_char : _upcase | • _lowcase | '_' | _digit + _id_char : • _upcase | _lowcase | '_' | _digit _lowcase : • 'a'-'z' - _tokId : _lowcase {• _id_char} _tokId : _lowcase {_id_char} • + _tokId : _lowcase {• _id_char} _upcase : • 'A'-'Z' - tokId : • _tokId tokId : _tokId • + tokId : • _tokId } Transitions: ['0','9'] -> S44 @@ -730,18 +730,18 @@ Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} S45{ _digit : • '0'-'9' - _id_char : • _upcase | _lowcase | '_' | _digit _id_char : (_upcase | _lowcase | '_' | _digit) • - _id_char : _upcase | • _lowcase | '_' | _digit _id_char : _upcase | _lowcase | '_' | • _digit _id_char : _upcase | _lowcase | • '_' | _digit + _id_char : _upcase | • _lowcase | '_' | _digit + _id_char : • _upcase | _lowcase | '_' | _digit _lowcase : • 'a'-'z' - _tokId : _lowcase {• _id_char} _tokId : _lowcase {_id_char} • + _tokId : _lowcase {• _id_char} _upcase : 'A'-'Z' • _upcase : • 'A'-'Z' - tokId : • _tokId tokId : _tokId • + tokId : • _tokId } Transitions: ['0','9'] -> S44 @@ -754,10 +754,10 @@ Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} S46{ _digit : • '0'-'9' _id_char : (_upcase | _lowcase | '_' | _digit) • - _id_char : _upcase | • _lowcase | '_' | _digit - _id_char : • _upcase | _lowcase | '_' | _digit _id_char : _upcase | _lowcase | '_' | • _digit _id_char : _upcase | _lowcase | • '_' | _digit + _id_char : _upcase | • _lowcase | '_' | _digit + _id_char : • _upcase | _lowcase | '_' | _digit _lowcase : • 'a'-'z' _tokId : _lowcase {_id_char} • _tokId : _lowcase {• _id_char} @@ -775,18 +775,18 @@ Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} S47{ _digit : • '0'-'9' - _id_char : _upcase | _lowcase | • '_' | _digit _id_char : (_upcase | _lowcase | '_' | _digit) • - _id_char : • _upcase | _lowcase | '_' | _digit - _id_char : _upcase | • _lowcase | '_' | _digit _id_char : _upcase | _lowcase | '_' | • _digit - _lowcase : • 'a'-'z' + _id_char : _upcase | _lowcase | • '_' | _digit + _id_char : _upcase | • _lowcase | '_' | _digit + _id_char : • _upcase | _lowcase | '_' | _digit _lowcase : 'a'-'z' • - _tokId : _lowcase {• _id_char} + _lowcase : • 'a'-'z' _tokId : _lowcase {_id_char} • + _tokId : _lowcase {• _id_char} _upcase : • 'A'-'Z' - tokId : • _tokId tokId : _tokId • + tokId : • _tokId } Transitions: ['0','9'] -> S44 @@ -798,18 +798,18 @@ Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} S48{ _digit : • '0'-'9' - _id_char : _upcase | _lowcase | '_' | • _digit _id_char : (_upcase | _lowcase | '_' | _digit) • + _id_char : _upcase | _lowcase | '_' | • _digit + _id_char : _upcase | _lowcase | • '_' | _digit _id_char : _upcase | • _lowcase | '_' | _digit _id_char : • _upcase | _lowcase | '_' | _digit - _id_char : _upcase | _lowcase | • '_' | _digit - _lowcase : • 'a'-'z' _lowcase : 'a'-'z' • - _tokId : _lowcase {• _id_char} + _lowcase : • 'a'-'z' _tokId : _lowcase {_id_char} • + _tokId : _lowcase {• _id_char} _upcase : • 'A'-'Z' - tokId : • _tokId tokId : _tokId • + tokId : • _tokId Λ : 'e' 'm' • 'p' 't' 'y' } Transitions: @@ -824,18 +824,18 @@ Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','o'], ['p','p'], ['q','z S49{ _digit : • '0'-'9' - _id_char : _upcase | _lowcase | '_' | • _digit _id_char : (_upcase | _lowcase | '_' | _digit) • + _id_char : _upcase | _lowcase | '_' | • _digit + _id_char : _upcase | _lowcase | • '_' | _digit _id_char : _upcase | • _lowcase | '_' | _digit _id_char : • _upcase | _lowcase | '_' | _digit - _id_char : _upcase | _lowcase | • '_' | _digit - _lowcase : • 'a'-'z' _lowcase : 'a'-'z' • - _tokId : _lowcase {• _id_char} + _lowcase : • 'a'-'z' _tokId : _lowcase {_id_char} • + _tokId : _lowcase {• _id_char} _upcase : • 'A'-'Z' - tokId : • _tokId tokId : _tokId • + tokId : • _tokId Λ : 'e' 'r' • 'r' 'o' 'r' } Transitions: @@ -852,16 +852,16 @@ S50{ _digit : '0'-'9' • _digit : • '0'-'9' _id_char : (_upcase | _lowcase | '_' | _digit) • - _id_char : • _upcase | _lowcase | '_' | _digit - _id_char : _upcase | • _lowcase | '_' | _digit - _id_char : _upcase | _lowcase | • '_' | _digit _id_char : _upcase | _lowcase | '_' | • _digit + _id_char : _upcase | _lowcase | • '_' | _digit + _id_char : _upcase | • _lowcase | '_' | _digit + _id_char : • _upcase | _lowcase | '_' | _digit _lowcase : • 'a'-'z' - _tokId : _lowcase {• _id_char} _tokId : _lowcase {_id_char} • + _tokId : _lowcase {• _id_char} _upcase : • 'A'-'Z' - ignoredTokId : '!' • _tokId ignoredTokId : '!' _tokId • + ignoredTokId : '!' • _tokId } Transitions: ['0','9'] -> S50 @@ -873,18 +873,18 @@ Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} S51{ _digit : • '0'-'9' - _id_char : • _upcase | _lowcase | '_' | _digit _id_char : (_upcase | _lowcase | '_' | _digit) • - _id_char : _upcase | • _lowcase | '_' | _digit _id_char : _upcase | _lowcase | '_' | • _digit _id_char : _upcase | _lowcase | • '_' | _digit + _id_char : _upcase | • _lowcase | '_' | _digit + _id_char : • _upcase | _lowcase | '_' | _digit _lowcase : • 'a'-'z' - _tokId : _lowcase {• _id_char} _tokId : _lowcase {_id_char} • + _tokId : _lowcase {• _id_char} _upcase : 'A'-'Z' • _upcase : • 'A'-'Z' - ignoredTokId : '!' • _tokId ignoredTokId : '!' _tokId • + ignoredTokId : '!' • _tokId } Transitions: ['0','9'] -> S50 @@ -897,10 +897,10 @@ Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} S52{ _digit : • '0'-'9' _id_char : (_upcase | _lowcase | '_' | _digit) • - _id_char : _upcase | • _lowcase | '_' | _digit - _id_char : • _upcase | _lowcase | '_' | _digit _id_char : _upcase | _lowcase | '_' | • _digit _id_char : _upcase | _lowcase | • '_' | _digit + _id_char : _upcase | • _lowcase | '_' | _digit + _id_char : • _upcase | _lowcase | '_' | _digit _lowcase : • 'a'-'z' _tokId : _lowcase {_id_char} • _tokId : _lowcase {• _id_char} @@ -918,18 +918,18 @@ Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} S53{ _digit : • '0'-'9' - _id_char : _upcase | _lowcase | • '_' | _digit _id_char : (_upcase | _lowcase | '_' | _digit) • - _id_char : • _upcase | _lowcase | '_' | _digit - _id_char : _upcase | • _lowcase | '_' | _digit _id_char : _upcase | _lowcase | '_' | • _digit - _lowcase : • 'a'-'z' + _id_char : _upcase | _lowcase | • '_' | _digit + _id_char : _upcase | • _lowcase | '_' | _digit + _id_char : • _upcase | _lowcase | '_' | _digit _lowcase : 'a'-'z' • - _tokId : _lowcase {• _id_char} + _lowcase : • 'a'-'z' _tokId : _lowcase {_id_char} • + _tokId : _lowcase {• _id_char} _upcase : • 'A'-'Z' - ignoredTokId : '!' • _tokId ignoredTokId : '!' _tokId • + ignoredTokId : '!' • _tokId } Transitions: ['0','9'] -> S50 @@ -946,16 +946,16 @@ S54{ _escaped_char : '\' ('a' | 'b' | 'f' | 'n' | 'r' | 't' | 'v' | '\' | ''' | '"') • _escaped_char : • '\' ('a' | 'b' | 'f' | 'n' | 'r' | 't' | 'v' | '\' | ''' | '"') _hex_byte_value : • '\' 'x' _hex_digit _hex_digit + _interpreted_string : '"' {_unicode_value | _byte_value} • '"' _interpreted_string : '"' {_unicode_value | • _byte_value} '"' _interpreted_string : '"' {• _unicode_value | _byte_value} '"' - _interpreted_string : '"' {_unicode_value | _byte_value} • '"' _little_u_value : • '\' 'u' _hex_digit _hex_digit _hex_digit _hex_digit _octal_byte_value : • '\' _octal_digit _octal_digit _octal_digit - _unicode_value : . | • _little_u_value | _big_u_value | _escaped_char - _unicode_value : • . | _little_u_value | _big_u_value | _escaped_char - _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char _unicode_value : (. | _little_u_value | _big_u_value | _escaped_char) • _unicode_value : . | _little_u_value | _big_u_value | • _escaped_char + _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char + _unicode_value : . | • _little_u_value | _big_u_value | _escaped_char + _unicode_value : • . | _little_u_value | _big_u_value | _escaped_char string_lit : _raw_string | • _interpreted_string } Transitions: @@ -995,9 +995,9 @@ Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} S57{ - _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' + _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' _interpreted_string : '"' {• _unicode_value | _byte_value} '"' _little_u_value : '\' 'u' • _hex_digit _hex_digit _hex_digit _hex_digit _unicode_value : . | • _little_u_value | _big_u_value | _escaped_char @@ -1134,18 +1134,18 @@ Symbols classes: {['>','>']} S68{ _digit : • '0'-'9' - _id_char : _upcase | _lowcase | '_' | • _digit _id_char : (_upcase | _lowcase | '_' | _digit) • + _id_char : _upcase | _lowcase | '_' | • _digit + _id_char : _upcase | _lowcase | • '_' | _digit _id_char : _upcase | • _lowcase | '_' | _digit _id_char : • _upcase | _lowcase | '_' | _digit - _id_char : _upcase | _lowcase | • '_' | _digit - _lowcase : • 'a'-'z' _lowcase : 'a'-'z' • - _tokId : _lowcase {• _id_char} + _lowcase : • 'a'-'z' _tokId : _lowcase {_id_char} • + _tokId : _lowcase {• _id_char} _upcase : • 'A'-'Z' - tokId : • _tokId tokId : _tokId • + tokId : • _tokId Λ : 'e' 'm' 'p' • 't' 'y' } Transitions: @@ -1160,18 +1160,18 @@ Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','s'], ['t','t'], ['u','z S69{ _digit : • '0'-'9' - _id_char : _upcase | _lowcase | '_' | • _digit _id_char : (_upcase | _lowcase | '_' | _digit) • + _id_char : _upcase | _lowcase | '_' | • _digit + _id_char : _upcase | _lowcase | • '_' | _digit _id_char : _upcase | • _lowcase | '_' | _digit _id_char : • _upcase | _lowcase | '_' | _digit - _id_char : _upcase | _lowcase | • '_' | _digit - _lowcase : • 'a'-'z' _lowcase : 'a'-'z' • - _tokId : _lowcase {• _id_char} + _lowcase : • 'a'-'z' _tokId : _lowcase {_id_char} • + _tokId : _lowcase {• _id_char} _upcase : • 'A'-'Z' - tokId : • _tokId tokId : _tokId • + tokId : • _tokId Λ : 'e' 'r' 'r' • 'o' 'r' } Transitions: @@ -1199,9 +1199,9 @@ Symbols classes: {['0','7']} S71{ _big_u_value : '\' 'U' _hex_digit • _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit - _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' + _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' _interpreted_string : '"' {• _unicode_value | _byte_value} '"' _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char @@ -1215,10 +1215,10 @@ Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} S72{ - _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • - _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' + _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • + _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' _interpreted_string : '"' {• _unicode_value | _byte_value} '"' _little_u_value : '\' 'u' _hex_digit • _hex_digit _hex_digit _hex_digit _unicode_value : . | • _little_u_value | _big_u_value | _escaped_char @@ -1234,9 +1234,9 @@ Symbols classes: {['0','9'], ['A','F'], ['a','f']} S73{ _byte_value : _octal_byte_value | • _hex_byte_value _hex_byte_value : '\' 'x' _hex_digit • _hex_digit - _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' + _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' _interpreted_string : '"' {_unicode_value | • _byte_value} '"' string_lit : _raw_string | • _interpreted_string @@ -1262,9 +1262,9 @@ Symbols classes: {['0','7']} S75{ _big_u_value : '\' 'U' _hex_digit • _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit - _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' + _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char char_lit : ''' (• _unicode_value | _byte_value) ''' @@ -1277,9 +1277,9 @@ Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} S76{ - _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' + _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' _little_u_value : '\' 'u' _hex_digit • _hex_digit _hex_digit _hex_digit _unicode_value : . | • _little_u_value | _big_u_value | _escaped_char @@ -1295,9 +1295,9 @@ Symbols classes: {['0','9'], ['A','F'], ['a','f']} S77{ _byte_value : _octal_byte_value | • _hex_byte_value _hex_byte_value : '\' 'x' _hex_digit • _hex_digit - _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' + _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' char_lit : ''' (_unicode_value | • _byte_value) ''' } @@ -1326,18 +1326,18 @@ Symbols classes: {['>','>']} S80{ _digit : • '0'-'9' - _id_char : _upcase | _lowcase | '_' | • _digit _id_char : (_upcase | _lowcase | '_' | _digit) • + _id_char : _upcase | _lowcase | '_' | • _digit + _id_char : _upcase | _lowcase | • '_' | _digit _id_char : _upcase | • _lowcase | '_' | _digit _id_char : • _upcase | _lowcase | '_' | _digit - _id_char : _upcase | _lowcase | • '_' | _digit - _lowcase : • 'a'-'z' _lowcase : 'a'-'z' • - _tokId : _lowcase {• _id_char} + _lowcase : • 'a'-'z' _tokId : _lowcase {_id_char} • + _tokId : _lowcase {• _id_char} _upcase : • 'A'-'Z' - tokId : • _tokId tokId : _tokId • + tokId : • _tokId Λ : 'e' 'm' 'p' 't' • 'y' } Transitions: @@ -1352,18 +1352,18 @@ Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','x'], ['y','y'], ['z','z S81{ _digit : • '0'-'9' - _id_char : _upcase | _lowcase | '_' | • _digit _id_char : (_upcase | _lowcase | '_' | _digit) • + _id_char : _upcase | _lowcase | '_' | • _digit + _id_char : _upcase | _lowcase | • '_' | _digit _id_char : _upcase | • _lowcase | '_' | _digit _id_char : • _upcase | _lowcase | '_' | _digit - _id_char : _upcase | _lowcase | • '_' | _digit - _lowcase : • 'a'-'z' _lowcase : 'a'-'z' • - _tokId : _lowcase {• _id_char} + _lowcase : • 'a'-'z' _tokId : _lowcase {_id_char} • + _tokId : _lowcase {• _id_char} _upcase : • 'A'-'Z' - tokId : • _tokId tokId : _tokId • + tokId : • _tokId Λ : 'e' 'r' 'r' 'o' • 'r' } Transitions: @@ -1378,22 +1378,22 @@ Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','q'], ['r','r'], ['s','z S82{ _big_u_value : • '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit - _byte_value : _octal_byte_value | • _hex_byte_value _byte_value : (_octal_byte_value | _hex_byte_value) • + _byte_value : _octal_byte_value | • _hex_byte_value _byte_value : • _octal_byte_value | _hex_byte_value _escaped_char : • '\' ('a' | 'b' | 'f' | 'n' | 'r' | 't' | 'v' | '\' | ''' | '"') _hex_byte_value : • '\' 'x' _hex_digit _hex_digit _interpreted_string : '"' {_unicode_value | _byte_value} • '"' - _interpreted_string : '"' {• _unicode_value | _byte_value} '"' _interpreted_string : '"' {_unicode_value | • _byte_value} '"' + _interpreted_string : '"' {• _unicode_value | _byte_value} '"' _little_u_value : • '\' 'u' _hex_digit _hex_digit _hex_digit _hex_digit _octal_byte_value : '\' _octal_digit _octal_digit _octal_digit • _octal_byte_value : • '\' _octal_digit _octal_digit _octal_digit _octal_digit : '0'-'7' • - _unicode_value : • . | _little_u_value | _big_u_value | _escaped_char - _unicode_value : . | • _little_u_value | _big_u_value | _escaped_char - _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char _unicode_value : . | _little_u_value | _big_u_value | • _escaped_char + _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char + _unicode_value : . | • _little_u_value | _big_u_value | _escaped_char + _unicode_value : • . | _little_u_value | _big_u_value | _escaped_char string_lit : _raw_string | • _interpreted_string } Transitions: @@ -1405,9 +1405,9 @@ Symbols classes: {['"','"'], ['\','\']} S83{ _big_u_value : '\' 'U' _hex_digit _hex_digit • _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit - _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' + _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' _interpreted_string : '"' {• _unicode_value | _byte_value} '"' _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char @@ -1421,10 +1421,10 @@ Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} S84{ - _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • - _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' + _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • + _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' _interpreted_string : '"' {• _unicode_value | _byte_value} '"' _little_u_value : '\' 'u' _hex_digit _hex_digit • _hex_digit _hex_digit _unicode_value : . | • _little_u_value | _big_u_value | _escaped_char @@ -1439,22 +1439,22 @@ Symbols classes: {['0','9'], ['A','F'], ['a','f']} S85{ _big_u_value : • '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit - _byte_value : _octal_byte_value | • _hex_byte_value _byte_value : (_octal_byte_value | _hex_byte_value) • + _byte_value : _octal_byte_value | • _hex_byte_value _byte_value : • _octal_byte_value | _hex_byte_value _escaped_char : • '\' ('a' | 'b' | 'f' | 'n' | 'r' | 't' | 'v' | '\' | ''' | '"') - _hex_byte_value : • '\' 'x' _hex_digit _hex_digit _hex_byte_value : '\' 'x' _hex_digit _hex_digit • + _hex_byte_value : • '\' 'x' _hex_digit _hex_digit _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • - _interpreted_string : '"' {• _unicode_value | _byte_value} '"' _interpreted_string : '"' {_unicode_value | _byte_value} • '"' _interpreted_string : '"' {_unicode_value | • _byte_value} '"' + _interpreted_string : '"' {• _unicode_value | _byte_value} '"' _little_u_value : • '\' 'u' _hex_digit _hex_digit _hex_digit _hex_digit _octal_byte_value : • '\' _octal_digit _octal_digit _octal_digit - _unicode_value : • . | _little_u_value | _big_u_value | _escaped_char - _unicode_value : . | • _little_u_value | _big_u_value | _escaped_char - _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char _unicode_value : . | _little_u_value | _big_u_value | • _escaped_char + _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char + _unicode_value : . | • _little_u_value | _big_u_value | _escaped_char + _unicode_value : • . | _little_u_value | _big_u_value | _escaped_char string_lit : _raw_string | • _interpreted_string } Transitions: @@ -1477,9 +1477,9 @@ Symbols classes: {[''',''']} S87{ _big_u_value : '\' 'U' _hex_digit _hex_digit • _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit - _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' + _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char char_lit : ''' (• _unicode_value | _byte_value) ''' @@ -1492,9 +1492,9 @@ Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} S88{ - _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' + _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' _little_u_value : '\' 'u' _hex_digit _hex_digit • _hex_digit _hex_digit _unicode_value : . | • _little_u_value | _big_u_value | _escaped_char @@ -1527,18 +1527,18 @@ Symbols classes: {} S91{ _digit : • '0'-'9' - _id_char : _upcase | _lowcase | '_' | • _digit _id_char : (_upcase | _lowcase | '_' | _digit) • + _id_char : _upcase | _lowcase | '_' | • _digit + _id_char : _upcase | _lowcase | • '_' | _digit _id_char : _upcase | • _lowcase | '_' | _digit _id_char : • _upcase | _lowcase | '_' | _digit - _id_char : _upcase | _lowcase | • '_' | _digit - _lowcase : • 'a'-'z' _lowcase : 'a'-'z' • - _tokId : _lowcase {• _id_char} + _lowcase : • 'a'-'z' _tokId : _lowcase {_id_char} • + _tokId : _lowcase {• _id_char} _upcase : • 'A'-'Z' - tokId : • _tokId tokId : _tokId • + tokId : • _tokId Λ : 'e' 'm' 'p' 't' 'y' • } Transitions: @@ -1551,18 +1551,18 @@ Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} S92{ _digit : • '0'-'9' - _id_char : _upcase | _lowcase | '_' | • _digit _id_char : (_upcase | _lowcase | '_' | _digit) • + _id_char : _upcase | _lowcase | '_' | • _digit + _id_char : _upcase | _lowcase | • '_' | _digit _id_char : _upcase | • _lowcase | '_' | _digit _id_char : • _upcase | _lowcase | '_' | _digit - _id_char : _upcase | _lowcase | • '_' | _digit - _lowcase : • 'a'-'z' _lowcase : 'a'-'z' • - _tokId : _lowcase {• _id_char} + _lowcase : • 'a'-'z' _tokId : _lowcase {_id_char} • + _tokId : _lowcase {• _id_char} _upcase : • 'A'-'Z' - tokId : • _tokId tokId : _tokId • + tokId : • _tokId Λ : 'e' 'r' 'r' 'o' 'r' • } Transitions: @@ -1575,9 +1575,9 @@ Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} S93{ _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit • _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit - _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' + _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' _interpreted_string : '"' {• _unicode_value | _byte_value} '"' _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char @@ -1591,10 +1591,10 @@ Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} S94{ - _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • - _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' + _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • + _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' _interpreted_string : '"' {• _unicode_value | _byte_value} '"' _little_u_value : '\' 'u' _hex_digit _hex_digit _hex_digit • _hex_digit _unicode_value : . | • _little_u_value | _big_u_value | _escaped_char @@ -1609,9 +1609,9 @@ Symbols classes: {['0','9'], ['A','F'], ['a','f']} S95{ _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit • _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit - _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' + _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char char_lit : ''' (• _unicode_value | _byte_value) ''' @@ -1624,9 +1624,9 @@ Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} S96{ - _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' + _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' _little_u_value : '\' 'u' _hex_digit _hex_digit _hex_digit • _hex_digit _unicode_value : . | • _little_u_value | _big_u_value | _escaped_char @@ -1641,9 +1641,9 @@ Symbols classes: {['0','9'], ['A','F'], ['a','f']} S97{ _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit • _hex_digit _hex_digit _hex_digit _hex_digit - _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' + _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' _interpreted_string : '"' {• _unicode_value | _byte_value} '"' _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char @@ -1663,17 +1663,17 @@ S98{ _escaped_char : • '\' ('a' | 'b' | 'f' | 'n' | 'r' | 't' | 'v' | '\' | ''' | '"') _hex_byte_value : • '\' 'x' _hex_digit _hex_digit _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • + _interpreted_string : '"' {_unicode_value | _byte_value} • '"' _interpreted_string : '"' {_unicode_value | • _byte_value} '"' _interpreted_string : '"' {• _unicode_value | _byte_value} '"' - _interpreted_string : '"' {_unicode_value | _byte_value} • '"' _little_u_value : '\' 'u' _hex_digit _hex_digit _hex_digit _hex_digit • _little_u_value : • '\' 'u' _hex_digit _hex_digit _hex_digit _hex_digit _octal_byte_value : • '\' _octal_digit _octal_digit _octal_digit - _unicode_value : . | • _little_u_value | _big_u_value | _escaped_char - _unicode_value : • . | _little_u_value | _big_u_value | _escaped_char - _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char _unicode_value : (. | _little_u_value | _big_u_value | _escaped_char) • _unicode_value : . | _little_u_value | _big_u_value | • _escaped_char + _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char + _unicode_value : . | • _little_u_value | _big_u_value | _escaped_char + _unicode_value : • . | _little_u_value | _big_u_value | _escaped_char string_lit : _raw_string | • _interpreted_string } Transitions: @@ -1685,9 +1685,9 @@ Symbols classes: {['"','"'], ['\','\']} S99{ _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit • _hex_digit _hex_digit _hex_digit _hex_digit - _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' + _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char char_lit : ''' (• _unicode_value | _byte_value) ''' @@ -1712,9 +1712,9 @@ Symbols classes: {[''',''']} S101{ _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit • _hex_digit _hex_digit _hex_digit - _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' + _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' _interpreted_string : '"' {• _unicode_value | _byte_value} '"' _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char @@ -1729,9 +1729,9 @@ Symbols classes: {['0','9'], ['A','F'], ['a','f']} S102{ _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit • _hex_digit _hex_digit _hex_digit - _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' + _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char char_lit : ''' (• _unicode_value | _byte_value) ''' @@ -1745,9 +1745,9 @@ Symbols classes: {['0','9'], ['A','F'], ['a','f']} S103{ _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit • _hex_digit _hex_digit - _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' + _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' _interpreted_string : '"' {• _unicode_value | _byte_value} '"' _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char @@ -1762,9 +1762,9 @@ Symbols classes: {['0','9'], ['A','F'], ['a','f']} S104{ _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit • _hex_digit _hex_digit - _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' + _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char char_lit : ''' (• _unicode_value | _byte_value) ''' @@ -1778,9 +1778,9 @@ Symbols classes: {['0','9'], ['A','F'], ['a','f']} S105{ _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit • _hex_digit - _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' + _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' _interpreted_string : '"' {• _unicode_value | _byte_value} '"' _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char @@ -1795,9 +1795,9 @@ Symbols classes: {['0','9'], ['A','F'], ['a','f']} S106{ _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit • _hex_digit - _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' + _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char char_lit : ''' (• _unicode_value | _byte_value) ''' @@ -1817,16 +1817,16 @@ S107{ _escaped_char : • '\' ('a' | 'b' | 'f' | 'n' | 'r' | 't' | 'v' | '\' | ''' | '"') _hex_byte_value : • '\' 'x' _hex_digit _hex_digit _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • + _interpreted_string : '"' {_unicode_value | _byte_value} • '"' _interpreted_string : '"' {_unicode_value | • _byte_value} '"' _interpreted_string : '"' {• _unicode_value | _byte_value} '"' - _interpreted_string : '"' {_unicode_value | _byte_value} • '"' _little_u_value : • '\' 'u' _hex_digit _hex_digit _hex_digit _hex_digit _octal_byte_value : • '\' _octal_digit _octal_digit _octal_digit - _unicode_value : . | • _little_u_value | _big_u_value | _escaped_char - _unicode_value : • . | _little_u_value | _big_u_value | _escaped_char - _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char _unicode_value : (. | _little_u_value | _big_u_value | _escaped_char) • _unicode_value : . | _little_u_value | _big_u_value | • _escaped_char + _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char + _unicode_value : . | • _little_u_value | _big_u_value | _escaped_char + _unicode_value : • . | _little_u_value | _big_u_value | _escaped_char string_lit : _raw_string | • _interpreted_string } Transitions: diff --git a/internal/lexer/items/itemlist.go b/internal/lexer/items/itemlist.go index d6bbb666..bde121e4 100644 --- a/internal/lexer/items/itemlist.go +++ b/internal/lexer/items/itemlist.go @@ -31,7 +31,7 @@ func (l ItemList) Len() int { } func (l ItemList) Less(i, j int) bool { - return l[i].Id < l[j].Id + return l[i].String() < l[j].String() } func (l ItemList) Swap(i, j int) { From c7cf12929cebf24eb3e8f4ad09ef23b756999a26 Mon Sep 17 00:00:00 2001 From: Massimiliano Calandrelli Date: Tue, 8 Oct 2019 07:35:34 +0200 Subject: [PATCH 11/33] WIP --- .../reparsed/internal/errors/next/errors.go | 56 + .../reparsed/internal/lexer/next/acttab.go | 459 ++ .../reparsed/internal/lexer/next/lexer.go | 145 + .../internal/lexer/next/transitiontable.go | 1299 +++++ .../reparsed/internal/parser/next/action.go | 51 + .../internal/parser/next/actiontable.go | 4604 +++++++++++++++++ .../internal/parser/next/gototable.go | 3073 +++++++++++ .../reparsed/internal/parser/next/parser.go | 217 + .../internal/parser/next/productionstable.go | 495 ++ .../reparsed/internal/token/next/token.go | 118 + internal/frontend/reparsed/reparsed.go | 6 +- 11 files changed, 10520 insertions(+), 3 deletions(-) create mode 100644 internal/frontend/reparsed/internal/errors/next/errors.go create mode 100644 internal/frontend/reparsed/internal/lexer/next/acttab.go create mode 100644 internal/frontend/reparsed/internal/lexer/next/lexer.go create mode 100644 internal/frontend/reparsed/internal/lexer/next/transitiontable.go create mode 100644 internal/frontend/reparsed/internal/parser/next/action.go create mode 100644 internal/frontend/reparsed/internal/parser/next/actiontable.go create mode 100644 internal/frontend/reparsed/internal/parser/next/gototable.go create mode 100644 internal/frontend/reparsed/internal/parser/next/parser.go create mode 100644 internal/frontend/reparsed/internal/parser/next/productionstable.go create mode 100644 internal/frontend/reparsed/internal/token/next/token.go diff --git a/internal/frontend/reparsed/internal/errors/next/errors.go b/internal/frontend/reparsed/internal/errors/next/errors.go new file mode 100644 index 00000000..1c32b551 --- /dev/null +++ b/internal/frontend/reparsed/internal/errors/next/errors.go @@ -0,0 +1,56 @@ +// Code generated by gocc; DO NOT EDIT. + +package errors + +import ( + "fmt" + "strings" + + token "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/internal/token/next" +) + +type ErrorSymbol interface { +} + +type Error struct { + Err error + ErrorToken *token.Token + ErrorSymbols []ErrorSymbol + ExpectedTokens []string + StackTop int +} + +func (e *Error) String() string { + w := new(strings.Builder) + fmt.Fprintf(w, "Error") + if e.Err != nil { + fmt.Fprintf(w, " %s\n", e.Err) + } else { + fmt.Fprintf(w, "\n") + } + fmt.Fprintf(w, "Token: type=%d, lit=%s\n", e.ErrorToken.Type, e.ErrorToken.Lit) + fmt.Fprintf(w, "Pos: offset=%d, line=%d, column=%d\n", e.ErrorToken.Pos.Offset, e.ErrorToken.Pos.Line, e.ErrorToken.Pos.Column) + fmt.Fprintf(w, "Expected one of: ") + for _, sym := range e.ExpectedTokens { + fmt.Fprintf(w, "%s ", sym) + } + fmt.Fprintf(w, "ErrorSymbol:\n") + for _, sym := range e.ErrorSymbols { + fmt.Fprintf(w, "%v\n", sym) + } + return w.String() +} + +func (e *Error) Error() string { + w := new(strings.Builder) + fmt.Fprintf(w, "Error in S%d: %s, %s", e.StackTop, token.TokMap.TokenString(e.ErrorToken), e.ErrorToken.Pos.String()) + if e.Err != nil { + fmt.Fprintf(w, ": %+v", e.Err) + } else { + fmt.Fprintf(w, ", expected one of: ") + for _, expected := range e.ExpectedTokens { + fmt.Fprintf(w, "%s ", expected) + } + } + return w.String() +} diff --git a/internal/frontend/reparsed/internal/lexer/next/acttab.go b/internal/frontend/reparsed/internal/lexer/next/acttab.go new file mode 100644 index 00000000..5aa89985 --- /dev/null +++ b/internal/frontend/reparsed/internal/lexer/next/acttab.go @@ -0,0 +1,459 @@ +// Code generated by gocc; DO NOT EDIT. + +package lexer + +import ( + "fmt" + + token "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/internal/token/next" +) + +type ActionTable [NumStates]ActionRow + +type ActionRow struct { + Accept token.Type + Ignore string +} + +func (a ActionRow) String() string { + return fmt.Sprintf("Accept=%d, Ignore=%s", a.Accept, a.Ignore) +} + +var ActTab = ActionTable{ + ActionRow{ // S0, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S1, Ignore("!whitespace") + Accept: -1, + Ignore: "!whitespace", + }, + ActionRow{ // S2, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S3, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S4, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S5, Accept("Λ<(>") + Accept: 12, + Ignore: "", + }, + ActionRow{ // S6, Accept("Λ<)>") + Accept: 13, + Ignore: "", + }, + ActionRow{ // S7, Accept("Λ<->") + Accept: 10, + Ignore: "", + }, + ActionRow{ // S8, Accept("Λ<.>") + Accept: 8, + Ignore: "", + }, + ActionRow{ // S9, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S10, Accept("Λ<:>") + Accept: 3, + Ignore: "", + }, + ActionRow{ // S11, Accept("Λ<;>") + Accept: 4, + Ignore: "", + }, + ActionRow{ // S12, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S13, Accept("prodId") + Accept: 19, + Ignore: "", + }, + ActionRow{ // S14, Accept("Λ<[>") + Accept: 14, + Ignore: "", + }, + ActionRow{ // S15, Accept("Λ<]>") + Accept: 15, + Ignore: "", + }, + ActionRow{ // S16, Accept("regDefId") + Accept: 5, + Ignore: "", + }, + ActionRow{ // S17, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S18, Accept("tokId") + Accept: 2, + Ignore: "", + }, + ActionRow{ // S19, Accept("tokId") + Accept: 2, + Ignore: "", + }, + ActionRow{ // S20, Accept("Λ<{>") + Accept: 16, + Ignore: "", + }, + ActionRow{ // S21, Accept("Λ<|>") + Accept: 7, + Ignore: "", + }, + ActionRow{ // S22, Accept("Λ<}>") + Accept: 17, + Ignore: "", + }, + ActionRow{ // S23, Accept("Λ<~>") + Accept: 11, + Ignore: "", + }, + ActionRow{ // S24, Accept("Λ<ε>") + Accept: 24, + Ignore: "", + }, + ActionRow{ // S25, Accept("Λ<λ>") + Accept: 22, + Ignore: "", + }, + ActionRow{ // S26, Accept("ignoredTokId") + Accept: 6, + Ignore: "", + }, + ActionRow{ // S27, Accept("string_lit") + Accept: 20, + Ignore: "", + }, + ActionRow{ // S28, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S29, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S30, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S31, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S32, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S33, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S34, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S35, Accept("prodId") + Accept: 19, + Ignore: "", + }, + ActionRow{ // S36, Accept("prodId") + Accept: 19, + Ignore: "", + }, + ActionRow{ // S37, Accept("prodId") + Accept: 19, + Ignore: "", + }, + ActionRow{ // S38, Accept("prodId") + Accept: 19, + Ignore: "", + }, + ActionRow{ // S39, Accept("regDefId") + Accept: 5, + Ignore: "", + }, + ActionRow{ // S40, Accept("regDefId") + Accept: 5, + Ignore: "", + }, + ActionRow{ // S41, Accept("regDefId") + Accept: 5, + Ignore: "", + }, + ActionRow{ // S42, Accept("regDefId") + Accept: 5, + Ignore: "", + }, + ActionRow{ // S43, Accept("string_lit") + Accept: 20, + Ignore: "", + }, + ActionRow{ // S44, Accept("tokId") + Accept: 2, + Ignore: "", + }, + ActionRow{ // S45, Accept("tokId") + Accept: 2, + Ignore: "", + }, + ActionRow{ // S46, Accept("tokId") + Accept: 2, + Ignore: "", + }, + ActionRow{ // S47, Accept("tokId") + Accept: 2, + Ignore: "", + }, + ActionRow{ // S48, Accept("tokId") + Accept: 2, + Ignore: "", + }, + ActionRow{ // S49, Accept("tokId") + Accept: 2, + Ignore: "", + }, + ActionRow{ // S50, Accept("ignoredTokId") + Accept: 6, + Ignore: "", + }, + ActionRow{ // S51, Accept("ignoredTokId") + Accept: 6, + Ignore: "", + }, + ActionRow{ // S52, Accept("ignoredTokId") + Accept: 6, + Ignore: "", + }, + ActionRow{ // S53, Accept("ignoredTokId") + Accept: 6, + Ignore: "", + }, + ActionRow{ // S54, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S55, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S56, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S57, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S58, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S59, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S60, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S61, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S62, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S63, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S64, Accept("char_lit") + Accept: 9, + Ignore: "", + }, + ActionRow{ // S65, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S66, Ignore("!comment") + Accept: -1, + Ignore: "!comment", + }, + ActionRow{ // S67, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S68, Accept("tokId") + Accept: 2, + Ignore: "", + }, + ActionRow{ // S69, Accept("tokId") + Accept: 2, + Ignore: "", + }, + ActionRow{ // S70, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S71, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S72, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S73, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S74, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S75, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S76, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S77, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S78, Ignore("!comment") + Accept: -1, + Ignore: "!comment", + }, + ActionRow{ // S79, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S80, Accept("tokId") + Accept: 2, + Ignore: "", + }, + ActionRow{ // S81, Accept("tokId") + Accept: 2, + Ignore: "", + }, + ActionRow{ // S82, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S83, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S84, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S85, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S86, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S87, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S88, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S89, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S90, Accept("g_sdt_lit") + Accept: 18, + Ignore: "", + }, + ActionRow{ // S91, Accept("Λ") + Accept: 23, + Ignore: "", + }, + ActionRow{ // S92, Accept("Λ") + Accept: 21, + Ignore: "", + }, + ActionRow{ // S93, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S94, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S95, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S96, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S97, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S98, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S99, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S100, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S101, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S102, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S103, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S104, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S105, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S106, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S107, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S108, + Accept: 0, + Ignore: "", + }, +} diff --git a/internal/frontend/reparsed/internal/lexer/next/lexer.go b/internal/frontend/reparsed/internal/lexer/next/lexer.go new file mode 100644 index 00000000..5a4a93b5 --- /dev/null +++ b/internal/frontend/reparsed/internal/lexer/next/lexer.go @@ -0,0 +1,145 @@ +// Code generated by gocc; DO NOT EDIT. + +package lexer + +import ( + "io" + "os" + + "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/internal/io/stream" + token "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/internal/token/next" +) + +const ( + NoState = -1 + NumStates = 109 + NumSymbols = 75 +) + +type Position struct { + pos int + line int + column int +} + +type Lexer struct { + Position + stream stream.WindowReader + eof bool +} + +func NewLexer(src []byte) *Lexer { + lexer := &Lexer{stream: stream.NewWindowReaderFromBytes(src)} + return lexer +} + +func NewLexerFile(fpath string) (*Lexer, error) { + s, err := os.Open(fpath) + if err != nil { + return nil, err + } + return &Lexer{stream: stream.NewWindowReader(s)}, nil +} + +func (l *Lexer) Scan() (tok *token.Token) { + tok = new(token.Token) + if l.eof { + tok.Type = token.EOF + tok.Pos.Offset, tok.Pos.Line, tok.Pos.Column = l.pos, l.line, l.column + return + } + start, startLine, startColumn, end := l.pos, l.line, l.column, 0 + tok.Type = token.INVALID + tok.Lit = []byte{} + state, rune1 := 0, rune(-1) + for state != -1 { + if l.eof { + rune1 = -1 + } else { + rune2, size, err := l.stream.ReadRune() + if err == io.EOF { + l.eof = true + err = nil + } + if err == nil && size > 0 { + rune1 = rune2 + l.pos += size + tok.Lit = append(tok.Lit, string(rune1)...) + } + } + + nextState := -1 + if rune1 != -1 { + nextState = TransTab[state](rune1) + } + state = nextState + + if state != -1 { + + switch rune1 { + case '\n': + l.line++ + l.column = 1 + case '\r': + l.column = 1 + case '\t': + l.column += 4 + default: + l.column++ + } + + switch { + case ActTab[state].Accept != -1: + tok.Type = ActTab[state].Accept + end = l.pos + case ActTab[state].Ignore != "": + start, startLine, startColumn = l.pos, l.line, l.column + state = 0 + if l.eof { + tok.Type = token.EOF + } + + } + } else { + if tok.Type == token.INVALID { + end = l.pos + } + } + } + if end > start { + l.pos = end + } + tok.Pos.Offset, tok.Pos.Line, tok.Pos.Column = start, startLine, startColumn + + return +} + +func (l *Lexer) Reset() { + l.Position.Reset() +} + +func (l *Lexer) Reposition(p Position) { + l.Position = p +} + +func (l Lexer) CurrentPosition() Position { + return l.Position +} + +func (p Position) Offset() int { + return p.pos +} + +func (p Position) Line() int { + return p.line +} + +func (p Position) Column() int { + return p.column +} + +func (p *Position) Reset() { + p.pos = 0 + p.line = 1 + p.column = 1 +} diff --git a/internal/frontend/reparsed/internal/lexer/next/transitiontable.go b/internal/frontend/reparsed/internal/lexer/next/transitiontable.go new file mode 100644 index 00000000..9cf91598 --- /dev/null +++ b/internal/frontend/reparsed/internal/lexer/next/transitiontable.go @@ -0,0 +1,1299 @@ +// Code generated by gocc; DO NOT EDIT. + +package lexer + +/* +Let s be the current state +Let r be the current input rune +transitionTable[s](r) returns the next state. +*/ +type TransitionTable [NumStates]func(rune) int + +var TransTab = TransitionTable{ + // S0 + func(r rune) int { + switch { + case r == 9: // ['\t','\t'] + return 1 + case r == 10: // ['\n','\n'] + return 1 + case r == 13: // ['\r','\r'] + return 1 + case r == 32: // [' ',' '] + return 1 + case r == 33: // ['!','!'] + return 2 + case r == 34: // ['"','"'] + return 3 + case r == 39: // [''','''] + return 4 + case r == 40: // ['(','('] + return 5 + case r == 41: // [')',')'] + return 6 + case r == 45: // ['-','-'] + return 7 + case r == 46: // ['.','.'] + return 8 + case r == 47: // ['/','/'] + return 9 + case r == 58: // [':',':'] + return 10 + case r == 59: // [';',';'] + return 11 + case r == 60: // ['<','<'] + return 12 + case 65 <= r && r <= 90: // ['A','Z'] + return 13 + case r == 91: // ['[','['] + return 14 + case r == 93: // [']',']'] + return 15 + case r == 95: // ['_','_'] + return 16 + case r == 96: // ['`','`'] + return 17 + case 97 <= r && r <= 100: // ['a','d'] + return 18 + case r == 101: // ['e','e'] + return 19 + case 102 <= r && r <= 122: // ['f','z'] + return 18 + case r == 123: // ['{','{'] + return 20 + case r == 124: // ['|','|'] + return 21 + case r == 125: // ['}','}'] + return 22 + case r == 126: // ['~','~'] + return 23 + case r == 949: // [\u03b5,\u03b5] + return 24 + case r == 955: // [\u03bb,\u03bb] + return 25 + } + return NoState + }, + // S1 + func(r rune) int { + switch { + } + return NoState + }, + // S2 + func(r rune) int { + switch { + case 97 <= r && r <= 122: // ['a','z'] + return 26 + } + return NoState + }, + // S3 + func(r rune) int { + switch { + case r == 34: // ['"','"'] + return 27 + case r == 92: // ['\','\'] + return 28 + default: + return 29 + } + }, + // S4 + func(r rune) int { + switch { + case r == 92: // ['\','\'] + return 30 + default: + return 31 + } + }, + // S5 + func(r rune) int { + switch { + } + return NoState + }, + // S6 + func(r rune) int { + switch { + } + return NoState + }, + // S7 + func(r rune) int { + switch { + } + return NoState + }, + // S8 + func(r rune) int { + switch { + } + return NoState + }, + // S9 + func(r rune) int { + switch { + case r == 42: // ['*','*'] + return 32 + case r == 47: // ['/','/'] + return 33 + } + return NoState + }, + // S10 + func(r rune) int { + switch { + } + return NoState + }, + // S11 + func(r rune) int { + switch { + } + return NoState + }, + // S12 + func(r rune) int { + switch { + case r == 60: // ['<','<'] + return 34 + } + return NoState + }, + // S13 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 35 + case 65 <= r && r <= 90: // ['A','Z'] + return 36 + case r == 95: // ['_','_'] + return 37 + case 97 <= r && r <= 122: // ['a','z'] + return 38 + } + return NoState + }, + // S14 + func(r rune) int { + switch { + } + return NoState + }, + // S15 + func(r rune) int { + switch { + } + return NoState + }, + // S16 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 39 + case 65 <= r && r <= 90: // ['A','Z'] + return 40 + case r == 95: // ['_','_'] + return 41 + case 97 <= r && r <= 122: // ['a','z'] + return 42 + } + return NoState + }, + // S17 + func(r rune) int { + switch { + case r == 96: // ['`','`'] + return 43 + default: + return 17 + } + }, + // S18 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 45 + case r == 95: // ['_','_'] + return 46 + case 97 <= r && r <= 122: // ['a','z'] + return 47 + } + return NoState + }, + // S19 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 45 + case r == 95: // ['_','_'] + return 46 + case 97 <= r && r <= 108: // ['a','l'] + return 47 + case r == 109: // ['m','m'] + return 48 + case 110 <= r && r <= 113: // ['n','q'] + return 47 + case r == 114: // ['r','r'] + return 49 + case 115 <= r && r <= 122: // ['s','z'] + return 47 + } + return NoState + }, + // S20 + func(r rune) int { + switch { + } + return NoState + }, + // S21 + func(r rune) int { + switch { + } + return NoState + }, + // S22 + func(r rune) int { + switch { + } + return NoState + }, + // S23 + func(r rune) int { + switch { + } + return NoState + }, + // S24 + func(r rune) int { + switch { + } + return NoState + }, + // S25 + func(r rune) int { + switch { + } + return NoState + }, + // S26 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 50 + case 65 <= r && r <= 90: // ['A','Z'] + return 51 + case r == 95: // ['_','_'] + return 52 + case 97 <= r && r <= 122: // ['a','z'] + return 53 + } + return NoState + }, + // S27 + func(r rune) int { + switch { + } + return NoState + }, + // S28 + func(r rune) int { + switch { + case r == 34: // ['"','"'] + return 54 + case r == 39: // [''','''] + return 54 + case 48 <= r && r <= 55: // ['0','7'] + return 55 + case r == 85: // ['U','U'] + return 56 + case r == 92: // ['\','\'] + return 54 + case r == 97: // ['a','a'] + return 54 + case r == 98: // ['b','b'] + return 54 + case r == 102: // ['f','f'] + return 54 + case r == 110: // ['n','n'] + return 54 + case r == 114: // ['r','r'] + return 54 + case r == 116: // ['t','t'] + return 54 + case r == 117: // ['u','u'] + return 57 + case r == 118: // ['v','v'] + return 54 + case r == 120: // ['x','x'] + return 58 + } + return NoState + }, + // S29 + func(r rune) int { + switch { + case r == 34: // ['"','"'] + return 27 + case r == 92: // ['\','\'] + return 28 + default: + return 29 + } + }, + // S30 + func(r rune) int { + switch { + case r == 34: // ['"','"'] + return 59 + case r == 39: // [''','''] + return 59 + case 48 <= r && r <= 55: // ['0','7'] + return 60 + case r == 85: // ['U','U'] + return 61 + case r == 92: // ['\','\'] + return 59 + case r == 97: // ['a','a'] + return 59 + case r == 98: // ['b','b'] + return 59 + case r == 102: // ['f','f'] + return 59 + case r == 110: // ['n','n'] + return 59 + case r == 114: // ['r','r'] + return 59 + case r == 116: // ['t','t'] + return 59 + case r == 117: // ['u','u'] + return 62 + case r == 118: // ['v','v'] + return 59 + case r == 120: // ['x','x'] + return 63 + } + return NoState + }, + // S31 + func(r rune) int { + switch { + case r == 39: // [''','''] + return 64 + } + return NoState + }, + // S32 + func(r rune) int { + switch { + case r == 42: // ['*','*'] + return 65 + default: + return 32 + } + }, + // S33 + func(r rune) int { + switch { + case r == 10: // ['\n','\n'] + return 66 + default: + return 33 + } + }, + // S34 + func(r rune) int { + switch { + default: + return 67 + } + }, + // S35 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 35 + case 65 <= r && r <= 90: // ['A','Z'] + return 36 + case r == 95: // ['_','_'] + return 37 + case 97 <= r && r <= 122: // ['a','z'] + return 38 + } + return NoState + }, + // S36 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 35 + case 65 <= r && r <= 90: // ['A','Z'] + return 36 + case r == 95: // ['_','_'] + return 37 + case 97 <= r && r <= 122: // ['a','z'] + return 38 + } + return NoState + }, + // S37 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 35 + case 65 <= r && r <= 90: // ['A','Z'] + return 36 + case r == 95: // ['_','_'] + return 37 + case 97 <= r && r <= 122: // ['a','z'] + return 38 + } + return NoState + }, + // S38 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 35 + case 65 <= r && r <= 90: // ['A','Z'] + return 36 + case r == 95: // ['_','_'] + return 37 + case 97 <= r && r <= 122: // ['a','z'] + return 38 + } + return NoState + }, + // S39 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 39 + case 65 <= r && r <= 90: // ['A','Z'] + return 40 + case r == 95: // ['_','_'] + return 41 + case 97 <= r && r <= 122: // ['a','z'] + return 42 + } + return NoState + }, + // S40 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 39 + case 65 <= r && r <= 90: // ['A','Z'] + return 40 + case r == 95: // ['_','_'] + return 41 + case 97 <= r && r <= 122: // ['a','z'] + return 42 + } + return NoState + }, + // S41 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 39 + case 65 <= r && r <= 90: // ['A','Z'] + return 40 + case r == 95: // ['_','_'] + return 41 + case 97 <= r && r <= 122: // ['a','z'] + return 42 + } + return NoState + }, + // S42 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 39 + case 65 <= r && r <= 90: // ['A','Z'] + return 40 + case r == 95: // ['_','_'] + return 41 + case 97 <= r && r <= 122: // ['a','z'] + return 42 + } + return NoState + }, + // S43 + func(r rune) int { + switch { + } + return NoState + }, + // S44 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 45 + case r == 95: // ['_','_'] + return 46 + case 97 <= r && r <= 122: // ['a','z'] + return 47 + } + return NoState + }, + // S45 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 45 + case r == 95: // ['_','_'] + return 46 + case 97 <= r && r <= 122: // ['a','z'] + return 47 + } + return NoState + }, + // S46 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 45 + case r == 95: // ['_','_'] + return 46 + case 97 <= r && r <= 122: // ['a','z'] + return 47 + } + return NoState + }, + // S47 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 45 + case r == 95: // ['_','_'] + return 46 + case 97 <= r && r <= 122: // ['a','z'] + return 47 + } + return NoState + }, + // S48 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 45 + case r == 95: // ['_','_'] + return 46 + case 97 <= r && r <= 111: // ['a','o'] + return 47 + case r == 112: // ['p','p'] + return 68 + case 113 <= r && r <= 122: // ['q','z'] + return 47 + } + return NoState + }, + // S49 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 45 + case r == 95: // ['_','_'] + return 46 + case 97 <= r && r <= 113: // ['a','q'] + return 47 + case r == 114: // ['r','r'] + return 69 + case 115 <= r && r <= 122: // ['s','z'] + return 47 + } + return NoState + }, + // S50 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 50 + case 65 <= r && r <= 90: // ['A','Z'] + return 51 + case r == 95: // ['_','_'] + return 52 + case 97 <= r && r <= 122: // ['a','z'] + return 53 + } + return NoState + }, + // S51 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 50 + case 65 <= r && r <= 90: // ['A','Z'] + return 51 + case r == 95: // ['_','_'] + return 52 + case 97 <= r && r <= 122: // ['a','z'] + return 53 + } + return NoState + }, + // S52 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 50 + case 65 <= r && r <= 90: // ['A','Z'] + return 51 + case r == 95: // ['_','_'] + return 52 + case 97 <= r && r <= 122: // ['a','z'] + return 53 + } + return NoState + }, + // S53 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 50 + case 65 <= r && r <= 90: // ['A','Z'] + return 51 + case r == 95: // ['_','_'] + return 52 + case 97 <= r && r <= 122: // ['a','z'] + return 53 + } + return NoState + }, + // S54 + func(r rune) int { + switch { + case r == 34: // ['"','"'] + return 27 + case r == 92: // ['\','\'] + return 28 + default: + return 29 + } + }, + // S55 + func(r rune) int { + switch { + case 48 <= r && r <= 55: // ['0','7'] + return 70 + } + return NoState + }, + // S56 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 71 + case 65 <= r && r <= 70: // ['A','F'] + return 71 + case 97 <= r && r <= 102: // ['a','f'] + return 71 + } + return NoState + }, + // S57 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 72 + case 65 <= r && r <= 70: // ['A','F'] + return 72 + case 97 <= r && r <= 102: // ['a','f'] + return 72 + } + return NoState + }, + // S58 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 73 + case 65 <= r && r <= 70: // ['A','F'] + return 73 + case 97 <= r && r <= 102: // ['a','f'] + return 73 + } + return NoState + }, + // S59 + func(r rune) int { + switch { + case r == 39: // [''','''] + return 64 + } + return NoState + }, + // S60 + func(r rune) int { + switch { + case 48 <= r && r <= 55: // ['0','7'] + return 74 + } + return NoState + }, + // S61 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 75 + case 65 <= r && r <= 70: // ['A','F'] + return 75 + case 97 <= r && r <= 102: // ['a','f'] + return 75 + } + return NoState + }, + // S62 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 76 + case 65 <= r && r <= 70: // ['A','F'] + return 76 + case 97 <= r && r <= 102: // ['a','f'] + return 76 + } + return NoState + }, + // S63 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 77 + case 65 <= r && r <= 70: // ['A','F'] + return 77 + case 97 <= r && r <= 102: // ['a','f'] + return 77 + } + return NoState + }, + // S64 + func(r rune) int { + switch { + } + return NoState + }, + // S65 + func(r rune) int { + switch { + case r == 42: // ['*','*'] + return 65 + case r == 47: // ['/','/'] + return 78 + default: + return 32 + } + }, + // S66 + func(r rune) int { + switch { + } + return NoState + }, + // S67 + func(r rune) int { + switch { + case r == 62: // ['>','>'] + return 79 + default: + return 67 + } + }, + // S68 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 45 + case r == 95: // ['_','_'] + return 46 + case 97 <= r && r <= 115: // ['a','s'] + return 47 + case r == 116: // ['t','t'] + return 80 + case 117 <= r && r <= 122: // ['u','z'] + return 47 + } + return NoState + }, + // S69 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 45 + case r == 95: // ['_','_'] + return 46 + case 97 <= r && r <= 110: // ['a','n'] + return 47 + case r == 111: // ['o','o'] + return 81 + case 112 <= r && r <= 122: // ['p','z'] + return 47 + } + return NoState + }, + // S70 + func(r rune) int { + switch { + case 48 <= r && r <= 55: // ['0','7'] + return 82 + } + return NoState + }, + // S71 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 83 + case 65 <= r && r <= 70: // ['A','F'] + return 83 + case 97 <= r && r <= 102: // ['a','f'] + return 83 + } + return NoState + }, + // S72 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 84 + case 65 <= r && r <= 70: // ['A','F'] + return 84 + case 97 <= r && r <= 102: // ['a','f'] + return 84 + } + return NoState + }, + // S73 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 85 + case 65 <= r && r <= 70: // ['A','F'] + return 85 + case 97 <= r && r <= 102: // ['a','f'] + return 85 + } + return NoState + }, + // S74 + func(r rune) int { + switch { + case 48 <= r && r <= 55: // ['0','7'] + return 86 + } + return NoState + }, + // S75 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 87 + case 65 <= r && r <= 70: // ['A','F'] + return 87 + case 97 <= r && r <= 102: // ['a','f'] + return 87 + } + return NoState + }, + // S76 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 88 + case 65 <= r && r <= 70: // ['A','F'] + return 88 + case 97 <= r && r <= 102: // ['a','f'] + return 88 + } + return NoState + }, + // S77 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 89 + case 65 <= r && r <= 70: // ['A','F'] + return 89 + case 97 <= r && r <= 102: // ['a','f'] + return 89 + } + return NoState + }, + // S78 + func(r rune) int { + switch { + } + return NoState + }, + // S79 + func(r rune) int { + switch { + case r == 62: // ['>','>'] + return 90 + } + return NoState + }, + // S80 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 45 + case r == 95: // ['_','_'] + return 46 + case 97 <= r && r <= 120: // ['a','x'] + return 47 + case r == 121: // ['y','y'] + return 91 + case r == 122: // ['z','z'] + return 47 + } + return NoState + }, + // S81 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 45 + case r == 95: // ['_','_'] + return 46 + case 97 <= r && r <= 113: // ['a','q'] + return 47 + case r == 114: // ['r','r'] + return 92 + case 115 <= r && r <= 122: // ['s','z'] + return 47 + } + return NoState + }, + // S82 + func(r rune) int { + switch { + case r == 34: // ['"','"'] + return 27 + case r == 92: // ['\','\'] + return 28 + default: + return 29 + } + }, + // S83 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 93 + case 65 <= r && r <= 70: // ['A','F'] + return 93 + case 97 <= r && r <= 102: // ['a','f'] + return 93 + } + return NoState + }, + // S84 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 94 + case 65 <= r && r <= 70: // ['A','F'] + return 94 + case 97 <= r && r <= 102: // ['a','f'] + return 94 + } + return NoState + }, + // S85 + func(r rune) int { + switch { + case r == 34: // ['"','"'] + return 27 + case r == 92: // ['\','\'] + return 28 + default: + return 29 + } + }, + // S86 + func(r rune) int { + switch { + case r == 39: // [''','''] + return 64 + } + return NoState + }, + // S87 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 95 + case 65 <= r && r <= 70: // ['A','F'] + return 95 + case 97 <= r && r <= 102: // ['a','f'] + return 95 + } + return NoState + }, + // S88 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 96 + case 65 <= r && r <= 70: // ['A','F'] + return 96 + case 97 <= r && r <= 102: // ['a','f'] + return 96 + } + return NoState + }, + // S89 + func(r rune) int { + switch { + case r == 39: // [''','''] + return 64 + } + return NoState + }, + // S90 + func(r rune) int { + switch { + } + return NoState + }, + // S91 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 45 + case r == 95: // ['_','_'] + return 46 + case 97 <= r && r <= 122: // ['a','z'] + return 47 + } + return NoState + }, + // S92 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 45 + case r == 95: // ['_','_'] + return 46 + case 97 <= r && r <= 122: // ['a','z'] + return 47 + } + return NoState + }, + // S93 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 97 + case 65 <= r && r <= 70: // ['A','F'] + return 97 + case 97 <= r && r <= 102: // ['a','f'] + return 97 + } + return NoState + }, + // S94 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 98 + case 65 <= r && r <= 70: // ['A','F'] + return 98 + case 97 <= r && r <= 102: // ['a','f'] + return 98 + } + return NoState + }, + // S95 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 99 + case 65 <= r && r <= 70: // ['A','F'] + return 99 + case 97 <= r && r <= 102: // ['a','f'] + return 99 + } + return NoState + }, + // S96 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 100 + case 65 <= r && r <= 70: // ['A','F'] + return 100 + case 97 <= r && r <= 102: // ['a','f'] + return 100 + } + return NoState + }, + // S97 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 101 + case 65 <= r && r <= 70: // ['A','F'] + return 101 + case 97 <= r && r <= 102: // ['a','f'] + return 101 + } + return NoState + }, + // S98 + func(r rune) int { + switch { + case r == 34: // ['"','"'] + return 27 + case r == 92: // ['\','\'] + return 28 + default: + return 29 + } + }, + // S99 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 102 + case 65 <= r && r <= 70: // ['A','F'] + return 102 + case 97 <= r && r <= 102: // ['a','f'] + return 102 + } + return NoState + }, + // S100 + func(r rune) int { + switch { + case r == 39: // [''','''] + return 64 + } + return NoState + }, + // S101 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 103 + case 65 <= r && r <= 70: // ['A','F'] + return 103 + case 97 <= r && r <= 102: // ['a','f'] + return 103 + } + return NoState + }, + // S102 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 104 + case 65 <= r && r <= 70: // ['A','F'] + return 104 + case 97 <= r && r <= 102: // ['a','f'] + return 104 + } + return NoState + }, + // S103 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 105 + case 65 <= r && r <= 70: // ['A','F'] + return 105 + case 97 <= r && r <= 102: // ['a','f'] + return 105 + } + return NoState + }, + // S104 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 106 + case 65 <= r && r <= 70: // ['A','F'] + return 106 + case 97 <= r && r <= 102: // ['a','f'] + return 106 + } + return NoState + }, + // S105 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 107 + case 65 <= r && r <= 70: // ['A','F'] + return 107 + case 97 <= r && r <= 102: // ['a','f'] + return 107 + } + return NoState + }, + // S106 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 108 + case 65 <= r && r <= 70: // ['A','F'] + return 108 + case 97 <= r && r <= 102: // ['a','f'] + return 108 + } + return NoState + }, + // S107 + func(r rune) int { + switch { + case r == 34: // ['"','"'] + return 27 + case r == 92: // ['\','\'] + return 28 + default: + return 29 + } + }, + // S108 + func(r rune) int { + switch { + case r == 39: // [''','''] + return 64 + } + return NoState + }, +} diff --git a/internal/frontend/reparsed/internal/parser/next/action.go b/internal/frontend/reparsed/internal/parser/next/action.go new file mode 100644 index 00000000..54bc55e9 --- /dev/null +++ b/internal/frontend/reparsed/internal/parser/next/action.go @@ -0,0 +1,51 @@ +// Code generated by gocc; DO NOT EDIT. + +package parser + +import ( + "fmt" +) + +type action interface { + act() + String() string +} + +type ( + accept bool + shift int // value is next state index + reduce int // value is production index +) + +func (this accept) act() {} +func (this shift) act() {} +func (this reduce) act() {} + +func (this accept) Equal(that action) bool { + if _, ok := that.(accept); ok { + return true + } + return false +} + +func (this reduce) Equal(that action) bool { + that1, ok := that.(reduce) + if !ok { + return false + } + return this == that1 +} + +func (this shift) Equal(that action) bool { + that1, ok := that.(shift) + if !ok { + return false + } + return this == that1 +} + +func (this accept) String() string { return "accept(0)" } +func (this shift) String() string { return fmt.Sprintf("shift:%d", this) } +func (this reduce) String() string { + return fmt.Sprintf("reduce:%d(%s)", this, productionsTable[this].String) +} diff --git a/internal/frontend/reparsed/internal/parser/next/actiontable.go b/internal/frontend/reparsed/internal/parser/next/actiontable.go new file mode 100644 index 00000000..6dfb93f3 --- /dev/null +++ b/internal/frontend/reparsed/internal/parser/next/actiontable.go @@ -0,0 +1,4604 @@ +// Code generated by gocc; DO NOT EDIT. + +package parser + +type ( + actionTable [numStates]actionRow + actionRow struct { + canRecover bool + actions [numSymbols]action + } +) + +var actionTab = actionTable{ + actionRow{ // S0 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + shift(9), // tokId + nil, // ":" + nil, // ";" + shift(10), // regDefId + shift(11), // ignoredTokId + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + shift(12), // g_sdt_lit + shift(13), // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S1 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + accept(true), // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S2 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(2), // Ω, reduce: Grammar + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + shift(12), // g_sdt_lit + shift(13), // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S3 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(3), // Ω, reduce: Grammar + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S4 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(4), // Ω, reduce: LexicalPart + shift(9), // tokId + nil, // ":" + nil, // ";" + shift(10), // regDefId + shift(11), // ignoredTokId + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + reduce(4), // g_sdt_lit, reduce: LexicalPart + reduce(4), // prodId, reduce: LexicalPart + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S5 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(5), // Ω, reduce: LexProductions + reduce(5), // tokId, reduce: LexProductions + nil, // ":" + nil, // ";" + reduce(5), // regDefId, reduce: LexProductions + reduce(5), // ignoredTokId, reduce: LexProductions + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + reduce(5), // g_sdt_lit, reduce: LexProductions + reduce(5), // prodId, reduce: LexProductions + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S6 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + shift(13), // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S7 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(24), // Ω, reduce: SyntaxPart + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + shift(13), // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S8 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(26), // Ω, reduce: SyntaxProdList + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + reduce(26), // prodId, reduce: SyntaxProdList + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S9 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + shift(18), // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S10 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + shift(19), // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S11 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + shift(20), // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S12 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + reduce(25), // prodId, reduce: FileHeader + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S13 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + shift(21), // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S14 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(1), // Ω, reduce: Grammar + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S15 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(6), // Ω, reduce: LexProductions + reduce(6), // tokId, reduce: LexProductions + nil, // ":" + nil, // ";" + reduce(6), // regDefId, reduce: LexProductions + reduce(6), // ignoredTokId, reduce: LexProductions + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + reduce(6), // g_sdt_lit, reduce: LexProductions + reduce(6), // prodId, reduce: LexProductions + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S16 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(23), // Ω, reduce: SyntaxPart + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + shift(13), // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S17 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(27), // Ω, reduce: SyntaxProdList + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + reduce(27), // prodId, reduce: SyntaxProdList + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S18 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + shift(25), // regDefId + nil, // ignoredTokId + nil, // "|" + shift(26), // "." + shift(27), // char_lit + nil, // "-" + shift(28), // "~" + shift(29), // "(" + nil, // ")" + shift(30), // "[" + nil, // "]" + shift(31), // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S19 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + shift(25), // regDefId + nil, // ignoredTokId + nil, // "|" + shift(26), // "." + shift(27), // char_lit + nil, // "-" + shift(28), // "~" + shift(29), // "(" + nil, // ")" + shift(30), // "[" + nil, // "]" + shift(31), // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S20 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + shift(25), // regDefId + nil, // ignoredTokId + nil, // "|" + shift(26), // "." + shift(27), // char_lit + nil, // "-" + shift(28), // "~" + shift(29), // "(" + nil, // ")" + shift(30), // "[" + nil, // "]" + shift(31), // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S21 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + shift(40), // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + shift(41), // prodId + shift(42), // string_lit + shift(43), // "error" + shift(44), // "λ" + shift(45), // "empty" + shift(46), // "ε" + }, + }, + actionRow{ // S22 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + shift(47), // ";" + nil, // regDefId + nil, // ignoredTokId + shift(48), // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S23 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + reduce(10), // ";", reduce: LexPattern + shift(25), // regDefId + nil, // ignoredTokId + reduce(10), // "|", reduce: LexPattern + shift(26), // "." + shift(27), // char_lit + nil, // "-" + shift(28), // "~" + shift(29), // "(" + nil, // ")" + shift(30), // "[" + nil, // "]" + shift(31), // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S24 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + reduce(12), // ";", reduce: LexAlt + reduce(12), // regDefId, reduce: LexAlt + nil, // ignoredTokId + reduce(12), // "|", reduce: LexAlt + reduce(12), // ".", reduce: LexAlt + reduce(12), // char_lit, reduce: LexAlt + nil, // "-" + reduce(12), // "~", reduce: LexAlt + reduce(12), // "(", reduce: LexAlt + nil, // ")" + reduce(12), // "[", reduce: LexAlt + nil, // "]" + reduce(12), // "{", reduce: LexAlt + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S25 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + reduce(19), // ";", reduce: LexTerm + reduce(19), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(19), // "|", reduce: LexTerm + reduce(19), // ".", reduce: LexTerm + reduce(19), // char_lit, reduce: LexTerm + nil, // "-" + reduce(19), // "~", reduce: LexTerm + reduce(19), // "(", reduce: LexTerm + nil, // ")" + reduce(19), // "[", reduce: LexTerm + nil, // "]" + reduce(19), // "{", reduce: LexTerm + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S26 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + reduce(14), // ";", reduce: LexTerm + reduce(14), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(14), // "|", reduce: LexTerm + reduce(14), // ".", reduce: LexTerm + reduce(14), // char_lit, reduce: LexTerm + nil, // "-" + reduce(14), // "~", reduce: LexTerm + reduce(14), // "(", reduce: LexTerm + nil, // ")" + reduce(14), // "[", reduce: LexTerm + nil, // "]" + reduce(14), // "{", reduce: LexTerm + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S27 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + reduce(15), // ";", reduce: LexTerm + reduce(15), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(15), // "|", reduce: LexTerm + reduce(15), // ".", reduce: LexTerm + reduce(15), // char_lit, reduce: LexTerm + shift(50), // "-" + reduce(15), // "~", reduce: LexTerm + reduce(15), // "(", reduce: LexTerm + nil, // ")" + reduce(15), // "[", reduce: LexTerm + nil, // "]" + reduce(15), // "{", reduce: LexTerm + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S28 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + shift(51), // char_lit + nil, // "-" + nil, // "~" + shift(52), // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S29 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + shift(56), // regDefId + nil, // ignoredTokId + nil, // "|" + shift(57), // "." + shift(58), // char_lit + nil, // "-" + shift(59), // "~" + shift(60), // "(" + nil, // ")" + shift(61), // "[" + nil, // "]" + shift(62), // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S30 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + shift(66), // regDefId + nil, // ignoredTokId + nil, // "|" + shift(67), // "." + shift(68), // char_lit + nil, // "-" + shift(69), // "~" + shift(70), // "(" + nil, // ")" + shift(71), // "[" + nil, // "]" + shift(72), // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S31 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + shift(76), // regDefId + nil, // ignoredTokId + nil, // "|" + shift(77), // "." + shift(78), // char_lit + nil, // "-" + shift(79), // "~" + shift(80), // "(" + nil, // ")" + shift(81), // "[" + nil, // "]" + shift(82), // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S32 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + shift(83), // ";" + nil, // regDefId + nil, // ignoredTokId + shift(48), // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S33 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + shift(84), // ";" + nil, // regDefId + nil, // ignoredTokId + shift(48), // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S34 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + shift(85), // ";" + nil, // regDefId + nil, // ignoredTokId + shift(86), // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S35 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + reduce(29), // ";", reduce: Alternatives + nil, // regDefId + nil, // ignoredTokId + reduce(29), // "|", reduce: Alternatives + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S36 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + shift(40), // tokId + nil, // ":" + reduce(31), // ";", reduce: SyntaxBody + nil, // regDefId + nil, // ignoredTokId + reduce(31), // "|", reduce: SyntaxBody + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + shift(88), // g_sdt_lit + shift(41), // prodId + shift(42), // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S37 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + shift(40), // tokId + nil, // ":" + reduce(33), // ";", reduce: SyntaxBody + nil, // regDefId + nil, // ignoredTokId + reduce(33), // "|", reduce: SyntaxBody + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + shift(90), // g_sdt_lit + shift(41), // prodId + shift(42), // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S38 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + reduce(37), // ";", reduce: SyntaxBody + nil, // regDefId + nil, // ignoredTokId + reduce(37), // "|", reduce: SyntaxBody + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S39 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + reduce(38), // tokId, reduce: Symbols + nil, // ":" + reduce(38), // ";", reduce: Symbols + nil, // regDefId + nil, // ignoredTokId + reduce(38), // "|", reduce: Symbols + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + reduce(38), // g_sdt_lit, reduce: Symbols + reduce(38), // prodId, reduce: Symbols + reduce(38), // string_lit, reduce: Symbols + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S40 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + reduce(41), // tokId, reduce: Symbol + nil, // ":" + reduce(41), // ";", reduce: Symbol + nil, // regDefId + nil, // ignoredTokId + reduce(41), // "|", reduce: Symbol + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + reduce(41), // g_sdt_lit, reduce: Symbol + reduce(41), // prodId, reduce: Symbol + reduce(41), // string_lit, reduce: Symbol + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S41 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + reduce(40), // tokId, reduce: Symbol + nil, // ":" + reduce(40), // ";", reduce: Symbol + nil, // regDefId + nil, // ignoredTokId + reduce(40), // "|", reduce: Symbol + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + reduce(40), // g_sdt_lit, reduce: Symbol + reduce(40), // prodId, reduce: Symbol + reduce(40), // string_lit, reduce: Symbol + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S42 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + reduce(42), // tokId, reduce: Symbol + nil, // ":" + reduce(42), // ";", reduce: Symbol + nil, // regDefId + nil, // ignoredTokId + reduce(42), // "|", reduce: Symbol + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + reduce(42), // g_sdt_lit, reduce: Symbol + reduce(42), // prodId, reduce: Symbol + reduce(42), // string_lit, reduce: Symbol + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S43 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + reduce(43), // tokId, reduce: ErrorSymbol + nil, // ":" + reduce(43), // ";", reduce: ErrorSymbol + nil, // regDefId + nil, // ignoredTokId + reduce(43), // "|", reduce: ErrorSymbol + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + reduce(43), // g_sdt_lit, reduce: ErrorSymbol + reduce(43), // prodId, reduce: ErrorSymbol + reduce(43), // string_lit, reduce: ErrorSymbol + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S44 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + reduce(44), // tokId, reduce: ErrorSymbol + nil, // ":" + reduce(44), // ";", reduce: ErrorSymbol + nil, // regDefId + nil, // ignoredTokId + reduce(44), // "|", reduce: ErrorSymbol + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + reduce(44), // g_sdt_lit, reduce: ErrorSymbol + reduce(44), // prodId, reduce: ErrorSymbol + reduce(44), // string_lit, reduce: ErrorSymbol + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S45 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + reduce(45), // ";", reduce: EpsilonSymbol + nil, // regDefId + nil, // ignoredTokId + reduce(45), // "|", reduce: EpsilonSymbol + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S46 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + reduce(46), // ";", reduce: EpsilonSymbol + nil, // regDefId + nil, // ignoredTokId + reduce(46), // "|", reduce: EpsilonSymbol + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S47 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(7), // Ω, reduce: LexProduction + reduce(7), // tokId, reduce: LexProduction + nil, // ":" + nil, // ";" + reduce(7), // regDefId, reduce: LexProduction + reduce(7), // ignoredTokId, reduce: LexProduction + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + reduce(7), // g_sdt_lit, reduce: LexProduction + reduce(7), // prodId, reduce: LexProduction + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S48 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + shift(25), // regDefId + nil, // ignoredTokId + nil, // "|" + shift(26), // "." + shift(27), // char_lit + nil, // "-" + shift(28), // "~" + shift(29), // "(" + nil, // ")" + shift(30), // "[" + nil, // "]" + shift(31), // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S49 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + reduce(13), // ";", reduce: LexAlt + reduce(13), // regDefId, reduce: LexAlt + nil, // ignoredTokId + reduce(13), // "|", reduce: LexAlt + reduce(13), // ".", reduce: LexAlt + reduce(13), // char_lit, reduce: LexAlt + nil, // "-" + reduce(13), // "~", reduce: LexAlt + reduce(13), // "(", reduce: LexAlt + nil, // ")" + reduce(13), // "[", reduce: LexAlt + nil, // "]" + reduce(13), // "{", reduce: LexAlt + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S50 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + shift(92), // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S51 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + reduce(17), // ";", reduce: LexTerm + reduce(17), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(17), // "|", reduce: LexTerm + reduce(17), // ".", reduce: LexTerm + reduce(17), // char_lit, reduce: LexTerm + nil, // "-" + reduce(17), // "~", reduce: LexTerm + reduce(17), // "(", reduce: LexTerm + nil, // ")" + reduce(17), // "[", reduce: LexTerm + nil, // "]" + reduce(17), // "{", reduce: LexTerm + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S52 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + shift(93), // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S53 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + shift(94), // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + shift(95), // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S54 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + shift(56), // regDefId + nil, // ignoredTokId + reduce(10), // "|", reduce: LexPattern + shift(57), // "." + shift(58), // char_lit + nil, // "-" + shift(59), // "~" + shift(60), // "(" + reduce(10), // ")", reduce: LexPattern + shift(61), // "[" + nil, // "]" + shift(62), // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S55 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(12), // regDefId, reduce: LexAlt + nil, // ignoredTokId + reduce(12), // "|", reduce: LexAlt + reduce(12), // ".", reduce: LexAlt + reduce(12), // char_lit, reduce: LexAlt + nil, // "-" + reduce(12), // "~", reduce: LexAlt + reduce(12), // "(", reduce: LexAlt + reduce(12), // ")", reduce: LexAlt + reduce(12), // "[", reduce: LexAlt + nil, // "]" + reduce(12), // "{", reduce: LexAlt + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S56 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(19), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(19), // "|", reduce: LexTerm + reduce(19), // ".", reduce: LexTerm + reduce(19), // char_lit, reduce: LexTerm + nil, // "-" + reduce(19), // "~", reduce: LexTerm + reduce(19), // "(", reduce: LexTerm + reduce(19), // ")", reduce: LexTerm + reduce(19), // "[", reduce: LexTerm + nil, // "]" + reduce(19), // "{", reduce: LexTerm + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S57 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(14), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(14), // "|", reduce: LexTerm + reduce(14), // ".", reduce: LexTerm + reduce(14), // char_lit, reduce: LexTerm + nil, // "-" + reduce(14), // "~", reduce: LexTerm + reduce(14), // "(", reduce: LexTerm + reduce(14), // ")", reduce: LexTerm + reduce(14), // "[", reduce: LexTerm + nil, // "]" + reduce(14), // "{", reduce: LexTerm + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S58 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(15), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(15), // "|", reduce: LexTerm + reduce(15), // ".", reduce: LexTerm + reduce(15), // char_lit, reduce: LexTerm + shift(97), // "-" + reduce(15), // "~", reduce: LexTerm + reduce(15), // "(", reduce: LexTerm + reduce(15), // ")", reduce: LexTerm + reduce(15), // "[", reduce: LexTerm + nil, // "]" + reduce(15), // "{", reduce: LexTerm + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S59 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + shift(98), // char_lit + nil, // "-" + nil, // "~" + shift(99), // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S60 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + shift(56), // regDefId + nil, // ignoredTokId + nil, // "|" + shift(57), // "." + shift(58), // char_lit + nil, // "-" + shift(59), // "~" + shift(60), // "(" + nil, // ")" + shift(61), // "[" + nil, // "]" + shift(62), // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S61 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + shift(66), // regDefId + nil, // ignoredTokId + nil, // "|" + shift(67), // "." + shift(68), // char_lit + nil, // "-" + shift(69), // "~" + shift(70), // "(" + nil, // ")" + shift(71), // "[" + nil, // "]" + shift(72), // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S62 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + shift(76), // regDefId + nil, // ignoredTokId + nil, // "|" + shift(77), // "." + shift(78), // char_lit + nil, // "-" + shift(79), // "~" + shift(80), // "(" + nil, // ")" + shift(81), // "[" + nil, // "]" + shift(82), // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S63 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + shift(103), // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + shift(104), // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S64 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + shift(66), // regDefId + nil, // ignoredTokId + reduce(10), // "|", reduce: LexPattern + shift(67), // "." + shift(68), // char_lit + nil, // "-" + shift(69), // "~" + shift(70), // "(" + nil, // ")" + shift(71), // "[" + reduce(10), // "]", reduce: LexPattern + shift(72), // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S65 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(12), // regDefId, reduce: LexAlt + nil, // ignoredTokId + reduce(12), // "|", reduce: LexAlt + reduce(12), // ".", reduce: LexAlt + reduce(12), // char_lit, reduce: LexAlt + nil, // "-" + reduce(12), // "~", reduce: LexAlt + reduce(12), // "(", reduce: LexAlt + nil, // ")" + reduce(12), // "[", reduce: LexAlt + reduce(12), // "]", reduce: LexAlt + reduce(12), // "{", reduce: LexAlt + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S66 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(19), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(19), // "|", reduce: LexTerm + reduce(19), // ".", reduce: LexTerm + reduce(19), // char_lit, reduce: LexTerm + nil, // "-" + reduce(19), // "~", reduce: LexTerm + reduce(19), // "(", reduce: LexTerm + nil, // ")" + reduce(19), // "[", reduce: LexTerm + reduce(19), // "]", reduce: LexTerm + reduce(19), // "{", reduce: LexTerm + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S67 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(14), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(14), // "|", reduce: LexTerm + reduce(14), // ".", reduce: LexTerm + reduce(14), // char_lit, reduce: LexTerm + nil, // "-" + reduce(14), // "~", reduce: LexTerm + reduce(14), // "(", reduce: LexTerm + nil, // ")" + reduce(14), // "[", reduce: LexTerm + reduce(14), // "]", reduce: LexTerm + reduce(14), // "{", reduce: LexTerm + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S68 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(15), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(15), // "|", reduce: LexTerm + reduce(15), // ".", reduce: LexTerm + reduce(15), // char_lit, reduce: LexTerm + shift(106), // "-" + reduce(15), // "~", reduce: LexTerm + reduce(15), // "(", reduce: LexTerm + nil, // ")" + reduce(15), // "[", reduce: LexTerm + reduce(15), // "]", reduce: LexTerm + reduce(15), // "{", reduce: LexTerm + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S69 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + shift(107), // char_lit + nil, // "-" + nil, // "~" + shift(108), // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S70 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + shift(56), // regDefId + nil, // ignoredTokId + nil, // "|" + shift(57), // "." + shift(58), // char_lit + nil, // "-" + shift(59), // "~" + shift(60), // "(" + nil, // ")" + shift(61), // "[" + nil, // "]" + shift(62), // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S71 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + shift(66), // regDefId + nil, // ignoredTokId + nil, // "|" + shift(67), // "." + shift(68), // char_lit + nil, // "-" + shift(69), // "~" + shift(70), // "(" + nil, // ")" + shift(71), // "[" + nil, // "]" + shift(72), // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S72 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + shift(76), // regDefId + nil, // ignoredTokId + nil, // "|" + shift(77), // "." + shift(78), // char_lit + nil, // "-" + shift(79), // "~" + shift(80), // "(" + nil, // ")" + shift(81), // "[" + nil, // "]" + shift(82), // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S73 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + shift(112), // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + shift(113), // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S74 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + shift(76), // regDefId + nil, // ignoredTokId + reduce(10), // "|", reduce: LexPattern + shift(77), // "." + shift(78), // char_lit + nil, // "-" + shift(79), // "~" + shift(80), // "(" + nil, // ")" + shift(81), // "[" + nil, // "]" + shift(82), // "{" + reduce(10), // "}", reduce: LexPattern + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S75 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(12), // regDefId, reduce: LexAlt + nil, // ignoredTokId + reduce(12), // "|", reduce: LexAlt + reduce(12), // ".", reduce: LexAlt + reduce(12), // char_lit, reduce: LexAlt + nil, // "-" + reduce(12), // "~", reduce: LexAlt + reduce(12), // "(", reduce: LexAlt + nil, // ")" + reduce(12), // "[", reduce: LexAlt + nil, // "]" + reduce(12), // "{", reduce: LexAlt + reduce(12), // "}", reduce: LexAlt + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S76 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(19), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(19), // "|", reduce: LexTerm + reduce(19), // ".", reduce: LexTerm + reduce(19), // char_lit, reduce: LexTerm + nil, // "-" + reduce(19), // "~", reduce: LexTerm + reduce(19), // "(", reduce: LexTerm + nil, // ")" + reduce(19), // "[", reduce: LexTerm + nil, // "]" + reduce(19), // "{", reduce: LexTerm + reduce(19), // "}", reduce: LexTerm + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S77 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(14), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(14), // "|", reduce: LexTerm + reduce(14), // ".", reduce: LexTerm + reduce(14), // char_lit, reduce: LexTerm + nil, // "-" + reduce(14), // "~", reduce: LexTerm + reduce(14), // "(", reduce: LexTerm + nil, // ")" + reduce(14), // "[", reduce: LexTerm + nil, // "]" + reduce(14), // "{", reduce: LexTerm + reduce(14), // "}", reduce: LexTerm + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S78 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(15), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(15), // "|", reduce: LexTerm + reduce(15), // ".", reduce: LexTerm + reduce(15), // char_lit, reduce: LexTerm + shift(115), // "-" + reduce(15), // "~", reduce: LexTerm + reduce(15), // "(", reduce: LexTerm + nil, // ")" + reduce(15), // "[", reduce: LexTerm + nil, // "]" + reduce(15), // "{", reduce: LexTerm + reduce(15), // "}", reduce: LexTerm + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S79 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + shift(116), // char_lit + nil, // "-" + nil, // "~" + shift(117), // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S80 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + shift(56), // regDefId + nil, // ignoredTokId + nil, // "|" + shift(57), // "." + shift(58), // char_lit + nil, // "-" + shift(59), // "~" + shift(60), // "(" + nil, // ")" + shift(61), // "[" + nil, // "]" + shift(62), // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S81 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + shift(66), // regDefId + nil, // ignoredTokId + nil, // "|" + shift(67), // "." + shift(68), // char_lit + nil, // "-" + shift(69), // "~" + shift(70), // "(" + nil, // ")" + shift(71), // "[" + nil, // "]" + shift(72), // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S82 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + shift(76), // regDefId + nil, // ignoredTokId + nil, // "|" + shift(77), // "." + shift(78), // char_lit + nil, // "-" + shift(79), // "~" + shift(80), // "(" + nil, // ")" + shift(81), // "[" + nil, // "]" + shift(82), // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S83 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(8), // Ω, reduce: LexProduction + reduce(8), // tokId, reduce: LexProduction + nil, // ":" + nil, // ";" + reduce(8), // regDefId, reduce: LexProduction + reduce(8), // ignoredTokId, reduce: LexProduction + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + reduce(8), // g_sdt_lit, reduce: LexProduction + reduce(8), // prodId, reduce: LexProduction + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S84 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(9), // Ω, reduce: LexProduction + reduce(9), // tokId, reduce: LexProduction + nil, // ":" + nil, // ";" + reduce(9), // regDefId, reduce: LexProduction + reduce(9), // ignoredTokId, reduce: LexProduction + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + reduce(9), // g_sdt_lit, reduce: LexProduction + reduce(9), // prodId, reduce: LexProduction + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S85 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(28), // Ω, reduce: SyntaxProduction + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + reduce(28), // prodId, reduce: SyntaxProduction + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S86 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + shift(40), // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + shift(41), // prodId + shift(42), // string_lit + shift(43), // "error" + shift(44), // "λ" + shift(45), // "empty" + shift(46), // "ε" + }, + }, + actionRow{ // S87 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + reduce(39), // tokId, reduce: Symbols + nil, // ":" + reduce(39), // ";", reduce: Symbols + nil, // regDefId + nil, // ignoredTokId + reduce(39), // "|", reduce: Symbols + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + reduce(39), // g_sdt_lit, reduce: Symbols + reduce(39), // prodId, reduce: Symbols + reduce(39), // string_lit, reduce: Symbols + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S88 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + reduce(32), // ";", reduce: SyntaxBody + nil, // regDefId + nil, // ignoredTokId + reduce(32), // "|", reduce: SyntaxBody + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S89 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + shift(40), // tokId + nil, // ":" + reduce(34), // ";", reduce: SyntaxBody + nil, // regDefId + nil, // ignoredTokId + reduce(34), // "|", reduce: SyntaxBody + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + shift(122), // g_sdt_lit + shift(41), // prodId + shift(42), // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S90 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + reduce(36), // ";", reduce: SyntaxBody + nil, // regDefId + nil, // ignoredTokId + reduce(36), // "|", reduce: SyntaxBody + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S91 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + reduce(11), // ";", reduce: LexPattern + shift(25), // regDefId + nil, // ignoredTokId + reduce(11), // "|", reduce: LexPattern + shift(26), // "." + shift(27), // char_lit + nil, // "-" + shift(28), // "~" + shift(29), // "(" + nil, // ")" + shift(30), // "[" + nil, // "]" + shift(31), // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S92 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + reduce(16), // ";", reduce: LexTerm + reduce(16), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(16), // "|", reduce: LexTerm + reduce(16), // ".", reduce: LexTerm + reduce(16), // char_lit, reduce: LexTerm + nil, // "-" + reduce(16), // "~", reduce: LexTerm + reduce(16), // "(", reduce: LexTerm + nil, // ")" + reduce(16), // "[", reduce: LexTerm + nil, // "]" + reduce(16), // "{", reduce: LexTerm + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S93 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + nil, // char_lit + shift(123), // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S94 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + shift(56), // regDefId + nil, // ignoredTokId + nil, // "|" + shift(57), // "." + shift(58), // char_lit + nil, // "-" + shift(59), // "~" + shift(60), // "(" + nil, // ")" + shift(61), // "[" + nil, // "]" + shift(62), // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S95 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + reduce(22), // ";", reduce: LexTerm + reduce(22), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(22), // "|", reduce: LexTerm + reduce(22), // ".", reduce: LexTerm + reduce(22), // char_lit, reduce: LexTerm + nil, // "-" + reduce(22), // "~", reduce: LexTerm + reduce(22), // "(", reduce: LexTerm + nil, // ")" + reduce(22), // "[", reduce: LexTerm + nil, // "]" + reduce(22), // "{", reduce: LexTerm + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S96 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(13), // regDefId, reduce: LexAlt + nil, // ignoredTokId + reduce(13), // "|", reduce: LexAlt + reduce(13), // ".", reduce: LexAlt + reduce(13), // char_lit, reduce: LexAlt + nil, // "-" + reduce(13), // "~", reduce: LexAlt + reduce(13), // "(", reduce: LexAlt + reduce(13), // ")", reduce: LexAlt + reduce(13), // "[", reduce: LexAlt + nil, // "]" + reduce(13), // "{", reduce: LexAlt + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S97 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + shift(125), // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S98 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(17), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(17), // "|", reduce: LexTerm + reduce(17), // ".", reduce: LexTerm + reduce(17), // char_lit, reduce: LexTerm + nil, // "-" + reduce(17), // "~", reduce: LexTerm + reduce(17), // "(", reduce: LexTerm + reduce(17), // ")", reduce: LexTerm + reduce(17), // "[", reduce: LexTerm + nil, // "]" + reduce(17), // "{", reduce: LexTerm + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S99 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + shift(126), // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S100 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + shift(94), // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + shift(127), // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S101 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + shift(103), // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + shift(128), // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S102 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + shift(112), // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + shift(129), // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S103 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + shift(66), // regDefId + nil, // ignoredTokId + nil, // "|" + shift(67), // "." + shift(68), // char_lit + nil, // "-" + shift(69), // "~" + shift(70), // "(" + nil, // ")" + shift(71), // "[" + nil, // "]" + shift(72), // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S104 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + reduce(20), // ";", reduce: LexTerm + reduce(20), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(20), // "|", reduce: LexTerm + reduce(20), // ".", reduce: LexTerm + reduce(20), // char_lit, reduce: LexTerm + nil, // "-" + reduce(20), // "~", reduce: LexTerm + reduce(20), // "(", reduce: LexTerm + nil, // ")" + reduce(20), // "[", reduce: LexTerm + nil, // "]" + reduce(20), // "{", reduce: LexTerm + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S105 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(13), // regDefId, reduce: LexAlt + nil, // ignoredTokId + reduce(13), // "|", reduce: LexAlt + reduce(13), // ".", reduce: LexAlt + reduce(13), // char_lit, reduce: LexAlt + nil, // "-" + reduce(13), // "~", reduce: LexAlt + reduce(13), // "(", reduce: LexAlt + nil, // ")" + reduce(13), // "[", reduce: LexAlt + reduce(13), // "]", reduce: LexAlt + reduce(13), // "{", reduce: LexAlt + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S106 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + shift(131), // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S107 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(17), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(17), // "|", reduce: LexTerm + reduce(17), // ".", reduce: LexTerm + reduce(17), // char_lit, reduce: LexTerm + nil, // "-" + reduce(17), // "~", reduce: LexTerm + reduce(17), // "(", reduce: LexTerm + nil, // ")" + reduce(17), // "[", reduce: LexTerm + reduce(17), // "]", reduce: LexTerm + reduce(17), // "{", reduce: LexTerm + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S108 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + shift(132), // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S109 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + shift(94), // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + shift(133), // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S110 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + shift(103), // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + shift(134), // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S111 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + shift(112), // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + shift(135), // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S112 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + shift(76), // regDefId + nil, // ignoredTokId + nil, // "|" + shift(77), // "." + shift(78), // char_lit + nil, // "-" + shift(79), // "~" + shift(80), // "(" + nil, // ")" + shift(81), // "[" + nil, // "]" + shift(82), // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S113 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + reduce(21), // ";", reduce: LexTerm + reduce(21), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(21), // "|", reduce: LexTerm + reduce(21), // ".", reduce: LexTerm + reduce(21), // char_lit, reduce: LexTerm + nil, // "-" + reduce(21), // "~", reduce: LexTerm + reduce(21), // "(", reduce: LexTerm + nil, // ")" + reduce(21), // "[", reduce: LexTerm + nil, // "]" + reduce(21), // "{", reduce: LexTerm + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S114 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(13), // regDefId, reduce: LexAlt + nil, // ignoredTokId + reduce(13), // "|", reduce: LexAlt + reduce(13), // ".", reduce: LexAlt + reduce(13), // char_lit, reduce: LexAlt + nil, // "-" + reduce(13), // "~", reduce: LexAlt + reduce(13), // "(", reduce: LexAlt + nil, // ")" + reduce(13), // "[", reduce: LexAlt + nil, // "]" + reduce(13), // "{", reduce: LexAlt + reduce(13), // "}", reduce: LexAlt + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S115 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + shift(137), // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S116 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(17), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(17), // "|", reduce: LexTerm + reduce(17), // ".", reduce: LexTerm + reduce(17), // char_lit, reduce: LexTerm + nil, // "-" + reduce(17), // "~", reduce: LexTerm + reduce(17), // "(", reduce: LexTerm + nil, // ")" + reduce(17), // "[", reduce: LexTerm + nil, // "]" + reduce(17), // "{", reduce: LexTerm + reduce(17), // "}", reduce: LexTerm + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S117 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + shift(138), // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S118 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + shift(94), // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + shift(139), // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S119 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + shift(103), // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + shift(140), // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S120 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + shift(112), // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + shift(141), // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S121 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + reduce(30), // ";", reduce: Alternatives + nil, // regDefId + nil, // ignoredTokId + reduce(30), // "|", reduce: Alternatives + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S122 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + reduce(35), // ";", reduce: SyntaxBody + nil, // regDefId + nil, // ignoredTokId + reduce(35), // "|", reduce: SyntaxBody + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S123 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + shift(142), // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S124 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + shift(56), // regDefId + nil, // ignoredTokId + reduce(11), // "|", reduce: LexPattern + shift(57), // "." + shift(58), // char_lit + nil, // "-" + shift(59), // "~" + shift(60), // "(" + reduce(11), // ")", reduce: LexPattern + shift(61), // "[" + nil, // "]" + shift(62), // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S125 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(16), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(16), // "|", reduce: LexTerm + reduce(16), // ".", reduce: LexTerm + reduce(16), // char_lit, reduce: LexTerm + nil, // "-" + reduce(16), // "~", reduce: LexTerm + reduce(16), // "(", reduce: LexTerm + reduce(16), // ")", reduce: LexTerm + reduce(16), // "[", reduce: LexTerm + nil, // "]" + reduce(16), // "{", reduce: LexTerm + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S126 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + nil, // char_lit + shift(143), // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S127 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(22), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(22), // "|", reduce: LexTerm + reduce(22), // ".", reduce: LexTerm + reduce(22), // char_lit, reduce: LexTerm + nil, // "-" + reduce(22), // "~", reduce: LexTerm + reduce(22), // "(", reduce: LexTerm + reduce(22), // ")", reduce: LexTerm + reduce(22), // "[", reduce: LexTerm + nil, // "]" + reduce(22), // "{", reduce: LexTerm + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S128 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(20), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(20), // "|", reduce: LexTerm + reduce(20), // ".", reduce: LexTerm + reduce(20), // char_lit, reduce: LexTerm + nil, // "-" + reduce(20), // "~", reduce: LexTerm + reduce(20), // "(", reduce: LexTerm + reduce(20), // ")", reduce: LexTerm + reduce(20), // "[", reduce: LexTerm + nil, // "]" + reduce(20), // "{", reduce: LexTerm + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S129 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(21), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(21), // "|", reduce: LexTerm + reduce(21), // ".", reduce: LexTerm + reduce(21), // char_lit, reduce: LexTerm + nil, // "-" + reduce(21), // "~", reduce: LexTerm + reduce(21), // "(", reduce: LexTerm + reduce(21), // ")", reduce: LexTerm + reduce(21), // "[", reduce: LexTerm + nil, // "]" + reduce(21), // "{", reduce: LexTerm + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S130 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + shift(66), // regDefId + nil, // ignoredTokId + reduce(11), // "|", reduce: LexPattern + shift(67), // "." + shift(68), // char_lit + nil, // "-" + shift(69), // "~" + shift(70), // "(" + nil, // ")" + shift(71), // "[" + reduce(11), // "]", reduce: LexPattern + shift(72), // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S131 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(16), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(16), // "|", reduce: LexTerm + reduce(16), // ".", reduce: LexTerm + reduce(16), // char_lit, reduce: LexTerm + nil, // "-" + reduce(16), // "~", reduce: LexTerm + reduce(16), // "(", reduce: LexTerm + nil, // ")" + reduce(16), // "[", reduce: LexTerm + reduce(16), // "]", reduce: LexTerm + reduce(16), // "{", reduce: LexTerm + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S132 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + nil, // char_lit + shift(144), // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S133 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(22), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(22), // "|", reduce: LexTerm + reduce(22), // ".", reduce: LexTerm + reduce(22), // char_lit, reduce: LexTerm + nil, // "-" + reduce(22), // "~", reduce: LexTerm + reduce(22), // "(", reduce: LexTerm + nil, // ")" + reduce(22), // "[", reduce: LexTerm + reduce(22), // "]", reduce: LexTerm + reduce(22), // "{", reduce: LexTerm + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S134 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(20), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(20), // "|", reduce: LexTerm + reduce(20), // ".", reduce: LexTerm + reduce(20), // char_lit, reduce: LexTerm + nil, // "-" + reduce(20), // "~", reduce: LexTerm + reduce(20), // "(", reduce: LexTerm + nil, // ")" + reduce(20), // "[", reduce: LexTerm + reduce(20), // "]", reduce: LexTerm + reduce(20), // "{", reduce: LexTerm + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S135 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(21), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(21), // "|", reduce: LexTerm + reduce(21), // ".", reduce: LexTerm + reduce(21), // char_lit, reduce: LexTerm + nil, // "-" + reduce(21), // "~", reduce: LexTerm + reduce(21), // "(", reduce: LexTerm + nil, // ")" + reduce(21), // "[", reduce: LexTerm + reduce(21), // "]", reduce: LexTerm + reduce(21), // "{", reduce: LexTerm + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S136 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + shift(76), // regDefId + nil, // ignoredTokId + reduce(11), // "|", reduce: LexPattern + shift(77), // "." + shift(78), // char_lit + nil, // "-" + shift(79), // "~" + shift(80), // "(" + nil, // ")" + shift(81), // "[" + nil, // "]" + shift(82), // "{" + reduce(11), // "}", reduce: LexPattern + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S137 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(16), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(16), // "|", reduce: LexTerm + reduce(16), // ".", reduce: LexTerm + reduce(16), // char_lit, reduce: LexTerm + nil, // "-" + reduce(16), // "~", reduce: LexTerm + reduce(16), // "(", reduce: LexTerm + nil, // ")" + reduce(16), // "[", reduce: LexTerm + nil, // "]" + reduce(16), // "{", reduce: LexTerm + reduce(16), // "}", reduce: LexTerm + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S138 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + nil, // char_lit + shift(145), // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S139 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(22), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(22), // "|", reduce: LexTerm + reduce(22), // ".", reduce: LexTerm + reduce(22), // char_lit, reduce: LexTerm + nil, // "-" + reduce(22), // "~", reduce: LexTerm + reduce(22), // "(", reduce: LexTerm + nil, // ")" + reduce(22), // "[", reduce: LexTerm + nil, // "]" + reduce(22), // "{", reduce: LexTerm + reduce(22), // "}", reduce: LexTerm + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S140 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(20), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(20), // "|", reduce: LexTerm + reduce(20), // ".", reduce: LexTerm + reduce(20), // char_lit, reduce: LexTerm + nil, // "-" + reduce(20), // "~", reduce: LexTerm + reduce(20), // "(", reduce: LexTerm + nil, // ")" + reduce(20), // "[", reduce: LexTerm + nil, // "]" + reduce(20), // "{", reduce: LexTerm + reduce(20), // "}", reduce: LexTerm + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S141 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(21), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(21), // "|", reduce: LexTerm + reduce(21), // ".", reduce: LexTerm + reduce(21), // char_lit, reduce: LexTerm + nil, // "-" + reduce(21), // "~", reduce: LexTerm + reduce(21), // "(", reduce: LexTerm + nil, // ")" + reduce(21), // "[", reduce: LexTerm + nil, // "]" + reduce(21), // "{", reduce: LexTerm + reduce(21), // "}", reduce: LexTerm + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S142 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + shift(146), // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S143 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + shift(147), // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S144 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + shift(148), // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S145 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + shift(149), // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S146 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + reduce(18), // ";", reduce: LexTerm + reduce(18), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(18), // "|", reduce: LexTerm + reduce(18), // ".", reduce: LexTerm + reduce(18), // char_lit, reduce: LexTerm + nil, // "-" + reduce(18), // "~", reduce: LexTerm + reduce(18), // "(", reduce: LexTerm + nil, // ")" + reduce(18), // "[", reduce: LexTerm + nil, // "]" + reduce(18), // "{", reduce: LexTerm + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S147 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + shift(150), // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S148 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + shift(151), // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S149 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + shift(152), // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S150 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(18), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(18), // "|", reduce: LexTerm + reduce(18), // ".", reduce: LexTerm + reduce(18), // char_lit, reduce: LexTerm + nil, // "-" + reduce(18), // "~", reduce: LexTerm + reduce(18), // "(", reduce: LexTerm + reduce(18), // ")", reduce: LexTerm + reduce(18), // "[", reduce: LexTerm + nil, // "]" + reduce(18), // "{", reduce: LexTerm + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S151 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(18), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(18), // "|", reduce: LexTerm + reduce(18), // ".", reduce: LexTerm + reduce(18), // char_lit, reduce: LexTerm + nil, // "-" + reduce(18), // "~", reduce: LexTerm + reduce(18), // "(", reduce: LexTerm + nil, // ")" + reduce(18), // "[", reduce: LexTerm + reduce(18), // "]", reduce: LexTerm + reduce(18), // "{", reduce: LexTerm + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S152 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(18), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(18), // "|", reduce: LexTerm + reduce(18), // ".", reduce: LexTerm + reduce(18), // char_lit, reduce: LexTerm + nil, // "-" + reduce(18), // "~", reduce: LexTerm + reduce(18), // "(", reduce: LexTerm + nil, // ")" + reduce(18), // "[", reduce: LexTerm + nil, // "]" + reduce(18), // "{", reduce: LexTerm + reduce(18), // "}", reduce: LexTerm + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, +} diff --git a/internal/frontend/reparsed/internal/parser/next/gototable.go b/internal/frontend/reparsed/internal/parser/next/gototable.go new file mode 100644 index 00000000..6d28aaa3 --- /dev/null +++ b/internal/frontend/reparsed/internal/parser/next/gototable.go @@ -0,0 +1,3073 @@ +// Code generated by gocc; DO NOT EDIT. + +package parser + +const numNTSymbols = 18 + +type ( + gotoTable [numStates]gotoRow + gotoRow [numNTSymbols]int +) + +var gotoTab = gotoTable{ + gotoRow{ // S0 + -1, // Π + 1, // Π + 2, // Π + 3, // Π + 4, // Π + 5, // Π + -1, // Π + -1, // Π + -1, // Π + 6, // Π + 7, // Π + 8, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S1 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S2 + -1, // Π + -1, // Π + -1, // Π + 14, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + 6, // Π + 7, // Π + 8, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S3 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S4 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + 15, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S5 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S6 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + 16, // Π + 8, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S7 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + 17, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S8 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S9 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S10 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S11 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S12 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S13 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S14 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S15 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S16 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + 17, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S17 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S18 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + 22, // Π + 23, // Π + 24, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S19 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + 32, // Π + 23, // Π + 24, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S20 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + 33, // Π + 23, // Π + 24, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S21 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + 34, // Π + 35, // Π + 36, // Π + 37, // Π + 38, // Π + 39, // Π + }, + gotoRow{ // S22 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S23 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + 49, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S24 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S25 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S26 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S27 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S28 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S29 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + 53, // Π + 54, // Π + 55, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S30 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + 63, // Π + 64, // Π + 65, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S31 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + 73, // Π + 74, // Π + 75, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S32 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S33 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S34 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S35 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S36 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + 87, // Π + }, + gotoRow{ // S37 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + 89, // Π + -1, // Π + -1, // Π + 39, // Π + }, + gotoRow{ // S38 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S39 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S40 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S41 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S42 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S43 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S44 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S45 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S46 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S47 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S48 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + 91, // Π + 24, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S49 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S50 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S51 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S52 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S53 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S54 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + 96, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S55 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S56 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S57 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S58 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S59 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S60 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + 100, // Π + 54, // Π + 55, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S61 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + 101, // Π + 64, // Π + 65, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S62 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + 102, // Π + 74, // Π + 75, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S63 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S64 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + 105, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S65 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S66 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S67 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S68 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S69 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S70 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + 109, // Π + 54, // Π + 55, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S71 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + 110, // Π + 64, // Π + 65, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S72 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + 111, // Π + 74, // Π + 75, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S73 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S74 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + 114, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S75 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S76 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S77 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S78 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S79 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S80 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + 118, // Π + 54, // Π + 55, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S81 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + 119, // Π + 64, // Π + 65, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S82 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + 120, // Π + 74, // Π + 75, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S83 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S84 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S85 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S86 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + 121, // Π + 36, // Π + 37, // Π + 38, // Π + 39, // Π + }, + gotoRow{ // S87 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S88 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S89 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + 87, // Π + }, + gotoRow{ // S90 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S91 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + 49, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S92 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S93 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S94 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + 124, // Π + 55, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S95 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S96 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S97 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S98 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S99 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S100 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S101 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S102 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S103 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + 130, // Π + 65, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S104 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S105 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S106 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S107 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S108 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S109 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S110 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S111 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S112 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + 136, // Π + 75, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S113 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S114 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S115 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S116 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S117 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S118 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S119 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S120 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S121 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S122 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S123 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S124 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + 96, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S125 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S126 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S127 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S128 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S129 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S130 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + 105, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S131 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S132 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S133 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S134 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S135 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S136 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + 114, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S137 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S138 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S139 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S140 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S141 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S142 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S143 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S144 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S145 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S146 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S147 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S148 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S149 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S150 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S151 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S152 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, +} diff --git a/internal/frontend/reparsed/internal/parser/next/parser.go b/internal/frontend/reparsed/internal/parser/next/parser.go new file mode 100644 index 00000000..f75ad59d --- /dev/null +++ b/internal/frontend/reparsed/internal/parser/next/parser.go @@ -0,0 +1,217 @@ +// Code generated by gocc; DO NOT EDIT. + +package parser + +import ( + "fmt" + "strings" + + parseError "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/internal/errors/next" + token "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/internal/token/next" +) + +const ( + numProductions = 47 + numStates = 153 + numSymbols = 43 +) + +// Stack + +type stack struct { + state []int + attrib []Attrib +} + +const iNITIAL_STACK_SIZE = 100 + +func newStack() *stack { + return &stack{ + state: make([]int, 0, iNITIAL_STACK_SIZE), + attrib: make([]Attrib, 0, iNITIAL_STACK_SIZE), + } +} + +func (s *stack) reset() { + s.state = s.state[:0] + s.attrib = s.attrib[:0] +} + +func (s *stack) push(state int, a Attrib) { + s.state = append(s.state, state) + s.attrib = append(s.attrib, a) +} + +func (s *stack) top() int { + return s.state[len(s.state)-1] +} + +func (s *stack) peek(pos int) int { + return s.state[pos] +} + +func (s *stack) topIndex() int { + return len(s.state) - 1 +} + +func (s *stack) popN(items int) []Attrib { + lo, hi := len(s.state)-items, len(s.state) + + attrib := s.attrib[lo:hi] + + s.state = s.state[:lo] + s.attrib = s.attrib[:lo] + + return attrib +} + +func (s *stack) String() string { + w := new(strings.Builder) + fmt.Fprintf(w, "stack:\n") + for i, st := range s.state { + fmt.Fprintf(w, "\t%d: %d , ", i, st) + if s.attrib[i] == nil { + fmt.Fprintf(w, "nil") + } else { + switch attr := s.attrib[i].(type) { + case *token.Token: + fmt.Fprintf(w, "%s", attr.Lit) + default: + fmt.Fprintf(w, "%v", attr) + } + } + fmt.Fprintf(w, "\n") + } + return w.String() +} + +// Parser + +type Parser struct { + stack *stack + nextToken *token.Token + pos int + UserContext interface{} +} + +type Scanner interface { + Scan() (tok *token.Token) +} + +func NewParser() *Parser { + p := &Parser{stack: newStack()} + p.Reset() + return p +} + +func (p *Parser) Reset() { + p.stack.reset() + p.stack.push(0, nil) +} + +func (p *Parser) Error(err error, scanner Scanner) (recovered bool, errorAttrib *parseError.Error) { + errorAttrib = &parseError.Error{ + Err: err, + ErrorToken: p.nextToken, + ErrorSymbols: p.popNonRecoveryStates(), + ExpectedTokens: make([]string, 0, 8), + } + for t, action := range actionTab[p.stack.top()].actions { + if action != nil { + errorAttrib.ExpectedTokens = append(errorAttrib.ExpectedTokens, token.TokMap.Id(token.Type(t))) + } + } + + if action := actionTab[p.stack.top()].actions[token.TokMap.Type("error")]; action != nil { + p.stack.push(int(action.(shift)), errorAttrib) // action can only be shift + } else { + return + } + + if action := actionTab[p.stack.top()].actions[p.nextToken.Type]; action != nil { + recovered = true + } + for !recovered && p.nextToken.Type != token.EOF { + p.nextToken = scanner.Scan() + if action := actionTab[p.stack.top()].actions[p.nextToken.Type]; action != nil { + recovered = true + } + } + + return +} + +func (p *Parser) popNonRecoveryStates() (removedAttribs []parseError.ErrorSymbol) { + if rs, ok := p.firstRecoveryState(); ok { + errorSymbols := p.stack.popN(p.stack.topIndex() - rs) + removedAttribs = make([]parseError.ErrorSymbol, len(errorSymbols)) + for i, e := range errorSymbols { + removedAttribs[i] = e + } + } else { + removedAttribs = []parseError.ErrorSymbol{} + } + return +} + +// recoveryState points to the highest state on the stack, which can recover +func (p *Parser) firstRecoveryState() (recoveryState int, canRecover bool) { + recoveryState, canRecover = p.stack.topIndex(), actionTab[p.stack.top()].canRecover + for recoveryState > 0 && !canRecover { + recoveryState-- + canRecover = actionTab[p.stack.peek(recoveryState)].canRecover + } + return +} + +func (p *Parser) newError(err error) error { + e := &parseError.Error{ + Err: err, + StackTop: p.stack.top(), + ErrorToken: p.nextToken, + } + actRow := actionTab[p.stack.top()] + for i, t := range actRow.actions { + if t != nil { + e.ExpectedTokens = append(e.ExpectedTokens, token.TokMap.Id(token.Type(i))) + } + } + return e +} + +func (p *Parser) Parse(scanner Scanner) (res interface{}, err error) { + p.Reset() + p.nextToken = scanner.Scan() + for acc := false; !acc; { + action := actionTab[p.stack.top()].actions[p.nextToken.Type] + if action == nil { + if recovered, errAttrib := p.Error(nil, scanner); !recovered { + p.nextToken = errAttrib.ErrorToken + return nil, p.newError(nil) + } + if action = actionTab[p.stack.top()].actions[p.nextToken.Type]; action == nil { + panic("Error recovery led to invalid action") + } + } + + switch act := action.(type) { + case accept: + res = p.stack.popN(1)[0] + acc = true + case shift: + p.stack.push(int(act), p.nextToken) + p.nextToken = scanner.Scan() + case reduce: + prod := productionsTable[int(act)] + attrib, err := prod.ReduceFunc(p.stack.popN(prod.NumSymbols)) + if err != nil { + return nil, p.newError(err) + } else { + p.stack.push(gotoTab[p.stack.top()][prod.NTType], attrib) + } + default: + panic("unknown action: " + action.String()) + } + } + return res, nil +} diff --git a/internal/frontend/reparsed/internal/parser/next/productionstable.go b/internal/frontend/reparsed/internal/parser/next/productionstable.go new file mode 100644 index 00000000..eec97f19 --- /dev/null +++ b/internal/frontend/reparsed/internal/parser/next/productionstable.go @@ -0,0 +1,495 @@ +// Code generated by gocc; DO NOT EDIT. + +package parser + +import "github.com/maxcalandrelli/gocc/internal/ast" + + + +type ( + //TODO: change type and variable names to be consistent with other tables + ProdTab [numProductions]ProdTabEntry + ProdTabEntry struct { + String string + Id string + NTType int + Index int + NumSymbols int + ReduceFunc func([]Attrib) (Attrib, error) + } + Attrib interface { + } +) + +var productionsTable = ProdTab{ + ProdTabEntry{ + String: `S' : Π << >>`, + Id: "S'", + NTType: 0, + Index: 0, + NumSymbols: 1, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return X[0], nil + }, + }, + ProdTabEntry{ + String: `Grammar : Π Π << ast.NewGrammar(X[0], X[1]) >>`, + Id: "Grammar", + NTType: 1, + Index: 1, + NumSymbols: 2, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewGrammar(X[0], X[1]) + }, + }, + ProdTabEntry{ + String: `Grammar : Π << ast.NewGrammar(X[0], nil) >>`, + Id: "Grammar", + NTType: 1, + Index: 2, + NumSymbols: 1, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewGrammar(X[0], nil) + }, + }, + ProdTabEntry{ + String: `Grammar : Π << ast.NewGrammar(nil, X[0]) >>`, + Id: "Grammar", + NTType: 1, + Index: 3, + NumSymbols: 1, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewGrammar(nil, X[0]) + }, + }, + ProdTabEntry{ + String: `LexicalPart : Π << ast.NewLexPart(nil, nil, X[0]) >>`, + Id: "LexicalPart", + NTType: 2, + Index: 4, + NumSymbols: 1, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewLexPart(nil, nil, X[0]) + }, + }, + ProdTabEntry{ + String: `LexProductions : Π << ast.NewLexProductions(X[0]) >>`, + Id: "LexProductions", + NTType: 4, + Index: 5, + NumSymbols: 1, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewLexProductions(X[0]) + }, + }, + ProdTabEntry{ + String: `LexProductions : Π Π << ast.AppendLexProduction(X[0], X[1]) >>`, + Id: "LexProductions", + NTType: 4, + Index: 6, + NumSymbols: 2, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.AppendLexProduction(X[0], X[1]) + }, + }, + ProdTabEntry{ + String: `LexProduction : tokId Λ<:> Π Λ<;> << ast.NewLexTokDef(X[0], X[2]) >>`, + Id: "LexProduction", + NTType: 5, + Index: 7, + NumSymbols: 4, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewLexTokDef(X[0], X[2]) + }, + }, + ProdTabEntry{ + String: `LexProduction : regDefId Λ<:> Π Λ<;> << ast.NewLexRegDef(X[0], X[2]) >>`, + Id: "LexProduction", + NTType: 5, + Index: 8, + NumSymbols: 4, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewLexRegDef(X[0], X[2]) + }, + }, + ProdTabEntry{ + String: `LexProduction : ignoredTokId Λ<:> Π Λ<;> << ast.NewLexIgnoredTokDef(X[0], X[2]) >>`, + Id: "LexProduction", + NTType: 5, + Index: 9, + NumSymbols: 4, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewLexIgnoredTokDef(X[0], X[2]) + }, + }, + ProdTabEntry{ + String: `LexPattern : Π << ast.NewLexPattern(X[0]) >>`, + Id: "LexPattern", + NTType: 6, + Index: 10, + NumSymbols: 1, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewLexPattern(X[0]) + }, + }, + ProdTabEntry{ + String: `LexPattern : Π Λ<|> Π << ast.AppendLexAlt(X[0], X[2]) >>`, + Id: "LexPattern", + NTType: 6, + Index: 11, + NumSymbols: 3, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.AppendLexAlt(X[0], X[2]) + }, + }, + ProdTabEntry{ + String: `LexAlt : Π << ast.NewLexAlt(X[0]) >>`, + Id: "LexAlt", + NTType: 7, + Index: 12, + NumSymbols: 1, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewLexAlt(X[0]) + }, + }, + ProdTabEntry{ + String: `LexAlt : Π Π << ast.AppendLexTerm(X[0], X[1]) >>`, + Id: "LexAlt", + NTType: 7, + Index: 13, + NumSymbols: 2, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.AppendLexTerm(X[0], X[1]) + }, + }, + ProdTabEntry{ + String: `LexTerm : Λ<.> << ast.LexDOT, nil >>`, + Id: "LexTerm", + NTType: 8, + Index: 14, + NumSymbols: 1, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.LexDOT, nil + }, + }, + ProdTabEntry{ + String: `LexTerm : char_lit << ast.NewLexCharLitExt(X[0],false) >>`, + Id: "LexTerm", + NTType: 8, + Index: 15, + NumSymbols: 1, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewLexCharLitExt(X[0],false) + }, + }, + ProdTabEntry{ + String: `LexTerm : char_lit Λ<-> char_lit << ast.NewLexCharRangeExt(X[0], X[2],false) >>`, + Id: "LexTerm", + NTType: 8, + Index: 16, + NumSymbols: 3, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewLexCharRangeExt(X[0], X[2],false) + }, + }, + ProdTabEntry{ + String: `LexTerm : Λ<~> char_lit << ast.NewLexCharLitExt(X[0], true) >>`, + Id: "LexTerm", + NTType: 8, + Index: 17, + NumSymbols: 2, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewLexCharLitExt(X[0], true) + }, + }, + ProdTabEntry{ + String: `LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> << ast.NewLexCharRangeExt(X[2], X[4], true) >>`, + Id: "LexTerm", + NTType: 8, + Index: 18, + NumSymbols: 6, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewLexCharRangeExt(X[2], X[4], true) + }, + }, + ProdTabEntry{ + String: `LexTerm : regDefId << ast.NewLexRegDefId(X[0]) >>`, + Id: "LexTerm", + NTType: 8, + Index: 19, + NumSymbols: 1, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewLexRegDefId(X[0]) + }, + }, + ProdTabEntry{ + String: `LexTerm : Λ<[> Π Λ<]> << ast.NewLexOptPattern(X[1]) >>`, + Id: "LexTerm", + NTType: 8, + Index: 20, + NumSymbols: 3, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewLexOptPattern(X[1]) + }, + }, + ProdTabEntry{ + String: `LexTerm : Λ<{> Π Λ<}> << ast.NewLexRepPattern(X[1]) >>`, + Id: "LexTerm", + NTType: 8, + Index: 21, + NumSymbols: 3, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewLexRepPattern(X[1]) + }, + }, + ProdTabEntry{ + String: `LexTerm : Λ<(> Π Λ<)> << ast.NewLexGroupPattern(X[1]) >>`, + Id: "LexTerm", + NTType: 8, + Index: 22, + NumSymbols: 3, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewLexGroupPattern(X[1]) + }, + }, + ProdTabEntry{ + String: `SyntaxPart : Π Π << ast.NewSyntaxPart(X[0], X[1]) >>`, + Id: "SyntaxPart", + NTType: 3, + Index: 23, + NumSymbols: 2, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewSyntaxPart(X[0], X[1]) + }, + }, + ProdTabEntry{ + String: `SyntaxPart : Π << ast.NewSyntaxPart(nil, X[0]) >>`, + Id: "SyntaxPart", + NTType: 3, + Index: 24, + NumSymbols: 1, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewSyntaxPart(nil, X[0]) + }, + }, + ProdTabEntry{ + String: `FileHeader : g_sdt_lit << ast.NewFileHeader(X[0]) >>`, + Id: "FileHeader", + NTType: 9, + Index: 25, + NumSymbols: 1, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewFileHeader(X[0]) + }, + }, + ProdTabEntry{ + String: `SyntaxProdList : Π << ast.NewSyntaxProdList(X[0]) >>`, + Id: "SyntaxProdList", + NTType: 10, + Index: 26, + NumSymbols: 1, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewSyntaxProdList(X[0]) + }, + }, + ProdTabEntry{ + String: `SyntaxProdList : Π Π << ast.AddSyntaxProds(X[0], X[1]) >>`, + Id: "SyntaxProdList", + NTType: 10, + Index: 27, + NumSymbols: 2, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.AddSyntaxProds(X[0], X[1]) + }, + }, + ProdTabEntry{ + String: `SyntaxProduction : prodId Λ<:> Π Λ<;> << ast.NewSyntaxProd(X[0], X[2]) >>`, + Id: "SyntaxProduction", + NTType: 11, + Index: 28, + NumSymbols: 4, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewSyntaxProd(X[0], X[2]) + }, + }, + ProdTabEntry{ + String: `Alternatives : Π << ast.NewSyntaxAlts(X[0]) >>`, + Id: "Alternatives", + NTType: 12, + Index: 29, + NumSymbols: 1, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewSyntaxAlts(X[0]) + }, + }, + ProdTabEntry{ + String: `Alternatives : Π Λ<|> Π << ast.AddSyntaxAlt(X[0], X[2]) >>`, + Id: "Alternatives", + NTType: 12, + Index: 30, + NumSymbols: 3, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.AddSyntaxAlt(X[0], X[2]) + }, + }, + ProdTabEntry{ + String: `SyntaxBody : Π << ast.NewSyntaxBodyGen(X[0], nil) >>`, + Id: "SyntaxBody", + NTType: 13, + Index: 31, + NumSymbols: 1, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewSyntaxBodyGen(X[0], nil) + }, + }, + ProdTabEntry{ + String: `SyntaxBody : Π g_sdt_lit << ast.NewSyntaxBodyGen(X[0], X[1]) >>`, + Id: "SyntaxBody", + NTType: 13, + Index: 32, + NumSymbols: 2, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewSyntaxBodyGen(X[0], X[1]) + }, + }, + ProdTabEntry{ + String: `SyntaxBody : Π << ast.NewErrorBodyGen(nil, nil) >>`, + Id: "SyntaxBody", + NTType: 13, + Index: 33, + NumSymbols: 1, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewErrorBodyGen(nil, nil) + }, + }, + ProdTabEntry{ + String: `SyntaxBody : Π Π << ast.NewErrorBodyGen(X[1], nil) >>`, + Id: "SyntaxBody", + NTType: 13, + Index: 34, + NumSymbols: 2, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewErrorBodyGen(X[1], nil) + }, + }, + ProdTabEntry{ + String: `SyntaxBody : Π Π g_sdt_lit << ast.NewErrorBodyGen(X[1], X[2]) >>`, + Id: "SyntaxBody", + NTType: 13, + Index: 35, + NumSymbols: 3, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewErrorBodyGen(X[1], X[2]) + }, + }, + ProdTabEntry{ + String: `SyntaxBody : Π g_sdt_lit << ast.NewErrorBodyGen(nil, X[1]) >>`, + Id: "SyntaxBody", + NTType: 13, + Index: 36, + NumSymbols: 2, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewErrorBodyGen(nil, X[1]) + }, + }, + ProdTabEntry{ + String: `SyntaxBody : Π << ast.NewEmptyBodyGen() >>`, + Id: "SyntaxBody", + NTType: 13, + Index: 37, + NumSymbols: 1, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewEmptyBodyGen() + }, + }, + ProdTabEntry{ + String: `Symbols : Π << ast.NewSyntaxSymbols(X[0]) >>`, + Id: "Symbols", + NTType: 14, + Index: 38, + NumSymbols: 1, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewSyntaxSymbols(X[0]) + }, + }, + ProdTabEntry{ + String: `Symbols : Π Π << ast.AddSyntaxSymbol(X[0], X[1]) >>`, + Id: "Symbols", + NTType: 14, + Index: 39, + NumSymbols: 2, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.AddSyntaxSymbol(X[0], X[1]) + }, + }, + ProdTabEntry{ + String: `Symbol : prodId << ast.NewSyntaxProdId(X[0]) >>`, + Id: "Symbol", + NTType: 17, + Index: 40, + NumSymbols: 1, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewSyntaxProdId(X[0]) + }, + }, + ProdTabEntry{ + String: `Symbol : tokId << ast.NewTokId(X[0]) >>`, + Id: "Symbol", + NTType: 17, + Index: 41, + NumSymbols: 1, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewTokId(X[0]) + }, + }, + ProdTabEntry{ + String: `Symbol : string_lit << ast.NewStringLit(X[0]) >>`, + Id: "Symbol", + NTType: 17, + Index: 42, + NumSymbols: 1, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewStringLit(X[0]) + }, + }, + ProdTabEntry{ + String: `ErrorSymbol : Λ << >>`, + Id: "ErrorSymbol", + NTType: 15, + Index: 43, + NumSymbols: 1, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return X[0], nil + }, + }, + ProdTabEntry{ + String: `ErrorSymbol : Λ<λ> << >>`, + Id: "ErrorSymbol", + NTType: 15, + Index: 44, + NumSymbols: 1, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return X[0], nil + }, + }, + ProdTabEntry{ + String: `EpsilonSymbol : Λ << >>`, + Id: "EpsilonSymbol", + NTType: 16, + Index: 45, + NumSymbols: 1, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return X[0], nil + }, + }, + ProdTabEntry{ + String: `EpsilonSymbol : Λ<ε> << >>`, + Id: "EpsilonSymbol", + NTType: 16, + Index: 46, + NumSymbols: 1, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return X[0], nil + }, + }, +} diff --git a/internal/frontend/reparsed/internal/token/next/token.go b/internal/frontend/reparsed/internal/token/next/token.go new file mode 100644 index 00000000..041efd2c --- /dev/null +++ b/internal/frontend/reparsed/internal/token/next/token.go @@ -0,0 +1,118 @@ +// Code generated by gocc; DO NOT EDIT. + +package token + +import ( + "fmt" +) + +type Token struct { + Type + Lit []byte + Pos + ForeingAstNode interface{} + ForeingAstError error +} + +type Type int + +const ( + INVALID Type = iota + EOF +) + +type Pos struct { + Offset int + Line int + Column int +} + +func (p Pos) String() string { + return fmt.Sprintf("Pos(offset=%d, line=%d, column=%d)", p.Offset, p.Line, p.Column) +} + +type TokenMap struct { + typeMap []string + idMap map[string]Type +} + +func (m TokenMap) Id(tok Type) string { + if int(tok) < len(m.typeMap) { + return m.typeMap[tok] + } + return "unknown" +} + +func (m TokenMap) Type(tok string) Type { + if typ, exist := m.idMap[tok]; exist { + return typ + } + return INVALID +} + +func (m TokenMap) TokenString(tok *Token) string { + //TODO: refactor to print pos & token string properly + return fmt.Sprintf("%s(%d,%s)", m.Id(tok.Type), tok.Type, tok.Lit) +} + +func (m TokenMap) StringType(typ Type) string { + return fmt.Sprintf("%s(%d)", m.Id(typ), typ) +} + +var TokMap = TokenMap{ + typeMap: []string{ + "INVALID", + "Ω", + "tokId", + "Λ<:>", + "Λ<;>", + "regDefId", + "ignoredTokId", + "Λ<|>", + "Λ<.>", + "char_lit", + "Λ<->", + "Λ<~>", + "Λ<(>", + "Λ<)>", + "Λ<[>", + "Λ<]>", + "Λ<{>", + "Λ<}>", + "g_sdt_lit", + "prodId", + "string_lit", + "Λ", + "Λ<λ>", + "Λ", + "Λ<ε>", + }, + + idMap: map[string]Type{ + "INVALID": 0, + "Ω": 1, + "tokId": 2, + "Λ<:>": 3, + "Λ<;>": 4, + "regDefId": 5, + "ignoredTokId": 6, + "Λ<|>": 7, + "Λ<.>": 8, + "char_lit": 9, + "Λ<->": 10, + "Λ<~>": 11, + "Λ<(>": 12, + "Λ<)>": 13, + "Λ<[>": 14, + "Λ<]>": 15, + "Λ<{>": 16, + "Λ<}>": 17, + "g_sdt_lit": 18, + "prodId": 19, + "string_lit": 20, + "Λ": 21, + "Λ<λ>": 22, + "Λ": 23, + "Λ<ε>": 24, + }, +} diff --git a/internal/frontend/reparsed/reparsed.go b/internal/frontend/reparsed/reparsed.go index 778fd1e1..5ba25d24 100644 --- a/internal/frontend/reparsed/reparsed.go +++ b/internal/frontend/reparsed/reparsed.go @@ -6,9 +6,9 @@ import ( "io" "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/internal/io/stream" - "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/internal/lexer" - "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/internal/parser" - "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/internal/token" + lexer "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/internal/lexer/next" + parser "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/internal/parser/next" + token "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/internal/token/next" ) type Token = token.Token From f65f13822a5b48321319f41dbc330edce4879091 Mon Sep 17 00:00:00 2001 From: Massimiliano Calandrelli Date: Tue, 8 Oct 2019 12:10:04 +0200 Subject: [PATCH 12/33] ... --- .../io/stream/internal/stream_impl.go | 2 +- .../reparsed/internal/lexer/next/lexer.go | 90 +++++++++++-------- .../reparsed/internal/token/next/token.go | 17 +++- internal/frontend/reparsed/main/next/main.go | 40 +++++++++ internal/frontend/reparsed/next/reparsed.go | 51 +++++++++++ internal/io/gen/golang/gen.go | 2 +- spec/test.bnf | 14 ++- 7 files changed, 173 insertions(+), 43 deletions(-) create mode 100644 internal/frontend/reparsed/main/next/main.go create mode 100644 internal/frontend/reparsed/next/reparsed.go diff --git a/internal/frontend/reparsed/internal/io/stream/internal/stream_impl.go b/internal/frontend/reparsed/internal/io/stream/internal/stream_impl.go index c5af4395..f09eeac3 100644 --- a/internal/frontend/reparsed/internal/io/stream/internal/stream_impl.go +++ b/internal/frontend/reparsed/internal/io/stream/internal/stream_impl.go @@ -97,7 +97,7 @@ func (s impl_WindowReader) bufferBytes(pos int) []byte { } func (s impl_WindowReader) bufferByteRange(pos int, length int) []byte { - p := s.bufferIndex(pos) + p := s.bufferOffset(pos) return s.bufferBytes(pos)[p : p+length] } diff --git a/internal/frontend/reparsed/internal/lexer/next/lexer.go b/internal/frontend/reparsed/internal/lexer/next/lexer.go index 5a4a93b5..0ac30ac0 100644 --- a/internal/frontend/reparsed/internal/lexer/next/lexer.go +++ b/internal/frontend/reparsed/internal/lexer/next/lexer.go @@ -3,6 +3,7 @@ package lexer import ( + "bytes" "io" "os" @@ -17,19 +18,24 @@ const ( ) type Position struct { - pos int - line int - column int + token.Pos + StreamPosition int64 +} + +type lexerStream interface { + io.RuneReader + io.Seeker } type Lexer struct { Position - stream stream.WindowReader + stream lexerStream eof bool } func NewLexer(src []byte) *Lexer { - lexer := &Lexer{stream: stream.NewWindowReaderFromBytes(src)} + lexer := &Lexer{stream: bytes.NewReader(src)} + lexer.Position.Reset() return lexer } @@ -38,17 +44,31 @@ func NewLexerFile(fpath string) (*Lexer, error) { if err != nil { return nil, err } - return &Lexer{stream: stream.NewWindowReader(s)}, nil + lexer := &Lexer{stream: stream.NewWindowReader(s)} + lexer.Position.Reset() + return lexer, nil +} + +func NewLexerStream(reader io.Reader) (*Lexer, error) { + lexer := &Lexer{} + lexer.Position.Reset() + if lexer.stream, _ = reader.(lexerStream); lexer.stream == nil { + lexer.stream = stream.NewWindowReader(reader) + } else { + lexer.Position.StreamPosition, _ = lexer.stream.Seek(0, io.SeekCurrent) + } + return lexer, nil } func (l *Lexer) Scan() (tok *token.Token) { tok = new(token.Token) if l.eof { tok.Type = token.EOF - tok.Pos.Offset, tok.Pos.Line, tok.Pos.Column = l.pos, l.line, l.column + tok.Pos = l.Position.Pos return } - start, startLine, startColumn, end := l.pos, l.line, l.column, 0 + l.Position.StreamPosition, _ = l.stream.Seek(0, io.SeekCurrent) + start, end := l.Position, Position{} tok.Type = token.INVALID tok.Lit = []byte{} state, rune1 := 0, rune(-1) @@ -63,8 +83,8 @@ func (l *Lexer) Scan() (tok *token.Token) { } if err == nil && size > 0 { rune1 = rune2 - l.pos += size - tok.Lit = append(tok.Lit, string(rune1)...) + l.Position.StreamPosition += int64(size) + l.Position.Pos.Offset += size } } @@ -75,26 +95,28 @@ func (l *Lexer) Scan() (tok *token.Token) { state = nextState if state != -1 { - switch rune1 { case '\n': - l.line++ - l.column = 1 + l.Position.Pos.Line++ + l.Position.Pos.Column = 1 case '\r': - l.column = 1 + l.Position.Pos.Column = 1 case '\t': - l.column += 4 + l.Position.Pos.Column += 4 default: - l.column++ + l.Position.Pos.Column++ } switch { case ActTab[state].Accept != -1: tok.Type = ActTab[state].Accept - end = l.pos + l.Position.StreamPosition, _ = l.stream.Seek(0, io.SeekCurrent) + end = l.Position + tok.Lit = append(tok.Lit, string(rune1)...) case ActTab[state].Ignore != "": - start, startLine, startColumn = l.pos, l.line, l.column + start = l.Position state = 0 + tok.Lit = []byte{} if l.eof { tok.Type = token.EOF } @@ -102,15 +124,14 @@ func (l *Lexer) Scan() (tok *token.Token) { } } else { if tok.Type == token.INVALID { - end = l.pos + end = l.Position } } } - if end > start { - l.pos = end + if end.Pos.Offset > start.Pos.Offset { + l.Reposition(end) } - tok.Pos.Offset, tok.Pos.Line, tok.Pos.Column = start, startLine, startColumn - + tok.Pos = start.Pos return } @@ -120,26 +141,21 @@ func (l *Lexer) Reset() { func (l *Lexer) Reposition(p Position) { l.Position = p + l.stream.Seek(l.Position.StreamPosition, io.SeekStart) } func (l Lexer) CurrentPosition() Position { return l.Position } -func (p Position) Offset() int { - return p.pos -} - -func (p Position) Line() int { - return p.line -} - -func (p Position) Column() int { - return p.column +func (p *Position) Reset() { + p.Offset = 0 + p.Line = 1 + p.Column = 1 } -func (p *Position) Reset() { - p.pos = 0 - p.line = 1 - p.column = 1 +func (p Position) StartingFrom(base Position) Position { + r := p + r.Pos = p.Pos.StartingFrom(base.Pos) + return r } diff --git a/internal/frontend/reparsed/internal/token/next/token.go b/internal/frontend/reparsed/internal/token/next/token.go index 041efd2c..f4cd2cba 100644 --- a/internal/frontend/reparsed/internal/token/next/token.go +++ b/internal/frontend/reparsed/internal/token/next/token.go @@ -31,6 +31,20 @@ func (p Pos) String() string { return fmt.Sprintf("Pos(offset=%d, line=%d, column=%d)", p.Offset, p.Line, p.Column) } +func (p Pos) StartingFrom(base Pos) Pos { + r := base + r.Offset += p.Offset + r.Line += p.Line + r.Column = p.Column + if p.Line > 0 && base.Line > 0 { + r.Line-- + } + if r.Column < 1 { + r.Column = 1 + } + return r +} + type TokenMap struct { typeMap []string idMap map[string]Type @@ -51,8 +65,7 @@ func (m TokenMap) Type(tok string) Type { } func (m TokenMap) TokenString(tok *Token) string { - //TODO: refactor to print pos & token string properly - return fmt.Sprintf("%s(%d,%s)", m.Id(tok.Type), tok.Type, tok.Lit) + return fmt.Sprintf("%s(%d,<%s>)", m.Id(tok.Type), tok.Type, tok.Lit) } func (m TokenMap) StringType(typ Type) string { diff --git a/internal/frontend/reparsed/main/next/main.go b/internal/frontend/reparsed/main/next/main.go new file mode 100644 index 00000000..ee2139ff --- /dev/null +++ b/internal/frontend/reparsed/main/next/main.go @@ -0,0 +1,40 @@ +package main + +import ( + "flag" + "fmt" + "os" + "strings" + + reparsed "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/next" +) + +func showResult(r interface{}, e error) { + if e != nil { + fmt.Fprintf(os.Stderr, "parsing returned the following error: %s\n", e.Error()) + } else { + fmt.Printf("%#v\n", r) + } +} + +var ( + File string + Text string + Longest bool +) + +func main() { + flag.StringVar(&File, "file", "", "parse also text in file") + flag.StringVar(&Text, "text", "", "parse also text given with flag") + flag.BoolVar(&Longest, "longest", false, "parse longest possible part") + flag.Parse() + if Text > "" { + showResult(reparsed.ParseText(Text)) + } + if File > "" { + showResult(reparsed.ParseFile(File)) + } + if str := strings.Join(os.Args[1:], " "); str > "" { + showResult(reparsed.ParseText(str)) + } +} diff --git a/internal/frontend/reparsed/next/reparsed.go b/internal/frontend/reparsed/next/reparsed.go new file mode 100644 index 00000000..5ba25d24 --- /dev/null +++ b/internal/frontend/reparsed/next/reparsed.go @@ -0,0 +1,51 @@ +// Code generated by gocc; DO NOT EDIT. + +package reparsed + +import ( + "io" + + "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/internal/io/stream" + lexer "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/internal/lexer/next" + parser "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/internal/parser/next" + token "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/internal/token/next" +) + +type Token = token.Token +type WindowReader = stream.WindowReader + +func ParseFile(fpath string) (interface{}, error) { + if lexer, err := NewLexerFile(fpath); err == nil { + return NewParser().Parse(lexer) + } else { + return nil, err + } +} + +func ParseText(text string) (interface{}, error) { + return NewParser().Parse(NewLexer([]byte(text))) +} + +func NewLexer(src []byte) *lexer.Lexer { + return lexer.NewLexer(src) +} + +func NewLexerFile(fpath string) (*lexer.Lexer, error) { + return lexer.NewLexerFile(fpath) +} + +func NewParser() *parser.Parser { + return parser.NewParser() +} + +func NewWindowReaderFromBytes(src []byte) WindowReader { + return stream.NewWindowReaderFromBytes(src) +} + +func NewWindowReader(rdr io.Reader) WindowReader { + return stream.NewWindowReader(rdr) +} + +func NewLimitedWindowReader(rdr io.Reader, sizeMin, sizeMax int) WindowReader { + return stream.NewLimitedWindowReader(rdr, sizeMin, sizeMax) +} diff --git a/internal/io/gen/golang/gen.go b/internal/io/gen/golang/gen.go index b076d404..fa1f4ca9 100644 --- a/internal/io/gen/golang/gen.go +++ b/internal/io/gen/golang/gen.go @@ -208,7 +208,7 @@ func (s impl_WindowReader) bufferBytes(pos int) []byte { } func (s impl_WindowReader) bufferByteRange(pos int, length int) []byte { - p := s.bufferIndex(pos) + p := s.bufferOffset(pos) return s.bufferBytes(pos)[p : p+length] } diff --git a/spec/test.bnf b/spec/test.bnf index d1e2914f..7e69d831 100644 --- a/spec/test.bnf +++ b/spec/test.bnf @@ -1,6 +1,16 @@ - +!comment : _lineComment | _blockComment ; +!whitespace : ' ' | '\t' | '\n' | '\r' ; + +_lineComment : '/' '/' {.} '\n' ; +_blockComment : '/' '*' {. | '*'} '*' '/' ; +_tokId : _lowcase {_id_char} ; +_lowcase : 'a'-'z' ; +_id_char : _upcase | _lowcase | '_' | _digit ; +_upcase : 'A'-'Z' ; +_digit : '0'-'9' ; + +// !space : ' ' | '\t' ; - hexdigit : '0'-'F' | ~(':'-'@') ; Test : From 4e7bbe3ce50b21b133dfb60b3048792558391927 Mon Sep 17 00:00:00 2001 From: Massimiliano Calandrelli Date: Tue, 8 Oct 2019 17:28:32 +0200 Subject: [PATCH 13/33] ... --- internal/ast/grammar.go | 8 +- internal/ast/syntaxcontextdependenttokenid.go | 50 + internal/ast/syntaxsymbol.go | 15 +- internal/base/gen/golang/base.go | 2 + internal/config/config.go | 2 + .../reparsed/internal/lexer/acttab.go | 122 +-- .../frontend/reparsed/internal/lexer/lexer.go | 150 +-- .../internal/lexer/transitiontable.go | 708 ++++++------- .../reparsed/internal/parser/actiontable.go | 955 +++++++++++------- .../reparsed/internal/parser/gototable.go | 342 ++++--- .../internal/parser/next/actiontable.go | 5 +- .../reparsed/internal/parser/next/parser.go | 20 +- .../reparsed/internal/parser/parser.go | 48 +- .../internal/parser/productionstable.go | 114 ++- .../frontend/reparsed/internal/token/token.go | 37 +- internal/frontend/reparsed/log/LR1_sets.txt | 871 +++++++++------- internal/frontend/reparsed/log/first.txt | 4 + internal/frontend/reparsed/log/lexer_sets.txt | 817 +++++++-------- internal/frontend/reparsed/log/terminals.txt | 1 + internal/frontend/reparsed/main/main.go | 6 +- internal/frontend/reparsed/reparsed.go | 6 +- internal/lexer/gen/golang/lexer.go | 190 ++-- internal/parser/gen/golang/parser.go | 42 +- .../parser/gen/golang/productionstable.go | 4 +- internal/parser/symbols/symbols.go | 7 + internal/token/gen/golang/token.go | 30 +- spec/gocc2.ebnf | 9 +- spec/test.bnf | 9 +- 28 files changed, 2571 insertions(+), 2003 deletions(-) create mode 100644 internal/ast/syntaxcontextdependenttokenid.go diff --git a/internal/ast/grammar.go b/internal/ast/grammar.go index b349468f..4ecec95f 100644 --- a/internal/ast/grammar.go +++ b/internal/ast/grammar.go @@ -77,15 +77,15 @@ func consistent(g *Grammar) (err error) { } for s, in := range used { if _, ok := defs[s]; !ok { - switch s { - case EmptySymbol, ErrorSymbol: + switch s.(type) { + case SyntaxEmpty, SyntaxError, SyntaxContextDependentTokId: continue } if !s.IsTerminal() { - fmt.Fprintf(os.Stderr, "error: undefined symbol %q used in productions %q\n", s, in) + fmt.Fprintf(os.Stderr, "error: undefined symbol %T{%q} used in productions %q\n", s, s, in) err = errUndefined } else { - fmt.Fprintf(os.Stderr, "warning: undefined symbol %q used in productions %q\n", s, in) + fmt.Fprintf(os.Stderr, "warning: undefined symbol %T{%q} used in productions %q\n", s, s, in) } } } diff --git a/internal/ast/syntaxcontextdependenttokenid.go b/internal/ast/syntaxcontextdependenttokenid.go new file mode 100644 index 00000000..838a9e51 --- /dev/null +++ b/internal/ast/syntaxcontextdependenttokenid.go @@ -0,0 +1,50 @@ +//Copyright 2013 Vastech SA (PTY) LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package ast + +import ( + "fmt" + + "github.com/maxcalandrelli/gocc/internal/config" +) + +type SyntaxContextDependentTokId struct { + string + StdSyntaxSymbol +} + +func NewContextDependentTokId(tokId interface{}) (SyntaxContextDependentTokId, error) { + return SyntaxContextDependentTokId{getString(tokId), StdSyntaxSymbol{}}, nil +} + +func NewNewContextDependentTokIdFromString(str string) SyntaxContextDependentTokId { + return SyntaxContextDependentTokId{str, StdSyntaxSymbol{}} +} + +func (this SyntaxContextDependentTokId) SymbolString() string { + return this.string +} + +func (this SyntaxContextDependentTokId) String() string { + return fmt.Sprintf("%s<%s>", config.INTERNAL_SYMBOL_CDTOK, this.string) +} + +func (this SyntaxContextDependentTokId) SymbolName() string { + return fmt.Sprintf("%s<%s>", config.INTERNAL_SYMBOL_CDTOK, this.string) +} + +func (this SyntaxContextDependentTokId) IsTerminal() bool { + return true +} diff --git a/internal/ast/syntaxsymbol.go b/internal/ast/syntaxsymbol.go index 70c6e635..9aa00e63 100644 --- a/internal/ast/syntaxsymbol.go +++ b/internal/ast/syntaxsymbol.go @@ -40,13 +40,14 @@ func (StdSyntaxSymbol) IsEpsilon() bool { return false } func (StdSyntaxSymbol) IsTerminal() bool { return false } func (StdSyntaxSymbol) IsNonTerminal() bool { return false } -func (SyntaxEmpty) gSymbol() {} -func (SyntaxEof) gSymbol() {} -func (SyntaxError) gSymbol() {} -func (SyntaxProdId) gSymbol() {} -func (SyntaxTokId) gSymbol() {} -func (SyntaxStringLit) gSymbol() {} -func (InvalidSyntaxSymbol) gSymbol() {} +func (SyntaxEmpty) gSymbol() {} +func (SyntaxEof) gSymbol() {} +func (SyntaxError) gSymbol() {} +func (SyntaxProdId) gSymbol() {} +func (SyntaxTokId) gSymbol() {} +func (SyntaxStringLit) gSymbol() {} +func (InvalidSyntaxSymbol) gSymbol() {} +func (SyntaxContextDependentTokId) gSymbol() {} func (InvalidSyntaxSymbol) SymbolName() string { return config.INTERNAL_SYMBOL_INVALID diff --git a/internal/base/gen/golang/base.go b/internal/base/gen/golang/base.go index d331d9e0..8377a3ef 100644 --- a/internal/base/gen/golang/base.go +++ b/internal/base/gen/golang/base.go @@ -154,11 +154,13 @@ func showResult (r interface{}, e error) { var ( File string Text string + Longest bool ) func main () { flag.StringVar(&File, "file", "", "parse also text in file") flag.StringVar(&Text, "text", "", "parse also text given with flag") + flag.BoolVar(&Longest, "longest", false, "parse longest possible part") flag.Parse() if Text > "" { showResult({{.MyName}}.ParseText(Text)) diff --git a/internal/config/config.go b/internal/config/config.go index 94e81d0f..53032af9 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -32,10 +32,12 @@ const ( INTERNAL_SYMBOL_EOF = "Ω" INTERNAL_SYMBOL_PROD = "Π" INTERNAL_SYMBOL_LIT = "Λ" + INTERNAL_SYMBOL_CDTOK = "μ" SYMBOL_EMPTY = "empty" SYMBOL_ERROR = "error" SYMBOL_INVALID = "ά" SYMBOL_EOF = "Ω" + SYMBOL_CDTOK = "μ" ) type ( diff --git a/internal/frontend/reparsed/internal/lexer/acttab.go b/internal/frontend/reparsed/internal/lexer/acttab.go index 54ce0506..e77059c6 100644 --- a/internal/frontend/reparsed/internal/lexer/acttab.go +++ b/internal/frontend/reparsed/internal/lexer/acttab.go @@ -72,70 +72,70 @@ var ActTab = ActionTable{ Accept: 0, Ignore: "", }, - ActionRow{ // S13, Accept("prodId") + ActionRow{ // S13, Accept("Λ<@>") + Accept: 21, + Ignore: "", + }, + ActionRow{ // S14, Accept("prodId") Accept: 19, Ignore: "", }, - ActionRow{ // S14, Accept("Λ<[>") + ActionRow{ // S15, Accept("Λ<[>") Accept: 14, Ignore: "", }, - ActionRow{ // S15, Accept("Λ<]>") + ActionRow{ // S16, Accept("Λ<]>") Accept: 15, Ignore: "", }, - ActionRow{ // S16, Accept("regDefId") + ActionRow{ // S17, Accept("regDefId") Accept: 5, Ignore: "", }, - ActionRow{ // S17, + ActionRow{ // S18, Accept: 0, Ignore: "", }, - ActionRow{ // S18, Accept("tokId") + ActionRow{ // S19, Accept("tokId") Accept: 2, Ignore: "", }, - ActionRow{ // S19, Accept("tokId") + ActionRow{ // S20, Accept("tokId") Accept: 2, Ignore: "", }, - ActionRow{ // S20, Accept("Λ<{>") + ActionRow{ // S21, Accept("Λ<{>") Accept: 16, Ignore: "", }, - ActionRow{ // S21, Accept("Λ<|>") + ActionRow{ // S22, Accept("Λ<|>") Accept: 7, Ignore: "", }, - ActionRow{ // S22, Accept("Λ<}>") + ActionRow{ // S23, Accept("Λ<}>") Accept: 17, Ignore: "", }, - ActionRow{ // S23, Accept("Λ<~>") + ActionRow{ // S24, Accept("Λ<~>") Accept: 11, Ignore: "", }, - ActionRow{ // S24, Accept("Λ<ε>") - Accept: 24, + ActionRow{ // S25, Accept("Λ<ε>") + Accept: 25, Ignore: "", }, - ActionRow{ // S25, Accept("Λ<λ>") - Accept: 22, + ActionRow{ // S26, Accept("Λ<λ>") + Accept: 23, Ignore: "", }, - ActionRow{ // S26, Accept("ignoredTokId") + ActionRow{ // S27, Accept("ignoredTokId") Accept: 6, Ignore: "", }, - ActionRow{ // S27, Accept("string_lit") + ActionRow{ // S28, Accept("string_lit") Accept: 20, Ignore: "", }, - ActionRow{ // S28, - Accept: 0, - Ignore: "", - }, ActionRow{ // S29, Accept: 0, Ignore: "", @@ -160,8 +160,8 @@ var ActTab = ActionTable{ Accept: 0, Ignore: "", }, - ActionRow{ // S35, Accept("prodId") - Accept: 19, + ActionRow{ // S35, + Accept: 0, Ignore: "", }, ActionRow{ // S36, Accept("prodId") @@ -176,8 +176,8 @@ var ActTab = ActionTable{ Accept: 19, Ignore: "", }, - ActionRow{ // S39, Accept("regDefId") - Accept: 5, + ActionRow{ // S39, Accept("prodId") + Accept: 19, Ignore: "", }, ActionRow{ // S40, Accept("regDefId") @@ -192,12 +192,12 @@ var ActTab = ActionTable{ Accept: 5, Ignore: "", }, - ActionRow{ // S43, Accept("string_lit") - Accept: 20, + ActionRow{ // S43, Accept("regDefId") + Accept: 5, Ignore: "", }, - ActionRow{ // S44, Accept("tokId") - Accept: 2, + ActionRow{ // S44, Accept("string_lit") + Accept: 20, Ignore: "", }, ActionRow{ // S45, Accept("tokId") @@ -220,8 +220,8 @@ var ActTab = ActionTable{ Accept: 2, Ignore: "", }, - ActionRow{ // S50, Accept("ignoredTokId") - Accept: 6, + ActionRow{ // S50, Accept("tokId") + Accept: 2, Ignore: "", }, ActionRow{ // S51, Accept("ignoredTokId") @@ -236,8 +236,8 @@ var ActTab = ActionTable{ Accept: 6, Ignore: "", }, - ActionRow{ // S54, - Accept: 0, + ActionRow{ // S54, Accept("ignoredTokId") + Accept: 6, Ignore: "", }, ActionRow{ // S55, @@ -276,32 +276,32 @@ var ActTab = ActionTable{ Accept: 0, Ignore: "", }, - ActionRow{ // S64, Accept("char_lit") + ActionRow{ // S64, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S65, Accept("char_lit") Accept: 9, Ignore: "", }, - ActionRow{ // S65, + ActionRow{ // S66, Accept: 0, Ignore: "", }, - ActionRow{ // S66, Ignore("!comment") + ActionRow{ // S67, Ignore("!comment") Accept: -1, Ignore: "!comment", }, - ActionRow{ // S67, + ActionRow{ // S68, Accept: 0, Ignore: "", }, - ActionRow{ // S68, Accept("tokId") - Accept: 2, - Ignore: "", - }, ActionRow{ // S69, Accept("tokId") Accept: 2, Ignore: "", }, - ActionRow{ // S70, - Accept: 0, + ActionRow{ // S70, Accept("tokId") + Accept: 2, Ignore: "", }, ActionRow{ // S71, @@ -332,24 +332,24 @@ var ActTab = ActionTable{ Accept: 0, Ignore: "", }, - ActionRow{ // S78, Ignore("!comment") + ActionRow{ // S78, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S79, Ignore("!comment") Accept: -1, Ignore: "!comment", }, - ActionRow{ // S79, + ActionRow{ // S80, Accept: 0, Ignore: "", }, - ActionRow{ // S80, Accept("tokId") - Accept: 2, - Ignore: "", - }, ActionRow{ // S81, Accept("tokId") Accept: 2, Ignore: "", }, - ActionRow{ // S82, - Accept: 0, + ActionRow{ // S82, Accept("tokId") + Accept: 2, Ignore: "", }, ActionRow{ // S83, @@ -380,20 +380,20 @@ var ActTab = ActionTable{ Accept: 0, Ignore: "", }, - ActionRow{ // S90, Accept("g_sdt_lit") - Accept: 18, + ActionRow{ // S90, + Accept: 0, Ignore: "", }, - ActionRow{ // S91, Accept("Λ") - Accept: 23, + ActionRow{ // S91, Accept("g_sdt_lit") + Accept: 18, Ignore: "", }, - ActionRow{ // S92, Accept("Λ") - Accept: 21, + ActionRow{ // S92, Accept("Λ") + Accept: 24, Ignore: "", }, - ActionRow{ // S93, - Accept: 0, + ActionRow{ // S93, Accept("Λ") + Accept: 22, Ignore: "", }, ActionRow{ // S94, @@ -456,4 +456,8 @@ var ActTab = ActionTable{ Accept: 0, Ignore: "", }, + ActionRow{ // S109, + Accept: 0, + Ignore: "", + }, } diff --git a/internal/frontend/reparsed/internal/lexer/lexer.go b/internal/frontend/reparsed/internal/lexer/lexer.go index cb532e91..49526d5f 100644 --- a/internal/frontend/reparsed/internal/lexer/lexer.go +++ b/internal/frontend/reparsed/internal/lexer/lexer.go @@ -3,59 +3,91 @@ package lexer import ( - "io/ioutil" - "unicode/utf8" - "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/internal/token" + "io" + "bytes" + "os" + + +"github.com/maxcalandrelli/gocc/internal/frontend/reparsed/internal/token" +"github.com/maxcalandrelli/gocc/internal/frontend/reparsed/internal/io/stream" ) const ( NoState = -1 - NumStates = 109 - NumSymbols = 75 + NumStates = 110 + NumSymbols = 76 ) -type Position struct { - pos int - line int - column int +type position struct { + token.Pos + StreamPosition int64 +} + +type lexerStream interface { + io.RuneReader + io.Seeker } type Lexer struct { - Position - src []byte + position + stream lexerStream + eof bool } func NewLexer(src []byte) *Lexer { - lexer := &Lexer{ src: src } - lexer.Position.Reset() + lexer := &Lexer{stream: bytes.NewReader(src)} + lexer.position.Reset() return lexer } func NewLexerFile(fpath string) (*Lexer, error) { - src, err := ioutil.ReadFile(fpath) + s, err := os.Open(fpath) if err != nil { return nil, err } - return NewLexer(src), nil + lexer := &Lexer{stream: stream.NewWindowReader(s)} + lexer.position.Reset() + return lexer, nil +} + +func NewLexerStream(reader io.Reader) (*Lexer, error) { + lexer := &Lexer{} + lexer.position.Reset() + if lexer.stream, _ = reader.(lexerStream); lexer.stream == nil { + lexer.stream = stream.NewWindowReader(reader) + } else { + lexer.position.StreamPosition, _ = lexer.stream.Seek(0, io.SeekCurrent) + } + return lexer, nil } func (l *Lexer) Scan() (tok *token.Token) { tok = new(token.Token) - if l.pos >= len(l.src) { + if l.eof { tok.Type = token.EOF - tok.Pos.Offset, tok.Pos.Line, tok.Pos.Column = l.pos, l.line, l.column + tok.Pos = l.position.Pos return } - start, startLine, startColumn, end := l.pos, l.line, l.column, 0 + l.position.StreamPosition, _ = l.stream.Seek(0, io.SeekCurrent) + start, end := l.position, position{} tok.Type = token.INVALID - state, rune1, size := 0, rune(-1), 0 + tok.Lit = []byte{} + state, rune1 := 0, rune(-1) for state != -1 { - if l.pos >= len(l.src) { + if l.eof { rune1 = -1 } else { - rune1, size = utf8.DecodeRune(l.src[l.pos:]) - l.pos += size + rune2, size, err := l.stream.ReadRune() + if err == io.EOF { + l.eof = true + err = nil + } + if err == nil && size > 0 { + rune1 = rune2 + l.position.StreamPosition += int64(size) + l.position.Pos.Offset += size + } } nextState := -1 @@ -65,83 +97,67 @@ func (l *Lexer) Scan() (tok *token.Token) { state = nextState if state != -1 { - switch rune1 { case '\n': - l.line++ - l.column = 1 + l.position.Pos.Line++ + l.position.Pos.Column = 1 case '\r': - l.column = 1 + l.position.Pos.Column = 1 case '\t': - l.column += 4 + l.position.Pos.Column += 4 default: - l.column++ + l.position.Pos.Column++ } switch { case ActTab[state].Accept != -1: tok.Type = ActTab[state].Accept - end = l.pos + l.position.StreamPosition, _ = l.stream.Seek(0, io.SeekCurrent) + end = l.position + tok.Lit = append(tok.Lit, string(rune1)...) case ActTab[state].Ignore != "": - start, startLine, startColumn = l.pos, l.line, l.column + start = l.position state = 0 - if start >= len(l.src) { + tok.Lit = []byte{} + if l.eof { tok.Type = token.EOF } } } else { if tok.Type == token.INVALID { - end = l.pos + end = l.position } } } - if end > start { - l.pos = end - tok.Lit = l.src[start:end] - } else { - tok.Lit = []byte{} + if end.Pos.Offset > start.Pos.Offset { + l.Reposition(end) } - tok.Pos.Offset, tok.Pos.Line, tok.Pos.Column = start, startLine, startColumn - + tok.Pos = start.Pos return } func (l *Lexer) Reset() { - l.Position.Reset() -} - -func (l *Lexer) Reposition(p Position) { - l.Position = p -} - -func (l Lexer) CurrentPosition() Position { - return l.Position + l.position.Reset() } -func (l Lexer) Source() []byte { - return l.src -} - -func (l Lexer) Remaining() []byte { - return l.src[l.pos:] -} - - -func (p Position) Offset() int { - return p.pos +func (l *Lexer) Reposition(p position) { + l.position = p + l.stream.Seek(l.position.StreamPosition, io.SeekStart) } -func (p Position) Line() int { - return p.line +func (l Lexer) CurrentPosition() position { + return l.position } -func (p Position) Column() int { - return p.column +func (p *position) Reset() { + p.Offset = 0 + p.Line = 1 + p.Column = 1 } -func (p *Position) Reset() { - p.pos = 0 - p.line = 1 - p.column = 1 +func (p position) StartingFrom(base position) position { + r := p + r.Pos = p.Pos.StartingFrom(base.Pos) + return r } diff --git a/internal/frontend/reparsed/internal/lexer/transitiontable.go b/internal/frontend/reparsed/internal/lexer/transitiontable.go index 9cf91598..d6266ccc 100644 --- a/internal/frontend/reparsed/internal/lexer/transitiontable.go +++ b/internal/frontend/reparsed/internal/lexer/transitiontable.go @@ -43,34 +43,36 @@ var TransTab = TransitionTable{ return 11 case r == 60: // ['<','<'] return 12 - case 65 <= r && r <= 90: // ['A','Z'] + case r == 64: // ['@','@'] return 13 - case r == 91: // ['[','['] + case 65 <= r && r <= 90: // ['A','Z'] return 14 - case r == 93: // [']',']'] + case r == 91: // ['[','['] return 15 - case r == 95: // ['_','_'] + case r == 93: // [']',']'] return 16 - case r == 96: // ['`','`'] + case r == 95: // ['_','_'] return 17 - case 97 <= r && r <= 100: // ['a','d'] + case r == 96: // ['`','`'] return 18 - case r == 101: // ['e','e'] + case 97 <= r && r <= 100: // ['a','d'] return 19 + case r == 101: // ['e','e'] + return 20 case 102 <= r && r <= 122: // ['f','z'] - return 18 + return 19 case r == 123: // ['{','{'] - return 20 - case r == 124: // ['|','|'] return 21 - case r == 125: // ['}','}'] + case r == 124: // ['|','|'] return 22 - case r == 126: // ['~','~'] + case r == 125: // ['}','}'] return 23 - case r == 949: // [\u03b5,\u03b5] + case r == 126: // ['~','~'] return 24 - case r == 955: // [\u03bb,\u03bb] + case r == 949: // [\u03b5,\u03b5] return 25 + case r == 955: // [\u03bb,\u03bb] + return 26 } return NoState }, @@ -84,7 +86,7 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 97 <= r && r <= 122: // ['a','z'] - return 26 + return 27 } return NoState }, @@ -92,20 +94,20 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case r == 34: // ['"','"'] - return 27 - case r == 92: // ['\','\'] return 28 - default: + case r == 92: // ['\','\'] return 29 + default: + return 30 } }, // S4 func(r rune) int { switch { case r == 92: // ['\','\'] - return 30 - default: return 31 + default: + return 32 } }, // S5 @@ -136,9 +138,9 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case r == 42: // ['*','*'] - return 32 - case r == 47: // ['/','/'] return 33 + case r == 47: // ['/','/'] + return 34 } return NoState }, @@ -158,98 +160,98 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case r == 60: // ['<','<'] - return 34 + return 35 } return NoState }, // S13 + func(r rune) int { + switch { + } + return NoState + }, + // S14 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 35 - case 65 <= r && r <= 90: // ['A','Z'] return 36 - case r == 95: // ['_','_'] + case 65 <= r && r <= 90: // ['A','Z'] return 37 - case 97 <= r && r <= 122: // ['a','z'] + case r == 95: // ['_','_'] return 38 + case 97 <= r && r <= 122: // ['a','z'] + return 39 } return NoState }, - // S14 + // S15 func(r rune) int { switch { } return NoState }, - // S15 + // S16 func(r rune) int { switch { } return NoState }, - // S16 + // S17 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 39 - case 65 <= r && r <= 90: // ['A','Z'] return 40 - case r == 95: // ['_','_'] + case 65 <= r && r <= 90: // ['A','Z'] return 41 - case 97 <= r && r <= 122: // ['a','z'] + case r == 95: // ['_','_'] return 42 + case 97 <= r && r <= 122: // ['a','z'] + return 43 } return NoState }, - // S17 + // S18 func(r rune) int { switch { case r == 96: // ['`','`'] - return 43 + return 44 default: - return 17 + return 18 } }, - // S18 + // S19 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 44 - case 65 <= r && r <= 90: // ['A','Z'] return 45 - case r == 95: // ['_','_'] + case 65 <= r && r <= 90: // ['A','Z'] return 46 - case 97 <= r && r <= 122: // ['a','z'] + case r == 95: // ['_','_'] return 47 + case 97 <= r && r <= 122: // ['a','z'] + return 48 } return NoState }, - // S19 + // S20 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 44 - case 65 <= r && r <= 90: // ['A','Z'] return 45 - case r == 95: // ['_','_'] + case 65 <= r && r <= 90: // ['A','Z'] return 46 - case 97 <= r && r <= 108: // ['a','l'] + case r == 95: // ['_','_'] return 47 - case r == 109: // ['m','m'] + case 97 <= r && r <= 108: // ['a','l'] return 48 + case r == 109: // ['m','m'] + return 49 case 110 <= r && r <= 113: // ['n','q'] - return 47 + return 48 case r == 114: // ['r','r'] - return 49 + return 50 case 115 <= r && r <= 122: // ['s','z'] - return 47 - } - return NoState - }, - // S20 - func(r rune) int { - switch { + return 48 } return NoState }, @@ -284,108 +286,106 @@ var TransTab = TransitionTable{ return NoState }, // S26 + func(r rune) int { + switch { + } + return NoState + }, + // S27 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 50 - case 65 <= r && r <= 90: // ['A','Z'] return 51 - case r == 95: // ['_','_'] + case 65 <= r && r <= 90: // ['A','Z'] return 52 - case 97 <= r && r <= 122: // ['a','z'] + case r == 95: // ['_','_'] return 53 + case 97 <= r && r <= 122: // ['a','z'] + return 54 } return NoState }, - // S27 + // S28 func(r rune) int { switch { } return NoState }, - // S28 + // S29 func(r rune) int { switch { case r == 34: // ['"','"'] - return 54 + return 55 case r == 39: // [''','''] - return 54 - case 48 <= r && r <= 55: // ['0','7'] return 55 - case r == 85: // ['U','U'] + case 48 <= r && r <= 55: // ['0','7'] return 56 + case r == 85: // ['U','U'] + return 57 case r == 92: // ['\','\'] - return 54 + return 55 case r == 97: // ['a','a'] - return 54 + return 55 case r == 98: // ['b','b'] - return 54 + return 55 case r == 102: // ['f','f'] - return 54 + return 55 case r == 110: // ['n','n'] - return 54 + return 55 case r == 114: // ['r','r'] - return 54 + return 55 case r == 116: // ['t','t'] - return 54 + return 55 case r == 117: // ['u','u'] - return 57 + return 58 case r == 118: // ['v','v'] - return 54 + return 55 case r == 120: // ['x','x'] - return 58 + return 59 } return NoState }, - // S29 + // S30 func(r rune) int { switch { case r == 34: // ['"','"'] - return 27 - case r == 92: // ['\','\'] return 28 - default: + case r == 92: // ['\','\'] return 29 + default: + return 30 } }, - // S30 + // S31 func(r rune) int { switch { case r == 34: // ['"','"'] - return 59 + return 60 case r == 39: // [''','''] - return 59 - case 48 <= r && r <= 55: // ['0','7'] return 60 - case r == 85: // ['U','U'] + case 48 <= r && r <= 55: // ['0','7'] return 61 + case r == 85: // ['U','U'] + return 62 case r == 92: // ['\','\'] - return 59 + return 60 case r == 97: // ['a','a'] - return 59 + return 60 case r == 98: // ['b','b'] - return 59 + return 60 case r == 102: // ['f','f'] - return 59 + return 60 case r == 110: // ['n','n'] - return 59 + return 60 case r == 114: // ['r','r'] - return 59 + return 60 case r == 116: // ['t','t'] - return 59 + return 60 case r == 117: // ['u','u'] - return 62 + return 63 case r == 118: // ['v','v'] - return 59 + return 60 case r == 120: // ['x','x'] - return 63 - } - return NoState - }, - // S31 - func(r rune) int { - switch { - case r == 39: // [''','''] return 64 } return NoState @@ -393,16 +393,15 @@ var TransTab = TransitionTable{ // S32 func(r rune) int { switch { - case r == 42: // ['*','*'] + case r == 39: // [''','''] return 65 - default: - return 32 } + return NoState }, // S33 func(r rune) int { switch { - case r == 10: // ['\n','\n'] + case r == 42: // ['*','*'] return 66 default: return 33 @@ -411,35 +410,30 @@ var TransTab = TransitionTable{ // S34 func(r rune) int { switch { - default: + case r == 10: // ['\n','\n'] return 67 + default: + return 34 } }, // S35 func(r rune) int { switch { - case 48 <= r && r <= 57: // ['0','9'] - return 35 - case 65 <= r && r <= 90: // ['A','Z'] - return 36 - case r == 95: // ['_','_'] - return 37 - case 97 <= r && r <= 122: // ['a','z'] - return 38 + default: + return 68 } - return NoState }, // S36 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 35 - case 65 <= r && r <= 90: // ['A','Z'] return 36 - case r == 95: // ['_','_'] + case 65 <= r && r <= 90: // ['A','Z'] return 37 - case 97 <= r && r <= 122: // ['a','z'] + case r == 95: // ['_','_'] return 38 + case 97 <= r && r <= 122: // ['a','z'] + return 39 } return NoState }, @@ -447,13 +441,13 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 35 - case 65 <= r && r <= 90: // ['A','Z'] return 36 - case r == 95: // ['_','_'] + case 65 <= r && r <= 90: // ['A','Z'] return 37 - case 97 <= r && r <= 122: // ['a','z'] + case r == 95: // ['_','_'] return 38 + case 97 <= r && r <= 122: // ['a','z'] + return 39 } return NoState }, @@ -461,13 +455,13 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 35 - case 65 <= r && r <= 90: // ['A','Z'] return 36 - case r == 95: // ['_','_'] + case 65 <= r && r <= 90: // ['A','Z'] return 37 - case 97 <= r && r <= 122: // ['a','z'] + case r == 95: // ['_','_'] return 38 + case 97 <= r && r <= 122: // ['a','z'] + return 39 } return NoState }, @@ -475,13 +469,13 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 39 + return 36 case 65 <= r && r <= 90: // ['A','Z'] - return 40 + return 37 case r == 95: // ['_','_'] - return 41 + return 38 case 97 <= r && r <= 122: // ['a','z'] - return 42 + return 39 } return NoState }, @@ -489,13 +483,13 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 39 - case 65 <= r && r <= 90: // ['A','Z'] return 40 - case r == 95: // ['_','_'] + case 65 <= r && r <= 90: // ['A','Z'] return 41 - case 97 <= r && r <= 122: // ['a','z'] + case r == 95: // ['_','_'] return 42 + case 97 <= r && r <= 122: // ['a','z'] + return 43 } return NoState }, @@ -503,13 +497,13 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 39 - case 65 <= r && r <= 90: // ['A','Z'] return 40 - case r == 95: // ['_','_'] + case 65 <= r && r <= 90: // ['A','Z'] return 41 - case 97 <= r && r <= 122: // ['a','z'] + case r == 95: // ['_','_'] return 42 + case 97 <= r && r <= 122: // ['a','z'] + return 43 } return NoState }, @@ -517,33 +511,33 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 39 - case 65 <= r && r <= 90: // ['A','Z'] return 40 - case r == 95: // ['_','_'] + case 65 <= r && r <= 90: // ['A','Z'] return 41 - case 97 <= r && r <= 122: // ['a','z'] + case r == 95: // ['_','_'] return 42 + case 97 <= r && r <= 122: // ['a','z'] + return 43 } return NoState }, // S43 func(r rune) int { switch { + case 48 <= r && r <= 57: // ['0','9'] + return 40 + case 65 <= r && r <= 90: // ['A','Z'] + return 41 + case r == 95: // ['_','_'] + return 42 + case 97 <= r && r <= 122: // ['a','z'] + return 43 } return NoState }, // S44 func(r rune) int { switch { - case 48 <= r && r <= 57: // ['0','9'] - return 44 - case 65 <= r && r <= 90: // ['A','Z'] - return 45 - case r == 95: // ['_','_'] - return 46 - case 97 <= r && r <= 122: // ['a','z'] - return 47 } return NoState }, @@ -551,13 +545,13 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 44 - case 65 <= r && r <= 90: // ['A','Z'] return 45 - case r == 95: // ['_','_'] + case 65 <= r && r <= 90: // ['A','Z'] return 46 - case 97 <= r && r <= 122: // ['a','z'] + case r == 95: // ['_','_'] return 47 + case 97 <= r && r <= 122: // ['a','z'] + return 48 } return NoState }, @@ -565,13 +559,13 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 44 - case 65 <= r && r <= 90: // ['A','Z'] return 45 - case r == 95: // ['_','_'] + case 65 <= r && r <= 90: // ['A','Z'] return 46 - case 97 <= r && r <= 122: // ['a','z'] + case r == 95: // ['_','_'] return 47 + case 97 <= r && r <= 122: // ['a','z'] + return 48 } return NoState }, @@ -579,13 +573,13 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 44 - case 65 <= r && r <= 90: // ['A','Z'] return 45 - case r == 95: // ['_','_'] + case 65 <= r && r <= 90: // ['A','Z'] return 46 - case 97 <= r && r <= 122: // ['a','z'] + case r == 95: // ['_','_'] return 47 + case 97 <= r && r <= 122: // ['a','z'] + return 48 } return NoState }, @@ -593,17 +587,13 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 44 - case 65 <= r && r <= 90: // ['A','Z'] return 45 - case r == 95: // ['_','_'] + case 65 <= r && r <= 90: // ['A','Z'] return 46 - case 97 <= r && r <= 111: // ['a','o'] - return 47 - case r == 112: // ['p','p'] - return 68 - case 113 <= r && r <= 122: // ['q','z'] + case r == 95: // ['_','_'] return 47 + case 97 <= r && r <= 122: // ['a','z'] + return 48 } return NoState }, @@ -611,17 +601,17 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 44 - case 65 <= r && r <= 90: // ['A','Z'] return 45 - case r == 95: // ['_','_'] + case 65 <= r && r <= 90: // ['A','Z'] return 46 - case 97 <= r && r <= 113: // ['a','q'] + case r == 95: // ['_','_'] return 47 - case r == 114: // ['r','r'] + case 97 <= r && r <= 111: // ['a','o'] + return 48 + case r == 112: // ['p','p'] return 69 - case 115 <= r && r <= 122: // ['s','z'] - return 47 + case 113 <= r && r <= 122: // ['q','z'] + return 48 } return NoState }, @@ -629,13 +619,17 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 50 + return 45 case 65 <= r && r <= 90: // ['A','Z'] - return 51 + return 46 case r == 95: // ['_','_'] - return 52 - case 97 <= r && r <= 122: // ['a','z'] - return 53 + return 47 + case 97 <= r && r <= 113: // ['a','q'] + return 48 + case r == 114: // ['r','r'] + return 70 + case 115 <= r && r <= 122: // ['s','z'] + return 48 } return NoState }, @@ -643,13 +637,13 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 50 - case 65 <= r && r <= 90: // ['A','Z'] return 51 - case r == 95: // ['_','_'] + case 65 <= r && r <= 90: // ['A','Z'] return 52 - case 97 <= r && r <= 122: // ['a','z'] + case r == 95: // ['_','_'] return 53 + case 97 <= r && r <= 122: // ['a','z'] + return 54 } return NoState }, @@ -657,13 +651,13 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 50 - case 65 <= r && r <= 90: // ['A','Z'] return 51 - case r == 95: // ['_','_'] + case 65 <= r && r <= 90: // ['A','Z'] return 52 - case 97 <= r && r <= 122: // ['a','z'] + case r == 95: // ['_','_'] return 53 + case 97 <= r && r <= 122: // ['a','z'] + return 54 } return NoState }, @@ -671,43 +665,45 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 50 - case 65 <= r && r <= 90: // ['A','Z'] return 51 - case r == 95: // ['_','_'] + case 65 <= r && r <= 90: // ['A','Z'] return 52 - case 97 <= r && r <= 122: // ['a','z'] + case r == 95: // ['_','_'] return 53 + case 97 <= r && r <= 122: // ['a','z'] + return 54 } return NoState }, // S54 func(r rune) int { switch { - case r == 34: // ['"','"'] - return 27 - case r == 92: // ['\','\'] - return 28 - default: - return 29 + case 48 <= r && r <= 57: // ['0','9'] + return 51 + case 65 <= r && r <= 90: // ['A','Z'] + return 52 + case r == 95: // ['_','_'] + return 53 + case 97 <= r && r <= 122: // ['a','z'] + return 54 } + return NoState }, // S55 func(r rune) int { switch { - case 48 <= r && r <= 55: // ['0','7'] - return 70 + case r == 34: // ['"','"'] + return 28 + case r == 92: // ['\','\'] + return 29 + default: + return 30 } - return NoState }, // S56 func(r rune) int { switch { - case 48 <= r && r <= 57: // ['0','9'] - return 71 - case 65 <= r && r <= 70: // ['A','F'] - return 71 - case 97 <= r && r <= 102: // ['a','f'] + case 48 <= r && r <= 55: // ['0','7'] return 71 } return NoState @@ -739,27 +735,27 @@ var TransTab = TransitionTable{ // S59 func(r rune) int { switch { - case r == 39: // [''','''] - return 64 + case 48 <= r && r <= 57: // ['0','9'] + return 74 + case 65 <= r && r <= 70: // ['A','F'] + return 74 + case 97 <= r && r <= 102: // ['a','f'] + return 74 } return NoState }, // S60 func(r rune) int { switch { - case 48 <= r && r <= 55: // ['0','7'] - return 74 + case r == 39: // [''','''] + return 65 } return NoState }, // S61 func(r rune) int { switch { - case 48 <= r && r <= 57: // ['0','9'] - return 75 - case 65 <= r && r <= 70: // ['A','F'] - return 75 - case 97 <= r && r <= 102: // ['a','f'] + case 48 <= r && r <= 55: // ['0','7'] return 75 } return NoState @@ -780,98 +776,98 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 77 + return 77 + case 65 <= r && r <= 70: // ['A','F'] + return 77 + case 97 <= r && r <= 102: // ['a','f'] + return 77 + } + return NoState + }, + // S64 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 78 case 65 <= r && r <= 70: // ['A','F'] - return 77 + return 78 case 97 <= r && r <= 102: // ['a','f'] - return 77 + return 78 } return NoState }, - // S64 + // S65 func(r rune) int { switch { } return NoState }, - // S65 + // S66 func(r rune) int { switch { case r == 42: // ['*','*'] - return 65 + return 66 case r == 47: // ['/','/'] - return 78 + return 79 default: - return 32 + return 33 } }, - // S66 + // S67 func(r rune) int { switch { } return NoState }, - // S67 + // S68 func(r rune) int { switch { case r == 62: // ['>','>'] - return 79 + return 80 default: - return 67 + return 68 } }, - // S68 + // S69 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 44 - case 65 <= r && r <= 90: // ['A','Z'] return 45 - case r == 95: // ['_','_'] + case 65 <= r && r <= 90: // ['A','Z'] return 46 - case 97 <= r && r <= 115: // ['a','s'] + case r == 95: // ['_','_'] return 47 + case 97 <= r && r <= 115: // ['a','s'] + return 48 case r == 116: // ['t','t'] - return 80 + return 81 case 117 <= r && r <= 122: // ['u','z'] - return 47 + return 48 } return NoState }, - // S69 + // S70 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 44 - case 65 <= r && r <= 90: // ['A','Z'] return 45 - case r == 95: // ['_','_'] + case 65 <= r && r <= 90: // ['A','Z'] return 46 - case 97 <= r && r <= 110: // ['a','n'] + case r == 95: // ['_','_'] return 47 + case 97 <= r && r <= 110: // ['a','n'] + return 48 case r == 111: // ['o','o'] - return 81 - case 112 <= r && r <= 122: // ['p','z'] - return 47 - } - return NoState - }, - // S70 - func(r rune) int { - switch { - case 48 <= r && r <= 55: // ['0','7'] return 82 + case 112 <= r && r <= 122: // ['p','z'] + return 48 } return NoState }, // S71 func(r rune) int { switch { - case 48 <= r && r <= 57: // ['0','9'] - return 83 - case 65 <= r && r <= 70: // ['A','F'] - return 83 - case 97 <= r && r <= 102: // ['a','f'] + case 48 <= r && r <= 55: // ['0','7'] return 83 } return NoState @@ -903,7 +899,11 @@ var TransTab = TransitionTable{ // S74 func(r rune) int { switch { - case 48 <= r && r <= 55: // ['0','7'] + case 48 <= r && r <= 57: // ['0','9'] + return 86 + case 65 <= r && r <= 70: // ['A','F'] + return 86 + case 97 <= r && r <= 102: // ['a','f'] return 86 } return NoState @@ -911,11 +911,7 @@ var TransTab = TransitionTable{ // S75 func(r rune) int { switch { - case 48 <= r && r <= 57: // ['0','9'] - return 87 - case 65 <= r && r <= 70: // ['A','F'] - return 87 - case 97 <= r && r <= 102: // ['a','f'] + case 48 <= r && r <= 55: // ['0','7'] return 87 } return NoState @@ -947,116 +943,116 @@ var TransTab = TransitionTable{ // S78 func(r rune) int { switch { + case 48 <= r && r <= 57: // ['0','9'] + return 90 + case 65 <= r && r <= 70: // ['A','F'] + return 90 + case 97 <= r && r <= 102: // ['a','f'] + return 90 } return NoState }, // S79 func(r rune) int { switch { - case r == 62: // ['>','>'] - return 90 } return NoState }, // S80 + func(r rune) int { + switch { + case r == 62: // ['>','>'] + return 91 + } + return NoState + }, + // S81 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 44 - case 65 <= r && r <= 90: // ['A','Z'] return 45 - case r == 95: // ['_','_'] + case 65 <= r && r <= 90: // ['A','Z'] return 46 - case 97 <= r && r <= 120: // ['a','x'] + case r == 95: // ['_','_'] return 47 + case 97 <= r && r <= 120: // ['a','x'] + return 48 case r == 121: // ['y','y'] - return 91 + return 92 case r == 122: // ['z','z'] - return 47 + return 48 } return NoState }, - // S81 + // S82 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 44 - case 65 <= r && r <= 90: // ['A','Z'] return 45 - case r == 95: // ['_','_'] + case 65 <= r && r <= 90: // ['A','Z'] return 46 - case 97 <= r && r <= 113: // ['a','q'] + case r == 95: // ['_','_'] return 47 + case 97 <= r && r <= 113: // ['a','q'] + return 48 case r == 114: // ['r','r'] - return 92 + return 93 case 115 <= r && r <= 122: // ['s','z'] - return 47 + return 48 } return NoState }, - // S82 + // S83 func(r rune) int { switch { case r == 34: // ['"','"'] - return 27 - case r == 92: // ['\','\'] return 28 - default: + case r == 92: // ['\','\'] return 29 + default: + return 30 } }, - // S83 + // S84 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 93 + return 94 case 65 <= r && r <= 70: // ['A','F'] - return 93 + return 94 case 97 <= r && r <= 102: // ['a','f'] - return 93 + return 94 } return NoState }, - // S84 + // S85 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 94 + return 95 case 65 <= r && r <= 70: // ['A','F'] - return 94 + return 95 case 97 <= r && r <= 102: // ['a','f'] - return 94 + return 95 } return NoState }, - // S85 + // S86 func(r rune) int { switch { case r == 34: // ['"','"'] - return 27 - case r == 92: // ['\','\'] return 28 - default: + case r == 92: // ['\','\'] return 29 + default: + return 30 } }, - // S86 - func(r rune) int { - switch { - case r == 39: // [''','''] - return 64 - } - return NoState - }, // S87 func(r rune) int { switch { - case 48 <= r && r <= 57: // ['0','9'] - return 95 - case 65 <= r && r <= 70: // ['A','F'] - return 95 - case 97 <= r && r <= 102: // ['a','f'] - return 95 + case r == 39: // [''','''] + return 65 } return NoState }, @@ -1075,28 +1071,26 @@ var TransTab = TransitionTable{ // S89 func(r rune) int { switch { - case r == 39: // [''','''] - return 64 + case 48 <= r && r <= 57: // ['0','9'] + return 97 + case 65 <= r && r <= 70: // ['A','F'] + return 97 + case 97 <= r && r <= 102: // ['a','f'] + return 97 } return NoState }, // S90 func(r rune) int { switch { + case r == 39: // [''','''] + return 65 } return NoState }, // S91 func(r rune) int { switch { - case 48 <= r && r <= 57: // ['0','9'] - return 44 - case 65 <= r && r <= 90: // ['A','Z'] - return 45 - case r == 95: // ['_','_'] - return 46 - case 97 <= r && r <= 122: // ['a','z'] - return 47 } return NoState }, @@ -1104,13 +1098,13 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 44 - case 65 <= r && r <= 90: // ['A','Z'] return 45 - case r == 95: // ['_','_'] + case 65 <= r && r <= 90: // ['A','Z'] return 46 - case 97 <= r && r <= 122: // ['a','z'] + case r == 95: // ['_','_'] return 47 + case 97 <= r && r <= 122: // ['a','z'] + return 48 } return NoState }, @@ -1118,11 +1112,13 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 97 - case 65 <= r && r <= 70: // ['A','F'] - return 97 - case 97 <= r && r <= 102: // ['a','f'] - return 97 + return 45 + case 65 <= r && r <= 90: // ['A','Z'] + return 46 + case r == 95: // ['_','_'] + return 47 + case 97 <= r && r <= 122: // ['a','z'] + return 48 } return NoState }, @@ -1175,17 +1171,6 @@ var TransTab = TransitionTable{ return NoState }, // S98 - func(r rune) int { - switch { - case r == 34: // ['"','"'] - return 27 - case r == 92: // ['\','\'] - return 28 - default: - return 29 - } - }, - // S99 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] @@ -1197,15 +1182,18 @@ var TransTab = TransitionTable{ } return NoState }, - // S100 + // S99 func(r rune) int { switch { - case r == 39: // [''','''] - return 64 + case r == 34: // ['"','"'] + return 28 + case r == 92: // ['\','\'] + return 29 + default: + return 30 } - return NoState }, - // S101 + // S100 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] @@ -1217,6 +1205,14 @@ var TransTab = TransitionTable{ } return NoState }, + // S101 + func(r rune) int { + switch { + case r == 39: // [''','''] + return 65 + } + return NoState + }, // S102 func(r rune) int { switch { @@ -1278,21 +1274,33 @@ var TransTab = TransitionTable{ return NoState }, // S107 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 109 + case 65 <= r && r <= 70: // ['A','F'] + return 109 + case 97 <= r && r <= 102: // ['a','f'] + return 109 + } + return NoState + }, + // S108 func(r rune) int { switch { case r == 34: // ['"','"'] - return 27 - case r == 92: // ['\','\'] return 28 - default: + case r == 92: // ['\','\'] return 29 + default: + return 30 } }, - // S108 + // S109 func(r rune) int { switch { case r == 39: // [''','''] - return 64 + return 65 } return NoState }, diff --git a/internal/frontend/reparsed/internal/parser/actiontable.go b/internal/frontend/reparsed/internal/parser/actiontable.go index 6dfb93f3..e4fe1547 100644 --- a/internal/frontend/reparsed/internal/parser/actiontable.go +++ b/internal/frontend/reparsed/internal/parser/actiontable.go @@ -35,6 +35,7 @@ var actionTab = actionTable{ shift(12), // g_sdt_lit shift(13), // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -65,6 +66,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -95,6 +97,7 @@ var actionTab = actionTable{ shift(12), // g_sdt_lit shift(13), // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -125,6 +128,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -155,6 +159,7 @@ var actionTab = actionTable{ reduce(4), // g_sdt_lit, reduce: LexicalPart reduce(4), // prodId, reduce: LexicalPart nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -185,6 +190,7 @@ var actionTab = actionTable{ reduce(5), // g_sdt_lit, reduce: LexProductions reduce(5), // prodId, reduce: LexProductions nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -215,6 +221,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit shift(13), // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -245,6 +252,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit shift(13), // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -275,6 +283,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit reduce(26), // prodId, reduce: SyntaxProdList nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -305,6 +314,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -335,6 +345,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -365,6 +376,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -395,6 +407,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit reduce(25), // prodId, reduce: FileHeader nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -425,6 +438,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -455,6 +469,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -485,6 +500,7 @@ var actionTab = actionTable{ reduce(6), // g_sdt_lit, reduce: LexProductions reduce(6), // prodId, reduce: LexProductions nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -515,6 +531,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit shift(13), // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -545,6 +562,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit reduce(27), // prodId, reduce: SyntaxProdList nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -575,6 +593,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -605,6 +624,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -635,6 +655,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -665,10 +686,11 @@ var actionTab = actionTable{ nil, // g_sdt_lit shift(41), // prodId shift(42), // string_lit - shift(43), // "error" - shift(44), // "λ" - shift(45), // "empty" - shift(46), // "ε" + shift(43), // "@" + shift(44), // "error" + shift(45), // "λ" + shift(46), // "empty" + shift(47), // "ε" }, }, actionRow{ // S22 @@ -678,10 +700,10 @@ var actionTab = actionTable{ nil, // Ω nil, // tokId nil, // ":" - shift(47), // ";" + shift(48), // ";" nil, // regDefId nil, // ignoredTokId - shift(48), // "|" + shift(49), // "|" nil, // "." nil, // char_lit nil, // "-" @@ -695,6 +717,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -725,6 +748,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -755,6 +779,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -785,6 +810,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -815,6 +841,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -834,7 +861,7 @@ var actionTab = actionTable{ reduce(15), // "|", reduce: LexTerm reduce(15), // ".", reduce: LexTerm reduce(15), // char_lit, reduce: LexTerm - shift(50), // "-" + shift(51), // "-" reduce(15), // "~", reduce: LexTerm reduce(15), // "(", reduce: LexTerm nil, // ")" @@ -845,6 +872,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -863,10 +891,10 @@ var actionTab = actionTable{ nil, // ignoredTokId nil, // "|" nil, // "." - shift(51), // char_lit + shift(52), // char_lit nil, // "-" nil, // "~" - shift(52), // "(" + shift(53), // "(" nil, // ")" nil, // "[" nil, // "]" @@ -875,6 +903,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -889,22 +918,23 @@ var actionTab = actionTable{ nil, // tokId nil, // ":" nil, // ";" - shift(56), // regDefId + shift(57), // regDefId nil, // ignoredTokId nil, // "|" - shift(57), // "." - shift(58), // char_lit + shift(58), // "." + shift(59), // char_lit nil, // "-" - shift(59), // "~" - shift(60), // "(" + shift(60), // "~" + shift(61), // "(" nil, // ")" - shift(61), // "[" + shift(62), // "[" nil, // "]" - shift(62), // "{" + shift(63), // "{" nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -919,22 +949,23 @@ var actionTab = actionTable{ nil, // tokId nil, // ":" nil, // ";" - shift(66), // regDefId + shift(67), // regDefId nil, // ignoredTokId nil, // "|" - shift(67), // "." - shift(68), // char_lit + shift(68), // "." + shift(69), // char_lit nil, // "-" - shift(69), // "~" - shift(70), // "(" + shift(70), // "~" + shift(71), // "(" nil, // ")" - shift(71), // "[" + shift(72), // "[" nil, // "]" - shift(72), // "{" + shift(73), // "{" nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -949,22 +980,23 @@ var actionTab = actionTable{ nil, // tokId nil, // ":" nil, // ";" - shift(76), // regDefId + shift(77), // regDefId nil, // ignoredTokId nil, // "|" - shift(77), // "." - shift(78), // char_lit + shift(78), // "." + shift(79), // char_lit nil, // "-" - shift(79), // "~" - shift(80), // "(" + shift(80), // "~" + shift(81), // "(" nil, // ")" - shift(81), // "[" + shift(82), // "[" nil, // "]" - shift(82), // "{" + shift(83), // "{" nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -978,10 +1010,10 @@ var actionTab = actionTable{ nil, // Ω nil, // tokId nil, // ":" - shift(83), // ";" + shift(84), // ";" nil, // regDefId nil, // ignoredTokId - shift(48), // "|" + shift(49), // "|" nil, // "." nil, // char_lit nil, // "-" @@ -995,6 +1027,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -1008,10 +1041,10 @@ var actionTab = actionTable{ nil, // Ω nil, // tokId nil, // ":" - shift(84), // ";" + shift(85), // ";" nil, // regDefId nil, // ignoredTokId - shift(48), // "|" + shift(49), // "|" nil, // "." nil, // char_lit nil, // "-" @@ -1025,6 +1058,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -1038,10 +1072,10 @@ var actionTab = actionTable{ nil, // Ω nil, // tokId nil, // ":" - shift(85), // ";" + shift(86), // ";" nil, // regDefId nil, // ignoredTokId - shift(86), // "|" + shift(87), // "|" nil, // "." nil, // char_lit nil, // "-" @@ -1055,6 +1089,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -1085,6 +1120,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -1112,9 +1148,10 @@ var actionTab = actionTable{ nil, // "]" nil, // "{" nil, // "}" - shift(88), // g_sdt_lit + shift(89), // g_sdt_lit shift(41), // prodId shift(42), // string_lit + shift(43), // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -1142,9 +1179,10 @@ var actionTab = actionTable{ nil, // "]" nil, // "{" nil, // "}" - shift(90), // g_sdt_lit + shift(91), // g_sdt_lit shift(41), // prodId shift(42), // string_lit + shift(43), // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -1175,6 +1213,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -1205,6 +1244,7 @@ var actionTab = actionTable{ reduce(38), // g_sdt_lit, reduce: Symbols reduce(38), // prodId, reduce: Symbols reduce(38), // string_lit, reduce: Symbols + reduce(38), // "@", reduce: Symbols nil, // "error" nil, // "λ" nil, // "empty" @@ -1235,6 +1275,7 @@ var actionTab = actionTable{ reduce(41), // g_sdt_lit, reduce: Symbol reduce(41), // prodId, reduce: Symbol reduce(41), // string_lit, reduce: Symbol + reduce(41), // "@", reduce: Symbol nil, // "error" nil, // "λ" nil, // "empty" @@ -1265,6 +1306,7 @@ var actionTab = actionTable{ reduce(40), // g_sdt_lit, reduce: Symbol reduce(40), // prodId, reduce: Symbol reduce(40), // string_lit, reduce: Symbol + reduce(40), // "@", reduce: Symbol nil, // "error" nil, // "λ" nil, // "empty" @@ -1295,6 +1337,7 @@ var actionTab = actionTable{ reduce(42), // g_sdt_lit, reduce: Symbol reduce(42), // prodId, reduce: Symbol reduce(42), // string_lit, reduce: Symbol + reduce(42), // "@", reduce: Symbol nil, // "error" nil, // "λ" nil, // "empty" @@ -1302,16 +1345,47 @@ var actionTab = actionTable{ }, }, actionRow{ // S43 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + shift(92), // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "@" + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S44 canRecover: false, actions: [numSymbols]action{ nil, // ά nil, // Ω - reduce(43), // tokId, reduce: ErrorSymbol + reduce(44), // tokId, reduce: ErrorSymbol nil, // ":" - reduce(43), // ";", reduce: ErrorSymbol + reduce(44), // ";", reduce: ErrorSymbol nil, // regDefId nil, // ignoredTokId - reduce(43), // "|", reduce: ErrorSymbol + reduce(44), // "|", reduce: ErrorSymbol nil, // "." nil, // char_lit nil, // "-" @@ -1322,26 +1396,27 @@ var actionTab = actionTable{ nil, // "]" nil, // "{" nil, // "}" - reduce(43), // g_sdt_lit, reduce: ErrorSymbol - reduce(43), // prodId, reduce: ErrorSymbol - reduce(43), // string_lit, reduce: ErrorSymbol + reduce(44), // g_sdt_lit, reduce: ErrorSymbol + reduce(44), // prodId, reduce: ErrorSymbol + reduce(44), // string_lit, reduce: ErrorSymbol + reduce(44), // "@", reduce: ErrorSymbol nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S44 + actionRow{ // S45 canRecover: false, actions: [numSymbols]action{ nil, // ά nil, // Ω - reduce(44), // tokId, reduce: ErrorSymbol + reduce(45), // tokId, reduce: ErrorSymbol nil, // ":" - reduce(44), // ";", reduce: ErrorSymbol + reduce(45), // ";", reduce: ErrorSymbol nil, // regDefId nil, // ignoredTokId - reduce(44), // "|", reduce: ErrorSymbol + reduce(45), // "|", reduce: ErrorSymbol nil, // "." nil, // char_lit nil, // "-" @@ -1352,26 +1427,27 @@ var actionTab = actionTable{ nil, // "]" nil, // "{" nil, // "}" - reduce(44), // g_sdt_lit, reduce: ErrorSymbol - reduce(44), // prodId, reduce: ErrorSymbol - reduce(44), // string_lit, reduce: ErrorSymbol + reduce(45), // g_sdt_lit, reduce: ErrorSymbol + reduce(45), // prodId, reduce: ErrorSymbol + reduce(45), // string_lit, reduce: ErrorSymbol + reduce(45), // "@", reduce: ErrorSymbol nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S45 + actionRow{ // S46 canRecover: false, actions: [numSymbols]action{ nil, // ά nil, // Ω nil, // tokId nil, // ":" - reduce(45), // ";", reduce: EpsilonSymbol + reduce(46), // ";", reduce: EpsilonSymbol nil, // regDefId nil, // ignoredTokId - reduce(45), // "|", reduce: EpsilonSymbol + reduce(46), // "|", reduce: EpsilonSymbol nil, // "." nil, // char_lit nil, // "-" @@ -1385,23 +1461,24 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S46 + actionRow{ // S47 canRecover: false, actions: [numSymbols]action{ nil, // ά nil, // Ω nil, // tokId nil, // ":" - reduce(46), // ";", reduce: EpsilonSymbol + reduce(47), // ";", reduce: EpsilonSymbol nil, // regDefId nil, // ignoredTokId - reduce(46), // "|", reduce: EpsilonSymbol + reduce(47), // "|", reduce: EpsilonSymbol nil, // "." nil, // char_lit nil, // "-" @@ -1415,13 +1492,14 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S47 + actionRow{ // S48 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -1445,13 +1523,14 @@ var actionTab = actionTable{ reduce(7), // g_sdt_lit, reduce: LexProduction reduce(7), // prodId, reduce: LexProduction nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S48 + actionRow{ // S49 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -1475,13 +1554,14 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S49 + actionRow{ // S50 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -1505,13 +1585,14 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S50 + actionRow{ // S51 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -1523,7 +1604,7 @@ var actionTab = actionTable{ nil, // ignoredTokId nil, // "|" nil, // "." - shift(92), // char_lit + shift(94), // char_lit nil, // "-" nil, // "~" nil, // "(" @@ -1535,13 +1616,14 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S51 + actionRow{ // S52 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -1565,13 +1647,14 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S52 + actionRow{ // S53 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -1583,7 +1666,7 @@ var actionTab = actionTable{ nil, // ignoredTokId nil, // "|" nil, // "." - shift(93), // char_lit + shift(95), // char_lit nil, // "-" nil, // "~" nil, // "(" @@ -1595,13 +1678,14 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S53 + actionRow{ // S54 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -1611,13 +1695,13 @@ var actionTab = actionTable{ nil, // ";" nil, // regDefId nil, // ignoredTokId - shift(94), // "|" + shift(96), // "|" nil, // "." nil, // char_lit nil, // "-" nil, // "~" nil, // "(" - shift(95), // ")" + shift(97), // ")" nil, // "[" nil, // "]" nil, // "{" @@ -1625,13 +1709,14 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S54 + actionRow{ // S55 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -1639,29 +1724,30 @@ var actionTab = actionTable{ nil, // tokId nil, // ":" nil, // ";" - shift(56), // regDefId + shift(57), // regDefId nil, // ignoredTokId reduce(10), // "|", reduce: LexPattern - shift(57), // "." - shift(58), // char_lit + shift(58), // "." + shift(59), // char_lit nil, // "-" - shift(59), // "~" - shift(60), // "(" + shift(60), // "~" + shift(61), // "(" reduce(10), // ")", reduce: LexPattern - shift(61), // "[" + shift(62), // "[" nil, // "]" - shift(62), // "{" + shift(63), // "{" nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S55 + actionRow{ // S56 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -1685,13 +1771,14 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S56 + actionRow{ // S57 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -1715,13 +1802,14 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S57 + actionRow{ // S58 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -1745,13 +1833,14 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S58 + actionRow{ // S59 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -1764,7 +1853,7 @@ var actionTab = actionTable{ reduce(15), // "|", reduce: LexTerm reduce(15), // ".", reduce: LexTerm reduce(15), // char_lit, reduce: LexTerm - shift(97), // "-" + shift(99), // "-" reduce(15), // "~", reduce: LexTerm reduce(15), // "(", reduce: LexTerm reduce(15), // ")", reduce: LexTerm @@ -1775,43 +1864,45 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S59 + actionRow{ // S60 canRecover: false, actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - shift(98), // char_lit - nil, // "-" - nil, // "~" - shift(99), // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + shift(100), // char_lit + nil, // "-" + nil, // "~" + shift(101), // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // "@" + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, }, - actionRow{ // S60 + actionRow{ // S61 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -1819,29 +1910,30 @@ var actionTab = actionTable{ nil, // tokId nil, // ":" nil, // ";" - shift(56), // regDefId + shift(57), // regDefId nil, // ignoredTokId nil, // "|" - shift(57), // "." - shift(58), // char_lit + shift(58), // "." + shift(59), // char_lit nil, // "-" - shift(59), // "~" - shift(60), // "(" + shift(60), // "~" + shift(61), // "(" nil, // ")" - shift(61), // "[" + shift(62), // "[" nil, // "]" - shift(62), // "{" + shift(63), // "{" nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S61 + actionRow{ // S62 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -1849,29 +1941,30 @@ var actionTab = actionTable{ nil, // tokId nil, // ":" nil, // ";" - shift(66), // regDefId + shift(67), // regDefId nil, // ignoredTokId nil, // "|" - shift(67), // "." - shift(68), // char_lit + shift(68), // "." + shift(69), // char_lit nil, // "-" - shift(69), // "~" - shift(70), // "(" + shift(70), // "~" + shift(71), // "(" nil, // ")" - shift(71), // "[" + shift(72), // "[" nil, // "]" - shift(72), // "{" + shift(73), // "{" nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S62 + actionRow{ // S63 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -1879,29 +1972,30 @@ var actionTab = actionTable{ nil, // tokId nil, // ":" nil, // ";" - shift(76), // regDefId + shift(77), // regDefId nil, // ignoredTokId nil, // "|" - shift(77), // "." - shift(78), // char_lit + shift(78), // "." + shift(79), // char_lit nil, // "-" - shift(79), // "~" - shift(80), // "(" + shift(80), // "~" + shift(81), // "(" nil, // ")" - shift(81), // "[" + shift(82), // "[" nil, // "]" - shift(82), // "{" + shift(83), // "{" nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S63 + actionRow{ // S64 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -1911,7 +2005,7 @@ var actionTab = actionTable{ nil, // ";" nil, // regDefId nil, // ignoredTokId - shift(103), // "|" + shift(105), // "|" nil, // "." nil, // char_lit nil, // "-" @@ -1919,19 +2013,20 @@ var actionTab = actionTable{ nil, // "(" nil, // ")" nil, // "[" - shift(104), // "]" + shift(106), // "]" nil, // "{" nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S64 + actionRow{ // S65 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -1939,29 +2034,30 @@ var actionTab = actionTable{ nil, // tokId nil, // ":" nil, // ";" - shift(66), // regDefId + shift(67), // regDefId nil, // ignoredTokId reduce(10), // "|", reduce: LexPattern - shift(67), // "." - shift(68), // char_lit + shift(68), // "." + shift(69), // char_lit nil, // "-" - shift(69), // "~" - shift(70), // "(" + shift(70), // "~" + shift(71), // "(" nil, // ")" - shift(71), // "[" + shift(72), // "[" reduce(10), // "]", reduce: LexPattern - shift(72), // "{" + shift(73), // "{" nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S65 + actionRow{ // S66 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -1985,13 +2081,14 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S66 + actionRow{ // S67 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -2015,13 +2112,14 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S67 + actionRow{ // S68 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -2045,13 +2143,14 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S68 + actionRow{ // S69 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -2064,7 +2163,7 @@ var actionTab = actionTable{ reduce(15), // "|", reduce: LexTerm reduce(15), // ".", reduce: LexTerm reduce(15), // char_lit, reduce: LexTerm - shift(106), // "-" + shift(108), // "-" reduce(15), // "~", reduce: LexTerm reduce(15), // "(", reduce: LexTerm nil, // ")" @@ -2075,13 +2174,14 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S69 + actionRow{ // S70 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -2093,10 +2193,10 @@ var actionTab = actionTable{ nil, // ignoredTokId nil, // "|" nil, // "." - shift(107), // char_lit + shift(109), // char_lit nil, // "-" nil, // "~" - shift(108), // "(" + shift(110), // "(" nil, // ")" nil, // "[" nil, // "]" @@ -2105,13 +2205,14 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S70 + actionRow{ // S71 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -2119,29 +2220,30 @@ var actionTab = actionTable{ nil, // tokId nil, // ":" nil, // ";" - shift(56), // regDefId + shift(57), // regDefId nil, // ignoredTokId nil, // "|" - shift(57), // "." - shift(58), // char_lit + shift(58), // "." + shift(59), // char_lit nil, // "-" - shift(59), // "~" - shift(60), // "(" + shift(60), // "~" + shift(61), // "(" nil, // ")" - shift(61), // "[" + shift(62), // "[" nil, // "]" - shift(62), // "{" + shift(63), // "{" nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S71 + actionRow{ // S72 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -2149,29 +2251,30 @@ var actionTab = actionTable{ nil, // tokId nil, // ":" nil, // ";" - shift(66), // regDefId + shift(67), // regDefId nil, // ignoredTokId nil, // "|" - shift(67), // "." - shift(68), // char_lit + shift(68), // "." + shift(69), // char_lit nil, // "-" - shift(69), // "~" - shift(70), // "(" + shift(70), // "~" + shift(71), // "(" nil, // ")" - shift(71), // "[" + shift(72), // "[" nil, // "]" - shift(72), // "{" + shift(73), // "{" nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S72 + actionRow{ // S73 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -2179,29 +2282,30 @@ var actionTab = actionTable{ nil, // tokId nil, // ":" nil, // ";" - shift(76), // regDefId + shift(77), // regDefId nil, // ignoredTokId nil, // "|" - shift(77), // "." - shift(78), // char_lit + shift(78), // "." + shift(79), // char_lit nil, // "-" - shift(79), // "~" - shift(80), // "(" + shift(80), // "~" + shift(81), // "(" nil, // ")" - shift(81), // "[" + shift(82), // "[" nil, // "]" - shift(82), // "{" + shift(83), // "{" nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S73 + actionRow{ // S74 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -2211,7 +2315,7 @@ var actionTab = actionTable{ nil, // ";" nil, // regDefId nil, // ignoredTokId - shift(112), // "|" + shift(114), // "|" nil, // "." nil, // char_lit nil, // "-" @@ -2221,17 +2325,18 @@ var actionTab = actionTable{ nil, // "[" nil, // "]" nil, // "{" - shift(113), // "}" + shift(115), // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S74 + actionRow{ // S75 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -2239,29 +2344,30 @@ var actionTab = actionTable{ nil, // tokId nil, // ":" nil, // ";" - shift(76), // regDefId + shift(77), // regDefId nil, // ignoredTokId reduce(10), // "|", reduce: LexPattern - shift(77), // "." - shift(78), // char_lit + shift(78), // "." + shift(79), // char_lit nil, // "-" - shift(79), // "~" - shift(80), // "(" + shift(80), // "~" + shift(81), // "(" nil, // ")" - shift(81), // "[" + shift(82), // "[" nil, // "]" - shift(82), // "{" + shift(83), // "{" reduce(10), // "}", reduce: LexPattern nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S75 + actionRow{ // S76 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -2285,13 +2391,14 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S76 + actionRow{ // S77 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -2315,13 +2422,14 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S77 + actionRow{ // S78 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -2345,13 +2453,14 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S78 + actionRow{ // S79 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -2364,7 +2473,7 @@ var actionTab = actionTable{ reduce(15), // "|", reduce: LexTerm reduce(15), // ".", reduce: LexTerm reduce(15), // char_lit, reduce: LexTerm - shift(115), // "-" + shift(117), // "-" reduce(15), // "~", reduce: LexTerm reduce(15), // "(", reduce: LexTerm nil, // ")" @@ -2375,13 +2484,14 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S79 + actionRow{ // S80 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -2393,10 +2503,10 @@ var actionTab = actionTable{ nil, // ignoredTokId nil, // "|" nil, // "." - shift(116), // char_lit + shift(118), // char_lit nil, // "-" nil, // "~" - shift(117), // "(" + shift(119), // "(" nil, // ")" nil, // "[" nil, // "]" @@ -2405,13 +2515,14 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S80 + actionRow{ // S81 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -2419,29 +2530,30 @@ var actionTab = actionTable{ nil, // tokId nil, // ":" nil, // ";" - shift(56), // regDefId + shift(57), // regDefId nil, // ignoredTokId nil, // "|" - shift(57), // "." - shift(58), // char_lit + shift(58), // "." + shift(59), // char_lit nil, // "-" - shift(59), // "~" - shift(60), // "(" + shift(60), // "~" + shift(61), // "(" nil, // ")" - shift(61), // "[" + shift(62), // "[" nil, // "]" - shift(62), // "{" + shift(63), // "{" nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S81 + actionRow{ // S82 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -2449,29 +2561,30 @@ var actionTab = actionTable{ nil, // tokId nil, // ":" nil, // ";" - shift(66), // regDefId + shift(67), // regDefId nil, // ignoredTokId nil, // "|" - shift(67), // "." - shift(68), // char_lit + shift(68), // "." + shift(69), // char_lit nil, // "-" - shift(69), // "~" - shift(70), // "(" + shift(70), // "~" + shift(71), // "(" nil, // ")" - shift(71), // "[" + shift(72), // "[" nil, // "]" - shift(72), // "{" + shift(73), // "{" nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S82 + actionRow{ // S83 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -2479,29 +2592,30 @@ var actionTab = actionTable{ nil, // tokId nil, // ":" nil, // ";" - shift(76), // regDefId + shift(77), // regDefId nil, // ignoredTokId nil, // "|" - shift(77), // "." - shift(78), // char_lit + shift(78), // "." + shift(79), // char_lit nil, // "-" - shift(79), // "~" - shift(80), // "(" + shift(80), // "~" + shift(81), // "(" nil, // ")" - shift(81), // "[" + shift(82), // "[" nil, // "]" - shift(82), // "{" + shift(83), // "{" nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S83 + actionRow{ // S84 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -2525,13 +2639,14 @@ var actionTab = actionTable{ reduce(8), // g_sdt_lit, reduce: LexProduction reduce(8), // prodId, reduce: LexProduction nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S84 + actionRow{ // S85 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -2555,13 +2670,14 @@ var actionTab = actionTable{ reduce(9), // g_sdt_lit, reduce: LexProduction reduce(9), // prodId, reduce: LexProduction nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S85 + actionRow{ // S86 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -2585,13 +2701,14 @@ var actionTab = actionTable{ nil, // g_sdt_lit reduce(28), // prodId, reduce: SyntaxProduction nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S86 + actionRow{ // S87 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -2615,13 +2732,14 @@ var actionTab = actionTable{ nil, // g_sdt_lit shift(41), // prodId shift(42), // string_lit - shift(43), // "error" - shift(44), // "λ" - shift(45), // "empty" - shift(46), // "ε" + shift(43), // "@" + shift(44), // "error" + shift(45), // "λ" + shift(46), // "empty" + shift(47), // "ε" }, }, - actionRow{ // S87 + actionRow{ // S88 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -2645,13 +2763,14 @@ var actionTab = actionTable{ reduce(39), // g_sdt_lit, reduce: Symbols reduce(39), // prodId, reduce: Symbols reduce(39), // string_lit, reduce: Symbols + reduce(39), // "@", reduce: Symbols nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S88 + actionRow{ // S89 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -2675,13 +2794,14 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S89 + actionRow{ // S90 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -2702,16 +2822,17 @@ var actionTab = actionTable{ nil, // "]" nil, // "{" nil, // "}" - shift(122), // g_sdt_lit + shift(124), // g_sdt_lit shift(41), // prodId shift(42), // string_lit + shift(43), // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S90 + actionRow{ // S91 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -2735,13 +2856,45 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S91 + actionRow{ // S92 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + reduce(43), // tokId, reduce: Symbol + nil, // ":" + reduce(43), // ";", reduce: Symbol + nil, // regDefId + nil, // ignoredTokId + reduce(43), // "|", reduce: Symbol + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + reduce(43), // g_sdt_lit, reduce: Symbol + reduce(43), // prodId, reduce: Symbol + reduce(43), // string_lit, reduce: Symbol + reduce(43), // "@", reduce: Symbol + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S93 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -2765,13 +2918,14 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S92 + actionRow{ // S94 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -2795,13 +2949,14 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S93 + actionRow{ // S95 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -2814,7 +2969,7 @@ var actionTab = actionTable{ nil, // "|" nil, // "." nil, // char_lit - shift(123), // "-" + shift(125), // "-" nil, // "~" nil, // "(" nil, // ")" @@ -2825,13 +2980,14 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S94 + actionRow{ // S96 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -2839,29 +2995,30 @@ var actionTab = actionTable{ nil, // tokId nil, // ":" nil, // ";" - shift(56), // regDefId + shift(57), // regDefId nil, // ignoredTokId nil, // "|" - shift(57), // "." - shift(58), // char_lit + shift(58), // "." + shift(59), // char_lit nil, // "-" - shift(59), // "~" - shift(60), // "(" + shift(60), // "~" + shift(61), // "(" nil, // ")" - shift(61), // "[" + shift(62), // "[" nil, // "]" - shift(62), // "{" + shift(63), // "{" nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S95 + actionRow{ // S97 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -2885,13 +3042,14 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S96 + actionRow{ // S98 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -2915,13 +3073,14 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S97 + actionRow{ // S99 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -2933,7 +3092,7 @@ var actionTab = actionTable{ nil, // ignoredTokId nil, // "|" nil, // "." - shift(125), // char_lit + shift(127), // char_lit nil, // "-" nil, // "~" nil, // "(" @@ -2945,13 +3104,14 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S98 + actionRow{ // S100 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -2975,13 +3135,14 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S99 + actionRow{ // S101 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -2993,7 +3154,7 @@ var actionTab = actionTable{ nil, // ignoredTokId nil, // "|" nil, // "." - shift(126), // char_lit + shift(128), // char_lit nil, // "-" nil, // "~" nil, // "(" @@ -3005,13 +3166,14 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S100 + actionRow{ // S102 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3021,13 +3183,13 @@ var actionTab = actionTable{ nil, // ";" nil, // regDefId nil, // ignoredTokId - shift(94), // "|" + shift(96), // "|" nil, // "." nil, // char_lit nil, // "-" nil, // "~" nil, // "(" - shift(127), // ")" + shift(129), // ")" nil, // "[" nil, // "]" nil, // "{" @@ -3035,13 +3197,14 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S101 + actionRow{ // S103 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3051,7 +3214,7 @@ var actionTab = actionTable{ nil, // ";" nil, // regDefId nil, // ignoredTokId - shift(103), // "|" + shift(105), // "|" nil, // "." nil, // char_lit nil, // "-" @@ -3059,19 +3222,20 @@ var actionTab = actionTable{ nil, // "(" nil, // ")" nil, // "[" - shift(128), // "]" + shift(130), // "]" nil, // "{" nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S102 + actionRow{ // S104 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3081,7 +3245,7 @@ var actionTab = actionTable{ nil, // ";" nil, // regDefId nil, // ignoredTokId - shift(112), // "|" + shift(114), // "|" nil, // "." nil, // char_lit nil, // "-" @@ -3091,17 +3255,18 @@ var actionTab = actionTable{ nil, // "[" nil, // "]" nil, // "{" - shift(129), // "}" + shift(131), // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S103 + actionRow{ // S105 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3109,29 +3274,30 @@ var actionTab = actionTable{ nil, // tokId nil, // ":" nil, // ";" - shift(66), // regDefId + shift(67), // regDefId nil, // ignoredTokId nil, // "|" - shift(67), // "." - shift(68), // char_lit + shift(68), // "." + shift(69), // char_lit nil, // "-" - shift(69), // "~" - shift(70), // "(" + shift(70), // "~" + shift(71), // "(" nil, // ")" - shift(71), // "[" + shift(72), // "[" nil, // "]" - shift(72), // "{" + shift(73), // "{" nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S104 + actionRow{ // S106 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3155,13 +3321,14 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S105 + actionRow{ // S107 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3185,13 +3352,14 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S106 + actionRow{ // S108 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3203,7 +3371,7 @@ var actionTab = actionTable{ nil, // ignoredTokId nil, // "|" nil, // "." - shift(131), // char_lit + shift(133), // char_lit nil, // "-" nil, // "~" nil, // "(" @@ -3215,13 +3383,14 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S107 + actionRow{ // S109 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3245,13 +3414,14 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S108 + actionRow{ // S110 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3263,7 +3433,7 @@ var actionTab = actionTable{ nil, // ignoredTokId nil, // "|" nil, // "." - shift(132), // char_lit + shift(134), // char_lit nil, // "-" nil, // "~" nil, // "(" @@ -3275,13 +3445,14 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S109 + actionRow{ // S111 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3291,13 +3462,13 @@ var actionTab = actionTable{ nil, // ";" nil, // regDefId nil, // ignoredTokId - shift(94), // "|" + shift(96), // "|" nil, // "." nil, // char_lit nil, // "-" nil, // "~" nil, // "(" - shift(133), // ")" + shift(135), // ")" nil, // "[" nil, // "]" nil, // "{" @@ -3305,13 +3476,14 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S110 + actionRow{ // S112 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3321,7 +3493,7 @@ var actionTab = actionTable{ nil, // ";" nil, // regDefId nil, // ignoredTokId - shift(103), // "|" + shift(105), // "|" nil, // "." nil, // char_lit nil, // "-" @@ -3329,19 +3501,20 @@ var actionTab = actionTable{ nil, // "(" nil, // ")" nil, // "[" - shift(134), // "]" + shift(136), // "]" nil, // "{" nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S111 + actionRow{ // S113 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3351,7 +3524,7 @@ var actionTab = actionTable{ nil, // ";" nil, // regDefId nil, // ignoredTokId - shift(112), // "|" + shift(114), // "|" nil, // "." nil, // char_lit nil, // "-" @@ -3361,17 +3534,18 @@ var actionTab = actionTable{ nil, // "[" nil, // "]" nil, // "{" - shift(135), // "}" + shift(137), // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S112 + actionRow{ // S114 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3379,29 +3553,30 @@ var actionTab = actionTable{ nil, // tokId nil, // ":" nil, // ";" - shift(76), // regDefId + shift(77), // regDefId nil, // ignoredTokId nil, // "|" - shift(77), // "." - shift(78), // char_lit + shift(78), // "." + shift(79), // char_lit nil, // "-" - shift(79), // "~" - shift(80), // "(" + shift(80), // "~" + shift(81), // "(" nil, // ")" - shift(81), // "[" + shift(82), // "[" nil, // "]" - shift(82), // "{" + shift(83), // "{" nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S113 + actionRow{ // S115 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3425,13 +3600,14 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S114 + actionRow{ // S116 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3455,13 +3631,14 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S115 + actionRow{ // S117 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3473,7 +3650,7 @@ var actionTab = actionTable{ nil, // ignoredTokId nil, // "|" nil, // "." - shift(137), // char_lit + shift(139), // char_lit nil, // "-" nil, // "~" nil, // "(" @@ -3485,13 +3662,14 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S116 + actionRow{ // S118 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3515,13 +3693,14 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S117 + actionRow{ // S119 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3533,7 +3712,7 @@ var actionTab = actionTable{ nil, // ignoredTokId nil, // "|" nil, // "." - shift(138), // char_lit + shift(140), // char_lit nil, // "-" nil, // "~" nil, // "(" @@ -3545,13 +3724,14 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S118 + actionRow{ // S120 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3561,13 +3741,13 @@ var actionTab = actionTable{ nil, // ";" nil, // regDefId nil, // ignoredTokId - shift(94), // "|" + shift(96), // "|" nil, // "." nil, // char_lit nil, // "-" nil, // "~" nil, // "(" - shift(139), // ")" + shift(141), // ")" nil, // "[" nil, // "]" nil, // "{" @@ -3575,13 +3755,14 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S119 + actionRow{ // S121 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3591,7 +3772,7 @@ var actionTab = actionTable{ nil, // ";" nil, // regDefId nil, // ignoredTokId - shift(103), // "|" + shift(105), // "|" nil, // "." nil, // char_lit nil, // "-" @@ -3599,19 +3780,20 @@ var actionTab = actionTable{ nil, // "(" nil, // ")" nil, // "[" - shift(140), // "]" + shift(142), // "]" nil, // "{" nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S120 + actionRow{ // S122 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3621,7 +3803,7 @@ var actionTab = actionTable{ nil, // ";" nil, // regDefId nil, // ignoredTokId - shift(112), // "|" + shift(114), // "|" nil, // "." nil, // char_lit nil, // "-" @@ -3631,17 +3813,18 @@ var actionTab = actionTable{ nil, // "[" nil, // "]" nil, // "{" - shift(141), // "}" + shift(143), // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S121 + actionRow{ // S123 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3665,13 +3848,14 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S122 + actionRow{ // S124 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3695,13 +3879,14 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S123 + actionRow{ // S125 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3713,7 +3898,7 @@ var actionTab = actionTable{ nil, // ignoredTokId nil, // "|" nil, // "." - shift(142), // char_lit + shift(144), // char_lit nil, // "-" nil, // "~" nil, // "(" @@ -3725,13 +3910,14 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S124 + actionRow{ // S126 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3739,29 +3925,30 @@ var actionTab = actionTable{ nil, // tokId nil, // ":" nil, // ";" - shift(56), // regDefId + shift(57), // regDefId nil, // ignoredTokId reduce(11), // "|", reduce: LexPattern - shift(57), // "." - shift(58), // char_lit + shift(58), // "." + shift(59), // char_lit nil, // "-" - shift(59), // "~" - shift(60), // "(" + shift(60), // "~" + shift(61), // "(" reduce(11), // ")", reduce: LexPattern - shift(61), // "[" + shift(62), // "[" nil, // "]" - shift(62), // "{" + shift(63), // "{" nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S125 + actionRow{ // S127 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3785,13 +3972,14 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S126 + actionRow{ // S128 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3804,7 +3992,7 @@ var actionTab = actionTable{ nil, // "|" nil, // "." nil, // char_lit - shift(143), // "-" + shift(145), // "-" nil, // "~" nil, // "(" nil, // ")" @@ -3815,13 +4003,14 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S127 + actionRow{ // S129 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3845,13 +4034,14 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S128 + actionRow{ // S130 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3875,13 +4065,14 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S129 + actionRow{ // S131 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3905,13 +4096,14 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S130 + actionRow{ // S132 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3919,29 +4111,30 @@ var actionTab = actionTable{ nil, // tokId nil, // ":" nil, // ";" - shift(66), // regDefId + shift(67), // regDefId nil, // ignoredTokId reduce(11), // "|", reduce: LexPattern - shift(67), // "." - shift(68), // char_lit + shift(68), // "." + shift(69), // char_lit nil, // "-" - shift(69), // "~" - shift(70), // "(" + shift(70), // "~" + shift(71), // "(" nil, // ")" - shift(71), // "[" + shift(72), // "[" reduce(11), // "]", reduce: LexPattern - shift(72), // "{" + shift(73), // "{" nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S131 + actionRow{ // S133 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3965,13 +4158,14 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S132 + actionRow{ // S134 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3984,7 +4178,7 @@ var actionTab = actionTable{ nil, // "|" nil, // "." nil, // char_lit - shift(144), // "-" + shift(146), // "-" nil, // "~" nil, // "(" nil, // ")" @@ -3995,13 +4189,14 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S133 + actionRow{ // S135 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -4025,13 +4220,14 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S134 + actionRow{ // S136 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -4055,13 +4251,14 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S135 + actionRow{ // S137 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -4085,13 +4282,14 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S136 + actionRow{ // S138 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -4099,29 +4297,30 @@ var actionTab = actionTable{ nil, // tokId nil, // ":" nil, // ";" - shift(76), // regDefId + shift(77), // regDefId nil, // ignoredTokId reduce(11), // "|", reduce: LexPattern - shift(77), // "." - shift(78), // char_lit + shift(78), // "." + shift(79), // char_lit nil, // "-" - shift(79), // "~" - shift(80), // "(" + shift(80), // "~" + shift(81), // "(" nil, // ")" - shift(81), // "[" + shift(82), // "[" nil, // "]" - shift(82), // "{" + shift(83), // "{" reduce(11), // "}", reduce: LexPattern nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S137 + actionRow{ // S139 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -4145,13 +4344,14 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S138 + actionRow{ // S140 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -4164,7 +4364,7 @@ var actionTab = actionTable{ nil, // "|" nil, // "." nil, // char_lit - shift(145), // "-" + shift(147), // "-" nil, // "~" nil, // "(" nil, // ")" @@ -4175,13 +4375,14 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S139 + actionRow{ // S141 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -4205,13 +4406,14 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S140 + actionRow{ // S142 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -4235,13 +4437,14 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S141 + actionRow{ // S143 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -4265,13 +4468,14 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S142 + actionRow{ // S144 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -4287,7 +4491,7 @@ var actionTab = actionTable{ nil, // "-" nil, // "~" nil, // "(" - shift(146), // ")" + shift(148), // ")" nil, // "[" nil, // "]" nil, // "{" @@ -4295,13 +4499,14 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S143 + actionRow{ // S145 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -4313,7 +4518,7 @@ var actionTab = actionTable{ nil, // ignoredTokId nil, // "|" nil, // "." - shift(147), // char_lit + shift(149), // char_lit nil, // "-" nil, // "~" nil, // "(" @@ -4325,13 +4530,14 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S144 + actionRow{ // S146 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -4343,7 +4549,7 @@ var actionTab = actionTable{ nil, // ignoredTokId nil, // "|" nil, // "." - shift(148), // char_lit + shift(150), // char_lit nil, // "-" nil, // "~" nil, // "(" @@ -4355,13 +4561,14 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S145 + actionRow{ // S147 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -4373,7 +4580,7 @@ var actionTab = actionTable{ nil, // ignoredTokId nil, // "|" nil, // "." - shift(149), // char_lit + shift(151), // char_lit nil, // "-" nil, // "~" nil, // "(" @@ -4385,13 +4592,14 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S146 + actionRow{ // S148 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -4415,13 +4623,14 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S147 + actionRow{ // S149 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -4437,7 +4646,7 @@ var actionTab = actionTable{ nil, // "-" nil, // "~" nil, // "(" - shift(150), // ")" + shift(152), // ")" nil, // "[" nil, // "]" nil, // "{" @@ -4445,13 +4654,14 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S148 + actionRow{ // S150 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -4467,7 +4677,7 @@ var actionTab = actionTable{ nil, // "-" nil, // "~" nil, // "(" - shift(151), // ")" + shift(153), // ")" nil, // "[" nil, // "]" nil, // "{" @@ -4475,13 +4685,14 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S149 + actionRow{ // S151 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -4497,7 +4708,7 @@ var actionTab = actionTable{ nil, // "-" nil, // "~" nil, // "(" - shift(152), // ")" + shift(154), // ")" nil, // "[" nil, // "]" nil, // "{" @@ -4505,13 +4716,14 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S150 + actionRow{ // S152 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -4535,13 +4747,14 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S151 + actionRow{ // S153 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -4565,13 +4778,14 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" nil, // "ε" }, }, - actionRow{ // S152 + actionRow{ // S154 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -4595,6 +4809,7 @@ var actionTab = actionTable{ nil, // g_sdt_lit nil, // prodId nil, // string_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" diff --git a/internal/frontend/reparsed/internal/parser/gototable.go b/internal/frontend/reparsed/internal/parser/gototable.go index 6d28aaa3..ac307ebd 100644 --- a/internal/frontend/reparsed/internal/parser/gototable.go +++ b/internal/frontend/reparsed/internal/parser/gototable.go @@ -479,7 +479,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 49, // Π + 50, // Π -1, // Π -1, // Π -1, // Π @@ -597,9 +597,9 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 53, // Π - 54, // Π - 55, // Π + 54, // Π + 55, // Π + 56, // Π -1, // Π -1, // Π -1, // Π @@ -617,9 +617,9 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 63, // Π - 64, // Π - 65, // Π + 64, // Π + 65, // Π + 66, // Π -1, // Π -1, // Π -1, // Π @@ -637,9 +637,9 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 73, // Π - 74, // Π - 75, // Π + 74, // Π + 75, // Π + 76, // Π -1, // Π -1, // Π -1, // Π @@ -748,7 +748,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 87, // Π + 88, // Π }, gotoRow{ // S37 -1, // Π @@ -765,7 +765,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 89, // Π + 90, // Π -1, // Π -1, // Π 39, // Π @@ -978,8 +978,8 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 91, // Π - 24, // Π + -1, // Π + -1, // Π -1, // Π -1, // Π -1, // Π @@ -998,8 +998,8 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - -1, // Π - -1, // Π + 93, // Π + 24, // Π -1, // Π -1, // Π -1, // Π @@ -1099,7 +1099,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 96, // Π + -1, // Π -1, // Π -1, // Π -1, // Π @@ -1119,7 +1119,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - -1, // Π + 98, // Π -1, // Π -1, // Π -1, // Π @@ -1211,15 +1211,35 @@ var gotoTab = gotoTable{ -1, // Π }, gotoRow{ // S60 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S61 -1, // Π -1, // Π -1, // Π -1, // Π -1, // Π -1, // Π - 100, // Π - 54, // Π - 55, // Π + 102, // Π + 55, // Π + 56, // Π -1, // Π -1, // Π -1, // Π @@ -1230,16 +1250,16 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S61 + gotoRow{ // S62 -1, // Π -1, // Π -1, // Π -1, // Π -1, // Π -1, // Π - 101, // Π - 64, // Π - 65, // Π + 103, // Π + 65, // Π + 66, // Π -1, // Π -1, // Π -1, // Π @@ -1250,16 +1270,16 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S62 + gotoRow{ // S63 -1, // Π -1, // Π -1, // Π -1, // Π -1, // Π -1, // Π - 102, // Π - 74, // Π - 75, // Π + 104, // Π + 75, // Π + 76, // Π -1, // Π -1, // Π -1, // Π @@ -1270,7 +1290,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S63 + gotoRow{ // S64 -1, // Π -1, // Π -1, // Π @@ -1290,7 +1310,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S64 + gotoRow{ // S65 -1, // Π -1, // Π -1, // Π @@ -1299,7 +1319,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 105, // Π + 107, // Π -1, // Π -1, // Π -1, // Π @@ -1310,7 +1330,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S65 + gotoRow{ // S66 -1, // Π -1, // Π -1, // Π @@ -1330,7 +1350,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S66 + gotoRow{ // S67 -1, // Π -1, // Π -1, // Π @@ -1350,7 +1370,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S67 + gotoRow{ // S68 -1, // Π -1, // Π -1, // Π @@ -1370,7 +1390,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S68 + gotoRow{ // S69 -1, // Π -1, // Π -1, // Π @@ -1390,7 +1410,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S69 + gotoRow{ // S70 -1, // Π -1, // Π -1, // Π @@ -1410,16 +1430,16 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S70 + gotoRow{ // S71 -1, // Π -1, // Π -1, // Π -1, // Π -1, // Π -1, // Π - 109, // Π - 54, // Π - 55, // Π + 111, // Π + 55, // Π + 56, // Π -1, // Π -1, // Π -1, // Π @@ -1430,16 +1450,16 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S71 + gotoRow{ // S72 -1, // Π -1, // Π -1, // Π -1, // Π -1, // Π -1, // Π - 110, // Π - 64, // Π - 65, // Π + 112, // Π + 65, // Π + 66, // Π -1, // Π -1, // Π -1, // Π @@ -1450,16 +1470,16 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S72 + gotoRow{ // S73 -1, // Π -1, // Π -1, // Π -1, // Π -1, // Π -1, // Π - 111, // Π - 74, // Π - 75, // Π + 113, // Π + 75, // Π + 76, // Π -1, // Π -1, // Π -1, // Π @@ -1470,7 +1490,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S73 + gotoRow{ // S74 -1, // Π -1, // Π -1, // Π @@ -1490,7 +1510,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S74 + gotoRow{ // S75 -1, // Π -1, // Π -1, // Π @@ -1499,7 +1519,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 114, // Π + 116, // Π -1, // Π -1, // Π -1, // Π @@ -1510,7 +1530,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S75 + gotoRow{ // S76 -1, // Π -1, // Π -1, // Π @@ -1530,7 +1550,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S76 + gotoRow{ // S77 -1, // Π -1, // Π -1, // Π @@ -1550,7 +1570,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S77 + gotoRow{ // S78 -1, // Π -1, // Π -1, // Π @@ -1570,7 +1590,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S78 + gotoRow{ // S79 -1, // Π -1, // Π -1, // Π @@ -1590,7 +1610,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S79 + gotoRow{ // S80 -1, // Π -1, // Π -1, // Π @@ -1610,16 +1630,16 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S80 + gotoRow{ // S81 -1, // Π -1, // Π -1, // Π -1, // Π -1, // Π -1, // Π - 118, // Π - 54, // Π - 55, // Π + 120, // Π + 55, // Π + 56, // Π -1, // Π -1, // Π -1, // Π @@ -1630,16 +1650,16 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S81 + gotoRow{ // S82 -1, // Π -1, // Π -1, // Π -1, // Π -1, // Π -1, // Π - 119, // Π - 64, // Π - 65, // Π + 121, // Π + 65, // Π + 66, // Π -1, // Π -1, // Π -1, // Π @@ -1650,16 +1670,16 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S82 + gotoRow{ // S83 -1, // Π -1, // Π -1, // Π -1, // Π -1, // Π -1, // Π - 120, // Π - 74, // Π - 75, // Π + 122, // Π + 75, // Π + 76, // Π -1, // Π -1, // Π -1, // Π @@ -1670,7 +1690,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S83 + gotoRow{ // S84 -1, // Π -1, // Π -1, // Π @@ -1690,7 +1710,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S84 + gotoRow{ // S85 -1, // Π -1, // Π -1, // Π @@ -1710,7 +1730,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S85 + gotoRow{ // S86 -1, // Π -1, // Π -1, // Π @@ -1730,7 +1750,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S86 + gotoRow{ // S87 -1, // Π -1, // Π -1, // Π @@ -1744,13 +1764,13 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 121, // Π + 123, // Π 36, // Π 37, // Π 38, // Π 39, // Π }, - gotoRow{ // S87 + gotoRow{ // S88 -1, // Π -1, // Π -1, // Π @@ -1770,7 +1790,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S88 + gotoRow{ // S89 -1, // Π -1, // Π -1, // Π @@ -1790,7 +1810,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S89 + gotoRow{ // S90 -1, // Π -1, // Π -1, // Π @@ -1808,9 +1828,9 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 87, // Π + 88, // Π }, - gotoRow{ // S90 + gotoRow{ // S91 -1, // Π -1, // Π -1, // Π @@ -1830,7 +1850,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S91 + gotoRow{ // S92 -1, // Π -1, // Π -1, // Π @@ -1839,7 +1859,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 49, // Π + -1, // Π -1, // Π -1, // Π -1, // Π @@ -1850,7 +1870,27 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S92 + gotoRow{ // S93 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + 50, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S94 -1, // Π -1, // Π -1, // Π @@ -1870,7 +1910,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S93 + gotoRow{ // S95 -1, // Π -1, // Π -1, // Π @@ -1890,7 +1930,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S94 + gotoRow{ // S96 -1, // Π -1, // Π -1, // Π @@ -1898,8 +1938,8 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 124, // Π - 55, // Π + 126, // Π + 56, // Π -1, // Π -1, // Π -1, // Π @@ -1910,7 +1950,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S95 + gotoRow{ // S97 -1, // Π -1, // Π -1, // Π @@ -1930,7 +1970,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S96 + gotoRow{ // S98 -1, // Π -1, // Π -1, // Π @@ -1950,7 +1990,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S97 + gotoRow{ // S99 -1, // Π -1, // Π -1, // Π @@ -1970,7 +2010,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S98 + gotoRow{ // S100 -1, // Π -1, // Π -1, // Π @@ -1990,7 +2030,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S99 + gotoRow{ // S101 -1, // Π -1, // Π -1, // Π @@ -2010,7 +2050,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S100 + gotoRow{ // S102 -1, // Π -1, // Π -1, // Π @@ -2030,7 +2070,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S101 + gotoRow{ // S103 -1, // Π -1, // Π -1, // Π @@ -2050,7 +2090,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S102 + gotoRow{ // S104 -1, // Π -1, // Π -1, // Π @@ -2070,7 +2110,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S103 + gotoRow{ // S105 -1, // Π -1, // Π -1, // Π @@ -2078,8 +2118,8 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 130, // Π - 65, // Π + 132, // Π + 66, // Π -1, // Π -1, // Π -1, // Π @@ -2090,7 +2130,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S104 + gotoRow{ // S106 -1, // Π -1, // Π -1, // Π @@ -2110,7 +2150,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S105 + gotoRow{ // S107 -1, // Π -1, // Π -1, // Π @@ -2130,7 +2170,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S106 + gotoRow{ // S108 -1, // Π -1, // Π -1, // Π @@ -2150,7 +2190,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S107 + gotoRow{ // S109 -1, // Π -1, // Π -1, // Π @@ -2170,7 +2210,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S108 + gotoRow{ // S110 -1, // Π -1, // Π -1, // Π @@ -2190,7 +2230,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S109 + gotoRow{ // S111 -1, // Π -1, // Π -1, // Π @@ -2210,7 +2250,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S110 + gotoRow{ // S112 -1, // Π -1, // Π -1, // Π @@ -2230,7 +2270,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S111 + gotoRow{ // S113 -1, // Π -1, // Π -1, // Π @@ -2250,7 +2290,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S112 + gotoRow{ // S114 -1, // Π -1, // Π -1, // Π @@ -2258,8 +2298,8 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 136, // Π - 75, // Π + 138, // Π + 76, // Π -1, // Π -1, // Π -1, // Π @@ -2270,7 +2310,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S113 + gotoRow{ // S115 -1, // Π -1, // Π -1, // Π @@ -2290,7 +2330,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S114 + gotoRow{ // S116 -1, // Π -1, // Π -1, // Π @@ -2310,7 +2350,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S115 + gotoRow{ // S117 -1, // Π -1, // Π -1, // Π @@ -2330,7 +2370,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S116 + gotoRow{ // S118 -1, // Π -1, // Π -1, // Π @@ -2350,7 +2390,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S117 + gotoRow{ // S119 -1, // Π -1, // Π -1, // Π @@ -2370,7 +2410,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S118 + gotoRow{ // S120 -1, // Π -1, // Π -1, // Π @@ -2390,7 +2430,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S119 + gotoRow{ // S121 -1, // Π -1, // Π -1, // Π @@ -2410,7 +2450,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S120 + gotoRow{ // S122 -1, // Π -1, // Π -1, // Π @@ -2430,7 +2470,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S121 + gotoRow{ // S123 -1, // Π -1, // Π -1, // Π @@ -2450,7 +2490,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S122 + gotoRow{ // S124 -1, // Π -1, // Π -1, // Π @@ -2470,7 +2510,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S123 + gotoRow{ // S125 -1, // Π -1, // Π -1, // Π @@ -2490,7 +2530,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S124 + gotoRow{ // S126 -1, // Π -1, // Π -1, // Π @@ -2499,7 +2539,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 96, // Π + 98, // Π -1, // Π -1, // Π -1, // Π @@ -2510,7 +2550,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S125 + gotoRow{ // S127 -1, // Π -1, // Π -1, // Π @@ -2530,7 +2570,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S126 + gotoRow{ // S128 -1, // Π -1, // Π -1, // Π @@ -2550,7 +2590,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S127 + gotoRow{ // S129 -1, // Π -1, // Π -1, // Π @@ -2570,7 +2610,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S128 + gotoRow{ // S130 -1, // Π -1, // Π -1, // Π @@ -2590,7 +2630,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S129 + gotoRow{ // S131 -1, // Π -1, // Π -1, // Π @@ -2610,7 +2650,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S130 + gotoRow{ // S132 -1, // Π -1, // Π -1, // Π @@ -2619,7 +2659,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 105, // Π + 107, // Π -1, // Π -1, // Π -1, // Π @@ -2630,7 +2670,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S131 + gotoRow{ // S133 -1, // Π -1, // Π -1, // Π @@ -2650,7 +2690,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S132 + gotoRow{ // S134 -1, // Π -1, // Π -1, // Π @@ -2670,7 +2710,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S133 + gotoRow{ // S135 -1, // Π -1, // Π -1, // Π @@ -2690,7 +2730,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S134 + gotoRow{ // S136 -1, // Π -1, // Π -1, // Π @@ -2710,7 +2750,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S135 + gotoRow{ // S137 -1, // Π -1, // Π -1, // Π @@ -2730,7 +2770,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S136 + gotoRow{ // S138 -1, // Π -1, // Π -1, // Π @@ -2739,7 +2779,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 114, // Π + 116, // Π -1, // Π -1, // Π -1, // Π @@ -2750,7 +2790,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S137 + gotoRow{ // S139 -1, // Π -1, // Π -1, // Π @@ -2770,7 +2810,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S138 + gotoRow{ // S140 -1, // Π -1, // Π -1, // Π @@ -2790,7 +2830,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S139 + gotoRow{ // S141 -1, // Π -1, // Π -1, // Π @@ -2810,7 +2850,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S140 + gotoRow{ // S142 -1, // Π -1, // Π -1, // Π @@ -2830,7 +2870,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S141 + gotoRow{ // S143 -1, // Π -1, // Π -1, // Π @@ -2850,7 +2890,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S142 + gotoRow{ // S144 -1, // Π -1, // Π -1, // Π @@ -2870,7 +2910,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S143 + gotoRow{ // S145 -1, // Π -1, // Π -1, // Π @@ -2890,7 +2930,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S144 + gotoRow{ // S146 -1, // Π -1, // Π -1, // Π @@ -2910,7 +2950,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S145 + gotoRow{ // S147 -1, // Π -1, // Π -1, // Π @@ -2930,7 +2970,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S146 + gotoRow{ // S148 -1, // Π -1, // Π -1, // Π @@ -2950,7 +2990,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S147 + gotoRow{ // S149 -1, // Π -1, // Π -1, // Π @@ -2970,7 +3010,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S148 + gotoRow{ // S150 -1, // Π -1, // Π -1, // Π @@ -2990,7 +3030,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S149 + gotoRow{ // S151 -1, // Π -1, // Π -1, // Π @@ -3010,7 +3050,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S150 + gotoRow{ // S152 -1, // Π -1, // Π -1, // Π @@ -3030,7 +3070,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S151 + gotoRow{ // S153 -1, // Π -1, // Π -1, // Π @@ -3050,7 +3090,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S152 + gotoRow{ // S154 -1, // Π -1, // Π -1, // Π diff --git a/internal/frontend/reparsed/internal/parser/next/actiontable.go b/internal/frontend/reparsed/internal/parser/next/actiontable.go index 6dfb93f3..8baba045 100644 --- a/internal/frontend/reparsed/internal/parser/next/actiontable.go +++ b/internal/frontend/reparsed/internal/parser/next/actiontable.go @@ -5,8 +5,9 @@ package parser type ( actionTable [numStates]actionRow actionRow struct { - canRecover bool - actions [numSymbols]action + canRecover bool + actions [numSymbols]action + contextDependentTokens []int } ) diff --git a/internal/frontend/reparsed/internal/parser/next/parser.go b/internal/frontend/reparsed/internal/parser/next/parser.go index f75ad59d..21440199 100644 --- a/internal/frontend/reparsed/internal/parser/next/parser.go +++ b/internal/frontend/reparsed/internal/parser/next/parser.go @@ -23,12 +23,12 @@ type stack struct { attrib []Attrib } -const iNITIAL_STACK_SIZE = 100 +const INITIAL_STACK_SIZE = 100 func newStack() *stack { return &stack{ - state: make([]int, 0, iNITIAL_STACK_SIZE), - attrib: make([]Attrib, 0, iNITIAL_STACK_SIZE), + state: make([]int, 0, INITIAL_STACK_SIZE), + attrib: make([]Attrib, 0, INITIAL_STACK_SIZE), } } @@ -94,10 +94,18 @@ type Parser struct { UserContext interface{} } +type scannerPosition interface{} + type Scanner interface { Scan() (tok *token.Token) } +type ContextDependentScanner interface { + Scanner + SavePosition() scannerPosition + RestorePosition() scannerPosition +} + func NewParser() *Parser { p := &Parser{stack: newStack()} p.Reset() @@ -179,7 +187,7 @@ func (p *Parser) newError(err error) error { return e } -func (p *Parser) Parse(scanner Scanner) (res interface{}, err error) { +func (p *Parser) parse(scanner Scanner) (res interface{}, err error) { p.Reset() p.nextToken = scanner.Scan() for acc := false; !acc; { @@ -215,3 +223,7 @@ func (p *Parser) Parse(scanner Scanner) (res interface{}, err error) { } return res, nil } + +func (p *Parser) Parse(scanner Scanner) (res interface{}, err error) { + return p.parse(scanner) +} diff --git a/internal/frontend/reparsed/internal/parser/parser.go b/internal/frontend/reparsed/internal/parser/parser.go index 70b713c3..1971d903 100644 --- a/internal/frontend/reparsed/internal/parser/parser.go +++ b/internal/frontend/reparsed/internal/parser/parser.go @@ -11,9 +11,9 @@ import ( ) const ( - numProductions = 47 - numStates = 153 - numSymbols = 43 + numProductions = 48 + numStates = 155 + numSymbols = 44 ) // Stack @@ -23,12 +23,12 @@ type stack struct { attrib []Attrib } -const iNITIAL_STACK_SIZE = 100 +const INITIAL_STACK_SIZE = 100 func newStack() *stack { return &stack{ - state: make([]int, 0, iNITIAL_STACK_SIZE), - attrib: make([]Attrib, 0, iNITIAL_STACK_SIZE), + state: make([]int, 0, INITIAL_STACK_SIZE), + attrib: make([]Attrib, 0, INITIAL_STACK_SIZE), } } @@ -90,16 +90,28 @@ func (s *stack) String() string { type Parser struct { stack *stack nextToken *token.Token - pos int - UserContext interface{} + userContext interface{} + longest bool } type Scanner interface { Scan() (tok *token.Token) } +type Position interface{} + +type ContextDependentScanner interface { + Scanner + Reposition(p Position) + CurrentPosition() Position +} + func NewParser() *Parser { - p := &Parser{stack: newStack()} + return NewParserWithContext(nil) +} + +func NewParserWithContext(u interface{}) *Parser { + p := &Parser{stack: newStack(), userContext: u } p.Reset() return p } @@ -180,11 +192,27 @@ func (p *Parser) newError(err error) error { } func (p *Parser) Parse(scanner Scanner) (res interface{}, err error) { + p.longest = false + return p.parse(scanner) +} + +func (p *Parser) ParseLongestPrefix(scanner Scanner) (res interface{}, err error, parsed []byte) { + p.longest = true + r, e := p.parse(scanner) + return r, e, []byte{} +} + +func (p *Parser) parse(scanner Scanner) (res interface{}, err error) { p.Reset() p.nextToken = scanner.Scan() for acc := false; !acc; { action := actionTab[p.stack.top()].actions[p.nextToken.Type] + if action == nil { + + if p.longest { + } + if recovered, errAttrib := p.Error(nil, scanner); !recovered { p.nextToken = errAttrib.ErrorToken return nil, p.newError(nil) @@ -203,7 +231,7 @@ func (p *Parser) Parse(scanner Scanner) (res interface{}, err error) { p.nextToken = scanner.Scan() case reduce: prod := productionsTable[int(act)] - attrib, err := prod.ReduceFunc(p.stack.popN(prod.NumSymbols)) + attrib, err := prod.ReduceFunc(p.userContext, p.stack.popN(prod.NumSymbols)) if err != nil { return nil, p.newError(err) } else { diff --git a/internal/frontend/reparsed/internal/parser/productionstable.go b/internal/frontend/reparsed/internal/parser/productionstable.go index eec97f19..10c79494 100644 --- a/internal/frontend/reparsed/internal/parser/productionstable.go +++ b/internal/frontend/reparsed/internal/parser/productionstable.go @@ -15,7 +15,7 @@ type ( NTType int Index int NumSymbols int - ReduceFunc func([]Attrib) (Attrib, error) + ReduceFunc func(interface{}, []Attrib) (Attrib, error) } Attrib interface { } @@ -28,7 +28,7 @@ var productionsTable = ProdTab{ NTType: 0, Index: 0, NumSymbols: 1, - ReduceFunc: func(X []Attrib) (Attrib, error) { + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { return X[0], nil }, }, @@ -38,7 +38,7 @@ var productionsTable = ProdTab{ NTType: 1, Index: 1, NumSymbols: 2, - ReduceFunc: func(X []Attrib) (Attrib, error) { + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { return ast.NewGrammar(X[0], X[1]) }, }, @@ -48,7 +48,7 @@ var productionsTable = ProdTab{ NTType: 1, Index: 2, NumSymbols: 1, - ReduceFunc: func(X []Attrib) (Attrib, error) { + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { return ast.NewGrammar(X[0], nil) }, }, @@ -58,7 +58,7 @@ var productionsTable = ProdTab{ NTType: 1, Index: 3, NumSymbols: 1, - ReduceFunc: func(X []Attrib) (Attrib, error) { + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { return ast.NewGrammar(nil, X[0]) }, }, @@ -68,7 +68,7 @@ var productionsTable = ProdTab{ NTType: 2, Index: 4, NumSymbols: 1, - ReduceFunc: func(X []Attrib) (Attrib, error) { + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { return ast.NewLexPart(nil, nil, X[0]) }, }, @@ -78,7 +78,7 @@ var productionsTable = ProdTab{ NTType: 4, Index: 5, NumSymbols: 1, - ReduceFunc: func(X []Attrib) (Attrib, error) { + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { return ast.NewLexProductions(X[0]) }, }, @@ -88,7 +88,7 @@ var productionsTable = ProdTab{ NTType: 4, Index: 6, NumSymbols: 2, - ReduceFunc: func(X []Attrib) (Attrib, error) { + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { return ast.AppendLexProduction(X[0], X[1]) }, }, @@ -98,7 +98,7 @@ var productionsTable = ProdTab{ NTType: 5, Index: 7, NumSymbols: 4, - ReduceFunc: func(X []Attrib) (Attrib, error) { + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { return ast.NewLexTokDef(X[0], X[2]) }, }, @@ -108,7 +108,7 @@ var productionsTable = ProdTab{ NTType: 5, Index: 8, NumSymbols: 4, - ReduceFunc: func(X []Attrib) (Attrib, error) { + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { return ast.NewLexRegDef(X[0], X[2]) }, }, @@ -118,7 +118,7 @@ var productionsTable = ProdTab{ NTType: 5, Index: 9, NumSymbols: 4, - ReduceFunc: func(X []Attrib) (Attrib, error) { + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { return ast.NewLexIgnoredTokDef(X[0], X[2]) }, }, @@ -128,7 +128,7 @@ var productionsTable = ProdTab{ NTType: 6, Index: 10, NumSymbols: 1, - ReduceFunc: func(X []Attrib) (Attrib, error) { + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { return ast.NewLexPattern(X[0]) }, }, @@ -138,7 +138,7 @@ var productionsTable = ProdTab{ NTType: 6, Index: 11, NumSymbols: 3, - ReduceFunc: func(X []Attrib) (Attrib, error) { + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { return ast.AppendLexAlt(X[0], X[2]) }, }, @@ -148,7 +148,7 @@ var productionsTable = ProdTab{ NTType: 7, Index: 12, NumSymbols: 1, - ReduceFunc: func(X []Attrib) (Attrib, error) { + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { return ast.NewLexAlt(X[0]) }, }, @@ -158,7 +158,7 @@ var productionsTable = ProdTab{ NTType: 7, Index: 13, NumSymbols: 2, - ReduceFunc: func(X []Attrib) (Attrib, error) { + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { return ast.AppendLexTerm(X[0], X[1]) }, }, @@ -168,7 +168,7 @@ var productionsTable = ProdTab{ NTType: 8, Index: 14, NumSymbols: 1, - ReduceFunc: func(X []Attrib) (Attrib, error) { + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { return ast.LexDOT, nil }, }, @@ -178,7 +178,7 @@ var productionsTable = ProdTab{ NTType: 8, Index: 15, NumSymbols: 1, - ReduceFunc: func(X []Attrib) (Attrib, error) { + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { return ast.NewLexCharLitExt(X[0],false) }, }, @@ -188,7 +188,7 @@ var productionsTable = ProdTab{ NTType: 8, Index: 16, NumSymbols: 3, - ReduceFunc: func(X []Attrib) (Attrib, error) { + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { return ast.NewLexCharRangeExt(X[0], X[2],false) }, }, @@ -198,7 +198,7 @@ var productionsTable = ProdTab{ NTType: 8, Index: 17, NumSymbols: 2, - ReduceFunc: func(X []Attrib) (Attrib, error) { + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { return ast.NewLexCharLitExt(X[0], true) }, }, @@ -208,7 +208,7 @@ var productionsTable = ProdTab{ NTType: 8, Index: 18, NumSymbols: 6, - ReduceFunc: func(X []Attrib) (Attrib, error) { + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { return ast.NewLexCharRangeExt(X[2], X[4], true) }, }, @@ -218,7 +218,7 @@ var productionsTable = ProdTab{ NTType: 8, Index: 19, NumSymbols: 1, - ReduceFunc: func(X []Attrib) (Attrib, error) { + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { return ast.NewLexRegDefId(X[0]) }, }, @@ -228,7 +228,7 @@ var productionsTable = ProdTab{ NTType: 8, Index: 20, NumSymbols: 3, - ReduceFunc: func(X []Attrib) (Attrib, error) { + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { return ast.NewLexOptPattern(X[1]) }, }, @@ -238,7 +238,7 @@ var productionsTable = ProdTab{ NTType: 8, Index: 21, NumSymbols: 3, - ReduceFunc: func(X []Attrib) (Attrib, error) { + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { return ast.NewLexRepPattern(X[1]) }, }, @@ -248,7 +248,7 @@ var productionsTable = ProdTab{ NTType: 8, Index: 22, NumSymbols: 3, - ReduceFunc: func(X []Attrib) (Attrib, error) { + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { return ast.NewLexGroupPattern(X[1]) }, }, @@ -258,7 +258,7 @@ var productionsTable = ProdTab{ NTType: 3, Index: 23, NumSymbols: 2, - ReduceFunc: func(X []Attrib) (Attrib, error) { + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { return ast.NewSyntaxPart(X[0], X[1]) }, }, @@ -268,7 +268,7 @@ var productionsTable = ProdTab{ NTType: 3, Index: 24, NumSymbols: 1, - ReduceFunc: func(X []Attrib) (Attrib, error) { + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { return ast.NewSyntaxPart(nil, X[0]) }, }, @@ -278,7 +278,7 @@ var productionsTable = ProdTab{ NTType: 9, Index: 25, NumSymbols: 1, - ReduceFunc: func(X []Attrib) (Attrib, error) { + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { return ast.NewFileHeader(X[0]) }, }, @@ -288,7 +288,7 @@ var productionsTable = ProdTab{ NTType: 10, Index: 26, NumSymbols: 1, - ReduceFunc: func(X []Attrib) (Attrib, error) { + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { return ast.NewSyntaxProdList(X[0]) }, }, @@ -298,7 +298,7 @@ var productionsTable = ProdTab{ NTType: 10, Index: 27, NumSymbols: 2, - ReduceFunc: func(X []Attrib) (Attrib, error) { + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { return ast.AddSyntaxProds(X[0], X[1]) }, }, @@ -308,7 +308,7 @@ var productionsTable = ProdTab{ NTType: 11, Index: 28, NumSymbols: 4, - ReduceFunc: func(X []Attrib) (Attrib, error) { + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { return ast.NewSyntaxProd(X[0], X[2]) }, }, @@ -318,7 +318,7 @@ var productionsTable = ProdTab{ NTType: 12, Index: 29, NumSymbols: 1, - ReduceFunc: func(X []Attrib) (Attrib, error) { + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { return ast.NewSyntaxAlts(X[0]) }, }, @@ -328,7 +328,7 @@ var productionsTable = ProdTab{ NTType: 12, Index: 30, NumSymbols: 3, - ReduceFunc: func(X []Attrib) (Attrib, error) { + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { return ast.AddSyntaxAlt(X[0], X[2]) }, }, @@ -338,7 +338,7 @@ var productionsTable = ProdTab{ NTType: 13, Index: 31, NumSymbols: 1, - ReduceFunc: func(X []Attrib) (Attrib, error) { + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { return ast.NewSyntaxBodyGen(X[0], nil) }, }, @@ -348,7 +348,7 @@ var productionsTable = ProdTab{ NTType: 13, Index: 32, NumSymbols: 2, - ReduceFunc: func(X []Attrib) (Attrib, error) { + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { return ast.NewSyntaxBodyGen(X[0], X[1]) }, }, @@ -358,7 +358,7 @@ var productionsTable = ProdTab{ NTType: 13, Index: 33, NumSymbols: 1, - ReduceFunc: func(X []Attrib) (Attrib, error) { + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { return ast.NewErrorBodyGen(nil, nil) }, }, @@ -368,7 +368,7 @@ var productionsTable = ProdTab{ NTType: 13, Index: 34, NumSymbols: 2, - ReduceFunc: func(X []Attrib) (Attrib, error) { + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { return ast.NewErrorBodyGen(X[1], nil) }, }, @@ -378,7 +378,7 @@ var productionsTable = ProdTab{ NTType: 13, Index: 35, NumSymbols: 3, - ReduceFunc: func(X []Attrib) (Attrib, error) { + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { return ast.NewErrorBodyGen(X[1], X[2]) }, }, @@ -388,7 +388,7 @@ var productionsTable = ProdTab{ NTType: 13, Index: 36, NumSymbols: 2, - ReduceFunc: func(X []Attrib) (Attrib, error) { + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { return ast.NewErrorBodyGen(nil, X[1]) }, }, @@ -398,7 +398,7 @@ var productionsTable = ProdTab{ NTType: 13, Index: 37, NumSymbols: 1, - ReduceFunc: func(X []Attrib) (Attrib, error) { + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { return ast.NewEmptyBodyGen() }, }, @@ -408,7 +408,7 @@ var productionsTable = ProdTab{ NTType: 14, Index: 38, NumSymbols: 1, - ReduceFunc: func(X []Attrib) (Attrib, error) { + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { return ast.NewSyntaxSymbols(X[0]) }, }, @@ -418,7 +418,7 @@ var productionsTable = ProdTab{ NTType: 14, Index: 39, NumSymbols: 2, - ReduceFunc: func(X []Attrib) (Attrib, error) { + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { return ast.AddSyntaxSymbol(X[0], X[1]) }, }, @@ -428,7 +428,7 @@ var productionsTable = ProdTab{ NTType: 17, Index: 40, NumSymbols: 1, - ReduceFunc: func(X []Attrib) (Attrib, error) { + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { return ast.NewSyntaxProdId(X[0]) }, }, @@ -438,7 +438,7 @@ var productionsTable = ProdTab{ NTType: 17, Index: 41, NumSymbols: 1, - ReduceFunc: func(X []Attrib) (Attrib, error) { + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { return ast.NewTokId(X[0]) }, }, @@ -448,17 +448,27 @@ var productionsTable = ProdTab{ NTType: 17, Index: 42, NumSymbols: 1, - ReduceFunc: func(X []Attrib) (Attrib, error) { + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { return ast.NewStringLit(X[0]) }, }, + ProdTabEntry{ + String: `Symbol : Λ<@> tokId << ast.NewContextDependentTokId(X[1]) >>`, + Id: "Symbol", + NTType: 17, + Index: 43, + NumSymbols: 2, + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { + return ast.NewContextDependentTokId(X[1]) + }, + }, ProdTabEntry{ String: `ErrorSymbol : Λ << >>`, Id: "ErrorSymbol", NTType: 15, - Index: 43, + Index: 44, NumSymbols: 1, - ReduceFunc: func(X []Attrib) (Attrib, error) { + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { return X[0], nil }, }, @@ -466,9 +476,9 @@ var productionsTable = ProdTab{ String: `ErrorSymbol : Λ<λ> << >>`, Id: "ErrorSymbol", NTType: 15, - Index: 44, + Index: 45, NumSymbols: 1, - ReduceFunc: func(X []Attrib) (Attrib, error) { + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { return X[0], nil }, }, @@ -476,9 +486,9 @@ var productionsTable = ProdTab{ String: `EpsilonSymbol : Λ << >>`, Id: "EpsilonSymbol", NTType: 16, - Index: 45, + Index: 46, NumSymbols: 1, - ReduceFunc: func(X []Attrib) (Attrib, error) { + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { return X[0], nil }, }, @@ -486,9 +496,9 @@ var productionsTable = ProdTab{ String: `EpsilonSymbol : Λ<ε> << >>`, Id: "EpsilonSymbol", NTType: 16, - Index: 46, + Index: 47, NumSymbols: 1, - ReduceFunc: func(X []Attrib) (Attrib, error) { + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { return X[0], nil }, }, diff --git a/internal/frontend/reparsed/internal/token/token.go b/internal/frontend/reparsed/internal/token/token.go index 1c9b8ce9..96b79347 100644 --- a/internal/frontend/reparsed/internal/token/token.go +++ b/internal/frontend/reparsed/internal/token/token.go @@ -6,18 +6,12 @@ import ( "fmt" ) -type UserContext interface{} - -type ParseContext struct { - Remaining []byte -} - type Token struct { Type Lit []byte Pos - Context *ParseContext - User UserContext + ForeingAstNode interface{} + ForeingAstError error } type Type int @@ -37,6 +31,20 @@ func (p Pos) String() string { return fmt.Sprintf("Pos(offset=%d, line=%d, column=%d)", p.Offset, p.Line, p.Column) } +func (p Pos) StartingFrom(base Pos) Pos { + r := base + r.Offset += p.Offset + r.Line += p.Line + r.Column = p.Column + if p.Line > 0 && base.Line > 0 { + r.Line-- + } + if r.Column < 1 { + r.Column = 1 + } + return r +} + type TokenMap struct { typeMap []string idMap map[string]Type @@ -57,8 +65,7 @@ func (m TokenMap) Type(tok string) Type { } func (m TokenMap) TokenString(tok *Token) string { - //TODO: refactor to print pos & token string properly - return fmt.Sprintf("%s(%d,%s)", m.Id(tok.Type), tok.Type, tok.Lit) + return fmt.Sprintf("%s(%d,<%s>)", m.Id(tok.Type), tok.Type, tok.Lit) } func (m TokenMap) StringType(typ Type) string { @@ -88,6 +95,7 @@ var TokMap = TokenMap{ "g_sdt_lit", "prodId", "string_lit", + "Λ<@>", "Λ", "Λ<λ>", "Λ", @@ -116,9 +124,10 @@ var TokMap = TokenMap{ "g_sdt_lit": 18, "prodId": 19, "string_lit": 20, - "Λ": 21, - "Λ<λ>": 22, - "Λ": 23, - "Λ<ε>": 24, + "Λ<@>": 21, + "Λ": 22, + "Λ<λ>": 23, + "Λ": 24, + "Λ<ε>": 25, }, } diff --git a/internal/frontend/reparsed/log/LR1_sets.txt b/internal/frontend/reparsed/log/LR1_sets.txt index 82a14c89..b25faeae 100644 --- a/internal/frontend/reparsed/log/LR1_sets.txt +++ b/internal/frontend/reparsed/log/LR1_sets.txt @@ -655,9 +655,11 @@ S21{ Symbols : •Π Π «g_sdt_lit» ErrorSymbol : •Λ «";"» ErrorSymbol : •Λ<λ> «";"» + ErrorSymbol : •Λ «"@"» ErrorSymbol : •Λ «prodId» ErrorSymbol : •Λ «string_lit» ErrorSymbol : •Λ «tokId» + ErrorSymbol : •Λ<λ> «"@"» ErrorSymbol : •Λ<λ> «prodId» ErrorSymbol : •Λ<λ> «string_lit» ErrorSymbol : •Λ<λ> «tokId» @@ -675,33 +677,45 @@ S21{ Symbol : •prodId «";"» Symbol : •tokId «";"» Symbol : •string_lit «";"» + Symbol : •Λ<@> tokId «";"» + Symbols : •Π «"@"» Symbols : •Π «prodId» Symbols : •Π «string_lit» Symbols : •Π «tokId» + Symbols : •Π Π «"@"» Symbols : •Π Π «prodId» Symbols : •Π Π «string_lit» Symbols : •Π Π «tokId» Symbol : •prodId «g_sdt_lit» Symbol : •tokId «g_sdt_lit» Symbol : •string_lit «g_sdt_lit» + Symbol : •Λ<@> tokId «g_sdt_lit» Symbols : •Π «"|"» Symbols : •Π Π «"|"» ErrorSymbol : •Λ «"|"» ErrorSymbol : •Λ<λ> «"|"» EpsilonSymbol : •Λ «"|"» EpsilonSymbol : •Λ<ε> «"|"» + Symbol : •prodId «"@"» + Symbol : •tokId «"@"» + Symbol : •string_lit «"@"» + Symbol : •Λ<@> tokId «"@"» Symbol : •prodId «prodId» Symbol : •tokId «prodId» Symbol : •string_lit «prodId» + Symbol : •Λ<@> tokId «prodId» Symbol : •prodId «string_lit» Symbol : •tokId «string_lit» Symbol : •string_lit «string_lit» + Symbol : •Λ<@> tokId «string_lit» Symbol : •prodId «tokId» Symbol : •tokId «tokId» Symbol : •string_lit «tokId» + Symbol : •Λ<@> tokId «tokId» Symbol : •prodId «"|"» Symbol : •tokId «"|"» Symbol : •string_lit «"|"» + Symbol : •Λ<@> tokId «"|"» } Transitions: Π -> 34 @@ -713,10 +727,11 @@ Transitions: tokId -> 40 prodId -> 41 string_lit -> 42 - Λ -> 43 - Λ<λ> -> 44 - Λ -> 45 - Λ<ε> -> 46 + Λ<@> -> 43 + Λ -> 44 + Λ<λ> -> 45 + Λ -> 46 + Λ<ε> -> 47 S22{ @@ -730,8 +745,8 @@ S22{ LexPattern : Π •Λ<|> Π «"|"» } Transitions: - Λ<;> -> 47 - Λ<|> -> 48 + Λ<;> -> 48 + Λ<|> -> 49 S23{ @@ -836,7 +851,7 @@ Transitions: Λ<(> -> 29 Λ<[> -> 30 Λ<{> -> 31 - Π -> 49 + Π -> 50 S24{ @@ -902,7 +917,7 @@ S27{ LexTerm : char_lit •Λ<-> char_lit «"|"» } Transitions: - Λ<-> -> 50 + Λ<-> -> 51 S28{ @@ -926,8 +941,8 @@ S28{ LexTerm : Λ<~> •Λ<(> char_lit Λ<-> char_lit Λ<)> «"|"» } Transitions: - char_lit -> 51 - Λ<(> -> 52 + char_lit -> 52 + Λ<(> -> 53 S29{ @@ -1045,16 +1060,16 @@ S29{ LexTerm : •Λ<(> Π Λ<)> «"|"» } Transitions: - Π -> 53 - Π -> 54 - Π -> 55 - regDefId -> 56 - Λ<.> -> 57 - char_lit -> 58 - Λ<~> -> 59 - Λ<(> -> 60 - Λ<[> -> 61 - Λ<{> -> 62 + Π -> 54 + Π -> 55 + Π -> 56 + regDefId -> 57 + Λ<.> -> 58 + char_lit -> 59 + Λ<~> -> 60 + Λ<(> -> 61 + Λ<[> -> 62 + Λ<{> -> 63 S30{ @@ -1172,16 +1187,16 @@ S30{ LexTerm : •Λ<(> Π Λ<)> «"|"» } Transitions: - Π -> 63 - Π -> 64 - Π -> 65 - regDefId -> 66 - Λ<.> -> 67 - char_lit -> 68 - Λ<~> -> 69 - Λ<(> -> 70 - Λ<[> -> 71 - Λ<{> -> 72 + Π -> 64 + Π -> 65 + Π -> 66 + regDefId -> 67 + Λ<.> -> 68 + char_lit -> 69 + Λ<~> -> 70 + Λ<(> -> 71 + Λ<[> -> 72 + Λ<{> -> 73 S31{ @@ -1299,16 +1314,16 @@ S31{ LexTerm : •Λ<(> Π Λ<)> «"|"» } Transitions: - Π -> 73 - Π -> 74 - Π -> 75 - regDefId -> 76 - Λ<.> -> 77 - char_lit -> 78 - Λ<~> -> 79 - Λ<(> -> 80 - Λ<[> -> 81 - Λ<{> -> 82 + Π -> 74 + Π -> 75 + Π -> 76 + regDefId -> 77 + Λ<.> -> 78 + char_lit -> 79 + Λ<~> -> 80 + Λ<(> -> 81 + Λ<[> -> 82 + Λ<{> -> 83 S32{ @@ -1322,8 +1337,8 @@ S32{ LexPattern : Π •Λ<|> Π «"|"» } Transitions: - Λ<|> -> 48 - Λ<;> -> 83 + Λ<|> -> 49 + Λ<;> -> 84 S33{ @@ -1337,8 +1352,8 @@ S33{ LexPattern : Π •Λ<|> Π «"|"» } Transitions: - Λ<|> -> 48 - Λ<;> -> 84 + Λ<|> -> 49 + Λ<;> -> 85 S34{ @@ -1348,8 +1363,8 @@ S34{ Alternatives : Π •Λ<|> Π «"|"» } Transitions: - Λ<;> -> 85 - Λ<|> -> 86 + Λ<;> -> 86 + Λ<|> -> 87 S35{ @@ -1366,6 +1381,7 @@ S36{ Symbols : Π •Π «g_sdt_lit» SyntaxBody : Π• «"|"» SyntaxBody : Π •g_sdt_lit «"|"» + Symbols : Π •Π «"@"» Symbols : Π •Π «prodId» Symbols : Π •Π «string_lit» Symbols : Π •Π «tokId» @@ -1373,28 +1389,39 @@ S36{ Symbol : •prodId «";"» Symbol : •tokId «";"» Symbol : •string_lit «";"» + Symbol : •Λ<@> tokId «";"» Symbol : •prodId «g_sdt_lit» Symbol : •tokId «g_sdt_lit» Symbol : •string_lit «g_sdt_lit» + Symbol : •Λ<@> tokId «g_sdt_lit» + Symbol : •prodId «"@"» + Symbol : •tokId «"@"» + Symbol : •string_lit «"@"» + Symbol : •Λ<@> tokId «"@"» Symbol : •prodId «prodId» Symbol : •tokId «prodId» Symbol : •string_lit «prodId» + Symbol : •Λ<@> tokId «prodId» Symbol : •prodId «string_lit» Symbol : •tokId «string_lit» Symbol : •string_lit «string_lit» + Symbol : •Λ<@> tokId «string_lit» Symbol : •prodId «tokId» Symbol : •tokId «tokId» Symbol : •string_lit «tokId» + Symbol : •Λ<@> tokId «tokId» Symbol : •prodId «"|"» Symbol : •tokId «"|"» Symbol : •string_lit «"|"» + Symbol : •Λ<@> tokId «"|"» } Transitions: tokId -> 40 prodId -> 41 string_lit -> 42 - Π -> 87 - g_sdt_lit -> 88 + Λ<@> -> 43 + Π -> 88 + g_sdt_lit -> 89 S37{ @@ -1415,35 +1442,48 @@ S37{ Symbol : •prodId «";"» Symbol : •tokId «";"» Symbol : •string_lit «";"» + Symbol : •Λ<@> tokId «";"» + Symbols : •Π «"@"» Symbols : •Π «prodId» Symbols : •Π «string_lit» Symbols : •Π «tokId» + Symbols : •Π Π «"@"» Symbols : •Π Π «prodId» Symbols : •Π Π «string_lit» Symbols : •Π Π «tokId» Symbol : •prodId «g_sdt_lit» Symbol : •tokId «g_sdt_lit» Symbol : •string_lit «g_sdt_lit» + Symbol : •Λ<@> tokId «g_sdt_lit» Symbol : •prodId «"|"» Symbol : •tokId «"|"» Symbol : •string_lit «"|"» + Symbol : •Λ<@> tokId «"|"» + Symbol : •prodId «"@"» + Symbol : •tokId «"@"» + Symbol : •string_lit «"@"» + Symbol : •Λ<@> tokId «"@"» Symbol : •prodId «prodId» Symbol : •tokId «prodId» Symbol : •string_lit «prodId» + Symbol : •Λ<@> tokId «prodId» Symbol : •prodId «string_lit» Symbol : •tokId «string_lit» Symbol : •string_lit «string_lit» + Symbol : •Λ<@> tokId «string_lit» Symbol : •prodId «tokId» Symbol : •tokId «tokId» Symbol : •string_lit «tokId» + Symbol : •Λ<@> tokId «tokId» } Transitions: Π -> 39 tokId -> 40 prodId -> 41 string_lit -> 42 - Π -> 89 - g_sdt_lit -> 90 + Λ<@> -> 43 + Π -> 90 + g_sdt_lit -> 91 S38{ @@ -1456,6 +1496,7 @@ Transitions: S39{ Symbols : Π• «";"» Symbols : Π• «g_sdt_lit» + Symbols : Π• «"@"» Symbols : Π• «prodId» Symbols : Π• «string_lit» Symbols : Π• «tokId» @@ -1467,6 +1508,7 @@ Transitions: S40{ Symbol : tokId• «";"» Symbol : tokId• «g_sdt_lit» + Symbol : tokId• «"@"» Symbol : tokId• «prodId» Symbol : tokId• «string_lit» Symbol : tokId• «tokId» @@ -1478,6 +1520,7 @@ Transitions: S41{ Symbol : prodId• «";"» Symbol : prodId• «g_sdt_lit» + Symbol : prodId• «"@"» Symbol : prodId• «prodId» Symbol : prodId• «string_lit» Symbol : prodId• «tokId» @@ -1489,6 +1532,7 @@ Transitions: S42{ Symbol : string_lit• «";"» Symbol : string_lit• «g_sdt_lit» + Symbol : string_lit• «"@"» Symbol : string_lit• «prodId» Symbol : string_lit• «string_lit» Symbol : string_lit• «tokId» @@ -1498,7 +1542,21 @@ Transitions: S43{ + Symbol : Λ<@> •tokId «";"» + Symbol : Λ<@> •tokId «g_sdt_lit» + Symbol : Λ<@> •tokId «"@"» + Symbol : Λ<@> •tokId «prodId» + Symbol : Λ<@> •tokId «string_lit» + Symbol : Λ<@> •tokId «tokId» + Symbol : Λ<@> •tokId «"|"» +} +Transitions: + tokId -> 92 + + +S44{ ErrorSymbol : Λ• «";"» + ErrorSymbol : Λ• «"@"» ErrorSymbol : Λ• «prodId» ErrorSymbol : Λ• «string_lit» ErrorSymbol : Λ• «tokId» @@ -1508,8 +1566,9 @@ S43{ Transitions: -S44{ +S45{ ErrorSymbol : Λ<λ>• «";"» + ErrorSymbol : Λ<λ>• «"@"» ErrorSymbol : Λ<λ>• «prodId» ErrorSymbol : Λ<λ>• «string_lit» ErrorSymbol : Λ<λ>• «tokId» @@ -1519,21 +1578,21 @@ S44{ Transitions: -S45{ +S46{ EpsilonSymbol : Λ• «";"» EpsilonSymbol : Λ• «"|"» } Transitions: -S46{ +S47{ EpsilonSymbol : Λ<ε>• «";"» EpsilonSymbol : Λ<ε>• «"|"» } Transitions: -S47{ +S48{ LexProduction : tokId Λ<:> Π Λ<;>• «g_sdt_lit» LexProduction : tokId Λ<:> Π Λ<;>• «prodId» LexProduction : tokId Λ<:> Π Λ<;>• «Ω» @@ -1544,7 +1603,7 @@ S47{ Transitions: -S48{ +S49{ LexPattern : Π Λ<|> •Π «";"» LexPattern : Π Λ<|> •Π «"|"» LexAlt : •Π «";"» @@ -1656,10 +1715,10 @@ Transitions: Λ<(> -> 29 Λ<[> -> 30 Λ<{> -> 31 - Π -> 91 + Π -> 93 -S49{ +S50{ LexAlt : Π Π• «";"» LexAlt : Π Π• «"("» LexAlt : Π Π• «"."» @@ -1673,7 +1732,7 @@ S49{ Transitions: -S50{ +S51{ LexTerm : char_lit Λ<-> •char_lit «";"» LexTerm : char_lit Λ<-> •char_lit «"("» LexTerm : char_lit Λ<-> •char_lit «"."» @@ -1685,10 +1744,10 @@ S50{ LexTerm : char_lit Λ<-> •char_lit «"|"» } Transitions: - char_lit -> 92 + char_lit -> 94 -S51{ +S52{ LexTerm : Λ<~> char_lit• «";"» LexTerm : Λ<~> char_lit• «"("» LexTerm : Λ<~> char_lit• «"."» @@ -1702,7 +1761,7 @@ S51{ Transitions: -S52{ +S53{ LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «";"» LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «"("» LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «"."» @@ -1714,10 +1773,10 @@ S52{ LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «"|"» } Transitions: - char_lit -> 93 + char_lit -> 95 -S53{ +S54{ LexTerm : Λ<(> Π •Λ<)> «";"» LexTerm : Λ<(> Π •Λ<)> «"("» LexTerm : Λ<(> Π •Λ<)> «"."» @@ -1731,11 +1790,11 @@ S53{ LexPattern : Π •Λ<|> Π «"|"» } Transitions: - Λ<|> -> 94 - Λ<)> -> 95 + Λ<|> -> 96 + Λ<)> -> 97 -S54{ +S55{ LexPattern : Π• «")"» LexAlt : Π •Π «")"» LexPattern : Π• «"|"» @@ -1830,17 +1889,17 @@ S54{ LexTerm : •Λ<(> Π Λ<)> «"|"» } Transitions: - regDefId -> 56 - Λ<.> -> 57 - char_lit -> 58 - Λ<~> -> 59 - Λ<(> -> 60 - Λ<[> -> 61 - Λ<{> -> 62 - Π -> 96 + regDefId -> 57 + Λ<.> -> 58 + char_lit -> 59 + Λ<~> -> 60 + Λ<(> -> 61 + Λ<[> -> 62 + Λ<{> -> 63 + Π -> 98 -S55{ +S56{ LexAlt : Π• «")"» LexAlt : Π• «"("» LexAlt : Π• «"."» @@ -1854,7 +1913,7 @@ S55{ Transitions: -S56{ +S57{ LexTerm : regDefId• «")"» LexTerm : regDefId• «"("» LexTerm : regDefId• «"."» @@ -1868,7 +1927,7 @@ S56{ Transitions: -S57{ +S58{ LexTerm : Λ<.>• «")"» LexTerm : Λ<.>• «"("» LexTerm : Λ<.>• «"."» @@ -1882,7 +1941,7 @@ S57{ Transitions: -S58{ +S59{ LexTerm : char_lit• «")"» LexTerm : char_lit •Λ<-> char_lit «")"» LexTerm : char_lit• «"("» @@ -1903,10 +1962,10 @@ S58{ LexTerm : char_lit •Λ<-> char_lit «"|"» } Transitions: - Λ<-> -> 97 + Λ<-> -> 99 -S59{ +S60{ LexTerm : Λ<~> •char_lit «")"» LexTerm : Λ<~> •Λ<(> char_lit Λ<-> char_lit Λ<)> «")"» LexTerm : Λ<~> •char_lit «"("» @@ -1927,11 +1986,11 @@ S59{ LexTerm : Λ<~> •Λ<(> char_lit Λ<-> char_lit Λ<)> «"|"» } Transitions: - char_lit -> 98 - Λ<(> -> 99 + char_lit -> 100 + Λ<(> -> 101 -S60{ +S61{ LexTerm : Λ<(> •Π Λ<)> «")"» LexTerm : Λ<(> •Π Λ<)> «"("» LexTerm : Λ<(> •Π Λ<)> «"."» @@ -2046,19 +2105,19 @@ S60{ LexTerm : •Λ<(> Π Λ<)> «"|"» } Transitions: - Π -> 54 - Π -> 55 - regDefId -> 56 - Λ<.> -> 57 - char_lit -> 58 - Λ<~> -> 59 - Λ<(> -> 60 - Λ<[> -> 61 - Λ<{> -> 62 - Π -> 100 + Π -> 55 + Π -> 56 + regDefId -> 57 + Λ<.> -> 58 + char_lit -> 59 + Λ<~> -> 60 + Λ<(> -> 61 + Λ<[> -> 62 + Λ<{> -> 63 + Π -> 102 -S61{ +S62{ LexTerm : Λ<[> •Π Λ<]> «")"» LexTerm : Λ<[> •Π Λ<]> «"("» LexTerm : Λ<[> •Π Λ<]> «"."» @@ -2173,19 +2232,19 @@ S61{ LexTerm : •Λ<(> Π Λ<)> «"|"» } Transitions: - Π -> 64 - Π -> 65 - regDefId -> 66 - Λ<.> -> 67 - char_lit -> 68 - Λ<~> -> 69 - Λ<(> -> 70 - Λ<[> -> 71 - Λ<{> -> 72 - Π -> 101 + Π -> 65 + Π -> 66 + regDefId -> 67 + Λ<.> -> 68 + char_lit -> 69 + Λ<~> -> 70 + Λ<(> -> 71 + Λ<[> -> 72 + Λ<{> -> 73 + Π -> 103 -S62{ +S63{ LexTerm : Λ<{> •Π Λ<}> «")"» LexTerm : Λ<{> •Π Λ<}> «"("» LexTerm : Λ<{> •Π Λ<}> «"."» @@ -2300,19 +2359,19 @@ S62{ LexTerm : •Λ<(> Π Λ<)> «"|"» } Transitions: - Π -> 74 - Π -> 75 - regDefId -> 76 - Λ<.> -> 77 - char_lit -> 78 - Λ<~> -> 79 - Λ<(> -> 80 - Λ<[> -> 81 - Λ<{> -> 82 - Π -> 102 + Π -> 75 + Π -> 76 + regDefId -> 77 + Λ<.> -> 78 + char_lit -> 79 + Λ<~> -> 80 + Λ<(> -> 81 + Λ<[> -> 82 + Λ<{> -> 83 + Π -> 104 -S63{ +S64{ LexTerm : Λ<[> Π •Λ<]> «";"» LexTerm : Λ<[> Π •Λ<]> «"("» LexTerm : Λ<[> Π •Λ<]> «"."» @@ -2326,11 +2385,11 @@ S63{ LexPattern : Π •Λ<|> Π «"|"» } Transitions: - Λ<|> -> 103 - Λ<]> -> 104 + Λ<|> -> 105 + Λ<]> -> 106 -S64{ +S65{ LexPattern : Π• «"]"» LexAlt : Π •Π «"]"» LexPattern : Π• «"|"» @@ -2425,17 +2484,17 @@ S64{ LexTerm : •Λ<(> Π Λ<)> «"|"» } Transitions: - regDefId -> 66 - Λ<.> -> 67 - char_lit -> 68 - Λ<~> -> 69 - Λ<(> -> 70 - Λ<[> -> 71 - Λ<{> -> 72 - Π -> 105 + regDefId -> 67 + Λ<.> -> 68 + char_lit -> 69 + Λ<~> -> 70 + Λ<(> -> 71 + Λ<[> -> 72 + Λ<{> -> 73 + Π -> 107 -S65{ +S66{ LexAlt : Π• «"]"» LexAlt : Π• «"("» LexAlt : Π• «"."» @@ -2449,7 +2508,7 @@ S65{ Transitions: -S66{ +S67{ LexTerm : regDefId• «"]"» LexTerm : regDefId• «"("» LexTerm : regDefId• «"."» @@ -2463,7 +2522,7 @@ S66{ Transitions: -S67{ +S68{ LexTerm : Λ<.>• «"]"» LexTerm : Λ<.>• «"("» LexTerm : Λ<.>• «"."» @@ -2477,7 +2536,7 @@ S67{ Transitions: -S68{ +S69{ LexTerm : char_lit• «"]"» LexTerm : char_lit •Λ<-> char_lit «"]"» LexTerm : char_lit• «"("» @@ -2498,10 +2557,10 @@ S68{ LexTerm : char_lit •Λ<-> char_lit «"|"» } Transitions: - Λ<-> -> 106 + Λ<-> -> 108 -S69{ +S70{ LexTerm : Λ<~> •char_lit «"]"» LexTerm : Λ<~> •Λ<(> char_lit Λ<-> char_lit Λ<)> «"]"» LexTerm : Λ<~> •char_lit «"("» @@ -2522,11 +2581,11 @@ S69{ LexTerm : Λ<~> •Λ<(> char_lit Λ<-> char_lit Λ<)> «"|"» } Transitions: - char_lit -> 107 - Λ<(> -> 108 + char_lit -> 109 + Λ<(> -> 110 -S70{ +S71{ LexTerm : Λ<(> •Π Λ<)> «"]"» LexTerm : Λ<(> •Π Λ<)> «"("» LexTerm : Λ<(> •Π Λ<)> «"."» @@ -2641,19 +2700,19 @@ S70{ LexTerm : •Λ<(> Π Λ<)> «"|"» } Transitions: - Π -> 54 - Π -> 55 - regDefId -> 56 - Λ<.> -> 57 - char_lit -> 58 - Λ<~> -> 59 - Λ<(> -> 60 - Λ<[> -> 61 - Λ<{> -> 62 - Π -> 109 + Π -> 55 + Π -> 56 + regDefId -> 57 + Λ<.> -> 58 + char_lit -> 59 + Λ<~> -> 60 + Λ<(> -> 61 + Λ<[> -> 62 + Λ<{> -> 63 + Π -> 111 -S71{ +S72{ LexTerm : Λ<[> •Π Λ<]> «"]"» LexTerm : Λ<[> •Π Λ<]> «"("» LexTerm : Λ<[> •Π Λ<]> «"."» @@ -2768,19 +2827,19 @@ S71{ LexTerm : •Λ<(> Π Λ<)> «"|"» } Transitions: - Π -> 64 - Π -> 65 - regDefId -> 66 - Λ<.> -> 67 - char_lit -> 68 - Λ<~> -> 69 - Λ<(> -> 70 - Λ<[> -> 71 - Λ<{> -> 72 - Π -> 110 + Π -> 65 + Π -> 66 + regDefId -> 67 + Λ<.> -> 68 + char_lit -> 69 + Λ<~> -> 70 + Λ<(> -> 71 + Λ<[> -> 72 + Λ<{> -> 73 + Π -> 112 -S72{ +S73{ LexTerm : Λ<{> •Π Λ<}> «"]"» LexTerm : Λ<{> •Π Λ<}> «"("» LexTerm : Λ<{> •Π Λ<}> «"."» @@ -2895,19 +2954,19 @@ S72{ LexTerm : •Λ<(> Π Λ<)> «"|"» } Transitions: - Π -> 74 - Π -> 75 - regDefId -> 76 - Λ<.> -> 77 - char_lit -> 78 - Λ<~> -> 79 - Λ<(> -> 80 - Λ<[> -> 81 - Λ<{> -> 82 - Π -> 111 + Π -> 75 + Π -> 76 + regDefId -> 77 + Λ<.> -> 78 + char_lit -> 79 + Λ<~> -> 80 + Λ<(> -> 81 + Λ<[> -> 82 + Λ<{> -> 83 + Π -> 113 -S73{ +S74{ LexTerm : Λ<{> Π •Λ<}> «";"» LexTerm : Λ<{> Π •Λ<}> «"("» LexTerm : Λ<{> Π •Λ<}> «"."» @@ -2921,11 +2980,11 @@ S73{ LexPattern : Π •Λ<|> Π «"|"» } Transitions: - Λ<|> -> 112 - Λ<}> -> 113 + Λ<|> -> 114 + Λ<}> -> 115 -S74{ +S75{ LexPattern : Π• «"}"» LexAlt : Π •Π «"}"» LexPattern : Π• «"|"» @@ -3020,17 +3079,17 @@ S74{ LexTerm : •Λ<(> Π Λ<)> «"|"» } Transitions: - regDefId -> 76 - Λ<.> -> 77 - char_lit -> 78 - Λ<~> -> 79 - Λ<(> -> 80 - Λ<[> -> 81 - Λ<{> -> 82 - Π -> 114 + regDefId -> 77 + Λ<.> -> 78 + char_lit -> 79 + Λ<~> -> 80 + Λ<(> -> 81 + Λ<[> -> 82 + Λ<{> -> 83 + Π -> 116 -S75{ +S76{ LexAlt : Π• «"}"» LexAlt : Π• «"("» LexAlt : Π• «"."» @@ -3044,7 +3103,7 @@ S75{ Transitions: -S76{ +S77{ LexTerm : regDefId• «"}"» LexTerm : regDefId• «"("» LexTerm : regDefId• «"."» @@ -3058,7 +3117,7 @@ S76{ Transitions: -S77{ +S78{ LexTerm : Λ<.>• «"}"» LexTerm : Λ<.>• «"("» LexTerm : Λ<.>• «"."» @@ -3072,7 +3131,7 @@ S77{ Transitions: -S78{ +S79{ LexTerm : char_lit• «"}"» LexTerm : char_lit •Λ<-> char_lit «"}"» LexTerm : char_lit• «"("» @@ -3093,10 +3152,10 @@ S78{ LexTerm : char_lit •Λ<-> char_lit «"|"» } Transitions: - Λ<-> -> 115 + Λ<-> -> 117 -S79{ +S80{ LexTerm : Λ<~> •char_lit «"}"» LexTerm : Λ<~> •Λ<(> char_lit Λ<-> char_lit Λ<)> «"}"» LexTerm : Λ<~> •char_lit «"("» @@ -3117,11 +3176,11 @@ S79{ LexTerm : Λ<~> •Λ<(> char_lit Λ<-> char_lit Λ<)> «"|"» } Transitions: - char_lit -> 116 - Λ<(> -> 117 + char_lit -> 118 + Λ<(> -> 119 -S80{ +S81{ LexTerm : Λ<(> •Π Λ<)> «"}"» LexTerm : Λ<(> •Π Λ<)> «"("» LexTerm : Λ<(> •Π Λ<)> «"."» @@ -3236,19 +3295,19 @@ S80{ LexTerm : •Λ<(> Π Λ<)> «"|"» } Transitions: - Π -> 54 - Π -> 55 - regDefId -> 56 - Λ<.> -> 57 - char_lit -> 58 - Λ<~> -> 59 - Λ<(> -> 60 - Λ<[> -> 61 - Λ<{> -> 62 - Π -> 118 + Π -> 55 + Π -> 56 + regDefId -> 57 + Λ<.> -> 58 + char_lit -> 59 + Λ<~> -> 60 + Λ<(> -> 61 + Λ<[> -> 62 + Λ<{> -> 63 + Π -> 120 -S81{ +S82{ LexTerm : Λ<[> •Π Λ<]> «"}"» LexTerm : Λ<[> •Π Λ<]> «"("» LexTerm : Λ<[> •Π Λ<]> «"."» @@ -3363,19 +3422,19 @@ S81{ LexTerm : •Λ<(> Π Λ<)> «"|"» } Transitions: - Π -> 64 - Π -> 65 - regDefId -> 66 - Λ<.> -> 67 - char_lit -> 68 - Λ<~> -> 69 - Λ<(> -> 70 - Λ<[> -> 71 - Λ<{> -> 72 - Π -> 119 + Π -> 65 + Π -> 66 + regDefId -> 67 + Λ<.> -> 68 + char_lit -> 69 + Λ<~> -> 70 + Λ<(> -> 71 + Λ<[> -> 72 + Λ<{> -> 73 + Π -> 121 -S82{ +S83{ LexTerm : Λ<{> •Π Λ<}> «"}"» LexTerm : Λ<{> •Π Λ<}> «"("» LexTerm : Λ<{> •Π Λ<}> «"."» @@ -3490,19 +3549,19 @@ S82{ LexTerm : •Λ<(> Π Λ<)> «"|"» } Transitions: - Π -> 74 - Π -> 75 - regDefId -> 76 - Λ<.> -> 77 - char_lit -> 78 - Λ<~> -> 79 - Λ<(> -> 80 - Λ<[> -> 81 - Λ<{> -> 82 - Π -> 120 + Π -> 75 + Π -> 76 + regDefId -> 77 + Λ<.> -> 78 + char_lit -> 79 + Λ<~> -> 80 + Λ<(> -> 81 + Λ<[> -> 82 + Λ<{> -> 83 + Π -> 122 -S83{ +S84{ LexProduction : regDefId Λ<:> Π Λ<;>• «g_sdt_lit» LexProduction : regDefId Λ<:> Π Λ<;>• «prodId» LexProduction : regDefId Λ<:> Π Λ<;>• «Ω» @@ -3513,7 +3572,7 @@ S83{ Transitions: -S84{ +S85{ LexProduction : ignoredTokId Λ<:> Π Λ<;>• «g_sdt_lit» LexProduction : ignoredTokId Λ<:> Π Λ<;>• «prodId» LexProduction : ignoredTokId Λ<:> Π Λ<;>• «Ω» @@ -3524,14 +3583,14 @@ S84{ Transitions: -S85{ +S86{ SyntaxProduction : prodId Λ<:> Π Λ<;>• «Ω» SyntaxProduction : prodId Λ<:> Π Λ<;>• «prodId» } Transitions: -S86{ +S87{ Alternatives : Π Λ<|> •Π «";"» Alternatives : Π Λ<|> •Π «"|"» SyntaxBody : •Π «";"» @@ -3554,9 +3613,11 @@ S86{ Symbols : •Π Π «g_sdt_lit» ErrorSymbol : •Λ «";"» ErrorSymbol : •Λ<λ> «";"» + ErrorSymbol : •Λ «"@"» ErrorSymbol : •Λ «prodId» ErrorSymbol : •Λ «string_lit» ErrorSymbol : •Λ «tokId» + ErrorSymbol : •Λ<λ> «"@"» ErrorSymbol : •Λ<λ> «prodId» ErrorSymbol : •Λ<λ> «string_lit» ErrorSymbol : •Λ<λ> «tokId» @@ -3573,27 +3634,39 @@ S86{ Symbol : •prodId «";"» Symbol : •tokId «";"» Symbol : •string_lit «";"» + Symbol : •Λ<@> tokId «";"» + Symbols : •Π «"@"» Symbols : •Π «prodId» Symbols : •Π «string_lit» Symbols : •Π «tokId» + Symbols : •Π Π «"@"» Symbols : •Π Π «prodId» Symbols : •Π Π «string_lit» Symbols : •Π Π «tokId» Symbol : •prodId «g_sdt_lit» Symbol : •tokId «g_sdt_lit» Symbol : •string_lit «g_sdt_lit» + Symbol : •Λ<@> tokId «g_sdt_lit» Symbol : •prodId «"|"» Symbol : •tokId «"|"» Symbol : •string_lit «"|"» + Symbol : •Λ<@> tokId «"|"» + Symbol : •prodId «"@"» + Symbol : •tokId «"@"» + Symbol : •string_lit «"@"» + Symbol : •Λ<@> tokId «"@"» Symbol : •prodId «prodId» Symbol : •tokId «prodId» Symbol : •string_lit «prodId» + Symbol : •Λ<@> tokId «prodId» Symbol : •prodId «string_lit» Symbol : •tokId «string_lit» Symbol : •string_lit «string_lit» + Symbol : •Λ<@> tokId «string_lit» Symbol : •prodId «tokId» Symbol : •tokId «tokId» Symbol : •string_lit «tokId» + Symbol : •Λ<@> tokId «tokId» } Transitions: Π -> 36 @@ -3603,16 +3676,18 @@ Transitions: tokId -> 40 prodId -> 41 string_lit -> 42 - Λ -> 43 - Λ<λ> -> 44 - Λ -> 45 - Λ<ε> -> 46 - Π -> 121 + Λ<@> -> 43 + Λ -> 44 + Λ<λ> -> 45 + Λ -> 46 + Λ<ε> -> 47 + Π -> 123 -S87{ +S88{ Symbols : Π Π• «";"» Symbols : Π Π• «g_sdt_lit» + Symbols : Π Π• «"@"» Symbols : Π Π• «prodId» Symbols : Π Π• «string_lit» Symbols : Π Π• «tokId» @@ -3621,14 +3696,14 @@ S87{ Transitions: -S88{ +S89{ SyntaxBody : Π g_sdt_lit• «";"» SyntaxBody : Π g_sdt_lit• «"|"» } Transitions: -S89{ +S90{ SyntaxBody : Π Π• «";"» SyntaxBody : Π Π •g_sdt_lit «";"» SyntaxBody : Π Π• «"|"» @@ -3636,44 +3711,68 @@ S89{ Symbols : Π •Π «";"» Symbols : Π •Π «g_sdt_lit» Symbols : Π •Π «"|"» + Symbols : Π •Π «"@"» Symbols : Π •Π «prodId» Symbols : Π •Π «string_lit» Symbols : Π •Π «tokId» Symbol : •prodId «";"» Symbol : •tokId «";"» Symbol : •string_lit «";"» + Symbol : •Λ<@> tokId «";"» Symbol : •prodId «g_sdt_lit» Symbol : •tokId «g_sdt_lit» Symbol : •string_lit «g_sdt_lit» + Symbol : •Λ<@> tokId «g_sdt_lit» Symbol : •prodId «"|"» Symbol : •tokId «"|"» Symbol : •string_lit «"|"» + Symbol : •Λ<@> tokId «"|"» + Symbol : •prodId «"@"» + Symbol : •tokId «"@"» + Symbol : •string_lit «"@"» + Symbol : •Λ<@> tokId «"@"» Symbol : •prodId «prodId» Symbol : •tokId «prodId» Symbol : •string_lit «prodId» + Symbol : •Λ<@> tokId «prodId» Symbol : •prodId «string_lit» Symbol : •tokId «string_lit» Symbol : •string_lit «string_lit» + Symbol : •Λ<@> tokId «string_lit» Symbol : •prodId «tokId» Symbol : •tokId «tokId» Symbol : •string_lit «tokId» + Symbol : •Λ<@> tokId «tokId» } Transitions: tokId -> 40 prodId -> 41 string_lit -> 42 - Π -> 87 - g_sdt_lit -> 122 + Λ<@> -> 43 + Π -> 88 + g_sdt_lit -> 124 -S90{ +S91{ SyntaxBody : Π g_sdt_lit• «";"» SyntaxBody : Π g_sdt_lit• «"|"» } Transitions: -S91{ +S92{ + Symbol : Λ<@> tokId• «";"» + Symbol : Λ<@> tokId• «g_sdt_lit» + Symbol : Λ<@> tokId• «"@"» + Symbol : Λ<@> tokId• «prodId» + Symbol : Λ<@> tokId• «string_lit» + Symbol : Λ<@> tokId• «tokId» + Symbol : Λ<@> tokId• «"|"» +} +Transitions: + + +S93{ LexPattern : Π Λ<|> Π• «";"» LexPattern : Π Λ<|> Π• «"|"» LexAlt : Π •Π «";"» @@ -3775,10 +3874,10 @@ Transitions: Λ<(> -> 29 Λ<[> -> 30 Λ<{> -> 31 - Π -> 49 + Π -> 50 -S92{ +S94{ LexTerm : char_lit Λ<-> char_lit• «";"» LexTerm : char_lit Λ<-> char_lit• «"("» LexTerm : char_lit Λ<-> char_lit• «"."» @@ -3792,7 +3891,7 @@ S92{ Transitions: -S93{ +S95{ LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «";"» LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «"("» LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «"."» @@ -3804,10 +3903,10 @@ S93{ LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «"|"» } Transitions: - Λ<-> -> 123 + Λ<-> -> 125 -S94{ +S96{ LexPattern : Π Λ<|> •Π «")"» LexPattern : Π Λ<|> •Π «"|"» LexAlt : •Π «")"» @@ -3911,18 +4010,18 @@ S94{ LexTerm : •Λ<(> Π Λ<)> «"~"» } Transitions: - Π -> 55 - regDefId -> 56 - Λ<.> -> 57 - char_lit -> 58 - Λ<~> -> 59 - Λ<(> -> 60 - Λ<[> -> 61 - Λ<{> -> 62 - Π -> 124 + Π -> 56 + regDefId -> 57 + Λ<.> -> 58 + char_lit -> 59 + Λ<~> -> 60 + Λ<(> -> 61 + Λ<[> -> 62 + Λ<{> -> 63 + Π -> 126 -S95{ +S97{ LexTerm : Λ<(> Π Λ<)>• «";"» LexTerm : Λ<(> Π Λ<)>• «"("» LexTerm : Λ<(> Π Λ<)>• «"."» @@ -3936,7 +4035,7 @@ S95{ Transitions: -S96{ +S98{ LexAlt : Π Π• «")"» LexAlt : Π Π• «"("» LexAlt : Π Π• «"."» @@ -3950,7 +4049,7 @@ S96{ Transitions: -S97{ +S99{ LexTerm : char_lit Λ<-> •char_lit «")"» LexTerm : char_lit Λ<-> •char_lit «"("» LexTerm : char_lit Λ<-> •char_lit «"."» @@ -3962,10 +4061,10 @@ S97{ LexTerm : char_lit Λ<-> •char_lit «"|"» } Transitions: - char_lit -> 125 + char_lit -> 127 -S98{ +S100{ LexTerm : Λ<~> char_lit• «")"» LexTerm : Λ<~> char_lit• «"("» LexTerm : Λ<~> char_lit• «"."» @@ -3979,7 +4078,7 @@ S98{ Transitions: -S99{ +S101{ LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «")"» LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «"("» LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «"."» @@ -3991,10 +4090,10 @@ S99{ LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «"|"» } Transitions: - char_lit -> 126 + char_lit -> 128 -S100{ +S102{ LexTerm : Λ<(> Π •Λ<)> «")"» LexTerm : Λ<(> Π •Λ<)> «"("» LexTerm : Λ<(> Π •Λ<)> «"."» @@ -4008,11 +4107,11 @@ S100{ LexPattern : Π •Λ<|> Π «"|"» } Transitions: - Λ<|> -> 94 - Λ<)> -> 127 + Λ<|> -> 96 + Λ<)> -> 129 -S101{ +S103{ LexTerm : Λ<[> Π •Λ<]> «")"» LexTerm : Λ<[> Π •Λ<]> «"("» LexTerm : Λ<[> Π •Λ<]> «"."» @@ -4026,11 +4125,11 @@ S101{ LexPattern : Π •Λ<|> Π «"|"» } Transitions: - Λ<|> -> 103 - Λ<]> -> 128 + Λ<|> -> 105 + Λ<]> -> 130 -S102{ +S104{ LexTerm : Λ<{> Π •Λ<}> «")"» LexTerm : Λ<{> Π •Λ<}> «"("» LexTerm : Λ<{> Π •Λ<}> «"."» @@ -4044,11 +4143,11 @@ S102{ LexPattern : Π •Λ<|> Π «"|"» } Transitions: - Λ<|> -> 112 - Λ<}> -> 129 + Λ<|> -> 114 + Λ<}> -> 131 -S103{ +S105{ LexPattern : Π Λ<|> •Π «"]"» LexPattern : Π Λ<|> •Π «"|"» LexAlt : •Π «"]"» @@ -4152,18 +4251,18 @@ S103{ LexTerm : •Λ<(> Π Λ<)> «"~"» } Transitions: - Π -> 65 - regDefId -> 66 - Λ<.> -> 67 - char_lit -> 68 - Λ<~> -> 69 - Λ<(> -> 70 - Λ<[> -> 71 - Λ<{> -> 72 - Π -> 130 + Π -> 66 + regDefId -> 67 + Λ<.> -> 68 + char_lit -> 69 + Λ<~> -> 70 + Λ<(> -> 71 + Λ<[> -> 72 + Λ<{> -> 73 + Π -> 132 -S104{ +S106{ LexTerm : Λ<[> Π Λ<]>• «";"» LexTerm : Λ<[> Π Λ<]>• «"("» LexTerm : Λ<[> Π Λ<]>• «"."» @@ -4177,7 +4276,7 @@ S104{ Transitions: -S105{ +S107{ LexAlt : Π Π• «"]"» LexAlt : Π Π• «"("» LexAlt : Π Π• «"."» @@ -4191,7 +4290,7 @@ S105{ Transitions: -S106{ +S108{ LexTerm : char_lit Λ<-> •char_lit «"]"» LexTerm : char_lit Λ<-> •char_lit «"("» LexTerm : char_lit Λ<-> •char_lit «"."» @@ -4203,10 +4302,10 @@ S106{ LexTerm : char_lit Λ<-> •char_lit «"|"» } Transitions: - char_lit -> 131 + char_lit -> 133 -S107{ +S109{ LexTerm : Λ<~> char_lit• «"]"» LexTerm : Λ<~> char_lit• «"("» LexTerm : Λ<~> char_lit• «"."» @@ -4220,7 +4319,7 @@ S107{ Transitions: -S108{ +S110{ LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «"]"» LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «"("» LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «"."» @@ -4232,10 +4331,10 @@ S108{ LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «"|"» } Transitions: - char_lit -> 132 + char_lit -> 134 -S109{ +S111{ LexTerm : Λ<(> Π •Λ<)> «"]"» LexTerm : Λ<(> Π •Λ<)> «"("» LexTerm : Λ<(> Π •Λ<)> «"."» @@ -4249,11 +4348,11 @@ S109{ LexPattern : Π •Λ<|> Π «"|"» } Transitions: - Λ<|> -> 94 - Λ<)> -> 133 + Λ<|> -> 96 + Λ<)> -> 135 -S110{ +S112{ LexTerm : Λ<[> Π •Λ<]> «"]"» LexTerm : Λ<[> Π •Λ<]> «"("» LexTerm : Λ<[> Π •Λ<]> «"."» @@ -4267,11 +4366,11 @@ S110{ LexPattern : Π •Λ<|> Π «"|"» } Transitions: - Λ<|> -> 103 - Λ<]> -> 134 + Λ<|> -> 105 + Λ<]> -> 136 -S111{ +S113{ LexTerm : Λ<{> Π •Λ<}> «"]"» LexTerm : Λ<{> Π •Λ<}> «"("» LexTerm : Λ<{> Π •Λ<}> «"."» @@ -4285,11 +4384,11 @@ S111{ LexPattern : Π •Λ<|> Π «"|"» } Transitions: - Λ<|> -> 112 - Λ<}> -> 135 + Λ<|> -> 114 + Λ<}> -> 137 -S112{ +S114{ LexPattern : Π Λ<|> •Π «"}"» LexPattern : Π Λ<|> •Π «"|"» LexAlt : •Π «"}"» @@ -4393,18 +4492,18 @@ S112{ LexTerm : •Λ<(> Π Λ<)> «"~"» } Transitions: - Π -> 75 - regDefId -> 76 - Λ<.> -> 77 - char_lit -> 78 - Λ<~> -> 79 - Λ<(> -> 80 - Λ<[> -> 81 - Λ<{> -> 82 - Π -> 136 + Π -> 76 + regDefId -> 77 + Λ<.> -> 78 + char_lit -> 79 + Λ<~> -> 80 + Λ<(> -> 81 + Λ<[> -> 82 + Λ<{> -> 83 + Π -> 138 -S113{ +S115{ LexTerm : Λ<{> Π Λ<}>• «";"» LexTerm : Λ<{> Π Λ<}>• «"("» LexTerm : Λ<{> Π Λ<}>• «"."» @@ -4418,7 +4517,7 @@ S113{ Transitions: -S114{ +S116{ LexAlt : Π Π• «"}"» LexAlt : Π Π• «"("» LexAlt : Π Π• «"."» @@ -4432,7 +4531,7 @@ S114{ Transitions: -S115{ +S117{ LexTerm : char_lit Λ<-> •char_lit «"}"» LexTerm : char_lit Λ<-> •char_lit «"("» LexTerm : char_lit Λ<-> •char_lit «"."» @@ -4444,10 +4543,10 @@ S115{ LexTerm : char_lit Λ<-> •char_lit «"|"» } Transitions: - char_lit -> 137 + char_lit -> 139 -S116{ +S118{ LexTerm : Λ<~> char_lit• «"}"» LexTerm : Λ<~> char_lit• «"("» LexTerm : Λ<~> char_lit• «"."» @@ -4461,7 +4560,7 @@ S116{ Transitions: -S117{ +S119{ LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «"}"» LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «"("» LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «"."» @@ -4473,10 +4572,10 @@ S117{ LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «"|"» } Transitions: - char_lit -> 138 + char_lit -> 140 -S118{ +S120{ LexTerm : Λ<(> Π •Λ<)> «"}"» LexTerm : Λ<(> Π •Λ<)> «"("» LexTerm : Λ<(> Π •Λ<)> «"."» @@ -4490,11 +4589,11 @@ S118{ LexPattern : Π •Λ<|> Π «"|"» } Transitions: - Λ<|> -> 94 - Λ<)> -> 139 + Λ<|> -> 96 + Λ<)> -> 141 -S119{ +S121{ LexTerm : Λ<[> Π •Λ<]> «"}"» LexTerm : Λ<[> Π •Λ<]> «"("» LexTerm : Λ<[> Π •Λ<]> «"."» @@ -4508,11 +4607,11 @@ S119{ LexPattern : Π •Λ<|> Π «"|"» } Transitions: - Λ<|> -> 103 - Λ<]> -> 140 + Λ<|> -> 105 + Λ<]> -> 142 -S120{ +S122{ LexTerm : Λ<{> Π •Λ<}> «"}"» LexTerm : Λ<{> Π •Λ<}> «"("» LexTerm : Λ<{> Π •Λ<}> «"."» @@ -4526,25 +4625,25 @@ S120{ LexPattern : Π •Λ<|> Π «"|"» } Transitions: - Λ<|> -> 112 - Λ<}> -> 141 + Λ<|> -> 114 + Λ<}> -> 143 -S121{ +S123{ Alternatives : Π Λ<|> Π• «";"» Alternatives : Π Λ<|> Π• «"|"» } Transitions: -S122{ +S124{ SyntaxBody : Π Π g_sdt_lit• «";"» SyntaxBody : Π Π g_sdt_lit• «"|"» } Transitions: -S123{ +S125{ LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «";"» LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «"("» LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «"."» @@ -4556,10 +4655,10 @@ S123{ LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «"|"» } Transitions: - char_lit -> 142 + char_lit -> 144 -S124{ +S126{ LexPattern : Π Λ<|> Π• «")"» LexPattern : Π Λ<|> Π• «"|"» LexAlt : Π •Π «")"» @@ -4654,17 +4753,17 @@ S124{ LexTerm : •Λ<(> Π Λ<)> «"~"» } Transitions: - regDefId -> 56 - Λ<.> -> 57 - char_lit -> 58 - Λ<~> -> 59 - Λ<(> -> 60 - Λ<[> -> 61 - Λ<{> -> 62 - Π -> 96 + regDefId -> 57 + Λ<.> -> 58 + char_lit -> 59 + Λ<~> -> 60 + Λ<(> -> 61 + Λ<[> -> 62 + Λ<{> -> 63 + Π -> 98 -S125{ +S127{ LexTerm : char_lit Λ<-> char_lit• «")"» LexTerm : char_lit Λ<-> char_lit• «"("» LexTerm : char_lit Λ<-> char_lit• «"."» @@ -4678,7 +4777,7 @@ S125{ Transitions: -S126{ +S128{ LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «")"» LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «"("» LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «"."» @@ -4690,10 +4789,10 @@ S126{ LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «"|"» } Transitions: - Λ<-> -> 143 + Λ<-> -> 145 -S127{ +S129{ LexTerm : Λ<(> Π Λ<)>• «")"» LexTerm : Λ<(> Π Λ<)>• «"("» LexTerm : Λ<(> Π Λ<)>• «"."» @@ -4707,7 +4806,7 @@ S127{ Transitions: -S128{ +S130{ LexTerm : Λ<[> Π Λ<]>• «")"» LexTerm : Λ<[> Π Λ<]>• «"("» LexTerm : Λ<[> Π Λ<]>• «"."» @@ -4721,7 +4820,7 @@ S128{ Transitions: -S129{ +S131{ LexTerm : Λ<{> Π Λ<}>• «")"» LexTerm : Λ<{> Π Λ<}>• «"("» LexTerm : Λ<{> Π Λ<}>• «"."» @@ -4735,7 +4834,7 @@ S129{ Transitions: -S130{ +S132{ LexPattern : Π Λ<|> Π• «"]"» LexPattern : Π Λ<|> Π• «"|"» LexAlt : Π •Π «"]"» @@ -4830,17 +4929,17 @@ S130{ LexTerm : •Λ<(> Π Λ<)> «"~"» } Transitions: - regDefId -> 66 - Λ<.> -> 67 - char_lit -> 68 - Λ<~> -> 69 - Λ<(> -> 70 - Λ<[> -> 71 - Λ<{> -> 72 - Π -> 105 + regDefId -> 67 + Λ<.> -> 68 + char_lit -> 69 + Λ<~> -> 70 + Λ<(> -> 71 + Λ<[> -> 72 + Λ<{> -> 73 + Π -> 107 -S131{ +S133{ LexTerm : char_lit Λ<-> char_lit• «"]"» LexTerm : char_lit Λ<-> char_lit• «"("» LexTerm : char_lit Λ<-> char_lit• «"."» @@ -4854,7 +4953,7 @@ S131{ Transitions: -S132{ +S134{ LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «"]"» LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «"("» LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «"."» @@ -4866,10 +4965,10 @@ S132{ LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «"|"» } Transitions: - Λ<-> -> 144 + Λ<-> -> 146 -S133{ +S135{ LexTerm : Λ<(> Π Λ<)>• «"]"» LexTerm : Λ<(> Π Λ<)>• «"("» LexTerm : Λ<(> Π Λ<)>• «"."» @@ -4883,7 +4982,7 @@ S133{ Transitions: -S134{ +S136{ LexTerm : Λ<[> Π Λ<]>• «"]"» LexTerm : Λ<[> Π Λ<]>• «"("» LexTerm : Λ<[> Π Λ<]>• «"."» @@ -4897,7 +4996,7 @@ S134{ Transitions: -S135{ +S137{ LexTerm : Λ<{> Π Λ<}>• «"]"» LexTerm : Λ<{> Π Λ<}>• «"("» LexTerm : Λ<{> Π Λ<}>• «"."» @@ -4911,7 +5010,7 @@ S135{ Transitions: -S136{ +S138{ LexPattern : Π Λ<|> Π• «"}"» LexPattern : Π Λ<|> Π• «"|"» LexAlt : Π •Π «"}"» @@ -5006,17 +5105,17 @@ S136{ LexTerm : •Λ<(> Π Λ<)> «"~"» } Transitions: - regDefId -> 76 - Λ<.> -> 77 - char_lit -> 78 - Λ<~> -> 79 - Λ<(> -> 80 - Λ<[> -> 81 - Λ<{> -> 82 - Π -> 114 + regDefId -> 77 + Λ<.> -> 78 + char_lit -> 79 + Λ<~> -> 80 + Λ<(> -> 81 + Λ<[> -> 82 + Λ<{> -> 83 + Π -> 116 -S137{ +S139{ LexTerm : char_lit Λ<-> char_lit• «"}"» LexTerm : char_lit Λ<-> char_lit• «"("» LexTerm : char_lit Λ<-> char_lit• «"."» @@ -5030,7 +5129,7 @@ S137{ Transitions: -S138{ +S140{ LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «"}"» LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «"("» LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «"."» @@ -5042,10 +5141,10 @@ S138{ LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «"|"» } Transitions: - Λ<-> -> 145 + Λ<-> -> 147 -S139{ +S141{ LexTerm : Λ<(> Π Λ<)>• «"}"» LexTerm : Λ<(> Π Λ<)>• «"("» LexTerm : Λ<(> Π Λ<)>• «"."» @@ -5059,7 +5158,7 @@ S139{ Transitions: -S140{ +S142{ LexTerm : Λ<[> Π Λ<]>• «"}"» LexTerm : Λ<[> Π Λ<]>• «"("» LexTerm : Λ<[> Π Λ<]>• «"."» @@ -5073,7 +5172,7 @@ S140{ Transitions: -S141{ +S143{ LexTerm : Λ<{> Π Λ<}>• «"}"» LexTerm : Λ<{> Π Λ<}>• «"("» LexTerm : Λ<{> Π Λ<}>• «"."» @@ -5087,7 +5186,7 @@ S141{ Transitions: -S142{ +S144{ LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «";"» LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «"("» LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «"."» @@ -5099,10 +5198,10 @@ S142{ LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «"|"» } Transitions: - Λ<)> -> 146 + Λ<)> -> 148 -S143{ +S145{ LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «")"» LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «"("» LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «"."» @@ -5114,10 +5213,10 @@ S143{ LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «"|"» } Transitions: - char_lit -> 147 + char_lit -> 149 -S144{ +S146{ LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «"]"» LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «"("» LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «"."» @@ -5129,10 +5228,10 @@ S144{ LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «"|"» } Transitions: - char_lit -> 148 + char_lit -> 150 -S145{ +S147{ LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «"}"» LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «"("» LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «"."» @@ -5144,10 +5243,10 @@ S145{ LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «"|"» } Transitions: - char_lit -> 149 + char_lit -> 151 -S146{ +S148{ LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)>• «";"» LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)>• «"("» LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)>• «"."» @@ -5161,7 +5260,7 @@ S146{ Transitions: -S147{ +S149{ LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «")"» LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «"("» LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «"."» @@ -5173,10 +5272,10 @@ S147{ LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «"|"» } Transitions: - Λ<)> -> 150 + Λ<)> -> 152 -S148{ +S150{ LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «"]"» LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «"("» LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «"."» @@ -5188,10 +5287,10 @@ S148{ LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «"|"» } Transitions: - Λ<)> -> 151 + Λ<)> -> 153 -S149{ +S151{ LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «"}"» LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «"("» LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «"."» @@ -5203,10 +5302,10 @@ S149{ LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «"|"» } Transitions: - Λ<)> -> 152 + Λ<)> -> 154 -S150{ +S152{ LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)>• «")"» LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)>• «"("» LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)>• «"."» @@ -5220,7 +5319,7 @@ S150{ Transitions: -S151{ +S153{ LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)>• «"]"» LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)>• «"("» LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)>• «"."» @@ -5234,7 +5333,7 @@ S151{ Transitions: -S152{ +S154{ LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)>• «"}"» LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)>• «"("» LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)>• «"."» diff --git a/internal/frontend/reparsed/log/first.txt b/internal/frontend/reparsed/log/first.txt index 7cb6a40c..76304b0e 100644 --- a/internal/frontend/reparsed/log/first.txt +++ b/internal/frontend/reparsed/log/first.txt @@ -71,6 +71,7 @@ prodId string_lit tokId + Λ<@> Λ Λ Λ<ε> @@ -80,6 +81,7 @@ prodId string_lit tokId + Λ<@> Λ Λ Λ<ε> @@ -89,6 +91,7 @@ prodId string_lit tokId + Λ<@> } Π: { Λ @@ -102,4 +105,5 @@ prodId string_lit tokId + Λ<@> } diff --git a/internal/frontend/reparsed/log/lexer_sets.txt b/internal/frontend/reparsed/log/lexer_sets.txt index 62753eca..928ef3ec 100644 --- a/internal/frontend/reparsed/log/lexer_sets.txt +++ b/internal/frontend/reparsed/log/lexer_sets.txt @@ -27,6 +27,7 @@ S0{ Λ<.> : • '.' Λ<:> : • ':' Λ<;> : • ';' + Λ<@> : • '@' Λ<[> : • '[' Λ<]> : • ']' Λ : • 'e' 'm' 'p' 't' 'y' @@ -54,22 +55,23 @@ Transitions: [':',':'] -> S10 [';',';'] -> S11 ['<','<'] -> S12 - ['A','Z'] -> S13 - ['[','['] -> S14 - [']',']'] -> S15 - ['_','_'] -> S16 - ['`','`'] -> S17 - ['a','d'] -> S18 - ['e','e'] -> S19 - ['f','z'] -> S18 - ['{','{'] -> S20 - ['|','|'] -> S21 - ['}','}'] -> S22 - ['~','~'] -> S23 - [\u03b5,\u03b5] -> S24 - [\u03bb,\u03bb] -> S25 + ['@','@'] -> S13 + ['A','Z'] -> S14 + ['[','['] -> S15 + [']',']'] -> S16 + ['_','_'] -> S17 + ['`','`'] -> S18 + ['a','d'] -> S19 + ['e','e'] -> S20 + ['f','z'] -> S19 + ['{','{'] -> S21 + ['|','|'] -> S22 + ['}','}'] -> S23 + ['~','~'] -> S24 + [\u03b5,\u03b5] -> S25 + [\u03bb,\u03bb] -> S26 Action: nil -Symbols classes: {['\t','\t'], ['\n','\n'], ['\r','\r'], [' ',' '], ['!','!'], ['"','"'], [''','''], ['(','('], [')',')'], ['-','-'], ['.','.'], ['/','/'], [':',':'], [';',';'], ['<','<'], ['A','Z'], ['[','['], [']',']'], ['_','_'], ['`','`'], ['a','d'], ['e','e'], ['f','z'], ['{','{'], ['|','|'], ['}','}'], ['~','~'], [\u03b5,\u03b5], [\u03bb,\u03bb]} +Symbols classes: {['\t','\t'], ['\n','\n'], ['\r','\r'], [' ',' '], ['!','!'], ['"','"'], [''','''], ['(','('], [')',')'], ['-','-'], ['.','.'], ['/','/'], [':',':'], [';',';'], ['<','<'], ['@','@'], ['A','Z'], ['[','['], [']',']'], ['_','_'], ['`','`'], ['a','d'], ['e','e'], ['f','z'], ['{','{'], ['|','|'], ['}','}'], ['~','~'], [\u03b5,\u03b5], [\u03bb,\u03bb]} S1{ !whitespace : (' ' | '\t' | '\n' | '\r') • @@ -84,7 +86,7 @@ S2{ ignoredTokId : '!' • _tokId } Transitions: - ['a','z'] -> S26 + ['a','z'] -> S27 Action: nil Symbols classes: {['a','z']} @@ -106,9 +108,9 @@ S3{ string_lit : _raw_string | • _interpreted_string } Transitions: - ['"','"'] -> S27 - ['\','\'] -> S28 -. -> S29 + ['"','"'] -> S28 + ['\','\'] -> S29 +. -> S30 Action: nil Symbols classes: {['"','"'], ['\','\']} @@ -128,8 +130,8 @@ S4{ char_lit : ''' (• _unicode_value | _byte_value) ''' } Transitions: - ['\','\'] -> S30 -. -> S31 + ['\','\'] -> S31 +. -> S32 Action: nil Symbols classes: {['\','\']} @@ -168,8 +170,8 @@ S9{ _lineComment : '/' • '/' {.} '\n' } Transitions: - ['*','*'] -> S32 - ['/','/'] -> S33 + ['*','*'] -> S33 + ['/','/'] -> S34 Action: nil Symbols classes: {['*','*'], ['/','/']} @@ -191,11 +193,18 @@ S12{ g_sdt_lit : '<' • '<' . {.} '>' '>' } Transitions: - ['<','<'] -> S34 + ['<','<'] -> S35 Action: nil Symbols classes: {['<','<']} S13{ + Λ<@> : '@' • +} +Transitions: +Action: Accept("Λ<@>") +Symbols classes: {} + +S14{ _digit : • '0'-'9' _id_char : _upcase | _lowcase | '_' | • _digit _id_char : _upcase | _lowcase | • '_' | _digit @@ -208,28 +217,28 @@ S13{ prodId : _upcase {• _id_char} } Transitions: - ['0','9'] -> S35 - ['A','Z'] -> S36 - ['_','_'] -> S37 - ['a','z'] -> S38 + ['0','9'] -> S36 + ['A','Z'] -> S37 + ['_','_'] -> S38 + ['a','z'] -> S39 Action: Accept("prodId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} -S14{ +S15{ Λ<[> : '[' • } Transitions: Action: Accept("Λ<[>") Symbols classes: {} -S15{ +S16{ Λ<]> : ']' • } Transitions: Action: Accept("Λ<]>") Symbols classes: {} -S16{ +S17{ _digit : • '0'-'9' _id_char : _upcase | _lowcase | '_' | • _digit _id_char : _upcase | _lowcase | • '_' | _digit @@ -241,25 +250,25 @@ S16{ regDefId : '_' {• _id_char} } Transitions: - ['0','9'] -> S39 - ['A','Z'] -> S40 - ['_','_'] -> S41 - ['a','z'] -> S42 + ['0','9'] -> S40 + ['A','Z'] -> S41 + ['_','_'] -> S42 + ['a','z'] -> S43 Action: Accept("regDefId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} -S17{ +S18{ _raw_string : '`' {.} • '`' _raw_string : '`' {• .} '`' string_lit : • _raw_string | _interpreted_string } Transitions: - ['`','`'] -> S43 -. -> S17 + ['`','`'] -> S44 +. -> S18 Action: nil Symbols classes: {['`','`']} -S18{ +S19{ _digit : • '0'-'9' _id_char : _upcase | _lowcase | '_' | • _digit _id_char : _upcase | _lowcase | • '_' | _digit @@ -274,14 +283,14 @@ S18{ tokId : • _tokId } Transitions: - ['0','9'] -> S44 - ['A','Z'] -> S45 - ['_','_'] -> S46 - ['a','z'] -> S47 + ['0','9'] -> S45 + ['A','Z'] -> S46 + ['_','_'] -> S47 + ['a','z'] -> S48 Action: Accept("tokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} -S19{ +S20{ _digit : • '0'-'9' _id_char : _upcase | _lowcase | '_' | • _digit _id_char : _upcase | _lowcase | • '_' | _digit @@ -298,60 +307,60 @@ S19{ Λ : 'e' • 'r' 'r' 'o' 'r' } Transitions: - ['0','9'] -> S44 - ['A','Z'] -> S45 - ['_','_'] -> S46 - ['a','l'] -> S47 - ['m','m'] -> S48 - ['n','q'] -> S47 - ['r','r'] -> S49 - ['s','z'] -> S47 + ['0','9'] -> S45 + ['A','Z'] -> S46 + ['_','_'] -> S47 + ['a','l'] -> S48 + ['m','m'] -> S49 + ['n','q'] -> S48 + ['r','r'] -> S50 + ['s','z'] -> S48 Action: Accept("tokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','l'], ['m','m'], ['n','q'], ['r','r'], ['s','z']} -S20{ +S21{ Λ<{> : '{' • } Transitions: Action: Accept("Λ<{>") Symbols classes: {} -S21{ +S22{ Λ<|> : '|' • } Transitions: Action: Accept("Λ<|>") Symbols classes: {} -S22{ +S23{ Λ<}> : '}' • } Transitions: Action: Accept("Λ<}>") Symbols classes: {} -S23{ +S24{ Λ<~> : '~' • } Transitions: Action: Accept("Λ<~>") Symbols classes: {} -S24{ +S25{ Λ<ε> : \u03b5 • } Transitions: Action: Accept("Λ<ε>") Symbols classes: {} -S25{ +S26{ Λ<λ> : \u03bb • } Transitions: Action: Accept("Λ<λ>") Symbols classes: {} -S26{ +S27{ _digit : • '0'-'9' _id_char : _upcase | _lowcase | '_' | • _digit _id_char : _upcase | _lowcase | • '_' | _digit @@ -366,14 +375,14 @@ S26{ ignoredTokId : '!' • _tokId } Transitions: - ['0','9'] -> S50 - ['A','Z'] -> S51 - ['_','_'] -> S52 - ['a','z'] -> S53 + ['0','9'] -> S51 + ['A','Z'] -> S52 + ['_','_'] -> S53 + ['a','z'] -> S54 Action: Accept("ignoredTokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} -S27{ +S28{ _interpreted_string : '"' {_unicode_value | _byte_value} '"' • string_lit : (_raw_string | _interpreted_string) • } @@ -381,7 +390,7 @@ Transitions: Action: Accept("string_lit") Symbols classes: {} -S28{ +S29{ _big_u_value : '\' • 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _byte_value : _octal_byte_value | • _hex_byte_value _byte_value : • _octal_byte_value | _hex_byte_value @@ -407,24 +416,24 @@ S28{ string_lit : _raw_string | • _interpreted_string } Transitions: - ['"','"'] -> S54 - [''','''] -> S54 - ['0','7'] -> S55 - ['U','U'] -> S56 - ['\','\'] -> S54 - ['a','a'] -> S54 - ['b','b'] -> S54 - ['f','f'] -> S54 - ['n','n'] -> S54 - ['r','r'] -> S54 - ['t','t'] -> S54 - ['u','u'] -> S57 - ['v','v'] -> S54 - ['x','x'] -> S58 + ['"','"'] -> S55 + [''','''] -> S55 + ['0','7'] -> S56 + ['U','U'] -> S57 + ['\','\'] -> S55 + ['a','a'] -> S55 + ['b','b'] -> S55 + ['f','f'] -> S55 + ['n','n'] -> S55 + ['r','r'] -> S55 + ['t','t'] -> S55 + ['u','u'] -> S58 + ['v','v'] -> S55 + ['x','x'] -> S59 Action: nil Symbols classes: {['"','"'], [''','''], ['0','7'], ['U','U'], ['\','\'], ['a','a'], ['b','b'], ['f','f'], ['n','n'], ['r','r'], ['t','t'], ['u','u'], ['v','v'], ['x','x']} -S29{ +S30{ _big_u_value : • '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _byte_value : _octal_byte_value | • _hex_byte_value _byte_value : • _octal_byte_value | _hex_byte_value @@ -443,13 +452,13 @@ S29{ string_lit : _raw_string | • _interpreted_string } Transitions: - ['"','"'] -> S27 - ['\','\'] -> S28 -. -> S29 + ['"','"'] -> S28 + ['\','\'] -> S29 +. -> S30 Action: nil Symbols classes: {['"','"'], ['\','\']} -S30{ +S31{ _big_u_value : '\' • 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _byte_value : _octal_byte_value | • _hex_byte_value _byte_value : • _octal_byte_value | _hex_byte_value @@ -474,64 +483,64 @@ S30{ char_lit : ''' (• _unicode_value | _byte_value) ''' } Transitions: - ['"','"'] -> S59 - [''','''] -> S59 - ['0','7'] -> S60 - ['U','U'] -> S61 - ['\','\'] -> S59 - ['a','a'] -> S59 - ['b','b'] -> S59 - ['f','f'] -> S59 - ['n','n'] -> S59 - ['r','r'] -> S59 - ['t','t'] -> S59 - ['u','u'] -> S62 - ['v','v'] -> S59 - ['x','x'] -> S63 + ['"','"'] -> S60 + [''','''] -> S60 + ['0','7'] -> S61 + ['U','U'] -> S62 + ['\','\'] -> S60 + ['a','a'] -> S60 + ['b','b'] -> S60 + ['f','f'] -> S60 + ['n','n'] -> S60 + ['r','r'] -> S60 + ['t','t'] -> S60 + ['u','u'] -> S63 + ['v','v'] -> S60 + ['x','x'] -> S64 Action: nil Symbols classes: {['"','"'], [''','''], ['0','7'], ['U','U'], ['\','\'], ['a','a'], ['b','b'], ['f','f'], ['n','n'], ['r','r'], ['t','t'], ['u','u'], ['v','v'], ['x','x']} -S31{ +S32{ _unicode_value : (. | _little_u_value | _big_u_value | _escaped_char) • char_lit : ''' (_unicode_value | _byte_value) • ''' } Transitions: - [''','''] -> S64 + [''','''] -> S65 Action: nil Symbols classes: {[''',''']} -S32{ +S33{ !comment : _lineComment | • _blockComment _blockComment : '/' '*' {. | '*'} • '*' '/' _blockComment : '/' '*' {. | • '*'} '*' '/' _blockComment : '/' '*' {• . | '*'} '*' '/' } Transitions: - ['*','*'] -> S65 -. -> S32 + ['*','*'] -> S66 +. -> S33 Action: nil Symbols classes: {['*','*']} -S33{ +S34{ !comment : • _lineComment | _blockComment _lineComment : '/' '/' {.} • '\n' _lineComment : '/' '/' {• .} '\n' } Transitions: - ['\n','\n'] -> S66 -. -> S33 + ['\n','\n'] -> S67 +. -> S34 Action: nil Symbols classes: {['\n','\n']} -S34{ +S35{ g_sdt_lit : '<' '<' • . {.} '>' '>' } Transitions: -. -> S67 +. -> S68 Action: nil Symbols classes: {} -S35{ +S36{ _digit : '0'-'9' • _digit : • '0'-'9' _id_char : (_upcase | _lowcase | '_' | _digit) • @@ -545,14 +554,14 @@ S35{ prodId : _upcase {• _id_char} } Transitions: - ['0','9'] -> S35 - ['A','Z'] -> S36 - ['_','_'] -> S37 - ['a','z'] -> S38 + ['0','9'] -> S36 + ['A','Z'] -> S37 + ['_','_'] -> S38 + ['a','z'] -> S39 Action: Accept("prodId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} -S36{ +S37{ _digit : • '0'-'9' _id_char : (_upcase | _lowcase | '_' | _digit) • _id_char : _upcase | _lowcase | '_' | • _digit @@ -566,14 +575,14 @@ S36{ prodId : _upcase {• _id_char} } Transitions: - ['0','9'] -> S35 - ['A','Z'] -> S36 - ['_','_'] -> S37 - ['a','z'] -> S38 + ['0','9'] -> S36 + ['A','Z'] -> S37 + ['_','_'] -> S38 + ['a','z'] -> S39 Action: Accept("prodId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} -S37{ +S38{ _digit : • '0'-'9' _id_char : (_upcase | _lowcase | '_' | _digit) • _id_char : _upcase | _lowcase | '_' | • _digit @@ -586,14 +595,14 @@ S37{ prodId : _upcase {• _id_char} } Transitions: - ['0','9'] -> S35 - ['A','Z'] -> S36 - ['_','_'] -> S37 - ['a','z'] -> S38 + ['0','9'] -> S36 + ['A','Z'] -> S37 + ['_','_'] -> S38 + ['a','z'] -> S39 Action: Accept("prodId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} -S38{ +S39{ _digit : • '0'-'9' _id_char : (_upcase | _lowcase | '_' | _digit) • _id_char : _upcase | _lowcase | '_' | • _digit @@ -607,14 +616,14 @@ S38{ prodId : _upcase {• _id_char} } Transitions: - ['0','9'] -> S35 - ['A','Z'] -> S36 - ['_','_'] -> S37 - ['a','z'] -> S38 + ['0','9'] -> S36 + ['A','Z'] -> S37 + ['_','_'] -> S38 + ['a','z'] -> S39 Action: Accept("prodId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} -S39{ +S40{ _digit : '0'-'9' • _digit : • '0'-'9' _id_char : (_upcase | _lowcase | '_' | _digit) • @@ -628,14 +637,14 @@ S39{ regDefId : '_' {• _id_char} } Transitions: - ['0','9'] -> S39 - ['A','Z'] -> S40 - ['_','_'] -> S41 - ['a','z'] -> S42 + ['0','9'] -> S40 + ['A','Z'] -> S41 + ['_','_'] -> S42 + ['a','z'] -> S43 Action: Accept("regDefId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} -S40{ +S41{ _digit : • '0'-'9' _id_char : (_upcase | _lowcase | '_' | _digit) • _id_char : _upcase | _lowcase | '_' | • _digit @@ -649,14 +658,14 @@ S40{ regDefId : '_' {• _id_char} } Transitions: - ['0','9'] -> S39 - ['A','Z'] -> S40 - ['_','_'] -> S41 - ['a','z'] -> S42 + ['0','9'] -> S40 + ['A','Z'] -> S41 + ['_','_'] -> S42 + ['a','z'] -> S43 Action: Accept("regDefId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} -S41{ +S42{ _digit : • '0'-'9' _id_char : (_upcase | _lowcase | '_' | _digit) • _id_char : _upcase | _lowcase | '_' | • _digit @@ -669,14 +678,14 @@ S41{ regDefId : '_' {• _id_char} } Transitions: - ['0','9'] -> S39 - ['A','Z'] -> S40 - ['_','_'] -> S41 - ['a','z'] -> S42 + ['0','9'] -> S40 + ['A','Z'] -> S41 + ['_','_'] -> S42 + ['a','z'] -> S43 Action: Accept("regDefId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} -S42{ +S43{ _digit : • '0'-'9' _id_char : (_upcase | _lowcase | '_' | _digit) • _id_char : _upcase | _lowcase | '_' | • _digit @@ -690,14 +699,14 @@ S42{ regDefId : '_' {• _id_char} } Transitions: - ['0','9'] -> S39 - ['A','Z'] -> S40 - ['_','_'] -> S41 - ['a','z'] -> S42 + ['0','9'] -> S40 + ['A','Z'] -> S41 + ['_','_'] -> S42 + ['a','z'] -> S43 Action: Accept("regDefId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} -S43{ +S44{ _raw_string : '`' {.} '`' • string_lit : (_raw_string | _interpreted_string) • } @@ -705,7 +714,7 @@ Transitions: Action: Accept("string_lit") Symbols classes: {} -S44{ +S45{ _digit : '0'-'9' • _digit : • '0'-'9' _id_char : (_upcase | _lowcase | '_' | _digit) • @@ -721,14 +730,14 @@ S44{ tokId : • _tokId } Transitions: - ['0','9'] -> S44 - ['A','Z'] -> S45 - ['_','_'] -> S46 - ['a','z'] -> S47 + ['0','9'] -> S45 + ['A','Z'] -> S46 + ['_','_'] -> S47 + ['a','z'] -> S48 Action: Accept("tokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} -S45{ +S46{ _digit : • '0'-'9' _id_char : (_upcase | _lowcase | '_' | _digit) • _id_char : _upcase | _lowcase | '_' | • _digit @@ -744,14 +753,14 @@ S45{ tokId : • _tokId } Transitions: - ['0','9'] -> S44 - ['A','Z'] -> S45 - ['_','_'] -> S46 - ['a','z'] -> S47 + ['0','9'] -> S45 + ['A','Z'] -> S46 + ['_','_'] -> S47 + ['a','z'] -> S48 Action: Accept("tokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} -S46{ +S47{ _digit : • '0'-'9' _id_char : (_upcase | _lowcase | '_' | _digit) • _id_char : _upcase | _lowcase | '_' | • _digit @@ -766,14 +775,14 @@ S46{ tokId : • _tokId } Transitions: - ['0','9'] -> S44 - ['A','Z'] -> S45 - ['_','_'] -> S46 - ['a','z'] -> S47 + ['0','9'] -> S45 + ['A','Z'] -> S46 + ['_','_'] -> S47 + ['a','z'] -> S48 Action: Accept("tokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} -S47{ +S48{ _digit : • '0'-'9' _id_char : (_upcase | _lowcase | '_' | _digit) • _id_char : _upcase | _lowcase | '_' | • _digit @@ -789,14 +798,14 @@ S47{ tokId : • _tokId } Transitions: - ['0','9'] -> S44 - ['A','Z'] -> S45 - ['_','_'] -> S46 - ['a','z'] -> S47 + ['0','9'] -> S45 + ['A','Z'] -> S46 + ['_','_'] -> S47 + ['a','z'] -> S48 Action: Accept("tokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} -S48{ +S49{ _digit : • '0'-'9' _id_char : (_upcase | _lowcase | '_' | _digit) • _id_char : _upcase | _lowcase | '_' | • _digit @@ -813,16 +822,16 @@ S48{ Λ : 'e' 'm' • 'p' 't' 'y' } Transitions: - ['0','9'] -> S44 - ['A','Z'] -> S45 - ['_','_'] -> S46 - ['a','o'] -> S47 - ['p','p'] -> S68 - ['q','z'] -> S47 + ['0','9'] -> S45 + ['A','Z'] -> S46 + ['_','_'] -> S47 + ['a','o'] -> S48 + ['p','p'] -> S69 + ['q','z'] -> S48 Action: Accept("tokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','o'], ['p','p'], ['q','z']} -S49{ +S50{ _digit : • '0'-'9' _id_char : (_upcase | _lowcase | '_' | _digit) • _id_char : _upcase | _lowcase | '_' | • _digit @@ -839,16 +848,16 @@ S49{ Λ : 'e' 'r' • 'r' 'o' 'r' } Transitions: - ['0','9'] -> S44 - ['A','Z'] -> S45 - ['_','_'] -> S46 - ['a','q'] -> S47 - ['r','r'] -> S69 - ['s','z'] -> S47 + ['0','9'] -> S45 + ['A','Z'] -> S46 + ['_','_'] -> S47 + ['a','q'] -> S48 + ['r','r'] -> S70 + ['s','z'] -> S48 Action: Accept("tokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','q'], ['r','r'], ['s','z']} -S50{ +S51{ _digit : '0'-'9' • _digit : • '0'-'9' _id_char : (_upcase | _lowcase | '_' | _digit) • @@ -864,14 +873,14 @@ S50{ ignoredTokId : '!' • _tokId } Transitions: - ['0','9'] -> S50 - ['A','Z'] -> S51 - ['_','_'] -> S52 - ['a','z'] -> S53 + ['0','9'] -> S51 + ['A','Z'] -> S52 + ['_','_'] -> S53 + ['a','z'] -> S54 Action: Accept("ignoredTokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} -S51{ +S52{ _digit : • '0'-'9' _id_char : (_upcase | _lowcase | '_' | _digit) • _id_char : _upcase | _lowcase | '_' | • _digit @@ -887,14 +896,14 @@ S51{ ignoredTokId : '!' • _tokId } Transitions: - ['0','9'] -> S50 - ['A','Z'] -> S51 - ['_','_'] -> S52 - ['a','z'] -> S53 + ['0','9'] -> S51 + ['A','Z'] -> S52 + ['_','_'] -> S53 + ['a','z'] -> S54 Action: Accept("ignoredTokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} -S52{ +S53{ _digit : • '0'-'9' _id_char : (_upcase | _lowcase | '_' | _digit) • _id_char : _upcase | _lowcase | '_' | • _digit @@ -909,14 +918,14 @@ S52{ ignoredTokId : '!' • _tokId } Transitions: - ['0','9'] -> S50 - ['A','Z'] -> S51 - ['_','_'] -> S52 - ['a','z'] -> S53 + ['0','9'] -> S51 + ['A','Z'] -> S52 + ['_','_'] -> S53 + ['a','z'] -> S54 Action: Accept("ignoredTokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} -S53{ +S54{ _digit : • '0'-'9' _id_char : (_upcase | _lowcase | '_' | _digit) • _id_char : _upcase | _lowcase | '_' | • _digit @@ -932,14 +941,14 @@ S53{ ignoredTokId : '!' • _tokId } Transitions: - ['0','9'] -> S50 - ['A','Z'] -> S51 - ['_','_'] -> S52 - ['a','z'] -> S53 + ['0','9'] -> S51 + ['A','Z'] -> S52 + ['_','_'] -> S53 + ['a','z'] -> S54 Action: Accept("ignoredTokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} -S54{ +S55{ _big_u_value : • '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _byte_value : _octal_byte_value | • _hex_byte_value _byte_value : • _octal_byte_value | _hex_byte_value @@ -959,13 +968,13 @@ S54{ string_lit : _raw_string | • _interpreted_string } Transitions: - ['"','"'] -> S27 - ['\','\'] -> S28 -. -> S29 + ['"','"'] -> S28 + ['\','\'] -> S29 +. -> S30 Action: nil Symbols classes: {['"','"'], ['\','\']} -S55{ +S56{ _byte_value : • _octal_byte_value | _hex_byte_value _interpreted_string : '"' {_unicode_value | • _byte_value} '"' _octal_byte_value : '\' _octal_digit • _octal_digit _octal_digit @@ -974,11 +983,11 @@ S55{ string_lit : _raw_string | • _interpreted_string } Transitions: - ['0','7'] -> S70 + ['0','7'] -> S71 Action: nil Symbols classes: {['0','7']} -S56{ +S57{ _big_u_value : '\' 'U' • _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' @@ -988,13 +997,13 @@ S56{ string_lit : _raw_string | • _interpreted_string } Transitions: - ['0','9'] -> S71 - ['A','F'] -> S71 - ['a','f'] -> S71 + ['0','9'] -> S72 + ['A','F'] -> S72 + ['a','f'] -> S72 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S57{ +S58{ _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' @@ -1004,13 +1013,13 @@ S57{ string_lit : _raw_string | • _interpreted_string } Transitions: - ['0','9'] -> S72 - ['A','F'] -> S72 - ['a','f'] -> S72 + ['0','9'] -> S73 + ['A','F'] -> S73 + ['a','f'] -> S73 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S58{ +S59{ _byte_value : _octal_byte_value | • _hex_byte_value _hex_byte_value : '\' 'x' • _hex_digit _hex_digit _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' @@ -1020,23 +1029,23 @@ S58{ string_lit : _raw_string | • _interpreted_string } Transitions: - ['0','9'] -> S73 - ['A','F'] -> S73 - ['a','f'] -> S73 + ['0','9'] -> S74 + ['A','F'] -> S74 + ['a','f'] -> S74 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S59{ +S60{ _escaped_char : '\' ('a' | 'b' | 'f' | 'n' | 'r' | 't' | 'v' | '\' | ''' | '"') • _unicode_value : (. | _little_u_value | _big_u_value | _escaped_char) • char_lit : ''' (_unicode_value | _byte_value) • ''' } Transitions: - [''','''] -> S64 + [''','''] -> S65 Action: nil Symbols classes: {[''',''']} -S60{ +S61{ _byte_value : • _octal_byte_value | _hex_byte_value _octal_byte_value : '\' _octal_digit • _octal_digit _octal_digit _octal_digit : '0'-'7' • @@ -1044,11 +1053,11 @@ S60{ char_lit : ''' (_unicode_value | • _byte_value) ''' } Transitions: - ['0','7'] -> S74 + ['0','7'] -> S75 Action: nil Symbols classes: {['0','7']} -S61{ +S62{ _big_u_value : '\' 'U' • _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' @@ -1057,13 +1066,13 @@ S61{ char_lit : ''' (• _unicode_value | _byte_value) ''' } Transitions: - ['0','9'] -> S75 - ['A','F'] -> S75 - ['a','f'] -> S75 + ['0','9'] -> S76 + ['A','F'] -> S76 + ['a','f'] -> S76 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S62{ +S63{ _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' @@ -1072,13 +1081,13 @@ S62{ char_lit : ''' (• _unicode_value | _byte_value) ''' } Transitions: - ['0','9'] -> S76 - ['A','F'] -> S76 - ['a','f'] -> S76 + ['0','9'] -> S77 + ['A','F'] -> S77 + ['a','f'] -> S77 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S63{ +S64{ _byte_value : _octal_byte_value | • _hex_byte_value _hex_byte_value : '\' 'x' • _hex_digit _hex_digit _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' @@ -1087,20 +1096,20 @@ S63{ char_lit : ''' (_unicode_value | • _byte_value) ''' } Transitions: - ['0','9'] -> S77 - ['A','F'] -> S77 - ['a','f'] -> S77 + ['0','9'] -> S78 + ['A','F'] -> S78 + ['a','f'] -> S78 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S64{ +S65{ char_lit : ''' (_unicode_value | _byte_value) ''' • } Transitions: Action: Accept("char_lit") Symbols classes: {} -S65{ +S66{ !comment : _lineComment | • _blockComment _blockComment : '/' '*' {. | '*'} '*' • '/' _blockComment : '/' '*' {. | '*'} • '*' '/' @@ -1108,13 +1117,13 @@ S65{ _blockComment : '/' '*' {• . | '*'} '*' '/' } Transitions: - ['*','*'] -> S65 - ['/','/'] -> S78 -. -> S32 + ['*','*'] -> S66 + ['/','/'] -> S79 +. -> S33 Action: nil Symbols classes: {['*','*'], ['/','/']} -S66{ +S67{ !comment : (_lineComment | _blockComment) • _lineComment : '/' '/' {.} '\n' • } @@ -1122,17 +1131,17 @@ Transitions: Action: Ignore("!comment") Symbols classes: {} -S67{ +S68{ g_sdt_lit : '<' '<' . {.} • '>' '>' g_sdt_lit : '<' '<' . {• .} '>' '>' } Transitions: - ['>','>'] -> S79 -. -> S67 + ['>','>'] -> S80 +. -> S68 Action: nil Symbols classes: {['>','>']} -S68{ +S69{ _digit : • '0'-'9' _id_char : (_upcase | _lowcase | '_' | _digit) • _id_char : _upcase | _lowcase | '_' | • _digit @@ -1149,16 +1158,16 @@ S68{ Λ : 'e' 'm' 'p' • 't' 'y' } Transitions: - ['0','9'] -> S44 - ['A','Z'] -> S45 - ['_','_'] -> S46 - ['a','s'] -> S47 - ['t','t'] -> S80 - ['u','z'] -> S47 + ['0','9'] -> S45 + ['A','Z'] -> S46 + ['_','_'] -> S47 + ['a','s'] -> S48 + ['t','t'] -> S81 + ['u','z'] -> S48 Action: Accept("tokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','s'], ['t','t'], ['u','z']} -S69{ +S70{ _digit : • '0'-'9' _id_char : (_upcase | _lowcase | '_' | _digit) • _id_char : _upcase | _lowcase | '_' | • _digit @@ -1175,16 +1184,16 @@ S69{ Λ : 'e' 'r' 'r' • 'o' 'r' } Transitions: - ['0','9'] -> S44 - ['A','Z'] -> S45 - ['_','_'] -> S46 - ['a','n'] -> S47 - ['o','o'] -> S81 - ['p','z'] -> S47 + ['0','9'] -> S45 + ['A','Z'] -> S46 + ['_','_'] -> S47 + ['a','n'] -> S48 + ['o','o'] -> S82 + ['p','z'] -> S48 Action: Accept("tokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','n'], ['o','o'], ['p','z']} -S70{ +S71{ _byte_value : • _octal_byte_value | _hex_byte_value _interpreted_string : '"' {_unicode_value | • _byte_value} '"' _octal_byte_value : '\' _octal_digit _octal_digit • _octal_digit @@ -1193,11 +1202,11 @@ S70{ string_lit : _raw_string | • _interpreted_string } Transitions: - ['0','7'] -> S82 + ['0','7'] -> S83 Action: nil Symbols classes: {['0','7']} -S71{ +S72{ _big_u_value : '\' 'U' _hex_digit • _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' @@ -1208,13 +1217,13 @@ S71{ string_lit : _raw_string | • _interpreted_string } Transitions: - ['0','9'] -> S83 - ['A','F'] -> S83 - ['a','f'] -> S83 + ['0','9'] -> S84 + ['A','F'] -> S84 + ['a','f'] -> S84 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S72{ +S73{ _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • @@ -1225,13 +1234,13 @@ S72{ string_lit : _raw_string | • _interpreted_string } Transitions: - ['0','9'] -> S84 - ['A','F'] -> S84 - ['a','f'] -> S84 + ['0','9'] -> S85 + ['A','F'] -> S85 + ['a','f'] -> S85 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S73{ +S74{ _byte_value : _octal_byte_value | • _hex_byte_value _hex_byte_value : '\' 'x' _hex_digit • _hex_digit _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' @@ -1242,13 +1251,13 @@ S73{ string_lit : _raw_string | • _interpreted_string } Transitions: - ['0','9'] -> S85 - ['A','F'] -> S85 - ['a','f'] -> S85 + ['0','9'] -> S86 + ['A','F'] -> S86 + ['a','f'] -> S86 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S74{ +S75{ _byte_value : • _octal_byte_value | _hex_byte_value _octal_byte_value : '\' _octal_digit _octal_digit • _octal_digit _octal_digit : '0'-'7' • @@ -1256,11 +1265,11 @@ S74{ char_lit : ''' (_unicode_value | • _byte_value) ''' } Transitions: - ['0','7'] -> S86 + ['0','7'] -> S87 Action: nil Symbols classes: {['0','7']} -S75{ +S76{ _big_u_value : '\' 'U' _hex_digit • _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' @@ -1270,13 +1279,13 @@ S75{ char_lit : ''' (• _unicode_value | _byte_value) ''' } Transitions: - ['0','9'] -> S87 - ['A','F'] -> S87 - ['a','f'] -> S87 + ['0','9'] -> S88 + ['A','F'] -> S88 + ['a','f'] -> S88 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S76{ +S77{ _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • @@ -1286,13 +1295,13 @@ S76{ char_lit : ''' (• _unicode_value | _byte_value) ''' } Transitions: - ['0','9'] -> S88 - ['A','F'] -> S88 - ['a','f'] -> S88 + ['0','9'] -> S89 + ['A','F'] -> S89 + ['a','f'] -> S89 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S77{ +S78{ _byte_value : _octal_byte_value | • _hex_byte_value _hex_byte_value : '\' 'x' _hex_digit • _hex_digit _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' @@ -1302,13 +1311,13 @@ S77{ char_lit : ''' (_unicode_value | • _byte_value) ''' } Transitions: - ['0','9'] -> S89 - ['A','F'] -> S89 - ['a','f'] -> S89 + ['0','9'] -> S90 + ['A','F'] -> S90 + ['a','f'] -> S90 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S78{ +S79{ !comment : (_lineComment | _blockComment) • _blockComment : '/' '*' {. | '*'} '*' '/' • } @@ -1316,15 +1325,15 @@ Transitions: Action: Ignore("!comment") Symbols classes: {} -S79{ +S80{ g_sdt_lit : '<' '<' . {.} '>' • '>' } Transitions: - ['>','>'] -> S90 + ['>','>'] -> S91 Action: nil Symbols classes: {['>','>']} -S80{ +S81{ _digit : • '0'-'9' _id_char : (_upcase | _lowcase | '_' | _digit) • _id_char : _upcase | _lowcase | '_' | • _digit @@ -1341,16 +1350,16 @@ S80{ Λ : 'e' 'm' 'p' 't' • 'y' } Transitions: - ['0','9'] -> S44 - ['A','Z'] -> S45 - ['_','_'] -> S46 - ['a','x'] -> S47 - ['y','y'] -> S91 - ['z','z'] -> S47 + ['0','9'] -> S45 + ['A','Z'] -> S46 + ['_','_'] -> S47 + ['a','x'] -> S48 + ['y','y'] -> S92 + ['z','z'] -> S48 Action: Accept("tokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','x'], ['y','y'], ['z','z']} -S81{ +S82{ _digit : • '0'-'9' _id_char : (_upcase | _lowcase | '_' | _digit) • _id_char : _upcase | _lowcase | '_' | • _digit @@ -1367,16 +1376,16 @@ S81{ Λ : 'e' 'r' 'r' 'o' • 'r' } Transitions: - ['0','9'] -> S44 - ['A','Z'] -> S45 - ['_','_'] -> S46 - ['a','q'] -> S47 - ['r','r'] -> S92 - ['s','z'] -> S47 + ['0','9'] -> S45 + ['A','Z'] -> S46 + ['_','_'] -> S47 + ['a','q'] -> S48 + ['r','r'] -> S93 + ['s','z'] -> S48 Action: Accept("tokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','q'], ['r','r'], ['s','z']} -S82{ +S83{ _big_u_value : • '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _byte_value : (_octal_byte_value | _hex_byte_value) • _byte_value : _octal_byte_value | • _hex_byte_value @@ -1397,13 +1406,13 @@ S82{ string_lit : _raw_string | • _interpreted_string } Transitions: - ['"','"'] -> S27 - ['\','\'] -> S28 -. -> S29 + ['"','"'] -> S28 + ['\','\'] -> S29 +. -> S30 Action: nil Symbols classes: {['"','"'], ['\','\']} -S83{ +S84{ _big_u_value : '\' 'U' _hex_digit _hex_digit • _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' @@ -1414,13 +1423,13 @@ S83{ string_lit : _raw_string | • _interpreted_string } Transitions: - ['0','9'] -> S93 - ['A','F'] -> S93 - ['a','f'] -> S93 + ['0','9'] -> S94 + ['A','F'] -> S94 + ['a','f'] -> S94 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S84{ +S85{ _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • @@ -1431,13 +1440,13 @@ S84{ string_lit : _raw_string | • _interpreted_string } Transitions: - ['0','9'] -> S94 - ['A','F'] -> S94 - ['a','f'] -> S94 + ['0','9'] -> S95 + ['A','F'] -> S95 + ['a','f'] -> S95 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S85{ +S86{ _big_u_value : • '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _byte_value : (_octal_byte_value | _hex_byte_value) • _byte_value : _octal_byte_value | • _hex_byte_value @@ -1458,24 +1467,24 @@ S85{ string_lit : _raw_string | • _interpreted_string } Transitions: - ['"','"'] -> S27 - ['\','\'] -> S28 -. -> S29 + ['"','"'] -> S28 + ['\','\'] -> S29 +. -> S30 Action: nil Symbols classes: {['"','"'], ['\','\']} -S86{ +S87{ _byte_value : (_octal_byte_value | _hex_byte_value) • _octal_byte_value : '\' _octal_digit _octal_digit _octal_digit • _octal_digit : '0'-'7' • char_lit : ''' (_unicode_value | _byte_value) • ''' } Transitions: - [''','''] -> S64 + [''','''] -> S65 Action: nil Symbols classes: {[''',''']} -S87{ +S88{ _big_u_value : '\' 'U' _hex_digit _hex_digit • _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' @@ -1485,13 +1494,13 @@ S87{ char_lit : ''' (• _unicode_value | _byte_value) ''' } Transitions: - ['0','9'] -> S95 - ['A','F'] -> S95 - ['a','f'] -> S95 + ['0','9'] -> S96 + ['A','F'] -> S96 + ['a','f'] -> S96 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S88{ +S89{ _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • @@ -1501,31 +1510,31 @@ S88{ char_lit : ''' (• _unicode_value | _byte_value) ''' } Transitions: - ['0','9'] -> S96 - ['A','F'] -> S96 - ['a','f'] -> S96 + ['0','9'] -> S97 + ['A','F'] -> S97 + ['a','f'] -> S97 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S89{ +S90{ _byte_value : (_octal_byte_value | _hex_byte_value) • _hex_byte_value : '\' 'x' _hex_digit _hex_digit • _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • char_lit : ''' (_unicode_value | _byte_value) • ''' } Transitions: - [''','''] -> S64 + [''','''] -> S65 Action: nil Symbols classes: {[''',''']} -S90{ +S91{ g_sdt_lit : '<' '<' . {.} '>' '>' • } Transitions: Action: Accept("g_sdt_lit") Symbols classes: {} -S91{ +S92{ _digit : • '0'-'9' _id_char : (_upcase | _lowcase | '_' | _digit) • _id_char : _upcase | _lowcase | '_' | • _digit @@ -1542,14 +1551,14 @@ S91{ Λ : 'e' 'm' 'p' 't' 'y' • } Transitions: - ['0','9'] -> S44 - ['A','Z'] -> S45 - ['_','_'] -> S46 - ['a','z'] -> S47 + ['0','9'] -> S45 + ['A','Z'] -> S46 + ['_','_'] -> S47 + ['a','z'] -> S48 Action: Accept("Λ") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} -S92{ +S93{ _digit : • '0'-'9' _id_char : (_upcase | _lowcase | '_' | _digit) • _id_char : _upcase | _lowcase | '_' | • _digit @@ -1566,14 +1575,14 @@ S92{ Λ : 'e' 'r' 'r' 'o' 'r' • } Transitions: - ['0','9'] -> S44 - ['A','Z'] -> S45 - ['_','_'] -> S46 - ['a','z'] -> S47 + ['0','9'] -> S45 + ['A','Z'] -> S46 + ['_','_'] -> S47 + ['a','z'] -> S48 Action: Accept("Λ") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} -S93{ +S94{ _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit • _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' @@ -1584,13 +1593,13 @@ S93{ string_lit : _raw_string | • _interpreted_string } Transitions: - ['0','9'] -> S97 - ['A','F'] -> S97 - ['a','f'] -> S97 + ['0','9'] -> S98 + ['A','F'] -> S98 + ['a','f'] -> S98 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S94{ +S95{ _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • @@ -1601,13 +1610,13 @@ S94{ string_lit : _raw_string | • _interpreted_string } Transitions: - ['0','9'] -> S98 - ['A','F'] -> S98 - ['a','f'] -> S98 + ['0','9'] -> S99 + ['A','F'] -> S99 + ['a','f'] -> S99 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S95{ +S96{ _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit • _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' @@ -1617,13 +1626,13 @@ S95{ char_lit : ''' (• _unicode_value | _byte_value) ''' } Transitions: - ['0','9'] -> S99 - ['A','F'] -> S99 - ['a','f'] -> S99 + ['0','9'] -> S100 + ['A','F'] -> S100 + ['a','f'] -> S100 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S96{ +S97{ _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • @@ -1633,13 +1642,13 @@ S96{ char_lit : ''' (• _unicode_value | _byte_value) ''' } Transitions: - ['0','9'] -> S100 - ['A','F'] -> S100 - ['a','f'] -> S100 + ['0','9'] -> S101 + ['A','F'] -> S101 + ['a','f'] -> S101 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S97{ +S98{ _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit • _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' @@ -1650,13 +1659,13 @@ S97{ string_lit : _raw_string | • _interpreted_string } Transitions: - ['0','9'] -> S101 - ['A','F'] -> S101 - ['a','f'] -> S101 + ['0','9'] -> S102 + ['A','F'] -> S102 + ['a','f'] -> S102 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S98{ +S99{ _big_u_value : • '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _byte_value : _octal_byte_value | • _hex_byte_value _byte_value : • _octal_byte_value | _hex_byte_value @@ -1677,13 +1686,13 @@ S98{ string_lit : _raw_string | • _interpreted_string } Transitions: - ['"','"'] -> S27 - ['\','\'] -> S28 -. -> S29 + ['"','"'] -> S28 + ['\','\'] -> S29 +. -> S30 Action: nil Symbols classes: {['"','"'], ['\','\']} -S99{ +S100{ _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit • _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' @@ -1693,24 +1702,24 @@ S99{ char_lit : ''' (• _unicode_value | _byte_value) ''' } Transitions: - ['0','9'] -> S102 - ['A','F'] -> S102 - ['a','f'] -> S102 + ['0','9'] -> S103 + ['A','F'] -> S103 + ['a','f'] -> S103 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S100{ +S101{ _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _little_u_value : '\' 'u' _hex_digit _hex_digit _hex_digit _hex_digit • _unicode_value : (. | _little_u_value | _big_u_value | _escaped_char) • char_lit : ''' (_unicode_value | _byte_value) • ''' } Transitions: - [''','''] -> S64 + [''','''] -> S65 Action: nil Symbols classes: {[''',''']} -S101{ +S102{ _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit • _hex_digit _hex_digit _hex_digit _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' @@ -1720,22 +1729,6 @@ S101{ _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char string_lit : _raw_string | • _interpreted_string } -Transitions: - ['0','9'] -> S103 - ['A','F'] -> S103 - ['a','f'] -> S103 -Action: nil -Symbols classes: {['0','9'], ['A','F'], ['a','f']} - -S102{ - _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit • _hex_digit _hex_digit _hex_digit - _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' - _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' - _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • - _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' - _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char - char_lit : ''' (• _unicode_value | _byte_value) ''' -} Transitions: ['0','9'] -> S104 ['A','F'] -> S104 @@ -1744,14 +1737,13 @@ Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} S103{ - _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit • _hex_digit _hex_digit + _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit • _hex_digit _hex_digit _hex_digit _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' - _interpreted_string : '"' {• _unicode_value | _byte_value} '"' _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char - string_lit : _raw_string | • _interpreted_string + char_lit : ''' (• _unicode_value | _byte_value) ''' } Transitions: ['0','9'] -> S105 @@ -1766,8 +1758,9 @@ S104{ _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' + _interpreted_string : '"' {• _unicode_value | _byte_value} '"' _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char - char_lit : ''' (• _unicode_value | _byte_value) ''' + string_lit : _raw_string | • _interpreted_string } Transitions: ['0','9'] -> S106 @@ -1777,14 +1770,13 @@ Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} S105{ - _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit • _hex_digit + _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit • _hex_digit _hex_digit _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' - _interpreted_string : '"' {• _unicode_value | _byte_value} '"' _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char - string_lit : _raw_string | • _interpreted_string + char_lit : ''' (• _unicode_value | _byte_value) ''' } Transitions: ['0','9'] -> S107 @@ -1799,8 +1791,9 @@ S106{ _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' + _interpreted_string : '"' {• _unicode_value | _byte_value} '"' _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char - char_lit : ''' (• _unicode_value | _byte_value) ''' + string_lit : _raw_string | • _interpreted_string } Transitions: ['0','9'] -> S108 @@ -1810,6 +1803,22 @@ Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} S107{ + _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit • _hex_digit + _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' + _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' + _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • + _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' + _unicode_value : . | _little_u_value | • _big_u_value | _escaped_char + char_lit : ''' (• _unicode_value | _byte_value) ''' +} +Transitions: + ['0','9'] -> S109 + ['A','F'] -> S109 + ['a','f'] -> S109 +Action: nil +Symbols classes: {['0','9'], ['A','F'], ['a','f']} + +S108{ _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit • _big_u_value : • '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _byte_value : _octal_byte_value | • _hex_byte_value @@ -1830,20 +1839,20 @@ S107{ string_lit : _raw_string | • _interpreted_string } Transitions: - ['"','"'] -> S27 - ['\','\'] -> S28 -. -> S29 + ['"','"'] -> S28 + ['\','\'] -> S29 +. -> S30 Action: nil Symbols classes: {['"','"'], ['\','\']} -S108{ +S109{ _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit • _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _unicode_value : (. | _little_u_value | _big_u_value | _escaped_char) • char_lit : ''' (_unicode_value | _byte_value) • ''' } Transitions: - [''','''] -> S64 + [''','''] -> S65 Action: nil Symbols classes: {[''',''']} diff --git a/internal/frontend/reparsed/log/terminals.txt b/internal/frontend/reparsed/log/terminals.txt index 528a8226..577976d5 100644 --- a/internal/frontend/reparsed/log/terminals.txt +++ b/internal/frontend/reparsed/log/terminals.txt @@ -19,6 +19,7 @@ char_lit g_sdt_lit prodId string_lit +"@" "error" "λ" "empty" diff --git a/internal/frontend/reparsed/main/main.go b/internal/frontend/reparsed/main/main.go index 86688bb2..10b5a50d 100644 --- a/internal/frontend/reparsed/main/main.go +++ b/internal/frontend/reparsed/main/main.go @@ -18,13 +18,15 @@ func showResult(r interface{}, e error) { } var ( - File string - Text string + File string + Text string + Longest bool ) func main() { flag.StringVar(&File, "file", "", "parse also text in file") flag.StringVar(&Text, "text", "", "parse also text given with flag") + flag.BoolVar(&Longest, "longest", false, "parse longest possible part") flag.Parse() if Text > "" { showResult(reparsed.ParseText(Text)) diff --git a/internal/frontend/reparsed/reparsed.go b/internal/frontend/reparsed/reparsed.go index 5ba25d24..778fd1e1 100644 --- a/internal/frontend/reparsed/reparsed.go +++ b/internal/frontend/reparsed/reparsed.go @@ -6,9 +6,9 @@ import ( "io" "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/internal/io/stream" - lexer "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/internal/lexer/next" - parser "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/internal/parser/next" - token "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/internal/token/next" + "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/internal/lexer" + "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/internal/parser" + "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/internal/token" ) type Token = token.Token diff --git a/internal/lexer/gen/golang/lexer.go b/internal/lexer/gen/golang/lexer.go index 2980c279..25a854b5 100644 --- a/internal/lexer/gen/golang/lexer.go +++ b/internal/lexer/gen/golang/lexer.go @@ -40,23 +40,25 @@ func genLexer(pkg, outDir string, itemsets *items.ItemSets, cfg config.Config, s func getLexerData(pkg, outDir string, itemsets *items.ItemSets, cfg config.Config, subpath string) *lexerData { lexSymbols := itemsets.Symbols().List() return &lexerData{ - Debug: cfg.DebugLexer(), - TokenImport: path.Join(pkg, subpath, "token"), - UtilImport: path.Join(pkg, subpath, "util"), - NumStates: itemsets.Size(), - NumSymbols: len(lexSymbols), - Symbols: lexSymbols, + Debug: cfg.DebugLexer(), + TokenImport: path.Join(pkg, subpath, "token"), + UtilImport: path.Join(pkg, subpath, "util"), + StreamImport: path.Join(pkg, subpath, "io/stream"), + NumStates: itemsets.Size(), + NumSymbols: len(lexSymbols), + Symbols: lexSymbols, } } type lexerData struct { - Debug bool - TokenImport string - UtilImport string - NumStates int - NumSymbols int - NextState []byte - Symbols []string + Debug bool + TokenImport string + UtilImport string + StreamImport string + NumStates int + NumSymbols int + NextState []byte + Symbols []string } const lexerSrc string = ` @@ -66,11 +68,15 @@ package lexer import ( {{if .Debug}} "fmt" -{{end}} "io/ioutil" - "unicode/utf8" +{{end}} + "io" + "bytes" + "os" {{if .Debug}} "{{.UtilImport}}" -{{end}} "{{.TokenImport}}" +{{end}} +"{{.TokenImport}}" +"{{.StreamImport}}" ) const ( @@ -79,53 +85,81 @@ const ( NumSymbols = {{.NumSymbols}} ) -type Position struct { - pos int - line int - column int +type position struct { + token.Pos + StreamPosition int64 +} + +type lexerStream interface { + io.RuneReader + io.Seeker } type Lexer struct { - Position - src []byte + position + stream lexerStream + eof bool } func NewLexer(src []byte) *Lexer { - lexer := &Lexer{ src: src } - lexer.Position.Reset() + lexer := &Lexer{stream: bytes.NewReader(src)} + lexer.position.Reset() return lexer } func NewLexerFile(fpath string) (*Lexer, error) { - src, err := ioutil.ReadFile(fpath) + s, err := os.Open(fpath) if err != nil { return nil, err } - return NewLexer(src), nil + lexer := &Lexer{stream: stream.NewWindowReader(s)} + lexer.position.Reset() + return lexer, nil +} + +func NewLexerStream(reader io.Reader) (*Lexer, error) { + lexer := &Lexer{} + lexer.position.Reset() + if lexer.stream, _ = reader.(lexerStream); lexer.stream == nil { + lexer.stream = stream.NewWindowReader(reader) + } else { + lexer.position.StreamPosition, _ = lexer.stream.Seek(0, io.SeekCurrent) + } + return lexer, nil } func (l *Lexer) Scan() (tok *token.Token) { {{- if .Debug}} - fmt.Printf("Lexer.Scan() pos=%d\n", l.pos) + fmt.Printf("Lexer.Scan() pos=%d\n", l.position.Pos.Offset) {{- end}} tok = new(token.Token) - if l.pos >= len(l.src) { + if l.eof { tok.Type = token.EOF - tok.Pos.Offset, tok.Pos.Line, tok.Pos.Column = l.pos, l.line, l.column + tok.Pos = l.position.Pos return } - start, startLine, startColumn, end := l.pos, l.line, l.column, 0 + l.position.StreamPosition, _ = l.stream.Seek(0, io.SeekCurrent) + start, end := l.position, position{} tok.Type = token.INVALID - state, rune1, size := 0, rune(-1), 0 + tok.Lit = []byte{} + state, rune1 := 0, rune(-1) for state != -1 { {{- if .Debug}} - fmt.Printf("\tpos=%d, line=%d, col=%d, state=%d\n", l.pos, l.line, l.column, state) + fmt.Printf("\tpos=%d, line=%d, col=%d, state=%d\n", l.position.Pos.Offset, l.position.Pos.Line, l.position.Pos.Column, state) {{- end}} - if l.pos >= len(l.src) { + if l.eof { rune1 = -1 } else { - rune1, size = utf8.DecodeRune(l.src[l.pos:]) - l.pos += size + rune2, size, err := l.stream.ReadRune() + if err == io.EOF { + l.eof = true + err = nil + } + if err == nil && size > 0 { + rune1 = rune2 + l.position.StreamPosition += int64(size) + l.position.Pos.Offset += size + } } nextState := -1 @@ -134,7 +168,7 @@ func (l *Lexer) Scan() (tok *token.Token) { } {{- if .Debug}} fmt.Printf("\tS%d, : tok=%s, rune == %s(%x), next state == %d\n", state, token.TokMap.Id(tok.Type), util.RuneToString(rune1), rune1, nextState) - fmt.Printf("\t\tpos=%d, size=%d, start=%d, end=%d\n", l.pos, size, start, end) + fmt.Printf("\t\tpos=%d, size=%d, start=%d, end=%d\n", l.position.Pos.Offset, size, start.position.Pos.Offset, end.position.Pos.Offset) if nextState != -1 { fmt.Printf("\t\taction:%s\n", ActTab[nextState].String()) } @@ -142,97 +176,71 @@ func (l *Lexer) Scan() (tok *token.Token) { state = nextState if state != -1 { - switch rune1 { case '\n': - l.line++ - l.column = 1 + l.position.Pos.Line++ + l.position.Pos.Column = 1 case '\r': - l.column = 1 + l.position.Pos.Column = 1 case '\t': - l.column += 4 + l.position.Pos.Column += 4 default: - l.column++ + l.position.Pos.Column++ } switch { case ActTab[state].Accept != -1: tok.Type = ActTab[state].Accept - end = l.pos + l.position.StreamPosition, _ = l.stream.Seek(0, io.SeekCurrent) + end = l.position + tok.Lit = append(tok.Lit, string(rune1)...) case ActTab[state].Ignore != "": - start, startLine, startColumn = l.pos, l.line, l.column + start = l.position state = 0 - if start >= len(l.src) { + tok.Lit = []byte{} + if l.eof { tok.Type = token.EOF } } } else { if tok.Type == token.INVALID { - end = l.pos + end = l.position } } } - if end > start { - l.pos = end - tok.Lit = l.src[start:end] - } else { - tok.Lit = []byte{} + if end.Pos.Offset > start.Pos.Offset { + l.Reposition(end) } - tok.Pos.Offset, tok.Pos.Line, tok.Pos.Column = start, startLine, startColumn - + tok.Pos = start.Pos {{- if .Debug}} fmt.Printf("Token at %s: %s \"%s\"\n", tok.String(), token.TokMap.Id(tok.Type), tok.Lit) {{- end}} - return } func (l *Lexer) Reset() { - l.Position.Reset() + l.position.Reset() } -func (l *Lexer) Reposition(p Position) { - l.Position = p +func (l *Lexer) Reposition(p position) { + l.position = p + l.stream.Seek(l.position.StreamPosition, io.SeekStart) } -func (l Lexer) CurrentPosition() Position { - return l.Position +func (l Lexer) CurrentPosition() position { + return l.position } -func (l Lexer) Source() []byte { - return l.src +func (p *position) Reset() { + p.Offset = 0 + p.Line = 1 + p.Column = 1 } -func (l Lexer) Remaining() []byte { - return l.src[l.pos:] +func (p position) StartingFrom(base position) position { + r := p + r.Pos = p.Pos.StartingFrom(base.Pos) + return r } - - -func (p Position) Offset() int { - return p.pos -} - -func (p Position) Line() int { - return p.line -} - -func (p Position) Column() int { - return p.column -} - -func (p *Position) Reset() { - p.pos = 0 - p.line = 1 - p.column = 1 -} -` - -const dbgInfo = ` -/* -Lexer symbols: -{{- range $i, $sym := .Symbols}} -{{- printf "\n%d: %s" $i $sym}} -{{- end}} -*/ ` diff --git a/internal/parser/gen/golang/parser.go b/internal/parser/gen/golang/parser.go index 6bf64876..f1804050 100644 --- a/internal/parser/gen/golang/parser.go +++ b/internal/parser/gen/golang/parser.go @@ -84,12 +84,12 @@ type stack struct { attrib []Attrib } -const iNITIAL_STACK_SIZE = 100 +const INITIAL_STACK_SIZE = 100 func newStack() *stack { return &stack{ - state: make([]int, 0, iNITIAL_STACK_SIZE), - attrib: make([]Attrib, 0, iNITIAL_STACK_SIZE), + state: make([]int, 0, INITIAL_STACK_SIZE), + attrib: make([]Attrib, 0, INITIAL_STACK_SIZE), } } @@ -151,16 +151,28 @@ func (s *stack) String() string { type Parser struct { stack *stack nextToken *token.Token - pos int - UserContext interface{} + userContext interface{} + longest bool } type Scanner interface { Scan() (tok *token.Token) } +type Position interface{} + +type ContextDependentScanner interface { + Scanner + Reposition(p Position) + CurrentPosition() Position +} + func NewParser() *Parser { - p := &Parser{stack: newStack()} + return NewParserWithContext(nil) +} + +func NewParserWithContext(u interface{}) *Parser { + p := &Parser{stack: newStack(), userContext: u } p.Reset() return p } @@ -241,11 +253,27 @@ func (p *Parser) newError(err error) error { } func (p *Parser) Parse(scanner Scanner) (res interface{}, err error) { + p.longest = false + return p.parse(scanner) +} + +func (p *Parser) ParseLongestPrefix(scanner Scanner) (res interface{}, err error, parsed []byte) { + p.longest = true + r, e := p.parse(scanner) + return r, e, []byte{} +} + +func (p *Parser) parse(scanner Scanner) (res interface{}, err error) { p.Reset() p.nextToken = scanner.Scan() for acc := false; !acc; { action := actionTab[p.stack.top()].actions[p.nextToken.Type] + if action == nil { + + if p.longest { + } + if recovered, errAttrib := p.Error(nil, scanner); !recovered { p.nextToken = errAttrib.ErrorToken return nil, p.newError(nil) @@ -267,7 +295,7 @@ func (p *Parser) Parse(scanner Scanner) (res interface{}, err error) { p.nextToken = scanner.Scan() case reduce: prod := productionsTable[int(act)] - attrib, err := prod.ReduceFunc(p.stack.popN(prod.NumSymbols)) + attrib, err := prod.ReduceFunc(p.userContext, p.stack.popN(prod.NumSymbols)) if err != nil { return nil, p.newError(err) } else { diff --git a/internal/parser/gen/golang/productionstable.go b/internal/parser/gen/golang/productionstable.go index 70e6368f..f3bee7f2 100644 --- a/internal/parser/gen/golang/productionstable.go +++ b/internal/parser/gen/golang/productionstable.go @@ -105,7 +105,7 @@ type ( NTType int Index int NumSymbols int - ReduceFunc func([]Attrib) (Attrib, error) + ReduceFunc func(interface{}, []Attrib) (Attrib, error) } Attrib interface { } @@ -119,7 +119,7 @@ var productionsTable = ProdTab{ NTType: {{$entry.NTType}}, Index: {{$i}}, NumSymbols: {{$entry.NumSymbols}}, - ReduceFunc: func(X []Attrib) (Attrib, error) { + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { {{$entry.ReduceFunc}} }, }, diff --git a/internal/parser/symbols/symbols.go b/internal/parser/symbols/symbols.go index b9cd4e67..9ae8cb40 100644 --- a/internal/parser/symbols/symbols.go +++ b/internal/parser/symbols/symbols.go @@ -89,6 +89,13 @@ func (this *Symbols) listMatchingSymbols(match func(ast.SyntaxSymbol) bool) ast. return res } +func (this *Symbols) ListContextDependentTokenSymbols() ast.SyntaxSymbols { + return this.listMatchingSymbols(func(s ast.SyntaxSymbol) bool { + _, r := s.(ast.SyntaxContextDependentTokId) + return r + }) +} + /* Return a slice containing the ids of all symbols declared as string literals in the grammar. */ diff --git a/internal/token/gen/golang/token.go b/internal/token/gen/golang/token.go index 0a60aeb6..95e3e2e3 100644 --- a/internal/token/gen/golang/token.go +++ b/internal/token/gen/golang/token.go @@ -71,18 +71,12 @@ import ( "fmt" ) -type UserContext interface {} - -type ParseContext struct { - Remaining []byte -} - type Token struct { Type - Lit []byte + Lit []byte Pos - Context *ParseContext - User UserContext + ForeingAstNode interface{} + ForeingAstError error } type Type int @@ -102,6 +96,20 @@ func (p Pos) String() string { return fmt.Sprintf("Pos(offset=%d, line=%d, column=%d)", p.Offset, p.Line, p.Column) } +func (p Pos) StartingFrom(base Pos) Pos { + r := base + r.Offset += p.Offset + r.Line += p.Line + r.Column = p.Column + if p.Line > 0 && base.Line > 0 { + r.Line-- + } + if r.Column < 1 { + r.Column = 1 + } + return r +} + type TokenMap struct { typeMap []string idMap map[string]Type @@ -122,8 +130,7 @@ func (m TokenMap) Type(tok string) Type { } func (m TokenMap) TokenString(tok *Token) string { - //TODO: refactor to print pos & token string properly - return fmt.Sprintf("%s(%d,%s)", m.Id(tok.Type), tok.Type, tok.Lit) + return fmt.Sprintf("%s(%d,<%s>)", m.Id(tok.Type), tok.Type, tok.Lit) } func (m TokenMap) StringType(typ Type) string { @@ -141,6 +148,7 @@ var TokMap = TokenMap{ {{- range .IdMap }} {{printf "%s" .}}, {{- end }} + }, } ` diff --git a/spec/gocc2.ebnf b/spec/gocc2.ebnf index 9ec40c87..dd2fddbf 100644 --- a/spec/gocc2.ebnf +++ b/spec/gocc2.ebnf @@ -12,9 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. - - - !comment : _lineComment | _blockComment ; !whitespace : ' ' | '\t' | '\n' | '\r' ; @@ -26,9 +23,7 @@ _id_char : _upcase | _lowcase | '_' | _digit ; _upcase : 'A'-'Z' ; _digit : '0'-'9' ; - _unicode_value - : . // Any UTF-8 character literal | _little_u_value | _big_u_value @@ -291,6 +286,10 @@ Symbol : | string_lit << ast.NewStringLit($0) >> + | + "@" + tokId + << ast.NewContextDependentTokId($1) >> ; ErrorSymbol : diff --git a/spec/test.bnf b/spec/test.bnf index 7e69d831..dd04204c 100644 --- a/spec/test.bnf +++ b/spec/test.bnf @@ -31,9 +31,14 @@ T hexdigit ; -T : "a" | "X" | ProdX | "λ1"; +T : "a" | "X" | ProdX | "λ1" | X; ProdX : "empty" | "ε" | "λ" | empty | ε ; -X: "!" | "hexdigit"; +X: + "!" + | "hexdigit" + | @altro + << f(Context) >> +; From 40dba9e682f53e7c07d7266308fe09aa096e1b1b Mon Sep 17 00:00:00 2001 From: Massimiliano Calandrelli Date: Wed, 9 Oct 2019 13:00:50 +0200 Subject: [PATCH 14/33] ... --- internal/ast/syntaxcontextdependenttokenid.go | 14 +- .../reparsed/internal/lexer/acttab.go | 122 +- .../frontend/reparsed/internal/lexer/lexer.go | 4 +- .../internal/lexer/transitiontable.go | 694 +- .../reparsed/internal/parser/actiontable.go | 9618 +++++++++-------- .../reparsed/internal/parser/gototable.go | 324 +- .../reparsed/internal/parser/parser.go | 78 +- .../internal/parser/productionstable.go | 4 +- .../frontend/reparsed/internal/token/token.go | 7 +- internal/frontend/reparsed/log/LR1_sets.txt | 911 +- internal/frontend/reparsed/log/first.txt | 4 - internal/frontend/reparsed/log/lexer_sets.txt | 714 +- internal/frontend/reparsed/log/terminals.txt | 2 +- internal/parser/gen/golang/actiontable.go | 50 +- internal/parser/gen/golang/parser.go | 76 +- internal/token/gen/golang/token.go | 1 - spec/gocc2.ebnf | 8 +- spec/test.bnf | 16 +- 18 files changed, 6379 insertions(+), 6268 deletions(-) diff --git a/internal/ast/syntaxcontextdependenttokenid.go b/internal/ast/syntaxcontextdependenttokenid.go index 838a9e51..f9cef6d3 100644 --- a/internal/ast/syntaxcontextdependenttokenid.go +++ b/internal/ast/syntaxcontextdependenttokenid.go @@ -23,14 +23,20 @@ import ( type SyntaxContextDependentTokId struct { string StdSyntaxSymbol + ContexDependentParseFunctionCall string } -func NewContextDependentTokId(tokId interface{}) (SyntaxContextDependentTokId, error) { - return SyntaxContextDependentTokId{getString(tokId), StdSyntaxSymbol{}}, nil +var ( + tokenIdCount = 0 +) + +func NewContextDependentTokId(tokId, ctxdeplit interface{}) (SyntaxContextDependentTokId, error) { + return NewNewContextDependentTokIdFromString(getString(tokId), getString(ctxdeplit)), nil } -func NewNewContextDependentTokIdFromString(str string) SyntaxContextDependentTokId { - return SyntaxContextDependentTokId{str, StdSyntaxSymbol{}} +func NewNewContextDependentTokIdFromString(tokId, ctxdeplit string) SyntaxContextDependentTokId { + tokenIdCount++ + return SyntaxContextDependentTokId{fmt.Sprintf("%s#%d", tokId, tokenIdCount), StdSyntaxSymbol{}, ctxdeplit[2 : len(ctxdeplit)-2]} } func (this SyntaxContextDependentTokId) SymbolString() string { diff --git a/internal/frontend/reparsed/internal/lexer/acttab.go b/internal/frontend/reparsed/internal/lexer/acttab.go index e77059c6..0d270dd3 100644 --- a/internal/frontend/reparsed/internal/lexer/acttab.go +++ b/internal/frontend/reparsed/internal/lexer/acttab.go @@ -72,8 +72,8 @@ var ActTab = ActionTable{ Accept: 0, Ignore: "", }, - ActionRow{ // S13, Accept("Λ<@>") - Accept: 21, + ActionRow{ // S13, + Accept: 0, Ignore: "", }, ActionRow{ // S14, Accept("prodId") @@ -164,8 +164,8 @@ var ActTab = ActionTable{ Accept: 0, Ignore: "", }, - ActionRow{ // S36, Accept("prodId") - Accept: 19, + ActionRow{ // S36, + Accept: 0, Ignore: "", }, ActionRow{ // S37, Accept("prodId") @@ -180,8 +180,8 @@ var ActTab = ActionTable{ Accept: 19, Ignore: "", }, - ActionRow{ // S40, Accept("regDefId") - Accept: 5, + ActionRow{ // S40, Accept("prodId") + Accept: 19, Ignore: "", }, ActionRow{ // S41, Accept("regDefId") @@ -196,12 +196,12 @@ var ActTab = ActionTable{ Accept: 5, Ignore: "", }, - ActionRow{ // S44, Accept("string_lit") - Accept: 20, + ActionRow{ // S44, Accept("regDefId") + Accept: 5, Ignore: "", }, - ActionRow{ // S45, Accept("tokId") - Accept: 2, + ActionRow{ // S45, Accept("string_lit") + Accept: 20, Ignore: "", }, ActionRow{ // S46, Accept("tokId") @@ -224,8 +224,8 @@ var ActTab = ActionTable{ Accept: 2, Ignore: "", }, - ActionRow{ // S51, Accept("ignoredTokId") - Accept: 6, + ActionRow{ // S51, Accept("tokId") + Accept: 2, Ignore: "", }, ActionRow{ // S52, Accept("ignoredTokId") @@ -240,8 +240,8 @@ var ActTab = ActionTable{ Accept: 6, Ignore: "", }, - ActionRow{ // S55, - Accept: 0, + ActionRow{ // S55, Accept("ignoredTokId") + Accept: 6, Ignore: "", }, ActionRow{ // S56, @@ -280,36 +280,36 @@ var ActTab = ActionTable{ Accept: 0, Ignore: "", }, - ActionRow{ // S65, Accept("char_lit") + ActionRow{ // S65, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S66, Accept("char_lit") Accept: 9, Ignore: "", }, - ActionRow{ // S66, + ActionRow{ // S67, Accept: 0, Ignore: "", }, - ActionRow{ // S67, Ignore("!comment") + ActionRow{ // S68, Ignore("!comment") Accept: -1, Ignore: "!comment", }, - ActionRow{ // S68, + ActionRow{ // S69, Accept: 0, Ignore: "", }, - ActionRow{ // S69, Accept("tokId") - Accept: 2, + ActionRow{ // S70, + Accept: 0, Ignore: "", }, - ActionRow{ // S70, Accept("tokId") + ActionRow{ // S71, Accept("tokId") Accept: 2, Ignore: "", }, - ActionRow{ // S71, - Accept: 0, - Ignore: "", - }, - ActionRow{ // S72, - Accept: 0, + ActionRow{ // S72, Accept("tokId") + Accept: 2, Ignore: "", }, ActionRow{ // S73, @@ -336,32 +336,32 @@ var ActTab = ActionTable{ Accept: 0, Ignore: "", }, - ActionRow{ // S79, Ignore("!comment") - Accept: -1, - Ignore: "!comment", + ActionRow{ // S79, + Accept: 0, + Ignore: "", }, ActionRow{ // S80, Accept: 0, Ignore: "", }, - ActionRow{ // S81, Accept("tokId") - Accept: 2, - Ignore: "", + ActionRow{ // S81, Ignore("!comment") + Accept: -1, + Ignore: "!comment", }, - ActionRow{ // S82, Accept("tokId") - Accept: 2, + ActionRow{ // S82, + Accept: 0, Ignore: "", }, ActionRow{ // S83, Accept: 0, Ignore: "", }, - ActionRow{ // S84, - Accept: 0, + ActionRow{ // S84, Accept("tokId") + Accept: 2, Ignore: "", }, - ActionRow{ // S85, - Accept: 0, + ActionRow{ // S85, Accept("tokId") + Accept: 2, Ignore: "", }, ActionRow{ // S86, @@ -384,32 +384,32 @@ var ActTab = ActionTable{ Accept: 0, Ignore: "", }, - ActionRow{ // S91, Accept("g_sdt_lit") - Accept: 18, + ActionRow{ // S91, + Accept: 0, Ignore: "", }, - ActionRow{ // S92, Accept("Λ") - Accept: 24, + ActionRow{ // S92, + Accept: 0, Ignore: "", }, - ActionRow{ // S93, Accept("Λ") - Accept: 22, + ActionRow{ // S93, + Accept: 0, Ignore: "", }, - ActionRow{ // S94, - Accept: 0, + ActionRow{ // S94, Accept("g_sdt_lit") + Accept: 18, Ignore: "", }, - ActionRow{ // S95, - Accept: 0, + ActionRow{ // S95, Accept("g_ctxdep_lit") + Accept: 21, Ignore: "", }, - ActionRow{ // S96, - Accept: 0, + ActionRow{ // S96, Accept("Λ") + Accept: 24, Ignore: "", }, - ActionRow{ // S97, - Accept: 0, + ActionRow{ // S97, Accept("Λ") + Accept: 22, Ignore: "", }, ActionRow{ // S98, @@ -460,4 +460,20 @@ var ActTab = ActionTable{ Accept: 0, Ignore: "", }, + ActionRow{ // S110, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S111, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S112, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S113, + Accept: 0, + Ignore: "", + }, } diff --git a/internal/frontend/reparsed/internal/lexer/lexer.go b/internal/frontend/reparsed/internal/lexer/lexer.go index 49526d5f..43efa836 100644 --- a/internal/frontend/reparsed/internal/lexer/lexer.go +++ b/internal/frontend/reparsed/internal/lexer/lexer.go @@ -15,8 +15,8 @@ import ( const ( NoState = -1 - NumStates = 110 - NumSymbols = 76 + NumStates = 114 + NumSymbols = 79 ) type position struct { diff --git a/internal/frontend/reparsed/internal/lexer/transitiontable.go b/internal/frontend/reparsed/internal/lexer/transitiontable.go index d6266ccc..c96a5ea5 100644 --- a/internal/frontend/reparsed/internal/lexer/transitiontable.go +++ b/internal/frontend/reparsed/internal/lexer/transitiontable.go @@ -167,6 +167,8 @@ var TransTab = TransitionTable{ // S13 func(r rune) int { switch { + case r == 60: // ['<','<'] + return 36 } return NoState }, @@ -174,13 +176,13 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 36 - case 65 <= r && r <= 90: // ['A','Z'] return 37 - case r == 95: // ['_','_'] + case 65 <= r && r <= 90: // ['A','Z'] return 38 - case 97 <= r && r <= 122: // ['a','z'] + case r == 95: // ['_','_'] return 39 + case 97 <= r && r <= 122: // ['a','z'] + return 40 } return NoState }, @@ -200,13 +202,13 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 40 - case 65 <= r && r <= 90: // ['A','Z'] return 41 - case r == 95: // ['_','_'] + case 65 <= r && r <= 90: // ['A','Z'] return 42 - case 97 <= r && r <= 122: // ['a','z'] + case r == 95: // ['_','_'] return 43 + case 97 <= r && r <= 122: // ['a','z'] + return 44 } return NoState }, @@ -214,7 +216,7 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case r == 96: // ['`','`'] - return 44 + return 45 default: return 18 } @@ -223,13 +225,13 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 45 - case 65 <= r && r <= 90: // ['A','Z'] return 46 - case r == 95: // ['_','_'] + case 65 <= r && r <= 90: // ['A','Z'] return 47 - case 97 <= r && r <= 122: // ['a','z'] + case r == 95: // ['_','_'] return 48 + case 97 <= r && r <= 122: // ['a','z'] + return 49 } return NoState }, @@ -237,21 +239,21 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 45 - case 65 <= r && r <= 90: // ['A','Z'] return 46 - case r == 95: // ['_','_'] + case 65 <= r && r <= 90: // ['A','Z'] return 47 - case 97 <= r && r <= 108: // ['a','l'] + case r == 95: // ['_','_'] return 48 - case r == 109: // ['m','m'] + case 97 <= r && r <= 108: // ['a','l'] return 49 + case r == 109: // ['m','m'] + return 50 case 110 <= r && r <= 113: // ['n','q'] - return 48 + return 49 case r == 114: // ['r','r'] - return 50 + return 51 case 115 <= r && r <= 122: // ['s','z'] - return 48 + return 49 } return NoState }, @@ -295,13 +297,13 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 51 - case 65 <= r && r <= 90: // ['A','Z'] return 52 - case r == 95: // ['_','_'] + case 65 <= r && r <= 90: // ['A','Z'] return 53 - case 97 <= r && r <= 122: // ['a','z'] + case r == 95: // ['_','_'] return 54 + case 97 <= r && r <= 122: // ['a','z'] + return 55 } return NoState }, @@ -315,33 +317,33 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case r == 34: // ['"','"'] - return 55 + return 56 case r == 39: // [''','''] - return 55 - case 48 <= r && r <= 55: // ['0','7'] return 56 - case r == 85: // ['U','U'] + case 48 <= r && r <= 55: // ['0','7'] return 57 + case r == 85: // ['U','U'] + return 58 case r == 92: // ['\','\'] - return 55 + return 56 case r == 97: // ['a','a'] - return 55 + return 56 case r == 98: // ['b','b'] - return 55 + return 56 case r == 102: // ['f','f'] - return 55 + return 56 case r == 110: // ['n','n'] - return 55 + return 56 case r == 114: // ['r','r'] - return 55 + return 56 case r == 116: // ['t','t'] - return 55 + return 56 case r == 117: // ['u','u'] - return 58 + return 59 case r == 118: // ['v','v'] - return 55 + return 56 case r == 120: // ['x','x'] - return 59 + return 60 } return NoState }, @@ -360,33 +362,33 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case r == 34: // ['"','"'] - return 60 + return 61 case r == 39: // [''','''] - return 60 - case 48 <= r && r <= 55: // ['0','7'] return 61 - case r == 85: // ['U','U'] + case 48 <= r && r <= 55: // ['0','7'] return 62 + case r == 85: // ['U','U'] + return 63 case r == 92: // ['\','\'] - return 60 + return 61 case r == 97: // ['a','a'] - return 60 + return 61 case r == 98: // ['b','b'] - return 60 + return 61 case r == 102: // ['f','f'] - return 60 + return 61 case r == 110: // ['n','n'] - return 60 + return 61 case r == 114: // ['r','r'] - return 60 + return 61 case r == 116: // ['t','t'] - return 60 + return 61 case r == 117: // ['u','u'] - return 63 + return 64 case r == 118: // ['v','v'] - return 60 + return 61 case r == 120: // ['x','x'] - return 64 + return 65 } return NoState }, @@ -394,7 +396,7 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case r == 39: // [''','''] - return 65 + return 66 } return NoState }, @@ -402,7 +404,7 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case r == 42: // ['*','*'] - return 66 + return 67 default: return 33 } @@ -411,7 +413,7 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case r == 10: // ['\n','\n'] - return 67 + return 68 default: return 34 } @@ -420,34 +422,27 @@ var TransTab = TransitionTable{ func(r rune) int { switch { default: - return 68 + return 69 } }, // S36 func(r rune) int { switch { - case 48 <= r && r <= 57: // ['0','9'] - return 36 - case 65 <= r && r <= 90: // ['A','Z'] - return 37 - case r == 95: // ['_','_'] - return 38 - case 97 <= r && r <= 122: // ['a','z'] - return 39 + default: + return 70 } - return NoState }, // S37 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 36 - case 65 <= r && r <= 90: // ['A','Z'] return 37 - case r == 95: // ['_','_'] + case 65 <= r && r <= 90: // ['A','Z'] return 38 - case 97 <= r && r <= 122: // ['a','z'] + case r == 95: // ['_','_'] return 39 + case 97 <= r && r <= 122: // ['a','z'] + return 40 } return NoState }, @@ -455,13 +450,13 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 36 - case 65 <= r && r <= 90: // ['A','Z'] return 37 - case r == 95: // ['_','_'] + case 65 <= r && r <= 90: // ['A','Z'] return 38 - case 97 <= r && r <= 122: // ['a','z'] + case r == 95: // ['_','_'] return 39 + case 97 <= r && r <= 122: // ['a','z'] + return 40 } return NoState }, @@ -469,13 +464,13 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 36 - case 65 <= r && r <= 90: // ['A','Z'] return 37 - case r == 95: // ['_','_'] + case 65 <= r && r <= 90: // ['A','Z'] return 38 - case 97 <= r && r <= 122: // ['a','z'] + case r == 95: // ['_','_'] return 39 + case 97 <= r && r <= 122: // ['a','z'] + return 40 } return NoState }, @@ -483,13 +478,13 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 40 + return 37 case 65 <= r && r <= 90: // ['A','Z'] - return 41 + return 38 case r == 95: // ['_','_'] - return 42 + return 39 case 97 <= r && r <= 122: // ['a','z'] - return 43 + return 40 } return NoState }, @@ -497,13 +492,13 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 40 - case 65 <= r && r <= 90: // ['A','Z'] return 41 - case r == 95: // ['_','_'] + case 65 <= r && r <= 90: // ['A','Z'] return 42 - case 97 <= r && r <= 122: // ['a','z'] + case r == 95: // ['_','_'] return 43 + case 97 <= r && r <= 122: // ['a','z'] + return 44 } return NoState }, @@ -511,13 +506,13 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 40 - case 65 <= r && r <= 90: // ['A','Z'] return 41 - case r == 95: // ['_','_'] + case 65 <= r && r <= 90: // ['A','Z'] return 42 - case 97 <= r && r <= 122: // ['a','z'] + case r == 95: // ['_','_'] return 43 + case 97 <= r && r <= 122: // ['a','z'] + return 44 } return NoState }, @@ -525,33 +520,33 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 40 - case 65 <= r && r <= 90: // ['A','Z'] return 41 - case r == 95: // ['_','_'] + case 65 <= r && r <= 90: // ['A','Z'] return 42 - case 97 <= r && r <= 122: // ['a','z'] + case r == 95: // ['_','_'] return 43 + case 97 <= r && r <= 122: // ['a','z'] + return 44 } return NoState }, // S44 func(r rune) int { switch { + case 48 <= r && r <= 57: // ['0','9'] + return 41 + case 65 <= r && r <= 90: // ['A','Z'] + return 42 + case r == 95: // ['_','_'] + return 43 + case 97 <= r && r <= 122: // ['a','z'] + return 44 } return NoState }, // S45 func(r rune) int { switch { - case 48 <= r && r <= 57: // ['0','9'] - return 45 - case 65 <= r && r <= 90: // ['A','Z'] - return 46 - case r == 95: // ['_','_'] - return 47 - case 97 <= r && r <= 122: // ['a','z'] - return 48 } return NoState }, @@ -559,13 +554,13 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 45 - case 65 <= r && r <= 90: // ['A','Z'] return 46 - case r == 95: // ['_','_'] + case 65 <= r && r <= 90: // ['A','Z'] return 47 - case 97 <= r && r <= 122: // ['a','z'] + case r == 95: // ['_','_'] return 48 + case 97 <= r && r <= 122: // ['a','z'] + return 49 } return NoState }, @@ -573,13 +568,13 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 45 - case 65 <= r && r <= 90: // ['A','Z'] return 46 - case r == 95: // ['_','_'] + case 65 <= r && r <= 90: // ['A','Z'] return 47 - case 97 <= r && r <= 122: // ['a','z'] + case r == 95: // ['_','_'] return 48 + case 97 <= r && r <= 122: // ['a','z'] + return 49 } return NoState }, @@ -587,13 +582,13 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 45 - case 65 <= r && r <= 90: // ['A','Z'] return 46 - case r == 95: // ['_','_'] + case 65 <= r && r <= 90: // ['A','Z'] return 47 - case 97 <= r && r <= 122: // ['a','z'] + case r == 95: // ['_','_'] return 48 + case 97 <= r && r <= 122: // ['a','z'] + return 49 } return NoState }, @@ -601,17 +596,13 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 45 - case 65 <= r && r <= 90: // ['A','Z'] return 46 - case r == 95: // ['_','_'] + case 65 <= r && r <= 90: // ['A','Z'] return 47 - case 97 <= r && r <= 111: // ['a','o'] - return 48 - case r == 112: // ['p','p'] - return 69 - case 113 <= r && r <= 122: // ['q','z'] + case r == 95: // ['_','_'] return 48 + case 97 <= r && r <= 122: // ['a','z'] + return 49 } return NoState }, @@ -619,17 +610,17 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 45 - case 65 <= r && r <= 90: // ['A','Z'] return 46 - case r == 95: // ['_','_'] + case 65 <= r && r <= 90: // ['A','Z'] return 47 - case 97 <= r && r <= 113: // ['a','q'] - return 48 - case r == 114: // ['r','r'] - return 70 - case 115 <= r && r <= 122: // ['s','z'] + case r == 95: // ['_','_'] return 48 + case 97 <= r && r <= 111: // ['a','o'] + return 49 + case r == 112: // ['p','p'] + return 71 + case 113 <= r && r <= 122: // ['q','z'] + return 49 } return NoState }, @@ -637,13 +628,17 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 51 + return 46 case 65 <= r && r <= 90: // ['A','Z'] - return 52 + return 47 case r == 95: // ['_','_'] - return 53 - case 97 <= r && r <= 122: // ['a','z'] - return 54 + return 48 + case 97 <= r && r <= 113: // ['a','q'] + return 49 + case r == 114: // ['r','r'] + return 72 + case 115 <= r && r <= 122: // ['s','z'] + return 49 } return NoState }, @@ -651,13 +646,13 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 51 - case 65 <= r && r <= 90: // ['A','Z'] return 52 - case r == 95: // ['_','_'] + case 65 <= r && r <= 90: // ['A','Z'] return 53 - case 97 <= r && r <= 122: // ['a','z'] + case r == 95: // ['_','_'] return 54 + case 97 <= r && r <= 122: // ['a','z'] + return 55 } return NoState }, @@ -665,13 +660,13 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 51 - case 65 <= r && r <= 90: // ['A','Z'] return 52 - case r == 95: // ['_','_'] + case 65 <= r && r <= 90: // ['A','Z'] return 53 - case 97 <= r && r <= 122: // ['a','z'] + case r == 95: // ['_','_'] return 54 + case 97 <= r && r <= 122: // ['a','z'] + return 55 } return NoState }, @@ -679,17 +674,31 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 51 - case 65 <= r && r <= 90: // ['A','Z'] return 52 - case r == 95: // ['_','_'] + case 65 <= r && r <= 90: // ['A','Z'] return 53 - case 97 <= r && r <= 122: // ['a','z'] + case r == 95: // ['_','_'] return 54 + case 97 <= r && r <= 122: // ['a','z'] + return 55 } return NoState }, // S55 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 52 + case 65 <= r && r <= 90: // ['A','Z'] + return 53 + case r == 95: // ['_','_'] + return 54 + case 97 <= r && r <= 122: // ['a','z'] + return 55 + } + return NoState + }, + // S56 func(r rune) int { switch { case r == 34: // ['"','"'] @@ -700,309 +709,326 @@ var TransTab = TransitionTable{ return 30 } }, - // S56 + // S57 func(r rune) int { switch { case 48 <= r && r <= 55: // ['0','7'] - return 71 + return 73 } return NoState }, - // S57 + // S58 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 72 + return 74 case 65 <= r && r <= 70: // ['A','F'] - return 72 + return 74 case 97 <= r && r <= 102: // ['a','f'] - return 72 + return 74 } return NoState }, - // S58 + // S59 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 73 + return 75 case 65 <= r && r <= 70: // ['A','F'] - return 73 + return 75 case 97 <= r && r <= 102: // ['a','f'] - return 73 + return 75 } return NoState }, - // S59 + // S60 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 74 + return 76 case 65 <= r && r <= 70: // ['A','F'] - return 74 + return 76 case 97 <= r && r <= 102: // ['a','f'] - return 74 + return 76 } return NoState }, - // S60 + // S61 func(r rune) int { switch { case r == 39: // [''','''] - return 65 + return 66 } return NoState }, - // S61 + // S62 func(r rune) int { switch { case 48 <= r && r <= 55: // ['0','7'] - return 75 + return 77 } return NoState }, - // S62 + // S63 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 76 + return 78 case 65 <= r && r <= 70: // ['A','F'] - return 76 + return 78 case 97 <= r && r <= 102: // ['a','f'] - return 76 + return 78 } return NoState }, - // S63 + // S64 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 77 + return 79 case 65 <= r && r <= 70: // ['A','F'] - return 77 + return 79 case 97 <= r && r <= 102: // ['a','f'] - return 77 + return 79 } return NoState }, - // S64 + // S65 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 78 + return 80 case 65 <= r && r <= 70: // ['A','F'] - return 78 + return 80 case 97 <= r && r <= 102: // ['a','f'] - return 78 + return 80 } return NoState }, - // S65 + // S66 func(r rune) int { switch { } return NoState }, - // S66 + // S67 func(r rune) int { switch { case r == 42: // ['*','*'] - return 66 + return 67 case r == 47: // ['/','/'] - return 79 + return 81 default: return 33 } }, - // S67 + // S68 func(r rune) int { switch { } return NoState }, - // S68 + // S69 func(r rune) int { switch { case r == 62: // ['>','>'] - return 80 + return 82 default: - return 68 + return 69 } }, - // S69 + // S70 + func(r rune) int { + switch { + case r == 62: // ['>','>'] + return 83 + default: + return 70 + } + }, + // S71 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 45 - case 65 <= r && r <= 90: // ['A','Z'] return 46 - case r == 95: // ['_','_'] + case 65 <= r && r <= 90: // ['A','Z'] return 47 - case 97 <= r && r <= 115: // ['a','s'] + case r == 95: // ['_','_'] return 48 + case 97 <= r && r <= 115: // ['a','s'] + return 49 case r == 116: // ['t','t'] - return 81 + return 84 case 117 <= r && r <= 122: // ['u','z'] - return 48 + return 49 } return NoState }, - // S70 + // S72 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 45 - case 65 <= r && r <= 90: // ['A','Z'] return 46 - case r == 95: // ['_','_'] + case 65 <= r && r <= 90: // ['A','Z'] return 47 - case 97 <= r && r <= 110: // ['a','n'] + case r == 95: // ['_','_'] return 48 + case 97 <= r && r <= 110: // ['a','n'] + return 49 case r == 111: // ['o','o'] - return 82 + return 85 case 112 <= r && r <= 122: // ['p','z'] - return 48 + return 49 } return NoState }, - // S71 + // S73 func(r rune) int { switch { case 48 <= r && r <= 55: // ['0','7'] - return 83 + return 86 } return NoState }, - // S72 + // S74 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 84 + return 87 case 65 <= r && r <= 70: // ['A','F'] - return 84 + return 87 case 97 <= r && r <= 102: // ['a','f'] - return 84 + return 87 } return NoState }, - // S73 + // S75 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 85 + return 88 case 65 <= r && r <= 70: // ['A','F'] - return 85 + return 88 case 97 <= r && r <= 102: // ['a','f'] - return 85 + return 88 } return NoState }, - // S74 + // S76 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 86 + return 89 case 65 <= r && r <= 70: // ['A','F'] - return 86 + return 89 case 97 <= r && r <= 102: // ['a','f'] - return 86 + return 89 } return NoState }, - // S75 + // S77 func(r rune) int { switch { case 48 <= r && r <= 55: // ['0','7'] - return 87 + return 90 } return NoState }, - // S76 + // S78 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 88 + return 91 case 65 <= r && r <= 70: // ['A','F'] - return 88 + return 91 case 97 <= r && r <= 102: // ['a','f'] - return 88 + return 91 } return NoState }, - // S77 + // S79 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 89 + return 92 case 65 <= r && r <= 70: // ['A','F'] - return 89 + return 92 case 97 <= r && r <= 102: // ['a','f'] - return 89 + return 92 } return NoState }, - // S78 + // S80 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 90 + return 93 case 65 <= r && r <= 70: // ['A','F'] - return 90 + return 93 case 97 <= r && r <= 102: // ['a','f'] - return 90 + return 93 } return NoState }, - // S79 + // S81 func(r rune) int { switch { } return NoState }, - // S80 + // S82 func(r rune) int { switch { case r == 62: // ['>','>'] - return 91 + return 94 } return NoState }, - // S81 + // S83 + func(r rune) int { + switch { + case r == 64: // ['@','@'] + return 95 + } + return NoState + }, + // S84 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 45 - case 65 <= r && r <= 90: // ['A','Z'] return 46 - case r == 95: // ['_','_'] + case 65 <= r && r <= 90: // ['A','Z'] return 47 - case 97 <= r && r <= 120: // ['a','x'] + case r == 95: // ['_','_'] return 48 + case 97 <= r && r <= 120: // ['a','x'] + return 49 case r == 121: // ['y','y'] - return 92 + return 96 case r == 122: // ['z','z'] - return 48 + return 49 } return NoState }, - // S82 + // S85 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 45 - case 65 <= r && r <= 90: // ['A','Z'] return 46 - case r == 95: // ['_','_'] + case 65 <= r && r <= 90: // ['A','Z'] return 47 - case 97 <= r && r <= 113: // ['a','q'] + case r == 95: // ['_','_'] return 48 + case 97 <= r && r <= 113: // ['a','q'] + return 49 case r == 114: // ['r','r'] - return 93 + return 97 case 115 <= r && r <= 122: // ['s','z'] - return 48 + return 49 } return NoState }, - // S83 + // S86 func(r rune) int { switch { case r == 34: // ['"','"'] @@ -1013,31 +1039,31 @@ var TransTab = TransitionTable{ return 30 } }, - // S84 + // S87 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 94 + return 98 case 65 <= r && r <= 70: // ['A','F'] - return 94 + return 98 case 97 <= r && r <= 102: // ['a','f'] - return 94 + return 98 } return NoState }, - // S85 + // S88 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 95 + return 99 case 65 <= r && r <= 70: // ['A','F'] - return 95 + return 99 case 97 <= r && r <= 102: // ['a','f'] - return 95 + return 99 } return NoState }, - // S86 + // S89 func(r rune) int { switch { case r == 34: // ['"','"'] @@ -1048,141 +1074,147 @@ var TransTab = TransitionTable{ return 30 } }, - // S87 + // S90 func(r rune) int { switch { case r == 39: // [''','''] - return 65 + return 66 } return NoState }, - // S88 + // S91 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 96 + return 100 case 65 <= r && r <= 70: // ['A','F'] - return 96 + return 100 case 97 <= r && r <= 102: // ['a','f'] - return 96 + return 100 } return NoState }, - // S89 + // S92 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 97 + return 101 case 65 <= r && r <= 70: // ['A','F'] - return 97 + return 101 case 97 <= r && r <= 102: // ['a','f'] - return 97 + return 101 } return NoState }, - // S90 + // S93 func(r rune) int { switch { case r == 39: // [''','''] - return 65 + return 66 } return NoState }, - // S91 + // S94 func(r rune) int { switch { } return NoState }, - // S92 + // S95 + func(r rune) int { + switch { + } + return NoState + }, + // S96 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 45 - case 65 <= r && r <= 90: // ['A','Z'] return 46 - case r == 95: // ['_','_'] + case 65 <= r && r <= 90: // ['A','Z'] return 47 - case 97 <= r && r <= 122: // ['a','z'] + case r == 95: // ['_','_'] return 48 + case 97 <= r && r <= 122: // ['a','z'] + return 49 } return NoState }, - // S93 + // S97 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 45 - case 65 <= r && r <= 90: // ['A','Z'] return 46 - case r == 95: // ['_','_'] + case 65 <= r && r <= 90: // ['A','Z'] return 47 - case 97 <= r && r <= 122: // ['a','z'] + case r == 95: // ['_','_'] return 48 + case 97 <= r && r <= 122: // ['a','z'] + return 49 } return NoState }, - // S94 + // S98 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 98 + return 102 case 65 <= r && r <= 70: // ['A','F'] - return 98 + return 102 case 97 <= r && r <= 102: // ['a','f'] - return 98 + return 102 } return NoState }, - // S95 + // S99 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 99 + return 103 case 65 <= r && r <= 70: // ['A','F'] - return 99 + return 103 case 97 <= r && r <= 102: // ['a','f'] - return 99 + return 103 } return NoState }, - // S96 + // S100 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 100 + return 104 case 65 <= r && r <= 70: // ['A','F'] - return 100 + return 104 case 97 <= r && r <= 102: // ['a','f'] - return 100 + return 104 } return NoState }, - // S97 + // S101 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 101 + return 105 case 65 <= r && r <= 70: // ['A','F'] - return 101 + return 105 case 97 <= r && r <= 102: // ['a','f'] - return 101 + return 105 } return NoState }, - // S98 + // S102 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 102 + return 106 case 65 <= r && r <= 70: // ['A','F'] - return 102 + return 106 case 97 <= r && r <= 102: // ['a','f'] - return 102 + return 106 } return NoState }, - // S99 + // S103 func(r rune) int { switch { case r == 34: // ['"','"'] @@ -1193,99 +1225,99 @@ var TransTab = TransitionTable{ return 30 } }, - // S100 + // S104 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 103 + return 107 case 65 <= r && r <= 70: // ['A','F'] - return 103 + return 107 case 97 <= r && r <= 102: // ['a','f'] - return 103 + return 107 } return NoState }, - // S101 + // S105 func(r rune) int { switch { case r == 39: // [''','''] - return 65 + return 66 } return NoState }, - // S102 + // S106 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 104 + return 108 case 65 <= r && r <= 70: // ['A','F'] - return 104 + return 108 case 97 <= r && r <= 102: // ['a','f'] - return 104 + return 108 } return NoState }, - // S103 + // S107 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 105 + return 109 case 65 <= r && r <= 70: // ['A','F'] - return 105 + return 109 case 97 <= r && r <= 102: // ['a','f'] - return 105 + return 109 } return NoState }, - // S104 + // S108 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 106 + return 110 case 65 <= r && r <= 70: // ['A','F'] - return 106 + return 110 case 97 <= r && r <= 102: // ['a','f'] - return 106 + return 110 } return NoState }, - // S105 + // S109 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 107 + return 111 case 65 <= r && r <= 70: // ['A','F'] - return 107 + return 111 case 97 <= r && r <= 102: // ['a','f'] - return 107 + return 111 } return NoState }, - // S106 + // S110 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 108 + return 112 case 65 <= r && r <= 70: // ['A','F'] - return 108 + return 112 case 97 <= r && r <= 102: // ['a','f'] - return 108 + return 112 } return NoState }, - // S107 + // S111 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 109 + return 113 case 65 <= r && r <= 70: // ['A','F'] - return 109 + return 113 case 97 <= r && r <= 102: // ['a','f'] - return 109 + return 113 } return NoState }, - // S108 + // S112 func(r rune) int { switch { case r == 34: // ['"','"'] @@ -1296,11 +1328,11 @@ var TransTab = TransitionTable{ return 30 } }, - // S109 + // S113 func(r rune) int { switch { case r == 39: // [''','''] - return 65 + return 66 } return NoState }, diff --git a/internal/frontend/reparsed/internal/parser/actiontable.go b/internal/frontend/reparsed/internal/parser/actiontable.go index e4fe1547..75117e0b 100644 --- a/internal/frontend/reparsed/internal/parser/actiontable.go +++ b/internal/frontend/reparsed/internal/parser/actiontable.go @@ -8,4812 +8,4816 @@ type ( canRecover bool actions [numSymbols]action } + contextDependentToken [numSymbols] func(interface{}) (interface{}, error, []byte) + actions struct { + table actionTable + cdTokens contextDependentToken + } ) - -var actionTab = actionTable{ - actionRow{ // S0 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - shift(9), // tokId - nil, // ":" - nil, // ";" - shift(10), // regDefId - shift(11), // ignoredTokId - nil, // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - shift(12), // g_sdt_lit - shift(13), // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S1 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - accept(true), // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S2 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - reduce(2), // Ω, reduce: Grammar - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - shift(12), // g_sdt_lit - shift(13), // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S3 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - reduce(3), // Ω, reduce: Grammar - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S4 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - reduce(4), // Ω, reduce: LexicalPart - shift(9), // tokId - nil, // ":" - nil, // ";" - shift(10), // regDefId - shift(11), // ignoredTokId - nil, // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - reduce(4), // g_sdt_lit, reduce: LexicalPart - reduce(4), // prodId, reduce: LexicalPart - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S5 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - reduce(5), // Ω, reduce: LexProductions - reduce(5), // tokId, reduce: LexProductions - nil, // ":" - nil, // ";" - reduce(5), // regDefId, reduce: LexProductions - reduce(5), // ignoredTokId, reduce: LexProductions - nil, // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - reduce(5), // g_sdt_lit, reduce: LexProductions - reduce(5), // prodId, reduce: LexProductions - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S6 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - shift(13), // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S7 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - reduce(24), // Ω, reduce: SyntaxPart - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - shift(13), // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S8 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - reduce(26), // Ω, reduce: SyntaxProdList - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - reduce(26), // prodId, reduce: SyntaxProdList - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S9 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - shift(18), // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S10 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - shift(19), // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S11 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - shift(20), // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S12 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - reduce(25), // prodId, reduce: FileHeader - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S13 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - shift(21), // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S14 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - reduce(1), // Ω, reduce: Grammar - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S15 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - reduce(6), // Ω, reduce: LexProductions - reduce(6), // tokId, reduce: LexProductions - nil, // ":" - nil, // ";" - reduce(6), // regDefId, reduce: LexProductions - reduce(6), // ignoredTokId, reduce: LexProductions - nil, // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - reduce(6), // g_sdt_lit, reduce: LexProductions - reduce(6), // prodId, reduce: LexProductions - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S16 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - reduce(23), // Ω, reduce: SyntaxPart - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - shift(13), // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S17 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - reduce(27), // Ω, reduce: SyntaxProdList - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - reduce(27), // prodId, reduce: SyntaxProdList - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S18 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - shift(25), // regDefId - nil, // ignoredTokId - nil, // "|" - shift(26), // "." - shift(27), // char_lit - nil, // "-" - shift(28), // "~" - shift(29), // "(" - nil, // ")" - shift(30), // "[" - nil, // "]" - shift(31), // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S19 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - shift(25), // regDefId - nil, // ignoredTokId - nil, // "|" - shift(26), // "." - shift(27), // char_lit - nil, // "-" - shift(28), // "~" - shift(29), // "(" - nil, // ")" - shift(30), // "[" - nil, // "]" - shift(31), // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S20 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - shift(25), // regDefId - nil, // ignoredTokId - nil, // "|" - shift(26), // "." - shift(27), // char_lit - nil, // "-" - shift(28), // "~" - shift(29), // "(" - nil, // ")" - shift(30), // "[" - nil, // "]" - shift(31), // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S21 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - shift(40), // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - shift(41), // prodId - shift(42), // string_lit - shift(43), // "@" - shift(44), // "error" - shift(45), // "λ" - shift(46), // "empty" - shift(47), // "ε" - }, - }, - actionRow{ // S22 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - shift(48), // ";" - nil, // regDefId - nil, // ignoredTokId - shift(49), // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S23 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - reduce(10), // ";", reduce: LexPattern - shift(25), // regDefId - nil, // ignoredTokId - reduce(10), // "|", reduce: LexPattern - shift(26), // "." - shift(27), // char_lit - nil, // "-" - shift(28), // "~" - shift(29), // "(" - nil, // ")" - shift(30), // "[" - nil, // "]" - shift(31), // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S24 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - reduce(12), // ";", reduce: LexAlt - reduce(12), // regDefId, reduce: LexAlt - nil, // ignoredTokId - reduce(12), // "|", reduce: LexAlt - reduce(12), // ".", reduce: LexAlt - reduce(12), // char_lit, reduce: LexAlt - nil, // "-" - reduce(12), // "~", reduce: LexAlt - reduce(12), // "(", reduce: LexAlt - nil, // ")" - reduce(12), // "[", reduce: LexAlt - nil, // "]" - reduce(12), // "{", reduce: LexAlt - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S25 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - reduce(19), // ";", reduce: LexTerm - reduce(19), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(19), // "|", reduce: LexTerm - reduce(19), // ".", reduce: LexTerm - reduce(19), // char_lit, reduce: LexTerm - nil, // "-" - reduce(19), // "~", reduce: LexTerm - reduce(19), // "(", reduce: LexTerm - nil, // ")" - reduce(19), // "[", reduce: LexTerm - nil, // "]" - reduce(19), // "{", reduce: LexTerm - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S26 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - reduce(14), // ";", reduce: LexTerm - reduce(14), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(14), // "|", reduce: LexTerm - reduce(14), // ".", reduce: LexTerm - reduce(14), // char_lit, reduce: LexTerm - nil, // "-" - reduce(14), // "~", reduce: LexTerm - reduce(14), // "(", reduce: LexTerm - nil, // ")" - reduce(14), // "[", reduce: LexTerm - nil, // "]" - reduce(14), // "{", reduce: LexTerm - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S27 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - reduce(15), // ";", reduce: LexTerm - reduce(15), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(15), // "|", reduce: LexTerm - reduce(15), // ".", reduce: LexTerm - reduce(15), // char_lit, reduce: LexTerm - shift(51), // "-" - reduce(15), // "~", reduce: LexTerm - reduce(15), // "(", reduce: LexTerm - nil, // ")" - reduce(15), // "[", reduce: LexTerm - nil, // "]" - reduce(15), // "{", reduce: LexTerm - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S28 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - shift(52), // char_lit - nil, // "-" - nil, // "~" - shift(53), // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S29 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - shift(57), // regDefId - nil, // ignoredTokId - nil, // "|" - shift(58), // "." - shift(59), // char_lit - nil, // "-" - shift(60), // "~" - shift(61), // "(" - nil, // ")" - shift(62), // "[" - nil, // "]" - shift(63), // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S30 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - shift(67), // regDefId - nil, // ignoredTokId - nil, // "|" - shift(68), // "." - shift(69), // char_lit - nil, // "-" - shift(70), // "~" - shift(71), // "(" - nil, // ")" - shift(72), // "[" - nil, // "]" - shift(73), // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S31 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - shift(77), // regDefId - nil, // ignoredTokId - nil, // "|" - shift(78), // "." - shift(79), // char_lit - nil, // "-" - shift(80), // "~" - shift(81), // "(" - nil, // ")" - shift(82), // "[" - nil, // "]" - shift(83), // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S32 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - shift(84), // ";" - nil, // regDefId - nil, // ignoredTokId - shift(49), // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S33 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - shift(85), // ";" - nil, // regDefId - nil, // ignoredTokId - shift(49), // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S34 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - shift(86), // ";" - nil, // regDefId - nil, // ignoredTokId - shift(87), // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S35 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - reduce(29), // ";", reduce: Alternatives - nil, // regDefId - nil, // ignoredTokId - reduce(29), // "|", reduce: Alternatives - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S36 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - shift(40), // tokId - nil, // ":" - reduce(31), // ";", reduce: SyntaxBody - nil, // regDefId - nil, // ignoredTokId - reduce(31), // "|", reduce: SyntaxBody - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - shift(89), // g_sdt_lit - shift(41), // prodId - shift(42), // string_lit - shift(43), // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S37 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - shift(40), // tokId - nil, // ":" - reduce(33), // ";", reduce: SyntaxBody - nil, // regDefId - nil, // ignoredTokId - reduce(33), // "|", reduce: SyntaxBody - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - shift(91), // g_sdt_lit - shift(41), // prodId - shift(42), // string_lit - shift(43), // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S38 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - reduce(37), // ";", reduce: SyntaxBody - nil, // regDefId - nil, // ignoredTokId - reduce(37), // "|", reduce: SyntaxBody - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S39 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - reduce(38), // tokId, reduce: Symbols - nil, // ":" - reduce(38), // ";", reduce: Symbols - nil, // regDefId - nil, // ignoredTokId - reduce(38), // "|", reduce: Symbols - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - reduce(38), // g_sdt_lit, reduce: Symbols - reduce(38), // prodId, reduce: Symbols - reduce(38), // string_lit, reduce: Symbols - reduce(38), // "@", reduce: Symbols - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S40 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - reduce(41), // tokId, reduce: Symbol - nil, // ":" - reduce(41), // ";", reduce: Symbol - nil, // regDefId - nil, // ignoredTokId - reduce(41), // "|", reduce: Symbol - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - reduce(41), // g_sdt_lit, reduce: Symbol - reduce(41), // prodId, reduce: Symbol - reduce(41), // string_lit, reduce: Symbol - reduce(41), // "@", reduce: Symbol - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S41 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - reduce(40), // tokId, reduce: Symbol - nil, // ":" - reduce(40), // ";", reduce: Symbol - nil, // regDefId - nil, // ignoredTokId - reduce(40), // "|", reduce: Symbol - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - reduce(40), // g_sdt_lit, reduce: Symbol - reduce(40), // prodId, reduce: Symbol - reduce(40), // string_lit, reduce: Symbol - reduce(40), // "@", reduce: Symbol - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S42 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - reduce(42), // tokId, reduce: Symbol - nil, // ":" - reduce(42), // ";", reduce: Symbol - nil, // regDefId - nil, // ignoredTokId - reduce(42), // "|", reduce: Symbol - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - reduce(42), // g_sdt_lit, reduce: Symbol - reduce(42), // prodId, reduce: Symbol - reduce(42), // string_lit, reduce: Symbol - reduce(42), // "@", reduce: Symbol - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S43 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - shift(92), // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S44 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - reduce(44), // tokId, reduce: ErrorSymbol - nil, // ":" - reduce(44), // ";", reduce: ErrorSymbol - nil, // regDefId - nil, // ignoredTokId - reduce(44), // "|", reduce: ErrorSymbol - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - reduce(44), // g_sdt_lit, reduce: ErrorSymbol - reduce(44), // prodId, reduce: ErrorSymbol - reduce(44), // string_lit, reduce: ErrorSymbol - reduce(44), // "@", reduce: ErrorSymbol - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S45 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - reduce(45), // tokId, reduce: ErrorSymbol - nil, // ":" - reduce(45), // ";", reduce: ErrorSymbol - nil, // regDefId - nil, // ignoredTokId - reduce(45), // "|", reduce: ErrorSymbol - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - reduce(45), // g_sdt_lit, reduce: ErrorSymbol - reduce(45), // prodId, reduce: ErrorSymbol - reduce(45), // string_lit, reduce: ErrorSymbol - reduce(45), // "@", reduce: ErrorSymbol - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S46 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - reduce(46), // ";", reduce: EpsilonSymbol - nil, // regDefId - nil, // ignoredTokId - reduce(46), // "|", reduce: EpsilonSymbol - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S47 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - reduce(47), // ";", reduce: EpsilonSymbol - nil, // regDefId - nil, // ignoredTokId - reduce(47), // "|", reduce: EpsilonSymbol - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S48 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - reduce(7), // Ω, reduce: LexProduction - reduce(7), // tokId, reduce: LexProduction - nil, // ":" - nil, // ";" - reduce(7), // regDefId, reduce: LexProduction - reduce(7), // ignoredTokId, reduce: LexProduction - nil, // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - reduce(7), // g_sdt_lit, reduce: LexProduction - reduce(7), // prodId, reduce: LexProduction - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S49 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - shift(25), // regDefId - nil, // ignoredTokId - nil, // "|" - shift(26), // "." - shift(27), // char_lit - nil, // "-" - shift(28), // "~" - shift(29), // "(" - nil, // ")" - shift(30), // "[" - nil, // "]" - shift(31), // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S50 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - reduce(13), // ";", reduce: LexAlt - reduce(13), // regDefId, reduce: LexAlt - nil, // ignoredTokId - reduce(13), // "|", reduce: LexAlt - reduce(13), // ".", reduce: LexAlt - reduce(13), // char_lit, reduce: LexAlt - nil, // "-" - reduce(13), // "~", reduce: LexAlt - reduce(13), // "(", reduce: LexAlt - nil, // ")" - reduce(13), // "[", reduce: LexAlt - nil, // "]" - reduce(13), // "{", reduce: LexAlt - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S51 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - shift(94), // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S52 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - reduce(17), // ";", reduce: LexTerm - reduce(17), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(17), // "|", reduce: LexTerm - reduce(17), // ".", reduce: LexTerm - reduce(17), // char_lit, reduce: LexTerm - nil, // "-" - reduce(17), // "~", reduce: LexTerm - reduce(17), // "(", reduce: LexTerm - nil, // ")" - reduce(17), // "[", reduce: LexTerm - nil, // "]" - reduce(17), // "{", reduce: LexTerm - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S53 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - shift(95), // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S54 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - shift(96), // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - shift(97), // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S55 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - shift(57), // regDefId - nil, // ignoredTokId - reduce(10), // "|", reduce: LexPattern - shift(58), // "." - shift(59), // char_lit - nil, // "-" - shift(60), // "~" - shift(61), // "(" - reduce(10), // ")", reduce: LexPattern - shift(62), // "[" - nil, // "]" - shift(63), // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S56 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(12), // regDefId, reduce: LexAlt - nil, // ignoredTokId - reduce(12), // "|", reduce: LexAlt - reduce(12), // ".", reduce: LexAlt - reduce(12), // char_lit, reduce: LexAlt - nil, // "-" - reduce(12), // "~", reduce: LexAlt - reduce(12), // "(", reduce: LexAlt - reduce(12), // ")", reduce: LexAlt - reduce(12), // "[", reduce: LexAlt - nil, // "]" - reduce(12), // "{", reduce: LexAlt - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S57 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(19), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(19), // "|", reduce: LexTerm - reduce(19), // ".", reduce: LexTerm - reduce(19), // char_lit, reduce: LexTerm - nil, // "-" - reduce(19), // "~", reduce: LexTerm - reduce(19), // "(", reduce: LexTerm - reduce(19), // ")", reduce: LexTerm - reduce(19), // "[", reduce: LexTerm - nil, // "]" - reduce(19), // "{", reduce: LexTerm - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S58 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(14), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(14), // "|", reduce: LexTerm - reduce(14), // ".", reduce: LexTerm - reduce(14), // char_lit, reduce: LexTerm - nil, // "-" - reduce(14), // "~", reduce: LexTerm - reduce(14), // "(", reduce: LexTerm - reduce(14), // ")", reduce: LexTerm - reduce(14), // "[", reduce: LexTerm - nil, // "]" - reduce(14), // "{", reduce: LexTerm - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S59 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(15), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(15), // "|", reduce: LexTerm - reduce(15), // ".", reduce: LexTerm - reduce(15), // char_lit, reduce: LexTerm - shift(99), // "-" - reduce(15), // "~", reduce: LexTerm - reduce(15), // "(", reduce: LexTerm - reduce(15), // ")", reduce: LexTerm - reduce(15), // "[", reduce: LexTerm - nil, // "]" - reduce(15), // "{", reduce: LexTerm - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S60 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - shift(100), // char_lit - nil, // "-" - nil, // "~" - shift(101), // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S61 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - shift(57), // regDefId - nil, // ignoredTokId - nil, // "|" - shift(58), // "." - shift(59), // char_lit - nil, // "-" - shift(60), // "~" - shift(61), // "(" - nil, // ")" - shift(62), // "[" - nil, // "]" - shift(63), // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S62 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - shift(67), // regDefId - nil, // ignoredTokId - nil, // "|" - shift(68), // "." - shift(69), // char_lit - nil, // "-" - shift(70), // "~" - shift(71), // "(" - nil, // ")" - shift(72), // "[" - nil, // "]" - shift(73), // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S63 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - shift(77), // regDefId - nil, // ignoredTokId - nil, // "|" - shift(78), // "." - shift(79), // char_lit - nil, // "-" - shift(80), // "~" - shift(81), // "(" - nil, // ")" - shift(82), // "[" - nil, // "]" - shift(83), // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S64 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - shift(105), // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - shift(106), // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S65 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - shift(67), // regDefId - nil, // ignoredTokId - reduce(10), // "|", reduce: LexPattern - shift(68), // "." - shift(69), // char_lit - nil, // "-" - shift(70), // "~" - shift(71), // "(" - nil, // ")" - shift(72), // "[" - reduce(10), // "]", reduce: LexPattern - shift(73), // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S66 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(12), // regDefId, reduce: LexAlt - nil, // ignoredTokId - reduce(12), // "|", reduce: LexAlt - reduce(12), // ".", reduce: LexAlt - reduce(12), // char_lit, reduce: LexAlt - nil, // "-" - reduce(12), // "~", reduce: LexAlt - reduce(12), // "(", reduce: LexAlt - nil, // ")" - reduce(12), // "[", reduce: LexAlt - reduce(12), // "]", reduce: LexAlt - reduce(12), // "{", reduce: LexAlt - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S67 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(19), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(19), // "|", reduce: LexTerm - reduce(19), // ".", reduce: LexTerm - reduce(19), // char_lit, reduce: LexTerm - nil, // "-" - reduce(19), // "~", reduce: LexTerm - reduce(19), // "(", reduce: LexTerm - nil, // ")" - reduce(19), // "[", reduce: LexTerm - reduce(19), // "]", reduce: LexTerm - reduce(19), // "{", reduce: LexTerm - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S68 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(14), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(14), // "|", reduce: LexTerm - reduce(14), // ".", reduce: LexTerm - reduce(14), // char_lit, reduce: LexTerm - nil, // "-" - reduce(14), // "~", reduce: LexTerm - reduce(14), // "(", reduce: LexTerm - nil, // ")" - reduce(14), // "[", reduce: LexTerm - reduce(14), // "]", reduce: LexTerm - reduce(14), // "{", reduce: LexTerm - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S69 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(15), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(15), // "|", reduce: LexTerm - reduce(15), // ".", reduce: LexTerm - reduce(15), // char_lit, reduce: LexTerm - shift(108), // "-" - reduce(15), // "~", reduce: LexTerm - reduce(15), // "(", reduce: LexTerm - nil, // ")" - reduce(15), // "[", reduce: LexTerm - reduce(15), // "]", reduce: LexTerm - reduce(15), // "{", reduce: LexTerm - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S70 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - shift(109), // char_lit - nil, // "-" - nil, // "~" - shift(110), // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S71 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - shift(57), // regDefId - nil, // ignoredTokId - nil, // "|" - shift(58), // "." - shift(59), // char_lit - nil, // "-" - shift(60), // "~" - shift(61), // "(" - nil, // ")" - shift(62), // "[" - nil, // "]" - shift(63), // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S72 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - shift(67), // regDefId - nil, // ignoredTokId - nil, // "|" - shift(68), // "." - shift(69), // char_lit - nil, // "-" - shift(70), // "~" - shift(71), // "(" - nil, // ")" - shift(72), // "[" - nil, // "]" - shift(73), // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S73 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - shift(77), // regDefId - nil, // ignoredTokId - nil, // "|" - shift(78), // "." - shift(79), // char_lit - nil, // "-" - shift(80), // "~" - shift(81), // "(" - nil, // ")" - shift(82), // "[" - nil, // "]" - shift(83), // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S74 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - shift(114), // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - shift(115), // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S75 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - shift(77), // regDefId - nil, // ignoredTokId - reduce(10), // "|", reduce: LexPattern - shift(78), // "." - shift(79), // char_lit - nil, // "-" - shift(80), // "~" - shift(81), // "(" - nil, // ")" - shift(82), // "[" - nil, // "]" - shift(83), // "{" - reduce(10), // "}", reduce: LexPattern - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S76 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(12), // regDefId, reduce: LexAlt - nil, // ignoredTokId - reduce(12), // "|", reduce: LexAlt - reduce(12), // ".", reduce: LexAlt - reduce(12), // char_lit, reduce: LexAlt - nil, // "-" - reduce(12), // "~", reduce: LexAlt - reduce(12), // "(", reduce: LexAlt - nil, // ")" - reduce(12), // "[", reduce: LexAlt - nil, // "]" - reduce(12), // "{", reduce: LexAlt - reduce(12), // "}", reduce: LexAlt - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S77 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(19), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(19), // "|", reduce: LexTerm - reduce(19), // ".", reduce: LexTerm - reduce(19), // char_lit, reduce: LexTerm - nil, // "-" - reduce(19), // "~", reduce: LexTerm - reduce(19), // "(", reduce: LexTerm - nil, // ")" - reduce(19), // "[", reduce: LexTerm - nil, // "]" - reduce(19), // "{", reduce: LexTerm - reduce(19), // "}", reduce: LexTerm - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S78 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(14), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(14), // "|", reduce: LexTerm - reduce(14), // ".", reduce: LexTerm - reduce(14), // char_lit, reduce: LexTerm - nil, // "-" - reduce(14), // "~", reduce: LexTerm - reduce(14), // "(", reduce: LexTerm - nil, // ")" - reduce(14), // "[", reduce: LexTerm - nil, // "]" - reduce(14), // "{", reduce: LexTerm - reduce(14), // "}", reduce: LexTerm - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S79 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(15), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(15), // "|", reduce: LexTerm - reduce(15), // ".", reduce: LexTerm - reduce(15), // char_lit, reduce: LexTerm - shift(117), // "-" - reduce(15), // "~", reduce: LexTerm - reduce(15), // "(", reduce: LexTerm - nil, // ")" - reduce(15), // "[", reduce: LexTerm - nil, // "]" - reduce(15), // "{", reduce: LexTerm - reduce(15), // "}", reduce: LexTerm - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S80 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - shift(118), // char_lit - nil, // "-" - nil, // "~" - shift(119), // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S81 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - shift(57), // regDefId - nil, // ignoredTokId - nil, // "|" - shift(58), // "." - shift(59), // char_lit - nil, // "-" - shift(60), // "~" - shift(61), // "(" - nil, // ")" - shift(62), // "[" - nil, // "]" - shift(63), // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S82 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - shift(67), // regDefId - nil, // ignoredTokId - nil, // "|" - shift(68), // "." - shift(69), // char_lit - nil, // "-" - shift(70), // "~" - shift(71), // "(" - nil, // ")" - shift(72), // "[" - nil, // "]" - shift(73), // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S83 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - shift(77), // regDefId - nil, // ignoredTokId - nil, // "|" - shift(78), // "." - shift(79), // char_lit - nil, // "-" - shift(80), // "~" - shift(81), // "(" - nil, // ")" - shift(82), // "[" - nil, // "]" - shift(83), // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S84 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - reduce(8), // Ω, reduce: LexProduction - reduce(8), // tokId, reduce: LexProduction - nil, // ":" - nil, // ";" - reduce(8), // regDefId, reduce: LexProduction - reduce(8), // ignoredTokId, reduce: LexProduction - nil, // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - reduce(8), // g_sdt_lit, reduce: LexProduction - reduce(8), // prodId, reduce: LexProduction - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S85 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - reduce(9), // Ω, reduce: LexProduction - reduce(9), // tokId, reduce: LexProduction - nil, // ":" - nil, // ";" - reduce(9), // regDefId, reduce: LexProduction - reduce(9), // ignoredTokId, reduce: LexProduction - nil, // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - reduce(9), // g_sdt_lit, reduce: LexProduction - reduce(9), // prodId, reduce: LexProduction - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S86 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - reduce(28), // Ω, reduce: SyntaxProduction - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - reduce(28), // prodId, reduce: SyntaxProduction - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S87 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - shift(40), // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - shift(41), // prodId - shift(42), // string_lit - shift(43), // "@" - shift(44), // "error" - shift(45), // "λ" - shift(46), // "empty" - shift(47), // "ε" - }, - }, - actionRow{ // S88 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - reduce(39), // tokId, reduce: Symbols - nil, // ":" - reduce(39), // ";", reduce: Symbols - nil, // regDefId - nil, // ignoredTokId - reduce(39), // "|", reduce: Symbols - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - reduce(39), // g_sdt_lit, reduce: Symbols - reduce(39), // prodId, reduce: Symbols - reduce(39), // string_lit, reduce: Symbols - reduce(39), // "@", reduce: Symbols - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S89 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - reduce(32), // ";", reduce: SyntaxBody - nil, // regDefId - nil, // ignoredTokId - reduce(32), // "|", reduce: SyntaxBody - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S90 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - shift(40), // tokId - nil, // ":" - reduce(34), // ";", reduce: SyntaxBody - nil, // regDefId - nil, // ignoredTokId - reduce(34), // "|", reduce: SyntaxBody - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - shift(124), // g_sdt_lit - shift(41), // prodId - shift(42), // string_lit - shift(43), // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S91 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - reduce(36), // ";", reduce: SyntaxBody - nil, // regDefId - nil, // ignoredTokId - reduce(36), // "|", reduce: SyntaxBody - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S92 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - reduce(43), // tokId, reduce: Symbol - nil, // ":" - reduce(43), // ";", reduce: Symbol - nil, // regDefId - nil, // ignoredTokId - reduce(43), // "|", reduce: Symbol - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - reduce(43), // g_sdt_lit, reduce: Symbol - reduce(43), // prodId, reduce: Symbol - reduce(43), // string_lit, reduce: Symbol - reduce(43), // "@", reduce: Symbol - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S93 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - reduce(11), // ";", reduce: LexPattern - shift(25), // regDefId - nil, // ignoredTokId - reduce(11), // "|", reduce: LexPattern - shift(26), // "." - shift(27), // char_lit - nil, // "-" - shift(28), // "~" - shift(29), // "(" - nil, // ")" - shift(30), // "[" - nil, // "]" - shift(31), // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S94 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - reduce(16), // ";", reduce: LexTerm - reduce(16), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(16), // "|", reduce: LexTerm - reduce(16), // ".", reduce: LexTerm - reduce(16), // char_lit, reduce: LexTerm - nil, // "-" - reduce(16), // "~", reduce: LexTerm - reduce(16), // "(", reduce: LexTerm - nil, // ")" - reduce(16), // "[", reduce: LexTerm - nil, // "]" - reduce(16), // "{", reduce: LexTerm - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S95 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - nil, // char_lit - shift(125), // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S96 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - shift(57), // regDefId - nil, // ignoredTokId - nil, // "|" - shift(58), // "." - shift(59), // char_lit - nil, // "-" - shift(60), // "~" - shift(61), // "(" - nil, // ")" - shift(62), // "[" - nil, // "]" - shift(63), // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S97 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - reduce(22), // ";", reduce: LexTerm - reduce(22), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(22), // "|", reduce: LexTerm - reduce(22), // ".", reduce: LexTerm - reduce(22), // char_lit, reduce: LexTerm - nil, // "-" - reduce(22), // "~", reduce: LexTerm - reduce(22), // "(", reduce: LexTerm - nil, // ")" - reduce(22), // "[", reduce: LexTerm - nil, // "]" - reduce(22), // "{", reduce: LexTerm - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S98 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(13), // regDefId, reduce: LexAlt - nil, // ignoredTokId - reduce(13), // "|", reduce: LexAlt - reduce(13), // ".", reduce: LexAlt - reduce(13), // char_lit, reduce: LexAlt - nil, // "-" - reduce(13), // "~", reduce: LexAlt - reduce(13), // "(", reduce: LexAlt - reduce(13), // ")", reduce: LexAlt - reduce(13), // "[", reduce: LexAlt - nil, // "]" - reduce(13), // "{", reduce: LexAlt - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S99 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - shift(127), // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S100 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(17), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(17), // "|", reduce: LexTerm - reduce(17), // ".", reduce: LexTerm - reduce(17), // char_lit, reduce: LexTerm - nil, // "-" - reduce(17), // "~", reduce: LexTerm - reduce(17), // "(", reduce: LexTerm - reduce(17), // ")", reduce: LexTerm - reduce(17), // "[", reduce: LexTerm - nil, // "]" - reduce(17), // "{", reduce: LexTerm - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S101 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - shift(128), // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S102 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - shift(96), // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - shift(129), // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S103 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - shift(105), // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - shift(130), // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S104 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - shift(114), // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - shift(131), // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S105 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - shift(67), // regDefId - nil, // ignoredTokId - nil, // "|" - shift(68), // "." - shift(69), // char_lit - nil, // "-" - shift(70), // "~" - shift(71), // "(" - nil, // ")" - shift(72), // "[" - nil, // "]" - shift(73), // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S106 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - reduce(20), // ";", reduce: LexTerm - reduce(20), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(20), // "|", reduce: LexTerm - reduce(20), // ".", reduce: LexTerm - reduce(20), // char_lit, reduce: LexTerm - nil, // "-" - reduce(20), // "~", reduce: LexTerm - reduce(20), // "(", reduce: LexTerm - nil, // ")" - reduce(20), // "[", reduce: LexTerm - nil, // "]" - reduce(20), // "{", reduce: LexTerm - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S107 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(13), // regDefId, reduce: LexAlt - nil, // ignoredTokId - reduce(13), // "|", reduce: LexAlt - reduce(13), // ".", reduce: LexAlt - reduce(13), // char_lit, reduce: LexAlt - nil, // "-" - reduce(13), // "~", reduce: LexAlt - reduce(13), // "(", reduce: LexAlt - nil, // ")" - reduce(13), // "[", reduce: LexAlt - reduce(13), // "]", reduce: LexAlt - reduce(13), // "{", reduce: LexAlt - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S108 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - shift(133), // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S109 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(17), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(17), // "|", reduce: LexTerm - reduce(17), // ".", reduce: LexTerm - reduce(17), // char_lit, reduce: LexTerm - nil, // "-" - reduce(17), // "~", reduce: LexTerm - reduce(17), // "(", reduce: LexTerm - nil, // ")" - reduce(17), // "[", reduce: LexTerm - reduce(17), // "]", reduce: LexTerm - reduce(17), // "{", reduce: LexTerm - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S110 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - shift(134), // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S111 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - shift(96), // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - shift(135), // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S112 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - shift(105), // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - shift(136), // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S113 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - shift(114), // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - shift(137), // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S114 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - shift(77), // regDefId - nil, // ignoredTokId - nil, // "|" - shift(78), // "." - shift(79), // char_lit - nil, // "-" - shift(80), // "~" - shift(81), // "(" - nil, // ")" - shift(82), // "[" - nil, // "]" - shift(83), // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S115 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - reduce(21), // ";", reduce: LexTerm - reduce(21), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(21), // "|", reduce: LexTerm - reduce(21), // ".", reduce: LexTerm - reduce(21), // char_lit, reduce: LexTerm - nil, // "-" - reduce(21), // "~", reduce: LexTerm - reduce(21), // "(", reduce: LexTerm - nil, // ")" - reduce(21), // "[", reduce: LexTerm - nil, // "]" - reduce(21), // "{", reduce: LexTerm - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S116 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(13), // regDefId, reduce: LexAlt - nil, // ignoredTokId - reduce(13), // "|", reduce: LexAlt - reduce(13), // ".", reduce: LexAlt - reduce(13), // char_lit, reduce: LexAlt - nil, // "-" - reduce(13), // "~", reduce: LexAlt - reduce(13), // "(", reduce: LexAlt - nil, // ")" - reduce(13), // "[", reduce: LexAlt - nil, // "]" - reduce(13), // "{", reduce: LexAlt - reduce(13), // "}", reduce: LexAlt - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S117 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - shift(139), // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S118 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(17), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(17), // "|", reduce: LexTerm - reduce(17), // ".", reduce: LexTerm - reduce(17), // char_lit, reduce: LexTerm - nil, // "-" - reduce(17), // "~", reduce: LexTerm - reduce(17), // "(", reduce: LexTerm - nil, // ")" - reduce(17), // "[", reduce: LexTerm - nil, // "]" - reduce(17), // "{", reduce: LexTerm - reduce(17), // "}", reduce: LexTerm - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S119 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - shift(140), // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S120 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - shift(96), // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - shift(141), // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S121 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - shift(105), // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - shift(142), // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S122 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - shift(114), // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - shift(143), // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S123 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - reduce(30), // ";", reduce: Alternatives - nil, // regDefId - nil, // ignoredTokId - reduce(30), // "|", reduce: Alternatives - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S124 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - reduce(35), // ";", reduce: SyntaxBody - nil, // regDefId - nil, // ignoredTokId - reduce(35), // "|", reduce: SyntaxBody - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S125 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - shift(144), // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S126 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - shift(57), // regDefId - nil, // ignoredTokId - reduce(11), // "|", reduce: LexPattern - shift(58), // "." - shift(59), // char_lit - nil, // "-" - shift(60), // "~" - shift(61), // "(" - reduce(11), // ")", reduce: LexPattern - shift(62), // "[" - nil, // "]" - shift(63), // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S127 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(16), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(16), // "|", reduce: LexTerm - reduce(16), // ".", reduce: LexTerm - reduce(16), // char_lit, reduce: LexTerm - nil, // "-" - reduce(16), // "~", reduce: LexTerm - reduce(16), // "(", reduce: LexTerm - reduce(16), // ")", reduce: LexTerm - reduce(16), // "[", reduce: LexTerm - nil, // "]" - reduce(16), // "{", reduce: LexTerm - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S128 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - nil, // char_lit - shift(145), // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S129 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(22), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(22), // "|", reduce: LexTerm - reduce(22), // ".", reduce: LexTerm - reduce(22), // char_lit, reduce: LexTerm - nil, // "-" - reduce(22), // "~", reduce: LexTerm - reduce(22), // "(", reduce: LexTerm - reduce(22), // ")", reduce: LexTerm - reduce(22), // "[", reduce: LexTerm - nil, // "]" - reduce(22), // "{", reduce: LexTerm - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S130 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(20), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(20), // "|", reduce: LexTerm - reduce(20), // ".", reduce: LexTerm - reduce(20), // char_lit, reduce: LexTerm - nil, // "-" - reduce(20), // "~", reduce: LexTerm - reduce(20), // "(", reduce: LexTerm - reduce(20), // ")", reduce: LexTerm - reduce(20), // "[", reduce: LexTerm - nil, // "]" - reduce(20), // "{", reduce: LexTerm - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S131 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(21), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(21), // "|", reduce: LexTerm - reduce(21), // ".", reduce: LexTerm - reduce(21), // char_lit, reduce: LexTerm - nil, // "-" - reduce(21), // "~", reduce: LexTerm - reduce(21), // "(", reduce: LexTerm - reduce(21), // ")", reduce: LexTerm - reduce(21), // "[", reduce: LexTerm - nil, // "]" - reduce(21), // "{", reduce: LexTerm - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S132 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - shift(67), // regDefId - nil, // ignoredTokId - reduce(11), // "|", reduce: LexPattern - shift(68), // "." - shift(69), // char_lit - nil, // "-" - shift(70), // "~" - shift(71), // "(" - nil, // ")" - shift(72), // "[" - reduce(11), // "]", reduce: LexPattern - shift(73), // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S133 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(16), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(16), // "|", reduce: LexTerm - reduce(16), // ".", reduce: LexTerm - reduce(16), // char_lit, reduce: LexTerm - nil, // "-" - reduce(16), // "~", reduce: LexTerm - reduce(16), // "(", reduce: LexTerm - nil, // ")" - reduce(16), // "[", reduce: LexTerm - reduce(16), // "]", reduce: LexTerm - reduce(16), // "{", reduce: LexTerm - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S134 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - nil, // char_lit - shift(146), // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S135 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(22), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(22), // "|", reduce: LexTerm - reduce(22), // ".", reduce: LexTerm - reduce(22), // char_lit, reduce: LexTerm - nil, // "-" - reduce(22), // "~", reduce: LexTerm - reduce(22), // "(", reduce: LexTerm - nil, // ")" - reduce(22), // "[", reduce: LexTerm - reduce(22), // "]", reduce: LexTerm - reduce(22), // "{", reduce: LexTerm - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S136 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(20), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(20), // "|", reduce: LexTerm - reduce(20), // ".", reduce: LexTerm - reduce(20), // char_lit, reduce: LexTerm - nil, // "-" - reduce(20), // "~", reduce: LexTerm - reduce(20), // "(", reduce: LexTerm - nil, // ")" - reduce(20), // "[", reduce: LexTerm - reduce(20), // "]", reduce: LexTerm - reduce(20), // "{", reduce: LexTerm - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S137 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(21), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(21), // "|", reduce: LexTerm - reduce(21), // ".", reduce: LexTerm - reduce(21), // char_lit, reduce: LexTerm - nil, // "-" - reduce(21), // "~", reduce: LexTerm - reduce(21), // "(", reduce: LexTerm - nil, // ")" - reduce(21), // "[", reduce: LexTerm - reduce(21), // "]", reduce: LexTerm - reduce(21), // "{", reduce: LexTerm - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S138 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - shift(77), // regDefId - nil, // ignoredTokId - reduce(11), // "|", reduce: LexPattern - shift(78), // "." - shift(79), // char_lit - nil, // "-" - shift(80), // "~" - shift(81), // "(" - nil, // ")" - shift(82), // "[" - nil, // "]" - shift(83), // "{" - reduce(11), // "}", reduce: LexPattern - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S139 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(16), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(16), // "|", reduce: LexTerm - reduce(16), // ".", reduce: LexTerm - reduce(16), // char_lit, reduce: LexTerm - nil, // "-" - reduce(16), // "~", reduce: LexTerm - reduce(16), // "(", reduce: LexTerm - nil, // ")" - reduce(16), // "[", reduce: LexTerm - nil, // "]" - reduce(16), // "{", reduce: LexTerm - reduce(16), // "}", reduce: LexTerm - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S140 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - nil, // char_lit - shift(147), // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S141 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(22), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(22), // "|", reduce: LexTerm - reduce(22), // ".", reduce: LexTerm - reduce(22), // char_lit, reduce: LexTerm - nil, // "-" - reduce(22), // "~", reduce: LexTerm - reduce(22), // "(", reduce: LexTerm - nil, // ")" - reduce(22), // "[", reduce: LexTerm - nil, // "]" - reduce(22), // "{", reduce: LexTerm - reduce(22), // "}", reduce: LexTerm - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S142 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(20), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(20), // "|", reduce: LexTerm - reduce(20), // ".", reduce: LexTerm - reduce(20), // char_lit, reduce: LexTerm - nil, // "-" - reduce(20), // "~", reduce: LexTerm - reduce(20), // "(", reduce: LexTerm - nil, // ")" - reduce(20), // "[", reduce: LexTerm - nil, // "]" - reduce(20), // "{", reduce: LexTerm - reduce(20), // "}", reduce: LexTerm - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S143 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(21), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(21), // "|", reduce: LexTerm - reduce(21), // ".", reduce: LexTerm - reduce(21), // char_lit, reduce: LexTerm - nil, // "-" - reduce(21), // "~", reduce: LexTerm - reduce(21), // "(", reduce: LexTerm - nil, // ")" - reduce(21), // "[", reduce: LexTerm - nil, // "]" - reduce(21), // "{", reduce: LexTerm - reduce(21), // "}", reduce: LexTerm - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S144 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - shift(148), // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S145 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - shift(149), // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S146 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - shift(150), // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S147 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - shift(151), // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S148 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - reduce(18), // ";", reduce: LexTerm - reduce(18), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(18), // "|", reduce: LexTerm - reduce(18), // ".", reduce: LexTerm - reduce(18), // char_lit, reduce: LexTerm - nil, // "-" - reduce(18), // "~", reduce: LexTerm - reduce(18), // "(", reduce: LexTerm - nil, // ")" - reduce(18), // "[", reduce: LexTerm - nil, // "]" - reduce(18), // "{", reduce: LexTerm - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S149 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - shift(152), // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S150 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - shift(153), // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S151 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - shift(154), // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S152 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(18), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(18), // "|", reduce: LexTerm - reduce(18), // ".", reduce: LexTerm - reduce(18), // char_lit, reduce: LexTerm - nil, // "-" - reduce(18), // "~", reduce: LexTerm - reduce(18), // "(", reduce: LexTerm - reduce(18), // ")", reduce: LexTerm - reduce(18), // "[", reduce: LexTerm - nil, // "]" - reduce(18), // "{", reduce: LexTerm - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S153 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(18), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(18), // "|", reduce: LexTerm - reduce(18), // ".", reduce: LexTerm - reduce(18), // char_lit, reduce: LexTerm - nil, // "-" - reduce(18), // "~", reduce: LexTerm - reduce(18), // "(", reduce: LexTerm - nil, // ")" - reduce(18), // "[", reduce: LexTerm - reduce(18), // "]", reduce: LexTerm - reduce(18), // "{", reduce: LexTerm - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S154 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(18), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(18), // "|", reduce: LexTerm - reduce(18), // ".", reduce: LexTerm - reduce(18), // char_lit, reduce: LexTerm - nil, // "-" - reduce(18), // "~", reduce: LexTerm - reduce(18), // "(", reduce: LexTerm - nil, // ")" - reduce(18), // "[", reduce: LexTerm - nil, // "]" - reduce(18), // "{", reduce: LexTerm - reduce(18), // "}", reduce: LexTerm - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, +var parserActions = actions { + cdTokens: contextDependentToken{ + nil, // ast.InvalidSyntaxSymbol + nil, // ast.SyntaxEof + nil, // ast.SyntaxTokId + nil, // ast.SyntaxStringLit + nil, // ast.SyntaxStringLit + nil, // ast.SyntaxTokId + nil, // ast.SyntaxTokId + nil, // ast.SyntaxStringLit + nil, // ast.SyntaxStringLit + nil, // ast.SyntaxTokId + nil, // ast.SyntaxStringLit + nil, // ast.SyntaxStringLit + nil, // ast.SyntaxStringLit + nil, // ast.SyntaxStringLit + nil, // ast.SyntaxStringLit + nil, // ast.SyntaxStringLit + nil, // ast.SyntaxStringLit + nil, // ast.SyntaxStringLit + nil, // ast.SyntaxTokId + nil, // ast.SyntaxTokId + nil, // ast.SyntaxTokId + nil, // ast.SyntaxTokId + nil, // ast.SyntaxStringLit + nil, // ast.SyntaxStringLit + nil, // ast.SyntaxStringLit + nil, // ast.SyntaxStringLit + }, + table: actionTable{ + actionRow{ // S0 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + shift(9), // tokId + nil, // ":" + nil, // ";" + shift(10), // regDefId + shift(11), // ignoredTokId + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + shift(12), // g_sdt_lit + shift(13), // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S1 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + accept(true), // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S2 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(2), // Ω, reduce: Grammar + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + shift(12), // g_sdt_lit + shift(13), // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S3 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(3), // Ω, reduce: Grammar + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S4 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(4), // Ω, reduce: LexicalPart + shift(9), // tokId + nil, // ":" + nil, // ";" + shift(10), // regDefId + shift(11), // ignoredTokId + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + reduce(4), // g_sdt_lit, reduce: LexicalPart + reduce(4), // prodId, reduce: LexicalPart + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S5 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(5), // Ω, reduce: LexProductions + reduce(5), // tokId, reduce: LexProductions + nil, // ":" + nil, // ";" + reduce(5), // regDefId, reduce: LexProductions + reduce(5), // ignoredTokId, reduce: LexProductions + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + reduce(5), // g_sdt_lit, reduce: LexProductions + reduce(5), // prodId, reduce: LexProductions + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S6 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + shift(13), // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S7 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(24), // Ω, reduce: SyntaxPart + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + shift(13), // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S8 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(26), // Ω, reduce: SyntaxProdList + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + reduce(26), // prodId, reduce: SyntaxProdList + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S9 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + shift(18), // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S10 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + shift(19), // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S11 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + shift(20), // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S12 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + reduce(25), // prodId, reduce: FileHeader + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S13 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + shift(21), // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S14 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(1), // Ω, reduce: Grammar + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S15 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(6), // Ω, reduce: LexProductions + reduce(6), // tokId, reduce: LexProductions + nil, // ":" + nil, // ";" + reduce(6), // regDefId, reduce: LexProductions + reduce(6), // ignoredTokId, reduce: LexProductions + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + reduce(6), // g_sdt_lit, reduce: LexProductions + reduce(6), // prodId, reduce: LexProductions + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S16 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(23), // Ω, reduce: SyntaxPart + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + shift(13), // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S17 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(27), // Ω, reduce: SyntaxProdList + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + reduce(27), // prodId, reduce: SyntaxProdList + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S18 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + shift(25), // regDefId + nil, // ignoredTokId + nil, // "|" + shift(26), // "." + shift(27), // char_lit + nil, // "-" + shift(28), // "~" + shift(29), // "(" + nil, // ")" + shift(30), // "[" + nil, // "]" + shift(31), // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S19 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + shift(25), // regDefId + nil, // ignoredTokId + nil, // "|" + shift(26), // "." + shift(27), // char_lit + nil, // "-" + shift(28), // "~" + shift(29), // "(" + nil, // ")" + shift(30), // "[" + nil, // "]" + shift(31), // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S20 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + shift(25), // regDefId + nil, // ignoredTokId + nil, // "|" + shift(26), // "." + shift(27), // char_lit + nil, // "-" + shift(28), // "~" + shift(29), // "(" + nil, // ")" + shift(30), // "[" + nil, // "]" + shift(31), // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S21 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + shift(40), // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + shift(41), // prodId + shift(42), // string_lit + nil, // g_ctxdep_lit + shift(43), // "error" + shift(44), // "λ" + shift(45), // "empty" + shift(46), // "ε" + }, + }, + actionRow{ // S22 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + shift(47), // ";" + nil, // regDefId + nil, // ignoredTokId + shift(48), // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S23 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + reduce(10), // ";", reduce: LexPattern + shift(25), // regDefId + nil, // ignoredTokId + reduce(10), // "|", reduce: LexPattern + shift(26), // "." + shift(27), // char_lit + nil, // "-" + shift(28), // "~" + shift(29), // "(" + nil, // ")" + shift(30), // "[" + nil, // "]" + shift(31), // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S24 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + reduce(12), // ";", reduce: LexAlt + reduce(12), // regDefId, reduce: LexAlt + nil, // ignoredTokId + reduce(12), // "|", reduce: LexAlt + reduce(12), // ".", reduce: LexAlt + reduce(12), // char_lit, reduce: LexAlt + nil, // "-" + reduce(12), // "~", reduce: LexAlt + reduce(12), // "(", reduce: LexAlt + nil, // ")" + reduce(12), // "[", reduce: LexAlt + nil, // "]" + reduce(12), // "{", reduce: LexAlt + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S25 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + reduce(19), // ";", reduce: LexTerm + reduce(19), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(19), // "|", reduce: LexTerm + reduce(19), // ".", reduce: LexTerm + reduce(19), // char_lit, reduce: LexTerm + nil, // "-" + reduce(19), // "~", reduce: LexTerm + reduce(19), // "(", reduce: LexTerm + nil, // ")" + reduce(19), // "[", reduce: LexTerm + nil, // "]" + reduce(19), // "{", reduce: LexTerm + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S26 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + reduce(14), // ";", reduce: LexTerm + reduce(14), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(14), // "|", reduce: LexTerm + reduce(14), // ".", reduce: LexTerm + reduce(14), // char_lit, reduce: LexTerm + nil, // "-" + reduce(14), // "~", reduce: LexTerm + reduce(14), // "(", reduce: LexTerm + nil, // ")" + reduce(14), // "[", reduce: LexTerm + nil, // "]" + reduce(14), // "{", reduce: LexTerm + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S27 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + reduce(15), // ";", reduce: LexTerm + reduce(15), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(15), // "|", reduce: LexTerm + reduce(15), // ".", reduce: LexTerm + reduce(15), // char_lit, reduce: LexTerm + shift(50), // "-" + reduce(15), // "~", reduce: LexTerm + reduce(15), // "(", reduce: LexTerm + nil, // ")" + reduce(15), // "[", reduce: LexTerm + nil, // "]" + reduce(15), // "{", reduce: LexTerm + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S28 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + shift(51), // char_lit + nil, // "-" + nil, // "~" + shift(52), // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S29 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + shift(56), // regDefId + nil, // ignoredTokId + nil, // "|" + shift(57), // "." + shift(58), // char_lit + nil, // "-" + shift(59), // "~" + shift(60), // "(" + nil, // ")" + shift(61), // "[" + nil, // "]" + shift(62), // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S30 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + shift(66), // regDefId + nil, // ignoredTokId + nil, // "|" + shift(67), // "." + shift(68), // char_lit + nil, // "-" + shift(69), // "~" + shift(70), // "(" + nil, // ")" + shift(71), // "[" + nil, // "]" + shift(72), // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S31 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + shift(76), // regDefId + nil, // ignoredTokId + nil, // "|" + shift(77), // "." + shift(78), // char_lit + nil, // "-" + shift(79), // "~" + shift(80), // "(" + nil, // ")" + shift(81), // "[" + nil, // "]" + shift(82), // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S32 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + shift(83), // ";" + nil, // regDefId + nil, // ignoredTokId + shift(48), // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S33 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + shift(84), // ";" + nil, // regDefId + nil, // ignoredTokId + shift(48), // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S34 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + shift(85), // ";" + nil, // regDefId + nil, // ignoredTokId + shift(86), // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S35 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + reduce(29), // ";", reduce: Alternatives + nil, // regDefId + nil, // ignoredTokId + reduce(29), // "|", reduce: Alternatives + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S36 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + shift(40), // tokId + nil, // ":" + reduce(31), // ";", reduce: SyntaxBody + nil, // regDefId + nil, // ignoredTokId + reduce(31), // "|", reduce: SyntaxBody + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + shift(88), // g_sdt_lit + shift(41), // prodId + shift(42), // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S37 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + shift(40), // tokId + nil, // ":" + reduce(33), // ";", reduce: SyntaxBody + nil, // regDefId + nil, // ignoredTokId + reduce(33), // "|", reduce: SyntaxBody + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + shift(90), // g_sdt_lit + shift(41), // prodId + shift(42), // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S38 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + reduce(37), // ";", reduce: SyntaxBody + nil, // regDefId + nil, // ignoredTokId + reduce(37), // "|", reduce: SyntaxBody + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S39 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + reduce(38), // tokId, reduce: Symbols + nil, // ":" + reduce(38), // ";", reduce: Symbols + nil, // regDefId + nil, // ignoredTokId + reduce(38), // "|", reduce: Symbols + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + reduce(38), // g_sdt_lit, reduce: Symbols + reduce(38), // prodId, reduce: Symbols + reduce(38), // string_lit, reduce: Symbols + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S40 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + reduce(41), // tokId, reduce: Symbol + nil, // ":" + reduce(41), // ";", reduce: Symbol + nil, // regDefId + nil, // ignoredTokId + reduce(41), // "|", reduce: Symbol + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + reduce(41), // g_sdt_lit, reduce: Symbol + reduce(41), // prodId, reduce: Symbol + reduce(41), // string_lit, reduce: Symbol + shift(91), // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S41 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + reduce(40), // tokId, reduce: Symbol + nil, // ":" + reduce(40), // ";", reduce: Symbol + nil, // regDefId + nil, // ignoredTokId + reduce(40), // "|", reduce: Symbol + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + reduce(40), // g_sdt_lit, reduce: Symbol + reduce(40), // prodId, reduce: Symbol + reduce(40), // string_lit, reduce: Symbol + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S42 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + reduce(42), // tokId, reduce: Symbol + nil, // ":" + reduce(42), // ";", reduce: Symbol + nil, // regDefId + nil, // ignoredTokId + reduce(42), // "|", reduce: Symbol + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + reduce(42), // g_sdt_lit, reduce: Symbol + reduce(42), // prodId, reduce: Symbol + reduce(42), // string_lit, reduce: Symbol + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S43 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + reduce(44), // tokId, reduce: ErrorSymbol + nil, // ":" + reduce(44), // ";", reduce: ErrorSymbol + nil, // regDefId + nil, // ignoredTokId + reduce(44), // "|", reduce: ErrorSymbol + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + reduce(44), // g_sdt_lit, reduce: ErrorSymbol + reduce(44), // prodId, reduce: ErrorSymbol + reduce(44), // string_lit, reduce: ErrorSymbol + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S44 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + reduce(45), // tokId, reduce: ErrorSymbol + nil, // ":" + reduce(45), // ";", reduce: ErrorSymbol + nil, // regDefId + nil, // ignoredTokId + reduce(45), // "|", reduce: ErrorSymbol + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + reduce(45), // g_sdt_lit, reduce: ErrorSymbol + reduce(45), // prodId, reduce: ErrorSymbol + reduce(45), // string_lit, reduce: ErrorSymbol + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S45 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + reduce(46), // ";", reduce: EpsilonSymbol + nil, // regDefId + nil, // ignoredTokId + reduce(46), // "|", reduce: EpsilonSymbol + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S46 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + reduce(47), // ";", reduce: EpsilonSymbol + nil, // regDefId + nil, // ignoredTokId + reduce(47), // "|", reduce: EpsilonSymbol + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S47 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(7), // Ω, reduce: LexProduction + reduce(7), // tokId, reduce: LexProduction + nil, // ":" + nil, // ";" + reduce(7), // regDefId, reduce: LexProduction + reduce(7), // ignoredTokId, reduce: LexProduction + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + reduce(7), // g_sdt_lit, reduce: LexProduction + reduce(7), // prodId, reduce: LexProduction + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S48 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + shift(25), // regDefId + nil, // ignoredTokId + nil, // "|" + shift(26), // "." + shift(27), // char_lit + nil, // "-" + shift(28), // "~" + shift(29), // "(" + nil, // ")" + shift(30), // "[" + nil, // "]" + shift(31), // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S49 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + reduce(13), // ";", reduce: LexAlt + reduce(13), // regDefId, reduce: LexAlt + nil, // ignoredTokId + reduce(13), // "|", reduce: LexAlt + reduce(13), // ".", reduce: LexAlt + reduce(13), // char_lit, reduce: LexAlt + nil, // "-" + reduce(13), // "~", reduce: LexAlt + reduce(13), // "(", reduce: LexAlt + nil, // ")" + reduce(13), // "[", reduce: LexAlt + nil, // "]" + reduce(13), // "{", reduce: LexAlt + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S50 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + shift(93), // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S51 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + reduce(17), // ";", reduce: LexTerm + reduce(17), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(17), // "|", reduce: LexTerm + reduce(17), // ".", reduce: LexTerm + reduce(17), // char_lit, reduce: LexTerm + nil, // "-" + reduce(17), // "~", reduce: LexTerm + reduce(17), // "(", reduce: LexTerm + nil, // ")" + reduce(17), // "[", reduce: LexTerm + nil, // "]" + reduce(17), // "{", reduce: LexTerm + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S52 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + shift(94), // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S53 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + shift(95), // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + shift(96), // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S54 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + shift(56), // regDefId + nil, // ignoredTokId + reduce(10), // "|", reduce: LexPattern + shift(57), // "." + shift(58), // char_lit + nil, // "-" + shift(59), // "~" + shift(60), // "(" + reduce(10), // ")", reduce: LexPattern + shift(61), // "[" + nil, // "]" + shift(62), // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S55 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(12), // regDefId, reduce: LexAlt + nil, // ignoredTokId + reduce(12), // "|", reduce: LexAlt + reduce(12), // ".", reduce: LexAlt + reduce(12), // char_lit, reduce: LexAlt + nil, // "-" + reduce(12), // "~", reduce: LexAlt + reduce(12), // "(", reduce: LexAlt + reduce(12), // ")", reduce: LexAlt + reduce(12), // "[", reduce: LexAlt + nil, // "]" + reduce(12), // "{", reduce: LexAlt + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S56 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(19), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(19), // "|", reduce: LexTerm + reduce(19), // ".", reduce: LexTerm + reduce(19), // char_lit, reduce: LexTerm + nil, // "-" + reduce(19), // "~", reduce: LexTerm + reduce(19), // "(", reduce: LexTerm + reduce(19), // ")", reduce: LexTerm + reduce(19), // "[", reduce: LexTerm + nil, // "]" + reduce(19), // "{", reduce: LexTerm + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S57 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(14), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(14), // "|", reduce: LexTerm + reduce(14), // ".", reduce: LexTerm + reduce(14), // char_lit, reduce: LexTerm + nil, // "-" + reduce(14), // "~", reduce: LexTerm + reduce(14), // "(", reduce: LexTerm + reduce(14), // ")", reduce: LexTerm + reduce(14), // "[", reduce: LexTerm + nil, // "]" + reduce(14), // "{", reduce: LexTerm + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S58 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(15), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(15), // "|", reduce: LexTerm + reduce(15), // ".", reduce: LexTerm + reduce(15), // char_lit, reduce: LexTerm + shift(98), // "-" + reduce(15), // "~", reduce: LexTerm + reduce(15), // "(", reduce: LexTerm + reduce(15), // ")", reduce: LexTerm + reduce(15), // "[", reduce: LexTerm + nil, // "]" + reduce(15), // "{", reduce: LexTerm + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S59 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + shift(99), // char_lit + nil, // "-" + nil, // "~" + shift(100), // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S60 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + shift(56), // regDefId + nil, // ignoredTokId + nil, // "|" + shift(57), // "." + shift(58), // char_lit + nil, // "-" + shift(59), // "~" + shift(60), // "(" + nil, // ")" + shift(61), // "[" + nil, // "]" + shift(62), // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S61 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + shift(66), // regDefId + nil, // ignoredTokId + nil, // "|" + shift(67), // "." + shift(68), // char_lit + nil, // "-" + shift(69), // "~" + shift(70), // "(" + nil, // ")" + shift(71), // "[" + nil, // "]" + shift(72), // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S62 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + shift(76), // regDefId + nil, // ignoredTokId + nil, // "|" + shift(77), // "." + shift(78), // char_lit + nil, // "-" + shift(79), // "~" + shift(80), // "(" + nil, // ")" + shift(81), // "[" + nil, // "]" + shift(82), // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S63 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + shift(104), // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + shift(105), // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S64 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + shift(66), // regDefId + nil, // ignoredTokId + reduce(10), // "|", reduce: LexPattern + shift(67), // "." + shift(68), // char_lit + nil, // "-" + shift(69), // "~" + shift(70), // "(" + nil, // ")" + shift(71), // "[" + reduce(10), // "]", reduce: LexPattern + shift(72), // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S65 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(12), // regDefId, reduce: LexAlt + nil, // ignoredTokId + reduce(12), // "|", reduce: LexAlt + reduce(12), // ".", reduce: LexAlt + reduce(12), // char_lit, reduce: LexAlt + nil, // "-" + reduce(12), // "~", reduce: LexAlt + reduce(12), // "(", reduce: LexAlt + nil, // ")" + reduce(12), // "[", reduce: LexAlt + reduce(12), // "]", reduce: LexAlt + reduce(12), // "{", reduce: LexAlt + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S66 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(19), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(19), // "|", reduce: LexTerm + reduce(19), // ".", reduce: LexTerm + reduce(19), // char_lit, reduce: LexTerm + nil, // "-" + reduce(19), // "~", reduce: LexTerm + reduce(19), // "(", reduce: LexTerm + nil, // ")" + reduce(19), // "[", reduce: LexTerm + reduce(19), // "]", reduce: LexTerm + reduce(19), // "{", reduce: LexTerm + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S67 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(14), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(14), // "|", reduce: LexTerm + reduce(14), // ".", reduce: LexTerm + reduce(14), // char_lit, reduce: LexTerm + nil, // "-" + reduce(14), // "~", reduce: LexTerm + reduce(14), // "(", reduce: LexTerm + nil, // ")" + reduce(14), // "[", reduce: LexTerm + reduce(14), // "]", reduce: LexTerm + reduce(14), // "{", reduce: LexTerm + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S68 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(15), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(15), // "|", reduce: LexTerm + reduce(15), // ".", reduce: LexTerm + reduce(15), // char_lit, reduce: LexTerm + shift(107), // "-" + reduce(15), // "~", reduce: LexTerm + reduce(15), // "(", reduce: LexTerm + nil, // ")" + reduce(15), // "[", reduce: LexTerm + reduce(15), // "]", reduce: LexTerm + reduce(15), // "{", reduce: LexTerm + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S69 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + shift(108), // char_lit + nil, // "-" + nil, // "~" + shift(109), // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S70 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + shift(56), // regDefId + nil, // ignoredTokId + nil, // "|" + shift(57), // "." + shift(58), // char_lit + nil, // "-" + shift(59), // "~" + shift(60), // "(" + nil, // ")" + shift(61), // "[" + nil, // "]" + shift(62), // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S71 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + shift(66), // regDefId + nil, // ignoredTokId + nil, // "|" + shift(67), // "." + shift(68), // char_lit + nil, // "-" + shift(69), // "~" + shift(70), // "(" + nil, // ")" + shift(71), // "[" + nil, // "]" + shift(72), // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S72 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + shift(76), // regDefId + nil, // ignoredTokId + nil, // "|" + shift(77), // "." + shift(78), // char_lit + nil, // "-" + shift(79), // "~" + shift(80), // "(" + nil, // ")" + shift(81), // "[" + nil, // "]" + shift(82), // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S73 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + shift(113), // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + shift(114), // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S74 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + shift(76), // regDefId + nil, // ignoredTokId + reduce(10), // "|", reduce: LexPattern + shift(77), // "." + shift(78), // char_lit + nil, // "-" + shift(79), // "~" + shift(80), // "(" + nil, // ")" + shift(81), // "[" + nil, // "]" + shift(82), // "{" + reduce(10), // "}", reduce: LexPattern + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S75 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(12), // regDefId, reduce: LexAlt + nil, // ignoredTokId + reduce(12), // "|", reduce: LexAlt + reduce(12), // ".", reduce: LexAlt + reduce(12), // char_lit, reduce: LexAlt + nil, // "-" + reduce(12), // "~", reduce: LexAlt + reduce(12), // "(", reduce: LexAlt + nil, // ")" + reduce(12), // "[", reduce: LexAlt + nil, // "]" + reduce(12), // "{", reduce: LexAlt + reduce(12), // "}", reduce: LexAlt + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S76 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(19), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(19), // "|", reduce: LexTerm + reduce(19), // ".", reduce: LexTerm + reduce(19), // char_lit, reduce: LexTerm + nil, // "-" + reduce(19), // "~", reduce: LexTerm + reduce(19), // "(", reduce: LexTerm + nil, // ")" + reduce(19), // "[", reduce: LexTerm + nil, // "]" + reduce(19), // "{", reduce: LexTerm + reduce(19), // "}", reduce: LexTerm + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S77 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(14), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(14), // "|", reduce: LexTerm + reduce(14), // ".", reduce: LexTerm + reduce(14), // char_lit, reduce: LexTerm + nil, // "-" + reduce(14), // "~", reduce: LexTerm + reduce(14), // "(", reduce: LexTerm + nil, // ")" + reduce(14), // "[", reduce: LexTerm + nil, // "]" + reduce(14), // "{", reduce: LexTerm + reduce(14), // "}", reduce: LexTerm + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S78 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(15), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(15), // "|", reduce: LexTerm + reduce(15), // ".", reduce: LexTerm + reduce(15), // char_lit, reduce: LexTerm + shift(116), // "-" + reduce(15), // "~", reduce: LexTerm + reduce(15), // "(", reduce: LexTerm + nil, // ")" + reduce(15), // "[", reduce: LexTerm + nil, // "]" + reduce(15), // "{", reduce: LexTerm + reduce(15), // "}", reduce: LexTerm + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S79 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + shift(117), // char_lit + nil, // "-" + nil, // "~" + shift(118), // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S80 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + shift(56), // regDefId + nil, // ignoredTokId + nil, // "|" + shift(57), // "." + shift(58), // char_lit + nil, // "-" + shift(59), // "~" + shift(60), // "(" + nil, // ")" + shift(61), // "[" + nil, // "]" + shift(62), // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S81 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + shift(66), // regDefId + nil, // ignoredTokId + nil, // "|" + shift(67), // "." + shift(68), // char_lit + nil, // "-" + shift(69), // "~" + shift(70), // "(" + nil, // ")" + shift(71), // "[" + nil, // "]" + shift(72), // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S82 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + shift(76), // regDefId + nil, // ignoredTokId + nil, // "|" + shift(77), // "." + shift(78), // char_lit + nil, // "-" + shift(79), // "~" + shift(80), // "(" + nil, // ")" + shift(81), // "[" + nil, // "]" + shift(82), // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S83 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(8), // Ω, reduce: LexProduction + reduce(8), // tokId, reduce: LexProduction + nil, // ":" + nil, // ";" + reduce(8), // regDefId, reduce: LexProduction + reduce(8), // ignoredTokId, reduce: LexProduction + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + reduce(8), // g_sdt_lit, reduce: LexProduction + reduce(8), // prodId, reduce: LexProduction + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S84 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(9), // Ω, reduce: LexProduction + reduce(9), // tokId, reduce: LexProduction + nil, // ":" + nil, // ";" + reduce(9), // regDefId, reduce: LexProduction + reduce(9), // ignoredTokId, reduce: LexProduction + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + reduce(9), // g_sdt_lit, reduce: LexProduction + reduce(9), // prodId, reduce: LexProduction + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S85 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(28), // Ω, reduce: SyntaxProduction + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + reduce(28), // prodId, reduce: SyntaxProduction + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S86 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + shift(40), // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + shift(41), // prodId + shift(42), // string_lit + nil, // g_ctxdep_lit + shift(43), // "error" + shift(44), // "λ" + shift(45), // "empty" + shift(46), // "ε" + }, + }, + actionRow{ // S87 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + reduce(39), // tokId, reduce: Symbols + nil, // ":" + reduce(39), // ";", reduce: Symbols + nil, // regDefId + nil, // ignoredTokId + reduce(39), // "|", reduce: Symbols + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + reduce(39), // g_sdt_lit, reduce: Symbols + reduce(39), // prodId, reduce: Symbols + reduce(39), // string_lit, reduce: Symbols + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S88 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + reduce(32), // ";", reduce: SyntaxBody + nil, // regDefId + nil, // ignoredTokId + reduce(32), // "|", reduce: SyntaxBody + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S89 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + shift(40), // tokId + nil, // ":" + reduce(34), // ";", reduce: SyntaxBody + nil, // regDefId + nil, // ignoredTokId + reduce(34), // "|", reduce: SyntaxBody + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + shift(123), // g_sdt_lit + shift(41), // prodId + shift(42), // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S90 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + reduce(36), // ";", reduce: SyntaxBody + nil, // regDefId + nil, // ignoredTokId + reduce(36), // "|", reduce: SyntaxBody + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S91 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + reduce(43), // tokId, reduce: Symbol + nil, // ":" + reduce(43), // ";", reduce: Symbol + nil, // regDefId + nil, // ignoredTokId + reduce(43), // "|", reduce: Symbol + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + reduce(43), // g_sdt_lit, reduce: Symbol + reduce(43), // prodId, reduce: Symbol + reduce(43), // string_lit, reduce: Symbol + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S92 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + reduce(11), // ";", reduce: LexPattern + shift(25), // regDefId + nil, // ignoredTokId + reduce(11), // "|", reduce: LexPattern + shift(26), // "." + shift(27), // char_lit + nil, // "-" + shift(28), // "~" + shift(29), // "(" + nil, // ")" + shift(30), // "[" + nil, // "]" + shift(31), // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S93 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + reduce(16), // ";", reduce: LexTerm + reduce(16), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(16), // "|", reduce: LexTerm + reduce(16), // ".", reduce: LexTerm + reduce(16), // char_lit, reduce: LexTerm + nil, // "-" + reduce(16), // "~", reduce: LexTerm + reduce(16), // "(", reduce: LexTerm + nil, // ")" + reduce(16), // "[", reduce: LexTerm + nil, // "]" + reduce(16), // "{", reduce: LexTerm + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S94 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + nil, // char_lit + shift(124), // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S95 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + shift(56), // regDefId + nil, // ignoredTokId + nil, // "|" + shift(57), // "." + shift(58), // char_lit + nil, // "-" + shift(59), // "~" + shift(60), // "(" + nil, // ")" + shift(61), // "[" + nil, // "]" + shift(62), // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S96 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + reduce(22), // ";", reduce: LexTerm + reduce(22), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(22), // "|", reduce: LexTerm + reduce(22), // ".", reduce: LexTerm + reduce(22), // char_lit, reduce: LexTerm + nil, // "-" + reduce(22), // "~", reduce: LexTerm + reduce(22), // "(", reduce: LexTerm + nil, // ")" + reduce(22), // "[", reduce: LexTerm + nil, // "]" + reduce(22), // "{", reduce: LexTerm + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S97 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(13), // regDefId, reduce: LexAlt + nil, // ignoredTokId + reduce(13), // "|", reduce: LexAlt + reduce(13), // ".", reduce: LexAlt + reduce(13), // char_lit, reduce: LexAlt + nil, // "-" + reduce(13), // "~", reduce: LexAlt + reduce(13), // "(", reduce: LexAlt + reduce(13), // ")", reduce: LexAlt + reduce(13), // "[", reduce: LexAlt + nil, // "]" + reduce(13), // "{", reduce: LexAlt + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S98 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + shift(126), // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S99 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(17), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(17), // "|", reduce: LexTerm + reduce(17), // ".", reduce: LexTerm + reduce(17), // char_lit, reduce: LexTerm + nil, // "-" + reduce(17), // "~", reduce: LexTerm + reduce(17), // "(", reduce: LexTerm + reduce(17), // ")", reduce: LexTerm + reduce(17), // "[", reduce: LexTerm + nil, // "]" + reduce(17), // "{", reduce: LexTerm + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S100 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + shift(127), // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S101 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + shift(95), // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + shift(128), // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S102 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + shift(104), // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + shift(129), // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S103 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + shift(113), // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + shift(130), // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S104 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + shift(66), // regDefId + nil, // ignoredTokId + nil, // "|" + shift(67), // "." + shift(68), // char_lit + nil, // "-" + shift(69), // "~" + shift(70), // "(" + nil, // ")" + shift(71), // "[" + nil, // "]" + shift(72), // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S105 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + reduce(20), // ";", reduce: LexTerm + reduce(20), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(20), // "|", reduce: LexTerm + reduce(20), // ".", reduce: LexTerm + reduce(20), // char_lit, reduce: LexTerm + nil, // "-" + reduce(20), // "~", reduce: LexTerm + reduce(20), // "(", reduce: LexTerm + nil, // ")" + reduce(20), // "[", reduce: LexTerm + nil, // "]" + reduce(20), // "{", reduce: LexTerm + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S106 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(13), // regDefId, reduce: LexAlt + nil, // ignoredTokId + reduce(13), // "|", reduce: LexAlt + reduce(13), // ".", reduce: LexAlt + reduce(13), // char_lit, reduce: LexAlt + nil, // "-" + reduce(13), // "~", reduce: LexAlt + reduce(13), // "(", reduce: LexAlt + nil, // ")" + reduce(13), // "[", reduce: LexAlt + reduce(13), // "]", reduce: LexAlt + reduce(13), // "{", reduce: LexAlt + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S107 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + shift(132), // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S108 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(17), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(17), // "|", reduce: LexTerm + reduce(17), // ".", reduce: LexTerm + reduce(17), // char_lit, reduce: LexTerm + nil, // "-" + reduce(17), // "~", reduce: LexTerm + reduce(17), // "(", reduce: LexTerm + nil, // ")" + reduce(17), // "[", reduce: LexTerm + reduce(17), // "]", reduce: LexTerm + reduce(17), // "{", reduce: LexTerm + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S109 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + shift(133), // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S110 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + shift(95), // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + shift(134), // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S111 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + shift(104), // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + shift(135), // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S112 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + shift(113), // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + shift(136), // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S113 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + shift(76), // regDefId + nil, // ignoredTokId + nil, // "|" + shift(77), // "." + shift(78), // char_lit + nil, // "-" + shift(79), // "~" + shift(80), // "(" + nil, // ")" + shift(81), // "[" + nil, // "]" + shift(82), // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S114 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + reduce(21), // ";", reduce: LexTerm + reduce(21), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(21), // "|", reduce: LexTerm + reduce(21), // ".", reduce: LexTerm + reduce(21), // char_lit, reduce: LexTerm + nil, // "-" + reduce(21), // "~", reduce: LexTerm + reduce(21), // "(", reduce: LexTerm + nil, // ")" + reduce(21), // "[", reduce: LexTerm + nil, // "]" + reduce(21), // "{", reduce: LexTerm + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S115 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(13), // regDefId, reduce: LexAlt + nil, // ignoredTokId + reduce(13), // "|", reduce: LexAlt + reduce(13), // ".", reduce: LexAlt + reduce(13), // char_lit, reduce: LexAlt + nil, // "-" + reduce(13), // "~", reduce: LexAlt + reduce(13), // "(", reduce: LexAlt + nil, // ")" + reduce(13), // "[", reduce: LexAlt + nil, // "]" + reduce(13), // "{", reduce: LexAlt + reduce(13), // "}", reduce: LexAlt + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S116 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + shift(138), // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S117 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(17), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(17), // "|", reduce: LexTerm + reduce(17), // ".", reduce: LexTerm + reduce(17), // char_lit, reduce: LexTerm + nil, // "-" + reduce(17), // "~", reduce: LexTerm + reduce(17), // "(", reduce: LexTerm + nil, // ")" + reduce(17), // "[", reduce: LexTerm + nil, // "]" + reduce(17), // "{", reduce: LexTerm + reduce(17), // "}", reduce: LexTerm + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S118 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + shift(139), // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S119 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + shift(95), // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + shift(140), // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S120 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + shift(104), // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + shift(141), // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S121 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + shift(113), // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + shift(142), // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S122 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + reduce(30), // ";", reduce: Alternatives + nil, // regDefId + nil, // ignoredTokId + reduce(30), // "|", reduce: Alternatives + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S123 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + reduce(35), // ";", reduce: SyntaxBody + nil, // regDefId + nil, // ignoredTokId + reduce(35), // "|", reduce: SyntaxBody + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S124 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + shift(143), // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S125 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + shift(56), // regDefId + nil, // ignoredTokId + reduce(11), // "|", reduce: LexPattern + shift(57), // "." + shift(58), // char_lit + nil, // "-" + shift(59), // "~" + shift(60), // "(" + reduce(11), // ")", reduce: LexPattern + shift(61), // "[" + nil, // "]" + shift(62), // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S126 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(16), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(16), // "|", reduce: LexTerm + reduce(16), // ".", reduce: LexTerm + reduce(16), // char_lit, reduce: LexTerm + nil, // "-" + reduce(16), // "~", reduce: LexTerm + reduce(16), // "(", reduce: LexTerm + reduce(16), // ")", reduce: LexTerm + reduce(16), // "[", reduce: LexTerm + nil, // "]" + reduce(16), // "{", reduce: LexTerm + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S127 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + nil, // char_lit + shift(144), // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S128 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(22), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(22), // "|", reduce: LexTerm + reduce(22), // ".", reduce: LexTerm + reduce(22), // char_lit, reduce: LexTerm + nil, // "-" + reduce(22), // "~", reduce: LexTerm + reduce(22), // "(", reduce: LexTerm + reduce(22), // ")", reduce: LexTerm + reduce(22), // "[", reduce: LexTerm + nil, // "]" + reduce(22), // "{", reduce: LexTerm + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S129 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(20), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(20), // "|", reduce: LexTerm + reduce(20), // ".", reduce: LexTerm + reduce(20), // char_lit, reduce: LexTerm + nil, // "-" + reduce(20), // "~", reduce: LexTerm + reduce(20), // "(", reduce: LexTerm + reduce(20), // ")", reduce: LexTerm + reduce(20), // "[", reduce: LexTerm + nil, // "]" + reduce(20), // "{", reduce: LexTerm + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S130 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(21), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(21), // "|", reduce: LexTerm + reduce(21), // ".", reduce: LexTerm + reduce(21), // char_lit, reduce: LexTerm + nil, // "-" + reduce(21), // "~", reduce: LexTerm + reduce(21), // "(", reduce: LexTerm + reduce(21), // ")", reduce: LexTerm + reduce(21), // "[", reduce: LexTerm + nil, // "]" + reduce(21), // "{", reduce: LexTerm + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S131 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + shift(66), // regDefId + nil, // ignoredTokId + reduce(11), // "|", reduce: LexPattern + shift(67), // "." + shift(68), // char_lit + nil, // "-" + shift(69), // "~" + shift(70), // "(" + nil, // ")" + shift(71), // "[" + reduce(11), // "]", reduce: LexPattern + shift(72), // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S132 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(16), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(16), // "|", reduce: LexTerm + reduce(16), // ".", reduce: LexTerm + reduce(16), // char_lit, reduce: LexTerm + nil, // "-" + reduce(16), // "~", reduce: LexTerm + reduce(16), // "(", reduce: LexTerm + nil, // ")" + reduce(16), // "[", reduce: LexTerm + reduce(16), // "]", reduce: LexTerm + reduce(16), // "{", reduce: LexTerm + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S133 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + nil, // char_lit + shift(145), // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S134 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(22), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(22), // "|", reduce: LexTerm + reduce(22), // ".", reduce: LexTerm + reduce(22), // char_lit, reduce: LexTerm + nil, // "-" + reduce(22), // "~", reduce: LexTerm + reduce(22), // "(", reduce: LexTerm + nil, // ")" + reduce(22), // "[", reduce: LexTerm + reduce(22), // "]", reduce: LexTerm + reduce(22), // "{", reduce: LexTerm + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S135 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(20), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(20), // "|", reduce: LexTerm + reduce(20), // ".", reduce: LexTerm + reduce(20), // char_lit, reduce: LexTerm + nil, // "-" + reduce(20), // "~", reduce: LexTerm + reduce(20), // "(", reduce: LexTerm + nil, // ")" + reduce(20), // "[", reduce: LexTerm + reduce(20), // "]", reduce: LexTerm + reduce(20), // "{", reduce: LexTerm + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S136 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(21), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(21), // "|", reduce: LexTerm + reduce(21), // ".", reduce: LexTerm + reduce(21), // char_lit, reduce: LexTerm + nil, // "-" + reduce(21), // "~", reduce: LexTerm + reduce(21), // "(", reduce: LexTerm + nil, // ")" + reduce(21), // "[", reduce: LexTerm + reduce(21), // "]", reduce: LexTerm + reduce(21), // "{", reduce: LexTerm + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S137 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + shift(76), // regDefId + nil, // ignoredTokId + reduce(11), // "|", reduce: LexPattern + shift(77), // "." + shift(78), // char_lit + nil, // "-" + shift(79), // "~" + shift(80), // "(" + nil, // ")" + shift(81), // "[" + nil, // "]" + shift(82), // "{" + reduce(11), // "}", reduce: LexPattern + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S138 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(16), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(16), // "|", reduce: LexTerm + reduce(16), // ".", reduce: LexTerm + reduce(16), // char_lit, reduce: LexTerm + nil, // "-" + reduce(16), // "~", reduce: LexTerm + reduce(16), // "(", reduce: LexTerm + nil, // ")" + reduce(16), // "[", reduce: LexTerm + nil, // "]" + reduce(16), // "{", reduce: LexTerm + reduce(16), // "}", reduce: LexTerm + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S139 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + nil, // char_lit + shift(146), // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S140 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(22), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(22), // "|", reduce: LexTerm + reduce(22), // ".", reduce: LexTerm + reduce(22), // char_lit, reduce: LexTerm + nil, // "-" + reduce(22), // "~", reduce: LexTerm + reduce(22), // "(", reduce: LexTerm + nil, // ")" + reduce(22), // "[", reduce: LexTerm + nil, // "]" + reduce(22), // "{", reduce: LexTerm + reduce(22), // "}", reduce: LexTerm + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S141 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(20), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(20), // "|", reduce: LexTerm + reduce(20), // ".", reduce: LexTerm + reduce(20), // char_lit, reduce: LexTerm + nil, // "-" + reduce(20), // "~", reduce: LexTerm + reduce(20), // "(", reduce: LexTerm + nil, // ")" + reduce(20), // "[", reduce: LexTerm + nil, // "]" + reduce(20), // "{", reduce: LexTerm + reduce(20), // "}", reduce: LexTerm + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S142 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(21), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(21), // "|", reduce: LexTerm + reduce(21), // ".", reduce: LexTerm + reduce(21), // char_lit, reduce: LexTerm + nil, // "-" + reduce(21), // "~", reduce: LexTerm + reduce(21), // "(", reduce: LexTerm + nil, // ")" + reduce(21), // "[", reduce: LexTerm + nil, // "]" + reduce(21), // "{", reduce: LexTerm + reduce(21), // "}", reduce: LexTerm + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S143 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + shift(147), // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S144 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + shift(148), // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S145 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + shift(149), // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S146 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + shift(150), // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S147 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + reduce(18), // ";", reduce: LexTerm + reduce(18), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(18), // "|", reduce: LexTerm + reduce(18), // ".", reduce: LexTerm + reduce(18), // char_lit, reduce: LexTerm + nil, // "-" + reduce(18), // "~", reduce: LexTerm + reduce(18), // "(", reduce: LexTerm + nil, // ")" + reduce(18), // "[", reduce: LexTerm + nil, // "]" + reduce(18), // "{", reduce: LexTerm + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S148 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + shift(151), // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S149 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + shift(152), // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S150 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + shift(153), // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S151 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(18), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(18), // "|", reduce: LexTerm + reduce(18), // ".", reduce: LexTerm + reduce(18), // char_lit, reduce: LexTerm + nil, // "-" + reduce(18), // "~", reduce: LexTerm + reduce(18), // "(", reduce: LexTerm + reduce(18), // ")", reduce: LexTerm + reduce(18), // "[", reduce: LexTerm + nil, // "]" + reduce(18), // "{", reduce: LexTerm + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S152 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(18), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(18), // "|", reduce: LexTerm + reduce(18), // ".", reduce: LexTerm + reduce(18), // char_lit, reduce: LexTerm + nil, // "-" + reduce(18), // "~", reduce: LexTerm + reduce(18), // "(", reduce: LexTerm + nil, // ")" + reduce(18), // "[", reduce: LexTerm + reduce(18), // "]", reduce: LexTerm + reduce(18), // "{", reduce: LexTerm + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + actionRow{ // S153 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(18), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(18), // "|", reduce: LexTerm + reduce(18), // ".", reduce: LexTerm + reduce(18), // char_lit, reduce: LexTerm + nil, // "-" + reduce(18), // "~", reduce: LexTerm + reduce(18), // "(", reduce: LexTerm + nil, // ")" + reduce(18), // "[", reduce: LexTerm + nil, // "]" + reduce(18), // "{", reduce: LexTerm + reduce(18), // "}", reduce: LexTerm + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + }, + }, } + diff --git a/internal/frontend/reparsed/internal/parser/gototable.go b/internal/frontend/reparsed/internal/parser/gototable.go index ac307ebd..f9e46430 100644 --- a/internal/frontend/reparsed/internal/parser/gototable.go +++ b/internal/frontend/reparsed/internal/parser/gototable.go @@ -479,7 +479,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 50, // Π + 49, // Π -1, // Π -1, // Π -1, // Π @@ -597,9 +597,9 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 54, // Π - 55, // Π - 56, // Π + 53, // Π + 54, // Π + 55, // Π -1, // Π -1, // Π -1, // Π @@ -617,9 +617,9 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 64, // Π - 65, // Π - 66, // Π + 63, // Π + 64, // Π + 65, // Π -1, // Π -1, // Π -1, // Π @@ -637,9 +637,9 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 74, // Π - 75, // Π - 76, // Π + 73, // Π + 74, // Π + 75, // Π -1, // Π -1, // Π -1, // Π @@ -748,7 +748,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 88, // Π + 87, // Π }, gotoRow{ // S37 -1, // Π @@ -765,7 +765,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 90, // Π + 89, // Π -1, // Π -1, // Π 39, // Π @@ -978,8 +978,8 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - -1, // Π - -1, // Π + 92, // Π + 24, // Π -1, // Π -1, // Π -1, // Π @@ -998,8 +998,8 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 93, // Π - 24, // Π + -1, // Π + -1, // Π -1, // Π -1, // Π -1, // Π @@ -1099,7 +1099,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - -1, // Π + 97, // Π -1, // Π -1, // Π -1, // Π @@ -1119,7 +1119,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 98, // Π + -1, // Π -1, // Π -1, // Π -1, // Π @@ -1211,35 +1211,15 @@ var gotoTab = gotoTable{ -1, // Π }, gotoRow{ // S60 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S61 -1, // Π -1, // Π -1, // Π -1, // Π -1, // Π -1, // Π - 102, // Π - 55, // Π - 56, // Π + 101, // Π + 54, // Π + 55, // Π -1, // Π -1, // Π -1, // Π @@ -1250,16 +1230,16 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S62 + gotoRow{ // S61 -1, // Π -1, // Π -1, // Π -1, // Π -1, // Π -1, // Π - 103, // Π - 65, // Π - 66, // Π + 102, // Π + 64, // Π + 65, // Π -1, // Π -1, // Π -1, // Π @@ -1270,16 +1250,16 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S63 + gotoRow{ // S62 -1, // Π -1, // Π -1, // Π -1, // Π -1, // Π -1, // Π - 104, // Π - 75, // Π - 76, // Π + 103, // Π + 74, // Π + 75, // Π -1, // Π -1, // Π -1, // Π @@ -1290,7 +1270,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S64 + gotoRow{ // S63 -1, // Π -1, // Π -1, // Π @@ -1310,7 +1290,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S65 + gotoRow{ // S64 -1, // Π -1, // Π -1, // Π @@ -1319,7 +1299,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 107, // Π + 106, // Π -1, // Π -1, // Π -1, // Π @@ -1330,7 +1310,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S66 + gotoRow{ // S65 -1, // Π -1, // Π -1, // Π @@ -1350,7 +1330,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S67 + gotoRow{ // S66 -1, // Π -1, // Π -1, // Π @@ -1370,7 +1350,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S68 + gotoRow{ // S67 -1, // Π -1, // Π -1, // Π @@ -1390,7 +1370,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S69 + gotoRow{ // S68 -1, // Π -1, // Π -1, // Π @@ -1410,7 +1390,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S70 + gotoRow{ // S69 -1, // Π -1, // Π -1, // Π @@ -1430,16 +1410,16 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S71 + gotoRow{ // S70 -1, // Π -1, // Π -1, // Π -1, // Π -1, // Π -1, // Π - 111, // Π - 55, // Π - 56, // Π + 110, // Π + 54, // Π + 55, // Π -1, // Π -1, // Π -1, // Π @@ -1450,16 +1430,16 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S72 + gotoRow{ // S71 -1, // Π -1, // Π -1, // Π -1, // Π -1, // Π -1, // Π - 112, // Π - 65, // Π - 66, // Π + 111, // Π + 64, // Π + 65, // Π -1, // Π -1, // Π -1, // Π @@ -1470,16 +1450,16 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S73 + gotoRow{ // S72 -1, // Π -1, // Π -1, // Π -1, // Π -1, // Π -1, // Π - 113, // Π - 75, // Π - 76, // Π + 112, // Π + 74, // Π + 75, // Π -1, // Π -1, // Π -1, // Π @@ -1490,7 +1470,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S74 + gotoRow{ // S73 -1, // Π -1, // Π -1, // Π @@ -1510,7 +1490,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S75 + gotoRow{ // S74 -1, // Π -1, // Π -1, // Π @@ -1519,7 +1499,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 116, // Π + 115, // Π -1, // Π -1, // Π -1, // Π @@ -1530,7 +1510,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S76 + gotoRow{ // S75 -1, // Π -1, // Π -1, // Π @@ -1550,7 +1530,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S77 + gotoRow{ // S76 -1, // Π -1, // Π -1, // Π @@ -1570,7 +1550,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S78 + gotoRow{ // S77 -1, // Π -1, // Π -1, // Π @@ -1590,7 +1570,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S79 + gotoRow{ // S78 -1, // Π -1, // Π -1, // Π @@ -1610,7 +1590,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S80 + gotoRow{ // S79 -1, // Π -1, // Π -1, // Π @@ -1630,16 +1610,16 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S81 + gotoRow{ // S80 -1, // Π -1, // Π -1, // Π -1, // Π -1, // Π -1, // Π - 120, // Π - 55, // Π - 56, // Π + 119, // Π + 54, // Π + 55, // Π -1, // Π -1, // Π -1, // Π @@ -1650,16 +1630,16 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S82 + gotoRow{ // S81 -1, // Π -1, // Π -1, // Π -1, // Π -1, // Π -1, // Π - 121, // Π - 65, // Π - 66, // Π + 120, // Π + 64, // Π + 65, // Π -1, // Π -1, // Π -1, // Π @@ -1670,16 +1650,16 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S83 + gotoRow{ // S82 -1, // Π -1, // Π -1, // Π -1, // Π -1, // Π -1, // Π - 122, // Π - 75, // Π - 76, // Π + 121, // Π + 74, // Π + 75, // Π -1, // Π -1, // Π -1, // Π @@ -1690,7 +1670,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S84 + gotoRow{ // S83 -1, // Π -1, // Π -1, // Π @@ -1710,7 +1690,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S85 + gotoRow{ // S84 -1, // Π -1, // Π -1, // Π @@ -1730,7 +1710,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S86 + gotoRow{ // S85 -1, // Π -1, // Π -1, // Π @@ -1750,7 +1730,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S87 + gotoRow{ // S86 -1, // Π -1, // Π -1, // Π @@ -1764,13 +1744,13 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 123, // Π + 122, // Π 36, // Π 37, // Π 38, // Π 39, // Π }, - gotoRow{ // S88 + gotoRow{ // S87 -1, // Π -1, // Π -1, // Π @@ -1790,7 +1770,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S89 + gotoRow{ // S88 -1, // Π -1, // Π -1, // Π @@ -1810,7 +1790,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S90 + gotoRow{ // S89 -1, // Π -1, // Π -1, // Π @@ -1828,9 +1808,9 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 88, // Π + 87, // Π }, - gotoRow{ // S91 + gotoRow{ // S90 -1, // Π -1, // Π -1, // Π @@ -1850,7 +1830,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S92 + gotoRow{ // S91 -1, // Π -1, // Π -1, // Π @@ -1870,7 +1850,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S93 + gotoRow{ // S92 -1, // Π -1, // Π -1, // Π @@ -1879,7 +1859,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 50, // Π + 49, // Π -1, // Π -1, // Π -1, // Π @@ -1890,7 +1870,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S94 + gotoRow{ // S93 -1, // Π -1, // Π -1, // Π @@ -1910,7 +1890,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S95 + gotoRow{ // S94 -1, // Π -1, // Π -1, // Π @@ -1930,7 +1910,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S96 + gotoRow{ // S95 -1, // Π -1, // Π -1, // Π @@ -1938,8 +1918,8 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 126, // Π - 56, // Π + 125, // Π + 55, // Π -1, // Π -1, // Π -1, // Π @@ -1950,7 +1930,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S97 + gotoRow{ // S96 -1, // Π -1, // Π -1, // Π @@ -1970,7 +1950,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S98 + gotoRow{ // S97 -1, // Π -1, // Π -1, // Π @@ -1990,7 +1970,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S99 + gotoRow{ // S98 -1, // Π -1, // Π -1, // Π @@ -2010,7 +1990,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S100 + gotoRow{ // S99 -1, // Π -1, // Π -1, // Π @@ -2030,7 +2010,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S101 + gotoRow{ // S100 -1, // Π -1, // Π -1, // Π @@ -2050,7 +2030,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S102 + gotoRow{ // S101 -1, // Π -1, // Π -1, // Π @@ -2070,7 +2050,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S103 + gotoRow{ // S102 -1, // Π -1, // Π -1, // Π @@ -2090,7 +2070,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S104 + gotoRow{ // S103 -1, // Π -1, // Π -1, // Π @@ -2110,7 +2090,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S105 + gotoRow{ // S104 -1, // Π -1, // Π -1, // Π @@ -2118,8 +2098,8 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 132, // Π - 66, // Π + 131, // Π + 65, // Π -1, // Π -1, // Π -1, // Π @@ -2130,7 +2110,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S106 + gotoRow{ // S105 -1, // Π -1, // Π -1, // Π @@ -2150,7 +2130,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S107 + gotoRow{ // S106 -1, // Π -1, // Π -1, // Π @@ -2170,7 +2150,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S108 + gotoRow{ // S107 -1, // Π -1, // Π -1, // Π @@ -2190,7 +2170,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S109 + gotoRow{ // S108 -1, // Π -1, // Π -1, // Π @@ -2210,7 +2190,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S110 + gotoRow{ // S109 -1, // Π -1, // Π -1, // Π @@ -2230,7 +2210,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S111 + gotoRow{ // S110 -1, // Π -1, // Π -1, // Π @@ -2250,7 +2230,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S112 + gotoRow{ // S111 -1, // Π -1, // Π -1, // Π @@ -2270,7 +2250,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S113 + gotoRow{ // S112 -1, // Π -1, // Π -1, // Π @@ -2290,7 +2270,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S114 + gotoRow{ // S113 -1, // Π -1, // Π -1, // Π @@ -2298,8 +2278,8 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 138, // Π - 76, // Π + 137, // Π + 75, // Π -1, // Π -1, // Π -1, // Π @@ -2310,7 +2290,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S115 + gotoRow{ // S114 -1, // Π -1, // Π -1, // Π @@ -2330,7 +2310,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S116 + gotoRow{ // S115 -1, // Π -1, // Π -1, // Π @@ -2350,7 +2330,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S117 + gotoRow{ // S116 -1, // Π -1, // Π -1, // Π @@ -2370,7 +2350,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S118 + gotoRow{ // S117 -1, // Π -1, // Π -1, // Π @@ -2390,7 +2370,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S119 + gotoRow{ // S118 -1, // Π -1, // Π -1, // Π @@ -2410,7 +2390,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S120 + gotoRow{ // S119 -1, // Π -1, // Π -1, // Π @@ -2430,7 +2410,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S121 + gotoRow{ // S120 -1, // Π -1, // Π -1, // Π @@ -2450,7 +2430,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S122 + gotoRow{ // S121 -1, // Π -1, // Π -1, // Π @@ -2470,7 +2450,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S123 + gotoRow{ // S122 -1, // Π -1, // Π -1, // Π @@ -2490,7 +2470,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S124 + gotoRow{ // S123 -1, // Π -1, // Π -1, // Π @@ -2510,7 +2490,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S125 + gotoRow{ // S124 -1, // Π -1, // Π -1, // Π @@ -2530,7 +2510,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S126 + gotoRow{ // S125 -1, // Π -1, // Π -1, // Π @@ -2539,7 +2519,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 98, // Π + 97, // Π -1, // Π -1, // Π -1, // Π @@ -2550,7 +2530,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S127 + gotoRow{ // S126 -1, // Π -1, // Π -1, // Π @@ -2570,7 +2550,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S128 + gotoRow{ // S127 -1, // Π -1, // Π -1, // Π @@ -2590,7 +2570,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S129 + gotoRow{ // S128 -1, // Π -1, // Π -1, // Π @@ -2610,7 +2590,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S130 + gotoRow{ // S129 -1, // Π -1, // Π -1, // Π @@ -2630,7 +2610,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S131 + gotoRow{ // S130 -1, // Π -1, // Π -1, // Π @@ -2650,7 +2630,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S132 + gotoRow{ // S131 -1, // Π -1, // Π -1, // Π @@ -2659,7 +2639,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 107, // Π + 106, // Π -1, // Π -1, // Π -1, // Π @@ -2670,7 +2650,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S133 + gotoRow{ // S132 -1, // Π -1, // Π -1, // Π @@ -2690,7 +2670,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S134 + gotoRow{ // S133 -1, // Π -1, // Π -1, // Π @@ -2710,7 +2690,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S135 + gotoRow{ // S134 -1, // Π -1, // Π -1, // Π @@ -2730,7 +2710,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S136 + gotoRow{ // S135 -1, // Π -1, // Π -1, // Π @@ -2750,7 +2730,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S137 + gotoRow{ // S136 -1, // Π -1, // Π -1, // Π @@ -2770,7 +2750,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S138 + gotoRow{ // S137 -1, // Π -1, // Π -1, // Π @@ -2779,7 +2759,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 116, // Π + 115, // Π -1, // Π -1, // Π -1, // Π @@ -2790,7 +2770,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S139 + gotoRow{ // S138 -1, // Π -1, // Π -1, // Π @@ -2810,7 +2790,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S140 + gotoRow{ // S139 -1, // Π -1, // Π -1, // Π @@ -2830,7 +2810,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S141 + gotoRow{ // S140 -1, // Π -1, // Π -1, // Π @@ -2850,7 +2830,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S142 + gotoRow{ // S141 -1, // Π -1, // Π -1, // Π @@ -2870,7 +2850,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S143 + gotoRow{ // S142 -1, // Π -1, // Π -1, // Π @@ -2890,7 +2870,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S144 + gotoRow{ // S143 -1, // Π -1, // Π -1, // Π @@ -2910,7 +2890,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S145 + gotoRow{ // S144 -1, // Π -1, // Π -1, // Π @@ -2930,7 +2910,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S146 + gotoRow{ // S145 -1, // Π -1, // Π -1, // Π @@ -2950,7 +2930,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S147 + gotoRow{ // S146 -1, // Π -1, // Π -1, // Π @@ -2970,7 +2950,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S148 + gotoRow{ // S147 -1, // Π -1, // Π -1, // Π @@ -2990,7 +2970,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S149 + gotoRow{ // S148 -1, // Π -1, // Π -1, // Π @@ -3010,7 +2990,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S150 + gotoRow{ // S149 -1, // Π -1, // Π -1, // Π @@ -3030,7 +3010,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S151 + gotoRow{ // S150 -1, // Π -1, // Π -1, // Π @@ -3050,7 +3030,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S152 + gotoRow{ // S151 -1, // Π -1, // Π -1, // Π @@ -3070,7 +3050,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S153 + gotoRow{ // S152 -1, // Π -1, // Π -1, // Π @@ -3090,7 +3070,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S154 + gotoRow{ // S153 -1, // Π -1, // Π -1, // Π diff --git a/internal/frontend/reparsed/internal/parser/parser.go b/internal/frontend/reparsed/internal/parser/parser.go index 1971d903..faedb5ee 100644 --- a/internal/frontend/reparsed/internal/parser/parser.go +++ b/internal/frontend/reparsed/internal/parser/parser.go @@ -5,6 +5,7 @@ package parser import ( "fmt" "strings" + "errors" parseError "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/internal/errors" "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/internal/token" @@ -12,7 +13,7 @@ import ( const ( numProductions = 48 - numStates = 155 + numStates = 154 numSymbols = 44 ) @@ -92,6 +93,7 @@ type Parser struct { nextToken *token.Token userContext interface{} longest bool + checkPoint Position } type Scanner interface { @@ -100,7 +102,7 @@ type Scanner interface { type Position interface{} -type ContextDependentScanner interface { +type RepositionableScanner interface { Scanner Reposition(p Position) CurrentPosition() Position @@ -128,24 +130,24 @@ func (p *Parser) Error(err error, scanner Scanner) (recovered bool, errorAttrib ErrorSymbols: p.popNonRecoveryStates(), ExpectedTokens: make([]string, 0, 8), } - for t, action := range actionTab[p.stack.top()].actions { + for t, action := range parserActions.table[p.stack.top()].actions { if action != nil { errorAttrib.ExpectedTokens = append(errorAttrib.ExpectedTokens, token.TokMap.Id(token.Type(t))) } } - if action := actionTab[p.stack.top()].actions[token.TokMap.Type("error")]; action != nil { + if action := parserActions.table[p.stack.top()].actions[token.TokMap.Type("error")]; action != nil { p.stack.push(int(action.(shift)), errorAttrib) // action can only be shift } else { return } - if action := actionTab[p.stack.top()].actions[p.nextToken.Type]; action != nil { + if action := parserActions.table[p.stack.top()].actions[p.nextToken.Type]; action != nil { recovered = true } for !recovered && p.nextToken.Type != token.EOF { p.nextToken = scanner.Scan() - if action := actionTab[p.stack.top()].actions[p.nextToken.Type]; action != nil { + if action := parserActions.table[p.stack.top()].actions[p.nextToken.Type]; action != nil { recovered = true } } @@ -168,10 +170,10 @@ func (p *Parser) popNonRecoveryStates() (removedAttribs []parseError.ErrorSymbol // recoveryState points to the highest state on the stack, which can recover func (p *Parser) firstRecoveryState() (recoveryState int, canRecover bool) { - recoveryState, canRecover = p.stack.topIndex(), actionTab[p.stack.top()].canRecover + recoveryState, canRecover = p.stack.topIndex(), parserActions.table[p.stack.top()].canRecover for recoveryState > 0 && !canRecover { recoveryState-- - canRecover = actionTab[p.stack.peek(recoveryState)].canRecover + canRecover = parserActions.table[p.stack.peek(recoveryState)].canRecover } return } @@ -182,7 +184,7 @@ func (p *Parser) newError(err error) error { StackTop: p.stack.top(), ErrorToken: p.nextToken, } - actRow := actionTab[p.stack.top()] + actRow := parserActions.table[p.stack.top()] for i, t := range actRow.actions { if t != nil { e.ExpectedTokens = append(e.ExpectedTokens, token.TokMap.Id(token.Type(i))) @@ -193,47 +195,75 @@ func (p *Parser) newError(err error) error { func (p *Parser) Parse(scanner Scanner) (res interface{}, err error) { p.longest = false - return p.parse(scanner) + r, e, _ := p.parse(scanner) + return r, e } func (p *Parser) ParseLongestPrefix(scanner Scanner) (res interface{}, err error, parsed []byte) { + if _, isRepositionable := scanner.(RepositionableScanner); !isRepositionable { + return nil, errors.New("scanner not repositionable"), []byte{} + } p.longest = true - r, e := p.parse(scanner) - return r, e, []byte{} + return p.parse(scanner) } -func (p *Parser) parse(scanner Scanner) (res interface{}, err error) { +func (p *Parser) parse(scanner Scanner) (res interface{}, err error, parsed []byte) { p.Reset() + if p.longest { + p.checkPoint = scanner.(RepositionableScanner).CurrentPosition() + } p.nextToken = scanner.Scan() for acc := false; !acc; { - action := actionTab[p.stack.top()].actions[p.nextToken.Type] + action := parserActions.table[p.stack.top()].actions[p.nextToken.Type] if action == nil { - - if p.longest { - } - + for tt, fn := range parserActions.cdTokens { + if fn != nil { + scanner.(RepositionableScanner).Reposition(p.checkPoint) + cd_res, cd_err, cd_parsed := fn(p.userContext) + if cd_err == nil && len(cd_parsed) > 0 { + action = parserActions.table[p.stack.top()].actions[tt] + p.nextToken.ForeingAstNode = cd_res + p.nextToken.Lit = cd_parsed + break + } + } + } + } + if action == nil { + if p.longest { + scanner.(RepositionableScanner).Reposition(p.checkPoint) + } + } + if action == nil { if recovered, errAttrib := p.Error(nil, scanner); !recovered { p.nextToken = errAttrib.ErrorToken - return nil, p.newError(nil) + return nil, p.newError(nil), []byte{} } - if action = actionTab[p.stack.top()].actions[p.nextToken.Type]; action == nil { + if action = parserActions.table[p.stack.top()].actions[p.nextToken.Type]; action == nil { panic("Error recovery led to invalid action") } - } + } switch act := action.(type) { case accept: res = p.stack.popN(1)[0] acc = true case shift: - p.stack.push(int(act), p.nextToken) + if p.nextToken.ForeingAstNode == nil { + p.stack.push(int(act), p.nextToken) + } else { + p.stack.push(int(act), p.nextToken.ForeingAstNode) + } + if p.longest { + p.checkPoint = scanner.(RepositionableScanner).CurrentPosition() + } p.nextToken = scanner.Scan() case reduce: prod := productionsTable[int(act)] attrib, err := prod.ReduceFunc(p.userContext, p.stack.popN(prod.NumSymbols)) if err != nil { - return nil, p.newError(err) + return nil, p.newError(err), []byte{} } else { p.stack.push(gotoTab[p.stack.top()][prod.NTType], attrib) } @@ -241,5 +271,5 @@ func (p *Parser) parse(scanner Scanner) (res interface{}, err error) { panic("unknown action: " + action.String()) } } - return res, nil + return res, nil, []byte{} } diff --git a/internal/frontend/reparsed/internal/parser/productionstable.go b/internal/frontend/reparsed/internal/parser/productionstable.go index 10c79494..dcf6a82a 100644 --- a/internal/frontend/reparsed/internal/parser/productionstable.go +++ b/internal/frontend/reparsed/internal/parser/productionstable.go @@ -453,13 +453,13 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `Symbol : Λ<@> tokId << ast.NewContextDependentTokId(X[1]) >>`, + String: `Symbol : tokId g_ctxdep_lit << ast.NewContextDependentTokId(X[0],X[1]) >>`, Id: "Symbol", NTType: 17, Index: 43, NumSymbols: 2, ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { - return ast.NewContextDependentTokId(X[1]) + return ast.NewContextDependentTokId(X[0],X[1]) }, }, ProdTabEntry{ diff --git a/internal/frontend/reparsed/internal/token/token.go b/internal/frontend/reparsed/internal/token/token.go index 96b79347..47dc5c70 100644 --- a/internal/frontend/reparsed/internal/token/token.go +++ b/internal/frontend/reparsed/internal/token/token.go @@ -10,8 +10,7 @@ type Token struct { Type Lit []byte Pos - ForeingAstNode interface{} - ForeingAstError error + ForeingAstNode interface{} } type Type int @@ -95,7 +94,7 @@ var TokMap = TokenMap{ "g_sdt_lit", "prodId", "string_lit", - "Λ<@>", + "g_ctxdep_lit", "Λ", "Λ<λ>", "Λ", @@ -124,7 +123,7 @@ var TokMap = TokenMap{ "g_sdt_lit": 18, "prodId": 19, "string_lit": 20, - "Λ<@>": 21, + "g_ctxdep_lit": 21, "Λ": 22, "Λ<λ>": 23, "Λ": 24, diff --git a/internal/frontend/reparsed/log/LR1_sets.txt b/internal/frontend/reparsed/log/LR1_sets.txt index b25faeae..39ef77dc 100644 --- a/internal/frontend/reparsed/log/LR1_sets.txt +++ b/internal/frontend/reparsed/log/LR1_sets.txt @@ -655,11 +655,9 @@ S21{ Symbols : •Π Π «g_sdt_lit» ErrorSymbol : •Λ «";"» ErrorSymbol : •Λ<λ> «";"» - ErrorSymbol : •Λ «"@"» ErrorSymbol : •Λ «prodId» ErrorSymbol : •Λ «string_lit» ErrorSymbol : •Λ «tokId» - ErrorSymbol : •Λ<λ> «"@"» ErrorSymbol : •Λ<λ> «prodId» ErrorSymbol : •Λ<λ> «string_lit» ErrorSymbol : •Λ<λ> «tokId» @@ -677,45 +675,39 @@ S21{ Symbol : •prodId «";"» Symbol : •tokId «";"» Symbol : •string_lit «";"» - Symbol : •Λ<@> tokId «";"» - Symbols : •Π «"@"» + Symbol : •tokId g_ctxdep_lit «";"» Symbols : •Π «prodId» Symbols : •Π «string_lit» Symbols : •Π «tokId» - Symbols : •Π Π «"@"» Symbols : •Π Π «prodId» Symbols : •Π Π «string_lit» Symbols : •Π Π «tokId» Symbol : •prodId «g_sdt_lit» Symbol : •tokId «g_sdt_lit» Symbol : •string_lit «g_sdt_lit» - Symbol : •Λ<@> tokId «g_sdt_lit» + Symbol : •tokId g_ctxdep_lit «g_sdt_lit» Symbols : •Π «"|"» Symbols : •Π Π «"|"» ErrorSymbol : •Λ «"|"» ErrorSymbol : •Λ<λ> «"|"» EpsilonSymbol : •Λ «"|"» EpsilonSymbol : •Λ<ε> «"|"» - Symbol : •prodId «"@"» - Symbol : •tokId «"@"» - Symbol : •string_lit «"@"» - Symbol : •Λ<@> tokId «"@"» Symbol : •prodId «prodId» Symbol : •tokId «prodId» Symbol : •string_lit «prodId» - Symbol : •Λ<@> tokId «prodId» + Symbol : •tokId g_ctxdep_lit «prodId» Symbol : •prodId «string_lit» Symbol : •tokId «string_lit» Symbol : •string_lit «string_lit» - Symbol : •Λ<@> tokId «string_lit» + Symbol : •tokId g_ctxdep_lit «string_lit» Symbol : •prodId «tokId» Symbol : •tokId «tokId» Symbol : •string_lit «tokId» - Symbol : •Λ<@> tokId «tokId» + Symbol : •tokId g_ctxdep_lit «tokId» Symbol : •prodId «"|"» Symbol : •tokId «"|"» Symbol : •string_lit «"|"» - Symbol : •Λ<@> tokId «"|"» + Symbol : •tokId g_ctxdep_lit «"|"» } Transitions: Π -> 34 @@ -727,11 +719,10 @@ Transitions: tokId -> 40 prodId -> 41 string_lit -> 42 - Λ<@> -> 43 - Λ -> 44 - Λ<λ> -> 45 - Λ -> 46 - Λ<ε> -> 47 + Λ -> 43 + Λ<λ> -> 44 + Λ -> 45 + Λ<ε> -> 46 S22{ @@ -745,8 +736,8 @@ S22{ LexPattern : Π •Λ<|> Π «"|"» } Transitions: - Λ<;> -> 48 - Λ<|> -> 49 + Λ<;> -> 47 + Λ<|> -> 48 S23{ @@ -851,7 +842,7 @@ Transitions: Λ<(> -> 29 Λ<[> -> 30 Λ<{> -> 31 - Π -> 50 + Π -> 49 S24{ @@ -917,7 +908,7 @@ S27{ LexTerm : char_lit •Λ<-> char_lit «"|"» } Transitions: - Λ<-> -> 51 + Λ<-> -> 50 S28{ @@ -941,8 +932,8 @@ S28{ LexTerm : Λ<~> •Λ<(> char_lit Λ<-> char_lit Λ<)> «"|"» } Transitions: - char_lit -> 52 - Λ<(> -> 53 + char_lit -> 51 + Λ<(> -> 52 S29{ @@ -1060,16 +1051,16 @@ S29{ LexTerm : •Λ<(> Π Λ<)> «"|"» } Transitions: - Π -> 54 - Π -> 55 - Π -> 56 - regDefId -> 57 - Λ<.> -> 58 - char_lit -> 59 - Λ<~> -> 60 - Λ<(> -> 61 - Λ<[> -> 62 - Λ<{> -> 63 + Π -> 53 + Π -> 54 + Π -> 55 + regDefId -> 56 + Λ<.> -> 57 + char_lit -> 58 + Λ<~> -> 59 + Λ<(> -> 60 + Λ<[> -> 61 + Λ<{> -> 62 S30{ @@ -1187,16 +1178,16 @@ S30{ LexTerm : •Λ<(> Π Λ<)> «"|"» } Transitions: - Π -> 64 - Π -> 65 - Π -> 66 - regDefId -> 67 - Λ<.> -> 68 - char_lit -> 69 - Λ<~> -> 70 - Λ<(> -> 71 - Λ<[> -> 72 - Λ<{> -> 73 + Π -> 63 + Π -> 64 + Π -> 65 + regDefId -> 66 + Λ<.> -> 67 + char_lit -> 68 + Λ<~> -> 69 + Λ<(> -> 70 + Λ<[> -> 71 + Λ<{> -> 72 S31{ @@ -1314,16 +1305,16 @@ S31{ LexTerm : •Λ<(> Π Λ<)> «"|"» } Transitions: - Π -> 74 - Π -> 75 - Π -> 76 - regDefId -> 77 - Λ<.> -> 78 - char_lit -> 79 - Λ<~> -> 80 - Λ<(> -> 81 - Λ<[> -> 82 - Λ<{> -> 83 + Π -> 73 + Π -> 74 + Π -> 75 + regDefId -> 76 + Λ<.> -> 77 + char_lit -> 78 + Λ<~> -> 79 + Λ<(> -> 80 + Λ<[> -> 81 + Λ<{> -> 82 S32{ @@ -1337,8 +1328,8 @@ S32{ LexPattern : Π •Λ<|> Π «"|"» } Transitions: - Λ<|> -> 49 - Λ<;> -> 84 + Λ<|> -> 48 + Λ<;> -> 83 S33{ @@ -1352,8 +1343,8 @@ S33{ LexPattern : Π •Λ<|> Π «"|"» } Transitions: - Λ<|> -> 49 - Λ<;> -> 85 + Λ<|> -> 48 + Λ<;> -> 84 S34{ @@ -1363,8 +1354,8 @@ S34{ Alternatives : Π •Λ<|> Π «"|"» } Transitions: - Λ<;> -> 86 - Λ<|> -> 87 + Λ<;> -> 85 + Λ<|> -> 86 S35{ @@ -1381,7 +1372,6 @@ S36{ Symbols : Π •Π «g_sdt_lit» SyntaxBody : Π• «"|"» SyntaxBody : Π •g_sdt_lit «"|"» - Symbols : Π •Π «"@"» Symbols : Π •Π «prodId» Symbols : Π •Π «string_lit» Symbols : Π •Π «tokId» @@ -1389,39 +1379,34 @@ S36{ Symbol : •prodId «";"» Symbol : •tokId «";"» Symbol : •string_lit «";"» - Symbol : •Λ<@> tokId «";"» + Symbol : •tokId g_ctxdep_lit «";"» Symbol : •prodId «g_sdt_lit» Symbol : •tokId «g_sdt_lit» Symbol : •string_lit «g_sdt_lit» - Symbol : •Λ<@> tokId «g_sdt_lit» - Symbol : •prodId «"@"» - Symbol : •tokId «"@"» - Symbol : •string_lit «"@"» - Symbol : •Λ<@> tokId «"@"» + Symbol : •tokId g_ctxdep_lit «g_sdt_lit» Symbol : •prodId «prodId» Symbol : •tokId «prodId» Symbol : •string_lit «prodId» - Symbol : •Λ<@> tokId «prodId» + Symbol : •tokId g_ctxdep_lit «prodId» Symbol : •prodId «string_lit» Symbol : •tokId «string_lit» Symbol : •string_lit «string_lit» - Symbol : •Λ<@> tokId «string_lit» + Symbol : •tokId g_ctxdep_lit «string_lit» Symbol : •prodId «tokId» Symbol : •tokId «tokId» Symbol : •string_lit «tokId» - Symbol : •Λ<@> tokId «tokId» + Symbol : •tokId g_ctxdep_lit «tokId» Symbol : •prodId «"|"» Symbol : •tokId «"|"» Symbol : •string_lit «"|"» - Symbol : •Λ<@> tokId «"|"» + Symbol : •tokId g_ctxdep_lit «"|"» } Transitions: tokId -> 40 prodId -> 41 string_lit -> 42 - Λ<@> -> 43 - Π -> 88 - g_sdt_lit -> 89 + Π -> 87 + g_sdt_lit -> 88 S37{ @@ -1442,48 +1427,41 @@ S37{ Symbol : •prodId «";"» Symbol : •tokId «";"» Symbol : •string_lit «";"» - Symbol : •Λ<@> tokId «";"» - Symbols : •Π «"@"» + Symbol : •tokId g_ctxdep_lit «";"» Symbols : •Π «prodId» Symbols : •Π «string_lit» Symbols : •Π «tokId» - Symbols : •Π Π «"@"» Symbols : •Π Π «prodId» Symbols : •Π Π «string_lit» Symbols : •Π Π «tokId» Symbol : •prodId «g_sdt_lit» Symbol : •tokId «g_sdt_lit» Symbol : •string_lit «g_sdt_lit» - Symbol : •Λ<@> tokId «g_sdt_lit» + Symbol : •tokId g_ctxdep_lit «g_sdt_lit» Symbol : •prodId «"|"» Symbol : •tokId «"|"» Symbol : •string_lit «"|"» - Symbol : •Λ<@> tokId «"|"» - Symbol : •prodId «"@"» - Symbol : •tokId «"@"» - Symbol : •string_lit «"@"» - Symbol : •Λ<@> tokId «"@"» + Symbol : •tokId g_ctxdep_lit «"|"» Symbol : •prodId «prodId» Symbol : •tokId «prodId» Symbol : •string_lit «prodId» - Symbol : •Λ<@> tokId «prodId» + Symbol : •tokId g_ctxdep_lit «prodId» Symbol : •prodId «string_lit» Symbol : •tokId «string_lit» Symbol : •string_lit «string_lit» - Symbol : •Λ<@> tokId «string_lit» + Symbol : •tokId g_ctxdep_lit «string_lit» Symbol : •prodId «tokId» Symbol : •tokId «tokId» Symbol : •string_lit «tokId» - Symbol : •Λ<@> tokId «tokId» + Symbol : •tokId g_ctxdep_lit «tokId» } Transitions: Π -> 39 tokId -> 40 prodId -> 41 string_lit -> 42 - Λ<@> -> 43 - Π -> 90 - g_sdt_lit -> 91 + Π -> 89 + g_sdt_lit -> 90 S38{ @@ -1496,7 +1474,6 @@ Transitions: S39{ Symbols : Π• «";"» Symbols : Π• «g_sdt_lit» - Symbols : Π• «"@"» Symbols : Π• «prodId» Symbols : Π• «string_lit» Symbols : Π• «tokId» @@ -1507,20 +1484,25 @@ Transitions: S40{ Symbol : tokId• «";"» + Symbol : tokId •g_ctxdep_lit «";"» Symbol : tokId• «g_sdt_lit» - Symbol : tokId• «"@"» + Symbol : tokId •g_ctxdep_lit «g_sdt_lit» Symbol : tokId• «prodId» + Symbol : tokId •g_ctxdep_lit «prodId» Symbol : tokId• «string_lit» + Symbol : tokId •g_ctxdep_lit «string_lit» Symbol : tokId• «tokId» + Symbol : tokId •g_ctxdep_lit «tokId» Symbol : tokId• «"|"» + Symbol : tokId •g_ctxdep_lit «"|"» } Transitions: + g_ctxdep_lit -> 91 S41{ Symbol : prodId• «";"» Symbol : prodId• «g_sdt_lit» - Symbol : prodId• «"@"» Symbol : prodId• «prodId» Symbol : prodId• «string_lit» Symbol : prodId• «tokId» @@ -1532,7 +1514,6 @@ Transitions: S42{ Symbol : string_lit• «";"» Symbol : string_lit• «g_sdt_lit» - Symbol : string_lit• «"@"» Symbol : string_lit• «prodId» Symbol : string_lit• «string_lit» Symbol : string_lit• «tokId» @@ -1542,21 +1523,7 @@ Transitions: S43{ - Symbol : Λ<@> •tokId «";"» - Symbol : Λ<@> •tokId «g_sdt_lit» - Symbol : Λ<@> •tokId «"@"» - Symbol : Λ<@> •tokId «prodId» - Symbol : Λ<@> •tokId «string_lit» - Symbol : Λ<@> •tokId «tokId» - Symbol : Λ<@> •tokId «"|"» -} -Transitions: - tokId -> 92 - - -S44{ ErrorSymbol : Λ• «";"» - ErrorSymbol : Λ• «"@"» ErrorSymbol : Λ• «prodId» ErrorSymbol : Λ• «string_lit» ErrorSymbol : Λ• «tokId» @@ -1566,9 +1533,8 @@ S44{ Transitions: -S45{ +S44{ ErrorSymbol : Λ<λ>• «";"» - ErrorSymbol : Λ<λ>• «"@"» ErrorSymbol : Λ<λ>• «prodId» ErrorSymbol : Λ<λ>• «string_lit» ErrorSymbol : Λ<λ>• «tokId» @@ -1578,21 +1544,21 @@ S45{ Transitions: -S46{ +S45{ EpsilonSymbol : Λ• «";"» EpsilonSymbol : Λ• «"|"» } Transitions: -S47{ +S46{ EpsilonSymbol : Λ<ε>• «";"» EpsilonSymbol : Λ<ε>• «"|"» } Transitions: -S48{ +S47{ LexProduction : tokId Λ<:> Π Λ<;>• «g_sdt_lit» LexProduction : tokId Λ<:> Π Λ<;>• «prodId» LexProduction : tokId Λ<:> Π Λ<;>• «Ω» @@ -1603,7 +1569,7 @@ S48{ Transitions: -S49{ +S48{ LexPattern : Π Λ<|> •Π «";"» LexPattern : Π Λ<|> •Π «"|"» LexAlt : •Π «";"» @@ -1715,10 +1681,10 @@ Transitions: Λ<(> -> 29 Λ<[> -> 30 Λ<{> -> 31 - Π -> 93 + Π -> 92 -S50{ +S49{ LexAlt : Π Π• «";"» LexAlt : Π Π• «"("» LexAlt : Π Π• «"."» @@ -1732,7 +1698,7 @@ S50{ Transitions: -S51{ +S50{ LexTerm : char_lit Λ<-> •char_lit «";"» LexTerm : char_lit Λ<-> •char_lit «"("» LexTerm : char_lit Λ<-> •char_lit «"."» @@ -1744,10 +1710,10 @@ S51{ LexTerm : char_lit Λ<-> •char_lit «"|"» } Transitions: - char_lit -> 94 + char_lit -> 93 -S52{ +S51{ LexTerm : Λ<~> char_lit• «";"» LexTerm : Λ<~> char_lit• «"("» LexTerm : Λ<~> char_lit• «"."» @@ -1761,7 +1727,7 @@ S52{ Transitions: -S53{ +S52{ LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «";"» LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «"("» LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «"."» @@ -1773,10 +1739,10 @@ S53{ LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «"|"» } Transitions: - char_lit -> 95 + char_lit -> 94 -S54{ +S53{ LexTerm : Λ<(> Π •Λ<)> «";"» LexTerm : Λ<(> Π •Λ<)> «"("» LexTerm : Λ<(> Π •Λ<)> «"."» @@ -1790,11 +1756,11 @@ S54{ LexPattern : Π •Λ<|> Π «"|"» } Transitions: - Λ<|> -> 96 - Λ<)> -> 97 + Λ<|> -> 95 + Λ<)> -> 96 -S55{ +S54{ LexPattern : Π• «")"» LexAlt : Π •Π «")"» LexPattern : Π• «"|"» @@ -1889,17 +1855,17 @@ S55{ LexTerm : •Λ<(> Π Λ<)> «"|"» } Transitions: - regDefId -> 57 - Λ<.> -> 58 - char_lit -> 59 - Λ<~> -> 60 - Λ<(> -> 61 - Λ<[> -> 62 - Λ<{> -> 63 - Π -> 98 + regDefId -> 56 + Λ<.> -> 57 + char_lit -> 58 + Λ<~> -> 59 + Λ<(> -> 60 + Λ<[> -> 61 + Λ<{> -> 62 + Π -> 97 -S56{ +S55{ LexAlt : Π• «")"» LexAlt : Π• «"("» LexAlt : Π• «"."» @@ -1913,7 +1879,7 @@ S56{ Transitions: -S57{ +S56{ LexTerm : regDefId• «")"» LexTerm : regDefId• «"("» LexTerm : regDefId• «"."» @@ -1927,7 +1893,7 @@ S57{ Transitions: -S58{ +S57{ LexTerm : Λ<.>• «")"» LexTerm : Λ<.>• «"("» LexTerm : Λ<.>• «"."» @@ -1941,7 +1907,7 @@ S58{ Transitions: -S59{ +S58{ LexTerm : char_lit• «")"» LexTerm : char_lit •Λ<-> char_lit «")"» LexTerm : char_lit• «"("» @@ -1962,10 +1928,10 @@ S59{ LexTerm : char_lit •Λ<-> char_lit «"|"» } Transitions: - Λ<-> -> 99 + Λ<-> -> 98 -S60{ +S59{ LexTerm : Λ<~> •char_lit «")"» LexTerm : Λ<~> •Λ<(> char_lit Λ<-> char_lit Λ<)> «")"» LexTerm : Λ<~> •char_lit «"("» @@ -1986,11 +1952,11 @@ S60{ LexTerm : Λ<~> •Λ<(> char_lit Λ<-> char_lit Λ<)> «"|"» } Transitions: - char_lit -> 100 - Λ<(> -> 101 + char_lit -> 99 + Λ<(> -> 100 -S61{ +S60{ LexTerm : Λ<(> •Π Λ<)> «")"» LexTerm : Λ<(> •Π Λ<)> «"("» LexTerm : Λ<(> •Π Λ<)> «"."» @@ -2105,19 +2071,19 @@ S61{ LexTerm : •Λ<(> Π Λ<)> «"|"» } Transitions: - Π -> 55 - Π -> 56 - regDefId -> 57 - Λ<.> -> 58 - char_lit -> 59 - Λ<~> -> 60 - Λ<(> -> 61 - Λ<[> -> 62 - Λ<{> -> 63 - Π -> 102 + Π -> 54 + Π -> 55 + regDefId -> 56 + Λ<.> -> 57 + char_lit -> 58 + Λ<~> -> 59 + Λ<(> -> 60 + Λ<[> -> 61 + Λ<{> -> 62 + Π -> 101 -S62{ +S61{ LexTerm : Λ<[> •Π Λ<]> «")"» LexTerm : Λ<[> •Π Λ<]> «"("» LexTerm : Λ<[> •Π Λ<]> «"."» @@ -2232,19 +2198,19 @@ S62{ LexTerm : •Λ<(> Π Λ<)> «"|"» } Transitions: - Π -> 65 - Π -> 66 - regDefId -> 67 - Λ<.> -> 68 - char_lit -> 69 - Λ<~> -> 70 - Λ<(> -> 71 - Λ<[> -> 72 - Λ<{> -> 73 - Π -> 103 + Π -> 64 + Π -> 65 + regDefId -> 66 + Λ<.> -> 67 + char_lit -> 68 + Λ<~> -> 69 + Λ<(> -> 70 + Λ<[> -> 71 + Λ<{> -> 72 + Π -> 102 -S63{ +S62{ LexTerm : Λ<{> •Π Λ<}> «")"» LexTerm : Λ<{> •Π Λ<}> «"("» LexTerm : Λ<{> •Π Λ<}> «"."» @@ -2359,19 +2325,19 @@ S63{ LexTerm : •Λ<(> Π Λ<)> «"|"» } Transitions: - Π -> 75 - Π -> 76 - regDefId -> 77 - Λ<.> -> 78 - char_lit -> 79 - Λ<~> -> 80 - Λ<(> -> 81 - Λ<[> -> 82 - Λ<{> -> 83 - Π -> 104 + Π -> 74 + Π -> 75 + regDefId -> 76 + Λ<.> -> 77 + char_lit -> 78 + Λ<~> -> 79 + Λ<(> -> 80 + Λ<[> -> 81 + Λ<{> -> 82 + Π -> 103 -S64{ +S63{ LexTerm : Λ<[> Π •Λ<]> «";"» LexTerm : Λ<[> Π •Λ<]> «"("» LexTerm : Λ<[> Π •Λ<]> «"."» @@ -2385,11 +2351,11 @@ S64{ LexPattern : Π •Λ<|> Π «"|"» } Transitions: - Λ<|> -> 105 - Λ<]> -> 106 + Λ<|> -> 104 + Λ<]> -> 105 -S65{ +S64{ LexPattern : Π• «"]"» LexAlt : Π •Π «"]"» LexPattern : Π• «"|"» @@ -2484,17 +2450,17 @@ S65{ LexTerm : •Λ<(> Π Λ<)> «"|"» } Transitions: - regDefId -> 67 - Λ<.> -> 68 - char_lit -> 69 - Λ<~> -> 70 - Λ<(> -> 71 - Λ<[> -> 72 - Λ<{> -> 73 - Π -> 107 + regDefId -> 66 + Λ<.> -> 67 + char_lit -> 68 + Λ<~> -> 69 + Λ<(> -> 70 + Λ<[> -> 71 + Λ<{> -> 72 + Π -> 106 -S66{ +S65{ LexAlt : Π• «"]"» LexAlt : Π• «"("» LexAlt : Π• «"."» @@ -2508,7 +2474,7 @@ S66{ Transitions: -S67{ +S66{ LexTerm : regDefId• «"]"» LexTerm : regDefId• «"("» LexTerm : regDefId• «"."» @@ -2522,7 +2488,7 @@ S67{ Transitions: -S68{ +S67{ LexTerm : Λ<.>• «"]"» LexTerm : Λ<.>• «"("» LexTerm : Λ<.>• «"."» @@ -2536,7 +2502,7 @@ S68{ Transitions: -S69{ +S68{ LexTerm : char_lit• «"]"» LexTerm : char_lit •Λ<-> char_lit «"]"» LexTerm : char_lit• «"("» @@ -2557,10 +2523,10 @@ S69{ LexTerm : char_lit •Λ<-> char_lit «"|"» } Transitions: - Λ<-> -> 108 + Λ<-> -> 107 -S70{ +S69{ LexTerm : Λ<~> •char_lit «"]"» LexTerm : Λ<~> •Λ<(> char_lit Λ<-> char_lit Λ<)> «"]"» LexTerm : Λ<~> •char_lit «"("» @@ -2581,11 +2547,11 @@ S70{ LexTerm : Λ<~> •Λ<(> char_lit Λ<-> char_lit Λ<)> «"|"» } Transitions: - char_lit -> 109 - Λ<(> -> 110 + char_lit -> 108 + Λ<(> -> 109 -S71{ +S70{ LexTerm : Λ<(> •Π Λ<)> «"]"» LexTerm : Λ<(> •Π Λ<)> «"("» LexTerm : Λ<(> •Π Λ<)> «"."» @@ -2700,19 +2666,19 @@ S71{ LexTerm : •Λ<(> Π Λ<)> «"|"» } Transitions: - Π -> 55 - Π -> 56 - regDefId -> 57 - Λ<.> -> 58 - char_lit -> 59 - Λ<~> -> 60 - Λ<(> -> 61 - Λ<[> -> 62 - Λ<{> -> 63 - Π -> 111 + Π -> 54 + Π -> 55 + regDefId -> 56 + Λ<.> -> 57 + char_lit -> 58 + Λ<~> -> 59 + Λ<(> -> 60 + Λ<[> -> 61 + Λ<{> -> 62 + Π -> 110 -S72{ +S71{ LexTerm : Λ<[> •Π Λ<]> «"]"» LexTerm : Λ<[> •Π Λ<]> «"("» LexTerm : Λ<[> •Π Λ<]> «"."» @@ -2827,19 +2793,19 @@ S72{ LexTerm : •Λ<(> Π Λ<)> «"|"» } Transitions: - Π -> 65 - Π -> 66 - regDefId -> 67 - Λ<.> -> 68 - char_lit -> 69 - Λ<~> -> 70 - Λ<(> -> 71 - Λ<[> -> 72 - Λ<{> -> 73 - Π -> 112 + Π -> 64 + Π -> 65 + regDefId -> 66 + Λ<.> -> 67 + char_lit -> 68 + Λ<~> -> 69 + Λ<(> -> 70 + Λ<[> -> 71 + Λ<{> -> 72 + Π -> 111 -S73{ +S72{ LexTerm : Λ<{> •Π Λ<}> «"]"» LexTerm : Λ<{> •Π Λ<}> «"("» LexTerm : Λ<{> •Π Λ<}> «"."» @@ -2954,19 +2920,19 @@ S73{ LexTerm : •Λ<(> Π Λ<)> «"|"» } Transitions: - Π -> 75 - Π -> 76 - regDefId -> 77 - Λ<.> -> 78 - char_lit -> 79 - Λ<~> -> 80 - Λ<(> -> 81 - Λ<[> -> 82 - Λ<{> -> 83 - Π -> 113 + Π -> 74 + Π -> 75 + regDefId -> 76 + Λ<.> -> 77 + char_lit -> 78 + Λ<~> -> 79 + Λ<(> -> 80 + Λ<[> -> 81 + Λ<{> -> 82 + Π -> 112 -S74{ +S73{ LexTerm : Λ<{> Π •Λ<}> «";"» LexTerm : Λ<{> Π •Λ<}> «"("» LexTerm : Λ<{> Π •Λ<}> «"."» @@ -2980,11 +2946,11 @@ S74{ LexPattern : Π •Λ<|> Π «"|"» } Transitions: - Λ<|> -> 114 - Λ<}> -> 115 + Λ<|> -> 113 + Λ<}> -> 114 -S75{ +S74{ LexPattern : Π• «"}"» LexAlt : Π •Π «"}"» LexPattern : Π• «"|"» @@ -3079,17 +3045,17 @@ S75{ LexTerm : •Λ<(> Π Λ<)> «"|"» } Transitions: - regDefId -> 77 - Λ<.> -> 78 - char_lit -> 79 - Λ<~> -> 80 - Λ<(> -> 81 - Λ<[> -> 82 - Λ<{> -> 83 - Π -> 116 + regDefId -> 76 + Λ<.> -> 77 + char_lit -> 78 + Λ<~> -> 79 + Λ<(> -> 80 + Λ<[> -> 81 + Λ<{> -> 82 + Π -> 115 -S76{ +S75{ LexAlt : Π• «"}"» LexAlt : Π• «"("» LexAlt : Π• «"."» @@ -3103,7 +3069,7 @@ S76{ Transitions: -S77{ +S76{ LexTerm : regDefId• «"}"» LexTerm : regDefId• «"("» LexTerm : regDefId• «"."» @@ -3117,7 +3083,7 @@ S77{ Transitions: -S78{ +S77{ LexTerm : Λ<.>• «"}"» LexTerm : Λ<.>• «"("» LexTerm : Λ<.>• «"."» @@ -3131,7 +3097,7 @@ S78{ Transitions: -S79{ +S78{ LexTerm : char_lit• «"}"» LexTerm : char_lit •Λ<-> char_lit «"}"» LexTerm : char_lit• «"("» @@ -3152,10 +3118,10 @@ S79{ LexTerm : char_lit •Λ<-> char_lit «"|"» } Transitions: - Λ<-> -> 117 + Λ<-> -> 116 -S80{ +S79{ LexTerm : Λ<~> •char_lit «"}"» LexTerm : Λ<~> •Λ<(> char_lit Λ<-> char_lit Λ<)> «"}"» LexTerm : Λ<~> •char_lit «"("» @@ -3176,11 +3142,11 @@ S80{ LexTerm : Λ<~> •Λ<(> char_lit Λ<-> char_lit Λ<)> «"|"» } Transitions: - char_lit -> 118 - Λ<(> -> 119 + char_lit -> 117 + Λ<(> -> 118 -S81{ +S80{ LexTerm : Λ<(> •Π Λ<)> «"}"» LexTerm : Λ<(> •Π Λ<)> «"("» LexTerm : Λ<(> •Π Λ<)> «"."» @@ -3295,19 +3261,19 @@ S81{ LexTerm : •Λ<(> Π Λ<)> «"|"» } Transitions: - Π -> 55 - Π -> 56 - regDefId -> 57 - Λ<.> -> 58 - char_lit -> 59 - Λ<~> -> 60 - Λ<(> -> 61 - Λ<[> -> 62 - Λ<{> -> 63 - Π -> 120 + Π -> 54 + Π -> 55 + regDefId -> 56 + Λ<.> -> 57 + char_lit -> 58 + Λ<~> -> 59 + Λ<(> -> 60 + Λ<[> -> 61 + Λ<{> -> 62 + Π -> 119 -S82{ +S81{ LexTerm : Λ<[> •Π Λ<]> «"}"» LexTerm : Λ<[> •Π Λ<]> «"("» LexTerm : Λ<[> •Π Λ<]> «"."» @@ -3422,19 +3388,19 @@ S82{ LexTerm : •Λ<(> Π Λ<)> «"|"» } Transitions: - Π -> 65 - Π -> 66 - regDefId -> 67 - Λ<.> -> 68 - char_lit -> 69 - Λ<~> -> 70 - Λ<(> -> 71 - Λ<[> -> 72 - Λ<{> -> 73 - Π -> 121 + Π -> 64 + Π -> 65 + regDefId -> 66 + Λ<.> -> 67 + char_lit -> 68 + Λ<~> -> 69 + Λ<(> -> 70 + Λ<[> -> 71 + Λ<{> -> 72 + Π -> 120 -S83{ +S82{ LexTerm : Λ<{> •Π Λ<}> «"}"» LexTerm : Λ<{> •Π Λ<}> «"("» LexTerm : Λ<{> •Π Λ<}> «"."» @@ -3549,19 +3515,19 @@ S83{ LexTerm : •Λ<(> Π Λ<)> «"|"» } Transitions: - Π -> 75 - Π -> 76 - regDefId -> 77 - Λ<.> -> 78 - char_lit -> 79 - Λ<~> -> 80 - Λ<(> -> 81 - Λ<[> -> 82 - Λ<{> -> 83 - Π -> 122 + Π -> 74 + Π -> 75 + regDefId -> 76 + Λ<.> -> 77 + char_lit -> 78 + Λ<~> -> 79 + Λ<(> -> 80 + Λ<[> -> 81 + Λ<{> -> 82 + Π -> 121 -S84{ +S83{ LexProduction : regDefId Λ<:> Π Λ<;>• «g_sdt_lit» LexProduction : regDefId Λ<:> Π Λ<;>• «prodId» LexProduction : regDefId Λ<:> Π Λ<;>• «Ω» @@ -3572,7 +3538,7 @@ S84{ Transitions: -S85{ +S84{ LexProduction : ignoredTokId Λ<:> Π Λ<;>• «g_sdt_lit» LexProduction : ignoredTokId Λ<:> Π Λ<;>• «prodId» LexProduction : ignoredTokId Λ<:> Π Λ<;>• «Ω» @@ -3583,14 +3549,14 @@ S85{ Transitions: -S86{ +S85{ SyntaxProduction : prodId Λ<:> Π Λ<;>• «Ω» SyntaxProduction : prodId Λ<:> Π Λ<;>• «prodId» } Transitions: -S87{ +S86{ Alternatives : Π Λ<|> •Π «";"» Alternatives : Π Λ<|> •Π «"|"» SyntaxBody : •Π «";"» @@ -3613,11 +3579,9 @@ S87{ Symbols : •Π Π «g_sdt_lit» ErrorSymbol : •Λ «";"» ErrorSymbol : •Λ<λ> «";"» - ErrorSymbol : •Λ «"@"» ErrorSymbol : •Λ «prodId» ErrorSymbol : •Λ «string_lit» ErrorSymbol : •Λ «tokId» - ErrorSymbol : •Λ<λ> «"@"» ErrorSymbol : •Λ<λ> «prodId» ErrorSymbol : •Λ<λ> «string_lit» ErrorSymbol : •Λ<λ> «tokId» @@ -3634,39 +3598,33 @@ S87{ Symbol : •prodId «";"» Symbol : •tokId «";"» Symbol : •string_lit «";"» - Symbol : •Λ<@> tokId «";"» - Symbols : •Π «"@"» + Symbol : •tokId g_ctxdep_lit «";"» Symbols : •Π «prodId» Symbols : •Π «string_lit» Symbols : •Π «tokId» - Symbols : •Π Π «"@"» Symbols : •Π Π «prodId» Symbols : •Π Π «string_lit» Symbols : •Π Π «tokId» Symbol : •prodId «g_sdt_lit» Symbol : •tokId «g_sdt_lit» Symbol : •string_lit «g_sdt_lit» - Symbol : •Λ<@> tokId «g_sdt_lit» + Symbol : •tokId g_ctxdep_lit «g_sdt_lit» Symbol : •prodId «"|"» Symbol : •tokId «"|"» Symbol : •string_lit «"|"» - Symbol : •Λ<@> tokId «"|"» - Symbol : •prodId «"@"» - Symbol : •tokId «"@"» - Symbol : •string_lit «"@"» - Symbol : •Λ<@> tokId «"@"» + Symbol : •tokId g_ctxdep_lit «"|"» Symbol : •prodId «prodId» Symbol : •tokId «prodId» Symbol : •string_lit «prodId» - Symbol : •Λ<@> tokId «prodId» + Symbol : •tokId g_ctxdep_lit «prodId» Symbol : •prodId «string_lit» Symbol : •tokId «string_lit» Symbol : •string_lit «string_lit» - Symbol : •Λ<@> tokId «string_lit» + Symbol : •tokId g_ctxdep_lit «string_lit» Symbol : •prodId «tokId» Symbol : •tokId «tokId» Symbol : •string_lit «tokId» - Symbol : •Λ<@> tokId «tokId» + Symbol : •tokId g_ctxdep_lit «tokId» } Transitions: Π -> 36 @@ -3676,18 +3634,16 @@ Transitions: tokId -> 40 prodId -> 41 string_lit -> 42 - Λ<@> -> 43 - Λ -> 44 - Λ<λ> -> 45 - Λ -> 46 - Λ<ε> -> 47 - Π -> 123 + Λ -> 43 + Λ<λ> -> 44 + Λ -> 45 + Λ<ε> -> 46 + Π -> 122 -S88{ +S87{ Symbols : Π Π• «";"» Symbols : Π Π• «g_sdt_lit» - Symbols : Π Π• «"@"» Symbols : Π Π• «prodId» Symbols : Π Π• «string_lit» Symbols : Π Π• «tokId» @@ -3696,14 +3652,14 @@ S88{ Transitions: -S89{ +S88{ SyntaxBody : Π g_sdt_lit• «";"» SyntaxBody : Π g_sdt_lit• «"|"» } Transitions: -S90{ +S89{ SyntaxBody : Π Π• «";"» SyntaxBody : Π Π •g_sdt_lit «";"» SyntaxBody : Π Π• «"|"» @@ -3711,68 +3667,61 @@ S90{ Symbols : Π •Π «";"» Symbols : Π •Π «g_sdt_lit» Symbols : Π •Π «"|"» - Symbols : Π •Π «"@"» Symbols : Π •Π «prodId» Symbols : Π •Π «string_lit» Symbols : Π •Π «tokId» Symbol : •prodId «";"» Symbol : •tokId «";"» Symbol : •string_lit «";"» - Symbol : •Λ<@> tokId «";"» + Symbol : •tokId g_ctxdep_lit «";"» Symbol : •prodId «g_sdt_lit» Symbol : •tokId «g_sdt_lit» Symbol : •string_lit «g_sdt_lit» - Symbol : •Λ<@> tokId «g_sdt_lit» + Symbol : •tokId g_ctxdep_lit «g_sdt_lit» Symbol : •prodId «"|"» Symbol : •tokId «"|"» Symbol : •string_lit «"|"» - Symbol : •Λ<@> tokId «"|"» - Symbol : •prodId «"@"» - Symbol : •tokId «"@"» - Symbol : •string_lit «"@"» - Symbol : •Λ<@> tokId «"@"» + Symbol : •tokId g_ctxdep_lit «"|"» Symbol : •prodId «prodId» Symbol : •tokId «prodId» Symbol : •string_lit «prodId» - Symbol : •Λ<@> tokId «prodId» + Symbol : •tokId g_ctxdep_lit «prodId» Symbol : •prodId «string_lit» Symbol : •tokId «string_lit» Symbol : •string_lit «string_lit» - Symbol : •Λ<@> tokId «string_lit» + Symbol : •tokId g_ctxdep_lit «string_lit» Symbol : •prodId «tokId» Symbol : •tokId «tokId» Symbol : •string_lit «tokId» - Symbol : •Λ<@> tokId «tokId» + Symbol : •tokId g_ctxdep_lit «tokId» } Transitions: tokId -> 40 prodId -> 41 string_lit -> 42 - Λ<@> -> 43 - Π -> 88 - g_sdt_lit -> 124 + Π -> 87 + g_sdt_lit -> 123 -S91{ +S90{ SyntaxBody : Π g_sdt_lit• «";"» SyntaxBody : Π g_sdt_lit• «"|"» } Transitions: -S92{ - Symbol : Λ<@> tokId• «";"» - Symbol : Λ<@> tokId• «g_sdt_lit» - Symbol : Λ<@> tokId• «"@"» - Symbol : Λ<@> tokId• «prodId» - Symbol : Λ<@> tokId• «string_lit» - Symbol : Λ<@> tokId• «tokId» - Symbol : Λ<@> tokId• «"|"» +S91{ + Symbol : tokId g_ctxdep_lit• «";"» + Symbol : tokId g_ctxdep_lit• «g_sdt_lit» + Symbol : tokId g_ctxdep_lit• «prodId» + Symbol : tokId g_ctxdep_lit• «string_lit» + Symbol : tokId g_ctxdep_lit• «tokId» + Symbol : tokId g_ctxdep_lit• «"|"» } Transitions: -S93{ +S92{ LexPattern : Π Λ<|> Π• «";"» LexPattern : Π Λ<|> Π• «"|"» LexAlt : Π •Π «";"» @@ -3874,10 +3823,10 @@ Transitions: Λ<(> -> 29 Λ<[> -> 30 Λ<{> -> 31 - Π -> 50 + Π -> 49 -S94{ +S93{ LexTerm : char_lit Λ<-> char_lit• «";"» LexTerm : char_lit Λ<-> char_lit• «"("» LexTerm : char_lit Λ<-> char_lit• «"."» @@ -3891,7 +3840,7 @@ S94{ Transitions: -S95{ +S94{ LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «";"» LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «"("» LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «"."» @@ -3903,10 +3852,10 @@ S95{ LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «"|"» } Transitions: - Λ<-> -> 125 + Λ<-> -> 124 -S96{ +S95{ LexPattern : Π Λ<|> •Π «")"» LexPattern : Π Λ<|> •Π «"|"» LexAlt : •Π «")"» @@ -4010,18 +3959,18 @@ S96{ LexTerm : •Λ<(> Π Λ<)> «"~"» } Transitions: - Π -> 56 - regDefId -> 57 - Λ<.> -> 58 - char_lit -> 59 - Λ<~> -> 60 - Λ<(> -> 61 - Λ<[> -> 62 - Λ<{> -> 63 - Π -> 126 + Π -> 55 + regDefId -> 56 + Λ<.> -> 57 + char_lit -> 58 + Λ<~> -> 59 + Λ<(> -> 60 + Λ<[> -> 61 + Λ<{> -> 62 + Π -> 125 -S97{ +S96{ LexTerm : Λ<(> Π Λ<)>• «";"» LexTerm : Λ<(> Π Λ<)>• «"("» LexTerm : Λ<(> Π Λ<)>• «"."» @@ -4035,7 +3984,7 @@ S97{ Transitions: -S98{ +S97{ LexAlt : Π Π• «")"» LexAlt : Π Π• «"("» LexAlt : Π Π• «"."» @@ -4049,7 +3998,7 @@ S98{ Transitions: -S99{ +S98{ LexTerm : char_lit Λ<-> •char_lit «")"» LexTerm : char_lit Λ<-> •char_lit «"("» LexTerm : char_lit Λ<-> •char_lit «"."» @@ -4061,10 +4010,10 @@ S99{ LexTerm : char_lit Λ<-> •char_lit «"|"» } Transitions: - char_lit -> 127 + char_lit -> 126 -S100{ +S99{ LexTerm : Λ<~> char_lit• «")"» LexTerm : Λ<~> char_lit• «"("» LexTerm : Λ<~> char_lit• «"."» @@ -4078,7 +4027,7 @@ S100{ Transitions: -S101{ +S100{ LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «")"» LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «"("» LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «"."» @@ -4090,10 +4039,10 @@ S101{ LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «"|"» } Transitions: - char_lit -> 128 + char_lit -> 127 -S102{ +S101{ LexTerm : Λ<(> Π •Λ<)> «")"» LexTerm : Λ<(> Π •Λ<)> «"("» LexTerm : Λ<(> Π •Λ<)> «"."» @@ -4107,11 +4056,11 @@ S102{ LexPattern : Π •Λ<|> Π «"|"» } Transitions: - Λ<|> -> 96 - Λ<)> -> 129 + Λ<|> -> 95 + Λ<)> -> 128 -S103{ +S102{ LexTerm : Λ<[> Π •Λ<]> «")"» LexTerm : Λ<[> Π •Λ<]> «"("» LexTerm : Λ<[> Π •Λ<]> «"."» @@ -4125,11 +4074,11 @@ S103{ LexPattern : Π •Λ<|> Π «"|"» } Transitions: - Λ<|> -> 105 - Λ<]> -> 130 + Λ<|> -> 104 + Λ<]> -> 129 -S104{ +S103{ LexTerm : Λ<{> Π •Λ<}> «")"» LexTerm : Λ<{> Π •Λ<}> «"("» LexTerm : Λ<{> Π •Λ<}> «"."» @@ -4143,11 +4092,11 @@ S104{ LexPattern : Π •Λ<|> Π «"|"» } Transitions: - Λ<|> -> 114 - Λ<}> -> 131 + Λ<|> -> 113 + Λ<}> -> 130 -S105{ +S104{ LexPattern : Π Λ<|> •Π «"]"» LexPattern : Π Λ<|> •Π «"|"» LexAlt : •Π «"]"» @@ -4251,18 +4200,18 @@ S105{ LexTerm : •Λ<(> Π Λ<)> «"~"» } Transitions: - Π -> 66 - regDefId -> 67 - Λ<.> -> 68 - char_lit -> 69 - Λ<~> -> 70 - Λ<(> -> 71 - Λ<[> -> 72 - Λ<{> -> 73 - Π -> 132 + Π -> 65 + regDefId -> 66 + Λ<.> -> 67 + char_lit -> 68 + Λ<~> -> 69 + Λ<(> -> 70 + Λ<[> -> 71 + Λ<{> -> 72 + Π -> 131 -S106{ +S105{ LexTerm : Λ<[> Π Λ<]>• «";"» LexTerm : Λ<[> Π Λ<]>• «"("» LexTerm : Λ<[> Π Λ<]>• «"."» @@ -4276,7 +4225,7 @@ S106{ Transitions: -S107{ +S106{ LexAlt : Π Π• «"]"» LexAlt : Π Π• «"("» LexAlt : Π Π• «"."» @@ -4290,7 +4239,7 @@ S107{ Transitions: -S108{ +S107{ LexTerm : char_lit Λ<-> •char_lit «"]"» LexTerm : char_lit Λ<-> •char_lit «"("» LexTerm : char_lit Λ<-> •char_lit «"."» @@ -4302,10 +4251,10 @@ S108{ LexTerm : char_lit Λ<-> •char_lit «"|"» } Transitions: - char_lit -> 133 + char_lit -> 132 -S109{ +S108{ LexTerm : Λ<~> char_lit• «"]"» LexTerm : Λ<~> char_lit• «"("» LexTerm : Λ<~> char_lit• «"."» @@ -4319,7 +4268,7 @@ S109{ Transitions: -S110{ +S109{ LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «"]"» LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «"("» LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «"."» @@ -4331,10 +4280,10 @@ S110{ LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «"|"» } Transitions: - char_lit -> 134 + char_lit -> 133 -S111{ +S110{ LexTerm : Λ<(> Π •Λ<)> «"]"» LexTerm : Λ<(> Π •Λ<)> «"("» LexTerm : Λ<(> Π •Λ<)> «"."» @@ -4348,11 +4297,11 @@ S111{ LexPattern : Π •Λ<|> Π «"|"» } Transitions: - Λ<|> -> 96 - Λ<)> -> 135 + Λ<|> -> 95 + Λ<)> -> 134 -S112{ +S111{ LexTerm : Λ<[> Π •Λ<]> «"]"» LexTerm : Λ<[> Π •Λ<]> «"("» LexTerm : Λ<[> Π •Λ<]> «"."» @@ -4366,11 +4315,11 @@ S112{ LexPattern : Π •Λ<|> Π «"|"» } Transitions: - Λ<|> -> 105 - Λ<]> -> 136 + Λ<|> -> 104 + Λ<]> -> 135 -S113{ +S112{ LexTerm : Λ<{> Π •Λ<}> «"]"» LexTerm : Λ<{> Π •Λ<}> «"("» LexTerm : Λ<{> Π •Λ<}> «"."» @@ -4384,11 +4333,11 @@ S113{ LexPattern : Π •Λ<|> Π «"|"» } Transitions: - Λ<|> -> 114 - Λ<}> -> 137 + Λ<|> -> 113 + Λ<}> -> 136 -S114{ +S113{ LexPattern : Π Λ<|> •Π «"}"» LexPattern : Π Λ<|> •Π «"|"» LexAlt : •Π «"}"» @@ -4492,18 +4441,18 @@ S114{ LexTerm : •Λ<(> Π Λ<)> «"~"» } Transitions: - Π -> 76 - regDefId -> 77 - Λ<.> -> 78 - char_lit -> 79 - Λ<~> -> 80 - Λ<(> -> 81 - Λ<[> -> 82 - Λ<{> -> 83 - Π -> 138 + Π -> 75 + regDefId -> 76 + Λ<.> -> 77 + char_lit -> 78 + Λ<~> -> 79 + Λ<(> -> 80 + Λ<[> -> 81 + Λ<{> -> 82 + Π -> 137 -S115{ +S114{ LexTerm : Λ<{> Π Λ<}>• «";"» LexTerm : Λ<{> Π Λ<}>• «"("» LexTerm : Λ<{> Π Λ<}>• «"."» @@ -4517,7 +4466,7 @@ S115{ Transitions: -S116{ +S115{ LexAlt : Π Π• «"}"» LexAlt : Π Π• «"("» LexAlt : Π Π• «"."» @@ -4531,7 +4480,7 @@ S116{ Transitions: -S117{ +S116{ LexTerm : char_lit Λ<-> •char_lit «"}"» LexTerm : char_lit Λ<-> •char_lit «"("» LexTerm : char_lit Λ<-> •char_lit «"."» @@ -4543,10 +4492,10 @@ S117{ LexTerm : char_lit Λ<-> •char_lit «"|"» } Transitions: - char_lit -> 139 + char_lit -> 138 -S118{ +S117{ LexTerm : Λ<~> char_lit• «"}"» LexTerm : Λ<~> char_lit• «"("» LexTerm : Λ<~> char_lit• «"."» @@ -4560,7 +4509,7 @@ S118{ Transitions: -S119{ +S118{ LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «"}"» LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «"("» LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «"."» @@ -4572,10 +4521,10 @@ S119{ LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «"|"» } Transitions: - char_lit -> 140 + char_lit -> 139 -S120{ +S119{ LexTerm : Λ<(> Π •Λ<)> «"}"» LexTerm : Λ<(> Π •Λ<)> «"("» LexTerm : Λ<(> Π •Λ<)> «"."» @@ -4589,11 +4538,11 @@ S120{ LexPattern : Π •Λ<|> Π «"|"» } Transitions: - Λ<|> -> 96 - Λ<)> -> 141 + Λ<|> -> 95 + Λ<)> -> 140 -S121{ +S120{ LexTerm : Λ<[> Π •Λ<]> «"}"» LexTerm : Λ<[> Π •Λ<]> «"("» LexTerm : Λ<[> Π •Λ<]> «"."» @@ -4607,11 +4556,11 @@ S121{ LexPattern : Π •Λ<|> Π «"|"» } Transitions: - Λ<|> -> 105 - Λ<]> -> 142 + Λ<|> -> 104 + Λ<]> -> 141 -S122{ +S121{ LexTerm : Λ<{> Π •Λ<}> «"}"» LexTerm : Λ<{> Π •Λ<}> «"("» LexTerm : Λ<{> Π •Λ<}> «"."» @@ -4625,25 +4574,25 @@ S122{ LexPattern : Π •Λ<|> Π «"|"» } Transitions: - Λ<|> -> 114 - Λ<}> -> 143 + Λ<|> -> 113 + Λ<}> -> 142 -S123{ +S122{ Alternatives : Π Λ<|> Π• «";"» Alternatives : Π Λ<|> Π• «"|"» } Transitions: -S124{ +S123{ SyntaxBody : Π Π g_sdt_lit• «";"» SyntaxBody : Π Π g_sdt_lit• «"|"» } Transitions: -S125{ +S124{ LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «";"» LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «"("» LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «"."» @@ -4655,10 +4604,10 @@ S125{ LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «"|"» } Transitions: - char_lit -> 144 + char_lit -> 143 -S126{ +S125{ LexPattern : Π Λ<|> Π• «")"» LexPattern : Π Λ<|> Π• «"|"» LexAlt : Π •Π «")"» @@ -4753,17 +4702,17 @@ S126{ LexTerm : •Λ<(> Π Λ<)> «"~"» } Transitions: - regDefId -> 57 - Λ<.> -> 58 - char_lit -> 59 - Λ<~> -> 60 - Λ<(> -> 61 - Λ<[> -> 62 - Λ<{> -> 63 - Π -> 98 + regDefId -> 56 + Λ<.> -> 57 + char_lit -> 58 + Λ<~> -> 59 + Λ<(> -> 60 + Λ<[> -> 61 + Λ<{> -> 62 + Π -> 97 -S127{ +S126{ LexTerm : char_lit Λ<-> char_lit• «")"» LexTerm : char_lit Λ<-> char_lit• «"("» LexTerm : char_lit Λ<-> char_lit• «"."» @@ -4777,7 +4726,7 @@ S127{ Transitions: -S128{ +S127{ LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «")"» LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «"("» LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «"."» @@ -4789,10 +4738,10 @@ S128{ LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «"|"» } Transitions: - Λ<-> -> 145 + Λ<-> -> 144 -S129{ +S128{ LexTerm : Λ<(> Π Λ<)>• «")"» LexTerm : Λ<(> Π Λ<)>• «"("» LexTerm : Λ<(> Π Λ<)>• «"."» @@ -4806,7 +4755,7 @@ S129{ Transitions: -S130{ +S129{ LexTerm : Λ<[> Π Λ<]>• «")"» LexTerm : Λ<[> Π Λ<]>• «"("» LexTerm : Λ<[> Π Λ<]>• «"."» @@ -4820,7 +4769,7 @@ S130{ Transitions: -S131{ +S130{ LexTerm : Λ<{> Π Λ<}>• «")"» LexTerm : Λ<{> Π Λ<}>• «"("» LexTerm : Λ<{> Π Λ<}>• «"."» @@ -4834,7 +4783,7 @@ S131{ Transitions: -S132{ +S131{ LexPattern : Π Λ<|> Π• «"]"» LexPattern : Π Λ<|> Π• «"|"» LexAlt : Π •Π «"]"» @@ -4929,17 +4878,17 @@ S132{ LexTerm : •Λ<(> Π Λ<)> «"~"» } Transitions: - regDefId -> 67 - Λ<.> -> 68 - char_lit -> 69 - Λ<~> -> 70 - Λ<(> -> 71 - Λ<[> -> 72 - Λ<{> -> 73 - Π -> 107 + regDefId -> 66 + Λ<.> -> 67 + char_lit -> 68 + Λ<~> -> 69 + Λ<(> -> 70 + Λ<[> -> 71 + Λ<{> -> 72 + Π -> 106 -S133{ +S132{ LexTerm : char_lit Λ<-> char_lit• «"]"» LexTerm : char_lit Λ<-> char_lit• «"("» LexTerm : char_lit Λ<-> char_lit• «"."» @@ -4953,7 +4902,7 @@ S133{ Transitions: -S134{ +S133{ LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «"]"» LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «"("» LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «"."» @@ -4965,10 +4914,10 @@ S134{ LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «"|"» } Transitions: - Λ<-> -> 146 + Λ<-> -> 145 -S135{ +S134{ LexTerm : Λ<(> Π Λ<)>• «"]"» LexTerm : Λ<(> Π Λ<)>• «"("» LexTerm : Λ<(> Π Λ<)>• «"."» @@ -4982,7 +4931,7 @@ S135{ Transitions: -S136{ +S135{ LexTerm : Λ<[> Π Λ<]>• «"]"» LexTerm : Λ<[> Π Λ<]>• «"("» LexTerm : Λ<[> Π Λ<]>• «"."» @@ -4996,7 +4945,7 @@ S136{ Transitions: -S137{ +S136{ LexTerm : Λ<{> Π Λ<}>• «"]"» LexTerm : Λ<{> Π Λ<}>• «"("» LexTerm : Λ<{> Π Λ<}>• «"."» @@ -5010,7 +4959,7 @@ S137{ Transitions: -S138{ +S137{ LexPattern : Π Λ<|> Π• «"}"» LexPattern : Π Λ<|> Π• «"|"» LexAlt : Π •Π «"}"» @@ -5105,17 +5054,17 @@ S138{ LexTerm : •Λ<(> Π Λ<)> «"~"» } Transitions: - regDefId -> 77 - Λ<.> -> 78 - char_lit -> 79 - Λ<~> -> 80 - Λ<(> -> 81 - Λ<[> -> 82 - Λ<{> -> 83 - Π -> 116 + regDefId -> 76 + Λ<.> -> 77 + char_lit -> 78 + Λ<~> -> 79 + Λ<(> -> 80 + Λ<[> -> 81 + Λ<{> -> 82 + Π -> 115 -S139{ +S138{ LexTerm : char_lit Λ<-> char_lit• «"}"» LexTerm : char_lit Λ<-> char_lit• «"("» LexTerm : char_lit Λ<-> char_lit• «"."» @@ -5129,7 +5078,7 @@ S139{ Transitions: -S140{ +S139{ LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «"}"» LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «"("» LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «"."» @@ -5141,10 +5090,10 @@ S140{ LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «"|"» } Transitions: - Λ<-> -> 147 + Λ<-> -> 146 -S141{ +S140{ LexTerm : Λ<(> Π Λ<)>• «"}"» LexTerm : Λ<(> Π Λ<)>• «"("» LexTerm : Λ<(> Π Λ<)>• «"."» @@ -5158,7 +5107,7 @@ S141{ Transitions: -S142{ +S141{ LexTerm : Λ<[> Π Λ<]>• «"}"» LexTerm : Λ<[> Π Λ<]>• «"("» LexTerm : Λ<[> Π Λ<]>• «"."» @@ -5172,7 +5121,7 @@ S142{ Transitions: -S143{ +S142{ LexTerm : Λ<{> Π Λ<}>• «"}"» LexTerm : Λ<{> Π Λ<}>• «"("» LexTerm : Λ<{> Π Λ<}>• «"."» @@ -5186,7 +5135,7 @@ S143{ Transitions: -S144{ +S143{ LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «";"» LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «"("» LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «"."» @@ -5198,10 +5147,10 @@ S144{ LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «"|"» } Transitions: - Λ<)> -> 148 + Λ<)> -> 147 -S145{ +S144{ LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «")"» LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «"("» LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «"."» @@ -5213,10 +5162,10 @@ S145{ LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «"|"» } Transitions: - char_lit -> 149 + char_lit -> 148 -S146{ +S145{ LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «"]"» LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «"("» LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «"."» @@ -5228,10 +5177,10 @@ S146{ LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «"|"» } Transitions: - char_lit -> 150 + char_lit -> 149 -S147{ +S146{ LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «"}"» LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «"("» LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «"."» @@ -5243,10 +5192,10 @@ S147{ LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «"|"» } Transitions: - char_lit -> 151 + char_lit -> 150 -S148{ +S147{ LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)>• «";"» LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)>• «"("» LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)>• «"."» @@ -5260,7 +5209,7 @@ S148{ Transitions: -S149{ +S148{ LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «")"» LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «"("» LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «"."» @@ -5272,10 +5221,10 @@ S149{ LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «"|"» } Transitions: - Λ<)> -> 152 + Λ<)> -> 151 -S150{ +S149{ LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «"]"» LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «"("» LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «"."» @@ -5287,10 +5236,10 @@ S150{ LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «"|"» } Transitions: - Λ<)> -> 153 + Λ<)> -> 152 -S151{ +S150{ LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «"}"» LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «"("» LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «"."» @@ -5302,10 +5251,10 @@ S151{ LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «"|"» } Transitions: - Λ<)> -> 154 + Λ<)> -> 153 -S152{ +S151{ LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)>• «")"» LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)>• «"("» LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)>• «"."» @@ -5319,7 +5268,7 @@ S152{ Transitions: -S153{ +S152{ LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)>• «"]"» LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)>• «"("» LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)>• «"."» @@ -5333,7 +5282,7 @@ S153{ Transitions: -S154{ +S153{ LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)>• «"}"» LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)>• «"("» LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)>• «"."» diff --git a/internal/frontend/reparsed/log/first.txt b/internal/frontend/reparsed/log/first.txt index 76304b0e..7cb6a40c 100644 --- a/internal/frontend/reparsed/log/first.txt +++ b/internal/frontend/reparsed/log/first.txt @@ -71,7 +71,6 @@ prodId string_lit tokId - Λ<@> Λ Λ Λ<ε> @@ -81,7 +80,6 @@ prodId string_lit tokId - Λ<@> Λ Λ Λ<ε> @@ -91,7 +89,6 @@ prodId string_lit tokId - Λ<@> } Π: { Λ @@ -105,5 +102,4 @@ prodId string_lit tokId - Λ<@> } diff --git a/internal/frontend/reparsed/log/lexer_sets.txt b/internal/frontend/reparsed/log/lexer_sets.txt index 928ef3ec..0fff5787 100644 --- a/internal/frontend/reparsed/log/lexer_sets.txt +++ b/internal/frontend/reparsed/log/lexer_sets.txt @@ -14,6 +14,7 @@ S0{ _tokId : • _lowcase {_id_char} _upcase : • 'A'-'Z' char_lit : • ''' (_unicode_value | _byte_value) ''' + g_ctxdep_lit : • '@' '<' . {.} '>' '@' g_sdt_lit : • '<' '<' . {.} '>' '>' ignoredTokId : • '!' _tokId prodId : • _upcase {_id_char} @@ -27,7 +28,6 @@ S0{ Λ<.> : • '.' Λ<:> : • ':' Λ<;> : • ';' - Λ<@> : • '@' Λ<[> : • '[' Λ<]> : • ']' Λ : • 'e' 'm' 'p' 't' 'y' @@ -198,11 +198,12 @@ Action: nil Symbols classes: {['<','<']} S13{ - Λ<@> : '@' • + g_ctxdep_lit : '@' • '<' . {.} '>' '@' } Transitions: -Action: Accept("Λ<@>") -Symbols classes: {} + ['<','<'] -> S36 +Action: nil +Symbols classes: {['<','<']} S14{ _digit : • '0'-'9' @@ -217,10 +218,10 @@ S14{ prodId : _upcase {• _id_char} } Transitions: - ['0','9'] -> S36 - ['A','Z'] -> S37 - ['_','_'] -> S38 - ['a','z'] -> S39 + ['0','9'] -> S37 + ['A','Z'] -> S38 + ['_','_'] -> S39 + ['a','z'] -> S40 Action: Accept("prodId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} @@ -250,10 +251,10 @@ S17{ regDefId : '_' {• _id_char} } Transitions: - ['0','9'] -> S40 - ['A','Z'] -> S41 - ['_','_'] -> S42 - ['a','z'] -> S43 + ['0','9'] -> S41 + ['A','Z'] -> S42 + ['_','_'] -> S43 + ['a','z'] -> S44 Action: Accept("regDefId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} @@ -263,7 +264,7 @@ S18{ string_lit : • _raw_string | _interpreted_string } Transitions: - ['`','`'] -> S44 + ['`','`'] -> S45 . -> S18 Action: nil Symbols classes: {['`','`']} @@ -283,10 +284,10 @@ S19{ tokId : • _tokId } Transitions: - ['0','9'] -> S45 - ['A','Z'] -> S46 - ['_','_'] -> S47 - ['a','z'] -> S48 + ['0','9'] -> S46 + ['A','Z'] -> S47 + ['_','_'] -> S48 + ['a','z'] -> S49 Action: Accept("tokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} @@ -307,14 +308,14 @@ S20{ Λ : 'e' • 'r' 'r' 'o' 'r' } Transitions: - ['0','9'] -> S45 - ['A','Z'] -> S46 - ['_','_'] -> S47 - ['a','l'] -> S48 - ['m','m'] -> S49 - ['n','q'] -> S48 - ['r','r'] -> S50 - ['s','z'] -> S48 + ['0','9'] -> S46 + ['A','Z'] -> S47 + ['_','_'] -> S48 + ['a','l'] -> S49 + ['m','m'] -> S50 + ['n','q'] -> S49 + ['r','r'] -> S51 + ['s','z'] -> S49 Action: Accept("tokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','l'], ['m','m'], ['n','q'], ['r','r'], ['s','z']} @@ -375,10 +376,10 @@ S27{ ignoredTokId : '!' • _tokId } Transitions: - ['0','9'] -> S51 - ['A','Z'] -> S52 - ['_','_'] -> S53 - ['a','z'] -> S54 + ['0','9'] -> S52 + ['A','Z'] -> S53 + ['_','_'] -> S54 + ['a','z'] -> S55 Action: Accept("ignoredTokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} @@ -416,20 +417,20 @@ S29{ string_lit : _raw_string | • _interpreted_string } Transitions: - ['"','"'] -> S55 - [''','''] -> S55 - ['0','7'] -> S56 - ['U','U'] -> S57 - ['\','\'] -> S55 - ['a','a'] -> S55 - ['b','b'] -> S55 - ['f','f'] -> S55 - ['n','n'] -> S55 - ['r','r'] -> S55 - ['t','t'] -> S55 - ['u','u'] -> S58 - ['v','v'] -> S55 - ['x','x'] -> S59 + ['"','"'] -> S56 + [''','''] -> S56 + ['0','7'] -> S57 + ['U','U'] -> S58 + ['\','\'] -> S56 + ['a','a'] -> S56 + ['b','b'] -> S56 + ['f','f'] -> S56 + ['n','n'] -> S56 + ['r','r'] -> S56 + ['t','t'] -> S56 + ['u','u'] -> S59 + ['v','v'] -> S56 + ['x','x'] -> S60 Action: nil Symbols classes: {['"','"'], [''','''], ['0','7'], ['U','U'], ['\','\'], ['a','a'], ['b','b'], ['f','f'], ['n','n'], ['r','r'], ['t','t'], ['u','u'], ['v','v'], ['x','x']} @@ -483,20 +484,20 @@ S31{ char_lit : ''' (• _unicode_value | _byte_value) ''' } Transitions: - ['"','"'] -> S60 - [''','''] -> S60 - ['0','7'] -> S61 - ['U','U'] -> S62 - ['\','\'] -> S60 - ['a','a'] -> S60 - ['b','b'] -> S60 - ['f','f'] -> S60 - ['n','n'] -> S60 - ['r','r'] -> S60 - ['t','t'] -> S60 - ['u','u'] -> S63 - ['v','v'] -> S60 - ['x','x'] -> S64 + ['"','"'] -> S61 + [''','''] -> S61 + ['0','7'] -> S62 + ['U','U'] -> S63 + ['\','\'] -> S61 + ['a','a'] -> S61 + ['b','b'] -> S61 + ['f','f'] -> S61 + ['n','n'] -> S61 + ['r','r'] -> S61 + ['t','t'] -> S61 + ['u','u'] -> S64 + ['v','v'] -> S61 + ['x','x'] -> S65 Action: nil Symbols classes: {['"','"'], [''','''], ['0','7'], ['U','U'], ['\','\'], ['a','a'], ['b','b'], ['f','f'], ['n','n'], ['r','r'], ['t','t'], ['u','u'], ['v','v'], ['x','x']} @@ -505,7 +506,7 @@ S32{ char_lit : ''' (_unicode_value | _byte_value) • ''' } Transitions: - [''','''] -> S65 + [''','''] -> S66 Action: nil Symbols classes: {[''',''']} @@ -516,7 +517,7 @@ S33{ _blockComment : '/' '*' {• . | '*'} '*' '/' } Transitions: - ['*','*'] -> S66 + ['*','*'] -> S67 . -> S33 Action: nil Symbols classes: {['*','*']} @@ -527,7 +528,7 @@ S34{ _lineComment : '/' '/' {• .} '\n' } Transitions: - ['\n','\n'] -> S67 + ['\n','\n'] -> S68 . -> S34 Action: nil Symbols classes: {['\n','\n']} @@ -536,11 +537,19 @@ S35{ g_sdt_lit : '<' '<' • . {.} '>' '>' } Transitions: -. -> S68 +. -> S69 Action: nil Symbols classes: {} S36{ + g_ctxdep_lit : '@' '<' • . {.} '>' '@' +} +Transitions: +. -> S70 +Action: nil +Symbols classes: {} + +S37{ _digit : '0'-'9' • _digit : • '0'-'9' _id_char : (_upcase | _lowcase | '_' | _digit) • @@ -554,14 +563,14 @@ S36{ prodId : _upcase {• _id_char} } Transitions: - ['0','9'] -> S36 - ['A','Z'] -> S37 - ['_','_'] -> S38 - ['a','z'] -> S39 + ['0','9'] -> S37 + ['A','Z'] -> S38 + ['_','_'] -> S39 + ['a','z'] -> S40 Action: Accept("prodId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} -S37{ +S38{ _digit : • '0'-'9' _id_char : (_upcase | _lowcase | '_' | _digit) • _id_char : _upcase | _lowcase | '_' | • _digit @@ -575,14 +584,14 @@ S37{ prodId : _upcase {• _id_char} } Transitions: - ['0','9'] -> S36 - ['A','Z'] -> S37 - ['_','_'] -> S38 - ['a','z'] -> S39 + ['0','9'] -> S37 + ['A','Z'] -> S38 + ['_','_'] -> S39 + ['a','z'] -> S40 Action: Accept("prodId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} -S38{ +S39{ _digit : • '0'-'9' _id_char : (_upcase | _lowcase | '_' | _digit) • _id_char : _upcase | _lowcase | '_' | • _digit @@ -595,14 +604,14 @@ S38{ prodId : _upcase {• _id_char} } Transitions: - ['0','9'] -> S36 - ['A','Z'] -> S37 - ['_','_'] -> S38 - ['a','z'] -> S39 + ['0','9'] -> S37 + ['A','Z'] -> S38 + ['_','_'] -> S39 + ['a','z'] -> S40 Action: Accept("prodId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} -S39{ +S40{ _digit : • '0'-'9' _id_char : (_upcase | _lowcase | '_' | _digit) • _id_char : _upcase | _lowcase | '_' | • _digit @@ -616,14 +625,14 @@ S39{ prodId : _upcase {• _id_char} } Transitions: - ['0','9'] -> S36 - ['A','Z'] -> S37 - ['_','_'] -> S38 - ['a','z'] -> S39 + ['0','9'] -> S37 + ['A','Z'] -> S38 + ['_','_'] -> S39 + ['a','z'] -> S40 Action: Accept("prodId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} -S40{ +S41{ _digit : '0'-'9' • _digit : • '0'-'9' _id_char : (_upcase | _lowcase | '_' | _digit) • @@ -637,14 +646,14 @@ S40{ regDefId : '_' {• _id_char} } Transitions: - ['0','9'] -> S40 - ['A','Z'] -> S41 - ['_','_'] -> S42 - ['a','z'] -> S43 + ['0','9'] -> S41 + ['A','Z'] -> S42 + ['_','_'] -> S43 + ['a','z'] -> S44 Action: Accept("regDefId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} -S41{ +S42{ _digit : • '0'-'9' _id_char : (_upcase | _lowcase | '_' | _digit) • _id_char : _upcase | _lowcase | '_' | • _digit @@ -658,14 +667,14 @@ S41{ regDefId : '_' {• _id_char} } Transitions: - ['0','9'] -> S40 - ['A','Z'] -> S41 - ['_','_'] -> S42 - ['a','z'] -> S43 + ['0','9'] -> S41 + ['A','Z'] -> S42 + ['_','_'] -> S43 + ['a','z'] -> S44 Action: Accept("regDefId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} -S42{ +S43{ _digit : • '0'-'9' _id_char : (_upcase | _lowcase | '_' | _digit) • _id_char : _upcase | _lowcase | '_' | • _digit @@ -678,14 +687,14 @@ S42{ regDefId : '_' {• _id_char} } Transitions: - ['0','9'] -> S40 - ['A','Z'] -> S41 - ['_','_'] -> S42 - ['a','z'] -> S43 + ['0','9'] -> S41 + ['A','Z'] -> S42 + ['_','_'] -> S43 + ['a','z'] -> S44 Action: Accept("regDefId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} -S43{ +S44{ _digit : • '0'-'9' _id_char : (_upcase | _lowcase | '_' | _digit) • _id_char : _upcase | _lowcase | '_' | • _digit @@ -699,14 +708,14 @@ S43{ regDefId : '_' {• _id_char} } Transitions: - ['0','9'] -> S40 - ['A','Z'] -> S41 - ['_','_'] -> S42 - ['a','z'] -> S43 + ['0','9'] -> S41 + ['A','Z'] -> S42 + ['_','_'] -> S43 + ['a','z'] -> S44 Action: Accept("regDefId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} -S44{ +S45{ _raw_string : '`' {.} '`' • string_lit : (_raw_string | _interpreted_string) • } @@ -714,7 +723,7 @@ Transitions: Action: Accept("string_lit") Symbols classes: {} -S45{ +S46{ _digit : '0'-'9' • _digit : • '0'-'9' _id_char : (_upcase | _lowcase | '_' | _digit) • @@ -730,14 +739,14 @@ S45{ tokId : • _tokId } Transitions: - ['0','9'] -> S45 - ['A','Z'] -> S46 - ['_','_'] -> S47 - ['a','z'] -> S48 + ['0','9'] -> S46 + ['A','Z'] -> S47 + ['_','_'] -> S48 + ['a','z'] -> S49 Action: Accept("tokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} -S46{ +S47{ _digit : • '0'-'9' _id_char : (_upcase | _lowcase | '_' | _digit) • _id_char : _upcase | _lowcase | '_' | • _digit @@ -753,14 +762,14 @@ S46{ tokId : • _tokId } Transitions: - ['0','9'] -> S45 - ['A','Z'] -> S46 - ['_','_'] -> S47 - ['a','z'] -> S48 + ['0','9'] -> S46 + ['A','Z'] -> S47 + ['_','_'] -> S48 + ['a','z'] -> S49 Action: Accept("tokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} -S47{ +S48{ _digit : • '0'-'9' _id_char : (_upcase | _lowcase | '_' | _digit) • _id_char : _upcase | _lowcase | '_' | • _digit @@ -775,14 +784,14 @@ S47{ tokId : • _tokId } Transitions: - ['0','9'] -> S45 - ['A','Z'] -> S46 - ['_','_'] -> S47 - ['a','z'] -> S48 + ['0','9'] -> S46 + ['A','Z'] -> S47 + ['_','_'] -> S48 + ['a','z'] -> S49 Action: Accept("tokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} -S48{ +S49{ _digit : • '0'-'9' _id_char : (_upcase | _lowcase | '_' | _digit) • _id_char : _upcase | _lowcase | '_' | • _digit @@ -798,14 +807,14 @@ S48{ tokId : • _tokId } Transitions: - ['0','9'] -> S45 - ['A','Z'] -> S46 - ['_','_'] -> S47 - ['a','z'] -> S48 + ['0','9'] -> S46 + ['A','Z'] -> S47 + ['_','_'] -> S48 + ['a','z'] -> S49 Action: Accept("tokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} -S49{ +S50{ _digit : • '0'-'9' _id_char : (_upcase | _lowcase | '_' | _digit) • _id_char : _upcase | _lowcase | '_' | • _digit @@ -822,16 +831,16 @@ S49{ Λ : 'e' 'm' • 'p' 't' 'y' } Transitions: - ['0','9'] -> S45 - ['A','Z'] -> S46 - ['_','_'] -> S47 - ['a','o'] -> S48 - ['p','p'] -> S69 - ['q','z'] -> S48 + ['0','9'] -> S46 + ['A','Z'] -> S47 + ['_','_'] -> S48 + ['a','o'] -> S49 + ['p','p'] -> S71 + ['q','z'] -> S49 Action: Accept("tokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','o'], ['p','p'], ['q','z']} -S50{ +S51{ _digit : • '0'-'9' _id_char : (_upcase | _lowcase | '_' | _digit) • _id_char : _upcase | _lowcase | '_' | • _digit @@ -848,16 +857,16 @@ S50{ Λ : 'e' 'r' • 'r' 'o' 'r' } Transitions: - ['0','9'] -> S45 - ['A','Z'] -> S46 - ['_','_'] -> S47 - ['a','q'] -> S48 - ['r','r'] -> S70 - ['s','z'] -> S48 + ['0','9'] -> S46 + ['A','Z'] -> S47 + ['_','_'] -> S48 + ['a','q'] -> S49 + ['r','r'] -> S72 + ['s','z'] -> S49 Action: Accept("tokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','q'], ['r','r'], ['s','z']} -S51{ +S52{ _digit : '0'-'9' • _digit : • '0'-'9' _id_char : (_upcase | _lowcase | '_' | _digit) • @@ -873,14 +882,14 @@ S51{ ignoredTokId : '!' • _tokId } Transitions: - ['0','9'] -> S51 - ['A','Z'] -> S52 - ['_','_'] -> S53 - ['a','z'] -> S54 + ['0','9'] -> S52 + ['A','Z'] -> S53 + ['_','_'] -> S54 + ['a','z'] -> S55 Action: Accept("ignoredTokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} -S52{ +S53{ _digit : • '0'-'9' _id_char : (_upcase | _lowcase | '_' | _digit) • _id_char : _upcase | _lowcase | '_' | • _digit @@ -896,14 +905,14 @@ S52{ ignoredTokId : '!' • _tokId } Transitions: - ['0','9'] -> S51 - ['A','Z'] -> S52 - ['_','_'] -> S53 - ['a','z'] -> S54 + ['0','9'] -> S52 + ['A','Z'] -> S53 + ['_','_'] -> S54 + ['a','z'] -> S55 Action: Accept("ignoredTokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} -S53{ +S54{ _digit : • '0'-'9' _id_char : (_upcase | _lowcase | '_' | _digit) • _id_char : _upcase | _lowcase | '_' | • _digit @@ -918,14 +927,14 @@ S53{ ignoredTokId : '!' • _tokId } Transitions: - ['0','9'] -> S51 - ['A','Z'] -> S52 - ['_','_'] -> S53 - ['a','z'] -> S54 + ['0','9'] -> S52 + ['A','Z'] -> S53 + ['_','_'] -> S54 + ['a','z'] -> S55 Action: Accept("ignoredTokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} -S54{ +S55{ _digit : • '0'-'9' _id_char : (_upcase | _lowcase | '_' | _digit) • _id_char : _upcase | _lowcase | '_' | • _digit @@ -941,14 +950,14 @@ S54{ ignoredTokId : '!' • _tokId } Transitions: - ['0','9'] -> S51 - ['A','Z'] -> S52 - ['_','_'] -> S53 - ['a','z'] -> S54 + ['0','9'] -> S52 + ['A','Z'] -> S53 + ['_','_'] -> S54 + ['a','z'] -> S55 Action: Accept("ignoredTokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} -S55{ +S56{ _big_u_value : • '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _byte_value : _octal_byte_value | • _hex_byte_value _byte_value : • _octal_byte_value | _hex_byte_value @@ -974,7 +983,7 @@ Transitions: Action: nil Symbols classes: {['"','"'], ['\','\']} -S56{ +S57{ _byte_value : • _octal_byte_value | _hex_byte_value _interpreted_string : '"' {_unicode_value | • _byte_value} '"' _octal_byte_value : '\' _octal_digit • _octal_digit _octal_digit @@ -983,11 +992,11 @@ S56{ string_lit : _raw_string | • _interpreted_string } Transitions: - ['0','7'] -> S71 + ['0','7'] -> S73 Action: nil Symbols classes: {['0','7']} -S57{ +S58{ _big_u_value : '\' 'U' • _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' @@ -997,13 +1006,13 @@ S57{ string_lit : _raw_string | • _interpreted_string } Transitions: - ['0','9'] -> S72 - ['A','F'] -> S72 - ['a','f'] -> S72 + ['0','9'] -> S74 + ['A','F'] -> S74 + ['a','f'] -> S74 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S58{ +S59{ _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' @@ -1013,13 +1022,13 @@ S58{ string_lit : _raw_string | • _interpreted_string } Transitions: - ['0','9'] -> S73 - ['A','F'] -> S73 - ['a','f'] -> S73 + ['0','9'] -> S75 + ['A','F'] -> S75 + ['a','f'] -> S75 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S59{ +S60{ _byte_value : _octal_byte_value | • _hex_byte_value _hex_byte_value : '\' 'x' • _hex_digit _hex_digit _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' @@ -1029,23 +1038,23 @@ S59{ string_lit : _raw_string | • _interpreted_string } Transitions: - ['0','9'] -> S74 - ['A','F'] -> S74 - ['a','f'] -> S74 + ['0','9'] -> S76 + ['A','F'] -> S76 + ['a','f'] -> S76 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S60{ +S61{ _escaped_char : '\' ('a' | 'b' | 'f' | 'n' | 'r' | 't' | 'v' | '\' | ''' | '"') • _unicode_value : (. | _little_u_value | _big_u_value | _escaped_char) • char_lit : ''' (_unicode_value | _byte_value) • ''' } Transitions: - [''','''] -> S65 + [''','''] -> S66 Action: nil Symbols classes: {[''',''']} -S61{ +S62{ _byte_value : • _octal_byte_value | _hex_byte_value _octal_byte_value : '\' _octal_digit • _octal_digit _octal_digit _octal_digit : '0'-'7' • @@ -1053,11 +1062,11 @@ S61{ char_lit : ''' (_unicode_value | • _byte_value) ''' } Transitions: - ['0','7'] -> S75 + ['0','7'] -> S77 Action: nil Symbols classes: {['0','7']} -S62{ +S63{ _big_u_value : '\' 'U' • _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' @@ -1066,13 +1075,13 @@ S62{ char_lit : ''' (• _unicode_value | _byte_value) ''' } Transitions: - ['0','9'] -> S76 - ['A','F'] -> S76 - ['a','f'] -> S76 + ['0','9'] -> S78 + ['A','F'] -> S78 + ['a','f'] -> S78 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S63{ +S64{ _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' _hex_digit : • '0'-'9' | 'A'-'F' | 'a'-'f' @@ -1081,13 +1090,13 @@ S63{ char_lit : ''' (• _unicode_value | _byte_value) ''' } Transitions: - ['0','9'] -> S77 - ['A','F'] -> S77 - ['a','f'] -> S77 + ['0','9'] -> S79 + ['A','F'] -> S79 + ['a','f'] -> S79 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S64{ +S65{ _byte_value : _octal_byte_value | • _hex_byte_value _hex_byte_value : '\' 'x' • _hex_digit _hex_digit _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' @@ -1096,20 +1105,20 @@ S64{ char_lit : ''' (_unicode_value | • _byte_value) ''' } Transitions: - ['0','9'] -> S78 - ['A','F'] -> S78 - ['a','f'] -> S78 + ['0','9'] -> S80 + ['A','F'] -> S80 + ['a','f'] -> S80 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S65{ +S66{ char_lit : ''' (_unicode_value | _byte_value) ''' • } Transitions: Action: Accept("char_lit") Symbols classes: {} -S66{ +S67{ !comment : _lineComment | • _blockComment _blockComment : '/' '*' {. | '*'} '*' • '/' _blockComment : '/' '*' {. | '*'} • '*' '/' @@ -1117,13 +1126,13 @@ S66{ _blockComment : '/' '*' {• . | '*'} '*' '/' } Transitions: - ['*','*'] -> S66 - ['/','/'] -> S79 + ['*','*'] -> S67 + ['/','/'] -> S81 . -> S33 Action: nil Symbols classes: {['*','*'], ['/','/']} -S67{ +S68{ !comment : (_lineComment | _blockComment) • _lineComment : '/' '/' {.} '\n' • } @@ -1131,17 +1140,27 @@ Transitions: Action: Ignore("!comment") Symbols classes: {} -S68{ +S69{ g_sdt_lit : '<' '<' . {.} • '>' '>' g_sdt_lit : '<' '<' . {• .} '>' '>' } Transitions: - ['>','>'] -> S80 -. -> S68 + ['>','>'] -> S82 +. -> S69 Action: nil Symbols classes: {['>','>']} -S69{ +S70{ + g_ctxdep_lit : '@' '<' . {.} • '>' '@' + g_ctxdep_lit : '@' '<' . {• .} '>' '@' +} +Transitions: + ['>','>'] -> S83 +. -> S70 +Action: nil +Symbols classes: {['>','>']} + +S71{ _digit : • '0'-'9' _id_char : (_upcase | _lowcase | '_' | _digit) • _id_char : _upcase | _lowcase | '_' | • _digit @@ -1158,16 +1177,16 @@ S69{ Λ : 'e' 'm' 'p' • 't' 'y' } Transitions: - ['0','9'] -> S45 - ['A','Z'] -> S46 - ['_','_'] -> S47 - ['a','s'] -> S48 - ['t','t'] -> S81 - ['u','z'] -> S48 + ['0','9'] -> S46 + ['A','Z'] -> S47 + ['_','_'] -> S48 + ['a','s'] -> S49 + ['t','t'] -> S84 + ['u','z'] -> S49 Action: Accept("tokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','s'], ['t','t'], ['u','z']} -S70{ +S72{ _digit : • '0'-'9' _id_char : (_upcase | _lowcase | '_' | _digit) • _id_char : _upcase | _lowcase | '_' | • _digit @@ -1184,16 +1203,16 @@ S70{ Λ : 'e' 'r' 'r' • 'o' 'r' } Transitions: - ['0','9'] -> S45 - ['A','Z'] -> S46 - ['_','_'] -> S47 - ['a','n'] -> S48 - ['o','o'] -> S82 - ['p','z'] -> S48 + ['0','9'] -> S46 + ['A','Z'] -> S47 + ['_','_'] -> S48 + ['a','n'] -> S49 + ['o','o'] -> S85 + ['p','z'] -> S49 Action: Accept("tokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','n'], ['o','o'], ['p','z']} -S71{ +S73{ _byte_value : • _octal_byte_value | _hex_byte_value _interpreted_string : '"' {_unicode_value | • _byte_value} '"' _octal_byte_value : '\' _octal_digit _octal_digit • _octal_digit @@ -1202,11 +1221,11 @@ S71{ string_lit : _raw_string | • _interpreted_string } Transitions: - ['0','7'] -> S83 + ['0','7'] -> S86 Action: nil Symbols classes: {['0','7']} -S72{ +S74{ _big_u_value : '\' 'U' _hex_digit • _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' @@ -1217,13 +1236,13 @@ S72{ string_lit : _raw_string | • _interpreted_string } Transitions: - ['0','9'] -> S84 - ['A','F'] -> S84 - ['a','f'] -> S84 + ['0','9'] -> S87 + ['A','F'] -> S87 + ['a','f'] -> S87 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S73{ +S75{ _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • @@ -1234,13 +1253,13 @@ S73{ string_lit : _raw_string | • _interpreted_string } Transitions: - ['0','9'] -> S85 - ['A','F'] -> S85 - ['a','f'] -> S85 + ['0','9'] -> S88 + ['A','F'] -> S88 + ['a','f'] -> S88 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S74{ +S76{ _byte_value : _octal_byte_value | • _hex_byte_value _hex_byte_value : '\' 'x' _hex_digit • _hex_digit _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' @@ -1251,13 +1270,13 @@ S74{ string_lit : _raw_string | • _interpreted_string } Transitions: - ['0','9'] -> S86 - ['A','F'] -> S86 - ['a','f'] -> S86 + ['0','9'] -> S89 + ['A','F'] -> S89 + ['a','f'] -> S89 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S75{ +S77{ _byte_value : • _octal_byte_value | _hex_byte_value _octal_byte_value : '\' _octal_digit _octal_digit • _octal_digit _octal_digit : '0'-'7' • @@ -1265,11 +1284,11 @@ S75{ char_lit : ''' (_unicode_value | • _byte_value) ''' } Transitions: - ['0','7'] -> S87 + ['0','7'] -> S90 Action: nil Symbols classes: {['0','7']} -S76{ +S78{ _big_u_value : '\' 'U' _hex_digit • _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' @@ -1279,13 +1298,13 @@ S76{ char_lit : ''' (• _unicode_value | _byte_value) ''' } Transitions: - ['0','9'] -> S88 - ['A','F'] -> S88 - ['a','f'] -> S88 + ['0','9'] -> S91 + ['A','F'] -> S91 + ['a','f'] -> S91 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S77{ +S79{ _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • @@ -1295,13 +1314,13 @@ S77{ char_lit : ''' (• _unicode_value | _byte_value) ''' } Transitions: - ['0','9'] -> S89 - ['A','F'] -> S89 - ['a','f'] -> S89 + ['0','9'] -> S92 + ['A','F'] -> S92 + ['a','f'] -> S92 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S78{ +S80{ _byte_value : _octal_byte_value | • _hex_byte_value _hex_byte_value : '\' 'x' _hex_digit • _hex_digit _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' @@ -1311,13 +1330,13 @@ S78{ char_lit : ''' (_unicode_value | • _byte_value) ''' } Transitions: - ['0','9'] -> S90 - ['A','F'] -> S90 - ['a','f'] -> S90 + ['0','9'] -> S93 + ['A','F'] -> S93 + ['a','f'] -> S93 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S79{ +S81{ !comment : (_lineComment | _blockComment) • _blockComment : '/' '*' {. | '*'} '*' '/' • } @@ -1325,15 +1344,23 @@ Transitions: Action: Ignore("!comment") Symbols classes: {} -S80{ +S82{ g_sdt_lit : '<' '<' . {.} '>' • '>' } Transitions: - ['>','>'] -> S91 + ['>','>'] -> S94 Action: nil Symbols classes: {['>','>']} -S81{ +S83{ + g_ctxdep_lit : '@' '<' . {.} '>' • '@' +} +Transitions: + ['@','@'] -> S95 +Action: nil +Symbols classes: {['@','@']} + +S84{ _digit : • '0'-'9' _id_char : (_upcase | _lowcase | '_' | _digit) • _id_char : _upcase | _lowcase | '_' | • _digit @@ -1350,16 +1377,16 @@ S81{ Λ : 'e' 'm' 'p' 't' • 'y' } Transitions: - ['0','9'] -> S45 - ['A','Z'] -> S46 - ['_','_'] -> S47 - ['a','x'] -> S48 - ['y','y'] -> S92 - ['z','z'] -> S48 + ['0','9'] -> S46 + ['A','Z'] -> S47 + ['_','_'] -> S48 + ['a','x'] -> S49 + ['y','y'] -> S96 + ['z','z'] -> S49 Action: Accept("tokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','x'], ['y','y'], ['z','z']} -S82{ +S85{ _digit : • '0'-'9' _id_char : (_upcase | _lowcase | '_' | _digit) • _id_char : _upcase | _lowcase | '_' | • _digit @@ -1376,16 +1403,16 @@ S82{ Λ : 'e' 'r' 'r' 'o' • 'r' } Transitions: - ['0','9'] -> S45 - ['A','Z'] -> S46 - ['_','_'] -> S47 - ['a','q'] -> S48 - ['r','r'] -> S93 - ['s','z'] -> S48 + ['0','9'] -> S46 + ['A','Z'] -> S47 + ['_','_'] -> S48 + ['a','q'] -> S49 + ['r','r'] -> S97 + ['s','z'] -> S49 Action: Accept("tokId") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','q'], ['r','r'], ['s','z']} -S83{ +S86{ _big_u_value : • '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _byte_value : (_octal_byte_value | _hex_byte_value) • _byte_value : _octal_byte_value | • _hex_byte_value @@ -1412,7 +1439,7 @@ Transitions: Action: nil Symbols classes: {['"','"'], ['\','\']} -S84{ +S87{ _big_u_value : '\' 'U' _hex_digit _hex_digit • _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' @@ -1423,13 +1450,13 @@ S84{ string_lit : _raw_string | • _interpreted_string } Transitions: - ['0','9'] -> S94 - ['A','F'] -> S94 - ['a','f'] -> S94 + ['0','9'] -> S98 + ['A','F'] -> S98 + ['a','f'] -> S98 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S85{ +S88{ _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • @@ -1440,13 +1467,13 @@ S85{ string_lit : _raw_string | • _interpreted_string } Transitions: - ['0','9'] -> S95 - ['A','F'] -> S95 - ['a','f'] -> S95 + ['0','9'] -> S99 + ['A','F'] -> S99 + ['a','f'] -> S99 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S86{ +S89{ _big_u_value : • '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _byte_value : (_octal_byte_value | _hex_byte_value) • _byte_value : _octal_byte_value | • _hex_byte_value @@ -1473,18 +1500,18 @@ Transitions: Action: nil Symbols classes: {['"','"'], ['\','\']} -S87{ +S90{ _byte_value : (_octal_byte_value | _hex_byte_value) • _octal_byte_value : '\' _octal_digit _octal_digit _octal_digit • _octal_digit : '0'-'7' • char_lit : ''' (_unicode_value | _byte_value) • ''' } Transitions: - [''','''] -> S65 + [''','''] -> S66 Action: nil Symbols classes: {[''',''']} -S88{ +S91{ _big_u_value : '\' 'U' _hex_digit _hex_digit • _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' @@ -1494,13 +1521,13 @@ S88{ char_lit : ''' (• _unicode_value | _byte_value) ''' } Transitions: - ['0','9'] -> S96 - ['A','F'] -> S96 - ['a','f'] -> S96 + ['0','9'] -> S100 + ['A','F'] -> S100 + ['a','f'] -> S100 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S89{ +S92{ _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • @@ -1510,31 +1537,38 @@ S89{ char_lit : ''' (• _unicode_value | _byte_value) ''' } Transitions: - ['0','9'] -> S97 - ['A','F'] -> S97 - ['a','f'] -> S97 + ['0','9'] -> S101 + ['A','F'] -> S101 + ['a','f'] -> S101 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S90{ +S93{ _byte_value : (_octal_byte_value | _hex_byte_value) • _hex_byte_value : '\' 'x' _hex_digit _hex_digit • _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • char_lit : ''' (_unicode_value | _byte_value) • ''' } Transitions: - [''','''] -> S65 + [''','''] -> S66 Action: nil Symbols classes: {[''',''']} -S91{ +S94{ g_sdt_lit : '<' '<' . {.} '>' '>' • } Transitions: Action: Accept("g_sdt_lit") Symbols classes: {} -S92{ +S95{ + g_ctxdep_lit : '@' '<' . {.} '>' '@' • +} +Transitions: +Action: Accept("g_ctxdep_lit") +Symbols classes: {} + +S96{ _digit : • '0'-'9' _id_char : (_upcase | _lowcase | '_' | _digit) • _id_char : _upcase | _lowcase | '_' | • _digit @@ -1551,14 +1585,14 @@ S92{ Λ : 'e' 'm' 'p' 't' 'y' • } Transitions: - ['0','9'] -> S45 - ['A','Z'] -> S46 - ['_','_'] -> S47 - ['a','z'] -> S48 + ['0','9'] -> S46 + ['A','Z'] -> S47 + ['_','_'] -> S48 + ['a','z'] -> S49 Action: Accept("Λ") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} -S93{ +S97{ _digit : • '0'-'9' _id_char : (_upcase | _lowcase | '_' | _digit) • _id_char : _upcase | _lowcase | '_' | • _digit @@ -1575,14 +1609,14 @@ S93{ Λ : 'e' 'r' 'r' 'o' 'r' • } Transitions: - ['0','9'] -> S45 - ['A','Z'] -> S46 - ['_','_'] -> S47 - ['a','z'] -> S48 + ['0','9'] -> S46 + ['A','Z'] -> S47 + ['_','_'] -> S48 + ['a','z'] -> S49 Action: Accept("Λ") Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} -S94{ +S98{ _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit • _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' @@ -1593,13 +1627,13 @@ S94{ string_lit : _raw_string | • _interpreted_string } Transitions: - ['0','9'] -> S98 - ['A','F'] -> S98 - ['a','f'] -> S98 + ['0','9'] -> S102 + ['A','F'] -> S102 + ['a','f'] -> S102 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S95{ +S99{ _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • @@ -1610,13 +1644,13 @@ S95{ string_lit : _raw_string | • _interpreted_string } Transitions: - ['0','9'] -> S99 - ['A','F'] -> S99 - ['a','f'] -> S99 + ['0','9'] -> S103 + ['A','F'] -> S103 + ['a','f'] -> S103 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S96{ +S100{ _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit • _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' @@ -1626,13 +1660,13 @@ S96{ char_lit : ''' (• _unicode_value | _byte_value) ''' } Transitions: - ['0','9'] -> S100 - ['A','F'] -> S100 - ['a','f'] -> S100 + ['0','9'] -> S104 + ['A','F'] -> S104 + ['a','f'] -> S104 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S97{ +S101{ _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • @@ -1642,13 +1676,13 @@ S97{ char_lit : ''' (• _unicode_value | _byte_value) ''' } Transitions: - ['0','9'] -> S101 - ['A','F'] -> S101 - ['a','f'] -> S101 + ['0','9'] -> S105 + ['A','F'] -> S105 + ['a','f'] -> S105 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S98{ +S102{ _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit • _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' @@ -1659,13 +1693,13 @@ S98{ string_lit : _raw_string | • _interpreted_string } Transitions: - ['0','9'] -> S102 - ['A','F'] -> S102 - ['a','f'] -> S102 + ['0','9'] -> S106 + ['A','F'] -> S106 + ['a','f'] -> S106 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S99{ +S103{ _big_u_value : • '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _byte_value : _octal_byte_value | • _hex_byte_value _byte_value : • _octal_byte_value | _hex_byte_value @@ -1692,7 +1726,7 @@ Transitions: Action: nil Symbols classes: {['"','"'], ['\','\']} -S100{ +S104{ _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit • _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' @@ -1702,24 +1736,24 @@ S100{ char_lit : ''' (• _unicode_value | _byte_value) ''' } Transitions: - ['0','9'] -> S103 - ['A','F'] -> S103 - ['a','f'] -> S103 + ['0','9'] -> S107 + ['A','F'] -> S107 + ['a','f'] -> S107 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S101{ +S105{ _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _little_u_value : '\' 'u' _hex_digit _hex_digit _hex_digit _hex_digit • _unicode_value : (. | _little_u_value | _big_u_value | _escaped_char) • char_lit : ''' (_unicode_value | _byte_value) • ''' } Transitions: - [''','''] -> S65 + [''','''] -> S66 Action: nil Symbols classes: {[''',''']} -S102{ +S106{ _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit • _hex_digit _hex_digit _hex_digit _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' @@ -1730,13 +1764,13 @@ S102{ string_lit : _raw_string | • _interpreted_string } Transitions: - ['0','9'] -> S104 - ['A','F'] -> S104 - ['a','f'] -> S104 + ['0','9'] -> S108 + ['A','F'] -> S108 + ['a','f'] -> S108 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S103{ +S107{ _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit • _hex_digit _hex_digit _hex_digit _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' @@ -1746,13 +1780,13 @@ S103{ char_lit : ''' (• _unicode_value | _byte_value) ''' } Transitions: - ['0','9'] -> S105 - ['A','F'] -> S105 - ['a','f'] -> S105 + ['0','9'] -> S109 + ['A','F'] -> S109 + ['a','f'] -> S109 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S104{ +S108{ _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit • _hex_digit _hex_digit _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' @@ -1763,13 +1797,13 @@ S104{ string_lit : _raw_string | • _interpreted_string } Transitions: - ['0','9'] -> S106 - ['A','F'] -> S106 - ['a','f'] -> S106 + ['0','9'] -> S110 + ['A','F'] -> S110 + ['a','f'] -> S110 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S105{ +S109{ _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit • _hex_digit _hex_digit _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' @@ -1779,13 +1813,13 @@ S105{ char_lit : ''' (• _unicode_value | _byte_value) ''' } Transitions: - ['0','9'] -> S107 - ['A','F'] -> S107 - ['a','f'] -> S107 + ['0','9'] -> S111 + ['A','F'] -> S111 + ['a','f'] -> S111 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S106{ +S110{ _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit • _hex_digit _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' @@ -1796,13 +1830,13 @@ S106{ string_lit : _raw_string | • _interpreted_string } Transitions: - ['0','9'] -> S108 - ['A','F'] -> S108 - ['a','f'] -> S108 + ['0','9'] -> S112 + ['A','F'] -> S112 + ['a','f'] -> S112 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S107{ +S111{ _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit • _hex_digit _hex_digit : '0'-'9' | 'A'-'F' | • 'a'-'f' _hex_digit : '0'-'9' | • 'A'-'F' | 'a'-'f' @@ -1812,13 +1846,13 @@ S107{ char_lit : ''' (• _unicode_value | _byte_value) ''' } Transitions: - ['0','9'] -> S109 - ['A','F'] -> S109 - ['a','f'] -> S109 + ['0','9'] -> S113 + ['A','F'] -> S113 + ['a','f'] -> S113 Action: nil Symbols classes: {['0','9'], ['A','F'], ['a','f']} -S108{ +S112{ _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit • _big_u_value : • '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _byte_value : _octal_byte_value | • _hex_byte_value @@ -1845,14 +1879,14 @@ Transitions: Action: nil Symbols classes: {['"','"'], ['\','\']} -S109{ +S113{ _big_u_value : '\' 'U' _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit _hex_digit • _hex_digit : ( '0'-'9' | 'A'-'F' | 'a'-'f') • _unicode_value : (. | _little_u_value | _big_u_value | _escaped_char) • char_lit : ''' (_unicode_value | _byte_value) • ''' } Transitions: - [''','''] -> S65 + [''','''] -> S66 Action: nil Symbols classes: {[''',''']} diff --git a/internal/frontend/reparsed/log/terminals.txt b/internal/frontend/reparsed/log/terminals.txt index 577976d5..2472b3c1 100644 --- a/internal/frontend/reparsed/log/terminals.txt +++ b/internal/frontend/reparsed/log/terminals.txt @@ -19,7 +19,7 @@ char_lit g_sdt_lit prodId string_lit -"@" +g_ctxdep_lit "error" "λ" "empty" diff --git a/internal/parser/gen/golang/actiontable.go b/internal/parser/gen/golang/actiontable.go index 7e1c21c5..0675aaf3 100644 --- a/internal/parser/gen/golang/actiontable.go +++ b/internal/parser/gen/golang/actiontable.go @@ -46,14 +46,16 @@ func GenActionTable(outDir string, prods ast.SyntaxProdList, itemSets *items.Ite } type actionTableData struct { - Rows []*actRow + Rows []*actRow + CdTokenFunctions []string } func getActionTableData(prods ast.SyntaxProdList, itemSets *items.ItemSets, tokMap *token.TokenMap) (actTab *actionTableData, conflicts map[int]items.RowConflicts) { actTab = &actionTableData{ - Rows: make([]*actRow, itemSets.Size()), + Rows: make([]*actRow, itemSets.Size()), + CdTokenFunctions: make([]string, len(tokMap.TypeMap)), } conflicts = make(map[int]items.RowConflicts) var row *actRow @@ -64,6 +66,14 @@ func getActionTableData(prods ast.SyntaxProdList, itemSets *items.ItemSets, } actTab.Rows[i] = row } + for i, sym := range tokMap.TypeMap { + switch s := sym.(type) { + case ast.SyntaxContextDependentTokId: + actTab.CdTokenFunctions[i] = fmt.Sprintf("func(Context interface{}) (interface{}, error, []byte) { return %s },", s.ContexDependentParseFunctionCall) + default: + actTab.CdTokenFunctions[i] = fmt.Sprintf("nil, // %T", s) + } + } return } @@ -143,20 +153,32 @@ type ( canRecover bool actions [numSymbols]action } + contextDependentToken [numSymbols] func(interface{}) (interface{}, error, []byte) + actions struct { + table actionTable + cdTokens contextDependentToken + } ) - -var actionTab = actionTable{ - {{- range $i, $r := .Rows }} - actionRow{ // S{{$i}} - canRecover: {{printf "%t" .CanRecover}}, - actions: [numSymbols]action{ - {{- range $a := .Actions }} - {{$a}} - {{- end }} - }, - }, - {{- end }} +var parserActions = actions { + cdTokens: contextDependentToken{ + {{- range $f := .CdTokenFunctions }} + {{$f}} + {{- end }} + }, + table: actionTable{ + {{- range $i, $r := .Rows }} + actionRow{ // S{{$i}} + canRecover: {{printf "%t" .CanRecover}}, + actions: [numSymbols]action{ + {{- range $a := .Actions }} + {{$a}} + {{- end }} + }, + }, + {{- end }} + }, } + ` func GenCompActionTable(outDir, subpath string, prods ast.SyntaxProdList, itemSets *items.ItemSets, tokMap *token.TokenMap) map[int]items.RowConflicts { diff --git a/internal/parser/gen/golang/parser.go b/internal/parser/gen/golang/parser.go index f1804050..d9212c44 100644 --- a/internal/parser/gen/golang/parser.go +++ b/internal/parser/gen/golang/parser.go @@ -66,6 +66,7 @@ package parser import ( "fmt" "strings" + "errors" parseError "{{.ErrorImport}}" "{{.TokenImport}}" @@ -153,6 +154,7 @@ type Parser struct { nextToken *token.Token userContext interface{} longest bool + checkPoint Position } type Scanner interface { @@ -161,7 +163,7 @@ type Scanner interface { type Position interface{} -type ContextDependentScanner interface { +type RepositionableScanner interface { Scanner Reposition(p Position) CurrentPosition() Position @@ -189,24 +191,24 @@ func (p *Parser) Error(err error, scanner Scanner) (recovered bool, errorAttrib ErrorSymbols: p.popNonRecoveryStates(), ExpectedTokens: make([]string, 0, 8), } - for t, action := range actionTab[p.stack.top()].actions { + for t, action := range parserActions.table[p.stack.top()].actions { if action != nil { errorAttrib.ExpectedTokens = append(errorAttrib.ExpectedTokens, token.TokMap.Id(token.Type(t))) } } - if action := actionTab[p.stack.top()].actions[token.TokMap.Type("error")]; action != nil { + if action := parserActions.table[p.stack.top()].actions[token.TokMap.Type("error")]; action != nil { p.stack.push(int(action.(shift)), errorAttrib) // action can only be shift } else { return } - if action := actionTab[p.stack.top()].actions[p.nextToken.Type]; action != nil { + if action := parserActions.table[p.stack.top()].actions[p.nextToken.Type]; action != nil { recovered = true } for !recovered && p.nextToken.Type != token.EOF { p.nextToken = scanner.Scan() - if action := actionTab[p.stack.top()].actions[p.nextToken.Type]; action != nil { + if action := parserActions.table[p.stack.top()].actions[p.nextToken.Type]; action != nil { recovered = true } } @@ -229,10 +231,10 @@ func (p *Parser) popNonRecoveryStates() (removedAttribs []parseError.ErrorSymbol // recoveryState points to the highest state on the stack, which can recover func (p *Parser) firstRecoveryState() (recoveryState int, canRecover bool) { - recoveryState, canRecover = p.stack.topIndex(), actionTab[p.stack.top()].canRecover + recoveryState, canRecover = p.stack.topIndex(), parserActions.table[p.stack.top()].canRecover for recoveryState > 0 && !canRecover { recoveryState-- - canRecover = actionTab[p.stack.peek(recoveryState)].canRecover + canRecover = parserActions.table[p.stack.peek(recoveryState)].canRecover } return } @@ -243,7 +245,7 @@ func (p *Parser) newError(err error) error { StackTop: p.stack.top(), ErrorToken: p.nextToken, } - actRow := actionTab[p.stack.top()] + actRow := parserActions.table[p.stack.top()] for i, t := range actRow.actions { if t != nil { e.ExpectedTokens = append(e.ExpectedTokens, token.TokMap.Id(token.Type(i))) @@ -254,34 +256,55 @@ func (p *Parser) newError(err error) error { func (p *Parser) Parse(scanner Scanner) (res interface{}, err error) { p.longest = false - return p.parse(scanner) + r, e, _ := p.parse(scanner) + return r, e } func (p *Parser) ParseLongestPrefix(scanner Scanner) (res interface{}, err error, parsed []byte) { + if _, isRepositionable := scanner.(RepositionableScanner); !isRepositionable { + return nil, errors.New("scanner not repositionable"), []byte{} + } p.longest = true - r, e := p.parse(scanner) - return r, e, []byte{} + return p.parse(scanner) } -func (p *Parser) parse(scanner Scanner) (res interface{}, err error) { +func (p *Parser) parse(scanner Scanner) (res interface{}, err error, parsed []byte) { p.Reset() + if p.longest { + p.checkPoint = scanner.(RepositionableScanner).CurrentPosition() + } p.nextToken = scanner.Scan() for acc := false; !acc; { - action := actionTab[p.stack.top()].actions[p.nextToken.Type] + action := parserActions.table[p.stack.top()].actions[p.nextToken.Type] if action == nil { - - if p.longest { - } - + for tt, fn := range parserActions.cdTokens { + if fn != nil { + scanner.(RepositionableScanner).Reposition(p.checkPoint) + cd_res, cd_err, cd_parsed := fn(p.userContext) + if cd_err == nil && len(cd_parsed) > 0 { + action = parserActions.table[p.stack.top()].actions[tt] + p.nextToken.ForeingAstNode = cd_res + p.nextToken.Lit = cd_parsed + break + } + } + } + } + if action == nil { + if p.longest { + scanner.(RepositionableScanner).Reposition(p.checkPoint) + } + } + if action == nil { if recovered, errAttrib := p.Error(nil, scanner); !recovered { p.nextToken = errAttrib.ErrorToken - return nil, p.newError(nil) + return nil, p.newError(nil), []byte{} } - if action = actionTab[p.stack.top()].actions[p.nextToken.Type]; action == nil { + if action = parserActions.table[p.stack.top()].actions[p.nextToken.Type]; action == nil { panic("Error recovery led to invalid action") } - } + } {{- if .Debug }} fmt.Printf("S%d %s %s\n", p.stack.top(), token.TokMap.TokenString(p.nextToken), action) {{- end }} @@ -291,13 +314,20 @@ func (p *Parser) parse(scanner Scanner) (res interface{}, err error) { res = p.stack.popN(1)[0] acc = true case shift: - p.stack.push(int(act), p.nextToken) + if p.nextToken.ForeingAstNode == nil { + p.stack.push(int(act), p.nextToken) + } else { + p.stack.push(int(act), p.nextToken.ForeingAstNode) + } + if p.longest { + p.checkPoint = scanner.(RepositionableScanner).CurrentPosition() + } p.nextToken = scanner.Scan() case reduce: prod := productionsTable[int(act)] attrib, err := prod.ReduceFunc(p.userContext, p.stack.popN(prod.NumSymbols)) if err != nil { - return nil, p.newError(err) + return nil, p.newError(err), []byte{} } else { p.stack.push(gotoTab[p.stack.top()][prod.NTType], attrib) } @@ -305,6 +335,6 @@ func (p *Parser) parse(scanner Scanner) (res interface{}, err error) { panic("unknown action: " + action.String()) } } - return res, nil + return res, nil, []byte{} } ` diff --git a/internal/token/gen/golang/token.go b/internal/token/gen/golang/token.go index 95e3e2e3..3ea9e692 100644 --- a/internal/token/gen/golang/token.go +++ b/internal/token/gen/golang/token.go @@ -76,7 +76,6 @@ type Token struct { Lit []byte Pos ForeingAstNode interface{} - ForeingAstError error } type Type int diff --git a/spec/gocc2.ebnf b/spec/gocc2.ebnf index dd2fddbf..4e1562a1 100644 --- a/spec/gocc2.ebnf +++ b/spec/gocc2.ebnf @@ -92,6 +92,10 @@ g_sdt_lit : '<' '<' . {.} '>' '>' ; +g_ctxdep_lit + : '@' '<' . {.} '>' '@' + ; + string_lit : _raw_string @@ -287,9 +291,9 @@ Symbol : string_lit << ast.NewStringLit($0) >> | - "@" tokId - << ast.NewContextDependentTokId($1) >> + g_ctxdep_lit + << ast.NewContextDependentTokId($0,$1) >> ; ErrorSymbol : diff --git a/spec/test.bnf b/spec/test.bnf index dd04204c..2967ff79 100644 --- a/spec/test.bnf +++ b/spec/test.bnf @@ -9,10 +9,16 @@ _id_char : _upcase | _lowcase | '_' | _digit ; _upcase : 'A'-'Z' ; _digit : '0'-'9' ; -// + !space : ' ' | '\t' ; hexdigit : '0'-'F' | ~(':'-'@') ; +<< +import( + "fmt" +) +>> + Test : Test1 ; @@ -38,7 +44,11 @@ ProdX : "empty" | "ε" | "λ" | empty | ε ; X: "!" | "hexdigit" - | @altro - << f(Context) >> + | + altro + @< altro() >@ + << + fmt.Printf("$0=%q\n$1=%q\n", $0, $1) + >> ; From f5e6104009d114291b5ab9192199a4b41807b999 Mon Sep 17 00:00:00 2001 From: Massimiliano Calandrelli Date: Wed, 9 Oct 2019 18:58:23 +0200 Subject: [PATCH 15/33] ... --- internal/ast/syntaxcontextdependenttokenid.go | 7 +- internal/base/gen/golang/base.go | 14 +- .../frontend/reparsed/internal/lexer/lexer.go | 17 +- .../internal/lexer/transitiontable.go | 4 +- .../reparsed/internal/parser/actiontable.go | 9754 +++++++++-------- .../reparsed/internal/parser/gototable.go | 602 +- .../reparsed/internal/parser/parser.go | 125 +- .../internal/parser/productionstable.go | 8 +- .../frontend/reparsed/internal/token/token.go | 10 +- internal/frontend/reparsed/log/lexer_sets.txt | 22 +- internal/frontend/reparsed/reparsed.go | 14 +- internal/lexer/gen/golang/lexer.go | 17 +- internal/parser/gen/gen.go | 4 +- internal/parser/gen/golang/actiontable.go | 244 +- internal/parser/gen/golang/gototable.go | 85 +- internal/parser/gen/golang/parser.go | 125 +- .../parser/gen/golang/productionstable.go | 12 +- internal/token/gen/golang/token.go | 11 +- spec/gocc2.ebnf | 2 +- spec/test.bnf | 29 +- 20 files changed, 5568 insertions(+), 5538 deletions(-) diff --git a/internal/ast/syntaxcontextdependenttokenid.go b/internal/ast/syntaxcontextdependenttokenid.go index f9cef6d3..7af3eb44 100644 --- a/internal/ast/syntaxcontextdependenttokenid.go +++ b/internal/ast/syntaxcontextdependenttokenid.go @@ -16,6 +16,7 @@ package ast import ( "fmt" + "regexp" "github.com/maxcalandrelli/gocc/internal/config" ) @@ -36,7 +37,11 @@ func NewContextDependentTokId(tokId, ctxdeplit interface{}) (SyntaxContextDepend func NewNewContextDependentTokIdFromString(tokId, ctxdeplit string) SyntaxContextDependentTokId { tokenIdCount++ - return SyntaxContextDependentTokId{fmt.Sprintf("%s#%d", tokId, tokenIdCount), StdSyntaxSymbol{}, ctxdeplit[2 : len(ctxdeplit)-2]} + return SyntaxContextDependentTokId{ + fmt.Sprintf("%s_%d", tokId, tokenIdCount), + StdSyntaxSymbol{}, + regexp.MustCompile("^(?ms:@@\\s*(.*)\\s*@@)$").ReplaceAllString(ctxdeplit, "${1}"), + } } func (this SyntaxContextDependentTokId) SymbolString() string { diff --git a/internal/base/gen/golang/base.go b/internal/base/gen/golang/base.go index 8377a3ef..596f27fa 100644 --- a/internal/base/gen/golang/base.go +++ b/internal/base/gen/golang/base.go @@ -88,8 +88,12 @@ import ( "{{.Pkg}}/{{.Subpath}}/io/stream" ) -type Token = token.Token -type WindowReader = stream.WindowReader +type ( + Token = token.Token + TokenStream = token.TokenStream + WindowReader = stream.WindowReader + Scanner = parser.Scanner +) func ParseFile(fpath string) (interface{}, error) { @@ -101,11 +105,11 @@ func ParseFile(fpath string) (interface{}, error) { } func ParseText(text string) (interface{}, error) { - return NewParser().Parse(NewLexer([]byte(text))) + return NewParser().Parse(NewLexerBytes([]byte(text))) } -func NewLexer(src []byte) *lexer.Lexer { - return lexer.NewLexer(src) +func NewLexerBytes(src []byte) *lexer.Lexer { + return lexer.NewLexerBytes(src) } func NewLexerFile(fpath string) (*lexer.Lexer, error) { diff --git a/internal/frontend/reparsed/internal/lexer/lexer.go b/internal/frontend/reparsed/internal/lexer/lexer.go index 43efa836..a79a4b69 100644 --- a/internal/frontend/reparsed/internal/lexer/lexer.go +++ b/internal/frontend/reparsed/internal/lexer/lexer.go @@ -24,18 +24,13 @@ type position struct { StreamPosition int64 } -type lexerStream interface { - io.RuneReader - io.Seeker -} - type Lexer struct { position - stream lexerStream + stream token.TokenStream eof bool } -func NewLexer(src []byte) *Lexer { +func NewLexerBytes(src []byte) *Lexer { lexer := &Lexer{stream: bytes.NewReader(src)} lexer.position.Reset() return lexer @@ -51,10 +46,10 @@ func NewLexerFile(fpath string) (*Lexer, error) { return lexer, nil } -func NewLexerStream(reader io.Reader) (*Lexer, error) { +func NewLexer(reader io.Reader) (*Lexer, error) { lexer := &Lexer{} lexer.position.Reset() - if lexer.stream, _ = reader.(lexerStream); lexer.stream == nil { + if lexer.stream, _ = reader.(token.TokenStream); lexer.stream == nil { lexer.stream = stream.NewWindowReader(reader) } else { lexer.position.StreamPosition, _ = lexer.stream.Seek(0, io.SeekCurrent) @@ -62,6 +57,10 @@ func NewLexerStream(reader io.Reader) (*Lexer, error) { return lexer, nil } +func (l Lexer) GetStream() io.Reader { + return l.stream +} + func (l *Lexer) Scan() (tok *token.Token) { tok = new(token.Token) if l.eof { diff --git a/internal/frontend/reparsed/internal/lexer/transitiontable.go b/internal/frontend/reparsed/internal/lexer/transitiontable.go index c96a5ea5..4a03759a 100644 --- a/internal/frontend/reparsed/internal/lexer/transitiontable.go +++ b/internal/frontend/reparsed/internal/lexer/transitiontable.go @@ -167,7 +167,7 @@ var TransTab = TransitionTable{ // S13 func(r rune) int { switch { - case r == 60: // ['<','<'] + case r == 64: // ['@','@'] return 36 } return NoState @@ -840,7 +840,7 @@ var TransTab = TransitionTable{ // S70 func(r rune) int { switch { - case r == 62: // ['>','>'] + case r == 64: // ['@','@'] return 83 default: return 70 diff --git a/internal/frontend/reparsed/internal/parser/actiontable.go b/internal/frontend/reparsed/internal/parser/actiontable.go index 75117e0b..239f10f5 100644 --- a/internal/frontend/reparsed/internal/parser/actiontable.go +++ b/internal/frontend/reparsed/internal/parser/actiontable.go @@ -4,4820 +4,4950 @@ package parser type ( actionTable [numStates]actionRow - actionRow struct { + cdFunc func(TokenStream, interface{}) (interface{}, error, []byte) + cdAction struct { + tokenIndex int + tokenScanner cdFunc + } + actionRow struct { canRecover bool actions [numSymbols]action + cdActions []cdAction + } + actions struct { + table actionTable } - contextDependentToken [numSymbols] func(interface{}) (interface{}, error, []byte) - actions struct { - table actionTable - cdTokens contextDependentToken - } ) -var parserActions = actions { - cdTokens: contextDependentToken{ - nil, // ast.InvalidSyntaxSymbol - nil, // ast.SyntaxEof - nil, // ast.SyntaxTokId - nil, // ast.SyntaxStringLit - nil, // ast.SyntaxStringLit - nil, // ast.SyntaxTokId - nil, // ast.SyntaxTokId - nil, // ast.SyntaxStringLit - nil, // ast.SyntaxStringLit - nil, // ast.SyntaxTokId - nil, // ast.SyntaxStringLit - nil, // ast.SyntaxStringLit - nil, // ast.SyntaxStringLit - nil, // ast.SyntaxStringLit - nil, // ast.SyntaxStringLit - nil, // ast.SyntaxStringLit - nil, // ast.SyntaxStringLit - nil, // ast.SyntaxStringLit - nil, // ast.SyntaxTokId - nil, // ast.SyntaxTokId - nil, // ast.SyntaxTokId - nil, // ast.SyntaxTokId - nil, // ast.SyntaxStringLit - nil, // ast.SyntaxStringLit - nil, // ast.SyntaxStringLit - nil, // ast.SyntaxStringLit - }, - table: actionTable{ - actionRow{ // S0 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - shift(9), // tokId - nil, // ":" - nil, // ";" - shift(10), // regDefId - shift(11), // ignoredTokId - nil, // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - shift(12), // g_sdt_lit - shift(13), // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S1 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - accept(true), // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S2 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - reduce(2), // Ω, reduce: Grammar - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - shift(12), // g_sdt_lit - shift(13), // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S3 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - reduce(3), // Ω, reduce: Grammar - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S4 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - reduce(4), // Ω, reduce: LexicalPart - shift(9), // tokId - nil, // ":" - nil, // ";" - shift(10), // regDefId - shift(11), // ignoredTokId - nil, // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - reduce(4), // g_sdt_lit, reduce: LexicalPart - reduce(4), // prodId, reduce: LexicalPart - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S5 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - reduce(5), // Ω, reduce: LexProductions - reduce(5), // tokId, reduce: LexProductions - nil, // ":" - nil, // ";" - reduce(5), // regDefId, reduce: LexProductions - reduce(5), // ignoredTokId, reduce: LexProductions - nil, // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - reduce(5), // g_sdt_lit, reduce: LexProductions - reduce(5), // prodId, reduce: LexProductions - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S6 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - shift(13), // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S7 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - reduce(24), // Ω, reduce: SyntaxPart - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - shift(13), // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S8 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - reduce(26), // Ω, reduce: SyntaxProdList - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - reduce(26), // prodId, reduce: SyntaxProdList - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S9 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - shift(18), // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S10 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - shift(19), // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S11 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - shift(20), // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S12 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - reduce(25), // prodId, reduce: FileHeader - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S13 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - shift(21), // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S14 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - reduce(1), // Ω, reduce: Grammar - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S15 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - reduce(6), // Ω, reduce: LexProductions - reduce(6), // tokId, reduce: LexProductions - nil, // ":" - nil, // ";" - reduce(6), // regDefId, reduce: LexProductions - reduce(6), // ignoredTokId, reduce: LexProductions - nil, // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - reduce(6), // g_sdt_lit, reduce: LexProductions - reduce(6), // prodId, reduce: LexProductions - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S16 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - reduce(23), // Ω, reduce: SyntaxPart - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - shift(13), // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S17 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - reduce(27), // Ω, reduce: SyntaxProdList - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - reduce(27), // prodId, reduce: SyntaxProdList - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S18 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - shift(25), // regDefId - nil, // ignoredTokId - nil, // "|" - shift(26), // "." - shift(27), // char_lit - nil, // "-" - shift(28), // "~" - shift(29), // "(" - nil, // ")" - shift(30), // "[" - nil, // "]" - shift(31), // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S19 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - shift(25), // regDefId - nil, // ignoredTokId - nil, // "|" - shift(26), // "." - shift(27), // char_lit - nil, // "-" - shift(28), // "~" - shift(29), // "(" - nil, // ")" - shift(30), // "[" - nil, // "]" - shift(31), // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S20 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - shift(25), // regDefId - nil, // ignoredTokId - nil, // "|" - shift(26), // "." - shift(27), // char_lit - nil, // "-" - shift(28), // "~" - shift(29), // "(" - nil, // ")" - shift(30), // "[" - nil, // "]" - shift(31), // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S21 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - shift(40), // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - shift(41), // prodId - shift(42), // string_lit - nil, // g_ctxdep_lit - shift(43), // "error" - shift(44), // "λ" - shift(45), // "empty" - shift(46), // "ε" - }, - }, - actionRow{ // S22 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - shift(47), // ";" - nil, // regDefId - nil, // ignoredTokId - shift(48), // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S23 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - reduce(10), // ";", reduce: LexPattern - shift(25), // regDefId - nil, // ignoredTokId - reduce(10), // "|", reduce: LexPattern - shift(26), // "." - shift(27), // char_lit - nil, // "-" - shift(28), // "~" - shift(29), // "(" - nil, // ")" - shift(30), // "[" - nil, // "]" - shift(31), // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S24 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - reduce(12), // ";", reduce: LexAlt - reduce(12), // regDefId, reduce: LexAlt - nil, // ignoredTokId - reduce(12), // "|", reduce: LexAlt - reduce(12), // ".", reduce: LexAlt - reduce(12), // char_lit, reduce: LexAlt - nil, // "-" - reduce(12), // "~", reduce: LexAlt - reduce(12), // "(", reduce: LexAlt - nil, // ")" - reduce(12), // "[", reduce: LexAlt - nil, // "]" - reduce(12), // "{", reduce: LexAlt - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S25 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - reduce(19), // ";", reduce: LexTerm - reduce(19), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(19), // "|", reduce: LexTerm - reduce(19), // ".", reduce: LexTerm - reduce(19), // char_lit, reduce: LexTerm - nil, // "-" - reduce(19), // "~", reduce: LexTerm - reduce(19), // "(", reduce: LexTerm - nil, // ")" - reduce(19), // "[", reduce: LexTerm - nil, // "]" - reduce(19), // "{", reduce: LexTerm - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S26 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - reduce(14), // ";", reduce: LexTerm - reduce(14), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(14), // "|", reduce: LexTerm - reduce(14), // ".", reduce: LexTerm - reduce(14), // char_lit, reduce: LexTerm - nil, // "-" - reduce(14), // "~", reduce: LexTerm - reduce(14), // "(", reduce: LexTerm - nil, // ")" - reduce(14), // "[", reduce: LexTerm - nil, // "]" - reduce(14), // "{", reduce: LexTerm - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S27 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - reduce(15), // ";", reduce: LexTerm - reduce(15), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(15), // "|", reduce: LexTerm - reduce(15), // ".", reduce: LexTerm - reduce(15), // char_lit, reduce: LexTerm - shift(50), // "-" - reduce(15), // "~", reduce: LexTerm - reduce(15), // "(", reduce: LexTerm - nil, // ")" - reduce(15), // "[", reduce: LexTerm - nil, // "]" - reduce(15), // "{", reduce: LexTerm - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S28 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - shift(51), // char_lit - nil, // "-" - nil, // "~" - shift(52), // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S29 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - shift(56), // regDefId - nil, // ignoredTokId - nil, // "|" - shift(57), // "." - shift(58), // char_lit - nil, // "-" - shift(59), // "~" - shift(60), // "(" - nil, // ")" - shift(61), // "[" - nil, // "]" - shift(62), // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S30 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - shift(66), // regDefId - nil, // ignoredTokId - nil, // "|" - shift(67), // "." - shift(68), // char_lit - nil, // "-" - shift(69), // "~" - shift(70), // "(" - nil, // ")" - shift(71), // "[" - nil, // "]" - shift(72), // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S31 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - shift(76), // regDefId - nil, // ignoredTokId - nil, // "|" - shift(77), // "." - shift(78), // char_lit - nil, // "-" - shift(79), // "~" - shift(80), // "(" - nil, // ")" - shift(81), // "[" - nil, // "]" - shift(82), // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S32 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - shift(83), // ";" - nil, // regDefId - nil, // ignoredTokId - shift(48), // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S33 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - shift(84), // ";" - nil, // regDefId - nil, // ignoredTokId - shift(48), // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S34 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - shift(85), // ";" - nil, // regDefId - nil, // ignoredTokId - shift(86), // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S35 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - reduce(29), // ";", reduce: Alternatives - nil, // regDefId - nil, // ignoredTokId - reduce(29), // "|", reduce: Alternatives - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S36 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - shift(40), // tokId - nil, // ":" - reduce(31), // ";", reduce: SyntaxBody - nil, // regDefId - nil, // ignoredTokId - reduce(31), // "|", reduce: SyntaxBody - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - shift(88), // g_sdt_lit - shift(41), // prodId - shift(42), // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S37 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - shift(40), // tokId - nil, // ":" - reduce(33), // ";", reduce: SyntaxBody - nil, // regDefId - nil, // ignoredTokId - reduce(33), // "|", reduce: SyntaxBody - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - shift(90), // g_sdt_lit - shift(41), // prodId - shift(42), // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S38 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - reduce(37), // ";", reduce: SyntaxBody - nil, // regDefId - nil, // ignoredTokId - reduce(37), // "|", reduce: SyntaxBody - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S39 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - reduce(38), // tokId, reduce: Symbols - nil, // ":" - reduce(38), // ";", reduce: Symbols - nil, // regDefId - nil, // ignoredTokId - reduce(38), // "|", reduce: Symbols - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - reduce(38), // g_sdt_lit, reduce: Symbols - reduce(38), // prodId, reduce: Symbols - reduce(38), // string_lit, reduce: Symbols - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S40 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - reduce(41), // tokId, reduce: Symbol - nil, // ":" - reduce(41), // ";", reduce: Symbol - nil, // regDefId - nil, // ignoredTokId - reduce(41), // "|", reduce: Symbol - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - reduce(41), // g_sdt_lit, reduce: Symbol - reduce(41), // prodId, reduce: Symbol - reduce(41), // string_lit, reduce: Symbol - shift(91), // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S41 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - reduce(40), // tokId, reduce: Symbol - nil, // ":" - reduce(40), // ";", reduce: Symbol - nil, // regDefId - nil, // ignoredTokId - reduce(40), // "|", reduce: Symbol - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - reduce(40), // g_sdt_lit, reduce: Symbol - reduce(40), // prodId, reduce: Symbol - reduce(40), // string_lit, reduce: Symbol - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S42 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - reduce(42), // tokId, reduce: Symbol - nil, // ":" - reduce(42), // ";", reduce: Symbol - nil, // regDefId - nil, // ignoredTokId - reduce(42), // "|", reduce: Symbol - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - reduce(42), // g_sdt_lit, reduce: Symbol - reduce(42), // prodId, reduce: Symbol - reduce(42), // string_lit, reduce: Symbol - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S43 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - reduce(44), // tokId, reduce: ErrorSymbol - nil, // ":" - reduce(44), // ";", reduce: ErrorSymbol - nil, // regDefId - nil, // ignoredTokId - reduce(44), // "|", reduce: ErrorSymbol - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - reduce(44), // g_sdt_lit, reduce: ErrorSymbol - reduce(44), // prodId, reduce: ErrorSymbol - reduce(44), // string_lit, reduce: ErrorSymbol - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S44 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - reduce(45), // tokId, reduce: ErrorSymbol - nil, // ":" - reduce(45), // ";", reduce: ErrorSymbol - nil, // regDefId - nil, // ignoredTokId - reduce(45), // "|", reduce: ErrorSymbol - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - reduce(45), // g_sdt_lit, reduce: ErrorSymbol - reduce(45), // prodId, reduce: ErrorSymbol - reduce(45), // string_lit, reduce: ErrorSymbol - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S45 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - reduce(46), // ";", reduce: EpsilonSymbol - nil, // regDefId - nil, // ignoredTokId - reduce(46), // "|", reduce: EpsilonSymbol - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S46 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - reduce(47), // ";", reduce: EpsilonSymbol - nil, // regDefId - nil, // ignoredTokId - reduce(47), // "|", reduce: EpsilonSymbol - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S47 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - reduce(7), // Ω, reduce: LexProduction - reduce(7), // tokId, reduce: LexProduction - nil, // ":" - nil, // ";" - reduce(7), // regDefId, reduce: LexProduction - reduce(7), // ignoredTokId, reduce: LexProduction - nil, // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - reduce(7), // g_sdt_lit, reduce: LexProduction - reduce(7), // prodId, reduce: LexProduction - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S48 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - shift(25), // regDefId - nil, // ignoredTokId - nil, // "|" - shift(26), // "." - shift(27), // char_lit - nil, // "-" - shift(28), // "~" - shift(29), // "(" - nil, // ")" - shift(30), // "[" - nil, // "]" - shift(31), // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S49 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - reduce(13), // ";", reduce: LexAlt - reduce(13), // regDefId, reduce: LexAlt - nil, // ignoredTokId - reduce(13), // "|", reduce: LexAlt - reduce(13), // ".", reduce: LexAlt - reduce(13), // char_lit, reduce: LexAlt - nil, // "-" - reduce(13), // "~", reduce: LexAlt - reduce(13), // "(", reduce: LexAlt - nil, // ")" - reduce(13), // "[", reduce: LexAlt - nil, // "]" - reduce(13), // "{", reduce: LexAlt - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S50 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - shift(93), // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S51 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - reduce(17), // ";", reduce: LexTerm - reduce(17), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(17), // "|", reduce: LexTerm - reduce(17), // ".", reduce: LexTerm - reduce(17), // char_lit, reduce: LexTerm - nil, // "-" - reduce(17), // "~", reduce: LexTerm - reduce(17), // "(", reduce: LexTerm - nil, // ")" - reduce(17), // "[", reduce: LexTerm - nil, // "]" - reduce(17), // "{", reduce: LexTerm - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S52 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - shift(94), // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S53 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - shift(95), // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - shift(96), // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S54 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - shift(56), // regDefId - nil, // ignoredTokId - reduce(10), // "|", reduce: LexPattern - shift(57), // "." - shift(58), // char_lit - nil, // "-" - shift(59), // "~" - shift(60), // "(" - reduce(10), // ")", reduce: LexPattern - shift(61), // "[" - nil, // "]" - shift(62), // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S55 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(12), // regDefId, reduce: LexAlt - nil, // ignoredTokId - reduce(12), // "|", reduce: LexAlt - reduce(12), // ".", reduce: LexAlt - reduce(12), // char_lit, reduce: LexAlt - nil, // "-" - reduce(12), // "~", reduce: LexAlt - reduce(12), // "(", reduce: LexAlt - reduce(12), // ")", reduce: LexAlt - reduce(12), // "[", reduce: LexAlt - nil, // "]" - reduce(12), // "{", reduce: LexAlt - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S56 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(19), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(19), // "|", reduce: LexTerm - reduce(19), // ".", reduce: LexTerm - reduce(19), // char_lit, reduce: LexTerm - nil, // "-" - reduce(19), // "~", reduce: LexTerm - reduce(19), // "(", reduce: LexTerm - reduce(19), // ")", reduce: LexTerm - reduce(19), // "[", reduce: LexTerm - nil, // "]" - reduce(19), // "{", reduce: LexTerm - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S57 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(14), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(14), // "|", reduce: LexTerm - reduce(14), // ".", reduce: LexTerm - reduce(14), // char_lit, reduce: LexTerm - nil, // "-" - reduce(14), // "~", reduce: LexTerm - reduce(14), // "(", reduce: LexTerm - reduce(14), // ")", reduce: LexTerm - reduce(14), // "[", reduce: LexTerm - nil, // "]" - reduce(14), // "{", reduce: LexTerm - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S58 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(15), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(15), // "|", reduce: LexTerm - reduce(15), // ".", reduce: LexTerm - reduce(15), // char_lit, reduce: LexTerm - shift(98), // "-" - reduce(15), // "~", reduce: LexTerm - reduce(15), // "(", reduce: LexTerm - reduce(15), // ")", reduce: LexTerm - reduce(15), // "[", reduce: LexTerm - nil, // "]" - reduce(15), // "{", reduce: LexTerm - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S59 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - shift(99), // char_lit - nil, // "-" - nil, // "~" - shift(100), // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S60 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - shift(56), // regDefId - nil, // ignoredTokId - nil, // "|" - shift(57), // "." - shift(58), // char_lit - nil, // "-" - shift(59), // "~" - shift(60), // "(" - nil, // ")" - shift(61), // "[" - nil, // "]" - shift(62), // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S61 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - shift(66), // regDefId - nil, // ignoredTokId - nil, // "|" - shift(67), // "." - shift(68), // char_lit - nil, // "-" - shift(69), // "~" - shift(70), // "(" - nil, // ")" - shift(71), // "[" - nil, // "]" - shift(72), // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S62 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - shift(76), // regDefId - nil, // ignoredTokId - nil, // "|" - shift(77), // "." - shift(78), // char_lit - nil, // "-" - shift(79), // "~" - shift(80), // "(" - nil, // ")" - shift(81), // "[" - nil, // "]" - shift(82), // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S63 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - shift(104), // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - shift(105), // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S64 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - shift(66), // regDefId - nil, // ignoredTokId - reduce(10), // "|", reduce: LexPattern - shift(67), // "." - shift(68), // char_lit - nil, // "-" - shift(69), // "~" - shift(70), // "(" - nil, // ")" - shift(71), // "[" - reduce(10), // "]", reduce: LexPattern - shift(72), // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S65 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(12), // regDefId, reduce: LexAlt - nil, // ignoredTokId - reduce(12), // "|", reduce: LexAlt - reduce(12), // ".", reduce: LexAlt - reduce(12), // char_lit, reduce: LexAlt - nil, // "-" - reduce(12), // "~", reduce: LexAlt - reduce(12), // "(", reduce: LexAlt - nil, // ")" - reduce(12), // "[", reduce: LexAlt - reduce(12), // "]", reduce: LexAlt - reduce(12), // "{", reduce: LexAlt - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S66 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(19), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(19), // "|", reduce: LexTerm - reduce(19), // ".", reduce: LexTerm - reduce(19), // char_lit, reduce: LexTerm - nil, // "-" - reduce(19), // "~", reduce: LexTerm - reduce(19), // "(", reduce: LexTerm - nil, // ")" - reduce(19), // "[", reduce: LexTerm - reduce(19), // "]", reduce: LexTerm - reduce(19), // "{", reduce: LexTerm - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S67 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(14), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(14), // "|", reduce: LexTerm - reduce(14), // ".", reduce: LexTerm - reduce(14), // char_lit, reduce: LexTerm - nil, // "-" - reduce(14), // "~", reduce: LexTerm - reduce(14), // "(", reduce: LexTerm - nil, // ")" - reduce(14), // "[", reduce: LexTerm - reduce(14), // "]", reduce: LexTerm - reduce(14), // "{", reduce: LexTerm - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S68 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(15), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(15), // "|", reduce: LexTerm - reduce(15), // ".", reduce: LexTerm - reduce(15), // char_lit, reduce: LexTerm - shift(107), // "-" - reduce(15), // "~", reduce: LexTerm - reduce(15), // "(", reduce: LexTerm - nil, // ")" - reduce(15), // "[", reduce: LexTerm - reduce(15), // "]", reduce: LexTerm - reduce(15), // "{", reduce: LexTerm - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S69 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - shift(108), // char_lit - nil, // "-" - nil, // "~" - shift(109), // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S70 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - shift(56), // regDefId - nil, // ignoredTokId - nil, // "|" - shift(57), // "." - shift(58), // char_lit - nil, // "-" - shift(59), // "~" - shift(60), // "(" - nil, // ")" - shift(61), // "[" - nil, // "]" - shift(62), // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S71 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - shift(66), // regDefId - nil, // ignoredTokId - nil, // "|" - shift(67), // "." - shift(68), // char_lit - nil, // "-" - shift(69), // "~" - shift(70), // "(" - nil, // ")" - shift(71), // "[" - nil, // "]" - shift(72), // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S72 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - shift(76), // regDefId - nil, // ignoredTokId - nil, // "|" - shift(77), // "." - shift(78), // char_lit - nil, // "-" - shift(79), // "~" - shift(80), // "(" - nil, // ")" - shift(81), // "[" - nil, // "]" - shift(82), // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S73 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - shift(113), // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - shift(114), // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S74 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - shift(76), // regDefId - nil, // ignoredTokId - reduce(10), // "|", reduce: LexPattern - shift(77), // "." - shift(78), // char_lit - nil, // "-" - shift(79), // "~" - shift(80), // "(" - nil, // ")" - shift(81), // "[" - nil, // "]" - shift(82), // "{" - reduce(10), // "}", reduce: LexPattern - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S75 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(12), // regDefId, reduce: LexAlt - nil, // ignoredTokId - reduce(12), // "|", reduce: LexAlt - reduce(12), // ".", reduce: LexAlt - reduce(12), // char_lit, reduce: LexAlt - nil, // "-" - reduce(12), // "~", reduce: LexAlt - reduce(12), // "(", reduce: LexAlt - nil, // ")" - reduce(12), // "[", reduce: LexAlt - nil, // "]" - reduce(12), // "{", reduce: LexAlt - reduce(12), // "}", reduce: LexAlt - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S76 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(19), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(19), // "|", reduce: LexTerm - reduce(19), // ".", reduce: LexTerm - reduce(19), // char_lit, reduce: LexTerm - nil, // "-" - reduce(19), // "~", reduce: LexTerm - reduce(19), // "(", reduce: LexTerm - nil, // ")" - reduce(19), // "[", reduce: LexTerm - nil, // "]" - reduce(19), // "{", reduce: LexTerm - reduce(19), // "}", reduce: LexTerm - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S77 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(14), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(14), // "|", reduce: LexTerm - reduce(14), // ".", reduce: LexTerm - reduce(14), // char_lit, reduce: LexTerm - nil, // "-" - reduce(14), // "~", reduce: LexTerm - reduce(14), // "(", reduce: LexTerm - nil, // ")" - reduce(14), // "[", reduce: LexTerm - nil, // "]" - reduce(14), // "{", reduce: LexTerm - reduce(14), // "}", reduce: LexTerm - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S78 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(15), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(15), // "|", reduce: LexTerm - reduce(15), // ".", reduce: LexTerm - reduce(15), // char_lit, reduce: LexTerm - shift(116), // "-" - reduce(15), // "~", reduce: LexTerm - reduce(15), // "(", reduce: LexTerm - nil, // ")" - reduce(15), // "[", reduce: LexTerm - nil, // "]" - reduce(15), // "{", reduce: LexTerm - reduce(15), // "}", reduce: LexTerm - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S79 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - shift(117), // char_lit - nil, // "-" - nil, // "~" - shift(118), // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S80 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - shift(56), // regDefId - nil, // ignoredTokId - nil, // "|" - shift(57), // "." - shift(58), // char_lit - nil, // "-" - shift(59), // "~" - shift(60), // "(" - nil, // ")" - shift(61), // "[" - nil, // "]" - shift(62), // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S81 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - shift(66), // regDefId - nil, // ignoredTokId - nil, // "|" - shift(67), // "." - shift(68), // char_lit - nil, // "-" - shift(69), // "~" - shift(70), // "(" - nil, // ")" - shift(71), // "[" - nil, // "]" - shift(72), // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S82 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - shift(76), // regDefId - nil, // ignoredTokId - nil, // "|" - shift(77), // "." - shift(78), // char_lit - nil, // "-" - shift(79), // "~" - shift(80), // "(" - nil, // ")" - shift(81), // "[" - nil, // "]" - shift(82), // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S83 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - reduce(8), // Ω, reduce: LexProduction - reduce(8), // tokId, reduce: LexProduction - nil, // ":" - nil, // ";" - reduce(8), // regDefId, reduce: LexProduction - reduce(8), // ignoredTokId, reduce: LexProduction - nil, // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - reduce(8), // g_sdt_lit, reduce: LexProduction - reduce(8), // prodId, reduce: LexProduction - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S84 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - reduce(9), // Ω, reduce: LexProduction - reduce(9), // tokId, reduce: LexProduction - nil, // ":" - nil, // ";" - reduce(9), // regDefId, reduce: LexProduction - reduce(9), // ignoredTokId, reduce: LexProduction - nil, // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - reduce(9), // g_sdt_lit, reduce: LexProduction - reduce(9), // prodId, reduce: LexProduction - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S85 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - reduce(28), // Ω, reduce: SyntaxProduction - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - reduce(28), // prodId, reduce: SyntaxProduction - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S86 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - shift(40), // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - shift(41), // prodId - shift(42), // string_lit - nil, // g_ctxdep_lit - shift(43), // "error" - shift(44), // "λ" - shift(45), // "empty" - shift(46), // "ε" - }, - }, - actionRow{ // S87 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - reduce(39), // tokId, reduce: Symbols - nil, // ":" - reduce(39), // ";", reduce: Symbols - nil, // regDefId - nil, // ignoredTokId - reduce(39), // "|", reduce: Symbols - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - reduce(39), // g_sdt_lit, reduce: Symbols - reduce(39), // prodId, reduce: Symbols - reduce(39), // string_lit, reduce: Symbols - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S88 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - reduce(32), // ";", reduce: SyntaxBody - nil, // regDefId - nil, // ignoredTokId - reduce(32), // "|", reduce: SyntaxBody - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S89 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - shift(40), // tokId - nil, // ":" - reduce(34), // ";", reduce: SyntaxBody - nil, // regDefId - nil, // ignoredTokId - reduce(34), // "|", reduce: SyntaxBody - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - shift(123), // g_sdt_lit - shift(41), // prodId - shift(42), // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S90 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - reduce(36), // ";", reduce: SyntaxBody - nil, // regDefId - nil, // ignoredTokId - reduce(36), // "|", reduce: SyntaxBody - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S91 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - reduce(43), // tokId, reduce: Symbol - nil, // ":" - reduce(43), // ";", reduce: Symbol - nil, // regDefId - nil, // ignoredTokId - reduce(43), // "|", reduce: Symbol - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - reduce(43), // g_sdt_lit, reduce: Symbol - reduce(43), // prodId, reduce: Symbol - reduce(43), // string_lit, reduce: Symbol - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S92 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - reduce(11), // ";", reduce: LexPattern - shift(25), // regDefId - nil, // ignoredTokId - reduce(11), // "|", reduce: LexPattern - shift(26), // "." - shift(27), // char_lit - nil, // "-" - shift(28), // "~" - shift(29), // "(" - nil, // ")" - shift(30), // "[" - nil, // "]" - shift(31), // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S93 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - reduce(16), // ";", reduce: LexTerm - reduce(16), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(16), // "|", reduce: LexTerm - reduce(16), // ".", reduce: LexTerm - reduce(16), // char_lit, reduce: LexTerm - nil, // "-" - reduce(16), // "~", reduce: LexTerm - reduce(16), // "(", reduce: LexTerm - nil, // ")" - reduce(16), // "[", reduce: LexTerm - nil, // "]" - reduce(16), // "{", reduce: LexTerm - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S94 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - nil, // char_lit - shift(124), // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S95 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - shift(56), // regDefId - nil, // ignoredTokId - nil, // "|" - shift(57), // "." - shift(58), // char_lit - nil, // "-" - shift(59), // "~" - shift(60), // "(" - nil, // ")" - shift(61), // "[" - nil, // "]" - shift(62), // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S96 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - reduce(22), // ";", reduce: LexTerm - reduce(22), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(22), // "|", reduce: LexTerm - reduce(22), // ".", reduce: LexTerm - reduce(22), // char_lit, reduce: LexTerm - nil, // "-" - reduce(22), // "~", reduce: LexTerm - reduce(22), // "(", reduce: LexTerm - nil, // ")" - reduce(22), // "[", reduce: LexTerm - nil, // "]" - reduce(22), // "{", reduce: LexTerm - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S97 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(13), // regDefId, reduce: LexAlt - nil, // ignoredTokId - reduce(13), // "|", reduce: LexAlt - reduce(13), // ".", reduce: LexAlt - reduce(13), // char_lit, reduce: LexAlt - nil, // "-" - reduce(13), // "~", reduce: LexAlt - reduce(13), // "(", reduce: LexAlt - reduce(13), // ")", reduce: LexAlt - reduce(13), // "[", reduce: LexAlt - nil, // "]" - reduce(13), // "{", reduce: LexAlt - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S98 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - shift(126), // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S99 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(17), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(17), // "|", reduce: LexTerm - reduce(17), // ".", reduce: LexTerm - reduce(17), // char_lit, reduce: LexTerm - nil, // "-" - reduce(17), // "~", reduce: LexTerm - reduce(17), // "(", reduce: LexTerm - reduce(17), // ")", reduce: LexTerm - reduce(17), // "[", reduce: LexTerm - nil, // "]" - reduce(17), // "{", reduce: LexTerm - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S100 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - shift(127), // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S101 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - shift(95), // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - shift(128), // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S102 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - shift(104), // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - shift(129), // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S103 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - shift(113), // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - shift(130), // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S104 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - shift(66), // regDefId - nil, // ignoredTokId - nil, // "|" - shift(67), // "." - shift(68), // char_lit - nil, // "-" - shift(69), // "~" - shift(70), // "(" - nil, // ")" - shift(71), // "[" - nil, // "]" - shift(72), // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S105 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - reduce(20), // ";", reduce: LexTerm - reduce(20), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(20), // "|", reduce: LexTerm - reduce(20), // ".", reduce: LexTerm - reduce(20), // char_lit, reduce: LexTerm - nil, // "-" - reduce(20), // "~", reduce: LexTerm - reduce(20), // "(", reduce: LexTerm - nil, // ")" - reduce(20), // "[", reduce: LexTerm - nil, // "]" - reduce(20), // "{", reduce: LexTerm - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S106 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(13), // regDefId, reduce: LexAlt - nil, // ignoredTokId - reduce(13), // "|", reduce: LexAlt - reduce(13), // ".", reduce: LexAlt - reduce(13), // char_lit, reduce: LexAlt - nil, // "-" - reduce(13), // "~", reduce: LexAlt - reduce(13), // "(", reduce: LexAlt - nil, // ")" - reduce(13), // "[", reduce: LexAlt - reduce(13), // "]", reduce: LexAlt - reduce(13), // "{", reduce: LexAlt - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S107 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - shift(132), // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S108 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(17), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(17), // "|", reduce: LexTerm - reduce(17), // ".", reduce: LexTerm - reduce(17), // char_lit, reduce: LexTerm - nil, // "-" - reduce(17), // "~", reduce: LexTerm - reduce(17), // "(", reduce: LexTerm - nil, // ")" - reduce(17), // "[", reduce: LexTerm - reduce(17), // "]", reduce: LexTerm - reduce(17), // "{", reduce: LexTerm - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S109 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - shift(133), // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S110 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - shift(95), // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - shift(134), // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S111 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - shift(104), // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - shift(135), // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S112 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - shift(113), // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - shift(136), // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S113 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - shift(76), // regDefId - nil, // ignoredTokId - nil, // "|" - shift(77), // "." - shift(78), // char_lit - nil, // "-" - shift(79), // "~" - shift(80), // "(" - nil, // ")" - shift(81), // "[" - nil, // "]" - shift(82), // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S114 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - reduce(21), // ";", reduce: LexTerm - reduce(21), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(21), // "|", reduce: LexTerm - reduce(21), // ".", reduce: LexTerm - reduce(21), // char_lit, reduce: LexTerm - nil, // "-" - reduce(21), // "~", reduce: LexTerm - reduce(21), // "(", reduce: LexTerm - nil, // ")" - reduce(21), // "[", reduce: LexTerm - nil, // "]" - reduce(21), // "{", reduce: LexTerm - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S115 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(13), // regDefId, reduce: LexAlt - nil, // ignoredTokId - reduce(13), // "|", reduce: LexAlt - reduce(13), // ".", reduce: LexAlt - reduce(13), // char_lit, reduce: LexAlt - nil, // "-" - reduce(13), // "~", reduce: LexAlt - reduce(13), // "(", reduce: LexAlt - nil, // ")" - reduce(13), // "[", reduce: LexAlt - nil, // "]" - reduce(13), // "{", reduce: LexAlt - reduce(13), // "}", reduce: LexAlt - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S116 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - shift(138), // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S117 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(17), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(17), // "|", reduce: LexTerm - reduce(17), // ".", reduce: LexTerm - reduce(17), // char_lit, reduce: LexTerm - nil, // "-" - reduce(17), // "~", reduce: LexTerm - reduce(17), // "(", reduce: LexTerm - nil, // ")" - reduce(17), // "[", reduce: LexTerm - nil, // "]" - reduce(17), // "{", reduce: LexTerm - reduce(17), // "}", reduce: LexTerm - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S118 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - shift(139), // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S119 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - shift(95), // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - shift(140), // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S120 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - shift(104), // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - shift(141), // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S121 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - shift(113), // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - shift(142), // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S122 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - reduce(30), // ";", reduce: Alternatives - nil, // regDefId - nil, // ignoredTokId - reduce(30), // "|", reduce: Alternatives - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S123 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - reduce(35), // ";", reduce: SyntaxBody - nil, // regDefId - nil, // ignoredTokId - reduce(35), // "|", reduce: SyntaxBody - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S124 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - shift(143), // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S125 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - shift(56), // regDefId - nil, // ignoredTokId - reduce(11), // "|", reduce: LexPattern - shift(57), // "." - shift(58), // char_lit - nil, // "-" - shift(59), // "~" - shift(60), // "(" - reduce(11), // ")", reduce: LexPattern - shift(61), // "[" - nil, // "]" - shift(62), // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S126 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(16), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(16), // "|", reduce: LexTerm - reduce(16), // ".", reduce: LexTerm - reduce(16), // char_lit, reduce: LexTerm - nil, // "-" - reduce(16), // "~", reduce: LexTerm - reduce(16), // "(", reduce: LexTerm - reduce(16), // ")", reduce: LexTerm - reduce(16), // "[", reduce: LexTerm - nil, // "]" - reduce(16), // "{", reduce: LexTerm - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S127 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - nil, // char_lit - shift(144), // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S128 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(22), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(22), // "|", reduce: LexTerm - reduce(22), // ".", reduce: LexTerm - reduce(22), // char_lit, reduce: LexTerm - nil, // "-" - reduce(22), // "~", reduce: LexTerm - reduce(22), // "(", reduce: LexTerm - reduce(22), // ")", reduce: LexTerm - reduce(22), // "[", reduce: LexTerm - nil, // "]" - reduce(22), // "{", reduce: LexTerm - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S129 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(20), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(20), // "|", reduce: LexTerm - reduce(20), // ".", reduce: LexTerm - reduce(20), // char_lit, reduce: LexTerm - nil, // "-" - reduce(20), // "~", reduce: LexTerm - reduce(20), // "(", reduce: LexTerm - reduce(20), // ")", reduce: LexTerm - reduce(20), // "[", reduce: LexTerm - nil, // "]" - reduce(20), // "{", reduce: LexTerm - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S130 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(21), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(21), // "|", reduce: LexTerm - reduce(21), // ".", reduce: LexTerm - reduce(21), // char_lit, reduce: LexTerm - nil, // "-" - reduce(21), // "~", reduce: LexTerm - reduce(21), // "(", reduce: LexTerm - reduce(21), // ")", reduce: LexTerm - reduce(21), // "[", reduce: LexTerm - nil, // "]" - reduce(21), // "{", reduce: LexTerm - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S131 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - shift(66), // regDefId - nil, // ignoredTokId - reduce(11), // "|", reduce: LexPattern - shift(67), // "." - shift(68), // char_lit - nil, // "-" - shift(69), // "~" - shift(70), // "(" - nil, // ")" - shift(71), // "[" - reduce(11), // "]", reduce: LexPattern - shift(72), // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S132 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(16), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(16), // "|", reduce: LexTerm - reduce(16), // ".", reduce: LexTerm - reduce(16), // char_lit, reduce: LexTerm - nil, // "-" - reduce(16), // "~", reduce: LexTerm - reduce(16), // "(", reduce: LexTerm - nil, // ")" - reduce(16), // "[", reduce: LexTerm - reduce(16), // "]", reduce: LexTerm - reduce(16), // "{", reduce: LexTerm - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S133 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - nil, // char_lit - shift(145), // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S134 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(22), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(22), // "|", reduce: LexTerm - reduce(22), // ".", reduce: LexTerm - reduce(22), // char_lit, reduce: LexTerm - nil, // "-" - reduce(22), // "~", reduce: LexTerm - reduce(22), // "(", reduce: LexTerm - nil, // ")" - reduce(22), // "[", reduce: LexTerm - reduce(22), // "]", reduce: LexTerm - reduce(22), // "{", reduce: LexTerm - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S135 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(20), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(20), // "|", reduce: LexTerm - reduce(20), // ".", reduce: LexTerm - reduce(20), // char_lit, reduce: LexTerm - nil, // "-" - reduce(20), // "~", reduce: LexTerm - reduce(20), // "(", reduce: LexTerm - nil, // ")" - reduce(20), // "[", reduce: LexTerm - reduce(20), // "]", reduce: LexTerm - reduce(20), // "{", reduce: LexTerm - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S136 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(21), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(21), // "|", reduce: LexTerm - reduce(21), // ".", reduce: LexTerm - reduce(21), // char_lit, reduce: LexTerm - nil, // "-" - reduce(21), // "~", reduce: LexTerm - reduce(21), // "(", reduce: LexTerm - nil, // ")" - reduce(21), // "[", reduce: LexTerm - reduce(21), // "]", reduce: LexTerm - reduce(21), // "{", reduce: LexTerm - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S137 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - shift(76), // regDefId - nil, // ignoredTokId - reduce(11), // "|", reduce: LexPattern - shift(77), // "." - shift(78), // char_lit - nil, // "-" - shift(79), // "~" - shift(80), // "(" - nil, // ")" - shift(81), // "[" - nil, // "]" - shift(82), // "{" - reduce(11), // "}", reduce: LexPattern - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S138 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(16), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(16), // "|", reduce: LexTerm - reduce(16), // ".", reduce: LexTerm - reduce(16), // char_lit, reduce: LexTerm - nil, // "-" - reduce(16), // "~", reduce: LexTerm - reduce(16), // "(", reduce: LexTerm - nil, // ")" - reduce(16), // "[", reduce: LexTerm - nil, // "]" - reduce(16), // "{", reduce: LexTerm - reduce(16), // "}", reduce: LexTerm - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S139 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - nil, // char_lit - shift(146), // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S140 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(22), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(22), // "|", reduce: LexTerm - reduce(22), // ".", reduce: LexTerm - reduce(22), // char_lit, reduce: LexTerm - nil, // "-" - reduce(22), // "~", reduce: LexTerm - reduce(22), // "(", reduce: LexTerm - nil, // ")" - reduce(22), // "[", reduce: LexTerm - nil, // "]" - reduce(22), // "{", reduce: LexTerm - reduce(22), // "}", reduce: LexTerm - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S141 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(20), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(20), // "|", reduce: LexTerm - reduce(20), // ".", reduce: LexTerm - reduce(20), // char_lit, reduce: LexTerm - nil, // "-" - reduce(20), // "~", reduce: LexTerm - reduce(20), // "(", reduce: LexTerm - nil, // ")" - reduce(20), // "[", reduce: LexTerm - nil, // "]" - reduce(20), // "{", reduce: LexTerm - reduce(20), // "}", reduce: LexTerm - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S142 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(21), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(21), // "|", reduce: LexTerm - reduce(21), // ".", reduce: LexTerm - reduce(21), // char_lit, reduce: LexTerm - nil, // "-" - reduce(21), // "~", reduce: LexTerm - reduce(21), // "(", reduce: LexTerm - nil, // ")" - reduce(21), // "[", reduce: LexTerm - nil, // "]" - reduce(21), // "{", reduce: LexTerm - reduce(21), // "}", reduce: LexTerm - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S143 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - shift(147), // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S144 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - shift(148), // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S145 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - shift(149), // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S146 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - shift(150), // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S147 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - reduce(18), // ";", reduce: LexTerm - reduce(18), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(18), // "|", reduce: LexTerm - reduce(18), // ".", reduce: LexTerm - reduce(18), // char_lit, reduce: LexTerm - nil, // "-" - reduce(18), // "~", reduce: LexTerm - reduce(18), // "(", reduce: LexTerm - nil, // ")" - reduce(18), // "[", reduce: LexTerm - nil, // "]" - reduce(18), // "{", reduce: LexTerm - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S148 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - shift(151), // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S149 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - shift(152), // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S150 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - shift(153), // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S151 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(18), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(18), // "|", reduce: LexTerm - reduce(18), // ".", reduce: LexTerm - reduce(18), // char_lit, reduce: LexTerm - nil, // "-" - reduce(18), // "~", reduce: LexTerm - reduce(18), // "(", reduce: LexTerm - reduce(18), // ")", reduce: LexTerm - reduce(18), // "[", reduce: LexTerm - nil, // "]" - reduce(18), // "{", reduce: LexTerm - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S152 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(18), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(18), // "|", reduce: LexTerm - reduce(18), // ".", reduce: LexTerm - reduce(18), // char_lit, reduce: LexTerm - nil, // "-" - reduce(18), // "~", reduce: LexTerm - reduce(18), // "(", reduce: LexTerm - nil, // ")" - reduce(18), // "[", reduce: LexTerm - reduce(18), // "]", reduce: LexTerm - reduce(18), // "{", reduce: LexTerm - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S153 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(18), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(18), // "|", reduce: LexTerm - reduce(18), // ".", reduce: LexTerm - reduce(18), // char_lit, reduce: LexTerm - nil, // "-" - reduce(18), // "~", reduce: LexTerm - reduce(18), // "(", reduce: LexTerm - nil, // ")" - reduce(18), // "[", reduce: LexTerm - nil, // "]" - reduce(18), // "{", reduce: LexTerm - reduce(18), // "}", reduce: LexTerm - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - }, -} +var parserActions = actions{ + table: actionTable{ + actionRow{ // S0 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + shift(9), // tokId + nil, // ":" + nil, // ";" + shift(10), // regDefId + shift(11), // ignoredTokId + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + shift(12), // g_sdt_lit + shift(13), // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S1 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + accept(true), // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S2 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(2), // Ω, reduce: Grammar + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + shift(12), // g_sdt_lit + shift(13), // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S3 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(3), // Ω, reduce: Grammar + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S4 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(4), // Ω, reduce: LexicalPart + shift(9), // tokId + nil, // ":" + nil, // ";" + shift(10), // regDefId + shift(11), // ignoredTokId + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + reduce(4), // g_sdt_lit, reduce: LexicalPart + reduce(4), // prodId, reduce: LexicalPart + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S5 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(5), // Ω, reduce: LexProductions + reduce(5), // tokId, reduce: LexProductions + nil, // ":" + nil, // ";" + reduce(5), // regDefId, reduce: LexProductions + reduce(5), // ignoredTokId, reduce: LexProductions + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + reduce(5), // g_sdt_lit, reduce: LexProductions + reduce(5), // prodId, reduce: LexProductions + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S6 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + shift(13), // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S7 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(24), // Ω, reduce: SyntaxPart + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + shift(13), // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S8 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(26), // Ω, reduce: SyntaxProdList + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + reduce(26), // prodId, reduce: SyntaxProdList + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S9 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + shift(18), // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S10 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + shift(19), // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S11 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + shift(20), // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S12 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + reduce(25), // prodId, reduce: FileHeader + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S13 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + shift(21), // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S14 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(1), // Ω, reduce: Grammar + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S15 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(6), // Ω, reduce: LexProductions + reduce(6), // tokId, reduce: LexProductions + nil, // ":" + nil, // ";" + reduce(6), // regDefId, reduce: LexProductions + reduce(6), // ignoredTokId, reduce: LexProductions + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + reduce(6), // g_sdt_lit, reduce: LexProductions + reduce(6), // prodId, reduce: LexProductions + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S16 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(23), // Ω, reduce: SyntaxPart + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + shift(13), // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S17 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(27), // Ω, reduce: SyntaxProdList + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + reduce(27), // prodId, reduce: SyntaxProdList + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S18 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + shift(25), // regDefId + nil, // ignoredTokId + nil, // "|" + shift(26), // "." + shift(27), // char_lit + nil, // "-" + shift(28), // "~" + shift(29), // "(" + nil, // ")" + shift(30), // "[" + nil, // "]" + shift(31), // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S19 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + shift(25), // regDefId + nil, // ignoredTokId + nil, // "|" + shift(26), // "." + shift(27), // char_lit + nil, // "-" + shift(28), // "~" + shift(29), // "(" + nil, // ")" + shift(30), // "[" + nil, // "]" + shift(31), // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S20 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + shift(25), // regDefId + nil, // ignoredTokId + nil, // "|" + shift(26), // "." + shift(27), // char_lit + nil, // "-" + shift(28), // "~" + shift(29), // "(" + nil, // ")" + shift(30), // "[" + nil, // "]" + shift(31), // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S21 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + shift(40), // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + shift(41), // prodId + shift(42), // string_lit + nil, // g_ctxdep_lit + shift(43), // "error" + shift(44), // "λ" + shift(45), // "empty" + shift(46), // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S22 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + shift(47), // ";" + nil, // regDefId + nil, // ignoredTokId + shift(48), // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S23 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + reduce(10), // ";", reduce: LexPattern + shift(25), // regDefId + nil, // ignoredTokId + reduce(10), // "|", reduce: LexPattern + shift(26), // "." + shift(27), // char_lit + nil, // "-" + shift(28), // "~" + shift(29), // "(" + nil, // ")" + shift(30), // "[" + nil, // "]" + shift(31), // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S24 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + reduce(12), // ";", reduce: LexAlt + reduce(12), // regDefId, reduce: LexAlt + nil, // ignoredTokId + reduce(12), // "|", reduce: LexAlt + reduce(12), // ".", reduce: LexAlt + reduce(12), // char_lit, reduce: LexAlt + nil, // "-" + reduce(12), // "~", reduce: LexAlt + reduce(12), // "(", reduce: LexAlt + nil, // ")" + reduce(12), // "[", reduce: LexAlt + nil, // "]" + reduce(12), // "{", reduce: LexAlt + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S25 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + reduce(19), // ";", reduce: LexTerm + reduce(19), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(19), // "|", reduce: LexTerm + reduce(19), // ".", reduce: LexTerm + reduce(19), // char_lit, reduce: LexTerm + nil, // "-" + reduce(19), // "~", reduce: LexTerm + reduce(19), // "(", reduce: LexTerm + nil, // ")" + reduce(19), // "[", reduce: LexTerm + nil, // "]" + reduce(19), // "{", reduce: LexTerm + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S26 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + reduce(14), // ";", reduce: LexTerm + reduce(14), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(14), // "|", reduce: LexTerm + reduce(14), // ".", reduce: LexTerm + reduce(14), // char_lit, reduce: LexTerm + nil, // "-" + reduce(14), // "~", reduce: LexTerm + reduce(14), // "(", reduce: LexTerm + nil, // ")" + reduce(14), // "[", reduce: LexTerm + nil, // "]" + reduce(14), // "{", reduce: LexTerm + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S27 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + reduce(15), // ";", reduce: LexTerm + reduce(15), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(15), // "|", reduce: LexTerm + reduce(15), // ".", reduce: LexTerm + reduce(15), // char_lit, reduce: LexTerm + shift(50), // "-" + reduce(15), // "~", reduce: LexTerm + reduce(15), // "(", reduce: LexTerm + nil, // ")" + reduce(15), // "[", reduce: LexTerm + nil, // "]" + reduce(15), // "{", reduce: LexTerm + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S28 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + shift(51), // char_lit + nil, // "-" + nil, // "~" + shift(52), // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S29 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + shift(56), // regDefId + nil, // ignoredTokId + nil, // "|" + shift(57), // "." + shift(58), // char_lit + nil, // "-" + shift(59), // "~" + shift(60), // "(" + nil, // ")" + shift(61), // "[" + nil, // "]" + shift(62), // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S30 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + shift(66), // regDefId + nil, // ignoredTokId + nil, // "|" + shift(67), // "." + shift(68), // char_lit + nil, // "-" + shift(69), // "~" + shift(70), // "(" + nil, // ")" + shift(71), // "[" + nil, // "]" + shift(72), // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S31 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + shift(76), // regDefId + nil, // ignoredTokId + nil, // "|" + shift(77), // "." + shift(78), // char_lit + nil, // "-" + shift(79), // "~" + shift(80), // "(" + nil, // ")" + shift(81), // "[" + nil, // "]" + shift(82), // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S32 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + shift(83), // ";" + nil, // regDefId + nil, // ignoredTokId + shift(48), // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S33 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + shift(84), // ";" + nil, // regDefId + nil, // ignoredTokId + shift(48), // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S34 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + shift(85), // ";" + nil, // regDefId + nil, // ignoredTokId + shift(86), // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S35 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + reduce(29), // ";", reduce: Alternatives + nil, // regDefId + nil, // ignoredTokId + reduce(29), // "|", reduce: Alternatives + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S36 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + shift(40), // tokId + nil, // ":" + reduce(31), // ";", reduce: SyntaxBody + nil, // regDefId + nil, // ignoredTokId + reduce(31), // "|", reduce: SyntaxBody + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + shift(88), // g_sdt_lit + shift(41), // prodId + shift(42), // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S37 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + shift(40), // tokId + nil, // ":" + reduce(33), // ";", reduce: SyntaxBody + nil, // regDefId + nil, // ignoredTokId + reduce(33), // "|", reduce: SyntaxBody + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + shift(90), // g_sdt_lit + shift(41), // prodId + shift(42), // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S38 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + reduce(37), // ";", reduce: SyntaxBody + nil, // regDefId + nil, // ignoredTokId + reduce(37), // "|", reduce: SyntaxBody + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S39 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + reduce(38), // tokId, reduce: Symbols + nil, // ":" + reduce(38), // ";", reduce: Symbols + nil, // regDefId + nil, // ignoredTokId + reduce(38), // "|", reduce: Symbols + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + reduce(38), // g_sdt_lit, reduce: Symbols + reduce(38), // prodId, reduce: Symbols + reduce(38), // string_lit, reduce: Symbols + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S40 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + reduce(41), // tokId, reduce: Symbol + nil, // ":" + reduce(41), // ";", reduce: Symbol + nil, // regDefId + nil, // ignoredTokId + reduce(41), // "|", reduce: Symbol + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + reduce(41), // g_sdt_lit, reduce: Symbol + reduce(41), // prodId, reduce: Symbol + reduce(41), // string_lit, reduce: Symbol + shift(91), // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S41 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + reduce(40), // tokId, reduce: Symbol + nil, // ":" + reduce(40), // ";", reduce: Symbol + nil, // regDefId + nil, // ignoredTokId + reduce(40), // "|", reduce: Symbol + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + reduce(40), // g_sdt_lit, reduce: Symbol + reduce(40), // prodId, reduce: Symbol + reduce(40), // string_lit, reduce: Symbol + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S42 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + reduce(42), // tokId, reduce: Symbol + nil, // ":" + reduce(42), // ";", reduce: Symbol + nil, // regDefId + nil, // ignoredTokId + reduce(42), // "|", reduce: Symbol + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + reduce(42), // g_sdt_lit, reduce: Symbol + reduce(42), // prodId, reduce: Symbol + reduce(42), // string_lit, reduce: Symbol + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S43 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + reduce(44), // tokId, reduce: ErrorSymbol + nil, // ":" + reduce(44), // ";", reduce: ErrorSymbol + nil, // regDefId + nil, // ignoredTokId + reduce(44), // "|", reduce: ErrorSymbol + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + reduce(44), // g_sdt_lit, reduce: ErrorSymbol + reduce(44), // prodId, reduce: ErrorSymbol + reduce(44), // string_lit, reduce: ErrorSymbol + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S44 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + reduce(45), // tokId, reduce: ErrorSymbol + nil, // ":" + reduce(45), // ";", reduce: ErrorSymbol + nil, // regDefId + nil, // ignoredTokId + reduce(45), // "|", reduce: ErrorSymbol + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + reduce(45), // g_sdt_lit, reduce: ErrorSymbol + reduce(45), // prodId, reduce: ErrorSymbol + reduce(45), // string_lit, reduce: ErrorSymbol + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S45 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + reduce(46), // ";", reduce: EpsilonSymbol + nil, // regDefId + nil, // ignoredTokId + reduce(46), // "|", reduce: EpsilonSymbol + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S46 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + reduce(47), // ";", reduce: EpsilonSymbol + nil, // regDefId + nil, // ignoredTokId + reduce(47), // "|", reduce: EpsilonSymbol + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S47 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(7), // Ω, reduce: LexProduction + reduce(7), // tokId, reduce: LexProduction + nil, // ":" + nil, // ";" + reduce(7), // regDefId, reduce: LexProduction + reduce(7), // ignoredTokId, reduce: LexProduction + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + reduce(7), // g_sdt_lit, reduce: LexProduction + reduce(7), // prodId, reduce: LexProduction + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S48 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + shift(25), // regDefId + nil, // ignoredTokId + nil, // "|" + shift(26), // "." + shift(27), // char_lit + nil, // "-" + shift(28), // "~" + shift(29), // "(" + nil, // ")" + shift(30), // "[" + nil, // "]" + shift(31), // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S49 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + reduce(13), // ";", reduce: LexAlt + reduce(13), // regDefId, reduce: LexAlt + nil, // ignoredTokId + reduce(13), // "|", reduce: LexAlt + reduce(13), // ".", reduce: LexAlt + reduce(13), // char_lit, reduce: LexAlt + nil, // "-" + reduce(13), // "~", reduce: LexAlt + reduce(13), // "(", reduce: LexAlt + nil, // ")" + reduce(13), // "[", reduce: LexAlt + nil, // "]" + reduce(13), // "{", reduce: LexAlt + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S50 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + shift(93), // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S51 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + reduce(17), // ";", reduce: LexTerm + reduce(17), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(17), // "|", reduce: LexTerm + reduce(17), // ".", reduce: LexTerm + reduce(17), // char_lit, reduce: LexTerm + nil, // "-" + reduce(17), // "~", reduce: LexTerm + reduce(17), // "(", reduce: LexTerm + nil, // ")" + reduce(17), // "[", reduce: LexTerm + nil, // "]" + reduce(17), // "{", reduce: LexTerm + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S52 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + shift(94), // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S53 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + shift(95), // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + shift(96), // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S54 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + shift(56), // regDefId + nil, // ignoredTokId + reduce(10), // "|", reduce: LexPattern + shift(57), // "." + shift(58), // char_lit + nil, // "-" + shift(59), // "~" + shift(60), // "(" + reduce(10), // ")", reduce: LexPattern + shift(61), // "[" + nil, // "]" + shift(62), // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S55 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(12), // regDefId, reduce: LexAlt + nil, // ignoredTokId + reduce(12), // "|", reduce: LexAlt + reduce(12), // ".", reduce: LexAlt + reduce(12), // char_lit, reduce: LexAlt + nil, // "-" + reduce(12), // "~", reduce: LexAlt + reduce(12), // "(", reduce: LexAlt + reduce(12), // ")", reduce: LexAlt + reduce(12), // "[", reduce: LexAlt + nil, // "]" + reduce(12), // "{", reduce: LexAlt + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S56 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(19), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(19), // "|", reduce: LexTerm + reduce(19), // ".", reduce: LexTerm + reduce(19), // char_lit, reduce: LexTerm + nil, // "-" + reduce(19), // "~", reduce: LexTerm + reduce(19), // "(", reduce: LexTerm + reduce(19), // ")", reduce: LexTerm + reduce(19), // "[", reduce: LexTerm + nil, // "]" + reduce(19), // "{", reduce: LexTerm + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S57 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(14), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(14), // "|", reduce: LexTerm + reduce(14), // ".", reduce: LexTerm + reduce(14), // char_lit, reduce: LexTerm + nil, // "-" + reduce(14), // "~", reduce: LexTerm + reduce(14), // "(", reduce: LexTerm + reduce(14), // ")", reduce: LexTerm + reduce(14), // "[", reduce: LexTerm + nil, // "]" + reduce(14), // "{", reduce: LexTerm + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S58 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(15), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(15), // "|", reduce: LexTerm + reduce(15), // ".", reduce: LexTerm + reduce(15), // char_lit, reduce: LexTerm + shift(98), // "-" + reduce(15), // "~", reduce: LexTerm + reduce(15), // "(", reduce: LexTerm + reduce(15), // ")", reduce: LexTerm + reduce(15), // "[", reduce: LexTerm + nil, // "]" + reduce(15), // "{", reduce: LexTerm + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S59 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + shift(99), // char_lit + nil, // "-" + nil, // "~" + shift(100), // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S60 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + shift(56), // regDefId + nil, // ignoredTokId + nil, // "|" + shift(57), // "." + shift(58), // char_lit + nil, // "-" + shift(59), // "~" + shift(60), // "(" + nil, // ")" + shift(61), // "[" + nil, // "]" + shift(62), // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S61 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + shift(66), // regDefId + nil, // ignoredTokId + nil, // "|" + shift(67), // "." + shift(68), // char_lit + nil, // "-" + shift(69), // "~" + shift(70), // "(" + nil, // ")" + shift(71), // "[" + nil, // "]" + shift(72), // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S62 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + shift(76), // regDefId + nil, // ignoredTokId + nil, // "|" + shift(77), // "." + shift(78), // char_lit + nil, // "-" + shift(79), // "~" + shift(80), // "(" + nil, // ")" + shift(81), // "[" + nil, // "]" + shift(82), // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S63 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + shift(104), // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + shift(105), // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S64 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + shift(66), // regDefId + nil, // ignoredTokId + reduce(10), // "|", reduce: LexPattern + shift(67), // "." + shift(68), // char_lit + nil, // "-" + shift(69), // "~" + shift(70), // "(" + nil, // ")" + shift(71), // "[" + reduce(10), // "]", reduce: LexPattern + shift(72), // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S65 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(12), // regDefId, reduce: LexAlt + nil, // ignoredTokId + reduce(12), // "|", reduce: LexAlt + reduce(12), // ".", reduce: LexAlt + reduce(12), // char_lit, reduce: LexAlt + nil, // "-" + reduce(12), // "~", reduce: LexAlt + reduce(12), // "(", reduce: LexAlt + nil, // ")" + reduce(12), // "[", reduce: LexAlt + reduce(12), // "]", reduce: LexAlt + reduce(12), // "{", reduce: LexAlt + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S66 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(19), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(19), // "|", reduce: LexTerm + reduce(19), // ".", reduce: LexTerm + reduce(19), // char_lit, reduce: LexTerm + nil, // "-" + reduce(19), // "~", reduce: LexTerm + reduce(19), // "(", reduce: LexTerm + nil, // ")" + reduce(19), // "[", reduce: LexTerm + reduce(19), // "]", reduce: LexTerm + reduce(19), // "{", reduce: LexTerm + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S67 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(14), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(14), // "|", reduce: LexTerm + reduce(14), // ".", reduce: LexTerm + reduce(14), // char_lit, reduce: LexTerm + nil, // "-" + reduce(14), // "~", reduce: LexTerm + reduce(14), // "(", reduce: LexTerm + nil, // ")" + reduce(14), // "[", reduce: LexTerm + reduce(14), // "]", reduce: LexTerm + reduce(14), // "{", reduce: LexTerm + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S68 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(15), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(15), // "|", reduce: LexTerm + reduce(15), // ".", reduce: LexTerm + reduce(15), // char_lit, reduce: LexTerm + shift(107), // "-" + reduce(15), // "~", reduce: LexTerm + reduce(15), // "(", reduce: LexTerm + nil, // ")" + reduce(15), // "[", reduce: LexTerm + reduce(15), // "]", reduce: LexTerm + reduce(15), // "{", reduce: LexTerm + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S69 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + shift(108), // char_lit + nil, // "-" + nil, // "~" + shift(109), // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S70 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + shift(56), // regDefId + nil, // ignoredTokId + nil, // "|" + shift(57), // "." + shift(58), // char_lit + nil, // "-" + shift(59), // "~" + shift(60), // "(" + nil, // ")" + shift(61), // "[" + nil, // "]" + shift(62), // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S71 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + shift(66), // regDefId + nil, // ignoredTokId + nil, // "|" + shift(67), // "." + shift(68), // char_lit + nil, // "-" + shift(69), // "~" + shift(70), // "(" + nil, // ")" + shift(71), // "[" + nil, // "]" + shift(72), // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S72 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + shift(76), // regDefId + nil, // ignoredTokId + nil, // "|" + shift(77), // "." + shift(78), // char_lit + nil, // "-" + shift(79), // "~" + shift(80), // "(" + nil, // ")" + shift(81), // "[" + nil, // "]" + shift(82), // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S73 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + shift(113), // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + shift(114), // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S74 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + shift(76), // regDefId + nil, // ignoredTokId + reduce(10), // "|", reduce: LexPattern + shift(77), // "." + shift(78), // char_lit + nil, // "-" + shift(79), // "~" + shift(80), // "(" + nil, // ")" + shift(81), // "[" + nil, // "]" + shift(82), // "{" + reduce(10), // "}", reduce: LexPattern + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S75 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(12), // regDefId, reduce: LexAlt + nil, // ignoredTokId + reduce(12), // "|", reduce: LexAlt + reduce(12), // ".", reduce: LexAlt + reduce(12), // char_lit, reduce: LexAlt + nil, // "-" + reduce(12), // "~", reduce: LexAlt + reduce(12), // "(", reduce: LexAlt + nil, // ")" + reduce(12), // "[", reduce: LexAlt + nil, // "]" + reduce(12), // "{", reduce: LexAlt + reduce(12), // "}", reduce: LexAlt + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S76 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(19), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(19), // "|", reduce: LexTerm + reduce(19), // ".", reduce: LexTerm + reduce(19), // char_lit, reduce: LexTerm + nil, // "-" + reduce(19), // "~", reduce: LexTerm + reduce(19), // "(", reduce: LexTerm + nil, // ")" + reduce(19), // "[", reduce: LexTerm + nil, // "]" + reduce(19), // "{", reduce: LexTerm + reduce(19), // "}", reduce: LexTerm + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S77 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(14), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(14), // "|", reduce: LexTerm + reduce(14), // ".", reduce: LexTerm + reduce(14), // char_lit, reduce: LexTerm + nil, // "-" + reduce(14), // "~", reduce: LexTerm + reduce(14), // "(", reduce: LexTerm + nil, // ")" + reduce(14), // "[", reduce: LexTerm + nil, // "]" + reduce(14), // "{", reduce: LexTerm + reduce(14), // "}", reduce: LexTerm + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S78 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(15), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(15), // "|", reduce: LexTerm + reduce(15), // ".", reduce: LexTerm + reduce(15), // char_lit, reduce: LexTerm + shift(116), // "-" + reduce(15), // "~", reduce: LexTerm + reduce(15), // "(", reduce: LexTerm + nil, // ")" + reduce(15), // "[", reduce: LexTerm + nil, // "]" + reduce(15), // "{", reduce: LexTerm + reduce(15), // "}", reduce: LexTerm + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S79 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + shift(117), // char_lit + nil, // "-" + nil, // "~" + shift(118), // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S80 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + shift(56), // regDefId + nil, // ignoredTokId + nil, // "|" + shift(57), // "." + shift(58), // char_lit + nil, // "-" + shift(59), // "~" + shift(60), // "(" + nil, // ")" + shift(61), // "[" + nil, // "]" + shift(62), // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S81 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + shift(66), // regDefId + nil, // ignoredTokId + nil, // "|" + shift(67), // "." + shift(68), // char_lit + nil, // "-" + shift(69), // "~" + shift(70), // "(" + nil, // ")" + shift(71), // "[" + nil, // "]" + shift(72), // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S82 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + shift(76), // regDefId + nil, // ignoredTokId + nil, // "|" + shift(77), // "." + shift(78), // char_lit + nil, // "-" + shift(79), // "~" + shift(80), // "(" + nil, // ")" + shift(81), // "[" + nil, // "]" + shift(82), // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S83 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(8), // Ω, reduce: LexProduction + reduce(8), // tokId, reduce: LexProduction + nil, // ":" + nil, // ";" + reduce(8), // regDefId, reduce: LexProduction + reduce(8), // ignoredTokId, reduce: LexProduction + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + reduce(8), // g_sdt_lit, reduce: LexProduction + reduce(8), // prodId, reduce: LexProduction + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S84 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(9), // Ω, reduce: LexProduction + reduce(9), // tokId, reduce: LexProduction + nil, // ":" + nil, // ";" + reduce(9), // regDefId, reduce: LexProduction + reduce(9), // ignoredTokId, reduce: LexProduction + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + reduce(9), // g_sdt_lit, reduce: LexProduction + reduce(9), // prodId, reduce: LexProduction + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S85 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(28), // Ω, reduce: SyntaxProduction + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + reduce(28), // prodId, reduce: SyntaxProduction + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S86 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + shift(40), // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + shift(41), // prodId + shift(42), // string_lit + nil, // g_ctxdep_lit + shift(43), // "error" + shift(44), // "λ" + shift(45), // "empty" + shift(46), // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S87 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + reduce(39), // tokId, reduce: Symbols + nil, // ":" + reduce(39), // ";", reduce: Symbols + nil, // regDefId + nil, // ignoredTokId + reduce(39), // "|", reduce: Symbols + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + reduce(39), // g_sdt_lit, reduce: Symbols + reduce(39), // prodId, reduce: Symbols + reduce(39), // string_lit, reduce: Symbols + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S88 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + reduce(32), // ";", reduce: SyntaxBody + nil, // regDefId + nil, // ignoredTokId + reduce(32), // "|", reduce: SyntaxBody + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S89 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + shift(40), // tokId + nil, // ":" + reduce(34), // ";", reduce: SyntaxBody + nil, // regDefId + nil, // ignoredTokId + reduce(34), // "|", reduce: SyntaxBody + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + shift(123), // g_sdt_lit + shift(41), // prodId + shift(42), // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S90 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + reduce(36), // ";", reduce: SyntaxBody + nil, // regDefId + nil, // ignoredTokId + reduce(36), // "|", reduce: SyntaxBody + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S91 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + reduce(43), // tokId, reduce: Symbol + nil, // ":" + reduce(43), // ";", reduce: Symbol + nil, // regDefId + nil, // ignoredTokId + reduce(43), // "|", reduce: Symbol + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + reduce(43), // g_sdt_lit, reduce: Symbol + reduce(43), // prodId, reduce: Symbol + reduce(43), // string_lit, reduce: Symbol + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S92 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + reduce(11), // ";", reduce: LexPattern + shift(25), // regDefId + nil, // ignoredTokId + reduce(11), // "|", reduce: LexPattern + shift(26), // "." + shift(27), // char_lit + nil, // "-" + shift(28), // "~" + shift(29), // "(" + nil, // ")" + shift(30), // "[" + nil, // "]" + shift(31), // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S93 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + reduce(16), // ";", reduce: LexTerm + reduce(16), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(16), // "|", reduce: LexTerm + reduce(16), // ".", reduce: LexTerm + reduce(16), // char_lit, reduce: LexTerm + nil, // "-" + reduce(16), // "~", reduce: LexTerm + reduce(16), // "(", reduce: LexTerm + nil, // ")" + reduce(16), // "[", reduce: LexTerm + nil, // "]" + reduce(16), // "{", reduce: LexTerm + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S94 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + nil, // char_lit + shift(124), // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S95 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + shift(56), // regDefId + nil, // ignoredTokId + nil, // "|" + shift(57), // "." + shift(58), // char_lit + nil, // "-" + shift(59), // "~" + shift(60), // "(" + nil, // ")" + shift(61), // "[" + nil, // "]" + shift(62), // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S96 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + reduce(22), // ";", reduce: LexTerm + reduce(22), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(22), // "|", reduce: LexTerm + reduce(22), // ".", reduce: LexTerm + reduce(22), // char_lit, reduce: LexTerm + nil, // "-" + reduce(22), // "~", reduce: LexTerm + reduce(22), // "(", reduce: LexTerm + nil, // ")" + reduce(22), // "[", reduce: LexTerm + nil, // "]" + reduce(22), // "{", reduce: LexTerm + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S97 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(13), // regDefId, reduce: LexAlt + nil, // ignoredTokId + reduce(13), // "|", reduce: LexAlt + reduce(13), // ".", reduce: LexAlt + reduce(13), // char_lit, reduce: LexAlt + nil, // "-" + reduce(13), // "~", reduce: LexAlt + reduce(13), // "(", reduce: LexAlt + reduce(13), // ")", reduce: LexAlt + reduce(13), // "[", reduce: LexAlt + nil, // "]" + reduce(13), // "{", reduce: LexAlt + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S98 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + shift(126), // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S99 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(17), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(17), // "|", reduce: LexTerm + reduce(17), // ".", reduce: LexTerm + reduce(17), // char_lit, reduce: LexTerm + nil, // "-" + reduce(17), // "~", reduce: LexTerm + reduce(17), // "(", reduce: LexTerm + reduce(17), // ")", reduce: LexTerm + reduce(17), // "[", reduce: LexTerm + nil, // "]" + reduce(17), // "{", reduce: LexTerm + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S100 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + shift(127), // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S101 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + shift(95), // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + shift(128), // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S102 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + shift(104), // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + shift(129), // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S103 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + shift(113), // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + shift(130), // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S104 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + shift(66), // regDefId + nil, // ignoredTokId + nil, // "|" + shift(67), // "." + shift(68), // char_lit + nil, // "-" + shift(69), // "~" + shift(70), // "(" + nil, // ")" + shift(71), // "[" + nil, // "]" + shift(72), // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S105 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + reduce(20), // ";", reduce: LexTerm + reduce(20), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(20), // "|", reduce: LexTerm + reduce(20), // ".", reduce: LexTerm + reduce(20), // char_lit, reduce: LexTerm + nil, // "-" + reduce(20), // "~", reduce: LexTerm + reduce(20), // "(", reduce: LexTerm + nil, // ")" + reduce(20), // "[", reduce: LexTerm + nil, // "]" + reduce(20), // "{", reduce: LexTerm + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S106 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(13), // regDefId, reduce: LexAlt + nil, // ignoredTokId + reduce(13), // "|", reduce: LexAlt + reduce(13), // ".", reduce: LexAlt + reduce(13), // char_lit, reduce: LexAlt + nil, // "-" + reduce(13), // "~", reduce: LexAlt + reduce(13), // "(", reduce: LexAlt + nil, // ")" + reduce(13), // "[", reduce: LexAlt + reduce(13), // "]", reduce: LexAlt + reduce(13), // "{", reduce: LexAlt + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S107 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + shift(132), // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S108 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(17), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(17), // "|", reduce: LexTerm + reduce(17), // ".", reduce: LexTerm + reduce(17), // char_lit, reduce: LexTerm + nil, // "-" + reduce(17), // "~", reduce: LexTerm + reduce(17), // "(", reduce: LexTerm + nil, // ")" + reduce(17), // "[", reduce: LexTerm + reduce(17), // "]", reduce: LexTerm + reduce(17), // "{", reduce: LexTerm + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S109 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + shift(133), // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S110 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + shift(95), // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + shift(134), // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S111 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + shift(104), // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + shift(135), // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S112 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + shift(113), // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + shift(136), // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S113 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + shift(76), // regDefId + nil, // ignoredTokId + nil, // "|" + shift(77), // "." + shift(78), // char_lit + nil, // "-" + shift(79), // "~" + shift(80), // "(" + nil, // ")" + shift(81), // "[" + nil, // "]" + shift(82), // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S114 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + reduce(21), // ";", reduce: LexTerm + reduce(21), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(21), // "|", reduce: LexTerm + reduce(21), // ".", reduce: LexTerm + reduce(21), // char_lit, reduce: LexTerm + nil, // "-" + reduce(21), // "~", reduce: LexTerm + reduce(21), // "(", reduce: LexTerm + nil, // ")" + reduce(21), // "[", reduce: LexTerm + nil, // "]" + reduce(21), // "{", reduce: LexTerm + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S115 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(13), // regDefId, reduce: LexAlt + nil, // ignoredTokId + reduce(13), // "|", reduce: LexAlt + reduce(13), // ".", reduce: LexAlt + reduce(13), // char_lit, reduce: LexAlt + nil, // "-" + reduce(13), // "~", reduce: LexAlt + reduce(13), // "(", reduce: LexAlt + nil, // ")" + reduce(13), // "[", reduce: LexAlt + nil, // "]" + reduce(13), // "{", reduce: LexAlt + reduce(13), // "}", reduce: LexAlt + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S116 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + shift(138), // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S117 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(17), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(17), // "|", reduce: LexTerm + reduce(17), // ".", reduce: LexTerm + reduce(17), // char_lit, reduce: LexTerm + nil, // "-" + reduce(17), // "~", reduce: LexTerm + reduce(17), // "(", reduce: LexTerm + nil, // ")" + reduce(17), // "[", reduce: LexTerm + nil, // "]" + reduce(17), // "{", reduce: LexTerm + reduce(17), // "}", reduce: LexTerm + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S118 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + shift(139), // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S119 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + shift(95), // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + shift(140), // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S120 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + shift(104), // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + shift(141), // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S121 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + shift(113), // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + shift(142), // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S122 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + reduce(30), // ";", reduce: Alternatives + nil, // regDefId + nil, // ignoredTokId + reduce(30), // "|", reduce: Alternatives + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S123 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + reduce(35), // ";", reduce: SyntaxBody + nil, // regDefId + nil, // ignoredTokId + reduce(35), // "|", reduce: SyntaxBody + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S124 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + shift(143), // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S125 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + shift(56), // regDefId + nil, // ignoredTokId + reduce(11), // "|", reduce: LexPattern + shift(57), // "." + shift(58), // char_lit + nil, // "-" + shift(59), // "~" + shift(60), // "(" + reduce(11), // ")", reduce: LexPattern + shift(61), // "[" + nil, // "]" + shift(62), // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S126 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(16), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(16), // "|", reduce: LexTerm + reduce(16), // ".", reduce: LexTerm + reduce(16), // char_lit, reduce: LexTerm + nil, // "-" + reduce(16), // "~", reduce: LexTerm + reduce(16), // "(", reduce: LexTerm + reduce(16), // ")", reduce: LexTerm + reduce(16), // "[", reduce: LexTerm + nil, // "]" + reduce(16), // "{", reduce: LexTerm + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S127 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + nil, // char_lit + shift(144), // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S128 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(22), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(22), // "|", reduce: LexTerm + reduce(22), // ".", reduce: LexTerm + reduce(22), // char_lit, reduce: LexTerm + nil, // "-" + reduce(22), // "~", reduce: LexTerm + reduce(22), // "(", reduce: LexTerm + reduce(22), // ")", reduce: LexTerm + reduce(22), // "[", reduce: LexTerm + nil, // "]" + reduce(22), // "{", reduce: LexTerm + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S129 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(20), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(20), // "|", reduce: LexTerm + reduce(20), // ".", reduce: LexTerm + reduce(20), // char_lit, reduce: LexTerm + nil, // "-" + reduce(20), // "~", reduce: LexTerm + reduce(20), // "(", reduce: LexTerm + reduce(20), // ")", reduce: LexTerm + reduce(20), // "[", reduce: LexTerm + nil, // "]" + reduce(20), // "{", reduce: LexTerm + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S130 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(21), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(21), // "|", reduce: LexTerm + reduce(21), // ".", reduce: LexTerm + reduce(21), // char_lit, reduce: LexTerm + nil, // "-" + reduce(21), // "~", reduce: LexTerm + reduce(21), // "(", reduce: LexTerm + reduce(21), // ")", reduce: LexTerm + reduce(21), // "[", reduce: LexTerm + nil, // "]" + reduce(21), // "{", reduce: LexTerm + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S131 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + shift(66), // regDefId + nil, // ignoredTokId + reduce(11), // "|", reduce: LexPattern + shift(67), // "." + shift(68), // char_lit + nil, // "-" + shift(69), // "~" + shift(70), // "(" + nil, // ")" + shift(71), // "[" + reduce(11), // "]", reduce: LexPattern + shift(72), // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S132 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(16), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(16), // "|", reduce: LexTerm + reduce(16), // ".", reduce: LexTerm + reduce(16), // char_lit, reduce: LexTerm + nil, // "-" + reduce(16), // "~", reduce: LexTerm + reduce(16), // "(", reduce: LexTerm + nil, // ")" + reduce(16), // "[", reduce: LexTerm + reduce(16), // "]", reduce: LexTerm + reduce(16), // "{", reduce: LexTerm + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S133 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + nil, // char_lit + shift(145), // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S134 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(22), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(22), // "|", reduce: LexTerm + reduce(22), // ".", reduce: LexTerm + reduce(22), // char_lit, reduce: LexTerm + nil, // "-" + reduce(22), // "~", reduce: LexTerm + reduce(22), // "(", reduce: LexTerm + nil, // ")" + reduce(22), // "[", reduce: LexTerm + reduce(22), // "]", reduce: LexTerm + reduce(22), // "{", reduce: LexTerm + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S135 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(20), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(20), // "|", reduce: LexTerm + reduce(20), // ".", reduce: LexTerm + reduce(20), // char_lit, reduce: LexTerm + nil, // "-" + reduce(20), // "~", reduce: LexTerm + reduce(20), // "(", reduce: LexTerm + nil, // ")" + reduce(20), // "[", reduce: LexTerm + reduce(20), // "]", reduce: LexTerm + reduce(20), // "{", reduce: LexTerm + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S136 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(21), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(21), // "|", reduce: LexTerm + reduce(21), // ".", reduce: LexTerm + reduce(21), // char_lit, reduce: LexTerm + nil, // "-" + reduce(21), // "~", reduce: LexTerm + reduce(21), // "(", reduce: LexTerm + nil, // ")" + reduce(21), // "[", reduce: LexTerm + reduce(21), // "]", reduce: LexTerm + reduce(21), // "{", reduce: LexTerm + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S137 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + shift(76), // regDefId + nil, // ignoredTokId + reduce(11), // "|", reduce: LexPattern + shift(77), // "." + shift(78), // char_lit + nil, // "-" + shift(79), // "~" + shift(80), // "(" + nil, // ")" + shift(81), // "[" + nil, // "]" + shift(82), // "{" + reduce(11), // "}", reduce: LexPattern + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S138 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(16), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(16), // "|", reduce: LexTerm + reduce(16), // ".", reduce: LexTerm + reduce(16), // char_lit, reduce: LexTerm + nil, // "-" + reduce(16), // "~", reduce: LexTerm + reduce(16), // "(", reduce: LexTerm + nil, // ")" + reduce(16), // "[", reduce: LexTerm + nil, // "]" + reduce(16), // "{", reduce: LexTerm + reduce(16), // "}", reduce: LexTerm + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S139 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + nil, // char_lit + shift(146), // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S140 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(22), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(22), // "|", reduce: LexTerm + reduce(22), // ".", reduce: LexTerm + reduce(22), // char_lit, reduce: LexTerm + nil, // "-" + reduce(22), // "~", reduce: LexTerm + reduce(22), // "(", reduce: LexTerm + nil, // ")" + reduce(22), // "[", reduce: LexTerm + nil, // "]" + reduce(22), // "{", reduce: LexTerm + reduce(22), // "}", reduce: LexTerm + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S141 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(20), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(20), // "|", reduce: LexTerm + reduce(20), // ".", reduce: LexTerm + reduce(20), // char_lit, reduce: LexTerm + nil, // "-" + reduce(20), // "~", reduce: LexTerm + reduce(20), // "(", reduce: LexTerm + nil, // ")" + reduce(20), // "[", reduce: LexTerm + nil, // "]" + reduce(20), // "{", reduce: LexTerm + reduce(20), // "}", reduce: LexTerm + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S142 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(21), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(21), // "|", reduce: LexTerm + reduce(21), // ".", reduce: LexTerm + reduce(21), // char_lit, reduce: LexTerm + nil, // "-" + reduce(21), // "~", reduce: LexTerm + reduce(21), // "(", reduce: LexTerm + nil, // ")" + reduce(21), // "[", reduce: LexTerm + nil, // "]" + reduce(21), // "{", reduce: LexTerm + reduce(21), // "}", reduce: LexTerm + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S143 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + shift(147), // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S144 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + shift(148), // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S145 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + shift(149), // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S146 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + shift(150), // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S147 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + reduce(18), // ";", reduce: LexTerm + reduce(18), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(18), // "|", reduce: LexTerm + reduce(18), // ".", reduce: LexTerm + reduce(18), // char_lit, reduce: LexTerm + nil, // "-" + reduce(18), // "~", reduce: LexTerm + reduce(18), // "(", reduce: LexTerm + nil, // ")" + reduce(18), // "[", reduce: LexTerm + nil, // "]" + reduce(18), // "{", reduce: LexTerm + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S148 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + shift(151), // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S149 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + shift(152), // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S150 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + shift(153), // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S151 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(18), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(18), // "|", reduce: LexTerm + reduce(18), // ".", reduce: LexTerm + reduce(18), // char_lit, reduce: LexTerm + nil, // "-" + reduce(18), // "~", reduce: LexTerm + reduce(18), // "(", reduce: LexTerm + reduce(18), // ")", reduce: LexTerm + reduce(18), // "[", reduce: LexTerm + nil, // "]" + reduce(18), // "{", reduce: LexTerm + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S152 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(18), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(18), // "|", reduce: LexTerm + reduce(18), // ".", reduce: LexTerm + reduce(18), // char_lit, reduce: LexTerm + nil, // "-" + reduce(18), // "~", reduce: LexTerm + reduce(18), // "(", reduce: LexTerm + nil, // ")" + reduce(18), // "[", reduce: LexTerm + reduce(18), // "]", reduce: LexTerm + reduce(18), // "{", reduce: LexTerm + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S153 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + reduce(18), // regDefId, reduce: LexTerm + nil, // ignoredTokId + reduce(18), // "|", reduce: LexTerm + reduce(18), // ".", reduce: LexTerm + reduce(18), // char_lit, reduce: LexTerm + nil, // "-" + reduce(18), // "~", reduce: LexTerm + reduce(18), // "(", reduce: LexTerm + nil, // ")" + reduce(18), // "[", reduce: LexTerm + nil, // "]" + reduce(18), // "{", reduce: LexTerm + reduce(18), // "}", reduce: LexTerm + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + }, +} diff --git a/internal/frontend/reparsed/internal/parser/gototable.go b/internal/frontend/reparsed/internal/parser/gototable.go index f9e46430..862fb55c 100644 --- a/internal/frontend/reparsed/internal/parser/gototable.go +++ b/internal/frontend/reparsed/internal/parser/gototable.go @@ -12,17 +12,17 @@ type ( var gotoTab = gotoTable{ gotoRow{ // S0 -1, // Π - 1, // Π - 2, // Π - 3, // Π - 4, // Π - 5, // Π + 1, // Π + 2, // Π + 3, // Π + 4, // Π + 5, // Π -1, // Π -1, // Π -1, // Π - 6, // Π - 7, // Π - 8, // Π + 6, // Π + 7, // Π + 8, // Π -1, // Π -1, // Π -1, // Π @@ -60,9 +60,9 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 6, // Π - 7, // Π - 8, // Π + 6, // Π + 7, // Π + 8, // Π -1, // Π -1, // Π -1, // Π @@ -142,7 +142,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π 16, // Π - 8, // Π + 8, // Π -1, // Π -1, // Π -1, // Π @@ -1211,64 +1211,64 @@ var gotoTab = gotoTable{ -1, // Π }, gotoRow{ // S60 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π 101, // Π - 54, // Π - 55, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π + 54, // Π + 55, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S61 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π 102, // Π - 64, // Π - 65, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π + 64, // Π + 65, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S62 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π 103, // Π - 74, // Π - 75, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π + 74, // Π + 75, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S63 -1, // Π @@ -1291,24 +1291,24 @@ var gotoTab = gotoTable{ -1, // Π }, gotoRow{ // S64 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π 106, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S65 -1, // Π @@ -1411,64 +1411,64 @@ var gotoTab = gotoTable{ -1, // Π }, gotoRow{ // S70 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π 110, // Π - 54, // Π - 55, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π + 54, // Π + 55, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S71 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π 111, // Π - 64, // Π - 65, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π + 64, // Π + 65, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S72 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π 112, // Π - 74, // Π - 75, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π + 74, // Π + 75, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S73 -1, // Π @@ -1491,24 +1491,24 @@ var gotoTab = gotoTable{ -1, // Π }, gotoRow{ // S74 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π 115, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S75 -1, // Π @@ -1611,64 +1611,64 @@ var gotoTab = gotoTable{ -1, // Π }, gotoRow{ // S80 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π 119, // Π - 54, // Π - 55, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π + 54, // Π + 55, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S81 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π 120, // Π - 64, // Π - 65, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π + 64, // Π + 65, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S82 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π 121, // Π - 74, // Π - 75, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π + 74, // Π + 75, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S83 -1, // Π @@ -1731,24 +1731,24 @@ var gotoTab = gotoTable{ -1, // Π }, gotoRow{ // S86 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π 122, // Π - 36, // Π - 37, // Π - 38, // Π - 39, // Π + 36, // Π + 37, // Π + 38, // Π + 39, // Π }, gotoRow{ // S87 -1, // Π @@ -1911,24 +1911,24 @@ var gotoTab = gotoTable{ -1, // Π }, gotoRow{ // S95 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π 125, // Π - 55, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π + 55, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S96 -1, // Π @@ -2091,24 +2091,24 @@ var gotoTab = gotoTable{ -1, // Π }, gotoRow{ // S104 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π 131, // Π - 65, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π + 65, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S105 -1, // Π @@ -2271,24 +2271,24 @@ var gotoTab = gotoTable{ -1, // Π }, gotoRow{ // S113 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π 137, // Π - 75, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π + 75, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S114 -1, // Π @@ -2631,24 +2631,24 @@ var gotoTab = gotoTable{ -1, // Π }, gotoRow{ // S131 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π 106, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S132 -1, // Π @@ -2751,24 +2751,24 @@ var gotoTab = gotoTable{ -1, // Π }, gotoRow{ // S137 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π 115, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S138 -1, // Π diff --git a/internal/frontend/reparsed/internal/parser/parser.go b/internal/frontend/reparsed/internal/parser/parser.go index faedb5ee..03f015f9 100644 --- a/internal/frontend/reparsed/internal/parser/parser.go +++ b/internal/frontend/reparsed/internal/parser/parser.go @@ -3,9 +3,10 @@ package parser import ( + "errors" "fmt" + "io" "strings" - "errors" parseError "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/internal/errors" "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/internal/token" @@ -91,29 +92,22 @@ func (s *stack) String() string { type Parser struct { stack *stack nextToken *token.Token - userContext interface{} - longest bool - checkPoint Position + userContext interface{} } type Scanner interface { Scan() (tok *token.Token) + GetStream() io.Reader } -type Position interface{} - -type RepositionableScanner interface { - Scanner - Reposition(p Position) - CurrentPosition() Position -} +type TokenStream = token.TokenStream func NewParser() *Parser { return NewParserWithContext(nil) } func NewParserWithContext(u interface{}) *Parser { - p := &Parser{stack: newStack(), userContext: u } + p := &Parser{stack: newStack(), userContext: u} p.Reset() return p } @@ -194,48 +188,83 @@ func (p *Parser) newError(err error) error { } func (p *Parser) Parse(scanner Scanner) (res interface{}, err error) { - p.longest = false - r, e, _ := p.parse(scanner) - return r, e + r, e, _ := p.parse(scanner, false) + return r, e } func (p *Parser) ParseLongestPrefix(scanner Scanner) (res interface{}, err error, parsed []byte) { - if _, isRepositionable := scanner.(RepositionableScanner); !isRepositionable { - return nil, errors.New("scanner not repositionable"), []byte{} - } - p.longest = true - return p.parse(scanner) + return p.parse(scanner, true) } -func (p *Parser) parse(scanner Scanner) (res interface{}, err error, parsed []byte) { +var errNotRepositionable = errors.New("scanner not repositionable") + +func (p *Parser) parse(scanner Scanner, longest bool) (res interface{}, err error, parsed []byte) { + var ( + tokens TokenStream + afterPos int64 + checkPoint int64 + ) + readNextToken := func() error { + if tokens == nil && (len(parserActions.table[p.stack.top()].cdActions) > 0 || longest) { + if tokens, _ = scanner.GetStream().(TokenStream); tokens == nil { + return errNotRepositionable + } + } + if len(parserActions.table[p.stack.top()].cdActions) > 0 { + checkPoint, _ = tokens.Seek(0, io.SeekCurrent) + } + p.nextToken = scanner.Scan() + if longest { + afterPos, _ = tokens.Seek(0, io.SeekCurrent) + } + return nil + } p.Reset() - if p.longest { - p.checkPoint = scanner.(RepositionableScanner).CurrentPosition() - } - p.nextToken = scanner.Scan() + if err := readNextToken(); err != nil { + return nil, err, []byte{} + } for acc := false; !acc; { action := parserActions.table[p.stack.top()].actions[p.nextToken.Type] - if action == nil { - for tt, fn := range parserActions.cdTokens { - if fn != nil { - scanner.(RepositionableScanner).Reposition(p.checkPoint) - cd_res, cd_err, cd_parsed := fn(p.userContext) - if cd_err == nil && len(cd_parsed) > 0 { - action = parserActions.table[p.stack.top()].actions[tt] - p.nextToken.ForeingAstNode = cd_res + // + // If no action, check if we have some context dependent parsing to try + // + for _, cdAction := range parserActions.table[p.stack.top()].cdActions { + tokens.Seek(checkPoint, io.SeekStart) + cd_res, cd_err, cd_parsed := cdAction.tokenScanner(tokens, p.userContext) + if cd_err == nil && len(cd_parsed) > 0 { + action = parserActions.table[p.stack.top()].actions[cdAction.tokenIndex] + if action != nil { + p.nextToken.Foreign = true + p.nextToken.ForeignAstNode = cd_res p.nextToken.Lit = cd_parsed break } } } - } - if action == nil { - if p.longest { - scanner.(RepositionableScanner).Reposition(p.checkPoint) + } + // + // Still no action? If a longest possible parsing is requested in place + // of a full text, we should try to check if an EOF here would have led + // to a successful parsing instead + // Rember that token.EOF is 1, that is the index of SyntaxEof into symbol table + // Dirty, dirty, dirty... but I found it as it is, and I prefer not to touch + // + if action == nil && longest { + tokens.Seek(checkPoint, io.SeekStart) + action = parserActions.table[p.stack.top()].actions[token.EOF] + if action == nil { + // + // ok, let's consume the token then + // + tokens.Seek(afterPos, io.SeekStart) } - } - if action == nil { + } + + // + // Well, no action is no action after all... + // + if action == nil { if recovered, errAttrib := p.Error(nil, scanner); !recovered { p.nextToken = errAttrib.ErrorToken return nil, p.newError(nil), []byte{} @@ -243,22 +272,20 @@ func (p *Parser) parse(scanner Scanner) (res interface{}, err error, parsed []by if action = parserActions.table[p.stack.top()].actions[p.nextToken.Type]; action == nil { panic("Error recovery led to invalid action") } - } + } switch act := action.(type) { case accept: res = p.stack.popN(1)[0] acc = true case shift: - if p.nextToken.ForeingAstNode == nil { - p.stack.push(int(act), p.nextToken) - } else { - p.stack.push(int(act), p.nextToken.ForeingAstNode) - } - if p.longest { - p.checkPoint = scanner.(RepositionableScanner).CurrentPosition() - } - p.nextToken = scanner.Scan() + p.stack.push(int(act), p.nextToken) + if p.nextToken.Foreign { + p.stack.push(int(act), p.nextToken.ForeignAstNode) + } + if err := readNextToken(); err != nil { + return nil, err, []byte{} + } case reduce: prod := productionsTable[int(act)] attrib, err := prod.ReduceFunc(p.userContext, p.stack.popN(prod.NumSymbols)) diff --git a/internal/frontend/reparsed/internal/parser/productionstable.go b/internal/frontend/reparsed/internal/parser/productionstable.go index dcf6a82a..a1baabc2 100644 --- a/internal/frontend/reparsed/internal/parser/productionstable.go +++ b/internal/frontend/reparsed/internal/parser/productionstable.go @@ -4,8 +4,6 @@ package parser import "github.com/maxcalandrelli/gocc/internal/ast" - - type ( //TODO: change type and variable names to be consistent with other tables ProdTab [numProductions]ProdTabEntry @@ -179,7 +177,7 @@ var productionsTable = ProdTab{ Index: 15, NumSymbols: 1, ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { - return ast.NewLexCharLitExt(X[0],false) + return ast.NewLexCharLitExt(X[0], false) }, }, ProdTabEntry{ @@ -189,7 +187,7 @@ var productionsTable = ProdTab{ Index: 16, NumSymbols: 3, ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { - return ast.NewLexCharRangeExt(X[0], X[2],false) + return ast.NewLexCharRangeExt(X[0], X[2], false) }, }, ProdTabEntry{ @@ -459,7 +457,7 @@ var productionsTable = ProdTab{ Index: 43, NumSymbols: 2, ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { - return ast.NewContextDependentTokId(X[0],X[1]) + return ast.NewContextDependentTokId(X[0], X[1]) }, }, ProdTabEntry{ diff --git a/internal/frontend/reparsed/internal/token/token.go b/internal/frontend/reparsed/internal/token/token.go index 47dc5c70..cb5ea6f5 100644 --- a/internal/frontend/reparsed/internal/token/token.go +++ b/internal/frontend/reparsed/internal/token/token.go @@ -4,13 +4,21 @@ package token import ( "fmt" + "io" ) +type TokenStream interface { + io.Reader + io.RuneScanner + io.Seeker +} + type Token struct { Type Lit []byte Pos - ForeingAstNode interface{} + ForeignAstNode interface{} + Foreign bool } type Type int diff --git a/internal/frontend/reparsed/log/lexer_sets.txt b/internal/frontend/reparsed/log/lexer_sets.txt index 0fff5787..78c8c14c 100644 --- a/internal/frontend/reparsed/log/lexer_sets.txt +++ b/internal/frontend/reparsed/log/lexer_sets.txt @@ -14,7 +14,7 @@ S0{ _tokId : • _lowcase {_id_char} _upcase : • 'A'-'Z' char_lit : • ''' (_unicode_value | _byte_value) ''' - g_ctxdep_lit : • '@' '<' . {.} '>' '@' + g_ctxdep_lit : • '@' '@' . {.} '@' '@' g_sdt_lit : • '<' '<' . {.} '>' '>' ignoredTokId : • '!' _tokId prodId : • _upcase {_id_char} @@ -198,12 +198,12 @@ Action: nil Symbols classes: {['<','<']} S13{ - g_ctxdep_lit : '@' • '<' . {.} '>' '@' + g_ctxdep_lit : '@' • '@' . {.} '@' '@' } Transitions: - ['<','<'] -> S36 + ['@','@'] -> S36 Action: nil -Symbols classes: {['<','<']} +Symbols classes: {['@','@']} S14{ _digit : • '0'-'9' @@ -542,7 +542,7 @@ Action: nil Symbols classes: {} S36{ - g_ctxdep_lit : '@' '<' • . {.} '>' '@' + g_ctxdep_lit : '@' '@' • . {.} '@' '@' } Transitions: . -> S70 @@ -1151,14 +1151,14 @@ Action: nil Symbols classes: {['>','>']} S70{ - g_ctxdep_lit : '@' '<' . {.} • '>' '@' - g_ctxdep_lit : '@' '<' . {• .} '>' '@' + g_ctxdep_lit : '@' '@' . {.} • '@' '@' + g_ctxdep_lit : '@' '@' . {• .} '@' '@' } Transitions: - ['>','>'] -> S83 + ['@','@'] -> S83 . -> S70 Action: nil -Symbols classes: {['>','>']} +Symbols classes: {['@','@']} S71{ _digit : • '0'-'9' @@ -1353,7 +1353,7 @@ Action: nil Symbols classes: {['>','>']} S83{ - g_ctxdep_lit : '@' '<' . {.} '>' • '@' + g_ctxdep_lit : '@' '@' . {.} '@' • '@' } Transitions: ['@','@'] -> S95 @@ -1562,7 +1562,7 @@ Action: Accept("g_sdt_lit") Symbols classes: {} S95{ - g_ctxdep_lit : '@' '<' . {.} '>' '@' • + g_ctxdep_lit : '@' '@' . {.} '@' '@' • } Transitions: Action: Accept("g_ctxdep_lit") diff --git a/internal/frontend/reparsed/reparsed.go b/internal/frontend/reparsed/reparsed.go index 778fd1e1..0d4ccadb 100644 --- a/internal/frontend/reparsed/reparsed.go +++ b/internal/frontend/reparsed/reparsed.go @@ -11,8 +11,12 @@ import ( "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/internal/token" ) -type Token = token.Token -type WindowReader = stream.WindowReader +type ( + Token = token.Token + TokenStream = token.TokenStream + WindowReader = stream.WindowReader + Scanner = parser.Scanner +) func ParseFile(fpath string) (interface{}, error) { if lexer, err := NewLexerFile(fpath); err == nil { @@ -23,11 +27,11 @@ func ParseFile(fpath string) (interface{}, error) { } func ParseText(text string) (interface{}, error) { - return NewParser().Parse(NewLexer([]byte(text))) + return NewParser().Parse(NewLexerBytes([]byte(text))) } -func NewLexer(src []byte) *lexer.Lexer { - return lexer.NewLexer(src) +func NewLexerBytes(src []byte) *lexer.Lexer { + return lexer.NewLexerBytes(src) } func NewLexerFile(fpath string) (*lexer.Lexer, error) { diff --git a/internal/lexer/gen/golang/lexer.go b/internal/lexer/gen/golang/lexer.go index 25a854b5..2faaafad 100644 --- a/internal/lexer/gen/golang/lexer.go +++ b/internal/lexer/gen/golang/lexer.go @@ -90,18 +90,13 @@ type position struct { StreamPosition int64 } -type lexerStream interface { - io.RuneReader - io.Seeker -} - type Lexer struct { position - stream lexerStream + stream token.TokenStream eof bool } -func NewLexer(src []byte) *Lexer { +func NewLexerBytes(src []byte) *Lexer { lexer := &Lexer{stream: bytes.NewReader(src)} lexer.position.Reset() return lexer @@ -117,10 +112,10 @@ func NewLexerFile(fpath string) (*Lexer, error) { return lexer, nil } -func NewLexerStream(reader io.Reader) (*Lexer, error) { +func NewLexer(reader io.Reader) (*Lexer, error) { lexer := &Lexer{} lexer.position.Reset() - if lexer.stream, _ = reader.(lexerStream); lexer.stream == nil { + if lexer.stream, _ = reader.(token.TokenStream); lexer.stream == nil { lexer.stream = stream.NewWindowReader(reader) } else { lexer.position.StreamPosition, _ = lexer.stream.Seek(0, io.SeekCurrent) @@ -128,6 +123,10 @@ func NewLexerStream(reader io.Reader) (*Lexer, error) { return lexer, nil } +func (l Lexer) GetStream() io.Reader { + return l.stream +} + func (l *Lexer) Scan() (tok *token.Token) { {{- if .Debug}} fmt.Printf("Lexer.Scan() pos=%d\n", l.position.Pos.Offset) diff --git a/internal/parser/gen/gen.go b/internal/parser/gen/gen.go index 120cb471..3bfb327d 100644 --- a/internal/parser/gen/gen.go +++ b/internal/parser/gen/gen.go @@ -30,9 +30,9 @@ func Gen(pkg, outDir, header string, prods ast.SyntaxProdList, symbols *symbols. itemsets *items.ItemSets, tokMap *token.TokenMap, cfg config.Config, subpath string) (conflicts map[int]items.RowConflicts) { golang.GenAction(outDir, subpath) - conflicts = golang.GenActionTable(outDir, prods, itemsets, tokMap, cfg.Zip(), subpath) + conflicts = golang.GenActionTable(outDir, prods, itemsets, tokMap, subpath, header) golang.GenErrors(pkg, outDir, subpath) - golang.GenGotoTable(outDir, itemsets, symbols, cfg.Zip(), subpath) + golang.GenGotoTable(outDir, itemsets, symbols, subpath) golang.GenParser(pkg, outDir, prods, itemsets, symbols, cfg, subpath) golang.GenProductionsTable(pkg, outDir, header, prods, symbols, itemsets, tokMap, subpath) return diff --git a/internal/parser/gen/golang/actiontable.go b/internal/parser/gen/golang/actiontable.go index 0675aaf3..f59eacb1 100644 --- a/internal/parser/gen/golang/actiontable.go +++ b/internal/parser/gen/golang/actiontable.go @@ -17,7 +17,7 @@ package golang import ( "bytes" "fmt" - "math" + "go/format" "path" "text/template" @@ -28,28 +28,34 @@ import ( "github.com/maxcalandrelli/gocc/internal/token" ) -func GenActionTable(outDir string, prods ast.SyntaxProdList, itemSets *items.ItemSets, tokMap *token.TokenMap, zip bool, subpath string) map[int]items.RowConflicts { - if zip { - return GenCompActionTable(outDir, subpath, prods, itemSets, tokMap) - } +type actionTableData struct { + Rows []*actRow + CdTokenFunctions []string +} + +type tmplData struct { + Header string + Table *actionTableData +} + +func GenActionTable(outDir string, prods ast.SyntaxProdList, itemSets *items.ItemSets, tokMap *token.TokenMap, subpath, header string) map[int]items.RowConflicts { tmpl, err := template.New("parser action table").Parse(actionTableSrc[1:]) if err != nil { panic(err) } wr := new(bytes.Buffer) data, conflicts := getActionTableData(prods, itemSets, tokMap) - if err := tmpl.Execute(wr, data); err != nil { + if err := tmpl.Execute(wr, tmplData{Table: data, Header: header}); err != nil { panic(err) } - io.WriteFile(path.Join(outDir, subpath, "parser", "actiontable.go"), wr.Bytes()) + source, err := format.Source(wr.Bytes()) + if err != nil { + panic(fmt.Sprintf("%s in\n%s", err.Error(), wr.String())) + } + io.WriteFile(path.Join(outDir, subpath, "parser", "actiontable.go"), source) return conflicts } -type actionTableData struct { - Rows []*actRow - CdTokenFunctions []string -} - func getActionTableData(prods ast.SyntaxProdList, itemSets *items.ItemSets, tokMap *token.TokenMap) (actTab *actionTableData, conflicts map[int]items.RowConflicts) { @@ -66,57 +72,28 @@ func getActionTableData(prods ast.SyntaxProdList, itemSets *items.ItemSets, } actTab.Rows[i] = row } - for i, sym := range tokMap.TypeMap { - switch s := sym.(type) { - case ast.SyntaxContextDependentTokId: - actTab.CdTokenFunctions[i] = fmt.Sprintf("func(Context interface{}) (interface{}, error, []byte) { return %s },", s.ContexDependentParseFunctionCall) - default: - actTab.CdTokenFunctions[i] = fmt.Sprintf("nil, // %T", s) - } - } return } +type cdActionFunc struct { + TokenType int + TokenFunc string +} + type actRow struct { CanRecover bool Actions []string + CdActions []cdActionFunc } func getActionRowData(prods ast.SyntaxProdList, set *items.ItemSet, tokMap *token.TokenMap) (data *actRow, conflicts items.RowConflicts) { data = &actRow{ CanRecover: set.CanRecover(), Actions: make([]string, len(tokMap.TypeMap)), + CdActions: []cdActionFunc{}, } conflicts = make(items.RowConflicts) - var max int // calculate padding. - for _, sym := range tokMap.TypeMap { - act, _ := set.Action(sym) - switch act1 := act.(type) { - case action.Accept: - n := len("accept(true),") - if n > max { - max = n - } - case action.Error: - n := len("nil,") - if n > max { - max = n - } - case action.Reduce: - n := len("reduce(") + nbytes(int(act1)) + len("),") - if n > max { - max = n - } - case action.Shift: - n := len("shift(") + nbytes(int(act1)) + len("),") - if n > max { - max = n - } - default: - panic(fmt.Sprintf("Unknown action type: %T", act1)) - } - } for i, sym := range tokMap.TypeMap { act, symConflicts := set.Action(sym) if len(symConflicts) > 0 { @@ -124,17 +101,20 @@ func getActionRowData(prods ast.SyntaxProdList, set *items.ItemSet, tokMap *toke } switch act1 := act.(type) { case action.Accept: - pad := max + 1 - len("accept(true),") - data.Actions[i] = fmt.Sprintf("accept(true),%*c// %s", pad, ' ', sym) + data.Actions[i] = fmt.Sprintf("accept(true), // %s", sym) case action.Error: - pad := max + 1 - len("nil,") - data.Actions[i] = fmt.Sprintf("nil,%*c// %s", pad, ' ', sym) + data.Actions[i] = fmt.Sprintf("nil, // %s", sym) case action.Reduce: - pad := max + 1 - (len("reduce(") + nbytes(int(act1)) + len("),")) - data.Actions[i] = fmt.Sprintf("reduce(%d),%*c// %s, reduce: %s", int(act1), pad, ' ', sym, prods[int(act1)].Id) + data.Actions[i] = fmt.Sprintf("reduce(%d), // %s, reduce: %s", int(act1), sym, prods[int(act1)].Id) case action.Shift: - pad := max + 1 - (len("shift(") + nbytes(int(act1)) + len("),")) - data.Actions[i] = fmt.Sprintf("shift(%d),%*c// %s", int(act1), pad, ' ', sym) + data.Actions[i] = fmt.Sprintf("shift(%d), // %s", int(act1), sym) + switch s := sym.(type) { + case ast.SyntaxContextDependentTokId: + data.CdActions = append(data.CdActions, cdActionFunc{ + i, + fmt.Sprintf("cdFunc_%s", s.SymbolString()), + }) + } default: panic(fmt.Sprintf("Unknown action type: %T", act1)) } @@ -147,26 +127,26 @@ const actionTableSrc = ` package parser + type ( actionTable [numStates]actionRow + cdFunc func(TokenStream, interface{}) (interface{}, error, []byte) + cdAction struct { + tokenIndex int + tokenScanner cdFunc + } actionRow struct { canRecover bool actions [numSymbols]action + cdActions []cdAction } - contextDependentToken [numSymbols] func(interface{}) (interface{}, error, []byte) actions struct { table actionTable - cdTokens contextDependentToken } ) var parserActions = actions { - cdTokens: contextDependentToken{ - {{- range $f := .CdTokenFunctions }} - {{$f}} - {{- end }} - }, table: actionTable{ - {{- range $i, $r := .Rows }} + {{- range $i, $r := .Table.Rows }} actionRow{ // S{{$i}} canRecover: {{printf "%t" .CanRecover}}, actions: [numSymbols]action{ @@ -174,140 +154,14 @@ var parserActions = actions { {{$a}} {{- end }} }, + cdActions: []cdAction{ + {{- range $c := .CdActions }} + cdAction{tokenIndex: {{$c.TokenType}}, tokenScanner: {{$c.TokenFunc}} }, + {{- end }} + }, }, {{- end }} }, } ` - -func GenCompActionTable(outDir, subpath string, prods ast.SyntaxProdList, itemSets *items.ItemSets, tokMap *token.TokenMap) map[int]items.RowConflicts { - tab := make([]struct { - CanRecover bool - Actions []struct { - Index int - Action int - Amount int - } - }, itemSets.Size()) - conflictss := make(map[int]items.RowConflicts) - for i := range tab { - set := itemSets.Set(i) - tab[i].CanRecover = set.CanRecover() - conflicts := make(items.RowConflicts) - for j, sym := range tokMap.TypeMap { - act, symConflicts := set.Action(sym) - if len(symConflicts) > 0 { - conflicts[sym] = symConflicts - } - switch act1 := act.(type) { - case action.Accept: - tab[i].Actions = append(tab[i].Actions, struct { - Index int - Action int - Amount int - }{Index: j, Action: 0, Amount: 0}) - case action.Error: - // skip - case action.Reduce: - tab[i].Actions = append(tab[i].Actions, struct { - Index int - Action int - Amount int - }{Index: j, Action: 1, Amount: int(act1)}) - case action.Shift: - tab[i].Actions = append(tab[i].Actions, struct { - Index int - Action int - Amount int - }{Index: j, Action: 2, Amount: int(act1)}) - default: - panic(fmt.Sprintf("Unknown action type: %T", act1)) - } - } - if len(conflicts) > 0 { - conflictss[i] = conflicts - } - } - bytesStr := genEnc(tab) - tmpl, err := template.New("parser action table").Parse(actionCompTableSrc[1:]) - if err != nil { - panic(err) - } - wr := new(bytes.Buffer) - if err := tmpl.Execute(wr, bytesStr); err != nil { - panic(err) - } - io.WriteFile(path.Join(outDir, subpath, "parser", "actiontable.go"), wr.Bytes()) - return conflictss -} - -const actionCompTableSrc = ` -// Code generated by gocc; DO NOT EDIT. - -package parser - -import ( - "bytes" - "compress/gzip" - "encoding/gob" -) - -type ( - actionTable [numStates]actionRow - actionRow struct { - canRecover bool - actions [numSymbols]action - } -) - -var actionTab = actionTable{} - -func init() { - tab := []struct { - CanRecover bool - Actions []struct { - Index int - Action int - Amount int - } - }{} - data := {{.}} - buf, err := gzip.NewReader(bytes.NewBuffer(data)) - if err != nil { - panic(err) - } - dec := gob.NewDecoder(buf) - if err := dec.Decode(&tab); err != nil { - panic(err) - } - - for i, row := range tab { - actionTab[i].canRecover = row.CanRecover - for _, a := range row.Actions { - switch a.Action { - case 0: - actionTab[i].actions[a.Index] = accept(true) - case 1: - actionTab[i].actions[a.Index] = reduce(a.Amount) - case 2: - actionTab[i].actions[a.Index] = shift(a.Amount) - } - } - } -} -` - -// nbytes returns the number of bytes required to output the integer x. -func nbytes(x int) int { - if x == 0 { - return 1 - } - n := 0 - if x < 0 { - x = -x - n++ - } - n += int(math.Log10(float64(x))) + 1 - return n -} diff --git a/internal/parser/gen/golang/gototable.go b/internal/parser/gen/golang/gototable.go index 54878c13..1eafcc09 100644 --- a/internal/parser/gen/golang/gototable.go +++ b/internal/parser/gen/golang/gototable.go @@ -35,14 +35,9 @@ type gotoTableData struct { type gotoRowElement struct { NT string State int - Pad int } -func GenGotoTable(outDir string, itemSets *items.ItemSets, sym *symbols.Symbols, zip bool, subpath string) { - if zip { - GenCompGotoTable(outDir, subpath, itemSets, sym) - return - } +func GenGotoTable(outDir string, itemSets *items.ItemSets, sym *symbols.Symbols, subpath string) { tmpl, err := template.New("parser goto table").Parse(gotoTableSrc[1:]) if err != nil { panic(err) @@ -67,18 +62,9 @@ func getGotoTableData(itemSets *items.ItemSets, sym *symbols.Symbols) *gotoTable func getGotoRowData(itemSet *items.ItemSet, sym *symbols.Symbols) []gotoRowElement { row := make([]gotoRowElement, sym.NumNTSymbols()) - var max int for i, nt := range sym.NTList() { row[i].NT = nt.SymbolName() row[i].State = itemSet.NextSetIndex(nt) - n := nbytes(row[i].State) - if n > max { - max = n - } - } - // Calculate padding. - for i := range row { - row[i].Pad = max + 1 - nbytes(row[i].State) } return row } @@ -99,7 +85,7 @@ var gotoTab = gotoTable{ {{- range $i, $r := .Rows }} gotoRow{ // S{{$i}} {{- range $j, $gto := . }} - {{ printf "%d,%*c// %s" $gto.State $gto.Pad ' ' $gto.NT }} + {{ printf "%d, // %s" $gto.State $gto.NT }} {{- end }} }, {{- end }} @@ -137,70 +123,3 @@ func genEnc(v interface{}) string { fmt.Fprintf(strBuf, "\t}") return string(strBuf.Bytes()) } - -func GenCompGotoTable(outDir, subpath string, itemSets *items.ItemSets, sym *symbols.Symbols) { - numNTSymbols := sym.NumNTSymbols() - rows := make([][]int, itemSets.Size()) - for i, set := range itemSets.List() { - rows[i] = make([]int, numNTSymbols) - for j, nt := range sym.NTList() { - rows[i][j] = set.NextSetIndex(nt) - } - } - bytesStr := genEnc(rows) - v := struct { - NumNTSymbols int - Bytes string - }{ - NumNTSymbols: numNTSymbols, - Bytes: bytesStr, - } - tmpl, err := template.New("parser goto table").Parse(gotoTableCompSrc[1:]) - if err != nil { - panic(err) - } - wr := new(bytes.Buffer) - if err := tmpl.Execute(wr, v); err != nil { - panic(err) - } - io.WriteFile(path.Join(outDir, subpath, "parser", "gototable.go"), wr.Bytes()) -} - -const gotoTableCompSrc = ` -// Code generated by gocc; DO NOT EDIT. - -package parser - -import ( - "bytes" - "compress/gzip" - "encoding/gob" -) - -const numNTSymbols = {{.NumNTSymbols}} - -type ( - gotoTable [numStates]gotoRow - gotoRow [numNTSymbols]int -) - -var gotoTab = gotoTable{} - -func init() { - tab := [][]int{} - data := {{.Bytes}} - buf, err := gzip.NewReader(bytes.NewBuffer(data)) - if err != nil { - panic(err) - } - dec := gob.NewDecoder(buf) - if err := dec.Decode(&tab); err != nil { - panic(err) - } - for i := 0; i < numStates; i++ { - for j := 0; j < numNTSymbols; j++ { - gotoTab[i][j] = tab[i][j] - } - } -} -` diff --git a/internal/parser/gen/golang/parser.go b/internal/parser/gen/golang/parser.go index d9212c44..0a37bb29 100644 --- a/internal/parser/gen/golang/parser.go +++ b/internal/parser/gen/golang/parser.go @@ -16,6 +16,8 @@ package golang import ( "bytes" + "fmt" + "go/format" "path" "text/template" @@ -35,7 +37,11 @@ func GenParser(pkg, outDir string, prods ast.SyntaxProdList, itemSets *items.Ite if err := tmpl.Execute(wr, getParserData(pkg, subpath, prods, itemSets, symbols, cfg)); err != nil { panic(err) } - io.WriteFile(path.Join(outDir, subpath, "parser", "parser.go"), wr.Bytes()) + source, err := format.Source(wr.Bytes()) + if err != nil { + panic(fmt.Sprintf("%s in\n%s", err.Error(), wr.String())) + } + io.WriteFile(path.Join(outDir, subpath, "parser", "parser.go"), source) } type parserData struct { @@ -45,6 +51,7 @@ type parserData struct { NumProductions int NumStates int NumSymbols int + CdTokList ast.SyntaxSymbols } func getParserData(pkg, subpath string, prods ast.SyntaxProdList, itemSets *items.ItemSets, symbols *symbols.Symbols, cfg config.Config) *parserData { @@ -55,6 +62,7 @@ func getParserData(pkg, subpath string, prods ast.SyntaxProdList, itemSets *item NumProductions: len(prods), NumStates: itemSets.Size(), NumSymbols: symbols.NumSymbols(), + CdTokList: symbols.ListContextDependentTokenSymbols(), } } @@ -65,6 +73,7 @@ package parser import ( "fmt" + "io" "strings" "errors" @@ -153,21 +162,19 @@ type Parser struct { stack *stack nextToken *token.Token userContext interface{} - longest bool - checkPoint Position } type Scanner interface { Scan() (tok *token.Token) + GetStream () io.Reader } -type Position interface{} +type TokenStream = token.TokenStream + +{{- range $c := .CdTokList }} +{{ printf "func cdFunc_%s (Stream TokenStream, Context interface{}) (interface{}, error, []byte) {return %s}" $c.SymbolString $c.ContexDependentParseFunctionCall }} +{{- end }} -type RepositionableScanner interface { - Scanner - Reposition(p Position) - CurrentPosition() Position -} func NewParser() *Parser { return NewParserWithContext(nil) @@ -255,47 +262,83 @@ func (p *Parser) newError(err error) error { } func (p *Parser) Parse(scanner Scanner) (res interface{}, err error) { - p.longest = false - r, e, _ := p.parse(scanner) + r, e, _ := p.parse(scanner, false) return r, e } func (p *Parser) ParseLongestPrefix(scanner Scanner) (res interface{}, err error, parsed []byte) { - if _, isRepositionable := scanner.(RepositionableScanner); !isRepositionable { - return nil, errors.New("scanner not repositionable"), []byte{} - } - p.longest = true - return p.parse(scanner) + return p.parse(scanner, true) } -func (p *Parser) parse(scanner Scanner) (res interface{}, err error, parsed []byte) { +var errNotRepositionable = errors.New("scanner not repositionable") + + +func (p *Parser) parse(scanner Scanner, longest bool) (res interface{}, err error, parsed []byte) { + var ( + tokens TokenStream + afterPos int64 + checkPoint int64 + ) + readNextToken := func () error { + if tokens == nil && (len(parserActions.table[p.stack.top()].cdActions) > 0 || longest) { + if tokens, _ = scanner.GetStream().(TokenStream); tokens == nil { + return errNotRepositionable + } + } + if len(parserActions.table[p.stack.top()].cdActions) > 0 { + checkPoint, _ = tokens.Seek (0, io.SeekCurrent) + } + p.nextToken = scanner.Scan() + if longest { + afterPos , _ = tokens.Seek (0, io.SeekCurrent) + } + return nil + } p.Reset() - if p.longest { - p.checkPoint = scanner.(RepositionableScanner).CurrentPosition() + if err := readNextToken(); err != nil { + return nil, err, []byte{} } - p.nextToken = scanner.Scan() for acc := false; !acc; { action := parserActions.table[p.stack.top()].actions[p.nextToken.Type] - if action == nil { - for tt, fn := range parserActions.cdTokens { - if fn != nil { - scanner.(RepositionableScanner).Reposition(p.checkPoint) - cd_res, cd_err, cd_parsed := fn(p.userContext) - if cd_err == nil && len(cd_parsed) > 0 { - action = parserActions.table[p.stack.top()].actions[tt] - p.nextToken.ForeingAstNode = cd_res - p.nextToken.Lit = cd_parsed - break - } + // + // If no action, check if we have some context dependent parsing to try + // + for _, cdAction := range parserActions.table[p.stack.top()].cdActions { + tokens.Seek(checkPoint, io.SeekStart) + cd_res, cd_err, cd_parsed := cdAction.tokenScanner(tokens, p.userContext) + if cd_err == nil && len(cd_parsed) > 0 { + action = parserActions.table[p.stack.top()].actions[cdAction.tokenIndex] + if action != nil { + p.nextToken.Foreign = true + p.nextToken.ForeignAstNode = cd_res + p.nextToken.Lit = cd_parsed + break + } } } } - if action == nil { - if p.longest { - scanner.(RepositionableScanner).Reposition(p.checkPoint) - } + // + // Still no action? If a longest possible parsing is requested in place + // of a full text, we should try to check if an EOF here would have led + // to a successful parsing instead + // Rember that token.EOF is 1, that is the index of SyntaxEof into symbol table + // Dirty, dirty, dirty... but I found it as it is, and I prefer not to touch + // + if action == nil && longest { + tokens.Seek(checkPoint, io.SeekStart) + action = parserActions.table[p.stack.top()].actions[token.EOF] + if action == nil { + // + // ok, let's consume the token then + // + tokens.Seek(afterPos, io.SeekStart) + } } + + // + // Well, no action is no action after all... + // if action == nil { if recovered, errAttrib := p.Error(nil, scanner); !recovered { p.nextToken = errAttrib.ErrorToken @@ -314,15 +357,13 @@ func (p *Parser) parse(scanner Scanner) (res interface{}, err error, parsed []by res = p.stack.popN(1)[0] acc = true case shift: - if p.nextToken.ForeingAstNode == nil { - p.stack.push(int(act), p.nextToken) - } else { - p.stack.push(int(act), p.nextToken.ForeingAstNode) + p.stack.push(int(act), p.nextToken) + if p.nextToken.Foreign { + p.stack.push(int(act), p.nextToken.ForeignAstNode) } - if p.longest { - p.checkPoint = scanner.(RepositionableScanner).CurrentPosition() + if err := readNextToken(); err != nil { + return nil, err, []byte{} } - p.nextToken = scanner.Scan() case reduce: prod := productionsTable[int(act)] attrib, err := prod.ReduceFunc(p.userContext, p.stack.popN(prod.NumSymbols)) diff --git a/internal/parser/gen/golang/productionstable.go b/internal/parser/gen/golang/productionstable.go index f3bee7f2..c4f9807e 100644 --- a/internal/parser/gen/golang/productionstable.go +++ b/internal/parser/gen/golang/productionstable.go @@ -17,6 +17,7 @@ package golang import ( "bytes" "fmt" + "go/format" "path" "text/template" @@ -39,7 +40,11 @@ func GenProductionsTable(pkg, outDir, header string, prods ast.SyntaxProdList, s if err := tmpl.Execute(wr, getProdsTab(header, prods, symbols, itemsets, tokMap)); err != nil { panic(err) } - io.WriteFile(fname, wr.Bytes()) + source, err := format.Source(wr.Bytes()) + if err != nil { + panic(err) + } + io.WriteFile(fname, source) } func getProdsTab(header string, prods ast.SyntaxProdList, symbols *symbols.Symbols, @@ -58,6 +63,11 @@ func getProdsTab(header string, prods ast.SyntaxProdList, symbols *symbols.Symbo data.ProdTab[i].NumSymbols = 0 } else { data.ProdTab[i].NumSymbols = len(prod.Body.Symbols) + for _, s := range prod.Body.Symbols { + if _, cdTok := s.(ast.SyntaxContextDependentTokId); cdTok { + data.ProdTab[i].NumSymbols++ + } + } } switch { case len(prod.Body.SDT) > 0: diff --git a/internal/token/gen/golang/token.go b/internal/token/gen/golang/token.go index 3ea9e692..a5c76566 100644 --- a/internal/token/gen/golang/token.go +++ b/internal/token/gen/golang/token.go @@ -69,13 +69,22 @@ package token import ( "fmt" + "io" ) +type TokenStream interface { + io.Reader + io.RuneScanner + io.Seeker +} + + type Token struct { Type Lit []byte Pos - ForeingAstNode interface{} + ForeignAstNode interface{} + Foreign bool } type Type int diff --git a/spec/gocc2.ebnf b/spec/gocc2.ebnf index 4e1562a1..050a6543 100644 --- a/spec/gocc2.ebnf +++ b/spec/gocc2.ebnf @@ -93,7 +93,7 @@ g_sdt_lit ; g_ctxdep_lit - : '@' '<' . {.} '>' '@' + : '@' '@' . {.} '@' '@' ; diff --git a/spec/test.bnf b/spec/test.bnf index 2967ff79..1ed6db55 100644 --- a/spec/test.bnf +++ b/spec/test.bnf @@ -30,7 +30,7 @@ Test1: Test2 : Test3 | Test1; Test3 : -"not" "empty" +"not" "empty" << fmt.Printf("very well\n") >> | T | @@ -46,9 +46,32 @@ X: | "hexdigit" | altro - @< altro() >@ + @@ + func () (interface {}, error, [] byte) { + count := 0 + ret := []byte{} + for { + r, _, _ := Stream.ReadRune() + switch r { + case ' ', '\t': + ret = append(ret, string(r)...) + case '/': + ret = append(ret, string(r)...) + count++ + default: + Stream.UnreadRune() + fmt.Printf("count=%d rune=<%c> ret=%s\n", count, r, string(ret)) + return count, nil, ret + } + } + return nil, nil, []byte{} + }() + @@ << - fmt.Printf("$0=%q\n$1=%q\n", $0, $1) + func () (interface{}, error) { + fmt.Printf("$0=%q\n$1=%q\n", $0, $1) + return nil, nil + } () >> ; From 9819cffd1f2fc9945f50ec5c55c596d2764bb84f Mon Sep 17 00:00:00 2001 From: Massimiliano Calandrelli Date: Thu, 10 Oct 2019 18:43:04 +0200 Subject: [PATCH 16/33] ... --- internal/base/gen/golang/base.go | 92 +++++++-- internal/frontend/reparsed/iface/iface.go | 30 +++ .../io/stream/internal/stream_impl.go | 2 +- .../io/stream/internal/stream_public.go | 2 +- .../frontend/reparsed/internal/lexer/lexer.go | 141 +++++++------- .../reparsed/internal/parser/parser.go | 57 +++--- .../frontend/reparsed/internal/token/token.go | 7 - internal/frontend/reparsed/main/main.go | 25 ++- internal/frontend/reparsed/reparsed.go | 17 +- internal/io/gen/golang/gen.go | 4 +- internal/lexer/gen/golang/lexer.go | 184 +++++++++--------- internal/parser/gen/golang/parser.go | 72 ++++--- internal/token/gen/golang/token.go | 8 - main.go | 2 +- spec/gocc2.ebnf | 3 +- spec/test.bnf | 11 +- 16 files changed, 369 insertions(+), 288 deletions(-) create mode 100644 internal/frontend/reparsed/iface/iface.go diff --git a/internal/base/gen/golang/base.go b/internal/base/gen/golang/base.go index 596f27fa..4dbbb864 100644 --- a/internal/base/gen/golang/base.go +++ b/internal/base/gen/golang/base.go @@ -40,6 +40,7 @@ func Gen(pkg, outdir, subpath string) { } genBase(d) genMain(d) + genIface(d) } func genBase(d data) { @@ -74,6 +75,22 @@ func genMain(d data) { io.WriteFile(basePath, source) } +func genIface(d data) { + basePath := path.Join(d.Outdir, "iface", "iface.go") + tmpl, err := template.New(d.MyName).Parse(ifaceSrc[1:]) + if err != nil { + panic(err) + } + buf := new(bytes.Buffer) + err = tmpl.Execute(buf, d) + // Use go/format to indent the idMap literal correctly. + source, err := format.Source(buf.Bytes()) + if err != nil { + panic(err) + } + io.WriteFile(basePath, source) +} + const baseSrc string = ` // Code generated by gocc; DO NOT EDIT. @@ -86,25 +103,28 @@ import ( "{{.Pkg}}/{{.Subpath}}/lexer" "{{.Pkg}}/{{.Subpath}}/parser" "{{.Pkg}}/{{.Subpath}}/io/stream" + "{{.Pkg}}/iface" ) type ( Token = token.Token - TokenStream = token.TokenStream + Lexer = lexer.Lexer + Parser = parser.Parser + TokenStream = iface.TokenStream WindowReader = stream.WindowReader - Scanner = parser.Scanner + Scanner = iface.Scanner ) -func ParseFile(fpath string) (interface{}, error) { +func ParseFile(fpath string) (interface{}, error, int) { if lexer, err := NewLexerFile(fpath); err == nil { return NewParser().Parse(lexer) } else { - return nil, err + return nil, err, 0 } } -func ParseText(text string) (interface{}, error) { +func ParseText(text string) (interface{}, error, int) { return NewParser().Parse(NewLexerBytes([]byte(text))) } @@ -112,6 +132,10 @@ func NewLexerBytes(src []byte) *lexer.Lexer { return lexer.NewLexerBytes(src) } +func NewLexerString(src string) *lexer.Lexer { + return lexer.NewLexerBytes([]byte(src)) +} + func NewLexerFile(fpath string) (*lexer.Lexer, error) { return lexer.NewLexerFile(fpath) } @@ -147,11 +171,11 @@ import ( {{.MyName}} "{{.Pkg}}" ) -func showResult (r interface{}, e error) { +func showResult (r interface{}, e error, l int) { if e != nil { fmt.Fprintf(os.Stderr, "parsing returned the following error: %s\n", e.Error()) } else { - fmt.Printf("%#v\n", r) + fmt.Printf("r=%#v, %d bytes\n", r, l) } } @@ -161,20 +185,66 @@ var ( Longest bool ) +func parse (longest bool, lex *{{.MyName}}.Lexer) (res interface{}, err error, ptl int) { + if longest { + return {{.MyName}}.NewParser().ParseLongestPrefix(lex) + } else { + return {{.MyName}}.NewParser().Parse(lex) + } + return +} + func main () { flag.StringVar(&File, "file", "", "parse also text in file") flag.StringVar(&Text, "text", "", "parse also text given with flag") flag.BoolVar(&Longest, "longest", false, "parse longest possible part") flag.Parse() if Text > "" { - showResult({{.MyName}}.ParseText(Text)) + showResult(parse(Longest, {{.MyName}}.NewLexerString(Text))) } if File > "" { - showResult({{.MyName}}.ParseFile(File)) + l, e := {{.MyName}}.NewLexerFile(File) + if e != nil { panic(e) } + showResult(parse(Longest, l)) } - if str := strings.Join(os.Args[1:], " "); str > "" { - showResult({{.MyName}}.ParseText(str)) + if str := strings.Join(flag.Args(), " "); str > "" { + showResult(parse(Longest, {{.MyName}}.NewLexerString(str))) } } +` + +const ifaceSrc string = ` +// Code generated by gocc; DO NOT EDIT. + +package iface + +import ( + "io" + "{{.Pkg}}/{{.Subpath}}/token" +) + +type ( + Scanner interface { + Scan() (tok *token.Token) + GetStream() TokenStream + } + + CheckPoint interface { + DistanceFrom(CheckPoint) int + } + + CheckPointable interface { + GetCheckPoint() CheckPoint + GotoCheckPoint(CheckPoint) + } + + TokenStream interface { + io.Reader + io.RuneScanner + io.Seeker + } +) + + ` diff --git a/internal/frontend/reparsed/iface/iface.go b/internal/frontend/reparsed/iface/iface.go new file mode 100644 index 00000000..beafa1ba --- /dev/null +++ b/internal/frontend/reparsed/iface/iface.go @@ -0,0 +1,30 @@ +// Code generated by gocc; DO NOT EDIT. + +package iface + +import ( + "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/internal/token" + "io" +) + +type ( + Scanner interface { + Scan() (tok *token.Token) + GetStream() TokenStream + } + + CheckPoint interface { + DistanceFrom(CheckPoint) int + } + + CheckPointable interface { + GetCheckPoint() CheckPoint + GotoCheckPoint(CheckPoint) + } + + TokenStream interface { + io.Reader + io.RuneScanner + io.Seeker + } +) diff --git a/internal/frontend/reparsed/internal/io/stream/internal/stream_impl.go b/internal/frontend/reparsed/internal/io/stream/internal/stream_impl.go index f09eeac3..358aa160 100644 --- a/internal/frontend/reparsed/internal/io/stream/internal/stream_impl.go +++ b/internal/frontend/reparsed/internal/io/stream/internal/stream_impl.go @@ -234,7 +234,7 @@ func (s *impl_WindowReader) unreadRune() (err error) { tmpb := []byte{} for { if _, err = tmps.seek(-1, io.SeekCurrent); err == nil { - b, _ := tmps.PeekByte() + b, _ := tmps.peekByte() tmpb = append([]byte{b}, tmpb...) switch len(tmpb) { case 1: diff --git a/internal/frontend/reparsed/internal/io/stream/internal/stream_public.go b/internal/frontend/reparsed/internal/io/stream/internal/stream_public.go index 2c99c2fa..20ed7b5e 100644 --- a/internal/frontend/reparsed/internal/io/stream/internal/stream_public.go +++ b/internal/frontend/reparsed/internal/io/stream/internal/stream_public.go @@ -79,7 +79,7 @@ func (s *impl_WindowReader) ReadByte() (byte, error) { func (s *impl_WindowReader) PeekByte() (byte, error) { s.lockReader() defer func() { s.unlockReader() }() - return s.PeekByte() + return s.peekByte() } func (s *impl_WindowReader) UnreadByte() error { diff --git a/internal/frontend/reparsed/internal/lexer/lexer.go b/internal/frontend/reparsed/internal/lexer/lexer.go index a79a4b69..7912000b 100644 --- a/internal/frontend/reparsed/internal/lexer/lexer.go +++ b/internal/frontend/reparsed/internal/lexer/lexer.go @@ -3,36 +3,37 @@ package lexer import ( - + "io" "bytes" "os" - -"github.com/maxcalandrelli/gocc/internal/frontend/reparsed/internal/token" -"github.com/maxcalandrelli/gocc/internal/frontend/reparsed/internal/io/stream" + + "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/iface" + "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/internal/token" + "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/internal/io/stream" ) const ( NoState = -1 NumStates = 114 - NumSymbols = 79 + NumSymbols = 83 + INVALID_RUNE = rune(-1) ) type position struct { token.Pos - StreamPosition int64 } type Lexer struct { position - stream token.TokenStream - eof bool + stream iface.TokenStream + eof bool } func NewLexerBytes(src []byte) *Lexer { lexer := &Lexer{stream: bytes.NewReader(src)} - lexer.position.Reset() + lexer.reset() return lexer } @@ -42,95 +43,92 @@ func NewLexerFile(fpath string) (*Lexer, error) { return nil, err } lexer := &Lexer{stream: stream.NewWindowReader(s)} - lexer.position.Reset() + lexer.reset() return lexer, nil } func NewLexer(reader io.Reader) (*Lexer, error) { lexer := &Lexer{} - lexer.position.Reset() - if lexer.stream, _ = reader.(token.TokenStream); lexer.stream == nil { + lexer.reset() + if lexer.stream, _ = reader.(iface.TokenStream); lexer.stream == nil { lexer.stream = stream.NewWindowReader(reader) - } else { - lexer.position.StreamPosition, _ = lexer.stream.Seek(0, io.SeekCurrent) } return lexer, nil } -func (l Lexer) GetStream() io.Reader { +func (l *Lexer) reset () { + l.position.Reset() +} + +func (l Lexer) GetStream() iface.TokenStream { return l.stream } +type checkPoint int64 + +func (c checkPoint) DistanceFrom (o iface.CheckPoint) int { + return int (c - o.(checkPoint)) +} + +func (l Lexer) GetCheckPoint() iface.CheckPoint { + pos, _ := l.stream.Seek(0, io.SeekCurrent) + return checkPoint(pos) +} + +func (l Lexer) GotoCheckPoint(cp iface.CheckPoint) { + l.stream.Seek(int64(cp.(checkPoint)), io.SeekStart) +} + func (l *Lexer) Scan() (tok *token.Token) { tok = new(token.Token) - if l.eof { - tok.Type = token.EOF - tok.Pos = l.position.Pos - return - } - l.position.StreamPosition, _ = l.stream.Seek(0, io.SeekCurrent) - start, end := l.position, position{} tok.Type = token.INVALID tok.Lit = []byte{} - state, rune1 := 0, rune(-1) - for state != -1 { - if l.eof { - rune1 = -1 - } else { - rune2, size, err := l.stream.ReadRune() - if err == io.EOF { - l.eof = true - err = nil - } - if err == nil && size > 0 { - rune1 = rune2 - l.position.StreamPosition += int64(size) - l.position.Pos.Offset += size - } - } - + start := l.position + state := 0 + for state != -1 { + curr, size, err := l.stream.ReadRune() + if size < 1 || err != nil { + curr = INVALID_RUNE + } + if size > 0 { + l.position.Pos.Offset += size + } nextState := -1 - if rune1 != -1 { - nextState = TransTab[state](rune1) - } + if err == nil { + if curr != INVALID_RUNE { + nextState = TransTab[state](curr) + } + } state = nextState - if state != -1 { - switch rune1 { - case '\n': - l.position.Pos.Line++ - l.position.Pos.Column = 1 - case '\r': - l.position.Pos.Column = 1 - case '\t': - l.position.Pos.Column += 4 - default: - l.position.Pos.Column++ - } - + switch curr { + case '\n': + l.position.Pos.Line++ + l.position.Pos.Column = 1 + case '\r': + l.position.Pos.Column = 1 + case '\t': + l.position.Pos.Column += 4 + default: + l.position.Pos.Column++ + } switch { case ActTab[state].Accept != -1: tok.Type = ActTab[state].Accept - l.position.StreamPosition, _ = l.stream.Seek(0, io.SeekCurrent) - end = l.position - tok.Lit = append(tok.Lit, string(rune1)...) + tok.Lit = append(tok.Lit, string(curr)...) case ActTab[state].Ignore != "": start = l.position state = 0 tok.Lit = []byte{} - if l.eof { - tok.Type = token.EOF - } - } } else { - if tok.Type == token.INVALID { - end = l.position - } - } - } - if end.Pos.Offset > start.Pos.Offset { - l.Reposition(end) + l.stream.UnreadRune() + } + if err == io.EOF && len(tok.Lit)==0 { + tok.Type = token.EOF + tok.Pos = start.Pos + return + } } tok.Pos = start.Pos return @@ -140,11 +138,6 @@ func (l *Lexer) Reset() { l.position.Reset() } -func (l *Lexer) Reposition(p position) { - l.position = p - l.stream.Seek(l.position.StreamPosition, io.SeekStart) -} - func (l Lexer) CurrentPosition() position { return l.position } diff --git a/internal/frontend/reparsed/internal/parser/parser.go b/internal/frontend/reparsed/internal/parser/parser.go index 03f015f9..5983e060 100644 --- a/internal/frontend/reparsed/internal/parser/parser.go +++ b/internal/frontend/reparsed/internal/parser/parser.go @@ -5,9 +5,9 @@ package parser import ( "errors" "fmt" - "io" "strings" + "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/iface" parseError "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/internal/errors" "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/internal/token" ) @@ -95,12 +95,7 @@ type Parser struct { userContext interface{} } -type Scanner interface { - Scan() (tok *token.Token) - GetStream() io.Reader -} - -type TokenStream = token.TokenStream +type TokenStream = iface.TokenStream func NewParser() *Parser { return NewParserWithContext(nil) @@ -117,7 +112,7 @@ func (p *Parser) Reset() { p.stack.push(0, nil) } -func (p *Parser) Error(err error, scanner Scanner) (recovered bool, errorAttrib *parseError.Error) { +func (p *Parser) Error(err error, scanner iface.Scanner) (recovered bool, errorAttrib *parseError.Error) { errorAttrib = &parseError.Error{ Err: err, ErrorToken: p.nextToken, @@ -187,41 +182,38 @@ func (p *Parser) newError(err error) error { return e } -func (p *Parser) Parse(scanner Scanner) (res interface{}, err error) { - r, e, _ := p.parse(scanner, false) - return r, e +func (p *Parser) Parse(scanner iface.Scanner) (res interface{}, err error, ptl int) { + return p.parse(scanner, false) } -func (p *Parser) ParseLongestPrefix(scanner Scanner) (res interface{}, err error, parsed []byte) { +func (p *Parser) ParseLongestPrefix(scanner iface.Scanner) (res interface{}, err error, ptl int) { return p.parse(scanner, true) } var errNotRepositionable = errors.New("scanner not repositionable") -func (p *Parser) parse(scanner Scanner, longest bool) (res interface{}, err error, parsed []byte) { +func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, err error, ptl int) { var ( - tokens TokenStream - afterPos int64 - checkPoint int64 + tokens iface.CheckPointable + afterPos iface.CheckPoint + checkPoint iface.CheckPoint ) readNextToken := func() error { if tokens == nil && (len(parserActions.table[p.stack.top()].cdActions) > 0 || longest) { - if tokens, _ = scanner.GetStream().(TokenStream); tokens == nil { - return errNotRepositionable - } - } - if len(parserActions.table[p.stack.top()].cdActions) > 0 { - checkPoint, _ = tokens.Seek(0, io.SeekCurrent) + return errNotRepositionable } + checkPoint = tokens.GetCheckPoint() p.nextToken = scanner.Scan() if longest { - afterPos, _ = tokens.Seek(0, io.SeekCurrent) + afterPos = tokens.GetCheckPoint() } return nil } p.Reset() + tokens, _ = scanner.(iface.CheckPointable) + startCp := tokens.GetCheckPoint() if err := readNextToken(); err != nil { - return nil, err, []byte{} + return nil, err, tokens.GetCheckPoint().DistanceFrom(startCp) } for acc := false; !acc; { action := parserActions.table[p.stack.top()].actions[p.nextToken.Type] @@ -230,14 +222,15 @@ func (p *Parser) parse(scanner Scanner, longest bool) (res interface{}, err erro // If no action, check if we have some context dependent parsing to try // for _, cdAction := range parserActions.table[p.stack.top()].cdActions { - tokens.Seek(checkPoint, io.SeekStart) - cd_res, cd_err, cd_parsed := cdAction.tokenScanner(tokens, p.userContext) + tokens.GotoCheckPoint(checkPoint) + cd_res, cd_err, cd_parsed := cdAction.tokenScanner(scanner.GetStream(), p.userContext) if cd_err == nil && len(cd_parsed) > 0 { action = parserActions.table[p.stack.top()].actions[cdAction.tokenIndex] if action != nil { p.nextToken.Foreign = true p.nextToken.ForeignAstNode = cd_res p.nextToken.Lit = cd_parsed + p.nextToken.Type = token.Type(cdAction.tokenIndex) break } } @@ -251,13 +244,13 @@ func (p *Parser) parse(scanner Scanner, longest bool) (res interface{}, err erro // Dirty, dirty, dirty... but I found it as it is, and I prefer not to touch // if action == nil && longest { - tokens.Seek(checkPoint, io.SeekStart) + tokens.GotoCheckPoint(checkPoint) action = parserActions.table[p.stack.top()].actions[token.EOF] if action == nil { // // ok, let's consume the token then // - tokens.Seek(afterPos, io.SeekStart) + tokens.GotoCheckPoint(afterPos) } } @@ -267,7 +260,7 @@ func (p *Parser) parse(scanner Scanner, longest bool) (res interface{}, err erro if action == nil { if recovered, errAttrib := p.Error(nil, scanner); !recovered { p.nextToken = errAttrib.ErrorToken - return nil, p.newError(nil), []byte{} + return nil, p.newError(nil), tokens.GetCheckPoint().DistanceFrom(startCp) } if action = parserActions.table[p.stack.top()].actions[p.nextToken.Type]; action == nil { panic("Error recovery led to invalid action") @@ -284,13 +277,13 @@ func (p *Parser) parse(scanner Scanner, longest bool) (res interface{}, err erro p.stack.push(int(act), p.nextToken.ForeignAstNode) } if err := readNextToken(); err != nil { - return nil, err, []byte{} + return nil, err, tokens.GetCheckPoint().DistanceFrom(startCp) } case reduce: prod := productionsTable[int(act)] attrib, err := prod.ReduceFunc(p.userContext, p.stack.popN(prod.NumSymbols)) if err != nil { - return nil, p.newError(err), []byte{} + return nil, p.newError(err), tokens.GetCheckPoint().DistanceFrom(startCp) } else { p.stack.push(gotoTab[p.stack.top()][prod.NTType], attrib) } @@ -298,5 +291,5 @@ func (p *Parser) parse(scanner Scanner, longest bool) (res interface{}, err erro panic("unknown action: " + action.String()) } } - return res, nil, []byte{} + return res, nil, tokens.GetCheckPoint().DistanceFrom(startCp) } diff --git a/internal/frontend/reparsed/internal/token/token.go b/internal/frontend/reparsed/internal/token/token.go index cb5ea6f5..fe25a5e4 100644 --- a/internal/frontend/reparsed/internal/token/token.go +++ b/internal/frontend/reparsed/internal/token/token.go @@ -4,15 +4,8 @@ package token import ( "fmt" - "io" ) -type TokenStream interface { - io.Reader - io.RuneScanner - io.Seeker -} - type Token struct { Type Lit []byte diff --git a/internal/frontend/reparsed/main/main.go b/internal/frontend/reparsed/main/main.go index 10b5a50d..5c6bb6ec 100644 --- a/internal/frontend/reparsed/main/main.go +++ b/internal/frontend/reparsed/main/main.go @@ -9,11 +9,11 @@ import ( reparsed "github.com/maxcalandrelli/gocc/internal/frontend/reparsed" ) -func showResult(r interface{}, e error) { +func showResult(r interface{}, e error, l int) { if e != nil { fmt.Fprintf(os.Stderr, "parsing returned the following error: %s\n", e.Error()) } else { - fmt.Printf("%#v\n", r) + fmt.Printf("r=%#v, %d bytes\n", r, l) } } @@ -23,18 +23,31 @@ var ( Longest bool ) +func parse(longest bool, lex *reparsed.Lexer) (res interface{}, err error, ptl int) { + if longest { + return reparsed.NewParser().ParseLongestPrefix(lex) + } else { + return reparsed.NewParser().Parse(lex) + } + return +} + func main() { flag.StringVar(&File, "file", "", "parse also text in file") flag.StringVar(&Text, "text", "", "parse also text given with flag") flag.BoolVar(&Longest, "longest", false, "parse longest possible part") flag.Parse() if Text > "" { - showResult(reparsed.ParseText(Text)) + showResult(parse(Longest, reparsed.NewLexerString(Text))) } if File > "" { - showResult(reparsed.ParseFile(File)) + l, e := reparsed.NewLexerFile(File) + if e != nil { + panic(e) + } + showResult(parse(Longest, l)) } - if str := strings.Join(os.Args[1:], " "); str > "" { - showResult(reparsed.ParseText(str)) + if str := strings.Join(flag.Args(), " "); str > "" { + showResult(parse(Longest, reparsed.NewLexerString(str))) } } diff --git a/internal/frontend/reparsed/reparsed.go b/internal/frontend/reparsed/reparsed.go index 0d4ccadb..38e7b511 100644 --- a/internal/frontend/reparsed/reparsed.go +++ b/internal/frontend/reparsed/reparsed.go @@ -5,6 +5,7 @@ package reparsed import ( "io" + "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/iface" "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/internal/io/stream" "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/internal/lexer" "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/internal/parser" @@ -13,20 +14,22 @@ import ( type ( Token = token.Token - TokenStream = token.TokenStream + Lexer = lexer.Lexer + Parser = parser.Parser + TokenStream = iface.TokenStream WindowReader = stream.WindowReader - Scanner = parser.Scanner + Scanner = iface.Scanner ) -func ParseFile(fpath string) (interface{}, error) { +func ParseFile(fpath string) (interface{}, error, int) { if lexer, err := NewLexerFile(fpath); err == nil { return NewParser().Parse(lexer) } else { - return nil, err + return nil, err, 0 } } -func ParseText(text string) (interface{}, error) { +func ParseText(text string) (interface{}, error, int) { return NewParser().Parse(NewLexerBytes([]byte(text))) } @@ -34,6 +37,10 @@ func NewLexerBytes(src []byte) *lexer.Lexer { return lexer.NewLexerBytes(src) } +func NewLexerString(src string) *lexer.Lexer { + return lexer.NewLexerBytes([]byte(src)) +} + func NewLexerFile(fpath string) (*lexer.Lexer, error) { return lexer.NewLexerFile(fpath) } diff --git a/internal/io/gen/golang/gen.go b/internal/io/gen/golang/gen.go index fa1f4ca9..188173fd 100644 --- a/internal/io/gen/golang/gen.go +++ b/internal/io/gen/golang/gen.go @@ -345,7 +345,7 @@ func (s *impl_WindowReader) unreadRune() (err error) { tmpb := []byte{} for { if _, err = tmps.seek(-1, io.SeekCurrent); err == nil { - b, _ := tmps.PeekByte() + b, _ := tmps.peekByte() tmpb = append([]byte{b}, tmpb...) switch len(tmpb) { case 1: @@ -468,7 +468,7 @@ func (s *impl_WindowReader) ReadByte() (byte, error) { func (s *impl_WindowReader) PeekByte() (byte, error) { s.lockReader() defer func() { s.unlockReader() }() - return s.PeekByte() + return s.peekByte() } func (s *impl_WindowReader) UnreadByte() error { diff --git a/internal/lexer/gen/golang/lexer.go b/internal/lexer/gen/golang/lexer.go index 2faaafad..1cae2a70 100644 --- a/internal/lexer/gen/golang/lexer.go +++ b/internal/lexer/gen/golang/lexer.go @@ -40,25 +40,23 @@ func genLexer(pkg, outDir string, itemsets *items.ItemSets, cfg config.Config, s func getLexerData(pkg, outDir string, itemsets *items.ItemSets, cfg config.Config, subpath string) *lexerData { lexSymbols := itemsets.Symbols().List() return &lexerData{ - Debug: cfg.DebugLexer(), - TokenImport: path.Join(pkg, subpath, "token"), - UtilImport: path.Join(pkg, subpath, "util"), - StreamImport: path.Join(pkg, subpath, "io/stream"), - NumStates: itemsets.Size(), - NumSymbols: len(lexSymbols), - Symbols: lexSymbols, + Debug: cfg.DebugLexer(), + PkgPath: pkg, + SubPath: subpath, + NumStates: itemsets.Size(), + NumSymbols: len(lexSymbols), + Symbols: lexSymbols, } } type lexerData struct { - Debug bool - TokenImport string - UtilImport string - StreamImport string - NumStates int - NumSymbols int - NextState []byte - Symbols []string + Debug bool + PkgPath string + SubPath string + NumStates int + NumSymbols int + NextState []byte + Symbols []string } const lexerSrc string = ` @@ -67,38 +65,37 @@ const lexerSrc string = ` package lexer import ( -{{if .Debug}} "fmt" -{{end}} + {{if .Debug}} "fmt" {{end}} "io" "bytes" "os" -{{if .Debug}} "{{.UtilImport}}" -{{end}} -"{{.TokenImport}}" -"{{.StreamImport}}" + {{if .Debug}} "{{.PkgPath}}/{{.SubPath}}/util" {{end}} + "{{.PkgPath}}/iface" + "{{.PkgPath}}/{{.SubPath}}/token" + "{{.PkgPath}}/{{.SubPath}}/io/stream" ) const ( NoState = -1 NumStates = {{.NumStates}} NumSymbols = {{.NumSymbols}} + INVALID_RUNE = rune(-1) ) type position struct { token.Pos - StreamPosition int64 } type Lexer struct { position - stream token.TokenStream - eof bool + stream iface.TokenStream + eof bool } func NewLexerBytes(src []byte) *Lexer { lexer := &Lexer{stream: bytes.NewReader(src)} - lexer.position.Reset() + lexer.reset() return lexer } @@ -108,108 +105,108 @@ func NewLexerFile(fpath string) (*Lexer, error) { return nil, err } lexer := &Lexer{stream: stream.NewWindowReader(s)} - lexer.position.Reset() + lexer.reset() return lexer, nil } func NewLexer(reader io.Reader) (*Lexer, error) { lexer := &Lexer{} - lexer.position.Reset() - if lexer.stream, _ = reader.(token.TokenStream); lexer.stream == nil { + lexer.reset() + if lexer.stream, _ = reader.(iface.TokenStream); lexer.stream == nil { lexer.stream = stream.NewWindowReader(reader) - } else { - lexer.position.StreamPosition, _ = lexer.stream.Seek(0, io.SeekCurrent) } return lexer, nil } -func (l Lexer) GetStream() io.Reader { +func (l *Lexer) reset () { + l.position.Reset() +} + +func (l Lexer) GetStream() iface.TokenStream { return l.stream } +type checkPoint int64 + +func (c checkPoint) DistanceFrom (o iface.CheckPoint) int { + return int (c - o.(checkPoint)) +} + +func (l Lexer) GetCheckPoint() iface.CheckPoint { + pos, _ := l.stream.Seek(0, io.SeekCurrent) + return checkPoint(pos) +} + +func (l Lexer) GotoCheckPoint(cp iface.CheckPoint) { + l.stream.Seek(int64(cp.(checkPoint)), io.SeekStart) +} + func (l *Lexer) Scan() (tok *token.Token) { {{- if .Debug}} fmt.Printf("Lexer.Scan() pos=%d\n", l.position.Pos.Offset) {{- end}} tok = new(token.Token) - if l.eof { - tok.Type = token.EOF - tok.Pos = l.position.Pos - return - } - l.position.StreamPosition, _ = l.stream.Seek(0, io.SeekCurrent) - start, end := l.position, position{} tok.Type = token.INVALID tok.Lit = []byte{} - state, rune1 := 0, rune(-1) - for state != -1 { + start := l.position + state := 0 + for state != -1 { {{- if .Debug}} fmt.Printf("\tpos=%d, line=%d, col=%d, state=%d\n", l.position.Pos.Offset, l.position.Pos.Line, l.position.Pos.Column, state) {{- end}} - if l.eof { - rune1 = -1 - } else { - rune2, size, err := l.stream.ReadRune() - if err == io.EOF { - l.eof = true - err = nil - } - if err == nil && size > 0 { - rune1 = rune2 - l.position.StreamPosition += int64(size) - l.position.Pos.Offset += size - } - } - - nextState := -1 - if rune1 != -1 { - nextState = TransTab[state](rune1) - } + curr, size, err := l.stream.ReadRune() + if size < 1 || err != nil { + curr = INVALID_RUNE + } {{- if .Debug}} - fmt.Printf("\tS%d, : tok=%s, rune == %s(%x), next state == %d\n", state, token.TokMap.Id(tok.Type), util.RuneToString(rune1), rune1, nextState) - fmt.Printf("\t\tpos=%d, size=%d, start=%d, end=%d\n", l.position.Pos.Offset, size, start.position.Pos.Offset, end.position.Pos.Offset) - if nextState != -1 { - fmt.Printf("\t\taction:%s\n", ActTab[nextState].String()) - } + fmt.Printf("\trune=<%c> size=%d err=%v\n", curr, size, err) {{- end}} + if size > 0 { + l.position.Pos.Offset += size + } + nextState := -1 + if err == nil { + if curr != INVALID_RUNE { + nextState = TransTab[state](curr) + } + {{- if .Debug}} + fmt.Printf("\tS%d, : tok=%s, rune == %s(%x), next state == %d\n", state, token.TokMap.Id(tok.Type), util.RuneToString(curr), curr, nextState) + fmt.Printf("\t\tpos=%d, size=%d, start=%d\n", l.position.Pos.Offset, size, start.Pos.Offset) + if nextState != -1 { + fmt.Printf("\t\taction:%s\n", ActTab[nextState].String()) + } + {{- end}} + } state = nextState - if state != -1 { - switch rune1 { - case '\n': - l.position.Pos.Line++ - l.position.Pos.Column = 1 - case '\r': - l.position.Pos.Column = 1 - case '\t': - l.position.Pos.Column += 4 - default: - l.position.Pos.Column++ - } - + switch curr { + case '\n': + l.position.Pos.Line++ + l.position.Pos.Column = 1 + case '\r': + l.position.Pos.Column = 1 + case '\t': + l.position.Pos.Column += 4 + default: + l.position.Pos.Column++ + } switch { case ActTab[state].Accept != -1: tok.Type = ActTab[state].Accept - l.position.StreamPosition, _ = l.stream.Seek(0, io.SeekCurrent) - end = l.position - tok.Lit = append(tok.Lit, string(rune1)...) + tok.Lit = append(tok.Lit, string(curr)...) case ActTab[state].Ignore != "": start = l.position state = 0 tok.Lit = []byte{} - if l.eof { - tok.Type = token.EOF - } - } } else { - if tok.Type == token.INVALID { - end = l.position - } - } - } - if end.Pos.Offset > start.Pos.Offset { - l.Reposition(end) + l.stream.UnreadRune() + } + if err == io.EOF && len(tok.Lit)==0 { + tok.Type = token.EOF + tok.Pos = start.Pos + return + } } tok.Pos = start.Pos {{- if .Debug}} @@ -222,11 +219,6 @@ func (l *Lexer) Reset() { l.position.Reset() } -func (l *Lexer) Reposition(p position) { - l.position = p - l.stream.Seek(l.position.StreamPosition, io.SeekStart) -} - func (l Lexer) CurrentPosition() position { return l.position } diff --git a/internal/parser/gen/golang/parser.go b/internal/parser/gen/golang/parser.go index 0a37bb29..66844c1f 100644 --- a/internal/parser/gen/golang/parser.go +++ b/internal/parser/gen/golang/parser.go @@ -46,8 +46,8 @@ func GenParser(pkg, outDir string, prods ast.SyntaxProdList, itemSets *items.Ite type parserData struct { Debug bool - ErrorImport string - TokenImport string + PkgPath string + SubPath string NumProductions int NumStates int NumSymbols int @@ -57,8 +57,8 @@ type parserData struct { func getParserData(pkg, subpath string, prods ast.SyntaxProdList, itemSets *items.ItemSets, symbols *symbols.Symbols, cfg config.Config) *parserData { return &parserData{ Debug: cfg.DebugParser(), - ErrorImport: path.Join(pkg, subpath, "errors"), - TokenImport: path.Join(pkg, subpath, "token"), + PkgPath: pkg, + SubPath: subpath, NumProductions: len(prods), NumStates: itemSets.Size(), NumSymbols: symbols.NumSymbols(), @@ -73,12 +73,12 @@ package parser import ( "fmt" - "io" "strings" "errors" - parseError "{{.ErrorImport}}" - "{{.TokenImport}}" + parseError "{{.PkgPath}}/{{.SubPath}}/errors" + "{{.PkgPath}}/{{.SubPath}}/token" + "{{.PkgPath}}/iface" ) const ( @@ -164,12 +164,7 @@ type Parser struct { userContext interface{} } -type Scanner interface { - Scan() (tok *token.Token) - GetStream () io.Reader -} - -type TokenStream = token.TokenStream +type TokenStream = iface.TokenStream {{- range $c := .CdTokList }} {{ printf "func cdFunc_%s (Stream TokenStream, Context interface{}) (interface{}, error, []byte) {return %s}" $c.SymbolString $c.ContexDependentParseFunctionCall }} @@ -191,7 +186,7 @@ func (p *Parser) Reset() { p.stack.push(0, nil) } -func (p *Parser) Error(err error, scanner Scanner) (recovered bool, errorAttrib *parseError.Error) { +func (p *Parser) Error(err error, scanner iface.Scanner) (recovered bool, errorAttrib *parseError.Error) { errorAttrib = &parseError.Error{ Err: err, ErrorToken: p.nextToken, @@ -261,42 +256,39 @@ func (p *Parser) newError(err error) error { return e } -func (p *Parser) Parse(scanner Scanner) (res interface{}, err error) { - r, e, _ := p.parse(scanner, false) - return r, e +func (p *Parser) Parse(scanner iface.Scanner) (res interface{}, err error, ptl int) { + return p.parse(scanner, false) } -func (p *Parser) ParseLongestPrefix(scanner Scanner) (res interface{}, err error, parsed []byte) { +func (p *Parser) ParseLongestPrefix(scanner iface.Scanner) (res interface{}, err error, ptl int) { return p.parse(scanner, true) } var errNotRepositionable = errors.New("scanner not repositionable") -func (p *Parser) parse(scanner Scanner, longest bool) (res interface{}, err error, parsed []byte) { +func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, err error, ptl int) { var ( - tokens TokenStream - afterPos int64 - checkPoint int64 + tokens iface.CheckPointable + afterPos iface.CheckPoint + checkPoint iface.CheckPoint ) readNextToken := func () error { if tokens == nil && (len(parserActions.table[p.stack.top()].cdActions) > 0 || longest) { - if tokens, _ = scanner.GetStream().(TokenStream); tokens == nil { - return errNotRepositionable - } - } - if len(parserActions.table[p.stack.top()].cdActions) > 0 { - checkPoint, _ = tokens.Seek (0, io.SeekCurrent) + return errNotRepositionable } + checkPoint = tokens.GetCheckPoint() p.nextToken = scanner.Scan() if longest { - afterPos , _ = tokens.Seek (0, io.SeekCurrent) + afterPos = tokens.GetCheckPoint() } return nil } p.Reset() + tokens, _ = scanner.(iface.CheckPointable) + startCp := tokens.GetCheckPoint() if err := readNextToken(); err != nil { - return nil, err, []byte{} + return nil, err, tokens.GetCheckPoint().DistanceFrom(startCp) } for acc := false; !acc; { action := parserActions.table[p.stack.top()].actions[p.nextToken.Type] @@ -305,14 +297,15 @@ func (p *Parser) parse(scanner Scanner, longest bool) (res interface{}, err erro // If no action, check if we have some context dependent parsing to try // for _, cdAction := range parserActions.table[p.stack.top()].cdActions { - tokens.Seek(checkPoint, io.SeekStart) - cd_res, cd_err, cd_parsed := cdAction.tokenScanner(tokens, p.userContext) + tokens.GotoCheckPoint (checkPoint) + cd_res, cd_err, cd_parsed := cdAction.tokenScanner(scanner.GetStream(), p.userContext) if cd_err == nil && len(cd_parsed) > 0 { action = parserActions.table[p.stack.top()].actions[cdAction.tokenIndex] if action != nil { p.nextToken.Foreign = true p.nextToken.ForeignAstNode = cd_res p.nextToken.Lit = cd_parsed + p.nextToken.Type = token.Type(cdAction.tokenIndex) break } } @@ -326,13 +319,16 @@ func (p *Parser) parse(scanner Scanner, longest bool) (res interface{}, err erro // Dirty, dirty, dirty... but I found it as it is, and I prefer not to touch // if action == nil && longest { - tokens.Seek(checkPoint, io.SeekStart) + tokens.GotoCheckPoint(checkPoint) action = parserActions.table[p.stack.top()].actions[token.EOF] if action == nil { // // ok, let's consume the token then // - tokens.Seek(afterPos, io.SeekStart) + {{- if .Debug }} + fmt.Printf("S%d unrecognized=<%#v> restoring checkpoint at %#v => %s\n", p.stack.top(), p.nextToken, afterPos, action) + {{- end }} + tokens.GotoCheckPoint(afterPos) } } @@ -342,7 +338,7 @@ func (p *Parser) parse(scanner Scanner, longest bool) (res interface{}, err erro if action == nil { if recovered, errAttrib := p.Error(nil, scanner); !recovered { p.nextToken = errAttrib.ErrorToken - return nil, p.newError(nil), []byte{} + return nil, p.newError(nil), tokens.GetCheckPoint().DistanceFrom(startCp) } if action = parserActions.table[p.stack.top()].actions[p.nextToken.Type]; action == nil { panic("Error recovery led to invalid action") @@ -362,13 +358,13 @@ func (p *Parser) parse(scanner Scanner, longest bool) (res interface{}, err erro p.stack.push(int(act), p.nextToken.ForeignAstNode) } if err := readNextToken(); err != nil { - return nil, err, []byte{} + return nil, err, tokens.GetCheckPoint().DistanceFrom(startCp) } case reduce: prod := productionsTable[int(act)] attrib, err := prod.ReduceFunc(p.userContext, p.stack.popN(prod.NumSymbols)) if err != nil { - return nil, p.newError(err), []byte{} + return nil, p.newError(err), tokens.GetCheckPoint().DistanceFrom(startCp) } else { p.stack.push(gotoTab[p.stack.top()][prod.NTType], attrib) } @@ -376,6 +372,6 @@ func (p *Parser) parse(scanner Scanner, longest bool) (res interface{}, err erro panic("unknown action: " + action.String()) } } - return res, nil, []byte{} + return res, nil, tokens.GetCheckPoint().DistanceFrom(startCp) } ` diff --git a/internal/token/gen/golang/token.go b/internal/token/gen/golang/token.go index a5c76566..6e339997 100644 --- a/internal/token/gen/golang/token.go +++ b/internal/token/gen/golang/token.go @@ -69,16 +69,8 @@ package token import ( "fmt" - "io" ) -type TokenStream interface { - io.Reader - io.RuneScanner - io.Seeker -} - - type Token struct { Type Lit []byte diff --git a/main.go b/main.go index 7cb47e47..d6869fe9 100644 --- a/main.go +++ b/main.go @@ -106,7 +106,7 @@ func main() { p := altfe.NewParser() grammar, err = p.Parse(scanner) */ - grammar, err = altfe.ParseFile(cfg.SourceFile()) + grammar, err, _ = altfe.ParseFile(cfg.SourceFile()) if err != nil { fmt.Printf("Parse error: %s\n", err) os.Exit(1) diff --git a/spec/gocc2.ebnf b/spec/gocc2.ebnf index 050a6543..7167788a 100644 --- a/spec/gocc2.ebnf +++ b/spec/gocc2.ebnf @@ -15,8 +15,9 @@ !comment : _lineComment | _blockComment ; !whitespace : ' ' | '\t' | '\n' | '\r' ; +_line_Comment : '/' '/' { ' ' } '\n' ; _lineComment : '/' '/' {.} '\n' ; -_blockComment : '/' '*' {. | '*'} '*' '/' ; +_blockComment : '/' '*' { . | '*' } '*' '/' ; _tokId : _lowcase {_id_char} ; _lowcase : 'a'-'z' ; _id_char : _upcase | _lowcase | '_' | _digit ; diff --git a/spec/test.bnf b/spec/test.bnf index 1ed6db55..7fde29ea 100644 --- a/spec/test.bnf +++ b/spec/test.bnf @@ -1,7 +1,7 @@ !comment : _lineComment | _blockComment ; !whitespace : ' ' | '\t' | '\n' | '\r' ; -_lineComment : '/' '/' {.} '\n' ; +_lineComment : '$' '/' '/' {.} '\n' ; _blockComment : '/' '*' {. | '*'} '*' '/' ; _tokId : _lowcase {_id_char} ; _lowcase : 'a'-'z' ; @@ -24,7 +24,7 @@ Test : ; Test1: - "try" Test2 + "try" Test2 << $1, nil >> ; Test2 : Test3 | Test1; @@ -60,17 +60,18 @@ X: count++ default: Stream.UnreadRune() - fmt.Printf("count=%d rune=<%c> ret=%s\n", count, r, string(ret)) + fmt.Printf("count=%d rune=<%c> ret=<%s>\n", count, r, string(ret)) return count, nil, ret } } return nil, nil, []byte{} }() @@ + Test2 << func () (interface{}, error) { - fmt.Printf("$0=%q\n$1=%q\n", $0, $1) - return nil, nil + fmt.Printf("$0=%#v\n$1=%#v\n", $0, $1) + return "buongiorno", nil } () >> ; From 3227a76a7b7f28b8692b45f1b6d08d3e42ce3798 Mon Sep 17 00:00:00 2001 From: Massimiliano Calandrelli Date: Thu, 10 Oct 2019 20:07:00 +0200 Subject: [PATCH 17/33] ... --- example/astx/ast.bnf | 4 +- example/astx/astx.go | 62 ++ example/astx/iface/iface.go | 30 + example/astx/internal/errors/errors.go | 56 ++ .../io/stream/internal/stream_impl.go | 275 ++++++ .../io/stream/internal/stream_public.go | 101 ++ example/astx/internal/io/stream/stream.go | 39 + example/astx/internal/lexer/acttab.go | 51 + example/astx/internal/lexer/lexer.go | 153 +++ .../astx/internal/lexer/transitiontable.go | 109 +++ .../internal}/parser/action.go | 0 example/astx/internal/parser/actiontable.go | 70 ++ example/astx/internal/parser/gototable.go | 38 + example/astx/internal/parser/parser.go | 295 ++++++ .../astx/internal/parser/productionstable.go | 63 ++ .../{nolexer => astx/internal}/token/token.go | 31 +- .../internal}/util/litconv.go | 0 .../{nolexer => astx/internal}/util/rune.go | 0 example/astx/main/main.go | 53 ++ example/bools/bools.go | 62 ++ example/bools/iface/iface.go | 30 + example/bools/internal/errors/errors.go | 56 ++ .../io/stream/internal/stream_impl.go | 275 ++++++ .../io/stream/internal/stream_public.go | 101 ++ example/bools/internal/io/stream/stream.go | 39 + example/bools/internal/lexer/acttab.go | 111 +++ example/bools/internal/lexer/lexer.go | 153 +++ .../bools/internal/lexer/transitiontable.go | 196 ++++ example/bools/internal/parser/action.go | 51 + example/bools/internal/parser/actiontable.go | 899 ++++++++++++++++++ example/bools/internal/parser/gototable.go | 381 ++++++++ example/bools/internal/parser/parser.go | 295 ++++++ .../bools/internal/parser/productionstable.go | 155 +++ example/bools/internal/token/token.go | 107 +++ example/bools/internal/util/litconv.go | 108 +++ example/bools/internal/util/rune.go | 39 + example/bools/main/main.go | 53 ++ example/bools/parser/productionstable.go | 4 +- example/calc/calc.go | 62 ++ example/calc/iface/iface.go | 30 + example/calc/internal/errors/errors.go | 56 ++ .../io/stream/internal/stream_impl.go | 275 ++++++ .../io/stream/internal/stream_public.go | 101 ++ example/calc/internal/io/stream/stream.go | 39 + example/calc/internal/lexer/acttab.go | 55 ++ example/calc/internal/lexer/lexer.go | 153 +++ .../calc/internal/lexer/transitiontable.go | 83 ++ example/calc/internal/parser/action.go | 51 + example/calc/internal/parser/actiontable.go | 324 +++++++ example/calc/internal/parser/gototable.go | 174 ++++ example/calc/internal/parser/parser.go | 295 ++++++ .../calc/internal/parser/productionstable.go | 106 +++ example/calc/internal/token/token.go | 95 ++ example/calc/internal/util/litconv.go | 108 +++ example/calc/internal/util/rune.go | 39 + example/calc/main/main.go | 53 ++ example/calc/parser/productionstable.go | 2 +- example/ctx/ctx.go | 62 ++ example/ctx/errors/errors.go | 2 +- example/ctx/iface/iface.go | 30 + example/ctx/internal/errors/errors.go | 56 ++ .../io/stream/internal/stream_impl.go | 275 ++++++ .../io/stream/internal/stream_public.go | 101 ++ example/ctx/internal/io/stream/stream.go | 39 + example/ctx/internal/lexer/acttab.go | 67 ++ example/ctx/internal/lexer/lexer.go | 153 +++ example/ctx/internal/lexer/transitiontable.go | 179 ++++ example/ctx/internal/parser/action.go | 51 + example/ctx/internal/parser/actiontable.go | 85 ++ example/ctx/internal/parser/gototable.go | 43 + example/ctx/internal/parser/parser.go | 295 ++++++ .../ctx/internal/parser/productionstable.go | 75 ++ example/ctx/internal/token/token.go | 89 ++ example/ctx/internal/util/litconv.go | 108 +++ example/ctx/internal/util/rune.go | 39 + example/ctx/lexer/acttab.go | 18 +- example/ctx/lexer/lexer.go | 28 +- example/ctx/lexer/transitiontable.go | 106 ++- example/ctx/main/main.go | 53 ++ example/ctx/parser/actiontable.go | 14 + example/ctx/parser/gototable.go | 7 +- example/ctx/parser/parser.go | 10 +- example/ctx/parser/productionstable.go | 15 +- example/ctx/token/token.go | 2 + example/errorrecovery/errorrecovery.go | 62 ++ example/errorrecovery/iface/iface.go | 30 + .../errorrecovery/internal/errors/errors.go | 56 ++ .../io/stream/internal/stream_impl.go | 275 ++++++ .../io/stream/internal/stream_public.go | 101 ++ .../internal/io/stream/stream.go | 39 + .../errorrecovery/internal/lexer/acttab.go | 51 + example/errorrecovery/internal/lexer/lexer.go | 153 +++ .../internal/lexer/transitiontable.go | 109 +++ .../errorrecovery/internal/parser/action.go | 51 + .../internal/parser/actiontable.go | 70 ++ .../internal/parser/gototable.go | 38 + .../errorrecovery/internal/parser/parser.go | 295 ++++++ .../internal/parser/productionstable.go | 73 ++ example/errorrecovery/internal/token/token.go | 87 ++ .../errorrecovery/internal/util/litconv.go | 108 +++ example/errorrecovery/internal/util/rune.go | 39 + example/errorrecovery/main/main.go | 53 ++ example/mail/iface/iface.go | 30 + .../io/stream/internal/stream_impl.go | 275 ++++++ .../io/stream/internal/stream_public.go | 101 ++ example/mail/internal/io/stream/stream.go | 39 + example/mail/internal/lexer/acttab.go | 83 ++ example/mail/internal/lexer/lexer.go | 153 +++ .../mail/internal/lexer/transitiontable.go | 510 ++++++++++ example/mail/internal/token/token.go | 87 ++ example/mail/internal/util/litconv.go | 108 +++ example/mail/internal/util/rune.go | 39 + example/mail/mail.go | 62 ++ example/mail/main/main.go | 53 ++ example/nolexer/iface/iface.go | 33 + example/nolexer/internal/errors/errors.go | 56 ++ .../io/stream/internal/stream_impl.go | 275 ++++++ .../io/stream/internal/stream_public.go | 101 ++ example/nolexer/internal/io/stream/stream.go | 39 + example/nolexer/internal/parser/action.go | 51 + .../nolexer/internal/parser/actiontable.go | 91 ++ example/nolexer/internal/parser/gototable.go | 43 + example/nolexer/internal/parser/parser.go | 298 ++++++ .../{ => internal}/parser/productionstable.go | 20 +- example/nolexer/internal/token/token.go | 91 ++ example/nolexer/internal/util/litconv.go | 108 +++ example/nolexer/internal/util/rune.go | 39 + example/nolexer/nolexer.bnf | 2 +- example/nolexer/nolexer_test.go | 6 +- example/nolexer/parser/actiontable.go | 74 -- example/nolexer/parser/gototable.go | 43 - example/nolexer/parser/parser.go | 216 ----- example/nolexer/scanner/scanner.go | 2 +- example/rr/iface/iface.go | 30 + .../{nolexer => rr/internal}/errors/errors.go | 2 +- .../io/stream/internal/stream_impl.go | 275 ++++++ .../io/stream/internal/stream_public.go | 101 ++ example/rr/internal/io/stream/stream.go | 39 + example/rr/internal/lexer/acttab.go | 39 + example/rr/internal/lexer/lexer.go | 153 +++ example/rr/internal/lexer/transitiontable.go | 49 + example/rr/internal/parser/action.go | 51 + example/rr/internal/parser/actiontable.go | 95 ++ example/rr/internal/parser/gototable.go | 55 ++ example/rr/internal/parser/parser.go | 295 ++++++ .../rr/internal/parser/productionstable.go | 91 ++ example/rr/internal/token/token.go | 89 ++ example/rr/internal/util/litconv.go | 108 +++ example/rr/internal/util/rune.go | 39 + example/rr/main/main.go | 53 ++ example/rr/parser/productionstable.go | 2 + example/rr/rr.go | 62 ++ example/sr/iface/iface.go | 30 + example/sr/internal/errors/errors.go | 56 ++ .../io/stream/internal/stream_impl.go | 275 ++++++ .../io/stream/internal/stream_public.go | 101 ++ example/sr/internal/io/stream/stream.go | 39 + example/sr/internal/lexer/acttab.go | 91 ++ example/sr/internal/lexer/lexer.go | 153 +++ example/sr/internal/lexer/transitiontable.go | 289 ++++++ example/sr/internal/parser/action.go | 51 + example/sr/internal/parser/actiontable.go | 217 +++++ example/sr/internal/parser/gototable.go | 77 ++ example/sr/internal/parser/parser.go | 295 ++++++ .../sr/internal/parser/productionstable.go | 63 ++ example/sr/internal/token/token.go | 93 ++ example/sr/internal/util/litconv.go | 108 +++ example/sr/internal/util/rune.go | 39 + example/sr/main/main.go | 53 ++ example/sr/sr.go | 62 ++ internal/base/gen/gen.go | 5 +- internal/base/gen/golang/base.go | 15 +- internal/config/config.go | 15 - internal/frontend/reparsed/iface/iface.go | 3 + .../frontend/reparsed/internal/lexer/lexer.go | 10 +- .../reparsed/internal/parser/parser.go | 25 +- internal/lexer/gen/golang/lexer.go | 24 +- internal/parser/gen/gen.go | 2 +- internal/parser/gen/golang/parser.go | 33 +- .../parser/gen/golang/productionstable.go | 17 +- main.go | 14 +- stock/main.go | 2 +- 182 files changed, 16867 insertions(+), 484 deletions(-) create mode 100644 example/astx/astx.go create mode 100644 example/astx/iface/iface.go create mode 100644 example/astx/internal/errors/errors.go create mode 100644 example/astx/internal/io/stream/internal/stream_impl.go create mode 100644 example/astx/internal/io/stream/internal/stream_public.go create mode 100644 example/astx/internal/io/stream/stream.go create mode 100644 example/astx/internal/lexer/acttab.go create mode 100644 example/astx/internal/lexer/lexer.go create mode 100644 example/astx/internal/lexer/transitiontable.go rename example/{nolexer => astx/internal}/parser/action.go (100%) create mode 100644 example/astx/internal/parser/actiontable.go create mode 100644 example/astx/internal/parser/gototable.go create mode 100644 example/astx/internal/parser/parser.go create mode 100644 example/astx/internal/parser/productionstable.go rename example/{nolexer => astx/internal}/token/token.go (70%) rename example/{nolexer => astx/internal}/util/litconv.go (100%) rename example/{nolexer => astx/internal}/util/rune.go (100%) create mode 100644 example/astx/main/main.go create mode 100644 example/bools/bools.go create mode 100644 example/bools/iface/iface.go create mode 100644 example/bools/internal/errors/errors.go create mode 100644 example/bools/internal/io/stream/internal/stream_impl.go create mode 100644 example/bools/internal/io/stream/internal/stream_public.go create mode 100644 example/bools/internal/io/stream/stream.go create mode 100644 example/bools/internal/lexer/acttab.go create mode 100644 example/bools/internal/lexer/lexer.go create mode 100644 example/bools/internal/lexer/transitiontable.go create mode 100644 example/bools/internal/parser/action.go create mode 100644 example/bools/internal/parser/actiontable.go create mode 100644 example/bools/internal/parser/gototable.go create mode 100644 example/bools/internal/parser/parser.go create mode 100644 example/bools/internal/parser/productionstable.go create mode 100644 example/bools/internal/token/token.go create mode 100644 example/bools/internal/util/litconv.go create mode 100644 example/bools/internal/util/rune.go create mode 100644 example/bools/main/main.go create mode 100644 example/calc/calc.go create mode 100644 example/calc/iface/iface.go create mode 100644 example/calc/internal/errors/errors.go create mode 100644 example/calc/internal/io/stream/internal/stream_impl.go create mode 100644 example/calc/internal/io/stream/internal/stream_public.go create mode 100644 example/calc/internal/io/stream/stream.go create mode 100644 example/calc/internal/lexer/acttab.go create mode 100644 example/calc/internal/lexer/lexer.go create mode 100644 example/calc/internal/lexer/transitiontable.go create mode 100644 example/calc/internal/parser/action.go create mode 100644 example/calc/internal/parser/actiontable.go create mode 100644 example/calc/internal/parser/gototable.go create mode 100644 example/calc/internal/parser/parser.go create mode 100644 example/calc/internal/parser/productionstable.go create mode 100644 example/calc/internal/token/token.go create mode 100644 example/calc/internal/util/litconv.go create mode 100644 example/calc/internal/util/rune.go create mode 100644 example/calc/main/main.go create mode 100644 example/ctx/ctx.go create mode 100644 example/ctx/iface/iface.go create mode 100644 example/ctx/internal/errors/errors.go create mode 100644 example/ctx/internal/io/stream/internal/stream_impl.go create mode 100644 example/ctx/internal/io/stream/internal/stream_public.go create mode 100644 example/ctx/internal/io/stream/stream.go create mode 100644 example/ctx/internal/lexer/acttab.go create mode 100644 example/ctx/internal/lexer/lexer.go create mode 100644 example/ctx/internal/lexer/transitiontable.go create mode 100644 example/ctx/internal/parser/action.go create mode 100644 example/ctx/internal/parser/actiontable.go create mode 100644 example/ctx/internal/parser/gototable.go create mode 100644 example/ctx/internal/parser/parser.go create mode 100644 example/ctx/internal/parser/productionstable.go create mode 100644 example/ctx/internal/token/token.go create mode 100644 example/ctx/internal/util/litconv.go create mode 100644 example/ctx/internal/util/rune.go create mode 100644 example/ctx/main/main.go create mode 100644 example/errorrecovery/errorrecovery.go create mode 100644 example/errorrecovery/iface/iface.go create mode 100644 example/errorrecovery/internal/errors/errors.go create mode 100644 example/errorrecovery/internal/io/stream/internal/stream_impl.go create mode 100644 example/errorrecovery/internal/io/stream/internal/stream_public.go create mode 100644 example/errorrecovery/internal/io/stream/stream.go create mode 100644 example/errorrecovery/internal/lexer/acttab.go create mode 100644 example/errorrecovery/internal/lexer/lexer.go create mode 100644 example/errorrecovery/internal/lexer/transitiontable.go create mode 100644 example/errorrecovery/internal/parser/action.go create mode 100644 example/errorrecovery/internal/parser/actiontable.go create mode 100644 example/errorrecovery/internal/parser/gototable.go create mode 100644 example/errorrecovery/internal/parser/parser.go create mode 100644 example/errorrecovery/internal/parser/productionstable.go create mode 100644 example/errorrecovery/internal/token/token.go create mode 100644 example/errorrecovery/internal/util/litconv.go create mode 100644 example/errorrecovery/internal/util/rune.go create mode 100644 example/errorrecovery/main/main.go create mode 100644 example/mail/iface/iface.go create mode 100644 example/mail/internal/io/stream/internal/stream_impl.go create mode 100644 example/mail/internal/io/stream/internal/stream_public.go create mode 100644 example/mail/internal/io/stream/stream.go create mode 100644 example/mail/internal/lexer/acttab.go create mode 100644 example/mail/internal/lexer/lexer.go create mode 100644 example/mail/internal/lexer/transitiontable.go create mode 100644 example/mail/internal/token/token.go create mode 100644 example/mail/internal/util/litconv.go create mode 100644 example/mail/internal/util/rune.go create mode 100644 example/mail/mail.go create mode 100644 example/mail/main/main.go create mode 100644 example/nolexer/iface/iface.go create mode 100644 example/nolexer/internal/errors/errors.go create mode 100644 example/nolexer/internal/io/stream/internal/stream_impl.go create mode 100644 example/nolexer/internal/io/stream/internal/stream_public.go create mode 100644 example/nolexer/internal/io/stream/stream.go create mode 100644 example/nolexer/internal/parser/action.go create mode 100644 example/nolexer/internal/parser/actiontable.go create mode 100644 example/nolexer/internal/parser/gototable.go create mode 100644 example/nolexer/internal/parser/parser.go rename example/nolexer/{ => internal}/parser/productionstable.go (68%) create mode 100644 example/nolexer/internal/token/token.go create mode 100644 example/nolexer/internal/util/litconv.go create mode 100644 example/nolexer/internal/util/rune.go delete mode 100644 example/nolexer/parser/actiontable.go delete mode 100644 example/nolexer/parser/gototable.go delete mode 100644 example/nolexer/parser/parser.go create mode 100644 example/rr/iface/iface.go rename example/{nolexer => rr/internal}/errors/errors.go (95%) create mode 100644 example/rr/internal/io/stream/internal/stream_impl.go create mode 100644 example/rr/internal/io/stream/internal/stream_public.go create mode 100644 example/rr/internal/io/stream/stream.go create mode 100644 example/rr/internal/lexer/acttab.go create mode 100644 example/rr/internal/lexer/lexer.go create mode 100644 example/rr/internal/lexer/transitiontable.go create mode 100644 example/rr/internal/parser/action.go create mode 100644 example/rr/internal/parser/actiontable.go create mode 100644 example/rr/internal/parser/gototable.go create mode 100644 example/rr/internal/parser/parser.go create mode 100644 example/rr/internal/parser/productionstable.go create mode 100644 example/rr/internal/token/token.go create mode 100644 example/rr/internal/util/litconv.go create mode 100644 example/rr/internal/util/rune.go create mode 100644 example/rr/main/main.go create mode 100644 example/rr/rr.go create mode 100644 example/sr/iface/iface.go create mode 100644 example/sr/internal/errors/errors.go create mode 100644 example/sr/internal/io/stream/internal/stream_impl.go create mode 100644 example/sr/internal/io/stream/internal/stream_public.go create mode 100644 example/sr/internal/io/stream/stream.go create mode 100644 example/sr/internal/lexer/acttab.go create mode 100644 example/sr/internal/lexer/lexer.go create mode 100644 example/sr/internal/lexer/transitiontable.go create mode 100644 example/sr/internal/parser/action.go create mode 100644 example/sr/internal/parser/actiontable.go create mode 100644 example/sr/internal/parser/gototable.go create mode 100644 example/sr/internal/parser/parser.go create mode 100644 example/sr/internal/parser/productionstable.go create mode 100644 example/sr/internal/token/token.go create mode 100644 example/sr/internal/util/litconv.go create mode 100644 example/sr/internal/util/rune.go create mode 100644 example/sr/main/main.go create mode 100644 example/sr/sr.go diff --git a/example/astx/ast.bnf b/example/astx/ast.bnf index 01698006..6bf87601 100644 --- a/example/astx/ast.bnf +++ b/example/astx/ast.bnf @@ -14,11 +14,11 @@ id : (_letter | '_') {_idchar} ; << import "github.com/maxcalandrelli/gocc/example/astx/ast" >> -StmtList : +StmtList : Stmt << ast.NewStmtList($0) >> | StmtList Stmt << ast.AppendStmt($0, $1) >> ; -Stmt : +Stmt : id << ast.NewStmt($0) >> ; \ No newline at end of file diff --git a/example/astx/astx.go b/example/astx/astx.go new file mode 100644 index 00000000..66a94f5c --- /dev/null +++ b/example/astx/astx.go @@ -0,0 +1,62 @@ +// Code generated by gocc; DO NOT EDIT. + +package astx + +import ( + "io" + + "github.com/maxcalandrelli/gocc/example/astx/iface" + "github.com/maxcalandrelli/gocc/example/astx/internal/io/stream" + "github.com/maxcalandrelli/gocc/example/astx/internal/lexer" + "github.com/maxcalandrelli/gocc/example/astx/internal/parser" + "github.com/maxcalandrelli/gocc/example/astx/internal/token" +) + +type ( + Token = token.Token + Lexer = lexer.Lexer + Parser = parser.Parser + TokenStream = iface.TokenStream + WindowReader = stream.WindowReader + Scanner = iface.Scanner +) + +func ParseFile(fpath string) (interface{}, error, int) { + if lexer, err := NewLexerFile(fpath); err == nil { + return NewParser().Parse(lexer) + } else { + return nil, err, 0 + } +} + +func ParseText(text string) (interface{}, error, int) { + return NewParser().Parse(NewLexerBytes([]byte(text))) +} + +func NewLexerBytes(src []byte) *lexer.Lexer { + return lexer.NewLexerBytes(src) +} + +func NewLexerString(src string) *lexer.Lexer { + return lexer.NewLexerBytes([]byte(src)) +} + +func NewLexerFile(fpath string) (*lexer.Lexer, error) { + return lexer.NewLexerFile(fpath) +} + +func NewParser() *parser.Parser { + return parser.NewParser() +} + +func NewWindowReaderFromBytes(src []byte) WindowReader { + return stream.NewWindowReaderFromBytes(src) +} + +func NewWindowReader(rdr io.Reader) WindowReader { + return stream.NewWindowReader(rdr) +} + +func NewLimitedWindowReader(rdr io.Reader, sizeMin, sizeMax int) WindowReader { + return stream.NewLimitedWindowReader(rdr, sizeMin, sizeMax) +} diff --git a/example/astx/iface/iface.go b/example/astx/iface/iface.go new file mode 100644 index 00000000..46188297 --- /dev/null +++ b/example/astx/iface/iface.go @@ -0,0 +1,30 @@ +// Code generated by gocc; DO NOT EDIT. + +package iface + +import ( + "github.com/maxcalandrelli/gocc/example/astx/internal/token" + "io" +) + +type ( + Scanner interface { + Scan() (tok *token.Token) + GetStream() TokenStream + } + + CheckPoint interface { + DistanceFrom(CheckPoint) int + } + + CheckPointable interface { + GetCheckPoint() CheckPoint + GotoCheckPoint(CheckPoint) + } + + TokenStream interface { + io.Reader + io.RuneScanner + io.Seeker + } +) diff --git a/example/astx/internal/errors/errors.go b/example/astx/internal/errors/errors.go new file mode 100644 index 00000000..ec96bb8d --- /dev/null +++ b/example/astx/internal/errors/errors.go @@ -0,0 +1,56 @@ +// Code generated by gocc; DO NOT EDIT. + +package errors + +import ( + "fmt" + "strings" + + "github.com/maxcalandrelli/gocc/example/astx/internal/token" +) + +type ErrorSymbol interface { +} + +type Error struct { + Err error + ErrorToken *token.Token + ErrorSymbols []ErrorSymbol + ExpectedTokens []string + StackTop int +} + +func (e *Error) String() string { + w := new(strings.Builder) + fmt.Fprintf(w, "Error") + if e.Err != nil { + fmt.Fprintf(w, " %s\n", e.Err) + } else { + fmt.Fprintf(w, "\n") + } + fmt.Fprintf(w, "Token: type=%d, lit=%s\n", e.ErrorToken.Type, e.ErrorToken.Lit) + fmt.Fprintf(w, "Pos: offset=%d, line=%d, column=%d\n", e.ErrorToken.Pos.Offset, e.ErrorToken.Pos.Line, e.ErrorToken.Pos.Column) + fmt.Fprintf(w, "Expected one of: ") + for _, sym := range e.ExpectedTokens { + fmt.Fprintf(w, "%s ", sym) + } + fmt.Fprintf(w, "ErrorSymbol:\n") + for _, sym := range e.ErrorSymbols { + fmt.Fprintf(w, "%v\n", sym) + } + return w.String() +} + +func (e *Error) Error() string { + w := new(strings.Builder) + fmt.Fprintf(w, "Error in S%d: %s, %s", e.StackTop, token.TokMap.TokenString(e.ErrorToken), e.ErrorToken.Pos.String()) + if e.Err != nil { + fmt.Fprintf(w, ": %+v", e.Err) + } else { + fmt.Fprintf(w, ", expected one of: ") + for _, expected := range e.ExpectedTokens { + fmt.Fprintf(w, "%s ", expected) + } + } + return w.String() +} diff --git a/example/astx/internal/io/stream/internal/stream_impl.go b/example/astx/internal/io/stream/internal/stream_impl.go new file mode 100644 index 00000000..358aa160 --- /dev/null +++ b/example/astx/internal/io/stream/internal/stream_impl.go @@ -0,0 +1,275 @@ +package internal + +import ( + "io" + "sync" + "unicode/utf8" +) + +type ( + impl_WindowReader struct { + bufferBlockSize int + maxBufferSize int + buffers [][]byte + available int + absbase int64 + position int + eof bool + rdr io.Reader + lock *sync.Mutex + } +) + +func (s *impl_WindowReader) lockReader() { + if s.lock != nil { + s.lock.Lock() + } +} + +func (s *impl_WindowReader) unlockReader() { + if s.lock != nil { + s.lock.Unlock() + } +} + +func (s *impl_WindowReader) seek(offset int64, whence int) (offs int64, err error) { + switch whence { + case io.SeekStart: + return s.seek(offset-s.ReadPosition(), io.SeekCurrent) + case io.SeekCurrent: + switch { + case offset == 0: + return s.ReadPosition(), nil + case offset < 0: + if -offset > int64(s.maxBackOffset()) { + err = io.ErrShortBuffer + } else { + s.advanceGet(int(offset)) + } + case offset > 0: + for offset > 0 && !s.eof { + available := s.Buffered() + if offset <= int64(available) { + s.advanceGet(int(offset)) + break + } + if available > 0 { + s.advanceGet(available) + offset -= int64(available) + } + read, _ := s.fetchBytes(int(offset)) + s.advanceGet(read) + offset -= int64(read) + } + if s.eof { + err = io.EOF + } + } + case io.SeekEnd: + for !s.eof { + s.seek(int64(s.MaxCap()), io.SeekCurrent) + } + s.seek(int64(s.Buffered()), io.SeekCurrent) + } + if s.eof && err == nil && s.Buffered() > 0 { + s.eof = false + } + return s.ReadPosition(), err +} + +func (s impl_WindowReader) maxBackOffset() int { + r := s.position + if s.absbase > 0 { + r = s.Cap() - s.Buffered() + } + return r +} + +func (s impl_WindowReader) bufferIndex(pos int) int { + if pos < 0 { + panic("negative position") + } + return pos / s.bufferBlockSize +} + +func (s impl_WindowReader) bufferBytes(pos int) []byte { + return s.buffers[s.bufferIndex(pos)] +} + +func (s impl_WindowReader) bufferByteRange(pos int, length int) []byte { + p := s.bufferOffset(pos) + return s.bufferBytes(pos)[p : p+length] +} + +func (s impl_WindowReader) bufferOffset(pos int) int { + return pos % s.bufferBlockSize +} + +func (s *impl_WindowReader) advanceGet(n int) { + sz := s.Cap() + switch { + case n < 0: + if -n > s.maxBackOffset() { + panic("underflow") + } + s.position += n + if s.position < 0 { + s.position += sz + s.absbase -= int64(sz) + } + case n > 0: + if n > s.Buffered() { + panic("overflow") + } + s.position += n + if s.position >= sz { + s.position -= sz + s.absbase += int64(sz) + } + } + s.available -= n +} + +func (s *impl_WindowReader) copy(to []byte, length int) { + for offs, cp := 0, 0; length > 0; length -= cp { + s.position %= s.MaxCap() + p := s.bufferOffset(s.position) + b := s.bufferBytes(s.position) + r := s.bufferBlockSize - p + if length <= r { + cp = copy(to[offs:], b[p:p+length]) + } else { + cp = copy(to[offs:], b[p:]) + } + s.advanceGet(cp) + offs += cp + } +} + +func (s *impl_WindowReader) fetchBytes(n int) (read int, err error) { + if s.rdr == nil { + s.eof = true + return 0, io.EOF + } + for n > 0 && s.Buffered() < s.MaxCap() && err == nil { + readNow := n + putpos := s.position + s.available + r := s.bufferBlockSize - s.bufferOffset(putpos) + if readNow > r { + readNow = r + } + for s.bufferIndex(putpos) >= len(s.buffers) && s.Cap() < s.MaxCap() { + s.buffers = append(s.buffers, make([]byte, s.bufferBlockSize)) + } + putpos %= s.MaxCap() + offs := s.bufferOffset(putpos) + if r, err = s.rdr.Read(s.bufferBytes(putpos)[offs : offs+readNow]); r > 0 { + s.available += r + read += r + n -= r + } + } + if n > 0 && err == nil { + err = io.ErrShortBuffer + } + return +} + +func (s *impl_WindowReader) read(p []byte) (read int, err error) { + if s.eof { + return 0, io.EOF + } + for read < len(p) && err == nil { + available := s.Buffered() + if len(p)-read <= available { + s.copy(p[read:], len(p)-read) + read = len(p) + } else { + if available == 0 { + available, err = s.fetchBytes(len(p) - read) + } + s.copy(p[read:], available) + read += available + switch err { + case io.ErrShortBuffer: + err = nil + case io.EOF: + s.eof = true + } + } + } + return +} + +func (s impl_WindowReader) peekByte() (byte, error) { + if s.Buffered() < 1 { + return 0, io.ErrShortBuffer + } + return s.bufferBytes(s.position)[s.bufferOffset(s.position)], nil +} + +func (s *impl_WindowReader) unreadByte() error { + _, e := s.seek(-1, io.SeekCurrent) + return e +} + +func (s *impl_WindowReader) readRune() (r rune, size int, err error) { + for i := 1; err == nil && i <= 4; i++ { + if s.Buffered() < i { + if _, err = s.fetchBytes(i); err != nil { + return + } + } + t := s.bufferByteRange(s.position, i) + if r, size = utf8.DecodeRune(t); r != utf8.RuneError { + s.advanceGet(size) + return + } + } + return utf8.RuneError, 0, err +} + +func (s *impl_WindowReader) unreadRune() (err error) { + tmps := *s + tmpb := []byte{} + for { + if _, err = tmps.seek(-1, io.SeekCurrent); err == nil { + b, _ := tmps.peekByte() + tmpb = append([]byte{b}, tmpb...) + switch len(tmpb) { + case 1: + if (tmpb[0] & 0xC0) == 0x80 { + continue + } + _, err = s.seek(-int64(len(tmpb)), io.SeekCurrent) + return + case 2: + if (tmpb[0] & 0xC0) == 0x80 { + continue + } + if (tmpb[0] & 0xE0) != 0xC0 { + break + } + _, err = s.seek(-int64(len(tmpb)), io.SeekCurrent) + return + case 3: + if (tmpb[0] & 0xC0) == 0x80 { + continue + } + if (tmpb[0] & 0xF0) != 0xE0 { + break + } + _, err = s.seek(-int64(len(tmpb)), io.SeekCurrent) + return + case 4: + if (tmpb[0] & 0xF8) != 0xF0 { + break + } + _, err = s.seek(-int64(len(tmpb)), io.SeekCurrent) + return + } + } + } + _, err = s.seek(-1, io.SeekCurrent) + return +} diff --git a/example/astx/internal/io/stream/internal/stream_public.go b/example/astx/internal/io/stream/internal/stream_public.go new file mode 100644 index 00000000..20ed7b5e --- /dev/null +++ b/example/astx/internal/io/stream/internal/stream_public.go @@ -0,0 +1,101 @@ +package internal + +import ( + "io" +) + +func NewWindowReader(buf []byte, underlyingReader io.Reader, blksize, smax int, InfoPrefixRoundUp bool) *impl_WindowReader { + if blksize < 0 || smax < blksize { + panic("illegal buffer size") + } + r := &impl_WindowReader{rdr: underlyingReader} + r.bufferBlockSize = blksize + if underlyingReader != nil { + if blksize <= 0 { + r.bufferBlockSize = 1 << 10 + } else if InfoPrefixRoundUp { + for r.bufferBlockSize = 1; blksize > 0; r.bufferBlockSize = r.bufferBlockSize << 1 { + blksize = blksize >> 1 + } + } + if smax > 0 { + r.maxBufferSize = ((smax-1)/r.bufferBlockSize + 1) * r.bufferBlockSize + } + r.buffers = [][]byte{} + } else { + r.buffers = [][]byte{buf} + r.available = len(buf) + r.bufferBlockSize = r.available + r.maxBufferSize = r.available + } + return r +} + +func (s impl_WindowReader) Cap() int { + return len(s.buffers) * s.bufferBlockSize +} + +func (s impl_WindowReader) BlockSize() int { + return s.bufferBlockSize +} + +func (s impl_WindowReader) MaxCap() int { + if s.maxBufferSize > 0 { + return s.maxBufferSize + } + return 1 << 31 +} + +func (s impl_WindowReader) MaxUnreadSize() int { + return s.maxBackOffset() +} + +func (s impl_WindowReader) Buffered() int { + return s.available +} + +func (s impl_WindowReader) ReadPosition() int64 { + return s.absbase + int64(s.position) +} + +func (s *impl_WindowReader) Read(p []byte) (read int, err error) { + s.lockReader() + defer func() { s.unlockReader() }() + return s.read(p) +} + +func (s *impl_WindowReader) Seek(offset int64, whence int) (offs int64, err error) { + s.lockReader() + defer func() { s.unlockReader() }() + return s.seek(offset, whence) +} + +func (s *impl_WindowReader) ReadByte() (byte, error) { + b := []byte{0} + _, err := s.Read(b) + return b[0], err +} + +func (s *impl_WindowReader) PeekByte() (byte, error) { + s.lockReader() + defer func() { s.unlockReader() }() + return s.peekByte() +} + +func (s *impl_WindowReader) UnreadByte() error { + s.lockReader() + defer func() { s.unlockReader() }() + return s.unreadByte() +} + +func (s *impl_WindowReader) ReadRune() (r rune, size int, err error) { + s.lockReader() + defer func() { s.unlockReader() }() + return s.readRune() +} + +func (s *impl_WindowReader) UnreadRune() (err error) { + s.lockReader() + defer func() { s.unlockReader() }() + return s.unreadRune() +} diff --git a/example/astx/internal/io/stream/stream.go b/example/astx/internal/io/stream/stream.go new file mode 100644 index 00000000..f8fcd588 --- /dev/null +++ b/example/astx/internal/io/stream/stream.go @@ -0,0 +1,39 @@ +package stream + +import ( + internal "github.com/maxcalandrelli/gocc/example/astx/internal/io/stream/internal" + "io" +) + +type ( + WindowReader interface { + BlockSize() int + Buffered() int + Cap() int + MaxCap() int + Read([]byte) (int, error) + ReadByte() (byte, error) + ReadPosition() int64 + ReadRune() (rune, int, error) + Seek(int64, int) (int64, error) + UnreadByte() error + UnreadRune() error + MaxUnreadSize() int + } +) + +var ( + InfoPrefixRoundUp = false +) + +func NewWindowReaderFromBytes(src []byte) WindowReader { + return internal.NewWindowReader(src, nil, 0, 0, InfoPrefixRoundUp) +} + +func NewWindowReader(rdr io.Reader) WindowReader { + return internal.NewWindowReader(nil, rdr, 0, 0, false) +} + +func NewLimitedWindowReader(rdr io.Reader, sizeMin, sizeMax int) WindowReader { + return internal.NewWindowReader(nil, rdr, sizeMin, sizeMax, InfoPrefixRoundUp) +} diff --git a/example/astx/internal/lexer/acttab.go b/example/astx/internal/lexer/acttab.go new file mode 100644 index 00000000..8c3c7f8b --- /dev/null +++ b/example/astx/internal/lexer/acttab.go @@ -0,0 +1,51 @@ +// Code generated by gocc; DO NOT EDIT. + +package lexer + +import ( + "fmt" + + "github.com/maxcalandrelli/gocc/example/astx/internal/token" +) + +type ActionTable [NumStates]ActionRow + +type ActionRow struct { + Accept token.Type + Ignore string +} + +func (a ActionRow) String() string { + return fmt.Sprintf("Accept=%d, Ignore=%s", a.Accept, a.Ignore) +} + +var ActTab = ActionTable{ + ActionRow{ // S0, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S1, Ignore("!whitespace") + Accept: -1, + Ignore: "!whitespace", + }, + ActionRow{ // S2, Accept("id") + Accept: 2, + Ignore: "", + }, + ActionRow{ // S3, Accept("id") + Accept: 2, + Ignore: "", + }, + ActionRow{ // S4, Accept("id") + Accept: 2, + Ignore: "", + }, + ActionRow{ // S5, Accept("id") + Accept: 2, + Ignore: "", + }, + ActionRow{ // S6, Accept("id") + Accept: 2, + Ignore: "", + }, +} diff --git a/example/astx/internal/lexer/lexer.go b/example/astx/internal/lexer/lexer.go new file mode 100644 index 00000000..ec4a29ad --- /dev/null +++ b/example/astx/internal/lexer/lexer.go @@ -0,0 +1,153 @@ +// Code generated by gocc; DO NOT EDIT. + +package lexer + +import ( + + "io" + "bytes" + "os" + + + "github.com/maxcalandrelli/gocc/example/astx/iface" + "github.com/maxcalandrelli/gocc/example/astx/internal/token" + "github.com/maxcalandrelli/gocc/example/astx/internal/io/stream" +) + +const ( + NoState = -1 + NumStates = 7 + NumSymbols = 10 + INVALID_RUNE = rune(-1) +) + +type position struct { + token.Pos +} + +type Lexer struct { + position + stream iface.TokenStream + eof bool +} + +func NewLexerBytes(src []byte) *Lexer { + lexer := &Lexer{stream: bytes.NewReader(src)} + lexer.reset() + return lexer +} + +func NewLexerFile(fpath string) (*Lexer, error) { + s, err := os.Open(fpath) + if err != nil { + return nil, err + } + lexer := &Lexer{stream: stream.NewWindowReader(s)} + lexer.reset() + return lexer, nil +} + +func NewLexer(reader io.Reader) (*Lexer, error) { + lexer := &Lexer{} + lexer.reset() + if lexer.stream, _ = reader.(iface.TokenStream); lexer.stream == nil { + lexer.stream = stream.NewWindowReader(reader) + } + return lexer, nil +} + +func (l *Lexer) reset () { + l.position.Reset() +} + +func (l Lexer) GetStream() iface.TokenStream { + return l.stream +} + +type checkPoint int64 + +func (c checkPoint) DistanceFrom (o iface.CheckPoint) int { + return int (c - o.(checkPoint)) +} + +func (l Lexer) GetCheckPoint() iface.CheckPoint { + pos, _ := l.stream.Seek(0, io.SeekCurrent) + return checkPoint(pos) +} + +func (l Lexer) GotoCheckPoint(cp iface.CheckPoint) { + l.stream.Seek(int64(cp.(checkPoint)), io.SeekStart) +} + +func (l *Lexer) Scan() (tok *token.Token) { + tok = new(token.Token) + tok.Type = token.INVALID + tok.Lit = []byte{} + start := l.position + state := 0 + for state != -1 { + curr, size, err := l.stream.ReadRune() + if size < 1 || err != nil { + curr = INVALID_RUNE + } + if size > 0 { + l.position.Pos.Offset += size + } + nextState := -1 + if curr != INVALID_RUNE { + nextState = TransTab[state](curr) + } + state = nextState + if state != -1 { + switch curr { + case '\n': + l.position.Pos.Line++ + l.position.Pos.Column = 1 + case '\r': + l.position.Pos.Column = 1 + case '\t': + l.position.Pos.Column += 4 + default: + l.position.Pos.Column++ + } + switch { + case ActTab[state].Accept != -1: + tok.Type = ActTab[state].Accept + tok.Lit = append(tok.Lit, string(curr)...) + case ActTab[state].Ignore != "": + start = l.position + state = 0 + tok.Lit = []byte{} + } + } else if curr != INVALID_RUNE { + l.stream.UnreadRune() + } + if err == io.EOF && len(tok.Lit)==0 { + tok.Type = token.EOF + tok.Pos = start.Pos + return + } + } + tok.Pos = start.Pos + return +} + +func (l *Lexer) Reset() { + l.position.Reset() +} + +func (l Lexer) CurrentPosition() position { + return l.position +} + +func (p *position) Reset() { + p.Offset = 0 + p.Line = 1 + p.Column = 1 +} + +func (p position) StartingFrom(base position) position { + r := p + r.Pos = p.Pos.StartingFrom(base.Pos) + return r +} diff --git a/example/astx/internal/lexer/transitiontable.go b/example/astx/internal/lexer/transitiontable.go new file mode 100644 index 00000000..50dd04da --- /dev/null +++ b/example/astx/internal/lexer/transitiontable.go @@ -0,0 +1,109 @@ +// Code generated by gocc; DO NOT EDIT. + +package lexer + +/* +Let s be the current state +Let r be the current input rune +transitionTable[s](r) returns the next state. +*/ +type TransitionTable [NumStates]func(rune) int + +var TransTab = TransitionTable{ + // S0 + func(r rune) int { + switch { + case r == 9: // ['\t','\t'] + return 1 + case r == 10: // ['\n','\n'] + return 1 + case r == 13: // ['\r','\r'] + return 1 + case r == 32: // [' ',' '] + return 1 + case 65 <= r && r <= 90: // ['A','Z'] + return 2 + case r == 95: // ['_','_'] + return 3 + case 97 <= r && r <= 122: // ['a','z'] + return 2 + } + return NoState + }, + // S1 + func(r rune) int { + switch { + } + return NoState + }, + // S2 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 4 + case 65 <= r && r <= 90: // ['A','Z'] + return 5 + case r == 95: // ['_','_'] + return 6 + case 97 <= r && r <= 122: // ['a','z'] + return 5 + } + return NoState + }, + // S3 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 4 + case 65 <= r && r <= 90: // ['A','Z'] + return 5 + case r == 95: // ['_','_'] + return 6 + case 97 <= r && r <= 122: // ['a','z'] + return 5 + } + return NoState + }, + // S4 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 4 + case 65 <= r && r <= 90: // ['A','Z'] + return 5 + case r == 95: // ['_','_'] + return 6 + case 97 <= r && r <= 122: // ['a','z'] + return 5 + } + return NoState + }, + // S5 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 4 + case 65 <= r && r <= 90: // ['A','Z'] + return 5 + case r == 95: // ['_','_'] + return 6 + case 97 <= r && r <= 122: // ['a','z'] + return 5 + } + return NoState + }, + // S6 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 4 + case 65 <= r && r <= 90: // ['A','Z'] + return 5 + case r == 95: // ['_','_'] + return 6 + case 97 <= r && r <= 122: // ['a','z'] + return 5 + } + return NoState + }, +} diff --git a/example/nolexer/parser/action.go b/example/astx/internal/parser/action.go similarity index 100% rename from example/nolexer/parser/action.go rename to example/astx/internal/parser/action.go diff --git a/example/astx/internal/parser/actiontable.go b/example/astx/internal/parser/actiontable.go new file mode 100644 index 00000000..9c8071d3 --- /dev/null +++ b/example/astx/internal/parser/actiontable.go @@ -0,0 +1,70 @@ +// Code generated by gocc; DO NOT EDIT. + +package parser + +type ( + actionTable [numStates]actionRow + cdFunc func(TokenStream, interface{}) (interface{}, error, []byte) + cdAction struct { + tokenIndex int + tokenScanner cdFunc + } + actionRow struct { + canRecover bool + actions [numSymbols]action + cdActions []cdAction + } + actions struct { + table actionTable + } +) + +var parserActions = actions{ + table: actionTable{ + actionRow{ // S0 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + shift(3), // id + }, + cdActions: []cdAction{}, + }, + actionRow{ // S1 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + accept(true), // Ω + shift(3), // id + }, + cdActions: []cdAction{}, + }, + actionRow{ // S2 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(1), // Ω, reduce: StmtList + reduce(1), // id, reduce: StmtList + }, + cdActions: []cdAction{}, + }, + actionRow{ // S3 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(3), // Ω, reduce: Stmt + reduce(3), // id, reduce: Stmt + }, + cdActions: []cdAction{}, + }, + actionRow{ // S4 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(2), // Ω, reduce: StmtList + reduce(2), // id, reduce: StmtList + }, + cdActions: []cdAction{}, + }, + }, +} diff --git a/example/astx/internal/parser/gototable.go b/example/astx/internal/parser/gototable.go new file mode 100644 index 00000000..3fc118e2 --- /dev/null +++ b/example/astx/internal/parser/gototable.go @@ -0,0 +1,38 @@ +// Code generated by gocc; DO NOT EDIT. + +package parser + +const numNTSymbols = 3 + +type ( + gotoTable [numStates]gotoRow + gotoRow [numNTSymbols]int +) + +var gotoTab = gotoTable{ + gotoRow{ // S0 + -1, // Π + 1, // Π + 2, // Π + }, + gotoRow{ // S1 + -1, // Π + -1, // Π + 4, // Π + }, + gotoRow{ // S2 + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S3 + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S4 + -1, // Π + -1, // Π + -1, // Π + }, +} diff --git a/example/astx/internal/parser/parser.go b/example/astx/internal/parser/parser.go new file mode 100644 index 00000000..69013844 --- /dev/null +++ b/example/astx/internal/parser/parser.go @@ -0,0 +1,295 @@ +// Code generated by gocc; DO NOT EDIT. + +package parser + +import ( + "errors" + "fmt" + "strings" + + "github.com/maxcalandrelli/gocc/example/astx/iface" + parseError "github.com/maxcalandrelli/gocc/example/astx/internal/errors" + "github.com/maxcalandrelli/gocc/example/astx/internal/token" +) + +const ( + numProductions = 4 + numStates = 5 + numSymbols = 6 +) + +// Stack + +type stack struct { + state []int + attrib []Attrib +} + +const INITIAL_STACK_SIZE = 100 + +func newStack() *stack { + return &stack{ + state: make([]int, 0, INITIAL_STACK_SIZE), + attrib: make([]Attrib, 0, INITIAL_STACK_SIZE), + } +} + +func (s *stack) reset() { + s.state = s.state[:0] + s.attrib = s.attrib[:0] +} + +func (s *stack) push(state int, a Attrib) { + s.state = append(s.state, state) + s.attrib = append(s.attrib, a) +} + +func (s *stack) top() int { + return s.state[len(s.state)-1] +} + +func (s *stack) peek(pos int) int { + return s.state[pos] +} + +func (s *stack) topIndex() int { + return len(s.state) - 1 +} + +func (s *stack) popN(items int) []Attrib { + lo, hi := len(s.state)-items, len(s.state) + + attrib := s.attrib[lo:hi] + + s.state = s.state[:lo] + s.attrib = s.attrib[:lo] + + return attrib +} + +func (s *stack) String() string { + w := new(strings.Builder) + fmt.Fprintf(w, "stack:\n") + for i, st := range s.state { + fmt.Fprintf(w, "\t%d: %d , ", i, st) + if s.attrib[i] == nil { + fmt.Fprintf(w, "nil") + } else { + switch attr := s.attrib[i].(type) { + case *token.Token: + fmt.Fprintf(w, "%s", attr.Lit) + default: + fmt.Fprintf(w, "%v", attr) + } + } + fmt.Fprintf(w, "\n") + } + return w.String() +} + +// Parser + +type Parser struct { + stack *stack + nextToken *token.Token + userContext interface{} +} + +type TokenStream = iface.TokenStream + +func NewParser() *Parser { + return NewParserWithContext(nil) +} + +func NewParserWithContext(u interface{}) *Parser { + p := &Parser{stack: newStack(), userContext: u} + p.Reset() + return p +} + +func (p *Parser) Reset() { + p.stack.reset() + p.stack.push(0, nil) +} + +func (p *Parser) Error(err error, scanner iface.Scanner) (recovered bool, errorAttrib *parseError.Error) { + errorAttrib = &parseError.Error{ + Err: err, + ErrorToken: p.nextToken, + ErrorSymbols: p.popNonRecoveryStates(), + ExpectedTokens: make([]string, 0, 8), + } + for t, action := range parserActions.table[p.stack.top()].actions { + if action != nil { + errorAttrib.ExpectedTokens = append(errorAttrib.ExpectedTokens, token.TokMap.Id(token.Type(t))) + } + } + + if action := parserActions.table[p.stack.top()].actions[token.TokMap.Type("error")]; action != nil { + p.stack.push(int(action.(shift)), errorAttrib) // action can only be shift + } else { + return + } + + if action := parserActions.table[p.stack.top()].actions[p.nextToken.Type]; action != nil { + recovered = true + } + for !recovered && p.nextToken.Type != token.EOF { + p.nextToken = scanner.Scan() + if action := parserActions.table[p.stack.top()].actions[p.nextToken.Type]; action != nil { + recovered = true + } + } + + return +} + +func (p *Parser) popNonRecoveryStates() (removedAttribs []parseError.ErrorSymbol) { + if rs, ok := p.firstRecoveryState(); ok { + errorSymbols := p.stack.popN(p.stack.topIndex() - rs) + removedAttribs = make([]parseError.ErrorSymbol, len(errorSymbols)) + for i, e := range errorSymbols { + removedAttribs[i] = e + } + } else { + removedAttribs = []parseError.ErrorSymbol{} + } + return +} + +// recoveryState points to the highest state on the stack, which can recover +func (p *Parser) firstRecoveryState() (recoveryState int, canRecover bool) { + recoveryState, canRecover = p.stack.topIndex(), parserActions.table[p.stack.top()].canRecover + for recoveryState > 0 && !canRecover { + recoveryState-- + canRecover = parserActions.table[p.stack.peek(recoveryState)].canRecover + } + return +} + +func (p *Parser) newError(err error) error { + e := &parseError.Error{ + Err: err, + StackTop: p.stack.top(), + ErrorToken: p.nextToken, + } + actRow := parserActions.table[p.stack.top()] + for i, t := range actRow.actions { + if t != nil { + e.ExpectedTokens = append(e.ExpectedTokens, token.TokMap.Id(token.Type(i))) + } + } + return e +} + +func (p *Parser) Parse(scanner iface.Scanner) (res interface{}, err error, ptl int) { + return p.parse(scanner, false) +} + +func (p *Parser) ParseLongestPrefix(scanner iface.Scanner) (res interface{}, err error, ptl int) { + return p.parse(scanner, true) +} + +var errNotRepositionable = errors.New("scanner not repositionable") + +func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, err error, ptl int) { + var ( + tokens iface.CheckPointable + afterPos iface.CheckPoint + checkPoint iface.CheckPoint + ) + readNextToken := func() error { + if tokens == nil && (len(parserActions.table[p.stack.top()].cdActions) > 0 || longest) { + return errNotRepositionable + } + checkPoint = tokens.GetCheckPoint() + p.nextToken = scanner.Scan() + if longest { + afterPos = tokens.GetCheckPoint() + } + return nil + } + p.Reset() + tokens, _ = scanner.(iface.CheckPointable) + startCp := tokens.GetCheckPoint() + if err := readNextToken(); err != nil { + return nil, err, tokens.GetCheckPoint().DistanceFrom(startCp) + } + for acc := false; !acc; { + action := parserActions.table[p.stack.top()].actions[p.nextToken.Type] + if action == nil { + // + // If no action, check if we have some context dependent parsing to try + // + for _, cdAction := range parserActions.table[p.stack.top()].cdActions { + tokens.GotoCheckPoint(checkPoint) + cd_res, cd_err, cd_parsed := cdAction.tokenScanner(scanner.GetStream(), p.userContext) + if cd_err == nil && len(cd_parsed) > 0 { + action = parserActions.table[p.stack.top()].actions[cdAction.tokenIndex] + if action != nil { + p.nextToken.Foreign = true + p.nextToken.ForeignAstNode = cd_res + p.nextToken.Lit = cd_parsed + p.nextToken.Type = token.Type(cdAction.tokenIndex) + break + } + } + } + } + // + // Still no action? If a longest possible parsing is requested in place + // of a full text, we should try to check if an EOF here would have led + // to a successful parsing instead + // Rember that token.EOF is 1, that is the index of SyntaxEof into symbol table + // Dirty, dirty, dirty... but I found it as it is, and I prefer not to touch + // + if action == nil && longest { + tokens.GotoCheckPoint(checkPoint) + action = parserActions.table[p.stack.top()].actions[token.EOF] + if action == nil { + // + // ok, let's consume the token then + // + tokens.GotoCheckPoint(afterPos) + } + } + + // + // Well, no action is no action after all... + // + if action == nil { + if recovered, errAttrib := p.Error(nil, scanner); !recovered { + p.nextToken = errAttrib.ErrorToken + return nil, p.newError(nil), tokens.GetCheckPoint().DistanceFrom(startCp) + } + if action = parserActions.table[p.stack.top()].actions[p.nextToken.Type]; action == nil { + panic("Error recovery led to invalid action") + } + } + + switch act := action.(type) { + case accept: + res = p.stack.popN(1)[0] + acc = true + case shift: + p.stack.push(int(act), p.nextToken) + if p.nextToken.Foreign { + p.stack.push(int(act), p.nextToken.ForeignAstNode) + } + if err := readNextToken(); err != nil { + return nil, err, tokens.GetCheckPoint().DistanceFrom(startCp) + } + case reduce: + prod := productionsTable[int(act)] + attrib, err := prod.ReduceFunc(p.userContext, p.stack.popN(prod.NumSymbols)) + if err != nil { + return nil, p.newError(err), tokens.GetCheckPoint().DistanceFrom(startCp) + } else { + p.stack.push(gotoTab[p.stack.top()][prod.NTType], attrib) + } + default: + panic("unknown action: " + action.String()) + } + } + return res, nil, tokens.GetCheckPoint().DistanceFrom(startCp) +} diff --git a/example/astx/internal/parser/productionstable.go b/example/astx/internal/parser/productionstable.go new file mode 100644 index 00000000..540f75cc --- /dev/null +++ b/example/astx/internal/parser/productionstable.go @@ -0,0 +1,63 @@ +// Code generated by gocc; DO NOT EDIT. + +package parser + +import "github.com/maxcalandrelli/gocc/example/astx/ast" + +type ( + //TODO: change type and variable names to be consistent with other tables + ProdTab [numProductions]ProdTabEntry + ProdTabEntry struct { + String string + Id string + NTType int + Index int + NumSymbols int + ReduceFunc func(interface{}, []Attrib) (Attrib, error) + } + Attrib interface { + } +) + +var productionsTable = ProdTab{ + ProdTabEntry{ + String: `S' : Π << >>`, + Id: "S'", + NTType: 0, + Index: 0, + NumSymbols: 1, + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { + return X[0], nil + }, + }, + ProdTabEntry{ + String: `StmtList : Π << ast.NewStmtList(X[0]) >>`, + Id: "StmtList", + NTType: 1, + Index: 1, + NumSymbols: 1, + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { + return ast.NewStmtList(X[0]) + }, + }, + ProdTabEntry{ + String: `StmtList : Π Π << ast.AppendStmt(X[0], X[1]) >>`, + Id: "StmtList", + NTType: 1, + Index: 2, + NumSymbols: 2, + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { + return ast.AppendStmt(X[0], X[1]) + }, + }, + ProdTabEntry{ + String: `Stmt : id << ast.NewStmt(X[0]) >>`, + Id: "Stmt", + NTType: 2, + Index: 3, + NumSymbols: 1, + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { + return ast.NewStmt(X[0]) + }, + }, +} diff --git a/example/nolexer/token/token.go b/example/astx/internal/token/token.go similarity index 70% rename from example/nolexer/token/token.go rename to example/astx/internal/token/token.go index 634aaeac..58432cfc 100644 --- a/example/nolexer/token/token.go +++ b/example/astx/internal/token/token.go @@ -10,6 +10,8 @@ type Token struct { Type Lit []byte Pos + ForeignAstNode interface{} + Foreign bool } type Type int @@ -29,6 +31,20 @@ func (p Pos) String() string { return fmt.Sprintf("Pos(offset=%d, line=%d, column=%d)", p.Offset, p.Line, p.Column) } +func (p Pos) StartingFrom(base Pos) Pos { + r := base + r.Offset += p.Offset + r.Line += p.Line + r.Column = p.Column + if p.Line > 0 && base.Line > 0 { + r.Line-- + } + if r.Column < 1 { + r.Column = 1 + } + return r +} + type TokenMap struct { typeMap []string idMap map[string]Type @@ -49,8 +65,7 @@ func (m TokenMap) Type(tok string) Type { } func (m TokenMap) TokenString(tok *Token) string { - //TODO: refactor to print pos & token string properly - return fmt.Sprintf("%s(%d,%s)", m.Id(tok.Type), tok.Type, tok.Lit) + return fmt.Sprintf("%s(%d,<%s>)", m.Id(tok.Type), tok.Type, tok.Lit) } func (m TokenMap) StringType(typ Type) string { @@ -60,17 +75,13 @@ func (m TokenMap) StringType(typ Type) string { var TokMap = TokenMap{ typeMap: []string{ "INVALID", - "$", - "name", - "hello", - "hiya", + "Ω", + "id", }, idMap: map[string]Type{ "INVALID": 0, - "$": 1, - "name": 2, - "hello": 3, - "hiya": 4, + "Ω": 1, + "id": 2, }, } diff --git a/example/nolexer/util/litconv.go b/example/astx/internal/util/litconv.go similarity index 100% rename from example/nolexer/util/litconv.go rename to example/astx/internal/util/litconv.go diff --git a/example/nolexer/util/rune.go b/example/astx/internal/util/rune.go similarity index 100% rename from example/nolexer/util/rune.go rename to example/astx/internal/util/rune.go diff --git a/example/astx/main/main.go b/example/astx/main/main.go new file mode 100644 index 00000000..1b547c2a --- /dev/null +++ b/example/astx/main/main.go @@ -0,0 +1,53 @@ +package main + +import ( + "flag" + "fmt" + "os" + "strings" + + astx "github.com/maxcalandrelli/gocc/example/astx" +) + +func showResult(r interface{}, e error, l int) { + if e != nil { + fmt.Fprintf(os.Stderr, "parsing returned the following error: %s\n", e.Error()) + } else { + fmt.Printf("r=%#v, %d bytes\n", r, l) + } +} + +var ( + File string + Text string + Longest bool +) + +func parse(longest bool, lex *astx.Lexer) (res interface{}, err error, ptl int) { + if longest { + return astx.NewParser().ParseLongestPrefix(lex) + } else { + return astx.NewParser().Parse(lex) + } + return +} + +func main() { + flag.StringVar(&File, "file", "", "parse also text in file") + flag.StringVar(&Text, "text", "", "parse also text given with flag") + flag.BoolVar(&Longest, "longest", false, "parse longest possible part") + flag.Parse() + if Text > "" { + showResult(parse(Longest, astx.NewLexerString(Text))) + } + if File > "" { + l, e := astx.NewLexerFile(File) + if e != nil { + panic(e) + } + showResult(parse(Longest, l)) + } + if str := strings.Join(flag.Args(), " "); str > "" { + showResult(parse(Longest, astx.NewLexerString(str))) + } +} diff --git a/example/bools/bools.go b/example/bools/bools.go new file mode 100644 index 00000000..d43a82de --- /dev/null +++ b/example/bools/bools.go @@ -0,0 +1,62 @@ +// Code generated by gocc; DO NOT EDIT. + +package bools + +import ( + "io" + + "github.com/maxcalandrelli/gocc/example/bools/iface" + "github.com/maxcalandrelli/gocc/example/bools/internal/io/stream" + "github.com/maxcalandrelli/gocc/example/bools/internal/lexer" + "github.com/maxcalandrelli/gocc/example/bools/internal/parser" + "github.com/maxcalandrelli/gocc/example/bools/internal/token" +) + +type ( + Token = token.Token + Lexer = lexer.Lexer + Parser = parser.Parser + TokenStream = iface.TokenStream + WindowReader = stream.WindowReader + Scanner = iface.Scanner +) + +func ParseFile(fpath string) (interface{}, error, int) { + if lexer, err := NewLexerFile(fpath); err == nil { + return NewParser().Parse(lexer) + } else { + return nil, err, 0 + } +} + +func ParseText(text string) (interface{}, error, int) { + return NewParser().Parse(NewLexerBytes([]byte(text))) +} + +func NewLexerBytes(src []byte) *lexer.Lexer { + return lexer.NewLexerBytes(src) +} + +func NewLexerString(src string) *lexer.Lexer { + return lexer.NewLexerBytes([]byte(src)) +} + +func NewLexerFile(fpath string) (*lexer.Lexer, error) { + return lexer.NewLexerFile(fpath) +} + +func NewParser() *parser.Parser { + return parser.NewParser() +} + +func NewWindowReaderFromBytes(src []byte) WindowReader { + return stream.NewWindowReaderFromBytes(src) +} + +func NewWindowReader(rdr io.Reader) WindowReader { + return stream.NewWindowReader(rdr) +} + +func NewLimitedWindowReader(rdr io.Reader, sizeMin, sizeMax int) WindowReader { + return stream.NewLimitedWindowReader(rdr, sizeMin, sizeMax) +} diff --git a/example/bools/iface/iface.go b/example/bools/iface/iface.go new file mode 100644 index 00000000..33d90ba8 --- /dev/null +++ b/example/bools/iface/iface.go @@ -0,0 +1,30 @@ +// Code generated by gocc; DO NOT EDIT. + +package iface + +import ( + "github.com/maxcalandrelli/gocc/example/bools/internal/token" + "io" +) + +type ( + Scanner interface { + Scan() (tok *token.Token) + GetStream() TokenStream + } + + CheckPoint interface { + DistanceFrom(CheckPoint) int + } + + CheckPointable interface { + GetCheckPoint() CheckPoint + GotoCheckPoint(CheckPoint) + } + + TokenStream interface { + io.Reader + io.RuneScanner + io.Seeker + } +) diff --git a/example/bools/internal/errors/errors.go b/example/bools/internal/errors/errors.go new file mode 100644 index 00000000..79b5a0fe --- /dev/null +++ b/example/bools/internal/errors/errors.go @@ -0,0 +1,56 @@ +// Code generated by gocc; DO NOT EDIT. + +package errors + +import ( + "fmt" + "strings" + + "github.com/maxcalandrelli/gocc/example/bools/internal/token" +) + +type ErrorSymbol interface { +} + +type Error struct { + Err error + ErrorToken *token.Token + ErrorSymbols []ErrorSymbol + ExpectedTokens []string + StackTop int +} + +func (e *Error) String() string { + w := new(strings.Builder) + fmt.Fprintf(w, "Error") + if e.Err != nil { + fmt.Fprintf(w, " %s\n", e.Err) + } else { + fmt.Fprintf(w, "\n") + } + fmt.Fprintf(w, "Token: type=%d, lit=%s\n", e.ErrorToken.Type, e.ErrorToken.Lit) + fmt.Fprintf(w, "Pos: offset=%d, line=%d, column=%d\n", e.ErrorToken.Pos.Offset, e.ErrorToken.Pos.Line, e.ErrorToken.Pos.Column) + fmt.Fprintf(w, "Expected one of: ") + for _, sym := range e.ExpectedTokens { + fmt.Fprintf(w, "%s ", sym) + } + fmt.Fprintf(w, "ErrorSymbol:\n") + for _, sym := range e.ErrorSymbols { + fmt.Fprintf(w, "%v\n", sym) + } + return w.String() +} + +func (e *Error) Error() string { + w := new(strings.Builder) + fmt.Fprintf(w, "Error in S%d: %s, %s", e.StackTop, token.TokMap.TokenString(e.ErrorToken), e.ErrorToken.Pos.String()) + if e.Err != nil { + fmt.Fprintf(w, ": %+v", e.Err) + } else { + fmt.Fprintf(w, ", expected one of: ") + for _, expected := range e.ExpectedTokens { + fmt.Fprintf(w, "%s ", expected) + } + } + return w.String() +} diff --git a/example/bools/internal/io/stream/internal/stream_impl.go b/example/bools/internal/io/stream/internal/stream_impl.go new file mode 100644 index 00000000..358aa160 --- /dev/null +++ b/example/bools/internal/io/stream/internal/stream_impl.go @@ -0,0 +1,275 @@ +package internal + +import ( + "io" + "sync" + "unicode/utf8" +) + +type ( + impl_WindowReader struct { + bufferBlockSize int + maxBufferSize int + buffers [][]byte + available int + absbase int64 + position int + eof bool + rdr io.Reader + lock *sync.Mutex + } +) + +func (s *impl_WindowReader) lockReader() { + if s.lock != nil { + s.lock.Lock() + } +} + +func (s *impl_WindowReader) unlockReader() { + if s.lock != nil { + s.lock.Unlock() + } +} + +func (s *impl_WindowReader) seek(offset int64, whence int) (offs int64, err error) { + switch whence { + case io.SeekStart: + return s.seek(offset-s.ReadPosition(), io.SeekCurrent) + case io.SeekCurrent: + switch { + case offset == 0: + return s.ReadPosition(), nil + case offset < 0: + if -offset > int64(s.maxBackOffset()) { + err = io.ErrShortBuffer + } else { + s.advanceGet(int(offset)) + } + case offset > 0: + for offset > 0 && !s.eof { + available := s.Buffered() + if offset <= int64(available) { + s.advanceGet(int(offset)) + break + } + if available > 0 { + s.advanceGet(available) + offset -= int64(available) + } + read, _ := s.fetchBytes(int(offset)) + s.advanceGet(read) + offset -= int64(read) + } + if s.eof { + err = io.EOF + } + } + case io.SeekEnd: + for !s.eof { + s.seek(int64(s.MaxCap()), io.SeekCurrent) + } + s.seek(int64(s.Buffered()), io.SeekCurrent) + } + if s.eof && err == nil && s.Buffered() > 0 { + s.eof = false + } + return s.ReadPosition(), err +} + +func (s impl_WindowReader) maxBackOffset() int { + r := s.position + if s.absbase > 0 { + r = s.Cap() - s.Buffered() + } + return r +} + +func (s impl_WindowReader) bufferIndex(pos int) int { + if pos < 0 { + panic("negative position") + } + return pos / s.bufferBlockSize +} + +func (s impl_WindowReader) bufferBytes(pos int) []byte { + return s.buffers[s.bufferIndex(pos)] +} + +func (s impl_WindowReader) bufferByteRange(pos int, length int) []byte { + p := s.bufferOffset(pos) + return s.bufferBytes(pos)[p : p+length] +} + +func (s impl_WindowReader) bufferOffset(pos int) int { + return pos % s.bufferBlockSize +} + +func (s *impl_WindowReader) advanceGet(n int) { + sz := s.Cap() + switch { + case n < 0: + if -n > s.maxBackOffset() { + panic("underflow") + } + s.position += n + if s.position < 0 { + s.position += sz + s.absbase -= int64(sz) + } + case n > 0: + if n > s.Buffered() { + panic("overflow") + } + s.position += n + if s.position >= sz { + s.position -= sz + s.absbase += int64(sz) + } + } + s.available -= n +} + +func (s *impl_WindowReader) copy(to []byte, length int) { + for offs, cp := 0, 0; length > 0; length -= cp { + s.position %= s.MaxCap() + p := s.bufferOffset(s.position) + b := s.bufferBytes(s.position) + r := s.bufferBlockSize - p + if length <= r { + cp = copy(to[offs:], b[p:p+length]) + } else { + cp = copy(to[offs:], b[p:]) + } + s.advanceGet(cp) + offs += cp + } +} + +func (s *impl_WindowReader) fetchBytes(n int) (read int, err error) { + if s.rdr == nil { + s.eof = true + return 0, io.EOF + } + for n > 0 && s.Buffered() < s.MaxCap() && err == nil { + readNow := n + putpos := s.position + s.available + r := s.bufferBlockSize - s.bufferOffset(putpos) + if readNow > r { + readNow = r + } + for s.bufferIndex(putpos) >= len(s.buffers) && s.Cap() < s.MaxCap() { + s.buffers = append(s.buffers, make([]byte, s.bufferBlockSize)) + } + putpos %= s.MaxCap() + offs := s.bufferOffset(putpos) + if r, err = s.rdr.Read(s.bufferBytes(putpos)[offs : offs+readNow]); r > 0 { + s.available += r + read += r + n -= r + } + } + if n > 0 && err == nil { + err = io.ErrShortBuffer + } + return +} + +func (s *impl_WindowReader) read(p []byte) (read int, err error) { + if s.eof { + return 0, io.EOF + } + for read < len(p) && err == nil { + available := s.Buffered() + if len(p)-read <= available { + s.copy(p[read:], len(p)-read) + read = len(p) + } else { + if available == 0 { + available, err = s.fetchBytes(len(p) - read) + } + s.copy(p[read:], available) + read += available + switch err { + case io.ErrShortBuffer: + err = nil + case io.EOF: + s.eof = true + } + } + } + return +} + +func (s impl_WindowReader) peekByte() (byte, error) { + if s.Buffered() < 1 { + return 0, io.ErrShortBuffer + } + return s.bufferBytes(s.position)[s.bufferOffset(s.position)], nil +} + +func (s *impl_WindowReader) unreadByte() error { + _, e := s.seek(-1, io.SeekCurrent) + return e +} + +func (s *impl_WindowReader) readRune() (r rune, size int, err error) { + for i := 1; err == nil && i <= 4; i++ { + if s.Buffered() < i { + if _, err = s.fetchBytes(i); err != nil { + return + } + } + t := s.bufferByteRange(s.position, i) + if r, size = utf8.DecodeRune(t); r != utf8.RuneError { + s.advanceGet(size) + return + } + } + return utf8.RuneError, 0, err +} + +func (s *impl_WindowReader) unreadRune() (err error) { + tmps := *s + tmpb := []byte{} + for { + if _, err = tmps.seek(-1, io.SeekCurrent); err == nil { + b, _ := tmps.peekByte() + tmpb = append([]byte{b}, tmpb...) + switch len(tmpb) { + case 1: + if (tmpb[0] & 0xC0) == 0x80 { + continue + } + _, err = s.seek(-int64(len(tmpb)), io.SeekCurrent) + return + case 2: + if (tmpb[0] & 0xC0) == 0x80 { + continue + } + if (tmpb[0] & 0xE0) != 0xC0 { + break + } + _, err = s.seek(-int64(len(tmpb)), io.SeekCurrent) + return + case 3: + if (tmpb[0] & 0xC0) == 0x80 { + continue + } + if (tmpb[0] & 0xF0) != 0xE0 { + break + } + _, err = s.seek(-int64(len(tmpb)), io.SeekCurrent) + return + case 4: + if (tmpb[0] & 0xF8) != 0xF0 { + break + } + _, err = s.seek(-int64(len(tmpb)), io.SeekCurrent) + return + } + } + } + _, err = s.seek(-1, io.SeekCurrent) + return +} diff --git a/example/bools/internal/io/stream/internal/stream_public.go b/example/bools/internal/io/stream/internal/stream_public.go new file mode 100644 index 00000000..20ed7b5e --- /dev/null +++ b/example/bools/internal/io/stream/internal/stream_public.go @@ -0,0 +1,101 @@ +package internal + +import ( + "io" +) + +func NewWindowReader(buf []byte, underlyingReader io.Reader, blksize, smax int, InfoPrefixRoundUp bool) *impl_WindowReader { + if blksize < 0 || smax < blksize { + panic("illegal buffer size") + } + r := &impl_WindowReader{rdr: underlyingReader} + r.bufferBlockSize = blksize + if underlyingReader != nil { + if blksize <= 0 { + r.bufferBlockSize = 1 << 10 + } else if InfoPrefixRoundUp { + for r.bufferBlockSize = 1; blksize > 0; r.bufferBlockSize = r.bufferBlockSize << 1 { + blksize = blksize >> 1 + } + } + if smax > 0 { + r.maxBufferSize = ((smax-1)/r.bufferBlockSize + 1) * r.bufferBlockSize + } + r.buffers = [][]byte{} + } else { + r.buffers = [][]byte{buf} + r.available = len(buf) + r.bufferBlockSize = r.available + r.maxBufferSize = r.available + } + return r +} + +func (s impl_WindowReader) Cap() int { + return len(s.buffers) * s.bufferBlockSize +} + +func (s impl_WindowReader) BlockSize() int { + return s.bufferBlockSize +} + +func (s impl_WindowReader) MaxCap() int { + if s.maxBufferSize > 0 { + return s.maxBufferSize + } + return 1 << 31 +} + +func (s impl_WindowReader) MaxUnreadSize() int { + return s.maxBackOffset() +} + +func (s impl_WindowReader) Buffered() int { + return s.available +} + +func (s impl_WindowReader) ReadPosition() int64 { + return s.absbase + int64(s.position) +} + +func (s *impl_WindowReader) Read(p []byte) (read int, err error) { + s.lockReader() + defer func() { s.unlockReader() }() + return s.read(p) +} + +func (s *impl_WindowReader) Seek(offset int64, whence int) (offs int64, err error) { + s.lockReader() + defer func() { s.unlockReader() }() + return s.seek(offset, whence) +} + +func (s *impl_WindowReader) ReadByte() (byte, error) { + b := []byte{0} + _, err := s.Read(b) + return b[0], err +} + +func (s *impl_WindowReader) PeekByte() (byte, error) { + s.lockReader() + defer func() { s.unlockReader() }() + return s.peekByte() +} + +func (s *impl_WindowReader) UnreadByte() error { + s.lockReader() + defer func() { s.unlockReader() }() + return s.unreadByte() +} + +func (s *impl_WindowReader) ReadRune() (r rune, size int, err error) { + s.lockReader() + defer func() { s.unlockReader() }() + return s.readRune() +} + +func (s *impl_WindowReader) UnreadRune() (err error) { + s.lockReader() + defer func() { s.unlockReader() }() + return s.unreadRune() +} diff --git a/example/bools/internal/io/stream/stream.go b/example/bools/internal/io/stream/stream.go new file mode 100644 index 00000000..9540add0 --- /dev/null +++ b/example/bools/internal/io/stream/stream.go @@ -0,0 +1,39 @@ +package stream + +import ( + internal "github.com/maxcalandrelli/gocc/example/bools/internal/io/stream/internal" + "io" +) + +type ( + WindowReader interface { + BlockSize() int + Buffered() int + Cap() int + MaxCap() int + Read([]byte) (int, error) + ReadByte() (byte, error) + ReadPosition() int64 + ReadRune() (rune, int, error) + Seek(int64, int) (int64, error) + UnreadByte() error + UnreadRune() error + MaxUnreadSize() int + } +) + +var ( + InfoPrefixRoundUp = false +) + +func NewWindowReaderFromBytes(src []byte) WindowReader { + return internal.NewWindowReader(src, nil, 0, 0, InfoPrefixRoundUp) +} + +func NewWindowReader(rdr io.Reader) WindowReader { + return internal.NewWindowReader(nil, rdr, 0, 0, false) +} + +func NewLimitedWindowReader(rdr io.Reader, sizeMin, sizeMax int) WindowReader { + return internal.NewWindowReader(nil, rdr, sizeMin, sizeMax, InfoPrefixRoundUp) +} diff --git a/example/bools/internal/lexer/acttab.go b/example/bools/internal/lexer/acttab.go new file mode 100644 index 00000000..138c1581 --- /dev/null +++ b/example/bools/internal/lexer/acttab.go @@ -0,0 +1,111 @@ +// Code generated by gocc; DO NOT EDIT. + +package lexer + +import ( + "fmt" + + "github.com/maxcalandrelli/gocc/example/bools/internal/token" +) + +type ActionTable [NumStates]ActionRow + +type ActionRow struct { + Accept token.Type + Ignore string +} + +func (a ActionRow) String() string { + return fmt.Sprintf("Accept=%d, Ignore=%s", a.Accept, a.Ignore) +} + +var ActTab = ActionTable{ + ActionRow{ // S0, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S1, Ignore("!whitespace") + Accept: -1, + Ignore: "!whitespace", + }, + ActionRow{ // S2, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S3, Accept("Λ<&>") + Accept: 2, + Ignore: "", + }, + ActionRow{ // S4, Accept("Λ<(>") + Accept: 4, + Ignore: "", + }, + ActionRow{ // S5, Accept("Λ<)>") + Accept: 5, + Ignore: "", + }, + ActionRow{ // S6, Accept("int_lit") + Accept: 8, + Ignore: "", + }, + ActionRow{ // S7, Accept("Λ<<>") + Accept: 9, + Ignore: "", + }, + ActionRow{ // S8, Accept("Λ<>>") + Accept: 10, + Ignore: "", + }, + ActionRow{ // S9, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S10, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S11, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S12, Accept("Λ<|>") + Accept: 3, + Ignore: "", + }, + ActionRow{ // S13, Accept("string_lit") + Accept: 11, + Ignore: "", + }, + ActionRow{ // S14, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S15, Accept("Λ") + Accept: 12, + Ignore: "", + }, + ActionRow{ // S16, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S17, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S18, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S19, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S20, Accept("Λ") + Accept: 6, + Ignore: "", + }, + ActionRow{ // S21, Accept("Λ") + Accept: 7, + Ignore: "", + }, +} diff --git a/example/bools/internal/lexer/lexer.go b/example/bools/internal/lexer/lexer.go new file mode 100644 index 00000000..07c86b15 --- /dev/null +++ b/example/bools/internal/lexer/lexer.go @@ -0,0 +1,153 @@ +// Code generated by gocc; DO NOT EDIT. + +package lexer + +import ( + + "io" + "bytes" + "os" + + + "github.com/maxcalandrelli/gocc/example/bools/iface" + "github.com/maxcalandrelli/gocc/example/bools/internal/token" + "github.com/maxcalandrelli/gocc/example/bools/internal/io/stream" +) + +const ( + NoState = -1 + NumStates = 22 + NumSymbols = 25 + INVALID_RUNE = rune(-1) +) + +type position struct { + token.Pos +} + +type Lexer struct { + position + stream iface.TokenStream + eof bool +} + +func NewLexerBytes(src []byte) *Lexer { + lexer := &Lexer{stream: bytes.NewReader(src)} + lexer.reset() + return lexer +} + +func NewLexerFile(fpath string) (*Lexer, error) { + s, err := os.Open(fpath) + if err != nil { + return nil, err + } + lexer := &Lexer{stream: stream.NewWindowReader(s)} + lexer.reset() + return lexer, nil +} + +func NewLexer(reader io.Reader) (*Lexer, error) { + lexer := &Lexer{} + lexer.reset() + if lexer.stream, _ = reader.(iface.TokenStream); lexer.stream == nil { + lexer.stream = stream.NewWindowReader(reader) + } + return lexer, nil +} + +func (l *Lexer) reset () { + l.position.Reset() +} + +func (l Lexer) GetStream() iface.TokenStream { + return l.stream +} + +type checkPoint int64 + +func (c checkPoint) DistanceFrom (o iface.CheckPoint) int { + return int (c - o.(checkPoint)) +} + +func (l Lexer) GetCheckPoint() iface.CheckPoint { + pos, _ := l.stream.Seek(0, io.SeekCurrent) + return checkPoint(pos) +} + +func (l Lexer) GotoCheckPoint(cp iface.CheckPoint) { + l.stream.Seek(int64(cp.(checkPoint)), io.SeekStart) +} + +func (l *Lexer) Scan() (tok *token.Token) { + tok = new(token.Token) + tok.Type = token.INVALID + tok.Lit = []byte{} + start := l.position + state := 0 + for state != -1 { + curr, size, err := l.stream.ReadRune() + if size < 1 || err != nil { + curr = INVALID_RUNE + } + if size > 0 { + l.position.Pos.Offset += size + } + nextState := -1 + if curr != INVALID_RUNE { + nextState = TransTab[state](curr) + } + state = nextState + if state != -1 { + switch curr { + case '\n': + l.position.Pos.Line++ + l.position.Pos.Column = 1 + case '\r': + l.position.Pos.Column = 1 + case '\t': + l.position.Pos.Column += 4 + default: + l.position.Pos.Column++ + } + switch { + case ActTab[state].Accept != -1: + tok.Type = ActTab[state].Accept + tok.Lit = append(tok.Lit, string(curr)...) + case ActTab[state].Ignore != "": + start = l.position + state = 0 + tok.Lit = []byte{} + } + } else if curr != INVALID_RUNE { + l.stream.UnreadRune() + } + if err == io.EOF && len(tok.Lit)==0 { + tok.Type = token.EOF + tok.Pos = start.Pos + return + } + } + tok.Pos = start.Pos + return +} + +func (l *Lexer) Reset() { + l.position.Reset() +} + +func (l Lexer) CurrentPosition() position { + return l.position +} + +func (p *position) Reset() { + p.Offset = 0 + p.Line = 1 + p.Column = 1 +} + +func (p position) StartingFrom(base position) position { + r := p + r.Pos = p.Pos.StartingFrom(base.Pos) + return r +} diff --git a/example/bools/internal/lexer/transitiontable.go b/example/bools/internal/lexer/transitiontable.go new file mode 100644 index 00000000..d8e02d47 --- /dev/null +++ b/example/bools/internal/lexer/transitiontable.go @@ -0,0 +1,196 @@ +// Code generated by gocc; DO NOT EDIT. + +package lexer + +/* +Let s be the current state +Let r be the current input rune +transitionTable[s](r) returns the next state. +*/ +type TransitionTable [NumStates]func(rune) int + +var TransTab = TransitionTable{ + // S0 + func(r rune) int { + switch { + case r == 9: // ['\t','\t'] + return 1 + case r == 10: // ['\n','\n'] + return 1 + case r == 13: // ['\r','\r'] + return 1 + case r == 32: // [' ',' '] + return 1 + case r == 34: // ['"','"'] + return 2 + case r == 38: // ['&','&'] + return 3 + case r == 40: // ['(','('] + return 4 + case r == 41: // [')',')'] + return 5 + case 48 <= r && r <= 57: // ['0','9'] + return 6 + case r == 60: // ['<','<'] + return 7 + case r == 62: // ['>','>'] + return 8 + case r == 102: // ['f','f'] + return 9 + case r == 105: // ['i','i'] + return 10 + case r == 116: // ['t','t'] + return 11 + case r == 124: // ['|','|'] + return 12 + } + return NoState + }, + // S1 + func(r rune) int { + switch { + } + return NoState + }, + // S2 + func(r rune) int { + switch { + case r == 34: // ['"','"'] + return 13 + default: + return 2 + } + }, + // S3 + func(r rune) int { + switch { + } + return NoState + }, + // S4 + func(r rune) int { + switch { + } + return NoState + }, + // S5 + func(r rune) int { + switch { + } + return NoState + }, + // S6 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 6 + } + return NoState + }, + // S7 + func(r rune) int { + switch { + } + return NoState + }, + // S8 + func(r rune) int { + switch { + } + return NoState + }, + // S9 + func(r rune) int { + switch { + case r == 97: // ['a','a'] + return 14 + } + return NoState + }, + // S10 + func(r rune) int { + switch { + case r == 110: // ['n','n'] + return 15 + } + return NoState + }, + // S11 + func(r rune) int { + switch { + case r == 114: // ['r','r'] + return 16 + } + return NoState + }, + // S12 + func(r rune) int { + switch { + } + return NoState + }, + // S13 + func(r rune) int { + switch { + } + return NoState + }, + // S14 + func(r rune) int { + switch { + case r == 108: // ['l','l'] + return 17 + } + return NoState + }, + // S15 + func(r rune) int { + switch { + } + return NoState + }, + // S16 + func(r rune) int { + switch { + case r == 117: // ['u','u'] + return 18 + } + return NoState + }, + // S17 + func(r rune) int { + switch { + case r == 115: // ['s','s'] + return 19 + } + return NoState + }, + // S18 + func(r rune) int { + switch { + case r == 101: // ['e','e'] + return 20 + } + return NoState + }, + // S19 + func(r rune) int { + switch { + case r == 101: // ['e','e'] + return 21 + } + return NoState + }, + // S20 + func(r rune) int { + switch { + } + return NoState + }, + // S21 + func(r rune) int { + switch { + } + return NoState + }, +} diff --git a/example/bools/internal/parser/action.go b/example/bools/internal/parser/action.go new file mode 100644 index 00000000..54bc55e9 --- /dev/null +++ b/example/bools/internal/parser/action.go @@ -0,0 +1,51 @@ +// Code generated by gocc; DO NOT EDIT. + +package parser + +import ( + "fmt" +) + +type action interface { + act() + String() string +} + +type ( + accept bool + shift int // value is next state index + reduce int // value is production index +) + +func (this accept) act() {} +func (this shift) act() {} +func (this reduce) act() {} + +func (this accept) Equal(that action) bool { + if _, ok := that.(accept); ok { + return true + } + return false +} + +func (this reduce) Equal(that action) bool { + that1, ok := that.(reduce) + if !ok { + return false + } + return this == that1 +} + +func (this shift) Equal(that action) bool { + that1, ok := that.(shift) + if !ok { + return false + } + return this == that1 +} + +func (this accept) String() string { return "accept(0)" } +func (this shift) String() string { return fmt.Sprintf("shift:%d", this) } +func (this reduce) String() string { + return fmt.Sprintf("reduce:%d(%s)", this, productionsTable[this].String) +} diff --git a/example/bools/internal/parser/actiontable.go b/example/bools/internal/parser/actiontable.go new file mode 100644 index 00000000..2e06d3a0 --- /dev/null +++ b/example/bools/internal/parser/actiontable.go @@ -0,0 +1,899 @@ +// Code generated by gocc; DO NOT EDIT. + +package parser + +type ( + actionTable [numStates]actionRow + cdFunc func(TokenStream, interface{}) (interface{}, error, []byte) + cdAction struct { + tokenIndex int + tokenScanner cdFunc + } + actionRow struct { + canRecover bool + actions [numSymbols]action + cdActions []cdAction + } + actions struct { + table actionTable + } +) + +var parserActions = actions{ + table: actionTable{ + actionRow{ // S0 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // "&" + nil, // "|" + shift(6), // "(" + nil, // ")" + shift(7), // "true" + shift(8), // "false" + shift(9), // int_lit + nil, // "<" + nil, // ">" + shift(10), // string_lit + nil, // "in" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S1 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + accept(true), // Ω + shift(11), // "&" + shift(12), // "|" + nil, // "(" + nil, // ")" + nil, // "true" + nil, // "false" + nil, // int_lit + nil, // "<" + nil, // ">" + nil, // string_lit + nil, // "in" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S2 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(1), // Ω, reduce: BoolExpr + reduce(1), // "&", reduce: BoolExpr + reduce(1), // "|", reduce: BoolExpr + nil, // "(" + nil, // ")" + nil, // "true" + nil, // "false" + nil, // int_lit + nil, // "<" + nil, // ">" + nil, // string_lit + nil, // "in" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S3 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(2), // Ω, reduce: BoolExpr1 + reduce(2), // "&", reduce: BoolExpr1 + reduce(2), // "|", reduce: BoolExpr1 + nil, // "(" + nil, // ")" + nil, // "true" + nil, // "false" + nil, // int_lit + nil, // "<" + nil, // ">" + nil, // string_lit + nil, // "in" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S4 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(8), // Ω, reduce: Val + reduce(8), // "&", reduce: Val + reduce(8), // "|", reduce: Val + nil, // "(" + nil, // ")" + nil, // "true" + nil, // "false" + nil, // int_lit + nil, // "<" + nil, // ">" + nil, // string_lit + nil, // "in" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S5 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(9), // Ω, reduce: Val + reduce(9), // "&", reduce: Val + reduce(9), // "|", reduce: Val + nil, // "(" + nil, // ")" + nil, // "true" + nil, // "false" + nil, // int_lit + nil, // "<" + nil, // ">" + nil, // string_lit + nil, // "in" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S6 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // "&" + nil, // "|" + shift(18), // "(" + nil, // ")" + shift(19), // "true" + shift(20), // "false" + shift(21), // int_lit + nil, // "<" + nil, // ">" + shift(22), // string_lit + nil, // "in" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S7 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(6), // Ω, reduce: Val + reduce(6), // "&", reduce: Val + reduce(6), // "|", reduce: Val + nil, // "(" + nil, // ")" + nil, // "true" + nil, // "false" + nil, // int_lit + nil, // "<" + nil, // ">" + nil, // string_lit + nil, // "in" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S8 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(7), // Ω, reduce: Val + reduce(7), // "&", reduce: Val + reduce(7), // "|", reduce: Val + nil, // "(" + nil, // ")" + nil, // "true" + nil, // "false" + nil, // int_lit + nil, // "<" + nil, // ">" + nil, // string_lit + nil, // "in" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S9 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // "&" + nil, // "|" + nil, // "(" + nil, // ")" + nil, // "true" + nil, // "false" + nil, // int_lit + shift(23), // "<" + shift(24), // ">" + nil, // string_lit + nil, // "in" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S10 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // "&" + nil, // "|" + nil, // "(" + nil, // ")" + nil, // "true" + nil, // "false" + nil, // int_lit + nil, // "<" + nil, // ">" + nil, // string_lit + shift(25), // "in" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S11 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // "&" + nil, // "|" + shift(6), // "(" + nil, // ")" + shift(7), // "true" + shift(8), // "false" + shift(9), // int_lit + nil, // "<" + nil, // ">" + shift(10), // string_lit + nil, // "in" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S12 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // "&" + nil, // "|" + shift(6), // "(" + nil, // ")" + shift(7), // "true" + shift(8), // "false" + shift(9), // int_lit + nil, // "<" + nil, // ">" + shift(10), // string_lit + nil, // "in" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S13 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + shift(29), // "&" + shift(30), // "|" + nil, // "(" + shift(31), // ")" + nil, // "true" + nil, // "false" + nil, // int_lit + nil, // "<" + nil, // ">" + nil, // string_lit + nil, // "in" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S14 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + reduce(1), // "&", reduce: BoolExpr + reduce(1), // "|", reduce: BoolExpr + nil, // "(" + reduce(1), // ")", reduce: BoolExpr + nil, // "true" + nil, // "false" + nil, // int_lit + nil, // "<" + nil, // ">" + nil, // string_lit + nil, // "in" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S15 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + reduce(2), // "&", reduce: BoolExpr1 + reduce(2), // "|", reduce: BoolExpr1 + nil, // "(" + reduce(2), // ")", reduce: BoolExpr1 + nil, // "true" + nil, // "false" + nil, // int_lit + nil, // "<" + nil, // ">" + nil, // string_lit + nil, // "in" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S16 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + reduce(8), // "&", reduce: Val + reduce(8), // "|", reduce: Val + nil, // "(" + reduce(8), // ")", reduce: Val + nil, // "true" + nil, // "false" + nil, // int_lit + nil, // "<" + nil, // ">" + nil, // string_lit + nil, // "in" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S17 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + reduce(9), // "&", reduce: Val + reduce(9), // "|", reduce: Val + nil, // "(" + reduce(9), // ")", reduce: Val + nil, // "true" + nil, // "false" + nil, // int_lit + nil, // "<" + nil, // ">" + nil, // string_lit + nil, // "in" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S18 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // "&" + nil, // "|" + shift(18), // "(" + nil, // ")" + shift(19), // "true" + shift(20), // "false" + shift(21), // int_lit + nil, // "<" + nil, // ">" + shift(22), // string_lit + nil, // "in" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S19 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + reduce(6), // "&", reduce: Val + reduce(6), // "|", reduce: Val + nil, // "(" + reduce(6), // ")", reduce: Val + nil, // "true" + nil, // "false" + nil, // int_lit + nil, // "<" + nil, // ">" + nil, // string_lit + nil, // "in" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S20 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + reduce(7), // "&", reduce: Val + reduce(7), // "|", reduce: Val + nil, // "(" + reduce(7), // ")", reduce: Val + nil, // "true" + nil, // "false" + nil, // int_lit + nil, // "<" + nil, // ">" + nil, // string_lit + nil, // "in" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S21 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // "&" + nil, // "|" + nil, // "(" + nil, // ")" + nil, // "true" + nil, // "false" + nil, // int_lit + shift(33), // "<" + shift(34), // ">" + nil, // string_lit + nil, // "in" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S22 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // "&" + nil, // "|" + nil, // "(" + nil, // ")" + nil, // "true" + nil, // "false" + nil, // int_lit + nil, // "<" + nil, // ">" + nil, // string_lit + shift(35), // "in" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S23 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // "&" + nil, // "|" + nil, // "(" + nil, // ")" + nil, // "true" + nil, // "false" + shift(36), // int_lit + nil, // "<" + nil, // ">" + nil, // string_lit + nil, // "in" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S24 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // "&" + nil, // "|" + nil, // "(" + nil, // ")" + nil, // "true" + nil, // "false" + shift(37), // int_lit + nil, // "<" + nil, // ">" + nil, // string_lit + nil, // "in" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S25 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // "&" + nil, // "|" + nil, // "(" + nil, // ")" + nil, // "true" + nil, // "false" + nil, // int_lit + nil, // "<" + nil, // ">" + shift(38), // string_lit + nil, // "in" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S26 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + shift(11), // "&" + shift(12), // "|" + nil, // "(" + nil, // ")" + nil, // "true" + nil, // "false" + nil, // int_lit + nil, // "<" + nil, // ">" + nil, // string_lit + nil, // "in" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S27 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(3), // Ω, reduce: BoolExpr1 + reduce(1), // "&", reduce: BoolExpr + reduce(1), // "|", reduce: BoolExpr + nil, // "(" + nil, // ")" + nil, // "true" + nil, // "false" + nil, // int_lit + nil, // "<" + nil, // ">" + nil, // string_lit + nil, // "in" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S28 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(4), // Ω, reduce: BoolExpr1 + reduce(1), // "&", reduce: BoolExpr + reduce(1), // "|", reduce: BoolExpr + nil, // "(" + nil, // ")" + nil, // "true" + nil, // "false" + nil, // int_lit + nil, // "<" + nil, // ">" + nil, // string_lit + nil, // "in" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S29 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // "&" + nil, // "|" + shift(18), // "(" + nil, // ")" + shift(19), // "true" + shift(20), // "false" + shift(21), // int_lit + nil, // "<" + nil, // ">" + shift(22), // string_lit + nil, // "in" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S30 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // "&" + nil, // "|" + shift(18), // "(" + nil, // ")" + shift(19), // "true" + shift(20), // "false" + shift(21), // int_lit + nil, // "<" + nil, // ">" + shift(22), // string_lit + nil, // "in" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S31 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(5), // Ω, reduce: BoolExpr1 + reduce(5), // "&", reduce: BoolExpr1 + reduce(5), // "|", reduce: BoolExpr1 + nil, // "(" + nil, // ")" + nil, // "true" + nil, // "false" + nil, // int_lit + nil, // "<" + nil, // ">" + nil, // string_lit + nil, // "in" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S32 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + shift(29), // "&" + shift(30), // "|" + nil, // "(" + shift(42), // ")" + nil, // "true" + nil, // "false" + nil, // int_lit + nil, // "<" + nil, // ">" + nil, // string_lit + nil, // "in" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S33 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // "&" + nil, // "|" + nil, // "(" + nil, // ")" + nil, // "true" + nil, // "false" + shift(43), // int_lit + nil, // "<" + nil, // ">" + nil, // string_lit + nil, // "in" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S34 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // "&" + nil, // "|" + nil, // "(" + nil, // ")" + nil, // "true" + nil, // "false" + shift(44), // int_lit + nil, // "<" + nil, // ">" + nil, // string_lit + nil, // "in" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S35 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // "&" + nil, // "|" + nil, // "(" + nil, // ")" + nil, // "true" + nil, // "false" + nil, // int_lit + nil, // "<" + nil, // ">" + shift(45), // string_lit + nil, // "in" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S36 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(10), // Ω, reduce: CompareExpr + reduce(10), // "&", reduce: CompareExpr + reduce(10), // "|", reduce: CompareExpr + nil, // "(" + nil, // ")" + nil, // "true" + nil, // "false" + nil, // int_lit + nil, // "<" + nil, // ">" + nil, // string_lit + nil, // "in" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S37 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(11), // Ω, reduce: CompareExpr + reduce(11), // "&", reduce: CompareExpr + reduce(11), // "|", reduce: CompareExpr + nil, // "(" + nil, // ")" + nil, // "true" + nil, // "false" + nil, // int_lit + nil, // "<" + nil, // ">" + nil, // string_lit + nil, // "in" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S38 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(12), // Ω, reduce: SubStringExpr + reduce(12), // "&", reduce: SubStringExpr + reduce(12), // "|", reduce: SubStringExpr + nil, // "(" + nil, // ")" + nil, // "true" + nil, // "false" + nil, // int_lit + nil, // "<" + nil, // ">" + nil, // string_lit + nil, // "in" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S39 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + shift(29), // "&" + shift(30), // "|" + nil, // "(" + nil, // ")" + nil, // "true" + nil, // "false" + nil, // int_lit + nil, // "<" + nil, // ">" + nil, // string_lit + nil, // "in" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S40 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + reduce(1), // "&", reduce: BoolExpr + reduce(1), // "|", reduce: BoolExpr + nil, // "(" + reduce(3), // ")", reduce: BoolExpr1 + nil, // "true" + nil, // "false" + nil, // int_lit + nil, // "<" + nil, // ">" + nil, // string_lit + nil, // "in" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S41 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + reduce(1), // "&", reduce: BoolExpr + reduce(1), // "|", reduce: BoolExpr + nil, // "(" + reduce(4), // ")", reduce: BoolExpr1 + nil, // "true" + nil, // "false" + nil, // int_lit + nil, // "<" + nil, // ">" + nil, // string_lit + nil, // "in" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S42 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + reduce(5), // "&", reduce: BoolExpr1 + reduce(5), // "|", reduce: BoolExpr1 + nil, // "(" + reduce(5), // ")", reduce: BoolExpr1 + nil, // "true" + nil, // "false" + nil, // int_lit + nil, // "<" + nil, // ">" + nil, // string_lit + nil, // "in" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S43 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + reduce(10), // "&", reduce: CompareExpr + reduce(10), // "|", reduce: CompareExpr + nil, // "(" + reduce(10), // ")", reduce: CompareExpr + nil, // "true" + nil, // "false" + nil, // int_lit + nil, // "<" + nil, // ">" + nil, // string_lit + nil, // "in" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S44 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + reduce(11), // "&", reduce: CompareExpr + reduce(11), // "|", reduce: CompareExpr + nil, // "(" + reduce(11), // ")", reduce: CompareExpr + nil, // "true" + nil, // "false" + nil, // int_lit + nil, // "<" + nil, // ">" + nil, // string_lit + nil, // "in" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S45 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + reduce(12), // "&", reduce: SubStringExpr + reduce(12), // "|", reduce: SubStringExpr + nil, // "(" + reduce(12), // ")", reduce: SubStringExpr + nil, // "true" + nil, // "false" + nil, // int_lit + nil, // "<" + nil, // ">" + nil, // string_lit + nil, // "in" + }, + cdActions: []cdAction{}, + }, + }, +} diff --git a/example/bools/internal/parser/gototable.go b/example/bools/internal/parser/gototable.go new file mode 100644 index 00000000..83b8ddba --- /dev/null +++ b/example/bools/internal/parser/gototable.go @@ -0,0 +1,381 @@ +// Code generated by gocc; DO NOT EDIT. + +package parser + +const numNTSymbols = 6 + +type ( + gotoTable [numStates]gotoRow + gotoRow [numNTSymbols]int +) + +var gotoTab = gotoTable{ + gotoRow{ // S0 + -1, // Π + 1, // Π + 2, // Π + 3, // Π + 4, // Π + 5, // Π + }, + gotoRow{ // S1 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S2 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S3 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S4 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S5 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S6 + -1, // Π + 13, // Π + 14, // Π + 15, // Π + 16, // Π + 17, // Π + }, + gotoRow{ // S7 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S8 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S9 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S10 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S11 + -1, // Π + 26, // Π + 27, // Π + 3, // Π + 4, // Π + 5, // Π + }, + gotoRow{ // S12 + -1, // Π + 26, // Π + 28, // Π + 3, // Π + 4, // Π + 5, // Π + }, + gotoRow{ // S13 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S14 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S15 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S16 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S17 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S18 + -1, // Π + 32, // Π + 14, // Π + 15, // Π + 16, // Π + 17, // Π + }, + gotoRow{ // S19 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S20 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S21 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S22 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S23 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S24 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S25 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S26 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S27 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S28 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S29 + -1, // Π + 39, // Π + 40, // Π + 15, // Π + 16, // Π + 17, // Π + }, + gotoRow{ // S30 + -1, // Π + 39, // Π + 41, // Π + 15, // Π + 16, // Π + 17, // Π + }, + gotoRow{ // S31 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S32 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S33 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S34 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S35 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S36 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S37 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S38 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S39 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S40 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S41 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S42 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S43 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S44 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S45 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, +} diff --git a/example/bools/internal/parser/parser.go b/example/bools/internal/parser/parser.go new file mode 100644 index 00000000..c25ae1ec --- /dev/null +++ b/example/bools/internal/parser/parser.go @@ -0,0 +1,295 @@ +// Code generated by gocc; DO NOT EDIT. + +package parser + +import ( + "errors" + "fmt" + "strings" + + "github.com/maxcalandrelli/gocc/example/bools/iface" + parseError "github.com/maxcalandrelli/gocc/example/bools/internal/errors" + "github.com/maxcalandrelli/gocc/example/bools/internal/token" +) + +const ( + numProductions = 13 + numStates = 46 + numSymbols = 19 +) + +// Stack + +type stack struct { + state []int + attrib []Attrib +} + +const INITIAL_STACK_SIZE = 100 + +func newStack() *stack { + return &stack{ + state: make([]int, 0, INITIAL_STACK_SIZE), + attrib: make([]Attrib, 0, INITIAL_STACK_SIZE), + } +} + +func (s *stack) reset() { + s.state = s.state[:0] + s.attrib = s.attrib[:0] +} + +func (s *stack) push(state int, a Attrib) { + s.state = append(s.state, state) + s.attrib = append(s.attrib, a) +} + +func (s *stack) top() int { + return s.state[len(s.state)-1] +} + +func (s *stack) peek(pos int) int { + return s.state[pos] +} + +func (s *stack) topIndex() int { + return len(s.state) - 1 +} + +func (s *stack) popN(items int) []Attrib { + lo, hi := len(s.state)-items, len(s.state) + + attrib := s.attrib[lo:hi] + + s.state = s.state[:lo] + s.attrib = s.attrib[:lo] + + return attrib +} + +func (s *stack) String() string { + w := new(strings.Builder) + fmt.Fprintf(w, "stack:\n") + for i, st := range s.state { + fmt.Fprintf(w, "\t%d: %d , ", i, st) + if s.attrib[i] == nil { + fmt.Fprintf(w, "nil") + } else { + switch attr := s.attrib[i].(type) { + case *token.Token: + fmt.Fprintf(w, "%s", attr.Lit) + default: + fmt.Fprintf(w, "%v", attr) + } + } + fmt.Fprintf(w, "\n") + } + return w.String() +} + +// Parser + +type Parser struct { + stack *stack + nextToken *token.Token + userContext interface{} +} + +type TokenStream = iface.TokenStream + +func NewParser() *Parser { + return NewParserWithContext(nil) +} + +func NewParserWithContext(u interface{}) *Parser { + p := &Parser{stack: newStack(), userContext: u} + p.Reset() + return p +} + +func (p *Parser) Reset() { + p.stack.reset() + p.stack.push(0, nil) +} + +func (p *Parser) Error(err error, scanner iface.Scanner) (recovered bool, errorAttrib *parseError.Error) { + errorAttrib = &parseError.Error{ + Err: err, + ErrorToken: p.nextToken, + ErrorSymbols: p.popNonRecoveryStates(), + ExpectedTokens: make([]string, 0, 8), + } + for t, action := range parserActions.table[p.stack.top()].actions { + if action != nil { + errorAttrib.ExpectedTokens = append(errorAttrib.ExpectedTokens, token.TokMap.Id(token.Type(t))) + } + } + + if action := parserActions.table[p.stack.top()].actions[token.TokMap.Type("error")]; action != nil { + p.stack.push(int(action.(shift)), errorAttrib) // action can only be shift + } else { + return + } + + if action := parserActions.table[p.stack.top()].actions[p.nextToken.Type]; action != nil { + recovered = true + } + for !recovered && p.nextToken.Type != token.EOF { + p.nextToken = scanner.Scan() + if action := parserActions.table[p.stack.top()].actions[p.nextToken.Type]; action != nil { + recovered = true + } + } + + return +} + +func (p *Parser) popNonRecoveryStates() (removedAttribs []parseError.ErrorSymbol) { + if rs, ok := p.firstRecoveryState(); ok { + errorSymbols := p.stack.popN(p.stack.topIndex() - rs) + removedAttribs = make([]parseError.ErrorSymbol, len(errorSymbols)) + for i, e := range errorSymbols { + removedAttribs[i] = e + } + } else { + removedAttribs = []parseError.ErrorSymbol{} + } + return +} + +// recoveryState points to the highest state on the stack, which can recover +func (p *Parser) firstRecoveryState() (recoveryState int, canRecover bool) { + recoveryState, canRecover = p.stack.topIndex(), parserActions.table[p.stack.top()].canRecover + for recoveryState > 0 && !canRecover { + recoveryState-- + canRecover = parserActions.table[p.stack.peek(recoveryState)].canRecover + } + return +} + +func (p *Parser) newError(err error) error { + e := &parseError.Error{ + Err: err, + StackTop: p.stack.top(), + ErrorToken: p.nextToken, + } + actRow := parserActions.table[p.stack.top()] + for i, t := range actRow.actions { + if t != nil { + e.ExpectedTokens = append(e.ExpectedTokens, token.TokMap.Id(token.Type(i))) + } + } + return e +} + +func (p *Parser) Parse(scanner iface.Scanner) (res interface{}, err error, ptl int) { + return p.parse(scanner, false) +} + +func (p *Parser) ParseLongestPrefix(scanner iface.Scanner) (res interface{}, err error, ptl int) { + return p.parse(scanner, true) +} + +var errNotRepositionable = errors.New("scanner not repositionable") + +func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, err error, ptl int) { + var ( + tokens iface.CheckPointable + afterPos iface.CheckPoint + checkPoint iface.CheckPoint + ) + readNextToken := func() error { + if tokens == nil && (len(parserActions.table[p.stack.top()].cdActions) > 0 || longest) { + return errNotRepositionable + } + checkPoint = tokens.GetCheckPoint() + p.nextToken = scanner.Scan() + if longest { + afterPos = tokens.GetCheckPoint() + } + return nil + } + p.Reset() + tokens, _ = scanner.(iface.CheckPointable) + startCp := tokens.GetCheckPoint() + if err := readNextToken(); err != nil { + return nil, err, tokens.GetCheckPoint().DistanceFrom(startCp) + } + for acc := false; !acc; { + action := parserActions.table[p.stack.top()].actions[p.nextToken.Type] + if action == nil { + // + // If no action, check if we have some context dependent parsing to try + // + for _, cdAction := range parserActions.table[p.stack.top()].cdActions { + tokens.GotoCheckPoint(checkPoint) + cd_res, cd_err, cd_parsed := cdAction.tokenScanner(scanner.GetStream(), p.userContext) + if cd_err == nil && len(cd_parsed) > 0 { + action = parserActions.table[p.stack.top()].actions[cdAction.tokenIndex] + if action != nil { + p.nextToken.Foreign = true + p.nextToken.ForeignAstNode = cd_res + p.nextToken.Lit = cd_parsed + p.nextToken.Type = token.Type(cdAction.tokenIndex) + break + } + } + } + } + // + // Still no action? If a longest possible parsing is requested in place + // of a full text, we should try to check if an EOF here would have led + // to a successful parsing instead + // Rember that token.EOF is 1, that is the index of SyntaxEof into symbol table + // Dirty, dirty, dirty... but I found it as it is, and I prefer not to touch + // + if action == nil && longest { + tokens.GotoCheckPoint(checkPoint) + action = parserActions.table[p.stack.top()].actions[token.EOF] + if action == nil { + // + // ok, let's consume the token then + // + tokens.GotoCheckPoint(afterPos) + } + } + + // + // Well, no action is no action after all... + // + if action == nil { + if recovered, errAttrib := p.Error(nil, scanner); !recovered { + p.nextToken = errAttrib.ErrorToken + return nil, p.newError(nil), tokens.GetCheckPoint().DistanceFrom(startCp) + } + if action = parserActions.table[p.stack.top()].actions[p.nextToken.Type]; action == nil { + panic("Error recovery led to invalid action") + } + } + + switch act := action.(type) { + case accept: + res = p.stack.popN(1)[0] + acc = true + case shift: + p.stack.push(int(act), p.nextToken) + if p.nextToken.Foreign { + p.stack.push(int(act), p.nextToken.ForeignAstNode) + } + if err := readNextToken(); err != nil { + return nil, err, tokens.GetCheckPoint().DistanceFrom(startCp) + } + case reduce: + prod := productionsTable[int(act)] + attrib, err := prod.ReduceFunc(p.userContext, p.stack.popN(prod.NumSymbols)) + if err != nil { + return nil, p.newError(err), tokens.GetCheckPoint().DistanceFrom(startCp) + } else { + p.stack.push(gotoTab[p.stack.top()][prod.NTType], attrib) + } + default: + panic("unknown action: " + action.String()) + } + } + return res, nil, tokens.GetCheckPoint().DistanceFrom(startCp) +} diff --git a/example/bools/internal/parser/productionstable.go b/example/bools/internal/parser/productionstable.go new file mode 100644 index 00000000..c6cbaed6 --- /dev/null +++ b/example/bools/internal/parser/productionstable.go @@ -0,0 +1,155 @@ +// Code generated by gocc; DO NOT EDIT. + +package parser + +import ( + "github.com/maxcalandrelli/gocc/example/bools/ast" +) + +type ( + //TODO: change type and variable names to be consistent with other tables + ProdTab [numProductions]ProdTabEntry + ProdTabEntry struct { + String string + Id string + NTType int + Index int + NumSymbols int + ReduceFunc func(interface{}, []Attrib) (Attrib, error) + } + Attrib interface { + } +) + +var productionsTable = ProdTab{ + ProdTabEntry{ + String: `S' : Π << >>`, + Id: "S'", + NTType: 0, + Index: 0, + NumSymbols: 1, + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { + return X[0], nil + }, + }, + ProdTabEntry{ + String: `BoolExpr : Π << X[0], nil >>`, + Id: "BoolExpr", + NTType: 1, + Index: 1, + NumSymbols: 1, + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { + return X[0], nil + }, + }, + ProdTabEntry{ + String: `BoolExpr1 : Π << X[0], nil >>`, + Id: "BoolExpr1", + NTType: 2, + Index: 2, + NumSymbols: 1, + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { + return X[0], nil + }, + }, + ProdTabEntry{ + String: `BoolExpr1 : Π Λ<&> Π << ast.NewBoolAndExpr(X[0], X[2]) >>`, + Id: "BoolExpr1", + NTType: 2, + Index: 3, + NumSymbols: 3, + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { + return ast.NewBoolAndExpr(X[0], X[2]) + }, + }, + ProdTabEntry{ + String: `BoolExpr1 : Π Λ<|> Π << ast.NewBoolOrExpr(X[0], X[2]) >>`, + Id: "BoolExpr1", + NTType: 2, + Index: 4, + NumSymbols: 3, + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { + return ast.NewBoolOrExpr(X[0], X[2]) + }, + }, + ProdTabEntry{ + String: `BoolExpr1 : Λ<(> Π Λ<)> << ast.NewBoolGroupExpr(X[1]) >>`, + Id: "BoolExpr1", + NTType: 2, + Index: 5, + NumSymbols: 3, + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { + return ast.NewBoolGroupExpr(X[1]) + }, + }, + ProdTabEntry{ + String: `Val : Λ << ast.TRUE, nil >>`, + Id: "Val", + NTType: 3, + Index: 6, + NumSymbols: 1, + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { + return ast.TRUE, nil + }, + }, + ProdTabEntry{ + String: `Val : Λ << ast.FALSE, nil >>`, + Id: "Val", + NTType: 3, + Index: 7, + NumSymbols: 1, + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { + return ast.FALSE, nil + }, + }, + ProdTabEntry{ + String: `Val : Π << X[0], nil >>`, + Id: "Val", + NTType: 3, + Index: 8, + NumSymbols: 1, + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { + return X[0], nil + }, + }, + ProdTabEntry{ + String: `Val : Π << X[0], nil >>`, + Id: "Val", + NTType: 3, + Index: 9, + NumSymbols: 1, + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { + return X[0], nil + }, + }, + ProdTabEntry{ + String: `CompareExpr : int_lit Λ<<> int_lit << ast.NewLessThanExpr(X[0], X[2]) >>`, + Id: "CompareExpr", + NTType: 4, + Index: 10, + NumSymbols: 3, + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { + return ast.NewLessThanExpr(X[0], X[2]) + }, + }, + ProdTabEntry{ + String: `CompareExpr : int_lit Λ<>> int_lit << ast.NewLessThanExpr(X[2], X[0]) >>`, + Id: "CompareExpr", + NTType: 4, + Index: 11, + NumSymbols: 3, + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { + return ast.NewLessThanExpr(X[2], X[0]) + }, + }, + ProdTabEntry{ + String: `SubStringExpr : string_lit Λ string_lit << ast.NewSubStringExpr(X[0], X[2]) >>`, + Id: "SubStringExpr", + NTType: 5, + Index: 12, + NumSymbols: 3, + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { + return ast.NewSubStringExpr(X[0], X[2]) + }, + }, +} diff --git a/example/bools/internal/token/token.go b/example/bools/internal/token/token.go new file mode 100644 index 00000000..54ef22ac --- /dev/null +++ b/example/bools/internal/token/token.go @@ -0,0 +1,107 @@ +// Code generated by gocc; DO NOT EDIT. + +package token + +import ( + "fmt" +) + +type Token struct { + Type + Lit []byte + Pos + ForeignAstNode interface{} + Foreign bool +} + +type Type int + +const ( + INVALID Type = iota + EOF +) + +type Pos struct { + Offset int + Line int + Column int +} + +func (p Pos) String() string { + return fmt.Sprintf("Pos(offset=%d, line=%d, column=%d)", p.Offset, p.Line, p.Column) +} + +func (p Pos) StartingFrom(base Pos) Pos { + r := base + r.Offset += p.Offset + r.Line += p.Line + r.Column = p.Column + if p.Line > 0 && base.Line > 0 { + r.Line-- + } + if r.Column < 1 { + r.Column = 1 + } + return r +} + +type TokenMap struct { + typeMap []string + idMap map[string]Type +} + +func (m TokenMap) Id(tok Type) string { + if int(tok) < len(m.typeMap) { + return m.typeMap[tok] + } + return "unknown" +} + +func (m TokenMap) Type(tok string) Type { + if typ, exist := m.idMap[tok]; exist { + return typ + } + return INVALID +} + +func (m TokenMap) TokenString(tok *Token) string { + return fmt.Sprintf("%s(%d,<%s>)", m.Id(tok.Type), tok.Type, tok.Lit) +} + +func (m TokenMap) StringType(typ Type) string { + return fmt.Sprintf("%s(%d)", m.Id(typ), typ) +} + +var TokMap = TokenMap{ + typeMap: []string{ + "INVALID", + "Ω", + "Λ<&>", + "Λ<|>", + "Λ<(>", + "Λ<)>", + "Λ", + "Λ", + "int_lit", + "Λ<<>", + "Λ<>>", + "string_lit", + "Λ", + }, + + idMap: map[string]Type{ + "INVALID": 0, + "Ω": 1, + "Λ<&>": 2, + "Λ<|>": 3, + "Λ<(>": 4, + "Λ<)>": 5, + "Λ": 6, + "Λ": 7, + "int_lit": 8, + "Λ<<>": 9, + "Λ<>>": 10, + "string_lit": 11, + "Λ": 12, + }, +} diff --git a/example/bools/internal/util/litconv.go b/example/bools/internal/util/litconv.go new file mode 100644 index 00000000..1aeb6166 --- /dev/null +++ b/example/bools/internal/util/litconv.go @@ -0,0 +1,108 @@ +// Code generated by gocc; DO NOT EDIT. + +package util + +import ( + "fmt" + "strconv" + "unicode" + "unicode/utf8" +) + +/* Interface */ + +/* +Convert the literal value of a scanned token to rune +*/ +func RuneValue(lit []byte) rune { + if lit[1] == '\\' { + return escapeCharVal(lit) + } + r, size := utf8.DecodeRune(lit[1:]) + if size != len(lit)-2 { + panic(fmt.Sprintf("Error decoding rune. Lit: %s, rune: %d, size%d\n", lit, r, size)) + } + return r +} + +/* +Convert the literal value of a scanned token to int64 +*/ +func IntValue(lit []byte) (int64, error) { + return strconv.ParseInt(string(lit), 10, 64) +} + +/* +Convert the literal value of a scanned token to uint64 +*/ +func UintValue(lit []byte) (uint64, error) { + return strconv.ParseUint(string(lit), 10, 64) +} + +/* Util */ + +func escapeCharVal(lit []byte) rune { + var i, base, max uint32 + offset := 2 + switch lit[offset] { + case 'a': + return '\a' + case 'b': + return '\b' + case 'f': + return '\f' + case 'n': + return '\n' + case 'r': + return '\r' + case 't': + return '\t' + case 'v': + return '\v' + case '\\': + return '\\' + case '\'': + return '\'' + case '0', '1', '2', '3', '4', '5', '6', '7': + i, base, max = 3, 8, 255 + case 'x': + i, base, max = 2, 16, 255 + offset++ + case 'u': + i, base, max = 4, 16, unicode.MaxRune + offset++ + case 'U': + i, base, max = 8, 16, unicode.MaxRune + offset++ + default: + panic(fmt.Sprintf("Error decoding character literal: %s\n", lit)) + } + + var x uint32 + for ; i > 0 && offset < len(lit)-1; i-- { + ch, size := utf8.DecodeRune(lit[offset:]) + offset += size + d := uint32(digitVal(ch)) + if d >= base { + panic(fmt.Sprintf("charVal(%s): illegal character (%c) in escape sequence. size=%d, offset=%d", lit, ch, size, offset)) + } + x = x*base + d + } + if x > max || 0xD800 <= x && x < 0xE000 { + panic(fmt.Sprintf("Error decoding escape char value. Lit:%s, offset:%d, escape sequence is invalid Unicode code point\n", lit, offset)) + } + + return rune(x) +} + +func digitVal(ch rune) int { + switch { + case '0' <= ch && ch <= '9': + return int(ch) - '0' + case 'a' <= ch && ch <= 'f': + return int(ch) - 'a' + 10 + case 'A' <= ch && ch <= 'F': + return int(ch) - 'A' + 10 + } + return 16 // larger than any legal digit val +} diff --git a/example/bools/internal/util/rune.go b/example/bools/internal/util/rune.go new file mode 100644 index 00000000..bd8523a4 --- /dev/null +++ b/example/bools/internal/util/rune.go @@ -0,0 +1,39 @@ +// Code generated by gocc; DO NOT EDIT. + +package util + +import ( + "fmt" +) + +func RuneToString(r rune) string { + if r >= 0x20 && r < 0x7f { + return fmt.Sprintf("'%c'", r) + } + switch r { + case 0x07: + return "'\\a'" + case 0x08: + return "'\\b'" + case 0x0C: + return "'\\f'" + case 0x0A: + return "'\\n'" + case 0x0D: + return "'\\r'" + case 0x09: + return "'\\t'" + case 0x0b: + return "'\\v'" + case 0x5c: + return "'\\\\\\'" + case 0x27: + return "'\\''" + case 0x22: + return "'\\\"'" + } + if r < 0x10000 { + return fmt.Sprintf("\\u%04x", r) + } + return fmt.Sprintf("\\U%08x", r) +} diff --git a/example/bools/main/main.go b/example/bools/main/main.go new file mode 100644 index 00000000..945b2a0b --- /dev/null +++ b/example/bools/main/main.go @@ -0,0 +1,53 @@ +package main + +import ( + "flag" + "fmt" + "os" + "strings" + + bools "github.com/maxcalandrelli/gocc/example/bools" +) + +func showResult(r interface{}, e error, l int) { + if e != nil { + fmt.Fprintf(os.Stderr, "parsing returned the following error: %s\n", e.Error()) + } else { + fmt.Printf("r=%#v, %d bytes\n", r, l) + } +} + +var ( + File string + Text string + Longest bool +) + +func parse(longest bool, lex *bools.Lexer) (res interface{}, err error, ptl int) { + if longest { + return bools.NewParser().ParseLongestPrefix(lex) + } else { + return bools.NewParser().Parse(lex) + } + return +} + +func main() { + flag.StringVar(&File, "file", "", "parse also text in file") + flag.StringVar(&Text, "text", "", "parse also text given with flag") + flag.BoolVar(&Longest, "longest", false, "parse longest possible part") + flag.Parse() + if Text > "" { + showResult(parse(Longest, bools.NewLexerString(Text))) + } + if File > "" { + l, e := bools.NewLexerFile(File) + if e != nil { + panic(e) + } + showResult(parse(Longest, l)) + } + if str := strings.Join(flag.Args(), " "); str > "" { + showResult(parse(Longest, bools.NewLexerString(str))) + } +} diff --git a/example/bools/parser/productionstable.go b/example/bools/parser/productionstable.go index 994b10b8..67618ea5 100644 --- a/example/bools/parser/productionstable.go +++ b/example/bools/parser/productionstable.go @@ -2,9 +2,7 @@ package parser -import ( - "github.com/maxcalandrelli/gocc/example/bools/ast" -) +import ( "github.com/maxcalandrelli/gocc/example/bools/ast" ) type ( //TODO: change type and variable names to be consistent with other tables diff --git a/example/calc/calc.go b/example/calc/calc.go new file mode 100644 index 00000000..57479229 --- /dev/null +++ b/example/calc/calc.go @@ -0,0 +1,62 @@ +// Code generated by gocc; DO NOT EDIT. + +package calc + +import ( + "io" + + "github.com/maxcalandrelli/gocc/example/calc/iface" + "github.com/maxcalandrelli/gocc/example/calc/internal/io/stream" + "github.com/maxcalandrelli/gocc/example/calc/internal/lexer" + "github.com/maxcalandrelli/gocc/example/calc/internal/parser" + "github.com/maxcalandrelli/gocc/example/calc/internal/token" +) + +type ( + Token = token.Token + Lexer = lexer.Lexer + Parser = parser.Parser + TokenStream = iface.TokenStream + WindowReader = stream.WindowReader + Scanner = iface.Scanner +) + +func ParseFile(fpath string) (interface{}, error, int) { + if lexer, err := NewLexerFile(fpath); err == nil { + return NewParser().Parse(lexer) + } else { + return nil, err, 0 + } +} + +func ParseText(text string) (interface{}, error, int) { + return NewParser().Parse(NewLexerBytes([]byte(text))) +} + +func NewLexerBytes(src []byte) *lexer.Lexer { + return lexer.NewLexerBytes(src) +} + +func NewLexerString(src string) *lexer.Lexer { + return lexer.NewLexerBytes([]byte(src)) +} + +func NewLexerFile(fpath string) (*lexer.Lexer, error) { + return lexer.NewLexerFile(fpath) +} + +func NewParser() *parser.Parser { + return parser.NewParser() +} + +func NewWindowReaderFromBytes(src []byte) WindowReader { + return stream.NewWindowReaderFromBytes(src) +} + +func NewWindowReader(rdr io.Reader) WindowReader { + return stream.NewWindowReader(rdr) +} + +func NewLimitedWindowReader(rdr io.Reader, sizeMin, sizeMax int) WindowReader { + return stream.NewLimitedWindowReader(rdr, sizeMin, sizeMax) +} diff --git a/example/calc/iface/iface.go b/example/calc/iface/iface.go new file mode 100644 index 00000000..1ad96ebe --- /dev/null +++ b/example/calc/iface/iface.go @@ -0,0 +1,30 @@ +// Code generated by gocc; DO NOT EDIT. + +package iface + +import ( + "github.com/maxcalandrelli/gocc/example/calc/internal/token" + "io" +) + +type ( + Scanner interface { + Scan() (tok *token.Token) + GetStream() TokenStream + } + + CheckPoint interface { + DistanceFrom(CheckPoint) int + } + + CheckPointable interface { + GetCheckPoint() CheckPoint + GotoCheckPoint(CheckPoint) + } + + TokenStream interface { + io.Reader + io.RuneScanner + io.Seeker + } +) diff --git a/example/calc/internal/errors/errors.go b/example/calc/internal/errors/errors.go new file mode 100644 index 00000000..39b5229d --- /dev/null +++ b/example/calc/internal/errors/errors.go @@ -0,0 +1,56 @@ +// Code generated by gocc; DO NOT EDIT. + +package errors + +import ( + "fmt" + "strings" + + "github.com/maxcalandrelli/gocc/example/calc/internal/token" +) + +type ErrorSymbol interface { +} + +type Error struct { + Err error + ErrorToken *token.Token + ErrorSymbols []ErrorSymbol + ExpectedTokens []string + StackTop int +} + +func (e *Error) String() string { + w := new(strings.Builder) + fmt.Fprintf(w, "Error") + if e.Err != nil { + fmt.Fprintf(w, " %s\n", e.Err) + } else { + fmt.Fprintf(w, "\n") + } + fmt.Fprintf(w, "Token: type=%d, lit=%s\n", e.ErrorToken.Type, e.ErrorToken.Lit) + fmt.Fprintf(w, "Pos: offset=%d, line=%d, column=%d\n", e.ErrorToken.Pos.Offset, e.ErrorToken.Pos.Line, e.ErrorToken.Pos.Column) + fmt.Fprintf(w, "Expected one of: ") + for _, sym := range e.ExpectedTokens { + fmt.Fprintf(w, "%s ", sym) + } + fmt.Fprintf(w, "ErrorSymbol:\n") + for _, sym := range e.ErrorSymbols { + fmt.Fprintf(w, "%v\n", sym) + } + return w.String() +} + +func (e *Error) Error() string { + w := new(strings.Builder) + fmt.Fprintf(w, "Error in S%d: %s, %s", e.StackTop, token.TokMap.TokenString(e.ErrorToken), e.ErrorToken.Pos.String()) + if e.Err != nil { + fmt.Fprintf(w, ": %+v", e.Err) + } else { + fmt.Fprintf(w, ", expected one of: ") + for _, expected := range e.ExpectedTokens { + fmt.Fprintf(w, "%s ", expected) + } + } + return w.String() +} diff --git a/example/calc/internal/io/stream/internal/stream_impl.go b/example/calc/internal/io/stream/internal/stream_impl.go new file mode 100644 index 00000000..358aa160 --- /dev/null +++ b/example/calc/internal/io/stream/internal/stream_impl.go @@ -0,0 +1,275 @@ +package internal + +import ( + "io" + "sync" + "unicode/utf8" +) + +type ( + impl_WindowReader struct { + bufferBlockSize int + maxBufferSize int + buffers [][]byte + available int + absbase int64 + position int + eof bool + rdr io.Reader + lock *sync.Mutex + } +) + +func (s *impl_WindowReader) lockReader() { + if s.lock != nil { + s.lock.Lock() + } +} + +func (s *impl_WindowReader) unlockReader() { + if s.lock != nil { + s.lock.Unlock() + } +} + +func (s *impl_WindowReader) seek(offset int64, whence int) (offs int64, err error) { + switch whence { + case io.SeekStart: + return s.seek(offset-s.ReadPosition(), io.SeekCurrent) + case io.SeekCurrent: + switch { + case offset == 0: + return s.ReadPosition(), nil + case offset < 0: + if -offset > int64(s.maxBackOffset()) { + err = io.ErrShortBuffer + } else { + s.advanceGet(int(offset)) + } + case offset > 0: + for offset > 0 && !s.eof { + available := s.Buffered() + if offset <= int64(available) { + s.advanceGet(int(offset)) + break + } + if available > 0 { + s.advanceGet(available) + offset -= int64(available) + } + read, _ := s.fetchBytes(int(offset)) + s.advanceGet(read) + offset -= int64(read) + } + if s.eof { + err = io.EOF + } + } + case io.SeekEnd: + for !s.eof { + s.seek(int64(s.MaxCap()), io.SeekCurrent) + } + s.seek(int64(s.Buffered()), io.SeekCurrent) + } + if s.eof && err == nil && s.Buffered() > 0 { + s.eof = false + } + return s.ReadPosition(), err +} + +func (s impl_WindowReader) maxBackOffset() int { + r := s.position + if s.absbase > 0 { + r = s.Cap() - s.Buffered() + } + return r +} + +func (s impl_WindowReader) bufferIndex(pos int) int { + if pos < 0 { + panic("negative position") + } + return pos / s.bufferBlockSize +} + +func (s impl_WindowReader) bufferBytes(pos int) []byte { + return s.buffers[s.bufferIndex(pos)] +} + +func (s impl_WindowReader) bufferByteRange(pos int, length int) []byte { + p := s.bufferOffset(pos) + return s.bufferBytes(pos)[p : p+length] +} + +func (s impl_WindowReader) bufferOffset(pos int) int { + return pos % s.bufferBlockSize +} + +func (s *impl_WindowReader) advanceGet(n int) { + sz := s.Cap() + switch { + case n < 0: + if -n > s.maxBackOffset() { + panic("underflow") + } + s.position += n + if s.position < 0 { + s.position += sz + s.absbase -= int64(sz) + } + case n > 0: + if n > s.Buffered() { + panic("overflow") + } + s.position += n + if s.position >= sz { + s.position -= sz + s.absbase += int64(sz) + } + } + s.available -= n +} + +func (s *impl_WindowReader) copy(to []byte, length int) { + for offs, cp := 0, 0; length > 0; length -= cp { + s.position %= s.MaxCap() + p := s.bufferOffset(s.position) + b := s.bufferBytes(s.position) + r := s.bufferBlockSize - p + if length <= r { + cp = copy(to[offs:], b[p:p+length]) + } else { + cp = copy(to[offs:], b[p:]) + } + s.advanceGet(cp) + offs += cp + } +} + +func (s *impl_WindowReader) fetchBytes(n int) (read int, err error) { + if s.rdr == nil { + s.eof = true + return 0, io.EOF + } + for n > 0 && s.Buffered() < s.MaxCap() && err == nil { + readNow := n + putpos := s.position + s.available + r := s.bufferBlockSize - s.bufferOffset(putpos) + if readNow > r { + readNow = r + } + for s.bufferIndex(putpos) >= len(s.buffers) && s.Cap() < s.MaxCap() { + s.buffers = append(s.buffers, make([]byte, s.bufferBlockSize)) + } + putpos %= s.MaxCap() + offs := s.bufferOffset(putpos) + if r, err = s.rdr.Read(s.bufferBytes(putpos)[offs : offs+readNow]); r > 0 { + s.available += r + read += r + n -= r + } + } + if n > 0 && err == nil { + err = io.ErrShortBuffer + } + return +} + +func (s *impl_WindowReader) read(p []byte) (read int, err error) { + if s.eof { + return 0, io.EOF + } + for read < len(p) && err == nil { + available := s.Buffered() + if len(p)-read <= available { + s.copy(p[read:], len(p)-read) + read = len(p) + } else { + if available == 0 { + available, err = s.fetchBytes(len(p) - read) + } + s.copy(p[read:], available) + read += available + switch err { + case io.ErrShortBuffer: + err = nil + case io.EOF: + s.eof = true + } + } + } + return +} + +func (s impl_WindowReader) peekByte() (byte, error) { + if s.Buffered() < 1 { + return 0, io.ErrShortBuffer + } + return s.bufferBytes(s.position)[s.bufferOffset(s.position)], nil +} + +func (s *impl_WindowReader) unreadByte() error { + _, e := s.seek(-1, io.SeekCurrent) + return e +} + +func (s *impl_WindowReader) readRune() (r rune, size int, err error) { + for i := 1; err == nil && i <= 4; i++ { + if s.Buffered() < i { + if _, err = s.fetchBytes(i); err != nil { + return + } + } + t := s.bufferByteRange(s.position, i) + if r, size = utf8.DecodeRune(t); r != utf8.RuneError { + s.advanceGet(size) + return + } + } + return utf8.RuneError, 0, err +} + +func (s *impl_WindowReader) unreadRune() (err error) { + tmps := *s + tmpb := []byte{} + for { + if _, err = tmps.seek(-1, io.SeekCurrent); err == nil { + b, _ := tmps.peekByte() + tmpb = append([]byte{b}, tmpb...) + switch len(tmpb) { + case 1: + if (tmpb[0] & 0xC0) == 0x80 { + continue + } + _, err = s.seek(-int64(len(tmpb)), io.SeekCurrent) + return + case 2: + if (tmpb[0] & 0xC0) == 0x80 { + continue + } + if (tmpb[0] & 0xE0) != 0xC0 { + break + } + _, err = s.seek(-int64(len(tmpb)), io.SeekCurrent) + return + case 3: + if (tmpb[0] & 0xC0) == 0x80 { + continue + } + if (tmpb[0] & 0xF0) != 0xE0 { + break + } + _, err = s.seek(-int64(len(tmpb)), io.SeekCurrent) + return + case 4: + if (tmpb[0] & 0xF8) != 0xF0 { + break + } + _, err = s.seek(-int64(len(tmpb)), io.SeekCurrent) + return + } + } + } + _, err = s.seek(-1, io.SeekCurrent) + return +} diff --git a/example/calc/internal/io/stream/internal/stream_public.go b/example/calc/internal/io/stream/internal/stream_public.go new file mode 100644 index 00000000..20ed7b5e --- /dev/null +++ b/example/calc/internal/io/stream/internal/stream_public.go @@ -0,0 +1,101 @@ +package internal + +import ( + "io" +) + +func NewWindowReader(buf []byte, underlyingReader io.Reader, blksize, smax int, InfoPrefixRoundUp bool) *impl_WindowReader { + if blksize < 0 || smax < blksize { + panic("illegal buffer size") + } + r := &impl_WindowReader{rdr: underlyingReader} + r.bufferBlockSize = blksize + if underlyingReader != nil { + if blksize <= 0 { + r.bufferBlockSize = 1 << 10 + } else if InfoPrefixRoundUp { + for r.bufferBlockSize = 1; blksize > 0; r.bufferBlockSize = r.bufferBlockSize << 1 { + blksize = blksize >> 1 + } + } + if smax > 0 { + r.maxBufferSize = ((smax-1)/r.bufferBlockSize + 1) * r.bufferBlockSize + } + r.buffers = [][]byte{} + } else { + r.buffers = [][]byte{buf} + r.available = len(buf) + r.bufferBlockSize = r.available + r.maxBufferSize = r.available + } + return r +} + +func (s impl_WindowReader) Cap() int { + return len(s.buffers) * s.bufferBlockSize +} + +func (s impl_WindowReader) BlockSize() int { + return s.bufferBlockSize +} + +func (s impl_WindowReader) MaxCap() int { + if s.maxBufferSize > 0 { + return s.maxBufferSize + } + return 1 << 31 +} + +func (s impl_WindowReader) MaxUnreadSize() int { + return s.maxBackOffset() +} + +func (s impl_WindowReader) Buffered() int { + return s.available +} + +func (s impl_WindowReader) ReadPosition() int64 { + return s.absbase + int64(s.position) +} + +func (s *impl_WindowReader) Read(p []byte) (read int, err error) { + s.lockReader() + defer func() { s.unlockReader() }() + return s.read(p) +} + +func (s *impl_WindowReader) Seek(offset int64, whence int) (offs int64, err error) { + s.lockReader() + defer func() { s.unlockReader() }() + return s.seek(offset, whence) +} + +func (s *impl_WindowReader) ReadByte() (byte, error) { + b := []byte{0} + _, err := s.Read(b) + return b[0], err +} + +func (s *impl_WindowReader) PeekByte() (byte, error) { + s.lockReader() + defer func() { s.unlockReader() }() + return s.peekByte() +} + +func (s *impl_WindowReader) UnreadByte() error { + s.lockReader() + defer func() { s.unlockReader() }() + return s.unreadByte() +} + +func (s *impl_WindowReader) ReadRune() (r rune, size int, err error) { + s.lockReader() + defer func() { s.unlockReader() }() + return s.readRune() +} + +func (s *impl_WindowReader) UnreadRune() (err error) { + s.lockReader() + defer func() { s.unlockReader() }() + return s.unreadRune() +} diff --git a/example/calc/internal/io/stream/stream.go b/example/calc/internal/io/stream/stream.go new file mode 100644 index 00000000..8a8b3233 --- /dev/null +++ b/example/calc/internal/io/stream/stream.go @@ -0,0 +1,39 @@ +package stream + +import ( + internal "github.com/maxcalandrelli/gocc/example/calc/internal/io/stream/internal" + "io" +) + +type ( + WindowReader interface { + BlockSize() int + Buffered() int + Cap() int + MaxCap() int + Read([]byte) (int, error) + ReadByte() (byte, error) + ReadPosition() int64 + ReadRune() (rune, int, error) + Seek(int64, int) (int64, error) + UnreadByte() error + UnreadRune() error + MaxUnreadSize() int + } +) + +var ( + InfoPrefixRoundUp = false +) + +func NewWindowReaderFromBytes(src []byte) WindowReader { + return internal.NewWindowReader(src, nil, 0, 0, InfoPrefixRoundUp) +} + +func NewWindowReader(rdr io.Reader) WindowReader { + return internal.NewWindowReader(nil, rdr, 0, 0, false) +} + +func NewLimitedWindowReader(rdr io.Reader, sizeMin, sizeMax int) WindowReader { + return internal.NewWindowReader(nil, rdr, sizeMin, sizeMax, InfoPrefixRoundUp) +} diff --git a/example/calc/internal/lexer/acttab.go b/example/calc/internal/lexer/acttab.go new file mode 100644 index 00000000..58aa3971 --- /dev/null +++ b/example/calc/internal/lexer/acttab.go @@ -0,0 +1,55 @@ +// Code generated by gocc; DO NOT EDIT. + +package lexer + +import ( + "fmt" + + "github.com/maxcalandrelli/gocc/example/calc/internal/token" +) + +type ActionTable [NumStates]ActionRow + +type ActionRow struct { + Accept token.Type + Ignore string +} + +func (a ActionRow) String() string { + return fmt.Sprintf("Accept=%d, Ignore=%s", a.Accept, a.Ignore) +} + +var ActTab = ActionTable{ + ActionRow{ // S0, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S1, Ignore("!whitespace") + Accept: -1, + Ignore: "!whitespace", + }, + ActionRow{ // S2, Accept("Λ<(>") + Accept: 4, + Ignore: "", + }, + ActionRow{ // S3, Accept("Λ<)>") + Accept: 5, + Ignore: "", + }, + ActionRow{ // S4, Accept("Λ<*>") + Accept: 3, + Ignore: "", + }, + ActionRow{ // S5, Accept("Λ<+>") + Accept: 2, + Ignore: "", + }, + ActionRow{ // S6, Accept("int64") + Accept: 6, + Ignore: "", + }, + ActionRow{ // S7, Accept("int64") + Accept: 6, + Ignore: "", + }, +} diff --git a/example/calc/internal/lexer/lexer.go b/example/calc/internal/lexer/lexer.go new file mode 100644 index 00000000..922767db --- /dev/null +++ b/example/calc/internal/lexer/lexer.go @@ -0,0 +1,153 @@ +// Code generated by gocc; DO NOT EDIT. + +package lexer + +import ( + + "io" + "bytes" + "os" + + + "github.com/maxcalandrelli/gocc/example/calc/iface" + "github.com/maxcalandrelli/gocc/example/calc/internal/token" + "github.com/maxcalandrelli/gocc/example/calc/internal/io/stream" +) + +const ( + NoState = -1 + NumStates = 8 + NumSymbols = 11 + INVALID_RUNE = rune(-1) +) + +type position struct { + token.Pos +} + +type Lexer struct { + position + stream iface.TokenStream + eof bool +} + +func NewLexerBytes(src []byte) *Lexer { + lexer := &Lexer{stream: bytes.NewReader(src)} + lexer.reset() + return lexer +} + +func NewLexerFile(fpath string) (*Lexer, error) { + s, err := os.Open(fpath) + if err != nil { + return nil, err + } + lexer := &Lexer{stream: stream.NewWindowReader(s)} + lexer.reset() + return lexer, nil +} + +func NewLexer(reader io.Reader) (*Lexer, error) { + lexer := &Lexer{} + lexer.reset() + if lexer.stream, _ = reader.(iface.TokenStream); lexer.stream == nil { + lexer.stream = stream.NewWindowReader(reader) + } + return lexer, nil +} + +func (l *Lexer) reset () { + l.position.Reset() +} + +func (l Lexer) GetStream() iface.TokenStream { + return l.stream +} + +type checkPoint int64 + +func (c checkPoint) DistanceFrom (o iface.CheckPoint) int { + return int (c - o.(checkPoint)) +} + +func (l Lexer) GetCheckPoint() iface.CheckPoint { + pos, _ := l.stream.Seek(0, io.SeekCurrent) + return checkPoint(pos) +} + +func (l Lexer) GotoCheckPoint(cp iface.CheckPoint) { + l.stream.Seek(int64(cp.(checkPoint)), io.SeekStart) +} + +func (l *Lexer) Scan() (tok *token.Token) { + tok = new(token.Token) + tok.Type = token.INVALID + tok.Lit = []byte{} + start := l.position + state := 0 + for state != -1 { + curr, size, err := l.stream.ReadRune() + if size < 1 || err != nil { + curr = INVALID_RUNE + } + if size > 0 { + l.position.Pos.Offset += size + } + nextState := -1 + if curr != INVALID_RUNE { + nextState = TransTab[state](curr) + } + state = nextState + if state != -1 { + switch curr { + case '\n': + l.position.Pos.Line++ + l.position.Pos.Column = 1 + case '\r': + l.position.Pos.Column = 1 + case '\t': + l.position.Pos.Column += 4 + default: + l.position.Pos.Column++ + } + switch { + case ActTab[state].Accept != -1: + tok.Type = ActTab[state].Accept + tok.Lit = append(tok.Lit, string(curr)...) + case ActTab[state].Ignore != "": + start = l.position + state = 0 + tok.Lit = []byte{} + } + } else if curr != INVALID_RUNE { + l.stream.UnreadRune() + } + if err == io.EOF && len(tok.Lit)==0 { + tok.Type = token.EOF + tok.Pos = start.Pos + return + } + } + tok.Pos = start.Pos + return +} + +func (l *Lexer) Reset() { + l.position.Reset() +} + +func (l Lexer) CurrentPosition() position { + return l.position +} + +func (p *position) Reset() { + p.Offset = 0 + p.Line = 1 + p.Column = 1 +} + +func (p position) StartingFrom(base position) position { + r := p + r.Pos = p.Pos.StartingFrom(base.Pos) + return r +} diff --git a/example/calc/internal/lexer/transitiontable.go b/example/calc/internal/lexer/transitiontable.go new file mode 100644 index 00000000..9edc0aec --- /dev/null +++ b/example/calc/internal/lexer/transitiontable.go @@ -0,0 +1,83 @@ +// Code generated by gocc; DO NOT EDIT. + +package lexer + +/* +Let s be the current state +Let r be the current input rune +transitionTable[s](r) returns the next state. +*/ +type TransitionTable [NumStates]func(rune) int + +var TransTab = TransitionTable{ + // S0 + func(r rune) int { + switch { + case r == 9: // ['\t','\t'] + return 1 + case r == 10: // ['\n','\n'] + return 1 + case r == 13: // ['\r','\r'] + return 1 + case r == 32: // [' ',' '] + return 1 + case r == 40: // ['(','('] + return 2 + case r == 41: // [')',')'] + return 3 + case r == 42: // ['*','*'] + return 4 + case r == 43: // ['+','+'] + return 5 + case 49 <= r && r <= 57: // ['1','9'] + return 6 + } + return NoState + }, + // S1 + func(r rune) int { + switch { + } + return NoState + }, + // S2 + func(r rune) int { + switch { + } + return NoState + }, + // S3 + func(r rune) int { + switch { + } + return NoState + }, + // S4 + func(r rune) int { + switch { + } + return NoState + }, + // S5 + func(r rune) int { + switch { + } + return NoState + }, + // S6 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 7 + } + return NoState + }, + // S7 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 7 + } + return NoState + }, +} diff --git a/example/calc/internal/parser/action.go b/example/calc/internal/parser/action.go new file mode 100644 index 00000000..54bc55e9 --- /dev/null +++ b/example/calc/internal/parser/action.go @@ -0,0 +1,51 @@ +// Code generated by gocc; DO NOT EDIT. + +package parser + +import ( + "fmt" +) + +type action interface { + act() + String() string +} + +type ( + accept bool + shift int // value is next state index + reduce int // value is production index +) + +func (this accept) act() {} +func (this shift) act() {} +func (this reduce) act() {} + +func (this accept) Equal(that action) bool { + if _, ok := that.(accept); ok { + return true + } + return false +} + +func (this reduce) Equal(that action) bool { + that1, ok := that.(reduce) + if !ok { + return false + } + return this == that1 +} + +func (this shift) Equal(that action) bool { + that1, ok := that.(shift) + if !ok { + return false + } + return this == that1 +} + +func (this accept) String() string { return "accept(0)" } +func (this shift) String() string { return fmt.Sprintf("shift:%d", this) } +func (this reduce) String() string { + return fmt.Sprintf("reduce:%d(%s)", this, productionsTable[this].String) +} diff --git a/example/calc/internal/parser/actiontable.go b/example/calc/internal/parser/actiontable.go new file mode 100644 index 00000000..6c234a0c --- /dev/null +++ b/example/calc/internal/parser/actiontable.go @@ -0,0 +1,324 @@ +// Code generated by gocc; DO NOT EDIT. + +package parser + +type ( + actionTable [numStates]actionRow + cdFunc func(TokenStream, interface{}) (interface{}, error, []byte) + cdAction struct { + tokenIndex int + tokenScanner cdFunc + } + actionRow struct { + canRecover bool + actions [numSymbols]action + cdActions []cdAction + } + actions struct { + table actionTable + } +) + +var parserActions = actions{ + table: actionTable{ + actionRow{ // S0 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // "+" + nil, // "*" + shift(5), // "(" + nil, // ")" + shift(6), // int64 + }, + cdActions: []cdAction{}, + }, + actionRow{ // S1 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + accept(true), // Ω + nil, // "+" + nil, // "*" + nil, // "(" + nil, // ")" + nil, // int64 + }, + cdActions: []cdAction{}, + }, + actionRow{ // S2 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(1), // Ω, reduce: Calc + shift(7), // "+" + nil, // "*" + nil, // "(" + nil, // ")" + nil, // int64 + }, + cdActions: []cdAction{}, + }, + actionRow{ // S3 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(3), // Ω, reduce: Expr + reduce(3), // "+", reduce: Expr + shift(8), // "*" + nil, // "(" + nil, // ")" + nil, // int64 + }, + cdActions: []cdAction{}, + }, + actionRow{ // S4 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(5), // Ω, reduce: Term + reduce(5), // "+", reduce: Term + reduce(5), // "*", reduce: Term + nil, // "(" + nil, // ")" + nil, // int64 + }, + cdActions: []cdAction{}, + }, + actionRow{ // S5 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // "+" + nil, // "*" + shift(12), // "(" + nil, // ")" + shift(13), // int64 + }, + cdActions: []cdAction{}, + }, + actionRow{ // S6 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(7), // Ω, reduce: Factor + reduce(7), // "+", reduce: Factor + reduce(7), // "*", reduce: Factor + nil, // "(" + nil, // ")" + nil, // int64 + }, + cdActions: []cdAction{}, + }, + actionRow{ // S7 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // "+" + nil, // "*" + shift(5), // "(" + nil, // ")" + shift(6), // int64 + }, + cdActions: []cdAction{}, + }, + actionRow{ // S8 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // "+" + nil, // "*" + shift(5), // "(" + nil, // ")" + shift(6), // int64 + }, + cdActions: []cdAction{}, + }, + actionRow{ // S9 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + shift(16), // "+" + nil, // "*" + nil, // "(" + shift(17), // ")" + nil, // int64 + }, + cdActions: []cdAction{}, + }, + actionRow{ // S10 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + reduce(3), // "+", reduce: Expr + shift(18), // "*" + nil, // "(" + reduce(3), // ")", reduce: Expr + nil, // int64 + }, + cdActions: []cdAction{}, + }, + actionRow{ // S11 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + reduce(5), // "+", reduce: Term + reduce(5), // "*", reduce: Term + nil, // "(" + reduce(5), // ")", reduce: Term + nil, // int64 + }, + cdActions: []cdAction{}, + }, + actionRow{ // S12 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // "+" + nil, // "*" + shift(12), // "(" + nil, // ")" + shift(13), // int64 + }, + cdActions: []cdAction{}, + }, + actionRow{ // S13 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + reduce(7), // "+", reduce: Factor + reduce(7), // "*", reduce: Factor + nil, // "(" + reduce(7), // ")", reduce: Factor + nil, // int64 + }, + cdActions: []cdAction{}, + }, + actionRow{ // S14 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(2), // Ω, reduce: Expr + reduce(2), // "+", reduce: Expr + shift(8), // "*" + nil, // "(" + nil, // ")" + nil, // int64 + }, + cdActions: []cdAction{}, + }, + actionRow{ // S15 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(4), // Ω, reduce: Term + reduce(4), // "+", reduce: Term + reduce(4), // "*", reduce: Term + nil, // "(" + nil, // ")" + nil, // int64 + }, + cdActions: []cdAction{}, + }, + actionRow{ // S16 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // "+" + nil, // "*" + shift(12), // "(" + nil, // ")" + shift(13), // int64 + }, + cdActions: []cdAction{}, + }, + actionRow{ // S17 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(6), // Ω, reduce: Factor + reduce(6), // "+", reduce: Factor + reduce(6), // "*", reduce: Factor + nil, // "(" + nil, // ")" + nil, // int64 + }, + cdActions: []cdAction{}, + }, + actionRow{ // S18 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // "+" + nil, // "*" + shift(12), // "(" + nil, // ")" + shift(13), // int64 + }, + cdActions: []cdAction{}, + }, + actionRow{ // S19 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + shift(16), // "+" + nil, // "*" + nil, // "(" + shift(22), // ")" + nil, // int64 + }, + cdActions: []cdAction{}, + }, + actionRow{ // S20 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + reduce(2), // "+", reduce: Expr + shift(18), // "*" + nil, // "(" + reduce(2), // ")", reduce: Expr + nil, // int64 + }, + cdActions: []cdAction{}, + }, + actionRow{ // S21 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + reduce(4), // "+", reduce: Term + reduce(4), // "*", reduce: Term + nil, // "(" + reduce(4), // ")", reduce: Term + nil, // int64 + }, + cdActions: []cdAction{}, + }, + actionRow{ // S22 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + reduce(6), // "+", reduce: Factor + reduce(6), // "*", reduce: Factor + nil, // "(" + reduce(6), // ")", reduce: Factor + nil, // int64 + }, + cdActions: []cdAction{}, + }, + }, +} diff --git a/example/calc/internal/parser/gototable.go b/example/calc/internal/parser/gototable.go new file mode 100644 index 00000000..518e496d --- /dev/null +++ b/example/calc/internal/parser/gototable.go @@ -0,0 +1,174 @@ +// Code generated by gocc; DO NOT EDIT. + +package parser + +const numNTSymbols = 5 + +type ( + gotoTable [numStates]gotoRow + gotoRow [numNTSymbols]int +) + +var gotoTab = gotoTable{ + gotoRow{ // S0 + -1, // Π + 1, // Π + 2, // Π + 3, // Π + 4, // Π + }, + gotoRow{ // S1 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S2 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S3 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S4 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S5 + -1, // Π + -1, // Π + 9, // Π + 10, // Π + 11, // Π + }, + gotoRow{ // S6 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S7 + -1, // Π + -1, // Π + -1, // Π + 14, // Π + 4, // Π + }, + gotoRow{ // S8 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + 15, // Π + }, + gotoRow{ // S9 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S10 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S11 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S12 + -1, // Π + -1, // Π + 19, // Π + 10, // Π + 11, // Π + }, + gotoRow{ // S13 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S14 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S15 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S16 + -1, // Π + -1, // Π + -1, // Π + 20, // Π + 11, // Π + }, + gotoRow{ // S17 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S18 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + 21, // Π + }, + gotoRow{ // S19 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S20 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S21 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S22 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, +} diff --git a/example/calc/internal/parser/parser.go b/example/calc/internal/parser/parser.go new file mode 100644 index 00000000..8491041e --- /dev/null +++ b/example/calc/internal/parser/parser.go @@ -0,0 +1,295 @@ +// Code generated by gocc; DO NOT EDIT. + +package parser + +import ( + "errors" + "fmt" + "strings" + + "github.com/maxcalandrelli/gocc/example/calc/iface" + parseError "github.com/maxcalandrelli/gocc/example/calc/internal/errors" + "github.com/maxcalandrelli/gocc/example/calc/internal/token" +) + +const ( + numProductions = 8 + numStates = 23 + numSymbols = 12 +) + +// Stack + +type stack struct { + state []int + attrib []Attrib +} + +const INITIAL_STACK_SIZE = 100 + +func newStack() *stack { + return &stack{ + state: make([]int, 0, INITIAL_STACK_SIZE), + attrib: make([]Attrib, 0, INITIAL_STACK_SIZE), + } +} + +func (s *stack) reset() { + s.state = s.state[:0] + s.attrib = s.attrib[:0] +} + +func (s *stack) push(state int, a Attrib) { + s.state = append(s.state, state) + s.attrib = append(s.attrib, a) +} + +func (s *stack) top() int { + return s.state[len(s.state)-1] +} + +func (s *stack) peek(pos int) int { + return s.state[pos] +} + +func (s *stack) topIndex() int { + return len(s.state) - 1 +} + +func (s *stack) popN(items int) []Attrib { + lo, hi := len(s.state)-items, len(s.state) + + attrib := s.attrib[lo:hi] + + s.state = s.state[:lo] + s.attrib = s.attrib[:lo] + + return attrib +} + +func (s *stack) String() string { + w := new(strings.Builder) + fmt.Fprintf(w, "stack:\n") + for i, st := range s.state { + fmt.Fprintf(w, "\t%d: %d , ", i, st) + if s.attrib[i] == nil { + fmt.Fprintf(w, "nil") + } else { + switch attr := s.attrib[i].(type) { + case *token.Token: + fmt.Fprintf(w, "%s", attr.Lit) + default: + fmt.Fprintf(w, "%v", attr) + } + } + fmt.Fprintf(w, "\n") + } + return w.String() +} + +// Parser + +type Parser struct { + stack *stack + nextToken *token.Token + userContext interface{} +} + +type TokenStream = iface.TokenStream + +func NewParser() *Parser { + return NewParserWithContext(nil) +} + +func NewParserWithContext(u interface{}) *Parser { + p := &Parser{stack: newStack(), userContext: u} + p.Reset() + return p +} + +func (p *Parser) Reset() { + p.stack.reset() + p.stack.push(0, nil) +} + +func (p *Parser) Error(err error, scanner iface.Scanner) (recovered bool, errorAttrib *parseError.Error) { + errorAttrib = &parseError.Error{ + Err: err, + ErrorToken: p.nextToken, + ErrorSymbols: p.popNonRecoveryStates(), + ExpectedTokens: make([]string, 0, 8), + } + for t, action := range parserActions.table[p.stack.top()].actions { + if action != nil { + errorAttrib.ExpectedTokens = append(errorAttrib.ExpectedTokens, token.TokMap.Id(token.Type(t))) + } + } + + if action := parserActions.table[p.stack.top()].actions[token.TokMap.Type("error")]; action != nil { + p.stack.push(int(action.(shift)), errorAttrib) // action can only be shift + } else { + return + } + + if action := parserActions.table[p.stack.top()].actions[p.nextToken.Type]; action != nil { + recovered = true + } + for !recovered && p.nextToken.Type != token.EOF { + p.nextToken = scanner.Scan() + if action := parserActions.table[p.stack.top()].actions[p.nextToken.Type]; action != nil { + recovered = true + } + } + + return +} + +func (p *Parser) popNonRecoveryStates() (removedAttribs []parseError.ErrorSymbol) { + if rs, ok := p.firstRecoveryState(); ok { + errorSymbols := p.stack.popN(p.stack.topIndex() - rs) + removedAttribs = make([]parseError.ErrorSymbol, len(errorSymbols)) + for i, e := range errorSymbols { + removedAttribs[i] = e + } + } else { + removedAttribs = []parseError.ErrorSymbol{} + } + return +} + +// recoveryState points to the highest state on the stack, which can recover +func (p *Parser) firstRecoveryState() (recoveryState int, canRecover bool) { + recoveryState, canRecover = p.stack.topIndex(), parserActions.table[p.stack.top()].canRecover + for recoveryState > 0 && !canRecover { + recoveryState-- + canRecover = parserActions.table[p.stack.peek(recoveryState)].canRecover + } + return +} + +func (p *Parser) newError(err error) error { + e := &parseError.Error{ + Err: err, + StackTop: p.stack.top(), + ErrorToken: p.nextToken, + } + actRow := parserActions.table[p.stack.top()] + for i, t := range actRow.actions { + if t != nil { + e.ExpectedTokens = append(e.ExpectedTokens, token.TokMap.Id(token.Type(i))) + } + } + return e +} + +func (p *Parser) Parse(scanner iface.Scanner) (res interface{}, err error, ptl int) { + return p.parse(scanner, false) +} + +func (p *Parser) ParseLongestPrefix(scanner iface.Scanner) (res interface{}, err error, ptl int) { + return p.parse(scanner, true) +} + +var errNotRepositionable = errors.New("scanner not repositionable") + +func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, err error, ptl int) { + var ( + tokens iface.CheckPointable + afterPos iface.CheckPoint + checkPoint iface.CheckPoint + ) + readNextToken := func() error { + if tokens == nil && (len(parserActions.table[p.stack.top()].cdActions) > 0 || longest) { + return errNotRepositionable + } + checkPoint = tokens.GetCheckPoint() + p.nextToken = scanner.Scan() + if longest { + afterPos = tokens.GetCheckPoint() + } + return nil + } + p.Reset() + tokens, _ = scanner.(iface.CheckPointable) + startCp := tokens.GetCheckPoint() + if err := readNextToken(); err != nil { + return nil, err, tokens.GetCheckPoint().DistanceFrom(startCp) + } + for acc := false; !acc; { + action := parserActions.table[p.stack.top()].actions[p.nextToken.Type] + if action == nil { + // + // If no action, check if we have some context dependent parsing to try + // + for _, cdAction := range parserActions.table[p.stack.top()].cdActions { + tokens.GotoCheckPoint(checkPoint) + cd_res, cd_err, cd_parsed := cdAction.tokenScanner(scanner.GetStream(), p.userContext) + if cd_err == nil && len(cd_parsed) > 0 { + action = parserActions.table[p.stack.top()].actions[cdAction.tokenIndex] + if action != nil { + p.nextToken.Foreign = true + p.nextToken.ForeignAstNode = cd_res + p.nextToken.Lit = cd_parsed + p.nextToken.Type = token.Type(cdAction.tokenIndex) + break + } + } + } + } + // + // Still no action? If a longest possible parsing is requested in place + // of a full text, we should try to check if an EOF here would have led + // to a successful parsing instead + // Rember that token.EOF is 1, that is the index of SyntaxEof into symbol table + // Dirty, dirty, dirty... but I found it as it is, and I prefer not to touch + // + if action == nil && longest { + tokens.GotoCheckPoint(checkPoint) + action = parserActions.table[p.stack.top()].actions[token.EOF] + if action == nil { + // + // ok, let's consume the token then + // + tokens.GotoCheckPoint(afterPos) + } + } + + // + // Well, no action is no action after all... + // + if action == nil { + if recovered, errAttrib := p.Error(nil, scanner); !recovered { + p.nextToken = errAttrib.ErrorToken + return nil, p.newError(nil), tokens.GetCheckPoint().DistanceFrom(startCp) + } + if action = parserActions.table[p.stack.top()].actions[p.nextToken.Type]; action == nil { + panic("Error recovery led to invalid action") + } + } + + switch act := action.(type) { + case accept: + res = p.stack.popN(1)[0] + acc = true + case shift: + p.stack.push(int(act), p.nextToken) + if p.nextToken.Foreign { + p.stack.push(int(act), p.nextToken.ForeignAstNode) + } + if err := readNextToken(); err != nil { + return nil, err, tokens.GetCheckPoint().DistanceFrom(startCp) + } + case reduce: + prod := productionsTable[int(act)] + attrib, err := prod.ReduceFunc(p.userContext, p.stack.popN(prod.NumSymbols)) + if err != nil { + return nil, p.newError(err), tokens.GetCheckPoint().DistanceFrom(startCp) + } else { + p.stack.push(gotoTab[p.stack.top()][prod.NTType], attrib) + } + default: + panic("unknown action: " + action.String()) + } + } + return res, nil, tokens.GetCheckPoint().DistanceFrom(startCp) +} diff --git a/example/calc/internal/parser/productionstable.go b/example/calc/internal/parser/productionstable.go new file mode 100644 index 00000000..0793b676 --- /dev/null +++ b/example/calc/internal/parser/productionstable.go @@ -0,0 +1,106 @@ +// Code generated by gocc; DO NOT EDIT. + +package parser + +import ( + "github.com/maxcalandrelli/gocc/example/calc/token" + "github.com/maxcalandrelli/gocc/example/calc/util" +) + +type ( + //TODO: change type and variable names to be consistent with other tables + ProdTab [numProductions]ProdTabEntry + ProdTabEntry struct { + String string + Id string + NTType int + Index int + NumSymbols int + ReduceFunc func(interface{}, []Attrib) (Attrib, error) + } + Attrib interface { + } +) + +var productionsTable = ProdTab{ + ProdTabEntry{ + String: `S' : Π << >>`, + Id: "S'", + NTType: 0, + Index: 0, + NumSymbols: 1, + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { + return X[0], nil + }, + }, + ProdTabEntry{ + String: `Calc : Π << >>`, + Id: "Calc", + NTType: 1, + Index: 1, + NumSymbols: 1, + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { + return X[0], nil + }, + }, + ProdTabEntry{ + String: `Expr : Π Λ<+> Π << X[0].(int64) + X[2].(int64), nil >>`, + Id: "Expr", + NTType: 2, + Index: 2, + NumSymbols: 3, + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { + return X[0].(int64) + X[2].(int64), nil + }, + }, + ProdTabEntry{ + String: `Expr : Π << >>`, + Id: "Expr", + NTType: 2, + Index: 3, + NumSymbols: 1, + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { + return X[0], nil + }, + }, + ProdTabEntry{ + String: `Term : Π Λ<*> Π << X[0].(int64) * X[2].(int64), nil >>`, + Id: "Term", + NTType: 3, + Index: 4, + NumSymbols: 3, + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { + return X[0].(int64) * X[2].(int64), nil + }, + }, + ProdTabEntry{ + String: `Term : Π << >>`, + Id: "Term", + NTType: 3, + Index: 5, + NumSymbols: 1, + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { + return X[0], nil + }, + }, + ProdTabEntry{ + String: `Factor : Λ<(> Π Λ<)> << X[1], nil >>`, + Id: "Factor", + NTType: 4, + Index: 6, + NumSymbols: 3, + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { + return X[1], nil + }, + }, + ProdTabEntry{ + String: `Factor : int64 << util.IntValue(X[0].(*token.Token).Lit) >>`, + Id: "Factor", + NTType: 4, + Index: 7, + NumSymbols: 1, + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { + return util.IntValue(X[0].(*token.Token).Lit) + }, + }, +} diff --git a/example/calc/internal/token/token.go b/example/calc/internal/token/token.go new file mode 100644 index 00000000..1554717a --- /dev/null +++ b/example/calc/internal/token/token.go @@ -0,0 +1,95 @@ +// Code generated by gocc; DO NOT EDIT. + +package token + +import ( + "fmt" +) + +type Token struct { + Type + Lit []byte + Pos + ForeignAstNode interface{} + Foreign bool +} + +type Type int + +const ( + INVALID Type = iota + EOF +) + +type Pos struct { + Offset int + Line int + Column int +} + +func (p Pos) String() string { + return fmt.Sprintf("Pos(offset=%d, line=%d, column=%d)", p.Offset, p.Line, p.Column) +} + +func (p Pos) StartingFrom(base Pos) Pos { + r := base + r.Offset += p.Offset + r.Line += p.Line + r.Column = p.Column + if p.Line > 0 && base.Line > 0 { + r.Line-- + } + if r.Column < 1 { + r.Column = 1 + } + return r +} + +type TokenMap struct { + typeMap []string + idMap map[string]Type +} + +func (m TokenMap) Id(tok Type) string { + if int(tok) < len(m.typeMap) { + return m.typeMap[tok] + } + return "unknown" +} + +func (m TokenMap) Type(tok string) Type { + if typ, exist := m.idMap[tok]; exist { + return typ + } + return INVALID +} + +func (m TokenMap) TokenString(tok *Token) string { + return fmt.Sprintf("%s(%d,<%s>)", m.Id(tok.Type), tok.Type, tok.Lit) +} + +func (m TokenMap) StringType(typ Type) string { + return fmt.Sprintf("%s(%d)", m.Id(typ), typ) +} + +var TokMap = TokenMap{ + typeMap: []string{ + "INVALID", + "Ω", + "Λ<+>", + "Λ<*>", + "Λ<(>", + "Λ<)>", + "int64", + }, + + idMap: map[string]Type{ + "INVALID": 0, + "Ω": 1, + "Λ<+>": 2, + "Λ<*>": 3, + "Λ<(>": 4, + "Λ<)>": 5, + "int64": 6, + }, +} diff --git a/example/calc/internal/util/litconv.go b/example/calc/internal/util/litconv.go new file mode 100644 index 00000000..1aeb6166 --- /dev/null +++ b/example/calc/internal/util/litconv.go @@ -0,0 +1,108 @@ +// Code generated by gocc; DO NOT EDIT. + +package util + +import ( + "fmt" + "strconv" + "unicode" + "unicode/utf8" +) + +/* Interface */ + +/* +Convert the literal value of a scanned token to rune +*/ +func RuneValue(lit []byte) rune { + if lit[1] == '\\' { + return escapeCharVal(lit) + } + r, size := utf8.DecodeRune(lit[1:]) + if size != len(lit)-2 { + panic(fmt.Sprintf("Error decoding rune. Lit: %s, rune: %d, size%d\n", lit, r, size)) + } + return r +} + +/* +Convert the literal value of a scanned token to int64 +*/ +func IntValue(lit []byte) (int64, error) { + return strconv.ParseInt(string(lit), 10, 64) +} + +/* +Convert the literal value of a scanned token to uint64 +*/ +func UintValue(lit []byte) (uint64, error) { + return strconv.ParseUint(string(lit), 10, 64) +} + +/* Util */ + +func escapeCharVal(lit []byte) rune { + var i, base, max uint32 + offset := 2 + switch lit[offset] { + case 'a': + return '\a' + case 'b': + return '\b' + case 'f': + return '\f' + case 'n': + return '\n' + case 'r': + return '\r' + case 't': + return '\t' + case 'v': + return '\v' + case '\\': + return '\\' + case '\'': + return '\'' + case '0', '1', '2', '3', '4', '5', '6', '7': + i, base, max = 3, 8, 255 + case 'x': + i, base, max = 2, 16, 255 + offset++ + case 'u': + i, base, max = 4, 16, unicode.MaxRune + offset++ + case 'U': + i, base, max = 8, 16, unicode.MaxRune + offset++ + default: + panic(fmt.Sprintf("Error decoding character literal: %s\n", lit)) + } + + var x uint32 + for ; i > 0 && offset < len(lit)-1; i-- { + ch, size := utf8.DecodeRune(lit[offset:]) + offset += size + d := uint32(digitVal(ch)) + if d >= base { + panic(fmt.Sprintf("charVal(%s): illegal character (%c) in escape sequence. size=%d, offset=%d", lit, ch, size, offset)) + } + x = x*base + d + } + if x > max || 0xD800 <= x && x < 0xE000 { + panic(fmt.Sprintf("Error decoding escape char value. Lit:%s, offset:%d, escape sequence is invalid Unicode code point\n", lit, offset)) + } + + return rune(x) +} + +func digitVal(ch rune) int { + switch { + case '0' <= ch && ch <= '9': + return int(ch) - '0' + case 'a' <= ch && ch <= 'f': + return int(ch) - 'a' + 10 + case 'A' <= ch && ch <= 'F': + return int(ch) - 'A' + 10 + } + return 16 // larger than any legal digit val +} diff --git a/example/calc/internal/util/rune.go b/example/calc/internal/util/rune.go new file mode 100644 index 00000000..bd8523a4 --- /dev/null +++ b/example/calc/internal/util/rune.go @@ -0,0 +1,39 @@ +// Code generated by gocc; DO NOT EDIT. + +package util + +import ( + "fmt" +) + +func RuneToString(r rune) string { + if r >= 0x20 && r < 0x7f { + return fmt.Sprintf("'%c'", r) + } + switch r { + case 0x07: + return "'\\a'" + case 0x08: + return "'\\b'" + case 0x0C: + return "'\\f'" + case 0x0A: + return "'\\n'" + case 0x0D: + return "'\\r'" + case 0x09: + return "'\\t'" + case 0x0b: + return "'\\v'" + case 0x5c: + return "'\\\\\\'" + case 0x27: + return "'\\''" + case 0x22: + return "'\\\"'" + } + if r < 0x10000 { + return fmt.Sprintf("\\u%04x", r) + } + return fmt.Sprintf("\\U%08x", r) +} diff --git a/example/calc/main/main.go b/example/calc/main/main.go new file mode 100644 index 00000000..1d135453 --- /dev/null +++ b/example/calc/main/main.go @@ -0,0 +1,53 @@ +package main + +import ( + "flag" + "fmt" + "os" + "strings" + + calc "github.com/maxcalandrelli/gocc/example/calc" +) + +func showResult(r interface{}, e error, l int) { + if e != nil { + fmt.Fprintf(os.Stderr, "parsing returned the following error: %s\n", e.Error()) + } else { + fmt.Printf("r=%#v, %d bytes\n", r, l) + } +} + +var ( + File string + Text string + Longest bool +) + +func parse(longest bool, lex *calc.Lexer) (res interface{}, err error, ptl int) { + if longest { + return calc.NewParser().ParseLongestPrefix(lex) + } else { + return calc.NewParser().Parse(lex) + } + return +} + +func main() { + flag.StringVar(&File, "file", "", "parse also text in file") + flag.StringVar(&Text, "text", "", "parse also text given with flag") + flag.BoolVar(&Longest, "longest", false, "parse longest possible part") + flag.Parse() + if Text > "" { + showResult(parse(Longest, calc.NewLexerString(Text))) + } + if File > "" { + l, e := calc.NewLexerFile(File) + if e != nil { + panic(e) + } + showResult(parse(Longest, l)) + } + if str := strings.Join(flag.Args(), " "); str > "" { + showResult(parse(Longest, calc.NewLexerString(str))) + } +} diff --git a/example/calc/parser/productionstable.go b/example/calc/parser/productionstable.go index e3d38815..958958d3 100644 --- a/example/calc/parser/productionstable.go +++ b/example/calc/parser/productionstable.go @@ -2,7 +2,7 @@ package parser -import ( +import( "github.com/maxcalandrelli/gocc/example/calc/token" "github.com/maxcalandrelli/gocc/example/calc/util" ) diff --git a/example/ctx/ctx.go b/example/ctx/ctx.go new file mode 100644 index 00000000..9df8ed71 --- /dev/null +++ b/example/ctx/ctx.go @@ -0,0 +1,62 @@ +// Code generated by gocc; DO NOT EDIT. + +package ctx + +import ( + "io" + + "github.com/maxcalandrelli/gocc/example/ctx/iface" + "github.com/maxcalandrelli/gocc/example/ctx/internal/io/stream" + "github.com/maxcalandrelli/gocc/example/ctx/internal/lexer" + "github.com/maxcalandrelli/gocc/example/ctx/internal/parser" + "github.com/maxcalandrelli/gocc/example/ctx/internal/token" +) + +type ( + Token = token.Token + Lexer = lexer.Lexer + Parser = parser.Parser + TokenStream = iface.TokenStream + WindowReader = stream.WindowReader + Scanner = iface.Scanner +) + +func ParseFile(fpath string) (interface{}, error, int) { + if lexer, err := NewLexerFile(fpath); err == nil { + return NewParser().Parse(lexer) + } else { + return nil, err, 0 + } +} + +func ParseText(text string) (interface{}, error, int) { + return NewParser().Parse(NewLexerBytes([]byte(text))) +} + +func NewLexerBytes(src []byte) *lexer.Lexer { + return lexer.NewLexerBytes(src) +} + +func NewLexerString(src string) *lexer.Lexer { + return lexer.NewLexerBytes([]byte(src)) +} + +func NewLexerFile(fpath string) (*lexer.Lexer, error) { + return lexer.NewLexerFile(fpath) +} + +func NewParser() *parser.Parser { + return parser.NewParser() +} + +func NewWindowReaderFromBytes(src []byte) WindowReader { + return stream.NewWindowReaderFromBytes(src) +} + +func NewWindowReader(rdr io.Reader) WindowReader { + return stream.NewWindowReader(rdr) +} + +func NewLimitedWindowReader(rdr io.Reader, sizeMin, sizeMax int) WindowReader { + return stream.NewLimitedWindowReader(rdr, sizeMin, sizeMax) +} diff --git a/example/ctx/errors/errors.go b/example/ctx/errors/errors.go index 5aad6b75..2813cd3b 100644 --- a/example/ctx/errors/errors.go +++ b/example/ctx/errors/errors.go @@ -6,7 +6,7 @@ import ( "fmt" "strings" - "github.com/maxcalandrelli/gocc/example/astx/token" + "github.com/maxcalandrelli/gocc/example/ctx/token" ) type ErrorSymbol interface { diff --git a/example/ctx/iface/iface.go b/example/ctx/iface/iface.go new file mode 100644 index 00000000..3d301025 --- /dev/null +++ b/example/ctx/iface/iface.go @@ -0,0 +1,30 @@ +// Code generated by gocc; DO NOT EDIT. + +package iface + +import ( + "github.com/maxcalandrelli/gocc/example/ctx/internal/token" + "io" +) + +type ( + Scanner interface { + Scan() (tok *token.Token) + GetStream() TokenStream + } + + CheckPoint interface { + DistanceFrom(CheckPoint) int + } + + CheckPointable interface { + GetCheckPoint() CheckPoint + GotoCheckPoint(CheckPoint) + } + + TokenStream interface { + io.Reader + io.RuneScanner + io.Seeker + } +) diff --git a/example/ctx/internal/errors/errors.go b/example/ctx/internal/errors/errors.go new file mode 100644 index 00000000..409cc47e --- /dev/null +++ b/example/ctx/internal/errors/errors.go @@ -0,0 +1,56 @@ +// Code generated by gocc; DO NOT EDIT. + +package errors + +import ( + "fmt" + "strings" + + "github.com/maxcalandrelli/gocc/example/ctx/internal/token" +) + +type ErrorSymbol interface { +} + +type Error struct { + Err error + ErrorToken *token.Token + ErrorSymbols []ErrorSymbol + ExpectedTokens []string + StackTop int +} + +func (e *Error) String() string { + w := new(strings.Builder) + fmt.Fprintf(w, "Error") + if e.Err != nil { + fmt.Fprintf(w, " %s\n", e.Err) + } else { + fmt.Fprintf(w, "\n") + } + fmt.Fprintf(w, "Token: type=%d, lit=%s\n", e.ErrorToken.Type, e.ErrorToken.Lit) + fmt.Fprintf(w, "Pos: offset=%d, line=%d, column=%d\n", e.ErrorToken.Pos.Offset, e.ErrorToken.Pos.Line, e.ErrorToken.Pos.Column) + fmt.Fprintf(w, "Expected one of: ") + for _, sym := range e.ExpectedTokens { + fmt.Fprintf(w, "%s ", sym) + } + fmt.Fprintf(w, "ErrorSymbol:\n") + for _, sym := range e.ErrorSymbols { + fmt.Fprintf(w, "%v\n", sym) + } + return w.String() +} + +func (e *Error) Error() string { + w := new(strings.Builder) + fmt.Fprintf(w, "Error in S%d: %s, %s", e.StackTop, token.TokMap.TokenString(e.ErrorToken), e.ErrorToken.Pos.String()) + if e.Err != nil { + fmt.Fprintf(w, ": %+v", e.Err) + } else { + fmt.Fprintf(w, ", expected one of: ") + for _, expected := range e.ExpectedTokens { + fmt.Fprintf(w, "%s ", expected) + } + } + return w.String() +} diff --git a/example/ctx/internal/io/stream/internal/stream_impl.go b/example/ctx/internal/io/stream/internal/stream_impl.go new file mode 100644 index 00000000..358aa160 --- /dev/null +++ b/example/ctx/internal/io/stream/internal/stream_impl.go @@ -0,0 +1,275 @@ +package internal + +import ( + "io" + "sync" + "unicode/utf8" +) + +type ( + impl_WindowReader struct { + bufferBlockSize int + maxBufferSize int + buffers [][]byte + available int + absbase int64 + position int + eof bool + rdr io.Reader + lock *sync.Mutex + } +) + +func (s *impl_WindowReader) lockReader() { + if s.lock != nil { + s.lock.Lock() + } +} + +func (s *impl_WindowReader) unlockReader() { + if s.lock != nil { + s.lock.Unlock() + } +} + +func (s *impl_WindowReader) seek(offset int64, whence int) (offs int64, err error) { + switch whence { + case io.SeekStart: + return s.seek(offset-s.ReadPosition(), io.SeekCurrent) + case io.SeekCurrent: + switch { + case offset == 0: + return s.ReadPosition(), nil + case offset < 0: + if -offset > int64(s.maxBackOffset()) { + err = io.ErrShortBuffer + } else { + s.advanceGet(int(offset)) + } + case offset > 0: + for offset > 0 && !s.eof { + available := s.Buffered() + if offset <= int64(available) { + s.advanceGet(int(offset)) + break + } + if available > 0 { + s.advanceGet(available) + offset -= int64(available) + } + read, _ := s.fetchBytes(int(offset)) + s.advanceGet(read) + offset -= int64(read) + } + if s.eof { + err = io.EOF + } + } + case io.SeekEnd: + for !s.eof { + s.seek(int64(s.MaxCap()), io.SeekCurrent) + } + s.seek(int64(s.Buffered()), io.SeekCurrent) + } + if s.eof && err == nil && s.Buffered() > 0 { + s.eof = false + } + return s.ReadPosition(), err +} + +func (s impl_WindowReader) maxBackOffset() int { + r := s.position + if s.absbase > 0 { + r = s.Cap() - s.Buffered() + } + return r +} + +func (s impl_WindowReader) bufferIndex(pos int) int { + if pos < 0 { + panic("negative position") + } + return pos / s.bufferBlockSize +} + +func (s impl_WindowReader) bufferBytes(pos int) []byte { + return s.buffers[s.bufferIndex(pos)] +} + +func (s impl_WindowReader) bufferByteRange(pos int, length int) []byte { + p := s.bufferOffset(pos) + return s.bufferBytes(pos)[p : p+length] +} + +func (s impl_WindowReader) bufferOffset(pos int) int { + return pos % s.bufferBlockSize +} + +func (s *impl_WindowReader) advanceGet(n int) { + sz := s.Cap() + switch { + case n < 0: + if -n > s.maxBackOffset() { + panic("underflow") + } + s.position += n + if s.position < 0 { + s.position += sz + s.absbase -= int64(sz) + } + case n > 0: + if n > s.Buffered() { + panic("overflow") + } + s.position += n + if s.position >= sz { + s.position -= sz + s.absbase += int64(sz) + } + } + s.available -= n +} + +func (s *impl_WindowReader) copy(to []byte, length int) { + for offs, cp := 0, 0; length > 0; length -= cp { + s.position %= s.MaxCap() + p := s.bufferOffset(s.position) + b := s.bufferBytes(s.position) + r := s.bufferBlockSize - p + if length <= r { + cp = copy(to[offs:], b[p:p+length]) + } else { + cp = copy(to[offs:], b[p:]) + } + s.advanceGet(cp) + offs += cp + } +} + +func (s *impl_WindowReader) fetchBytes(n int) (read int, err error) { + if s.rdr == nil { + s.eof = true + return 0, io.EOF + } + for n > 0 && s.Buffered() < s.MaxCap() && err == nil { + readNow := n + putpos := s.position + s.available + r := s.bufferBlockSize - s.bufferOffset(putpos) + if readNow > r { + readNow = r + } + for s.bufferIndex(putpos) >= len(s.buffers) && s.Cap() < s.MaxCap() { + s.buffers = append(s.buffers, make([]byte, s.bufferBlockSize)) + } + putpos %= s.MaxCap() + offs := s.bufferOffset(putpos) + if r, err = s.rdr.Read(s.bufferBytes(putpos)[offs : offs+readNow]); r > 0 { + s.available += r + read += r + n -= r + } + } + if n > 0 && err == nil { + err = io.ErrShortBuffer + } + return +} + +func (s *impl_WindowReader) read(p []byte) (read int, err error) { + if s.eof { + return 0, io.EOF + } + for read < len(p) && err == nil { + available := s.Buffered() + if len(p)-read <= available { + s.copy(p[read:], len(p)-read) + read = len(p) + } else { + if available == 0 { + available, err = s.fetchBytes(len(p) - read) + } + s.copy(p[read:], available) + read += available + switch err { + case io.ErrShortBuffer: + err = nil + case io.EOF: + s.eof = true + } + } + } + return +} + +func (s impl_WindowReader) peekByte() (byte, error) { + if s.Buffered() < 1 { + return 0, io.ErrShortBuffer + } + return s.bufferBytes(s.position)[s.bufferOffset(s.position)], nil +} + +func (s *impl_WindowReader) unreadByte() error { + _, e := s.seek(-1, io.SeekCurrent) + return e +} + +func (s *impl_WindowReader) readRune() (r rune, size int, err error) { + for i := 1; err == nil && i <= 4; i++ { + if s.Buffered() < i { + if _, err = s.fetchBytes(i); err != nil { + return + } + } + t := s.bufferByteRange(s.position, i) + if r, size = utf8.DecodeRune(t); r != utf8.RuneError { + s.advanceGet(size) + return + } + } + return utf8.RuneError, 0, err +} + +func (s *impl_WindowReader) unreadRune() (err error) { + tmps := *s + tmpb := []byte{} + for { + if _, err = tmps.seek(-1, io.SeekCurrent); err == nil { + b, _ := tmps.peekByte() + tmpb = append([]byte{b}, tmpb...) + switch len(tmpb) { + case 1: + if (tmpb[0] & 0xC0) == 0x80 { + continue + } + _, err = s.seek(-int64(len(tmpb)), io.SeekCurrent) + return + case 2: + if (tmpb[0] & 0xC0) == 0x80 { + continue + } + if (tmpb[0] & 0xE0) != 0xC0 { + break + } + _, err = s.seek(-int64(len(tmpb)), io.SeekCurrent) + return + case 3: + if (tmpb[0] & 0xC0) == 0x80 { + continue + } + if (tmpb[0] & 0xF0) != 0xE0 { + break + } + _, err = s.seek(-int64(len(tmpb)), io.SeekCurrent) + return + case 4: + if (tmpb[0] & 0xF8) != 0xF0 { + break + } + _, err = s.seek(-int64(len(tmpb)), io.SeekCurrent) + return + } + } + } + _, err = s.seek(-1, io.SeekCurrent) + return +} diff --git a/example/ctx/internal/io/stream/internal/stream_public.go b/example/ctx/internal/io/stream/internal/stream_public.go new file mode 100644 index 00000000..20ed7b5e --- /dev/null +++ b/example/ctx/internal/io/stream/internal/stream_public.go @@ -0,0 +1,101 @@ +package internal + +import ( + "io" +) + +func NewWindowReader(buf []byte, underlyingReader io.Reader, blksize, smax int, InfoPrefixRoundUp bool) *impl_WindowReader { + if blksize < 0 || smax < blksize { + panic("illegal buffer size") + } + r := &impl_WindowReader{rdr: underlyingReader} + r.bufferBlockSize = blksize + if underlyingReader != nil { + if blksize <= 0 { + r.bufferBlockSize = 1 << 10 + } else if InfoPrefixRoundUp { + for r.bufferBlockSize = 1; blksize > 0; r.bufferBlockSize = r.bufferBlockSize << 1 { + blksize = blksize >> 1 + } + } + if smax > 0 { + r.maxBufferSize = ((smax-1)/r.bufferBlockSize + 1) * r.bufferBlockSize + } + r.buffers = [][]byte{} + } else { + r.buffers = [][]byte{buf} + r.available = len(buf) + r.bufferBlockSize = r.available + r.maxBufferSize = r.available + } + return r +} + +func (s impl_WindowReader) Cap() int { + return len(s.buffers) * s.bufferBlockSize +} + +func (s impl_WindowReader) BlockSize() int { + return s.bufferBlockSize +} + +func (s impl_WindowReader) MaxCap() int { + if s.maxBufferSize > 0 { + return s.maxBufferSize + } + return 1 << 31 +} + +func (s impl_WindowReader) MaxUnreadSize() int { + return s.maxBackOffset() +} + +func (s impl_WindowReader) Buffered() int { + return s.available +} + +func (s impl_WindowReader) ReadPosition() int64 { + return s.absbase + int64(s.position) +} + +func (s *impl_WindowReader) Read(p []byte) (read int, err error) { + s.lockReader() + defer func() { s.unlockReader() }() + return s.read(p) +} + +func (s *impl_WindowReader) Seek(offset int64, whence int) (offs int64, err error) { + s.lockReader() + defer func() { s.unlockReader() }() + return s.seek(offset, whence) +} + +func (s *impl_WindowReader) ReadByte() (byte, error) { + b := []byte{0} + _, err := s.Read(b) + return b[0], err +} + +func (s *impl_WindowReader) PeekByte() (byte, error) { + s.lockReader() + defer func() { s.unlockReader() }() + return s.peekByte() +} + +func (s *impl_WindowReader) UnreadByte() error { + s.lockReader() + defer func() { s.unlockReader() }() + return s.unreadByte() +} + +func (s *impl_WindowReader) ReadRune() (r rune, size int, err error) { + s.lockReader() + defer func() { s.unlockReader() }() + return s.readRune() +} + +func (s *impl_WindowReader) UnreadRune() (err error) { + s.lockReader() + defer func() { s.unlockReader() }() + return s.unreadRune() +} diff --git a/example/ctx/internal/io/stream/stream.go b/example/ctx/internal/io/stream/stream.go new file mode 100644 index 00000000..cbaa8749 --- /dev/null +++ b/example/ctx/internal/io/stream/stream.go @@ -0,0 +1,39 @@ +package stream + +import ( + internal "github.com/maxcalandrelli/gocc/example/ctx/internal/io/stream/internal" + "io" +) + +type ( + WindowReader interface { + BlockSize() int + Buffered() int + Cap() int + MaxCap() int + Read([]byte) (int, error) + ReadByte() (byte, error) + ReadPosition() int64 + ReadRune() (rune, int, error) + Seek(int64, int) (int64, error) + UnreadByte() error + UnreadRune() error + MaxUnreadSize() int + } +) + +var ( + InfoPrefixRoundUp = false +) + +func NewWindowReaderFromBytes(src []byte) WindowReader { + return internal.NewWindowReader(src, nil, 0, 0, InfoPrefixRoundUp) +} + +func NewWindowReader(rdr io.Reader) WindowReader { + return internal.NewWindowReader(nil, rdr, 0, 0, false) +} + +func NewLimitedWindowReader(rdr io.Reader, sizeMin, sizeMax int) WindowReader { + return internal.NewWindowReader(nil, rdr, sizeMin, sizeMax, InfoPrefixRoundUp) +} diff --git a/example/ctx/internal/lexer/acttab.go b/example/ctx/internal/lexer/acttab.go new file mode 100644 index 00000000..c9966aa5 --- /dev/null +++ b/example/ctx/internal/lexer/acttab.go @@ -0,0 +1,67 @@ +// Code generated by gocc; DO NOT EDIT. + +package lexer + +import ( + "fmt" + + "github.com/maxcalandrelli/gocc/example/ctx/internal/token" +) + +type ActionTable [NumStates]ActionRow + +type ActionRow struct { + Accept token.Type + Ignore string +} + +func (a ActionRow) String() string { + return fmt.Sprintf("Accept=%d, Ignore=%s", a.Accept, a.Ignore) +} + +var ActTab = ActionTable{ + ActionRow{ // S0, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S1, Ignore("!whitespace") + Accept: -1, + Ignore: "!whitespace", + }, + ActionRow{ // S2, Accept("id") + Accept: 2, + Ignore: "", + }, + ActionRow{ // S3, Accept("id") + Accept: 2, + Ignore: "", + }, + ActionRow{ // S4, Accept("id") + Accept: 2, + Ignore: "", + }, + ActionRow{ // S5, Accept("id") + Accept: 2, + Ignore: "", + }, + ActionRow{ // S6, Accept("id") + Accept: 2, + Ignore: "", + }, + ActionRow{ // S7, Accept("id") + Accept: 2, + Ignore: "", + }, + ActionRow{ // S8, Accept("id") + Accept: 2, + Ignore: "", + }, + ActionRow{ // S9, Accept("id") + Accept: 2, + Ignore: "", + }, + ActionRow{ // S10, Accept("Λ") + Accept: 3, + Ignore: "", + }, +} diff --git a/example/ctx/internal/lexer/lexer.go b/example/ctx/internal/lexer/lexer.go new file mode 100644 index 00000000..f6c53a0f --- /dev/null +++ b/example/ctx/internal/lexer/lexer.go @@ -0,0 +1,153 @@ +// Code generated by gocc; DO NOT EDIT. + +package lexer + +import ( + + "io" + "bytes" + "os" + + + "github.com/maxcalandrelli/gocc/example/ctx/iface" + "github.com/maxcalandrelli/gocc/example/ctx/internal/token" + "github.com/maxcalandrelli/gocc/example/ctx/internal/io/stream" +) + +const ( + NoState = -1 + NumStates = 11 + NumSymbols = 14 + INVALID_RUNE = rune(-1) +) + +type position struct { + token.Pos +} + +type Lexer struct { + position + stream iface.TokenStream + eof bool +} + +func NewLexerBytes(src []byte) *Lexer { + lexer := &Lexer{stream: bytes.NewReader(src)} + lexer.reset() + return lexer +} + +func NewLexerFile(fpath string) (*Lexer, error) { + s, err := os.Open(fpath) + if err != nil { + return nil, err + } + lexer := &Lexer{stream: stream.NewWindowReader(s)} + lexer.reset() + return lexer, nil +} + +func NewLexer(reader io.Reader) (*Lexer, error) { + lexer := &Lexer{} + lexer.reset() + if lexer.stream, _ = reader.(iface.TokenStream); lexer.stream == nil { + lexer.stream = stream.NewWindowReader(reader) + } + return lexer, nil +} + +func (l *Lexer) reset () { + l.position.Reset() +} + +func (l Lexer) GetStream() iface.TokenStream { + return l.stream +} + +type checkPoint int64 + +func (c checkPoint) DistanceFrom (o iface.CheckPoint) int { + return int (c - o.(checkPoint)) +} + +func (l Lexer) GetCheckPoint() iface.CheckPoint { + pos, _ := l.stream.Seek(0, io.SeekCurrent) + return checkPoint(pos) +} + +func (l Lexer) GotoCheckPoint(cp iface.CheckPoint) { + l.stream.Seek(int64(cp.(checkPoint)), io.SeekStart) +} + +func (l *Lexer) Scan() (tok *token.Token) { + tok = new(token.Token) + tok.Type = token.INVALID + tok.Lit = []byte{} + start := l.position + state := 0 + for state != -1 { + curr, size, err := l.stream.ReadRune() + if size < 1 || err != nil { + curr = INVALID_RUNE + } + if size > 0 { + l.position.Pos.Offset += size + } + nextState := -1 + if curr != INVALID_RUNE { + nextState = TransTab[state](curr) + } + state = nextState + if state != -1 { + switch curr { + case '\n': + l.position.Pos.Line++ + l.position.Pos.Column = 1 + case '\r': + l.position.Pos.Column = 1 + case '\t': + l.position.Pos.Column += 4 + default: + l.position.Pos.Column++ + } + switch { + case ActTab[state].Accept != -1: + tok.Type = ActTab[state].Accept + tok.Lit = append(tok.Lit, string(curr)...) + case ActTab[state].Ignore != "": + start = l.position + state = 0 + tok.Lit = []byte{} + } + } else if curr != INVALID_RUNE { + l.stream.UnreadRune() + } + if err == io.EOF && len(tok.Lit)==0 { + tok.Type = token.EOF + tok.Pos = start.Pos + return + } + } + tok.Pos = start.Pos + return +} + +func (l *Lexer) Reset() { + l.position.Reset() +} + +func (l Lexer) CurrentPosition() position { + return l.position +} + +func (p *position) Reset() { + p.Offset = 0 + p.Line = 1 + p.Column = 1 +} + +func (p position) StartingFrom(base position) position { + r := p + r.Pos = p.Pos.StartingFrom(base.Pos) + return r +} diff --git a/example/ctx/internal/lexer/transitiontable.go b/example/ctx/internal/lexer/transitiontable.go new file mode 100644 index 00000000..ae790a2c --- /dev/null +++ b/example/ctx/internal/lexer/transitiontable.go @@ -0,0 +1,179 @@ +// Code generated by gocc; DO NOT EDIT. + +package lexer + +/* +Let s be the current state +Let r be the current input rune +transitionTable[s](r) returns the next state. +*/ +type TransitionTable [NumStates]func(rune) int + +var TransTab = TransitionTable{ + // S0 + func(r rune) int { + switch { + case r == 9: // ['\t','\t'] + return 1 + case r == 10: // ['\n','\n'] + return 1 + case r == 13: // ['\r','\r'] + return 1 + case r == 32: // [' ',' '] + return 1 + case 65 <= r && r <= 90: // ['A','Z'] + return 2 + case r == 95: // ['_','_'] + return 3 + case 97 <= r && r <= 98: // ['a','b'] + return 2 + case r == 99: // ['c','c'] + return 4 + case 100 <= r && r <= 122: // ['d','z'] + return 2 + } + return NoState + }, + // S1 + func(r rune) int { + switch { + } + return NoState + }, + // S2 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 5 + case 65 <= r && r <= 90: // ['A','Z'] + return 6 + case r == 95: // ['_','_'] + return 7 + case 97 <= r && r <= 122: // ['a','z'] + return 6 + } + return NoState + }, + // S3 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 5 + case 65 <= r && r <= 90: // ['A','Z'] + return 6 + case r == 95: // ['_','_'] + return 7 + case 97 <= r && r <= 122: // ['a','z'] + return 6 + } + return NoState + }, + // S4 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 5 + case 65 <= r && r <= 90: // ['A','Z'] + return 6 + case r == 95: // ['_','_'] + return 7 + case r == 97: // ['a','a'] + return 8 + case 98 <= r && r <= 122: // ['b','z'] + return 6 + } + return NoState + }, + // S5 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 5 + case 65 <= r && r <= 90: // ['A','Z'] + return 6 + case r == 95: // ['_','_'] + return 7 + case 97 <= r && r <= 122: // ['a','z'] + return 6 + } + return NoState + }, + // S6 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 5 + case 65 <= r && r <= 90: // ['A','Z'] + return 6 + case r == 95: // ['_','_'] + return 7 + case 97 <= r && r <= 122: // ['a','z'] + return 6 + } + return NoState + }, + // S7 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 5 + case 65 <= r && r <= 90: // ['A','Z'] + return 6 + case r == 95: // ['_','_'] + return 7 + case 97 <= r && r <= 122: // ['a','z'] + return 6 + } + return NoState + }, + // S8 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 5 + case 65 <= r && r <= 90: // ['A','Z'] + return 6 + case r == 95: // ['_','_'] + return 7 + case 97 <= r && r <= 107: // ['a','k'] + return 6 + case r == 108: // ['l','l'] + return 9 + case 109 <= r && r <= 122: // ['m','z'] + return 6 + } + return NoState + }, + // S9 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 5 + case 65 <= r && r <= 90: // ['A','Z'] + return 6 + case r == 95: // ['_','_'] + return 7 + case 97 <= r && r <= 98: // ['a','b'] + return 6 + case r == 99: // ['c','c'] + return 10 + case 100 <= r && r <= 122: // ['d','z'] + return 6 + } + return NoState + }, + // S10 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 5 + case 65 <= r && r <= 90: // ['A','Z'] + return 6 + case r == 95: // ['_','_'] + return 7 + case 97 <= r && r <= 122: // ['a','z'] + return 6 + } + return NoState + }, +} diff --git a/example/ctx/internal/parser/action.go b/example/ctx/internal/parser/action.go new file mode 100644 index 00000000..54bc55e9 --- /dev/null +++ b/example/ctx/internal/parser/action.go @@ -0,0 +1,51 @@ +// Code generated by gocc; DO NOT EDIT. + +package parser + +import ( + "fmt" +) + +type action interface { + act() + String() string +} + +type ( + accept bool + shift int // value is next state index + reduce int // value is production index +) + +func (this accept) act() {} +func (this shift) act() {} +func (this reduce) act() {} + +func (this accept) Equal(that action) bool { + if _, ok := that.(accept); ok { + return true + } + return false +} + +func (this reduce) Equal(that action) bool { + that1, ok := that.(reduce) + if !ok { + return false + } + return this == that1 +} + +func (this shift) Equal(that action) bool { + that1, ok := that.(shift) + if !ok { + return false + } + return this == that1 +} + +func (this accept) String() string { return "accept(0)" } +func (this shift) String() string { return fmt.Sprintf("shift:%d", this) } +func (this reduce) String() string { + return fmt.Sprintf("reduce:%d(%s)", this, productionsTable[this].String) +} diff --git a/example/ctx/internal/parser/actiontable.go b/example/ctx/internal/parser/actiontable.go new file mode 100644 index 00000000..19187713 --- /dev/null +++ b/example/ctx/internal/parser/actiontable.go @@ -0,0 +1,85 @@ +// Code generated by gocc; DO NOT EDIT. + +package parser + +type ( + actionTable [numStates]actionRow + cdFunc func(TokenStream, interface{}) (interface{}, error, []byte) + cdAction struct { + tokenIndex int + tokenScanner cdFunc + } + actionRow struct { + canRecover bool + actions [numSymbols]action + cdActions []cdAction + } + actions struct { + table actionTable + } +) + +var parserActions = actions{ + table: actionTable{ + actionRow{ // S0 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + shift(3), // id + shift(4), // "calc" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S1 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + accept(true), // Ω + shift(3), // id + shift(4), // "calc" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S2 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(1), // Ω, reduce: StmtList + reduce(1), // id, reduce: StmtList + reduce(1), // "calc", reduce: StmtList + }, + cdActions: []cdAction{}, + }, + actionRow{ // S3 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(3), // Ω, reduce: Stmt + reduce(3), // id, reduce: Stmt + reduce(3), // "calc", reduce: Stmt + }, + cdActions: []cdAction{}, + }, + actionRow{ // S4 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(4), // Ω, reduce: Stmt + reduce(4), // id, reduce: Stmt + reduce(4), // "calc", reduce: Stmt + }, + cdActions: []cdAction{}, + }, + actionRow{ // S5 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(2), // Ω, reduce: StmtList + reduce(2), // id, reduce: StmtList + reduce(2), // "calc", reduce: StmtList + }, + cdActions: []cdAction{}, + }, + }, +} diff --git a/example/ctx/internal/parser/gototable.go b/example/ctx/internal/parser/gototable.go new file mode 100644 index 00000000..443ec029 --- /dev/null +++ b/example/ctx/internal/parser/gototable.go @@ -0,0 +1,43 @@ +// Code generated by gocc; DO NOT EDIT. + +package parser + +const numNTSymbols = 3 + +type ( + gotoTable [numStates]gotoRow + gotoRow [numNTSymbols]int +) + +var gotoTab = gotoTable{ + gotoRow{ // S0 + -1, // Π + 1, // Π + 2, // Π + }, + gotoRow{ // S1 + -1, // Π + -1, // Π + 5, // Π + }, + gotoRow{ // S2 + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S3 + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S4 + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S5 + -1, // Π + -1, // Π + -1, // Π + }, +} diff --git a/example/ctx/internal/parser/parser.go b/example/ctx/internal/parser/parser.go new file mode 100644 index 00000000..4c5da4db --- /dev/null +++ b/example/ctx/internal/parser/parser.go @@ -0,0 +1,295 @@ +// Code generated by gocc; DO NOT EDIT. + +package parser + +import ( + "errors" + "fmt" + "strings" + + "github.com/maxcalandrelli/gocc/example/ctx/iface" + parseError "github.com/maxcalandrelli/gocc/example/ctx/internal/errors" + "github.com/maxcalandrelli/gocc/example/ctx/internal/token" +) + +const ( + numProductions = 5 + numStates = 6 + numSymbols = 7 +) + +// Stack + +type stack struct { + state []int + attrib []Attrib +} + +const INITIAL_STACK_SIZE = 100 + +func newStack() *stack { + return &stack{ + state: make([]int, 0, INITIAL_STACK_SIZE), + attrib: make([]Attrib, 0, INITIAL_STACK_SIZE), + } +} + +func (s *stack) reset() { + s.state = s.state[:0] + s.attrib = s.attrib[:0] +} + +func (s *stack) push(state int, a Attrib) { + s.state = append(s.state, state) + s.attrib = append(s.attrib, a) +} + +func (s *stack) top() int { + return s.state[len(s.state)-1] +} + +func (s *stack) peek(pos int) int { + return s.state[pos] +} + +func (s *stack) topIndex() int { + return len(s.state) - 1 +} + +func (s *stack) popN(items int) []Attrib { + lo, hi := len(s.state)-items, len(s.state) + + attrib := s.attrib[lo:hi] + + s.state = s.state[:lo] + s.attrib = s.attrib[:lo] + + return attrib +} + +func (s *stack) String() string { + w := new(strings.Builder) + fmt.Fprintf(w, "stack:\n") + for i, st := range s.state { + fmt.Fprintf(w, "\t%d: %d , ", i, st) + if s.attrib[i] == nil { + fmt.Fprintf(w, "nil") + } else { + switch attr := s.attrib[i].(type) { + case *token.Token: + fmt.Fprintf(w, "%s", attr.Lit) + default: + fmt.Fprintf(w, "%v", attr) + } + } + fmt.Fprintf(w, "\n") + } + return w.String() +} + +// Parser + +type Parser struct { + stack *stack + nextToken *token.Token + userContext interface{} +} + +type TokenStream = iface.TokenStream + +func NewParser() *Parser { + return NewParserWithContext(nil) +} + +func NewParserWithContext(u interface{}) *Parser { + p := &Parser{stack: newStack(), userContext: u} + p.Reset() + return p +} + +func (p *Parser) Reset() { + p.stack.reset() + p.stack.push(0, nil) +} + +func (p *Parser) Error(err error, scanner iface.Scanner) (recovered bool, errorAttrib *parseError.Error) { + errorAttrib = &parseError.Error{ + Err: err, + ErrorToken: p.nextToken, + ErrorSymbols: p.popNonRecoveryStates(), + ExpectedTokens: make([]string, 0, 8), + } + for t, action := range parserActions.table[p.stack.top()].actions { + if action != nil { + errorAttrib.ExpectedTokens = append(errorAttrib.ExpectedTokens, token.TokMap.Id(token.Type(t))) + } + } + + if action := parserActions.table[p.stack.top()].actions[token.TokMap.Type("error")]; action != nil { + p.stack.push(int(action.(shift)), errorAttrib) // action can only be shift + } else { + return + } + + if action := parserActions.table[p.stack.top()].actions[p.nextToken.Type]; action != nil { + recovered = true + } + for !recovered && p.nextToken.Type != token.EOF { + p.nextToken = scanner.Scan() + if action := parserActions.table[p.stack.top()].actions[p.nextToken.Type]; action != nil { + recovered = true + } + } + + return +} + +func (p *Parser) popNonRecoveryStates() (removedAttribs []parseError.ErrorSymbol) { + if rs, ok := p.firstRecoveryState(); ok { + errorSymbols := p.stack.popN(p.stack.topIndex() - rs) + removedAttribs = make([]parseError.ErrorSymbol, len(errorSymbols)) + for i, e := range errorSymbols { + removedAttribs[i] = e + } + } else { + removedAttribs = []parseError.ErrorSymbol{} + } + return +} + +// recoveryState points to the highest state on the stack, which can recover +func (p *Parser) firstRecoveryState() (recoveryState int, canRecover bool) { + recoveryState, canRecover = p.stack.topIndex(), parserActions.table[p.stack.top()].canRecover + for recoveryState > 0 && !canRecover { + recoveryState-- + canRecover = parserActions.table[p.stack.peek(recoveryState)].canRecover + } + return +} + +func (p *Parser) newError(err error) error { + e := &parseError.Error{ + Err: err, + StackTop: p.stack.top(), + ErrorToken: p.nextToken, + } + actRow := parserActions.table[p.stack.top()] + for i, t := range actRow.actions { + if t != nil { + e.ExpectedTokens = append(e.ExpectedTokens, token.TokMap.Id(token.Type(i))) + } + } + return e +} + +func (p *Parser) Parse(scanner iface.Scanner) (res interface{}, err error, ptl int) { + return p.parse(scanner, false) +} + +func (p *Parser) ParseLongestPrefix(scanner iface.Scanner) (res interface{}, err error, ptl int) { + return p.parse(scanner, true) +} + +var errNotRepositionable = errors.New("scanner not repositionable") + +func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, err error, ptl int) { + var ( + tokens iface.CheckPointable + afterPos iface.CheckPoint + checkPoint iface.CheckPoint + ) + readNextToken := func() error { + if tokens == nil && (len(parserActions.table[p.stack.top()].cdActions) > 0 || longest) { + return errNotRepositionable + } + checkPoint = tokens.GetCheckPoint() + p.nextToken = scanner.Scan() + if longest { + afterPos = tokens.GetCheckPoint() + } + return nil + } + p.Reset() + tokens, _ = scanner.(iface.CheckPointable) + startCp := tokens.GetCheckPoint() + if err := readNextToken(); err != nil { + return nil, err, tokens.GetCheckPoint().DistanceFrom(startCp) + } + for acc := false; !acc; { + action := parserActions.table[p.stack.top()].actions[p.nextToken.Type] + if action == nil { + // + // If no action, check if we have some context dependent parsing to try + // + for _, cdAction := range parserActions.table[p.stack.top()].cdActions { + tokens.GotoCheckPoint(checkPoint) + cd_res, cd_err, cd_parsed := cdAction.tokenScanner(scanner.GetStream(), p.userContext) + if cd_err == nil && len(cd_parsed) > 0 { + action = parserActions.table[p.stack.top()].actions[cdAction.tokenIndex] + if action != nil { + p.nextToken.Foreign = true + p.nextToken.ForeignAstNode = cd_res + p.nextToken.Lit = cd_parsed + p.nextToken.Type = token.Type(cdAction.tokenIndex) + break + } + } + } + } + // + // Still no action? If a longest possible parsing is requested in place + // of a full text, we should try to check if an EOF here would have led + // to a successful parsing instead + // Rember that token.EOF is 1, that is the index of SyntaxEof into symbol table + // Dirty, dirty, dirty... but I found it as it is, and I prefer not to touch + // + if action == nil && longest { + tokens.GotoCheckPoint(checkPoint) + action = parserActions.table[p.stack.top()].actions[token.EOF] + if action == nil { + // + // ok, let's consume the token then + // + tokens.GotoCheckPoint(afterPos) + } + } + + // + // Well, no action is no action after all... + // + if action == nil { + if recovered, errAttrib := p.Error(nil, scanner); !recovered { + p.nextToken = errAttrib.ErrorToken + return nil, p.newError(nil), tokens.GetCheckPoint().DistanceFrom(startCp) + } + if action = parserActions.table[p.stack.top()].actions[p.nextToken.Type]; action == nil { + panic("Error recovery led to invalid action") + } + } + + switch act := action.(type) { + case accept: + res = p.stack.popN(1)[0] + acc = true + case shift: + p.stack.push(int(act), p.nextToken) + if p.nextToken.Foreign { + p.stack.push(int(act), p.nextToken.ForeignAstNode) + } + if err := readNextToken(); err != nil { + return nil, err, tokens.GetCheckPoint().DistanceFrom(startCp) + } + case reduce: + prod := productionsTable[int(act)] + attrib, err := prod.ReduceFunc(p.userContext, p.stack.popN(prod.NumSymbols)) + if err != nil { + return nil, p.newError(err), tokens.GetCheckPoint().DistanceFrom(startCp) + } else { + p.stack.push(gotoTab[p.stack.top()][prod.NTType], attrib) + } + default: + panic("unknown action: " + action.String()) + } + } + return res, nil, tokens.GetCheckPoint().DistanceFrom(startCp) +} diff --git a/example/ctx/internal/parser/productionstable.go b/example/ctx/internal/parser/productionstable.go new file mode 100644 index 00000000..6b7ed847 --- /dev/null +++ b/example/ctx/internal/parser/productionstable.go @@ -0,0 +1,75 @@ +// Code generated by gocc; DO NOT EDIT. + +package parser + +import ( + "github.com/maxcalandrelli/gocc/example/ctx/ast" +) + +type ( + //TODO: change type and variable names to be consistent with other tables + ProdTab [numProductions]ProdTabEntry + ProdTabEntry struct { + String string + Id string + NTType int + Index int + NumSymbols int + ReduceFunc func(interface{}, []Attrib) (Attrib, error) + } + Attrib interface { + } +) + +var productionsTable = ProdTab{ + ProdTabEntry{ + String: `S' : Π << >>`, + Id: "S'", + NTType: 0, + Index: 0, + NumSymbols: 1, + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { + return X[0], nil + }, + }, + ProdTabEntry{ + String: `StmtList : Π << ast.NewStmtList(X[0]) >>`, + Id: "StmtList", + NTType: 1, + Index: 1, + NumSymbols: 1, + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { + return ast.NewStmtList(X[0]) + }, + }, + ProdTabEntry{ + String: `StmtList : Π Π << ast.AppendStmt(X[0], X[1]) >>`, + Id: "StmtList", + NTType: 1, + Index: 2, + NumSymbols: 2, + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { + return ast.AppendStmt(X[0], X[1]) + }, + }, + ProdTabEntry{ + String: `Stmt : id << ast.NewStmt(X[0]) >>`, + Id: "Stmt", + NTType: 2, + Index: 3, + NumSymbols: 1, + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { + return ast.NewStmt(X[0]) + }, + }, + ProdTabEntry{ + String: `Stmt : Λ << ast.Calc(X[0]) >>`, + Id: "Stmt", + NTType: 2, + Index: 4, + NumSymbols: 1, + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { + return ast.Calc(X[0]) + }, + }, +} diff --git a/example/ctx/internal/token/token.go b/example/ctx/internal/token/token.go new file mode 100644 index 00000000..ff662bb5 --- /dev/null +++ b/example/ctx/internal/token/token.go @@ -0,0 +1,89 @@ +// Code generated by gocc; DO NOT EDIT. + +package token + +import ( + "fmt" +) + +type Token struct { + Type + Lit []byte + Pos + ForeignAstNode interface{} + Foreign bool +} + +type Type int + +const ( + INVALID Type = iota + EOF +) + +type Pos struct { + Offset int + Line int + Column int +} + +func (p Pos) String() string { + return fmt.Sprintf("Pos(offset=%d, line=%d, column=%d)", p.Offset, p.Line, p.Column) +} + +func (p Pos) StartingFrom(base Pos) Pos { + r := base + r.Offset += p.Offset + r.Line += p.Line + r.Column = p.Column + if p.Line > 0 && base.Line > 0 { + r.Line-- + } + if r.Column < 1 { + r.Column = 1 + } + return r +} + +type TokenMap struct { + typeMap []string + idMap map[string]Type +} + +func (m TokenMap) Id(tok Type) string { + if int(tok) < len(m.typeMap) { + return m.typeMap[tok] + } + return "unknown" +} + +func (m TokenMap) Type(tok string) Type { + if typ, exist := m.idMap[tok]; exist { + return typ + } + return INVALID +} + +func (m TokenMap) TokenString(tok *Token) string { + return fmt.Sprintf("%s(%d,<%s>)", m.Id(tok.Type), tok.Type, tok.Lit) +} + +func (m TokenMap) StringType(typ Type) string { + return fmt.Sprintf("%s(%d)", m.Id(typ), typ) +} + +var TokMap = TokenMap{ + typeMap: []string{ + "INVALID", + "Ω", + "id", + "Λ", + }, + + idMap: map[string]Type{ + "INVALID": 0, + "Ω": 1, + "id": 2, + "Λ": 3, + }, +} diff --git a/example/ctx/internal/util/litconv.go b/example/ctx/internal/util/litconv.go new file mode 100644 index 00000000..1aeb6166 --- /dev/null +++ b/example/ctx/internal/util/litconv.go @@ -0,0 +1,108 @@ +// Code generated by gocc; DO NOT EDIT. + +package util + +import ( + "fmt" + "strconv" + "unicode" + "unicode/utf8" +) + +/* Interface */ + +/* +Convert the literal value of a scanned token to rune +*/ +func RuneValue(lit []byte) rune { + if lit[1] == '\\' { + return escapeCharVal(lit) + } + r, size := utf8.DecodeRune(lit[1:]) + if size != len(lit)-2 { + panic(fmt.Sprintf("Error decoding rune. Lit: %s, rune: %d, size%d\n", lit, r, size)) + } + return r +} + +/* +Convert the literal value of a scanned token to int64 +*/ +func IntValue(lit []byte) (int64, error) { + return strconv.ParseInt(string(lit), 10, 64) +} + +/* +Convert the literal value of a scanned token to uint64 +*/ +func UintValue(lit []byte) (uint64, error) { + return strconv.ParseUint(string(lit), 10, 64) +} + +/* Util */ + +func escapeCharVal(lit []byte) rune { + var i, base, max uint32 + offset := 2 + switch lit[offset] { + case 'a': + return '\a' + case 'b': + return '\b' + case 'f': + return '\f' + case 'n': + return '\n' + case 'r': + return '\r' + case 't': + return '\t' + case 'v': + return '\v' + case '\\': + return '\\' + case '\'': + return '\'' + case '0', '1', '2', '3', '4', '5', '6', '7': + i, base, max = 3, 8, 255 + case 'x': + i, base, max = 2, 16, 255 + offset++ + case 'u': + i, base, max = 4, 16, unicode.MaxRune + offset++ + case 'U': + i, base, max = 8, 16, unicode.MaxRune + offset++ + default: + panic(fmt.Sprintf("Error decoding character literal: %s\n", lit)) + } + + var x uint32 + for ; i > 0 && offset < len(lit)-1; i-- { + ch, size := utf8.DecodeRune(lit[offset:]) + offset += size + d := uint32(digitVal(ch)) + if d >= base { + panic(fmt.Sprintf("charVal(%s): illegal character (%c) in escape sequence. size=%d, offset=%d", lit, ch, size, offset)) + } + x = x*base + d + } + if x > max || 0xD800 <= x && x < 0xE000 { + panic(fmt.Sprintf("Error decoding escape char value. Lit:%s, offset:%d, escape sequence is invalid Unicode code point\n", lit, offset)) + } + + return rune(x) +} + +func digitVal(ch rune) int { + switch { + case '0' <= ch && ch <= '9': + return int(ch) - '0' + case 'a' <= ch && ch <= 'f': + return int(ch) - 'a' + 10 + case 'A' <= ch && ch <= 'F': + return int(ch) - 'A' + 10 + } + return 16 // larger than any legal digit val +} diff --git a/example/ctx/internal/util/rune.go b/example/ctx/internal/util/rune.go new file mode 100644 index 00000000..bd8523a4 --- /dev/null +++ b/example/ctx/internal/util/rune.go @@ -0,0 +1,39 @@ +// Code generated by gocc; DO NOT EDIT. + +package util + +import ( + "fmt" +) + +func RuneToString(r rune) string { + if r >= 0x20 && r < 0x7f { + return fmt.Sprintf("'%c'", r) + } + switch r { + case 0x07: + return "'\\a'" + case 0x08: + return "'\\b'" + case 0x0C: + return "'\\f'" + case 0x0A: + return "'\\n'" + case 0x0D: + return "'\\r'" + case 0x09: + return "'\\t'" + case 0x0b: + return "'\\v'" + case 0x5c: + return "'\\\\\\'" + case 0x27: + return "'\\''" + case 0x22: + return "'\\\"'" + } + if r < 0x10000 { + return fmt.Sprintf("\\u%04x", r) + } + return fmt.Sprintf("\\U%08x", r) +} diff --git a/example/ctx/lexer/acttab.go b/example/ctx/lexer/acttab.go index c43f5d24..b5ae1a0f 100644 --- a/example/ctx/lexer/acttab.go +++ b/example/ctx/lexer/acttab.go @@ -5,7 +5,7 @@ package lexer import ( "fmt" - "github.com/maxcalandrelli/gocc/example/astx/token" + "github.com/maxcalandrelli/gocc/example/ctx/token" ) type ActionTable [NumStates]ActionRow @@ -48,4 +48,20 @@ var ActTab = ActionTable{ Accept: 2, Ignore: "", }, + ActionRow{ // S7 + Accept: 2, + Ignore: "", + }, + ActionRow{ // S8 + Accept: 2, + Ignore: "", + }, + ActionRow{ // S9 + Accept: 2, + Ignore: "", + }, + ActionRow{ // S10 + Accept: 3, + Ignore: "", + }, } diff --git a/example/ctx/lexer/lexer.go b/example/ctx/lexer/lexer.go index 41f924a0..b50c20d4 100644 --- a/example/ctx/lexer/lexer.go +++ b/example/ctx/lexer/lexer.go @@ -6,13 +6,13 @@ import ( "io/ioutil" "unicode/utf8" - "github.com/maxcalandrelli/gocc/example/astx/token" + "github.com/maxcalandrelli/gocc/example/ctx/token" ) const ( NoState = -1 - NumStates = 7 - NumSymbols = 10 + NumStates = 11 + NumSymbols = 14 ) type Lexer struct { @@ -114,13 +114,17 @@ func (l *Lexer) Reset() { /* Lexer symbols: 0: '_' -1: '_' -2: ' ' -3: '\t' -4: '\n' -5: '\r' -6: 'a'-'z' -7: 'A'-'Z' -8: '0'-'9' -9: . +1: 'c' +2: 'a' +3: 'l' +4: 'c' +5: '_' +6: ' ' +7: '\t' +8: '\n' +9: '\r' +10: 'a'-'z' +11: 'A'-'Z' +12: '0'-'9' +13: . */ diff --git a/example/ctx/lexer/transitiontable.go b/example/ctx/lexer/transitiontable.go index 50dd04da..ae790a2c 100644 --- a/example/ctx/lexer/transitiontable.go +++ b/example/ctx/lexer/transitiontable.go @@ -25,7 +25,11 @@ var TransTab = TransitionTable{ return 2 case r == 95: // ['_','_'] return 3 - case 97 <= r && r <= 122: // ['a','z'] + case 97 <= r && r <= 98: // ['a','b'] + return 2 + case r == 99: // ['c','c'] + return 4 + case 100 <= r && r <= 122: // ['d','z'] return 2 } return NoState @@ -40,13 +44,13 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 4 - case 65 <= r && r <= 90: // ['A','Z'] return 5 - case r == 95: // ['_','_'] + case 65 <= r && r <= 90: // ['A','Z'] return 6 + case r == 95: // ['_','_'] + return 7 case 97 <= r && r <= 122: // ['a','z'] - return 5 + return 6 } return NoState }, @@ -54,13 +58,13 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 4 - case 65 <= r && r <= 90: // ['A','Z'] return 5 - case r == 95: // ['_','_'] + case 65 <= r && r <= 90: // ['A','Z'] return 6 + case r == 95: // ['_','_'] + return 7 case 97 <= r && r <= 122: // ['a','z'] - return 5 + return 6 } return NoState }, @@ -68,13 +72,15 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 4 - case 65 <= r && r <= 90: // ['A','Z'] return 5 + case 65 <= r && r <= 90: // ['A','Z'] + return 6 case r == 95: // ['_','_'] + return 7 + case r == 97: // ['a','a'] + return 8 + case 98 <= r && r <= 122: // ['b','z'] return 6 - case 97 <= r && r <= 122: // ['a','z'] - return 5 } return NoState }, @@ -82,27 +88,91 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 4 - case 65 <= r && r <= 90: // ['A','Z'] return 5 + case 65 <= r && r <= 90: // ['A','Z'] + return 6 case r == 95: // ['_','_'] + return 7 + case 97 <= r && r <= 122: // ['a','z'] + return 6 + } + return NoState + }, + // S6 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 5 + case 65 <= r && r <= 90: // ['A','Z'] return 6 + case r == 95: // ['_','_'] + return 7 case 97 <= r && r <= 122: // ['a','z'] + return 6 + } + return NoState + }, + // S7 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] return 5 + case 65 <= r && r <= 90: // ['A','Z'] + return 6 + case r == 95: // ['_','_'] + return 7 + case 97 <= r && r <= 122: // ['a','z'] + return 6 } return NoState }, - // S6 + // S8 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 4 + return 5 case 65 <= r && r <= 90: // ['A','Z'] + return 6 + case r == 95: // ['_','_'] + return 7 + case 97 <= r && r <= 107: // ['a','k'] + return 6 + case r == 108: // ['l','l'] + return 9 + case 109 <= r && r <= 122: // ['m','z'] + return 6 + } + return NoState + }, + // S9 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] return 5 + case 65 <= r && r <= 90: // ['A','Z'] + return 6 case r == 95: // ['_','_'] + return 7 + case 97 <= r && r <= 98: // ['a','b'] return 6 - case 97 <= r && r <= 122: // ['a','z'] + case r == 99: // ['c','c'] + return 10 + case 100 <= r && r <= 122: // ['d','z'] + return 6 + } + return NoState + }, + // S10 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] return 5 + case 65 <= r && r <= 90: // ['A','Z'] + return 6 + case r == 95: // ['_','_'] + return 7 + case 97 <= r && r <= 122: // ['a','z'] + return 6 } return NoState }, diff --git a/example/ctx/main/main.go b/example/ctx/main/main.go new file mode 100644 index 00000000..71222e72 --- /dev/null +++ b/example/ctx/main/main.go @@ -0,0 +1,53 @@ +package main + +import ( + "flag" + "fmt" + "os" + "strings" + + ctx "github.com/maxcalandrelli/gocc/example/ctx" +) + +func showResult(r interface{}, e error, l int) { + if e != nil { + fmt.Fprintf(os.Stderr, "parsing returned the following error: %s\n", e.Error()) + } else { + fmt.Printf("r=%#v, %d bytes\n", r, l) + } +} + +var ( + File string + Text string + Longest bool +) + +func parse(longest bool, lex *ctx.Lexer) (res interface{}, err error, ptl int) { + if longest { + return ctx.NewParser().ParseLongestPrefix(lex) + } else { + return ctx.NewParser().Parse(lex) + } + return +} + +func main() { + flag.StringVar(&File, "file", "", "parse also text in file") + flag.StringVar(&Text, "text", "", "parse also text given with flag") + flag.BoolVar(&Longest, "longest", false, "parse longest possible part") + flag.Parse() + if Text > "" { + showResult(parse(Longest, ctx.NewLexerString(Text))) + } + if File > "" { + l, e := ctx.NewLexerFile(File) + if e != nil { + panic(e) + } + showResult(parse(Longest, l)) + } + if str := strings.Join(flag.Args(), " "); str > "" { + showResult(parse(Longest, ctx.NewLexerString(str))) + } +} diff --git a/example/ctx/parser/actiontable.go b/example/ctx/parser/actiontable.go index 5a87c2d9..fb2b7b80 100644 --- a/example/ctx/parser/actiontable.go +++ b/example/ctx/parser/actiontable.go @@ -17,6 +17,7 @@ var actionTab = actionTable{ nil, // INVALID nil, // $ shift(3), // id + shift(4), // calc }, }, actionRow{ // S1 @@ -25,6 +26,7 @@ var actionTab = actionTable{ nil, // INVALID accept(true), // $ shift(3), // id + shift(4), // calc }, }, actionRow{ // S2 @@ -33,6 +35,7 @@ var actionTab = actionTable{ nil, // INVALID reduce(1), // $, reduce: StmtList reduce(1), // id, reduce: StmtList + reduce(1), // calc, reduce: StmtList }, }, actionRow{ // S3 @@ -41,14 +44,25 @@ var actionTab = actionTable{ nil, // INVALID reduce(3), // $, reduce: Stmt reduce(3), // id, reduce: Stmt + reduce(3), // calc, reduce: Stmt }, }, actionRow{ // S4 + canRecover: false, + actions: [numSymbols]action{ + nil, // INVALID + reduce(4), // $, reduce: Stmt + reduce(4), // id, reduce: Stmt + reduce(4), // calc, reduce: Stmt + }, + }, + actionRow{ // S5 canRecover: false, actions: [numSymbols]action{ nil, // INVALID reduce(2), // $, reduce: StmtList reduce(2), // id, reduce: StmtList + reduce(2), // calc, reduce: StmtList }, }, } diff --git a/example/ctx/parser/gototable.go b/example/ctx/parser/gototable.go index 365a4be8..2b3a2108 100644 --- a/example/ctx/parser/gototable.go +++ b/example/ctx/parser/gototable.go @@ -18,7 +18,7 @@ var gotoTab = gotoTable{ gotoRow{ // S1 -1, // S' -1, // StmtList - 4, // Stmt + 5, // Stmt }, gotoRow{ // S2 -1, // S' @@ -35,4 +35,9 @@ var gotoTab = gotoTable{ -1, // StmtList -1, // Stmt }, + gotoRow{ // S5 + -1, // S' + -1, // StmtList + -1, // Stmt + }, } diff --git a/example/ctx/parser/parser.go b/example/ctx/parser/parser.go index 589aa2c2..72353f50 100644 --- a/example/ctx/parser/parser.go +++ b/example/ctx/parser/parser.go @@ -6,14 +6,14 @@ import ( "fmt" "strings" - parseError "github.com/maxcalandrelli/gocc/example/astx/errors" - "github.com/maxcalandrelli/gocc/example/astx/token" + parseError "github.com/maxcalandrelli/gocc/example/ctx/errors" + "github.com/maxcalandrelli/gocc/example/ctx/token" ) const ( - numProductions = 4 - numStates = 5 - numSymbols = 6 + numProductions = 5 + numStates = 6 + numSymbols = 7 ) // Stack diff --git a/example/ctx/parser/productionstable.go b/example/ctx/parser/productionstable.go index 1b603b16..653b4435 100644 --- a/example/ctx/parser/productionstable.go +++ b/example/ctx/parser/productionstable.go @@ -2,7 +2,10 @@ package parser -import "github.com/maxcalandrelli/gocc/example/astx/ast" +import ( + "github.com/maxcalandrelli/gocc/example/ctx/ast" + "github.com/maxcalandrelli/gocc/example/ctx/ast" + ) type ( //TODO: change type and variable names to be consistent with other tables @@ -60,4 +63,14 @@ var productionsTable = ProdTab{ return ast.NewStmt(X[0]) }, }, + ProdTabEntry{ + String: `Stmt : "calc" << ast.Calc(X[0]) >>`, + Id: "Stmt", + NTType: 2, + Index: 4, + NumSymbols: 1, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.Calc(X[0]) + }, + }, } diff --git a/example/ctx/token/token.go b/example/ctx/token/token.go index 501b01ac..d190e977 100644 --- a/example/ctx/token/token.go +++ b/example/ctx/token/token.go @@ -62,11 +62,13 @@ var TokMap = TokenMap{ "INVALID", "$", "id", + "calc", }, idMap: map[string]Type{ "INVALID": 0, "$": 1, "id": 2, + "calc": 3, }, } diff --git a/example/errorrecovery/errorrecovery.go b/example/errorrecovery/errorrecovery.go new file mode 100644 index 00000000..b8faa3d8 --- /dev/null +++ b/example/errorrecovery/errorrecovery.go @@ -0,0 +1,62 @@ +// Code generated by gocc; DO NOT EDIT. + +package errorrecovery + +import ( + "io" + + "github.com/maxcalandrelli/gocc/example/errorrecovery/iface" + "github.com/maxcalandrelli/gocc/example/errorrecovery/internal/io/stream" + "github.com/maxcalandrelli/gocc/example/errorrecovery/internal/lexer" + "github.com/maxcalandrelli/gocc/example/errorrecovery/internal/parser" + "github.com/maxcalandrelli/gocc/example/errorrecovery/internal/token" +) + +type ( + Token = token.Token + Lexer = lexer.Lexer + Parser = parser.Parser + TokenStream = iface.TokenStream + WindowReader = stream.WindowReader + Scanner = iface.Scanner +) + +func ParseFile(fpath string) (interface{}, error, int) { + if lexer, err := NewLexerFile(fpath); err == nil { + return NewParser().Parse(lexer) + } else { + return nil, err, 0 + } +} + +func ParseText(text string) (interface{}, error, int) { + return NewParser().Parse(NewLexerBytes([]byte(text))) +} + +func NewLexerBytes(src []byte) *lexer.Lexer { + return lexer.NewLexerBytes(src) +} + +func NewLexerString(src string) *lexer.Lexer { + return lexer.NewLexerBytes([]byte(src)) +} + +func NewLexerFile(fpath string) (*lexer.Lexer, error) { + return lexer.NewLexerFile(fpath) +} + +func NewParser() *parser.Parser { + return parser.NewParser() +} + +func NewWindowReaderFromBytes(src []byte) WindowReader { + return stream.NewWindowReaderFromBytes(src) +} + +func NewWindowReader(rdr io.Reader) WindowReader { + return stream.NewWindowReader(rdr) +} + +func NewLimitedWindowReader(rdr io.Reader, sizeMin, sizeMax int) WindowReader { + return stream.NewLimitedWindowReader(rdr, sizeMin, sizeMax) +} diff --git a/example/errorrecovery/iface/iface.go b/example/errorrecovery/iface/iface.go new file mode 100644 index 00000000..a7175c9c --- /dev/null +++ b/example/errorrecovery/iface/iface.go @@ -0,0 +1,30 @@ +// Code generated by gocc; DO NOT EDIT. + +package iface + +import ( + "github.com/maxcalandrelli/gocc/example/errorrecovery/internal/token" + "io" +) + +type ( + Scanner interface { + Scan() (tok *token.Token) + GetStream() TokenStream + } + + CheckPoint interface { + DistanceFrom(CheckPoint) int + } + + CheckPointable interface { + GetCheckPoint() CheckPoint + GotoCheckPoint(CheckPoint) + } + + TokenStream interface { + io.Reader + io.RuneScanner + io.Seeker + } +) diff --git a/example/errorrecovery/internal/errors/errors.go b/example/errorrecovery/internal/errors/errors.go new file mode 100644 index 00000000..ac18f939 --- /dev/null +++ b/example/errorrecovery/internal/errors/errors.go @@ -0,0 +1,56 @@ +// Code generated by gocc; DO NOT EDIT. + +package errors + +import ( + "fmt" + "strings" + + "github.com/maxcalandrelli/gocc/example/errorrecovery/internal/token" +) + +type ErrorSymbol interface { +} + +type Error struct { + Err error + ErrorToken *token.Token + ErrorSymbols []ErrorSymbol + ExpectedTokens []string + StackTop int +} + +func (e *Error) String() string { + w := new(strings.Builder) + fmt.Fprintf(w, "Error") + if e.Err != nil { + fmt.Fprintf(w, " %s\n", e.Err) + } else { + fmt.Fprintf(w, "\n") + } + fmt.Fprintf(w, "Token: type=%d, lit=%s\n", e.ErrorToken.Type, e.ErrorToken.Lit) + fmt.Fprintf(w, "Pos: offset=%d, line=%d, column=%d\n", e.ErrorToken.Pos.Offset, e.ErrorToken.Pos.Line, e.ErrorToken.Pos.Column) + fmt.Fprintf(w, "Expected one of: ") + for _, sym := range e.ExpectedTokens { + fmt.Fprintf(w, "%s ", sym) + } + fmt.Fprintf(w, "ErrorSymbol:\n") + for _, sym := range e.ErrorSymbols { + fmt.Fprintf(w, "%v\n", sym) + } + return w.String() +} + +func (e *Error) Error() string { + w := new(strings.Builder) + fmt.Fprintf(w, "Error in S%d: %s, %s", e.StackTop, token.TokMap.TokenString(e.ErrorToken), e.ErrorToken.Pos.String()) + if e.Err != nil { + fmt.Fprintf(w, ": %+v", e.Err) + } else { + fmt.Fprintf(w, ", expected one of: ") + for _, expected := range e.ExpectedTokens { + fmt.Fprintf(w, "%s ", expected) + } + } + return w.String() +} diff --git a/example/errorrecovery/internal/io/stream/internal/stream_impl.go b/example/errorrecovery/internal/io/stream/internal/stream_impl.go new file mode 100644 index 00000000..358aa160 --- /dev/null +++ b/example/errorrecovery/internal/io/stream/internal/stream_impl.go @@ -0,0 +1,275 @@ +package internal + +import ( + "io" + "sync" + "unicode/utf8" +) + +type ( + impl_WindowReader struct { + bufferBlockSize int + maxBufferSize int + buffers [][]byte + available int + absbase int64 + position int + eof bool + rdr io.Reader + lock *sync.Mutex + } +) + +func (s *impl_WindowReader) lockReader() { + if s.lock != nil { + s.lock.Lock() + } +} + +func (s *impl_WindowReader) unlockReader() { + if s.lock != nil { + s.lock.Unlock() + } +} + +func (s *impl_WindowReader) seek(offset int64, whence int) (offs int64, err error) { + switch whence { + case io.SeekStart: + return s.seek(offset-s.ReadPosition(), io.SeekCurrent) + case io.SeekCurrent: + switch { + case offset == 0: + return s.ReadPosition(), nil + case offset < 0: + if -offset > int64(s.maxBackOffset()) { + err = io.ErrShortBuffer + } else { + s.advanceGet(int(offset)) + } + case offset > 0: + for offset > 0 && !s.eof { + available := s.Buffered() + if offset <= int64(available) { + s.advanceGet(int(offset)) + break + } + if available > 0 { + s.advanceGet(available) + offset -= int64(available) + } + read, _ := s.fetchBytes(int(offset)) + s.advanceGet(read) + offset -= int64(read) + } + if s.eof { + err = io.EOF + } + } + case io.SeekEnd: + for !s.eof { + s.seek(int64(s.MaxCap()), io.SeekCurrent) + } + s.seek(int64(s.Buffered()), io.SeekCurrent) + } + if s.eof && err == nil && s.Buffered() > 0 { + s.eof = false + } + return s.ReadPosition(), err +} + +func (s impl_WindowReader) maxBackOffset() int { + r := s.position + if s.absbase > 0 { + r = s.Cap() - s.Buffered() + } + return r +} + +func (s impl_WindowReader) bufferIndex(pos int) int { + if pos < 0 { + panic("negative position") + } + return pos / s.bufferBlockSize +} + +func (s impl_WindowReader) bufferBytes(pos int) []byte { + return s.buffers[s.bufferIndex(pos)] +} + +func (s impl_WindowReader) bufferByteRange(pos int, length int) []byte { + p := s.bufferOffset(pos) + return s.bufferBytes(pos)[p : p+length] +} + +func (s impl_WindowReader) bufferOffset(pos int) int { + return pos % s.bufferBlockSize +} + +func (s *impl_WindowReader) advanceGet(n int) { + sz := s.Cap() + switch { + case n < 0: + if -n > s.maxBackOffset() { + panic("underflow") + } + s.position += n + if s.position < 0 { + s.position += sz + s.absbase -= int64(sz) + } + case n > 0: + if n > s.Buffered() { + panic("overflow") + } + s.position += n + if s.position >= sz { + s.position -= sz + s.absbase += int64(sz) + } + } + s.available -= n +} + +func (s *impl_WindowReader) copy(to []byte, length int) { + for offs, cp := 0, 0; length > 0; length -= cp { + s.position %= s.MaxCap() + p := s.bufferOffset(s.position) + b := s.bufferBytes(s.position) + r := s.bufferBlockSize - p + if length <= r { + cp = copy(to[offs:], b[p:p+length]) + } else { + cp = copy(to[offs:], b[p:]) + } + s.advanceGet(cp) + offs += cp + } +} + +func (s *impl_WindowReader) fetchBytes(n int) (read int, err error) { + if s.rdr == nil { + s.eof = true + return 0, io.EOF + } + for n > 0 && s.Buffered() < s.MaxCap() && err == nil { + readNow := n + putpos := s.position + s.available + r := s.bufferBlockSize - s.bufferOffset(putpos) + if readNow > r { + readNow = r + } + for s.bufferIndex(putpos) >= len(s.buffers) && s.Cap() < s.MaxCap() { + s.buffers = append(s.buffers, make([]byte, s.bufferBlockSize)) + } + putpos %= s.MaxCap() + offs := s.bufferOffset(putpos) + if r, err = s.rdr.Read(s.bufferBytes(putpos)[offs : offs+readNow]); r > 0 { + s.available += r + read += r + n -= r + } + } + if n > 0 && err == nil { + err = io.ErrShortBuffer + } + return +} + +func (s *impl_WindowReader) read(p []byte) (read int, err error) { + if s.eof { + return 0, io.EOF + } + for read < len(p) && err == nil { + available := s.Buffered() + if len(p)-read <= available { + s.copy(p[read:], len(p)-read) + read = len(p) + } else { + if available == 0 { + available, err = s.fetchBytes(len(p) - read) + } + s.copy(p[read:], available) + read += available + switch err { + case io.ErrShortBuffer: + err = nil + case io.EOF: + s.eof = true + } + } + } + return +} + +func (s impl_WindowReader) peekByte() (byte, error) { + if s.Buffered() < 1 { + return 0, io.ErrShortBuffer + } + return s.bufferBytes(s.position)[s.bufferOffset(s.position)], nil +} + +func (s *impl_WindowReader) unreadByte() error { + _, e := s.seek(-1, io.SeekCurrent) + return e +} + +func (s *impl_WindowReader) readRune() (r rune, size int, err error) { + for i := 1; err == nil && i <= 4; i++ { + if s.Buffered() < i { + if _, err = s.fetchBytes(i); err != nil { + return + } + } + t := s.bufferByteRange(s.position, i) + if r, size = utf8.DecodeRune(t); r != utf8.RuneError { + s.advanceGet(size) + return + } + } + return utf8.RuneError, 0, err +} + +func (s *impl_WindowReader) unreadRune() (err error) { + tmps := *s + tmpb := []byte{} + for { + if _, err = tmps.seek(-1, io.SeekCurrent); err == nil { + b, _ := tmps.peekByte() + tmpb = append([]byte{b}, tmpb...) + switch len(tmpb) { + case 1: + if (tmpb[0] & 0xC0) == 0x80 { + continue + } + _, err = s.seek(-int64(len(tmpb)), io.SeekCurrent) + return + case 2: + if (tmpb[0] & 0xC0) == 0x80 { + continue + } + if (tmpb[0] & 0xE0) != 0xC0 { + break + } + _, err = s.seek(-int64(len(tmpb)), io.SeekCurrent) + return + case 3: + if (tmpb[0] & 0xC0) == 0x80 { + continue + } + if (tmpb[0] & 0xF0) != 0xE0 { + break + } + _, err = s.seek(-int64(len(tmpb)), io.SeekCurrent) + return + case 4: + if (tmpb[0] & 0xF8) != 0xF0 { + break + } + _, err = s.seek(-int64(len(tmpb)), io.SeekCurrent) + return + } + } + } + _, err = s.seek(-1, io.SeekCurrent) + return +} diff --git a/example/errorrecovery/internal/io/stream/internal/stream_public.go b/example/errorrecovery/internal/io/stream/internal/stream_public.go new file mode 100644 index 00000000..20ed7b5e --- /dev/null +++ b/example/errorrecovery/internal/io/stream/internal/stream_public.go @@ -0,0 +1,101 @@ +package internal + +import ( + "io" +) + +func NewWindowReader(buf []byte, underlyingReader io.Reader, blksize, smax int, InfoPrefixRoundUp bool) *impl_WindowReader { + if blksize < 0 || smax < blksize { + panic("illegal buffer size") + } + r := &impl_WindowReader{rdr: underlyingReader} + r.bufferBlockSize = blksize + if underlyingReader != nil { + if blksize <= 0 { + r.bufferBlockSize = 1 << 10 + } else if InfoPrefixRoundUp { + for r.bufferBlockSize = 1; blksize > 0; r.bufferBlockSize = r.bufferBlockSize << 1 { + blksize = blksize >> 1 + } + } + if smax > 0 { + r.maxBufferSize = ((smax-1)/r.bufferBlockSize + 1) * r.bufferBlockSize + } + r.buffers = [][]byte{} + } else { + r.buffers = [][]byte{buf} + r.available = len(buf) + r.bufferBlockSize = r.available + r.maxBufferSize = r.available + } + return r +} + +func (s impl_WindowReader) Cap() int { + return len(s.buffers) * s.bufferBlockSize +} + +func (s impl_WindowReader) BlockSize() int { + return s.bufferBlockSize +} + +func (s impl_WindowReader) MaxCap() int { + if s.maxBufferSize > 0 { + return s.maxBufferSize + } + return 1 << 31 +} + +func (s impl_WindowReader) MaxUnreadSize() int { + return s.maxBackOffset() +} + +func (s impl_WindowReader) Buffered() int { + return s.available +} + +func (s impl_WindowReader) ReadPosition() int64 { + return s.absbase + int64(s.position) +} + +func (s *impl_WindowReader) Read(p []byte) (read int, err error) { + s.lockReader() + defer func() { s.unlockReader() }() + return s.read(p) +} + +func (s *impl_WindowReader) Seek(offset int64, whence int) (offs int64, err error) { + s.lockReader() + defer func() { s.unlockReader() }() + return s.seek(offset, whence) +} + +func (s *impl_WindowReader) ReadByte() (byte, error) { + b := []byte{0} + _, err := s.Read(b) + return b[0], err +} + +func (s *impl_WindowReader) PeekByte() (byte, error) { + s.lockReader() + defer func() { s.unlockReader() }() + return s.peekByte() +} + +func (s *impl_WindowReader) UnreadByte() error { + s.lockReader() + defer func() { s.unlockReader() }() + return s.unreadByte() +} + +func (s *impl_WindowReader) ReadRune() (r rune, size int, err error) { + s.lockReader() + defer func() { s.unlockReader() }() + return s.readRune() +} + +func (s *impl_WindowReader) UnreadRune() (err error) { + s.lockReader() + defer func() { s.unlockReader() }() + return s.unreadRune() +} diff --git a/example/errorrecovery/internal/io/stream/stream.go b/example/errorrecovery/internal/io/stream/stream.go new file mode 100644 index 00000000..5afc1043 --- /dev/null +++ b/example/errorrecovery/internal/io/stream/stream.go @@ -0,0 +1,39 @@ +package stream + +import ( + internal "github.com/maxcalandrelli/gocc/example/errorrecovery/internal/io/stream/internal" + "io" +) + +type ( + WindowReader interface { + BlockSize() int + Buffered() int + Cap() int + MaxCap() int + Read([]byte) (int, error) + ReadByte() (byte, error) + ReadPosition() int64 + ReadRune() (rune, int, error) + Seek(int64, int) (int64, error) + UnreadByte() error + UnreadRune() error + MaxUnreadSize() int + } +) + +var ( + InfoPrefixRoundUp = false +) + +func NewWindowReaderFromBytes(src []byte) WindowReader { + return internal.NewWindowReader(src, nil, 0, 0, InfoPrefixRoundUp) +} + +func NewWindowReader(rdr io.Reader) WindowReader { + return internal.NewWindowReader(nil, rdr, 0, 0, false) +} + +func NewLimitedWindowReader(rdr io.Reader, sizeMin, sizeMax int) WindowReader { + return internal.NewWindowReader(nil, rdr, sizeMin, sizeMax, InfoPrefixRoundUp) +} diff --git a/example/errorrecovery/internal/lexer/acttab.go b/example/errorrecovery/internal/lexer/acttab.go new file mode 100644 index 00000000..6c1bd404 --- /dev/null +++ b/example/errorrecovery/internal/lexer/acttab.go @@ -0,0 +1,51 @@ +// Code generated by gocc; DO NOT EDIT. + +package lexer + +import ( + "fmt" + + "github.com/maxcalandrelli/gocc/example/errorrecovery/internal/token" +) + +type ActionTable [NumStates]ActionRow + +type ActionRow struct { + Accept token.Type + Ignore string +} + +func (a ActionRow) String() string { + return fmt.Sprintf("Accept=%d, Ignore=%s", a.Accept, a.Ignore) +} + +var ActTab = ActionTable{ + ActionRow{ // S0, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S1, Ignore("!whitespace") + Accept: -1, + Ignore: "!whitespace", + }, + ActionRow{ // S2, Accept("id") + Accept: 2, + Ignore: "", + }, + ActionRow{ // S3, Accept("id") + Accept: 2, + Ignore: "", + }, + ActionRow{ // S4, Accept("id") + Accept: 2, + Ignore: "", + }, + ActionRow{ // S5, Accept("id") + Accept: 2, + Ignore: "", + }, + ActionRow{ // S6, Accept("id") + Accept: 2, + Ignore: "", + }, +} diff --git a/example/errorrecovery/internal/lexer/lexer.go b/example/errorrecovery/internal/lexer/lexer.go new file mode 100644 index 00000000..1afa07bb --- /dev/null +++ b/example/errorrecovery/internal/lexer/lexer.go @@ -0,0 +1,153 @@ +// Code generated by gocc; DO NOT EDIT. + +package lexer + +import ( + + "io" + "bytes" + "os" + + + "github.com/maxcalandrelli/gocc/example/errorrecovery/iface" + "github.com/maxcalandrelli/gocc/example/errorrecovery/internal/token" + "github.com/maxcalandrelli/gocc/example/errorrecovery/internal/io/stream" +) + +const ( + NoState = -1 + NumStates = 7 + NumSymbols = 10 + INVALID_RUNE = rune(-1) +) + +type position struct { + token.Pos +} + +type Lexer struct { + position + stream iface.TokenStream + eof bool +} + +func NewLexerBytes(src []byte) *Lexer { + lexer := &Lexer{stream: bytes.NewReader(src)} + lexer.reset() + return lexer +} + +func NewLexerFile(fpath string) (*Lexer, error) { + s, err := os.Open(fpath) + if err != nil { + return nil, err + } + lexer := &Lexer{stream: stream.NewWindowReader(s)} + lexer.reset() + return lexer, nil +} + +func NewLexer(reader io.Reader) (*Lexer, error) { + lexer := &Lexer{} + lexer.reset() + if lexer.stream, _ = reader.(iface.TokenStream); lexer.stream == nil { + lexer.stream = stream.NewWindowReader(reader) + } + return lexer, nil +} + +func (l *Lexer) reset () { + l.position.Reset() +} + +func (l Lexer) GetStream() iface.TokenStream { + return l.stream +} + +type checkPoint int64 + +func (c checkPoint) DistanceFrom (o iface.CheckPoint) int { + return int (c - o.(checkPoint)) +} + +func (l Lexer) GetCheckPoint() iface.CheckPoint { + pos, _ := l.stream.Seek(0, io.SeekCurrent) + return checkPoint(pos) +} + +func (l Lexer) GotoCheckPoint(cp iface.CheckPoint) { + l.stream.Seek(int64(cp.(checkPoint)), io.SeekStart) +} + +func (l *Lexer) Scan() (tok *token.Token) { + tok = new(token.Token) + tok.Type = token.INVALID + tok.Lit = []byte{} + start := l.position + state := 0 + for state != -1 { + curr, size, err := l.stream.ReadRune() + if size < 1 || err != nil { + curr = INVALID_RUNE + } + if size > 0 { + l.position.Pos.Offset += size + } + nextState := -1 + if curr != INVALID_RUNE { + nextState = TransTab[state](curr) + } + state = nextState + if state != -1 { + switch curr { + case '\n': + l.position.Pos.Line++ + l.position.Pos.Column = 1 + case '\r': + l.position.Pos.Column = 1 + case '\t': + l.position.Pos.Column += 4 + default: + l.position.Pos.Column++ + } + switch { + case ActTab[state].Accept != -1: + tok.Type = ActTab[state].Accept + tok.Lit = append(tok.Lit, string(curr)...) + case ActTab[state].Ignore != "": + start = l.position + state = 0 + tok.Lit = []byte{} + } + } else if curr != INVALID_RUNE { + l.stream.UnreadRune() + } + if err == io.EOF && len(tok.Lit)==0 { + tok.Type = token.EOF + tok.Pos = start.Pos + return + } + } + tok.Pos = start.Pos + return +} + +func (l *Lexer) Reset() { + l.position.Reset() +} + +func (l Lexer) CurrentPosition() position { + return l.position +} + +func (p *position) Reset() { + p.Offset = 0 + p.Line = 1 + p.Column = 1 +} + +func (p position) StartingFrom(base position) position { + r := p + r.Pos = p.Pos.StartingFrom(base.Pos) + return r +} diff --git a/example/errorrecovery/internal/lexer/transitiontable.go b/example/errorrecovery/internal/lexer/transitiontable.go new file mode 100644 index 00000000..50dd04da --- /dev/null +++ b/example/errorrecovery/internal/lexer/transitiontable.go @@ -0,0 +1,109 @@ +// Code generated by gocc; DO NOT EDIT. + +package lexer + +/* +Let s be the current state +Let r be the current input rune +transitionTable[s](r) returns the next state. +*/ +type TransitionTable [NumStates]func(rune) int + +var TransTab = TransitionTable{ + // S0 + func(r rune) int { + switch { + case r == 9: // ['\t','\t'] + return 1 + case r == 10: // ['\n','\n'] + return 1 + case r == 13: // ['\r','\r'] + return 1 + case r == 32: // [' ',' '] + return 1 + case 65 <= r && r <= 90: // ['A','Z'] + return 2 + case r == 95: // ['_','_'] + return 3 + case 97 <= r && r <= 122: // ['a','z'] + return 2 + } + return NoState + }, + // S1 + func(r rune) int { + switch { + } + return NoState + }, + // S2 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 4 + case 65 <= r && r <= 90: // ['A','Z'] + return 5 + case r == 95: // ['_','_'] + return 6 + case 97 <= r && r <= 122: // ['a','z'] + return 5 + } + return NoState + }, + // S3 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 4 + case 65 <= r && r <= 90: // ['A','Z'] + return 5 + case r == 95: // ['_','_'] + return 6 + case 97 <= r && r <= 122: // ['a','z'] + return 5 + } + return NoState + }, + // S4 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 4 + case 65 <= r && r <= 90: // ['A','Z'] + return 5 + case r == 95: // ['_','_'] + return 6 + case 97 <= r && r <= 122: // ['a','z'] + return 5 + } + return NoState + }, + // S5 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 4 + case 65 <= r && r <= 90: // ['A','Z'] + return 5 + case r == 95: // ['_','_'] + return 6 + case 97 <= r && r <= 122: // ['a','z'] + return 5 + } + return NoState + }, + // S6 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 4 + case 65 <= r && r <= 90: // ['A','Z'] + return 5 + case r == 95: // ['_','_'] + return 6 + case 97 <= r && r <= 122: // ['a','z'] + return 5 + } + return NoState + }, +} diff --git a/example/errorrecovery/internal/parser/action.go b/example/errorrecovery/internal/parser/action.go new file mode 100644 index 00000000..54bc55e9 --- /dev/null +++ b/example/errorrecovery/internal/parser/action.go @@ -0,0 +1,51 @@ +// Code generated by gocc; DO NOT EDIT. + +package parser + +import ( + "fmt" +) + +type action interface { + act() + String() string +} + +type ( + accept bool + shift int // value is next state index + reduce int // value is production index +) + +func (this accept) act() {} +func (this shift) act() {} +func (this reduce) act() {} + +func (this accept) Equal(that action) bool { + if _, ok := that.(accept); ok { + return true + } + return false +} + +func (this reduce) Equal(that action) bool { + that1, ok := that.(reduce) + if !ok { + return false + } + return this == that1 +} + +func (this shift) Equal(that action) bool { + that1, ok := that.(shift) + if !ok { + return false + } + return this == that1 +} + +func (this accept) String() string { return "accept(0)" } +func (this shift) String() string { return fmt.Sprintf("shift:%d", this) } +func (this reduce) String() string { + return fmt.Sprintf("reduce:%d(%s)", this, productionsTable[this].String) +} diff --git a/example/errorrecovery/internal/parser/actiontable.go b/example/errorrecovery/internal/parser/actiontable.go new file mode 100644 index 00000000..cff78c91 --- /dev/null +++ b/example/errorrecovery/internal/parser/actiontable.go @@ -0,0 +1,70 @@ +// Code generated by gocc; DO NOT EDIT. + +package parser + +type ( + actionTable [numStates]actionRow + cdFunc func(TokenStream, interface{}) (interface{}, error, []byte) + cdAction struct { + tokenIndex int + tokenScanner cdFunc + } + actionRow struct { + canRecover bool + actions [numSymbols]action + cdActions []cdAction + } + actions struct { + table actionTable + } +) + +var parserActions = actions{ + table: actionTable{ + actionRow{ // S0 + canRecover: true, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + shift(3), // id + }, + cdActions: []cdAction{}, + }, + actionRow{ // S1 + canRecover: true, + actions: [numSymbols]action{ + nil, // ά + accept(true), // Ω + shift(3), // id + }, + cdActions: []cdAction{}, + }, + actionRow{ // S2 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(1), // Ω, reduce: StmtList + reduce(1), // id, reduce: StmtList + }, + cdActions: []cdAction{}, + }, + actionRow{ // S3 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(3), // Ω, reduce: Stmt + reduce(3), // id, reduce: Stmt + }, + cdActions: []cdAction{}, + }, + actionRow{ // S4 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(2), // Ω, reduce: StmtList + reduce(2), // id, reduce: StmtList + }, + cdActions: []cdAction{}, + }, + }, +} diff --git a/example/errorrecovery/internal/parser/gototable.go b/example/errorrecovery/internal/parser/gototable.go new file mode 100644 index 00000000..3fc118e2 --- /dev/null +++ b/example/errorrecovery/internal/parser/gototable.go @@ -0,0 +1,38 @@ +// Code generated by gocc; DO NOT EDIT. + +package parser + +const numNTSymbols = 3 + +type ( + gotoTable [numStates]gotoRow + gotoRow [numNTSymbols]int +) + +var gotoTab = gotoTable{ + gotoRow{ // S0 + -1, // Π + 1, // Π + 2, // Π + }, + gotoRow{ // S1 + -1, // Π + -1, // Π + 4, // Π + }, + gotoRow{ // S2 + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S3 + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S4 + -1, // Π + -1, // Π + -1, // Π + }, +} diff --git a/example/errorrecovery/internal/parser/parser.go b/example/errorrecovery/internal/parser/parser.go new file mode 100644 index 00000000..a6c0bc41 --- /dev/null +++ b/example/errorrecovery/internal/parser/parser.go @@ -0,0 +1,295 @@ +// Code generated by gocc; DO NOT EDIT. + +package parser + +import ( + "errors" + "fmt" + "strings" + + "github.com/maxcalandrelli/gocc/example/errorrecovery/iface" + parseError "github.com/maxcalandrelli/gocc/example/errorrecovery/internal/errors" + "github.com/maxcalandrelli/gocc/example/errorrecovery/internal/token" +) + +const ( + numProductions = 5 + numStates = 5 + numSymbols = 6 +) + +// Stack + +type stack struct { + state []int + attrib []Attrib +} + +const INITIAL_STACK_SIZE = 100 + +func newStack() *stack { + return &stack{ + state: make([]int, 0, INITIAL_STACK_SIZE), + attrib: make([]Attrib, 0, INITIAL_STACK_SIZE), + } +} + +func (s *stack) reset() { + s.state = s.state[:0] + s.attrib = s.attrib[:0] +} + +func (s *stack) push(state int, a Attrib) { + s.state = append(s.state, state) + s.attrib = append(s.attrib, a) +} + +func (s *stack) top() int { + return s.state[len(s.state)-1] +} + +func (s *stack) peek(pos int) int { + return s.state[pos] +} + +func (s *stack) topIndex() int { + return len(s.state) - 1 +} + +func (s *stack) popN(items int) []Attrib { + lo, hi := len(s.state)-items, len(s.state) + + attrib := s.attrib[lo:hi] + + s.state = s.state[:lo] + s.attrib = s.attrib[:lo] + + return attrib +} + +func (s *stack) String() string { + w := new(strings.Builder) + fmt.Fprintf(w, "stack:\n") + for i, st := range s.state { + fmt.Fprintf(w, "\t%d: %d , ", i, st) + if s.attrib[i] == nil { + fmt.Fprintf(w, "nil") + } else { + switch attr := s.attrib[i].(type) { + case *token.Token: + fmt.Fprintf(w, "%s", attr.Lit) + default: + fmt.Fprintf(w, "%v", attr) + } + } + fmt.Fprintf(w, "\n") + } + return w.String() +} + +// Parser + +type Parser struct { + stack *stack + nextToken *token.Token + userContext interface{} +} + +type TokenStream = iface.TokenStream + +func NewParser() *Parser { + return NewParserWithContext(nil) +} + +func NewParserWithContext(u interface{}) *Parser { + p := &Parser{stack: newStack(), userContext: u} + p.Reset() + return p +} + +func (p *Parser) Reset() { + p.stack.reset() + p.stack.push(0, nil) +} + +func (p *Parser) Error(err error, scanner iface.Scanner) (recovered bool, errorAttrib *parseError.Error) { + errorAttrib = &parseError.Error{ + Err: err, + ErrorToken: p.nextToken, + ErrorSymbols: p.popNonRecoveryStates(), + ExpectedTokens: make([]string, 0, 8), + } + for t, action := range parserActions.table[p.stack.top()].actions { + if action != nil { + errorAttrib.ExpectedTokens = append(errorAttrib.ExpectedTokens, token.TokMap.Id(token.Type(t))) + } + } + + if action := parserActions.table[p.stack.top()].actions[token.TokMap.Type("error")]; action != nil { + p.stack.push(int(action.(shift)), errorAttrib) // action can only be shift + } else { + return + } + + if action := parserActions.table[p.stack.top()].actions[p.nextToken.Type]; action != nil { + recovered = true + } + for !recovered && p.nextToken.Type != token.EOF { + p.nextToken = scanner.Scan() + if action := parserActions.table[p.stack.top()].actions[p.nextToken.Type]; action != nil { + recovered = true + } + } + + return +} + +func (p *Parser) popNonRecoveryStates() (removedAttribs []parseError.ErrorSymbol) { + if rs, ok := p.firstRecoveryState(); ok { + errorSymbols := p.stack.popN(p.stack.topIndex() - rs) + removedAttribs = make([]parseError.ErrorSymbol, len(errorSymbols)) + for i, e := range errorSymbols { + removedAttribs[i] = e + } + } else { + removedAttribs = []parseError.ErrorSymbol{} + } + return +} + +// recoveryState points to the highest state on the stack, which can recover +func (p *Parser) firstRecoveryState() (recoveryState int, canRecover bool) { + recoveryState, canRecover = p.stack.topIndex(), parserActions.table[p.stack.top()].canRecover + for recoveryState > 0 && !canRecover { + recoveryState-- + canRecover = parserActions.table[p.stack.peek(recoveryState)].canRecover + } + return +} + +func (p *Parser) newError(err error) error { + e := &parseError.Error{ + Err: err, + StackTop: p.stack.top(), + ErrorToken: p.nextToken, + } + actRow := parserActions.table[p.stack.top()] + for i, t := range actRow.actions { + if t != nil { + e.ExpectedTokens = append(e.ExpectedTokens, token.TokMap.Id(token.Type(i))) + } + } + return e +} + +func (p *Parser) Parse(scanner iface.Scanner) (res interface{}, err error, ptl int) { + return p.parse(scanner, false) +} + +func (p *Parser) ParseLongestPrefix(scanner iface.Scanner) (res interface{}, err error, ptl int) { + return p.parse(scanner, true) +} + +var errNotRepositionable = errors.New("scanner not repositionable") + +func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, err error, ptl int) { + var ( + tokens iface.CheckPointable + afterPos iface.CheckPoint + checkPoint iface.CheckPoint + ) + readNextToken := func() error { + if tokens == nil && (len(parserActions.table[p.stack.top()].cdActions) > 0 || longest) { + return errNotRepositionable + } + checkPoint = tokens.GetCheckPoint() + p.nextToken = scanner.Scan() + if longest { + afterPos = tokens.GetCheckPoint() + } + return nil + } + p.Reset() + tokens, _ = scanner.(iface.CheckPointable) + startCp := tokens.GetCheckPoint() + if err := readNextToken(); err != nil { + return nil, err, tokens.GetCheckPoint().DistanceFrom(startCp) + } + for acc := false; !acc; { + action := parserActions.table[p.stack.top()].actions[p.nextToken.Type] + if action == nil { + // + // If no action, check if we have some context dependent parsing to try + // + for _, cdAction := range parserActions.table[p.stack.top()].cdActions { + tokens.GotoCheckPoint(checkPoint) + cd_res, cd_err, cd_parsed := cdAction.tokenScanner(scanner.GetStream(), p.userContext) + if cd_err == nil && len(cd_parsed) > 0 { + action = parserActions.table[p.stack.top()].actions[cdAction.tokenIndex] + if action != nil { + p.nextToken.Foreign = true + p.nextToken.ForeignAstNode = cd_res + p.nextToken.Lit = cd_parsed + p.nextToken.Type = token.Type(cdAction.tokenIndex) + break + } + } + } + } + // + // Still no action? If a longest possible parsing is requested in place + // of a full text, we should try to check if an EOF here would have led + // to a successful parsing instead + // Rember that token.EOF is 1, that is the index of SyntaxEof into symbol table + // Dirty, dirty, dirty... but I found it as it is, and I prefer not to touch + // + if action == nil && longest { + tokens.GotoCheckPoint(checkPoint) + action = parserActions.table[p.stack.top()].actions[token.EOF] + if action == nil { + // + // ok, let's consume the token then + // + tokens.GotoCheckPoint(afterPos) + } + } + + // + // Well, no action is no action after all... + // + if action == nil { + if recovered, errAttrib := p.Error(nil, scanner); !recovered { + p.nextToken = errAttrib.ErrorToken + return nil, p.newError(nil), tokens.GetCheckPoint().DistanceFrom(startCp) + } + if action = parserActions.table[p.stack.top()].actions[p.nextToken.Type]; action == nil { + panic("Error recovery led to invalid action") + } + } + + switch act := action.(type) { + case accept: + res = p.stack.popN(1)[0] + acc = true + case shift: + p.stack.push(int(act), p.nextToken) + if p.nextToken.Foreign { + p.stack.push(int(act), p.nextToken.ForeignAstNode) + } + if err := readNextToken(); err != nil { + return nil, err, tokens.GetCheckPoint().DistanceFrom(startCp) + } + case reduce: + prod := productionsTable[int(act)] + attrib, err := prod.ReduceFunc(p.userContext, p.stack.popN(prod.NumSymbols)) + if err != nil { + return nil, p.newError(err), tokens.GetCheckPoint().DistanceFrom(startCp) + } else { + p.stack.push(gotoTab[p.stack.top()][prod.NTType], attrib) + } + default: + panic("unknown action: " + action.String()) + } + } + return res, nil, tokens.GetCheckPoint().DistanceFrom(startCp) +} diff --git a/example/errorrecovery/internal/parser/productionstable.go b/example/errorrecovery/internal/parser/productionstable.go new file mode 100644 index 00000000..053d13bb --- /dev/null +++ b/example/errorrecovery/internal/parser/productionstable.go @@ -0,0 +1,73 @@ +// Code generated by gocc; DO NOT EDIT. + +package parser + +import "github.com/maxcalandrelli/gocc/example/errorrecovery/ast" + +type ( + //TODO: change type and variable names to be consistent with other tables + ProdTab [numProductions]ProdTabEntry + ProdTabEntry struct { + String string + Id string + NTType int + Index int + NumSymbols int + ReduceFunc func(interface{}, []Attrib) (Attrib, error) + } + Attrib interface { + } +) + +var productionsTable = ProdTab{ + ProdTabEntry{ + String: `S' : Π << >>`, + Id: "S'", + NTType: 0, + Index: 0, + NumSymbols: 1, + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { + return X[0], nil + }, + }, + ProdTabEntry{ + String: `StmtList : Π << ast.NewStmtList(X[0]) >>`, + Id: "StmtList", + NTType: 1, + Index: 1, + NumSymbols: 1, + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { + return ast.NewStmtList(X[0]) + }, + }, + ProdTabEntry{ + String: `StmtList : Π Π << ast.AppendStmt(X[0], X[1]) >>`, + Id: "StmtList", + NTType: 1, + Index: 2, + NumSymbols: 2, + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { + return ast.AppendStmt(X[0], X[1]) + }, + }, + ProdTabEntry{ + String: `Stmt : id << ast.NewStmt(X[0]) >>`, + Id: "Stmt", + NTType: 2, + Index: 3, + NumSymbols: 1, + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { + return ast.NewStmt(X[0]) + }, + }, + ProdTabEntry{ + String: `Stmt : λ << >>`, + Id: "Stmt", + NTType: 2, + Index: 4, + NumSymbols: 1, + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { + return X[0], nil + }, + }, +} diff --git a/example/errorrecovery/internal/token/token.go b/example/errorrecovery/internal/token/token.go new file mode 100644 index 00000000..58432cfc --- /dev/null +++ b/example/errorrecovery/internal/token/token.go @@ -0,0 +1,87 @@ +// Code generated by gocc; DO NOT EDIT. + +package token + +import ( + "fmt" +) + +type Token struct { + Type + Lit []byte + Pos + ForeignAstNode interface{} + Foreign bool +} + +type Type int + +const ( + INVALID Type = iota + EOF +) + +type Pos struct { + Offset int + Line int + Column int +} + +func (p Pos) String() string { + return fmt.Sprintf("Pos(offset=%d, line=%d, column=%d)", p.Offset, p.Line, p.Column) +} + +func (p Pos) StartingFrom(base Pos) Pos { + r := base + r.Offset += p.Offset + r.Line += p.Line + r.Column = p.Column + if p.Line > 0 && base.Line > 0 { + r.Line-- + } + if r.Column < 1 { + r.Column = 1 + } + return r +} + +type TokenMap struct { + typeMap []string + idMap map[string]Type +} + +func (m TokenMap) Id(tok Type) string { + if int(tok) < len(m.typeMap) { + return m.typeMap[tok] + } + return "unknown" +} + +func (m TokenMap) Type(tok string) Type { + if typ, exist := m.idMap[tok]; exist { + return typ + } + return INVALID +} + +func (m TokenMap) TokenString(tok *Token) string { + return fmt.Sprintf("%s(%d,<%s>)", m.Id(tok.Type), tok.Type, tok.Lit) +} + +func (m TokenMap) StringType(typ Type) string { + return fmt.Sprintf("%s(%d)", m.Id(typ), typ) +} + +var TokMap = TokenMap{ + typeMap: []string{ + "INVALID", + "Ω", + "id", + }, + + idMap: map[string]Type{ + "INVALID": 0, + "Ω": 1, + "id": 2, + }, +} diff --git a/example/errorrecovery/internal/util/litconv.go b/example/errorrecovery/internal/util/litconv.go new file mode 100644 index 00000000..1aeb6166 --- /dev/null +++ b/example/errorrecovery/internal/util/litconv.go @@ -0,0 +1,108 @@ +// Code generated by gocc; DO NOT EDIT. + +package util + +import ( + "fmt" + "strconv" + "unicode" + "unicode/utf8" +) + +/* Interface */ + +/* +Convert the literal value of a scanned token to rune +*/ +func RuneValue(lit []byte) rune { + if lit[1] == '\\' { + return escapeCharVal(lit) + } + r, size := utf8.DecodeRune(lit[1:]) + if size != len(lit)-2 { + panic(fmt.Sprintf("Error decoding rune. Lit: %s, rune: %d, size%d\n", lit, r, size)) + } + return r +} + +/* +Convert the literal value of a scanned token to int64 +*/ +func IntValue(lit []byte) (int64, error) { + return strconv.ParseInt(string(lit), 10, 64) +} + +/* +Convert the literal value of a scanned token to uint64 +*/ +func UintValue(lit []byte) (uint64, error) { + return strconv.ParseUint(string(lit), 10, 64) +} + +/* Util */ + +func escapeCharVal(lit []byte) rune { + var i, base, max uint32 + offset := 2 + switch lit[offset] { + case 'a': + return '\a' + case 'b': + return '\b' + case 'f': + return '\f' + case 'n': + return '\n' + case 'r': + return '\r' + case 't': + return '\t' + case 'v': + return '\v' + case '\\': + return '\\' + case '\'': + return '\'' + case '0', '1', '2', '3', '4', '5', '6', '7': + i, base, max = 3, 8, 255 + case 'x': + i, base, max = 2, 16, 255 + offset++ + case 'u': + i, base, max = 4, 16, unicode.MaxRune + offset++ + case 'U': + i, base, max = 8, 16, unicode.MaxRune + offset++ + default: + panic(fmt.Sprintf("Error decoding character literal: %s\n", lit)) + } + + var x uint32 + for ; i > 0 && offset < len(lit)-1; i-- { + ch, size := utf8.DecodeRune(lit[offset:]) + offset += size + d := uint32(digitVal(ch)) + if d >= base { + panic(fmt.Sprintf("charVal(%s): illegal character (%c) in escape sequence. size=%d, offset=%d", lit, ch, size, offset)) + } + x = x*base + d + } + if x > max || 0xD800 <= x && x < 0xE000 { + panic(fmt.Sprintf("Error decoding escape char value. Lit:%s, offset:%d, escape sequence is invalid Unicode code point\n", lit, offset)) + } + + return rune(x) +} + +func digitVal(ch rune) int { + switch { + case '0' <= ch && ch <= '9': + return int(ch) - '0' + case 'a' <= ch && ch <= 'f': + return int(ch) - 'a' + 10 + case 'A' <= ch && ch <= 'F': + return int(ch) - 'A' + 10 + } + return 16 // larger than any legal digit val +} diff --git a/example/errorrecovery/internal/util/rune.go b/example/errorrecovery/internal/util/rune.go new file mode 100644 index 00000000..bd8523a4 --- /dev/null +++ b/example/errorrecovery/internal/util/rune.go @@ -0,0 +1,39 @@ +// Code generated by gocc; DO NOT EDIT. + +package util + +import ( + "fmt" +) + +func RuneToString(r rune) string { + if r >= 0x20 && r < 0x7f { + return fmt.Sprintf("'%c'", r) + } + switch r { + case 0x07: + return "'\\a'" + case 0x08: + return "'\\b'" + case 0x0C: + return "'\\f'" + case 0x0A: + return "'\\n'" + case 0x0D: + return "'\\r'" + case 0x09: + return "'\\t'" + case 0x0b: + return "'\\v'" + case 0x5c: + return "'\\\\\\'" + case 0x27: + return "'\\''" + case 0x22: + return "'\\\"'" + } + if r < 0x10000 { + return fmt.Sprintf("\\u%04x", r) + } + return fmt.Sprintf("\\U%08x", r) +} diff --git a/example/errorrecovery/main/main.go b/example/errorrecovery/main/main.go new file mode 100644 index 00000000..f31ff541 --- /dev/null +++ b/example/errorrecovery/main/main.go @@ -0,0 +1,53 @@ +package main + +import ( + "flag" + "fmt" + "os" + "strings" + + errorrecovery "github.com/maxcalandrelli/gocc/example/errorrecovery" +) + +func showResult(r interface{}, e error, l int) { + if e != nil { + fmt.Fprintf(os.Stderr, "parsing returned the following error: %s\n", e.Error()) + } else { + fmt.Printf("r=%#v, %d bytes\n", r, l) + } +} + +var ( + File string + Text string + Longest bool +) + +func parse(longest bool, lex *errorrecovery.Lexer) (res interface{}, err error, ptl int) { + if longest { + return errorrecovery.NewParser().ParseLongestPrefix(lex) + } else { + return errorrecovery.NewParser().Parse(lex) + } + return +} + +func main() { + flag.StringVar(&File, "file", "", "parse also text in file") + flag.StringVar(&Text, "text", "", "parse also text given with flag") + flag.BoolVar(&Longest, "longest", false, "parse longest possible part") + flag.Parse() + if Text > "" { + showResult(parse(Longest, errorrecovery.NewLexerString(Text))) + } + if File > "" { + l, e := errorrecovery.NewLexerFile(File) + if e != nil { + panic(e) + } + showResult(parse(Longest, l)) + } + if str := strings.Join(flag.Args(), " "); str > "" { + showResult(parse(Longest, errorrecovery.NewLexerString(str))) + } +} diff --git a/example/mail/iface/iface.go b/example/mail/iface/iface.go new file mode 100644 index 00000000..6774b3cc --- /dev/null +++ b/example/mail/iface/iface.go @@ -0,0 +1,30 @@ +// Code generated by gocc; DO NOT EDIT. + +package iface + +import ( + "github.com/maxcalandrelli/gocc/example/mail/internal/token" + "io" +) + +type ( + Scanner interface { + Scan() (tok *token.Token) + GetStream() TokenStream + } + + CheckPoint interface { + DistanceFrom(CheckPoint) int + } + + CheckPointable interface { + GetCheckPoint() CheckPoint + GotoCheckPoint(CheckPoint) + } + + TokenStream interface { + io.Reader + io.RuneScanner + io.Seeker + } +) diff --git a/example/mail/internal/io/stream/internal/stream_impl.go b/example/mail/internal/io/stream/internal/stream_impl.go new file mode 100644 index 00000000..358aa160 --- /dev/null +++ b/example/mail/internal/io/stream/internal/stream_impl.go @@ -0,0 +1,275 @@ +package internal + +import ( + "io" + "sync" + "unicode/utf8" +) + +type ( + impl_WindowReader struct { + bufferBlockSize int + maxBufferSize int + buffers [][]byte + available int + absbase int64 + position int + eof bool + rdr io.Reader + lock *sync.Mutex + } +) + +func (s *impl_WindowReader) lockReader() { + if s.lock != nil { + s.lock.Lock() + } +} + +func (s *impl_WindowReader) unlockReader() { + if s.lock != nil { + s.lock.Unlock() + } +} + +func (s *impl_WindowReader) seek(offset int64, whence int) (offs int64, err error) { + switch whence { + case io.SeekStart: + return s.seek(offset-s.ReadPosition(), io.SeekCurrent) + case io.SeekCurrent: + switch { + case offset == 0: + return s.ReadPosition(), nil + case offset < 0: + if -offset > int64(s.maxBackOffset()) { + err = io.ErrShortBuffer + } else { + s.advanceGet(int(offset)) + } + case offset > 0: + for offset > 0 && !s.eof { + available := s.Buffered() + if offset <= int64(available) { + s.advanceGet(int(offset)) + break + } + if available > 0 { + s.advanceGet(available) + offset -= int64(available) + } + read, _ := s.fetchBytes(int(offset)) + s.advanceGet(read) + offset -= int64(read) + } + if s.eof { + err = io.EOF + } + } + case io.SeekEnd: + for !s.eof { + s.seek(int64(s.MaxCap()), io.SeekCurrent) + } + s.seek(int64(s.Buffered()), io.SeekCurrent) + } + if s.eof && err == nil && s.Buffered() > 0 { + s.eof = false + } + return s.ReadPosition(), err +} + +func (s impl_WindowReader) maxBackOffset() int { + r := s.position + if s.absbase > 0 { + r = s.Cap() - s.Buffered() + } + return r +} + +func (s impl_WindowReader) bufferIndex(pos int) int { + if pos < 0 { + panic("negative position") + } + return pos / s.bufferBlockSize +} + +func (s impl_WindowReader) bufferBytes(pos int) []byte { + return s.buffers[s.bufferIndex(pos)] +} + +func (s impl_WindowReader) bufferByteRange(pos int, length int) []byte { + p := s.bufferOffset(pos) + return s.bufferBytes(pos)[p : p+length] +} + +func (s impl_WindowReader) bufferOffset(pos int) int { + return pos % s.bufferBlockSize +} + +func (s *impl_WindowReader) advanceGet(n int) { + sz := s.Cap() + switch { + case n < 0: + if -n > s.maxBackOffset() { + panic("underflow") + } + s.position += n + if s.position < 0 { + s.position += sz + s.absbase -= int64(sz) + } + case n > 0: + if n > s.Buffered() { + panic("overflow") + } + s.position += n + if s.position >= sz { + s.position -= sz + s.absbase += int64(sz) + } + } + s.available -= n +} + +func (s *impl_WindowReader) copy(to []byte, length int) { + for offs, cp := 0, 0; length > 0; length -= cp { + s.position %= s.MaxCap() + p := s.bufferOffset(s.position) + b := s.bufferBytes(s.position) + r := s.bufferBlockSize - p + if length <= r { + cp = copy(to[offs:], b[p:p+length]) + } else { + cp = copy(to[offs:], b[p:]) + } + s.advanceGet(cp) + offs += cp + } +} + +func (s *impl_WindowReader) fetchBytes(n int) (read int, err error) { + if s.rdr == nil { + s.eof = true + return 0, io.EOF + } + for n > 0 && s.Buffered() < s.MaxCap() && err == nil { + readNow := n + putpos := s.position + s.available + r := s.bufferBlockSize - s.bufferOffset(putpos) + if readNow > r { + readNow = r + } + for s.bufferIndex(putpos) >= len(s.buffers) && s.Cap() < s.MaxCap() { + s.buffers = append(s.buffers, make([]byte, s.bufferBlockSize)) + } + putpos %= s.MaxCap() + offs := s.bufferOffset(putpos) + if r, err = s.rdr.Read(s.bufferBytes(putpos)[offs : offs+readNow]); r > 0 { + s.available += r + read += r + n -= r + } + } + if n > 0 && err == nil { + err = io.ErrShortBuffer + } + return +} + +func (s *impl_WindowReader) read(p []byte) (read int, err error) { + if s.eof { + return 0, io.EOF + } + for read < len(p) && err == nil { + available := s.Buffered() + if len(p)-read <= available { + s.copy(p[read:], len(p)-read) + read = len(p) + } else { + if available == 0 { + available, err = s.fetchBytes(len(p) - read) + } + s.copy(p[read:], available) + read += available + switch err { + case io.ErrShortBuffer: + err = nil + case io.EOF: + s.eof = true + } + } + } + return +} + +func (s impl_WindowReader) peekByte() (byte, error) { + if s.Buffered() < 1 { + return 0, io.ErrShortBuffer + } + return s.bufferBytes(s.position)[s.bufferOffset(s.position)], nil +} + +func (s *impl_WindowReader) unreadByte() error { + _, e := s.seek(-1, io.SeekCurrent) + return e +} + +func (s *impl_WindowReader) readRune() (r rune, size int, err error) { + for i := 1; err == nil && i <= 4; i++ { + if s.Buffered() < i { + if _, err = s.fetchBytes(i); err != nil { + return + } + } + t := s.bufferByteRange(s.position, i) + if r, size = utf8.DecodeRune(t); r != utf8.RuneError { + s.advanceGet(size) + return + } + } + return utf8.RuneError, 0, err +} + +func (s *impl_WindowReader) unreadRune() (err error) { + tmps := *s + tmpb := []byte{} + for { + if _, err = tmps.seek(-1, io.SeekCurrent); err == nil { + b, _ := tmps.peekByte() + tmpb = append([]byte{b}, tmpb...) + switch len(tmpb) { + case 1: + if (tmpb[0] & 0xC0) == 0x80 { + continue + } + _, err = s.seek(-int64(len(tmpb)), io.SeekCurrent) + return + case 2: + if (tmpb[0] & 0xC0) == 0x80 { + continue + } + if (tmpb[0] & 0xE0) != 0xC0 { + break + } + _, err = s.seek(-int64(len(tmpb)), io.SeekCurrent) + return + case 3: + if (tmpb[0] & 0xC0) == 0x80 { + continue + } + if (tmpb[0] & 0xF0) != 0xE0 { + break + } + _, err = s.seek(-int64(len(tmpb)), io.SeekCurrent) + return + case 4: + if (tmpb[0] & 0xF8) != 0xF0 { + break + } + _, err = s.seek(-int64(len(tmpb)), io.SeekCurrent) + return + } + } + } + _, err = s.seek(-1, io.SeekCurrent) + return +} diff --git a/example/mail/internal/io/stream/internal/stream_public.go b/example/mail/internal/io/stream/internal/stream_public.go new file mode 100644 index 00000000..20ed7b5e --- /dev/null +++ b/example/mail/internal/io/stream/internal/stream_public.go @@ -0,0 +1,101 @@ +package internal + +import ( + "io" +) + +func NewWindowReader(buf []byte, underlyingReader io.Reader, blksize, smax int, InfoPrefixRoundUp bool) *impl_WindowReader { + if blksize < 0 || smax < blksize { + panic("illegal buffer size") + } + r := &impl_WindowReader{rdr: underlyingReader} + r.bufferBlockSize = blksize + if underlyingReader != nil { + if blksize <= 0 { + r.bufferBlockSize = 1 << 10 + } else if InfoPrefixRoundUp { + for r.bufferBlockSize = 1; blksize > 0; r.bufferBlockSize = r.bufferBlockSize << 1 { + blksize = blksize >> 1 + } + } + if smax > 0 { + r.maxBufferSize = ((smax-1)/r.bufferBlockSize + 1) * r.bufferBlockSize + } + r.buffers = [][]byte{} + } else { + r.buffers = [][]byte{buf} + r.available = len(buf) + r.bufferBlockSize = r.available + r.maxBufferSize = r.available + } + return r +} + +func (s impl_WindowReader) Cap() int { + return len(s.buffers) * s.bufferBlockSize +} + +func (s impl_WindowReader) BlockSize() int { + return s.bufferBlockSize +} + +func (s impl_WindowReader) MaxCap() int { + if s.maxBufferSize > 0 { + return s.maxBufferSize + } + return 1 << 31 +} + +func (s impl_WindowReader) MaxUnreadSize() int { + return s.maxBackOffset() +} + +func (s impl_WindowReader) Buffered() int { + return s.available +} + +func (s impl_WindowReader) ReadPosition() int64 { + return s.absbase + int64(s.position) +} + +func (s *impl_WindowReader) Read(p []byte) (read int, err error) { + s.lockReader() + defer func() { s.unlockReader() }() + return s.read(p) +} + +func (s *impl_WindowReader) Seek(offset int64, whence int) (offs int64, err error) { + s.lockReader() + defer func() { s.unlockReader() }() + return s.seek(offset, whence) +} + +func (s *impl_WindowReader) ReadByte() (byte, error) { + b := []byte{0} + _, err := s.Read(b) + return b[0], err +} + +func (s *impl_WindowReader) PeekByte() (byte, error) { + s.lockReader() + defer func() { s.unlockReader() }() + return s.peekByte() +} + +func (s *impl_WindowReader) UnreadByte() error { + s.lockReader() + defer func() { s.unlockReader() }() + return s.unreadByte() +} + +func (s *impl_WindowReader) ReadRune() (r rune, size int, err error) { + s.lockReader() + defer func() { s.unlockReader() }() + return s.readRune() +} + +func (s *impl_WindowReader) UnreadRune() (err error) { + s.lockReader() + defer func() { s.unlockReader() }() + return s.unreadRune() +} diff --git a/example/mail/internal/io/stream/stream.go b/example/mail/internal/io/stream/stream.go new file mode 100644 index 00000000..eb4b534f --- /dev/null +++ b/example/mail/internal/io/stream/stream.go @@ -0,0 +1,39 @@ +package stream + +import ( + internal "github.com/maxcalandrelli/gocc/example/mail/internal/io/stream/internal" + "io" +) + +type ( + WindowReader interface { + BlockSize() int + Buffered() int + Cap() int + MaxCap() int + Read([]byte) (int, error) + ReadByte() (byte, error) + ReadPosition() int64 + ReadRune() (rune, int, error) + Seek(int64, int) (int64, error) + UnreadByte() error + UnreadRune() error + MaxUnreadSize() int + } +) + +var ( + InfoPrefixRoundUp = false +) + +func NewWindowReaderFromBytes(src []byte) WindowReader { + return internal.NewWindowReader(src, nil, 0, 0, InfoPrefixRoundUp) +} + +func NewWindowReader(rdr io.Reader) WindowReader { + return internal.NewWindowReader(nil, rdr, 0, 0, false) +} + +func NewLimitedWindowReader(rdr io.Reader, sizeMin, sizeMax int) WindowReader { + return internal.NewWindowReader(nil, rdr, sizeMin, sizeMax, InfoPrefixRoundUp) +} diff --git a/example/mail/internal/lexer/acttab.go b/example/mail/internal/lexer/acttab.go new file mode 100644 index 00000000..d876c8f3 --- /dev/null +++ b/example/mail/internal/lexer/acttab.go @@ -0,0 +1,83 @@ +// Code generated by gocc; DO NOT EDIT. + +package lexer + +import ( + "fmt" + + "github.com/maxcalandrelli/gocc/example/mail/internal/token" +) + +type ActionTable [NumStates]ActionRow + +type ActionRow struct { + Accept token.Type + Ignore string +} + +func (a ActionRow) String() string { + return fmt.Sprintf("Accept=%d, Ignore=%s", a.Accept, a.Ignore) +} + +var ActTab = ActionTable{ + ActionRow{ // S0, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S1, Ignore("!whitespace") + Accept: -1, + Ignore: "!whitespace", + }, + ActionRow{ // S2, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S3, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S4, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S5, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S6, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S7, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S8, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S9, Accept("addrspec") + Accept: 2, + Ignore: "", + }, + ActionRow{ // S10, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S11, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S12, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S13, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S14, Accept("addrspec") + Accept: 2, + Ignore: "", + }, +} diff --git a/example/mail/internal/lexer/lexer.go b/example/mail/internal/lexer/lexer.go new file mode 100644 index 00000000..a60677fa --- /dev/null +++ b/example/mail/internal/lexer/lexer.go @@ -0,0 +1,153 @@ +// Code generated by gocc; DO NOT EDIT. + +package lexer + +import ( + + "io" + "bytes" + "os" + + + "github.com/maxcalandrelli/gocc/example/mail/iface" + "github.com/maxcalandrelli/gocc/example/mail/internal/token" + "github.com/maxcalandrelli/gocc/example/mail/internal/io/stream" +) + +const ( + NoState = -1 + NumStates = 15 + NumSymbols = 33 + INVALID_RUNE = rune(-1) +) + +type position struct { + token.Pos +} + +type Lexer struct { + position + stream iface.TokenStream + eof bool +} + +func NewLexerBytes(src []byte) *Lexer { + lexer := &Lexer{stream: bytes.NewReader(src)} + lexer.reset() + return lexer +} + +func NewLexerFile(fpath string) (*Lexer, error) { + s, err := os.Open(fpath) + if err != nil { + return nil, err + } + lexer := &Lexer{stream: stream.NewWindowReader(s)} + lexer.reset() + return lexer, nil +} + +func NewLexer(reader io.Reader) (*Lexer, error) { + lexer := &Lexer{} + lexer.reset() + if lexer.stream, _ = reader.(iface.TokenStream); lexer.stream == nil { + lexer.stream = stream.NewWindowReader(reader) + } + return lexer, nil +} + +func (l *Lexer) reset () { + l.position.Reset() +} + +func (l Lexer) GetStream() iface.TokenStream { + return l.stream +} + +type checkPoint int64 + +func (c checkPoint) DistanceFrom (o iface.CheckPoint) int { + return int (c - o.(checkPoint)) +} + +func (l Lexer) GetCheckPoint() iface.CheckPoint { + pos, _ := l.stream.Seek(0, io.SeekCurrent) + return checkPoint(pos) +} + +func (l Lexer) GotoCheckPoint(cp iface.CheckPoint) { + l.stream.Seek(int64(cp.(checkPoint)), io.SeekStart) +} + +func (l *Lexer) Scan() (tok *token.Token) { + tok = new(token.Token) + tok.Type = token.INVALID + tok.Lit = []byte{} + start := l.position + state := 0 + for state != -1 { + curr, size, err := l.stream.ReadRune() + if size < 1 || err != nil { + curr = INVALID_RUNE + } + if size > 0 { + l.position.Pos.Offset += size + } + nextState := -1 + if curr != INVALID_RUNE { + nextState = TransTab[state](curr) + } + state = nextState + if state != -1 { + switch curr { + case '\n': + l.position.Pos.Line++ + l.position.Pos.Column = 1 + case '\r': + l.position.Pos.Column = 1 + case '\t': + l.position.Pos.Column += 4 + default: + l.position.Pos.Column++ + } + switch { + case ActTab[state].Accept != -1: + tok.Type = ActTab[state].Accept + tok.Lit = append(tok.Lit, string(curr)...) + case ActTab[state].Ignore != "": + start = l.position + state = 0 + tok.Lit = []byte{} + } + } else if curr != INVALID_RUNE { + l.stream.UnreadRune() + } + if err == io.EOF && len(tok.Lit)==0 { + tok.Type = token.EOF + tok.Pos = start.Pos + return + } + } + tok.Pos = start.Pos + return +} + +func (l *Lexer) Reset() { + l.position.Reset() +} + +func (l Lexer) CurrentPosition() position { + return l.position +} + +func (p *position) Reset() { + p.Offset = 0 + p.Line = 1 + p.Column = 1 +} + +func (p position) StartingFrom(base position) position { + r := p + r.Pos = p.Pos.StartingFrom(base.Pos) + return r +} diff --git a/example/mail/internal/lexer/transitiontable.go b/example/mail/internal/lexer/transitiontable.go new file mode 100644 index 00000000..d3c1c3a4 --- /dev/null +++ b/example/mail/internal/lexer/transitiontable.go @@ -0,0 +1,510 @@ +// Code generated by gocc; DO NOT EDIT. + +package lexer + +/* +Let s be the current state +Let r be the current input rune +transitionTable[s](r) returns the next state. +*/ +type TransitionTable [NumStates]func(rune) int + +var TransTab = TransitionTable{ + // S0 + func(r rune) int { + switch { + case r == 9: // ['\t','\t'] + return 1 + case r == 10: // ['\n','\n'] + return 1 + case r == 13: // ['\r','\r'] + return 1 + case r == 32: // [' ',' '] + return 1 + case r == 33: // ['!','!'] + return 2 + case r == 34: // ['"','"'] + return 3 + case r == 35: // ['#','#'] + return 2 + case r == 36: // ['$','$'] + return 2 + case r == 37: // ['%','%'] + return 2 + case r == 38: // ['&','&'] + return 2 + case r == 39: // [''','''] + return 2 + case r == 42: // ['*','*'] + return 2 + case r == 43: // ['+','+'] + return 2 + case r == 45: // ['-','-'] + return 2 + case r == 47: // ['/','/'] + return 2 + case 48 <= r && r <= 57: // ['0','9'] + return 2 + case r == 61: // ['=','='] + return 2 + case r == 63: // ['?','?'] + return 2 + case 65 <= r && r <= 90: // ['A','Z'] + return 2 + case r == 94: // ['^','^'] + return 2 + case r == 95: // ['_','_'] + return 2 + case r == 96: // ['`','`'] + return 2 + case 97 <= r && r <= 122: // ['a','z'] + return 2 + case r == 123: // ['{','{'] + return 2 + case r == 124: // ['|','|'] + return 2 + case r == 125: // ['}','}'] + return 2 + case r == 126: // ['~','~'] + return 2 + case 256 <= r && r <= 1114111: // [\u0100,\U0010ffff] + return 2 + } + return NoState + }, + // S1 + func(r rune) int { + switch { + } + return NoState + }, + // S2 + func(r rune) int { + switch { + case r == 33: // ['!','!'] + return 2 + case r == 35: // ['#','#'] + return 2 + case r == 36: // ['$','$'] + return 2 + case r == 37: // ['%','%'] + return 2 + case r == 38: // ['&','&'] + return 2 + case r == 39: // [''','''] + return 2 + case r == 42: // ['*','*'] + return 2 + case r == 43: // ['+','+'] + return 2 + case r == 45: // ['-','-'] + return 2 + case r == 46: // ['.','.'] + return 4 + case r == 47: // ['/','/'] + return 2 + case 48 <= r && r <= 57: // ['0','9'] + return 2 + case r == 61: // ['=','='] + return 2 + case r == 63: // ['?','?'] + return 2 + case r == 64: // ['@','@'] + return 5 + case 65 <= r && r <= 90: // ['A','Z'] + return 2 + case r == 94: // ['^','^'] + return 2 + case r == 95: // ['_','_'] + return 2 + case r == 96: // ['`','`'] + return 2 + case 97 <= r && r <= 122: // ['a','z'] + return 2 + case r == 123: // ['{','{'] + return 2 + case r == 124: // ['|','|'] + return 2 + case r == 125: // ['}','}'] + return 2 + case r == 126: // ['~','~'] + return 2 + case 256 <= r && r <= 1114111: // [\u0100,\U0010ffff] + return 2 + } + return NoState + }, + // S3 + func(r rune) int { + switch { + case r == 92: // ['\','\'] + return 6 + default: + return 7 + } + }, + // S4 + func(r rune) int { + switch { + case r == 33: // ['!','!'] + return 8 + case r == 35: // ['#','#'] + return 8 + case r == 36: // ['$','$'] + return 8 + case r == 37: // ['%','%'] + return 8 + case r == 38: // ['&','&'] + return 8 + case r == 39: // [''','''] + return 8 + case r == 42: // ['*','*'] + return 8 + case r == 43: // ['+','+'] + return 8 + case r == 45: // ['-','-'] + return 8 + case r == 47: // ['/','/'] + return 8 + case 48 <= r && r <= 57: // ['0','9'] + return 8 + case r == 61: // ['=','='] + return 8 + case r == 63: // ['?','?'] + return 8 + case 65 <= r && r <= 90: // ['A','Z'] + return 8 + case r == 94: // ['^','^'] + return 8 + case r == 95: // ['_','_'] + return 8 + case r == 96: // ['`','`'] + return 8 + case 97 <= r && r <= 122: // ['a','z'] + return 8 + case r == 123: // ['{','{'] + return 8 + case r == 124: // ['|','|'] + return 8 + case r == 125: // ['}','}'] + return 8 + case r == 126: // ['~','~'] + return 8 + case 256 <= r && r <= 1114111: // [\u0100,\U0010ffff] + return 8 + } + return NoState + }, + // S5 + func(r rune) int { + switch { + case r == 33: // ['!','!'] + return 9 + case r == 35: // ['#','#'] + return 9 + case r == 36: // ['$','$'] + return 9 + case r == 37: // ['%','%'] + return 9 + case r == 38: // ['&','&'] + return 9 + case r == 39: // [''','''] + return 9 + case r == 42: // ['*','*'] + return 9 + case r == 43: // ['+','+'] + return 9 + case r == 45: // ['-','-'] + return 9 + case r == 47: // ['/','/'] + return 9 + case 48 <= r && r <= 57: // ['0','9'] + return 9 + case r == 61: // ['=','='] + return 9 + case r == 63: // ['?','?'] + return 9 + case 65 <= r && r <= 90: // ['A','Z'] + return 9 + case r == 94: // ['^','^'] + return 9 + case r == 95: // ['_','_'] + return 9 + case r == 96: // ['`','`'] + return 9 + case 97 <= r && r <= 122: // ['a','z'] + return 9 + case r == 123: // ['{','{'] + return 9 + case r == 124: // ['|','|'] + return 9 + case r == 125: // ['}','}'] + return 9 + case r == 126: // ['~','~'] + return 9 + case 256 <= r && r <= 1114111: // [\u0100,\U0010ffff] + return 9 + } + return NoState + }, + // S6 + func(r rune) int { + switch { + default: + return 10 + } + }, + // S7 + func(r rune) int { + switch { + case r == 34: // ['"','"'] + return 11 + case r == 92: // ['\','\'] + return 12 + default: + return 7 + } + }, + // S8 + func(r rune) int { + switch { + case r == 33: // ['!','!'] + return 8 + case r == 35: // ['#','#'] + return 8 + case r == 36: // ['$','$'] + return 8 + case r == 37: // ['%','%'] + return 8 + case r == 38: // ['&','&'] + return 8 + case r == 39: // [''','''] + return 8 + case r == 42: // ['*','*'] + return 8 + case r == 43: // ['+','+'] + return 8 + case r == 45: // ['-','-'] + return 8 + case r == 46: // ['.','.'] + return 4 + case r == 47: // ['/','/'] + return 8 + case 48 <= r && r <= 57: // ['0','9'] + return 8 + case r == 61: // ['=','='] + return 8 + case r == 63: // ['?','?'] + return 8 + case r == 64: // ['@','@'] + return 5 + case 65 <= r && r <= 90: // ['A','Z'] + return 8 + case r == 94: // ['^','^'] + return 8 + case r == 95: // ['_','_'] + return 8 + case r == 96: // ['`','`'] + return 8 + case 97 <= r && r <= 122: // ['a','z'] + return 8 + case r == 123: // ['{','{'] + return 8 + case r == 124: // ['|','|'] + return 8 + case r == 125: // ['}','}'] + return 8 + case r == 126: // ['~','~'] + return 8 + case 256 <= r && r <= 1114111: // [\u0100,\U0010ffff] + return 8 + } + return NoState + }, + // S9 + func(r rune) int { + switch { + case r == 33: // ['!','!'] + return 9 + case r == 35: // ['#','#'] + return 9 + case r == 36: // ['$','$'] + return 9 + case r == 37: // ['%','%'] + return 9 + case r == 38: // ['&','&'] + return 9 + case r == 39: // [''','''] + return 9 + case r == 42: // ['*','*'] + return 9 + case r == 43: // ['+','+'] + return 9 + case r == 45: // ['-','-'] + return 9 + case r == 46: // ['.','.'] + return 13 + case r == 47: // ['/','/'] + return 9 + case 48 <= r && r <= 57: // ['0','9'] + return 9 + case r == 61: // ['=','='] + return 9 + case r == 63: // ['?','?'] + return 9 + case 65 <= r && r <= 90: // ['A','Z'] + return 9 + case r == 94: // ['^','^'] + return 9 + case r == 95: // ['_','_'] + return 9 + case r == 96: // ['`','`'] + return 9 + case 97 <= r && r <= 122: // ['a','z'] + return 9 + case r == 123: // ['{','{'] + return 9 + case r == 124: // ['|','|'] + return 9 + case r == 125: // ['}','}'] + return 9 + case r == 126: // ['~','~'] + return 9 + case 256 <= r && r <= 1114111: // [\u0100,\U0010ffff] + return 9 + } + return NoState + }, + // S10 + func(r rune) int { + switch { + case r == 34: // ['"','"'] + return 11 + case r == 92: // ['\','\'] + return 12 + default: + return 7 + } + }, + // S11 + func(r rune) int { + switch { + case r == 64: // ['@','@'] + return 5 + } + return NoState + }, + // S12 + func(r rune) int { + switch { + default: + return 10 + } + }, + // S13 + func(r rune) int { + switch { + case r == 33: // ['!','!'] + return 14 + case r == 35: // ['#','#'] + return 14 + case r == 36: // ['$','$'] + return 14 + case r == 37: // ['%','%'] + return 14 + case r == 38: // ['&','&'] + return 14 + case r == 39: // [''','''] + return 14 + case r == 42: // ['*','*'] + return 14 + case r == 43: // ['+','+'] + return 14 + case r == 45: // ['-','-'] + return 14 + case r == 47: // ['/','/'] + return 14 + case 48 <= r && r <= 57: // ['0','9'] + return 14 + case r == 61: // ['=','='] + return 14 + case r == 63: // ['?','?'] + return 14 + case 65 <= r && r <= 90: // ['A','Z'] + return 14 + case r == 94: // ['^','^'] + return 14 + case r == 95: // ['_','_'] + return 14 + case r == 96: // ['`','`'] + return 14 + case 97 <= r && r <= 122: // ['a','z'] + return 14 + case r == 123: // ['{','{'] + return 14 + case r == 124: // ['|','|'] + return 14 + case r == 125: // ['}','}'] + return 14 + case r == 126: // ['~','~'] + return 14 + case 256 <= r && r <= 1114111: // [\u0100,\U0010ffff] + return 14 + } + return NoState + }, + // S14 + func(r rune) int { + switch { + case r == 33: // ['!','!'] + return 14 + case r == 35: // ['#','#'] + return 14 + case r == 36: // ['$','$'] + return 14 + case r == 37: // ['%','%'] + return 14 + case r == 38: // ['&','&'] + return 14 + case r == 39: // [''','''] + return 14 + case r == 42: // ['*','*'] + return 14 + case r == 43: // ['+','+'] + return 14 + case r == 45: // ['-','-'] + return 14 + case r == 46: // ['.','.'] + return 13 + case r == 47: // ['/','/'] + return 14 + case 48 <= r && r <= 57: // ['0','9'] + return 14 + case r == 61: // ['=','='] + return 14 + case r == 63: // ['?','?'] + return 14 + case 65 <= r && r <= 90: // ['A','Z'] + return 14 + case r == 94: // ['^','^'] + return 14 + case r == 95: // ['_','_'] + return 14 + case r == 96: // ['`','`'] + return 14 + case 97 <= r && r <= 122: // ['a','z'] + return 14 + case r == 123: // ['{','{'] + return 14 + case r == 124: // ['|','|'] + return 14 + case r == 125: // ['}','}'] + return 14 + case r == 126: // ['~','~'] + return 14 + case 256 <= r && r <= 1114111: // [\u0100,\U0010ffff] + return 14 + } + return NoState + }, +} diff --git a/example/mail/internal/token/token.go b/example/mail/internal/token/token.go new file mode 100644 index 00000000..cefacb55 --- /dev/null +++ b/example/mail/internal/token/token.go @@ -0,0 +1,87 @@ +// Code generated by gocc; DO NOT EDIT. + +package token + +import ( + "fmt" +) + +type Token struct { + Type + Lit []byte + Pos + ForeignAstNode interface{} + Foreign bool +} + +type Type int + +const ( + INVALID Type = iota + EOF +) + +type Pos struct { + Offset int + Line int + Column int +} + +func (p Pos) String() string { + return fmt.Sprintf("Pos(offset=%d, line=%d, column=%d)", p.Offset, p.Line, p.Column) +} + +func (p Pos) StartingFrom(base Pos) Pos { + r := base + r.Offset += p.Offset + r.Line += p.Line + r.Column = p.Column + if p.Line > 0 && base.Line > 0 { + r.Line-- + } + if r.Column < 1 { + r.Column = 1 + } + return r +} + +type TokenMap struct { + typeMap []string + idMap map[string]Type +} + +func (m TokenMap) Id(tok Type) string { + if int(tok) < len(m.typeMap) { + return m.typeMap[tok] + } + return "unknown" +} + +func (m TokenMap) Type(tok string) Type { + if typ, exist := m.idMap[tok]; exist { + return typ + } + return INVALID +} + +func (m TokenMap) TokenString(tok *Token) string { + return fmt.Sprintf("%s(%d,<%s>)", m.Id(tok.Type), tok.Type, tok.Lit) +} + +func (m TokenMap) StringType(typ Type) string { + return fmt.Sprintf("%s(%d)", m.Id(typ), typ) +} + +var TokMap = TokenMap{ + typeMap: []string{ + "INVALID", + "Ω", + "addrspec", + }, + + idMap: map[string]Type{ + "INVALID": 0, + "Ω": 1, + "addrspec": 2, + }, +} diff --git a/example/mail/internal/util/litconv.go b/example/mail/internal/util/litconv.go new file mode 100644 index 00000000..1aeb6166 --- /dev/null +++ b/example/mail/internal/util/litconv.go @@ -0,0 +1,108 @@ +// Code generated by gocc; DO NOT EDIT. + +package util + +import ( + "fmt" + "strconv" + "unicode" + "unicode/utf8" +) + +/* Interface */ + +/* +Convert the literal value of a scanned token to rune +*/ +func RuneValue(lit []byte) rune { + if lit[1] == '\\' { + return escapeCharVal(lit) + } + r, size := utf8.DecodeRune(lit[1:]) + if size != len(lit)-2 { + panic(fmt.Sprintf("Error decoding rune. Lit: %s, rune: %d, size%d\n", lit, r, size)) + } + return r +} + +/* +Convert the literal value of a scanned token to int64 +*/ +func IntValue(lit []byte) (int64, error) { + return strconv.ParseInt(string(lit), 10, 64) +} + +/* +Convert the literal value of a scanned token to uint64 +*/ +func UintValue(lit []byte) (uint64, error) { + return strconv.ParseUint(string(lit), 10, 64) +} + +/* Util */ + +func escapeCharVal(lit []byte) rune { + var i, base, max uint32 + offset := 2 + switch lit[offset] { + case 'a': + return '\a' + case 'b': + return '\b' + case 'f': + return '\f' + case 'n': + return '\n' + case 'r': + return '\r' + case 't': + return '\t' + case 'v': + return '\v' + case '\\': + return '\\' + case '\'': + return '\'' + case '0', '1', '2', '3', '4', '5', '6', '7': + i, base, max = 3, 8, 255 + case 'x': + i, base, max = 2, 16, 255 + offset++ + case 'u': + i, base, max = 4, 16, unicode.MaxRune + offset++ + case 'U': + i, base, max = 8, 16, unicode.MaxRune + offset++ + default: + panic(fmt.Sprintf("Error decoding character literal: %s\n", lit)) + } + + var x uint32 + for ; i > 0 && offset < len(lit)-1; i-- { + ch, size := utf8.DecodeRune(lit[offset:]) + offset += size + d := uint32(digitVal(ch)) + if d >= base { + panic(fmt.Sprintf("charVal(%s): illegal character (%c) in escape sequence. size=%d, offset=%d", lit, ch, size, offset)) + } + x = x*base + d + } + if x > max || 0xD800 <= x && x < 0xE000 { + panic(fmt.Sprintf("Error decoding escape char value. Lit:%s, offset:%d, escape sequence is invalid Unicode code point\n", lit, offset)) + } + + return rune(x) +} + +func digitVal(ch rune) int { + switch { + case '0' <= ch && ch <= '9': + return int(ch) - '0' + case 'a' <= ch && ch <= 'f': + return int(ch) - 'a' + 10 + case 'A' <= ch && ch <= 'F': + return int(ch) - 'A' + 10 + } + return 16 // larger than any legal digit val +} diff --git a/example/mail/internal/util/rune.go b/example/mail/internal/util/rune.go new file mode 100644 index 00000000..bd8523a4 --- /dev/null +++ b/example/mail/internal/util/rune.go @@ -0,0 +1,39 @@ +// Code generated by gocc; DO NOT EDIT. + +package util + +import ( + "fmt" +) + +func RuneToString(r rune) string { + if r >= 0x20 && r < 0x7f { + return fmt.Sprintf("'%c'", r) + } + switch r { + case 0x07: + return "'\\a'" + case 0x08: + return "'\\b'" + case 0x0C: + return "'\\f'" + case 0x0A: + return "'\\n'" + case 0x0D: + return "'\\r'" + case 0x09: + return "'\\t'" + case 0x0b: + return "'\\v'" + case 0x5c: + return "'\\\\\\'" + case 0x27: + return "'\\''" + case 0x22: + return "'\\\"'" + } + if r < 0x10000 { + return fmt.Sprintf("\\u%04x", r) + } + return fmt.Sprintf("\\U%08x", r) +} diff --git a/example/mail/mail.go b/example/mail/mail.go new file mode 100644 index 00000000..a366d111 --- /dev/null +++ b/example/mail/mail.go @@ -0,0 +1,62 @@ +// Code generated by gocc; DO NOT EDIT. + +package mail + +import ( + "io" + + "github.com/maxcalandrelli/gocc/example/mail/iface" + "github.com/maxcalandrelli/gocc/example/mail/internal/io/stream" + "github.com/maxcalandrelli/gocc/example/mail/internal/lexer" + "github.com/maxcalandrelli/gocc/example/mail/internal/parser" + "github.com/maxcalandrelli/gocc/example/mail/internal/token" +) + +type ( + Token = token.Token + Lexer = lexer.Lexer + Parser = parser.Parser + TokenStream = iface.TokenStream + WindowReader = stream.WindowReader + Scanner = iface.Scanner +) + +func ParseFile(fpath string) (interface{}, error, int) { + if lexer, err := NewLexerFile(fpath); err == nil { + return NewParser().Parse(lexer) + } else { + return nil, err, 0 + } +} + +func ParseText(text string) (interface{}, error, int) { + return NewParser().Parse(NewLexerBytes([]byte(text))) +} + +func NewLexerBytes(src []byte) *lexer.Lexer { + return lexer.NewLexerBytes(src) +} + +func NewLexerString(src string) *lexer.Lexer { + return lexer.NewLexerBytes([]byte(src)) +} + +func NewLexerFile(fpath string) (*lexer.Lexer, error) { + return lexer.NewLexerFile(fpath) +} + +func NewParser() *parser.Parser { + return parser.NewParser() +} + +func NewWindowReaderFromBytes(src []byte) WindowReader { + return stream.NewWindowReaderFromBytes(src) +} + +func NewWindowReader(rdr io.Reader) WindowReader { + return stream.NewWindowReader(rdr) +} + +func NewLimitedWindowReader(rdr io.Reader, sizeMin, sizeMax int) WindowReader { + return stream.NewLimitedWindowReader(rdr, sizeMin, sizeMax) +} diff --git a/example/mail/main/main.go b/example/mail/main/main.go new file mode 100644 index 00000000..6a8a9ef4 --- /dev/null +++ b/example/mail/main/main.go @@ -0,0 +1,53 @@ +package main + +import ( + "flag" + "fmt" + "os" + "strings" + + mail "github.com/maxcalandrelli/gocc/example/mail" +) + +func showResult(r interface{}, e error, l int) { + if e != nil { + fmt.Fprintf(os.Stderr, "parsing returned the following error: %s\n", e.Error()) + } else { + fmt.Printf("r=%#v, %d bytes\n", r, l) + } +} + +var ( + File string + Text string + Longest bool +) + +func parse(longest bool, lex *mail.Lexer) (res interface{}, err error, ptl int) { + if longest { + return mail.NewParser().ParseLongestPrefix(lex) + } else { + return mail.NewParser().Parse(lex) + } + return +} + +func main() { + flag.StringVar(&File, "file", "", "parse also text in file") + flag.StringVar(&Text, "text", "", "parse also text given with flag") + flag.BoolVar(&Longest, "longest", false, "parse longest possible part") + flag.Parse() + if Text > "" { + showResult(parse(Longest, mail.NewLexerString(Text))) + } + if File > "" { + l, e := mail.NewLexerFile(File) + if e != nil { + panic(e) + } + showResult(parse(Longest, l)) + } + if str := strings.Join(flag.Args(), " "); str > "" { + showResult(parse(Longest, mail.NewLexerString(str))) + } +} diff --git a/example/nolexer/iface/iface.go b/example/nolexer/iface/iface.go new file mode 100644 index 00000000..ff6e65c1 --- /dev/null +++ b/example/nolexer/iface/iface.go @@ -0,0 +1,33 @@ +// Code generated by gocc; DO NOT EDIT. + +package iface + +import ( + "github.com/maxcalandrelli/gocc/example/nolexer/internal/token" + "io" +) + +type ( + Scanner interface { + Scan() (tok *token.Token) + } + + StreamScanner interface { + GetStream() TokenStream + } + + CheckPoint interface { + DistanceFrom(CheckPoint) int + } + + CheckPointable interface { + GetCheckPoint() CheckPoint + GotoCheckPoint(CheckPoint) + } + + TokenStream interface { + io.Reader + io.RuneScanner + io.Seeker + } +) diff --git a/example/nolexer/internal/errors/errors.go b/example/nolexer/internal/errors/errors.go new file mode 100644 index 00000000..2992ec3f --- /dev/null +++ b/example/nolexer/internal/errors/errors.go @@ -0,0 +1,56 @@ +// Code generated by gocc; DO NOT EDIT. + +package errors + +import ( + "fmt" + "strings" + + "github.com/maxcalandrelli/gocc/example/nolexer/internal/token" +) + +type ErrorSymbol interface { +} + +type Error struct { + Err error + ErrorToken *token.Token + ErrorSymbols []ErrorSymbol + ExpectedTokens []string + StackTop int +} + +func (e *Error) String() string { + w := new(strings.Builder) + fmt.Fprintf(w, "Error") + if e.Err != nil { + fmt.Fprintf(w, " %s\n", e.Err) + } else { + fmt.Fprintf(w, "\n") + } + fmt.Fprintf(w, "Token: type=%d, lit=%s\n", e.ErrorToken.Type, e.ErrorToken.Lit) + fmt.Fprintf(w, "Pos: offset=%d, line=%d, column=%d\n", e.ErrorToken.Pos.Offset, e.ErrorToken.Pos.Line, e.ErrorToken.Pos.Column) + fmt.Fprintf(w, "Expected one of: ") + for _, sym := range e.ExpectedTokens { + fmt.Fprintf(w, "%s ", sym) + } + fmt.Fprintf(w, "ErrorSymbol:\n") + for _, sym := range e.ErrorSymbols { + fmt.Fprintf(w, "%v\n", sym) + } + return w.String() +} + +func (e *Error) Error() string { + w := new(strings.Builder) + fmt.Fprintf(w, "Error in S%d: %s, %s", e.StackTop, token.TokMap.TokenString(e.ErrorToken), e.ErrorToken.Pos.String()) + if e.Err != nil { + fmt.Fprintf(w, ": %+v", e.Err) + } else { + fmt.Fprintf(w, ", expected one of: ") + for _, expected := range e.ExpectedTokens { + fmt.Fprintf(w, "%s ", expected) + } + } + return w.String() +} diff --git a/example/nolexer/internal/io/stream/internal/stream_impl.go b/example/nolexer/internal/io/stream/internal/stream_impl.go new file mode 100644 index 00000000..358aa160 --- /dev/null +++ b/example/nolexer/internal/io/stream/internal/stream_impl.go @@ -0,0 +1,275 @@ +package internal + +import ( + "io" + "sync" + "unicode/utf8" +) + +type ( + impl_WindowReader struct { + bufferBlockSize int + maxBufferSize int + buffers [][]byte + available int + absbase int64 + position int + eof bool + rdr io.Reader + lock *sync.Mutex + } +) + +func (s *impl_WindowReader) lockReader() { + if s.lock != nil { + s.lock.Lock() + } +} + +func (s *impl_WindowReader) unlockReader() { + if s.lock != nil { + s.lock.Unlock() + } +} + +func (s *impl_WindowReader) seek(offset int64, whence int) (offs int64, err error) { + switch whence { + case io.SeekStart: + return s.seek(offset-s.ReadPosition(), io.SeekCurrent) + case io.SeekCurrent: + switch { + case offset == 0: + return s.ReadPosition(), nil + case offset < 0: + if -offset > int64(s.maxBackOffset()) { + err = io.ErrShortBuffer + } else { + s.advanceGet(int(offset)) + } + case offset > 0: + for offset > 0 && !s.eof { + available := s.Buffered() + if offset <= int64(available) { + s.advanceGet(int(offset)) + break + } + if available > 0 { + s.advanceGet(available) + offset -= int64(available) + } + read, _ := s.fetchBytes(int(offset)) + s.advanceGet(read) + offset -= int64(read) + } + if s.eof { + err = io.EOF + } + } + case io.SeekEnd: + for !s.eof { + s.seek(int64(s.MaxCap()), io.SeekCurrent) + } + s.seek(int64(s.Buffered()), io.SeekCurrent) + } + if s.eof && err == nil && s.Buffered() > 0 { + s.eof = false + } + return s.ReadPosition(), err +} + +func (s impl_WindowReader) maxBackOffset() int { + r := s.position + if s.absbase > 0 { + r = s.Cap() - s.Buffered() + } + return r +} + +func (s impl_WindowReader) bufferIndex(pos int) int { + if pos < 0 { + panic("negative position") + } + return pos / s.bufferBlockSize +} + +func (s impl_WindowReader) bufferBytes(pos int) []byte { + return s.buffers[s.bufferIndex(pos)] +} + +func (s impl_WindowReader) bufferByteRange(pos int, length int) []byte { + p := s.bufferOffset(pos) + return s.bufferBytes(pos)[p : p+length] +} + +func (s impl_WindowReader) bufferOffset(pos int) int { + return pos % s.bufferBlockSize +} + +func (s *impl_WindowReader) advanceGet(n int) { + sz := s.Cap() + switch { + case n < 0: + if -n > s.maxBackOffset() { + panic("underflow") + } + s.position += n + if s.position < 0 { + s.position += sz + s.absbase -= int64(sz) + } + case n > 0: + if n > s.Buffered() { + panic("overflow") + } + s.position += n + if s.position >= sz { + s.position -= sz + s.absbase += int64(sz) + } + } + s.available -= n +} + +func (s *impl_WindowReader) copy(to []byte, length int) { + for offs, cp := 0, 0; length > 0; length -= cp { + s.position %= s.MaxCap() + p := s.bufferOffset(s.position) + b := s.bufferBytes(s.position) + r := s.bufferBlockSize - p + if length <= r { + cp = copy(to[offs:], b[p:p+length]) + } else { + cp = copy(to[offs:], b[p:]) + } + s.advanceGet(cp) + offs += cp + } +} + +func (s *impl_WindowReader) fetchBytes(n int) (read int, err error) { + if s.rdr == nil { + s.eof = true + return 0, io.EOF + } + for n > 0 && s.Buffered() < s.MaxCap() && err == nil { + readNow := n + putpos := s.position + s.available + r := s.bufferBlockSize - s.bufferOffset(putpos) + if readNow > r { + readNow = r + } + for s.bufferIndex(putpos) >= len(s.buffers) && s.Cap() < s.MaxCap() { + s.buffers = append(s.buffers, make([]byte, s.bufferBlockSize)) + } + putpos %= s.MaxCap() + offs := s.bufferOffset(putpos) + if r, err = s.rdr.Read(s.bufferBytes(putpos)[offs : offs+readNow]); r > 0 { + s.available += r + read += r + n -= r + } + } + if n > 0 && err == nil { + err = io.ErrShortBuffer + } + return +} + +func (s *impl_WindowReader) read(p []byte) (read int, err error) { + if s.eof { + return 0, io.EOF + } + for read < len(p) && err == nil { + available := s.Buffered() + if len(p)-read <= available { + s.copy(p[read:], len(p)-read) + read = len(p) + } else { + if available == 0 { + available, err = s.fetchBytes(len(p) - read) + } + s.copy(p[read:], available) + read += available + switch err { + case io.ErrShortBuffer: + err = nil + case io.EOF: + s.eof = true + } + } + } + return +} + +func (s impl_WindowReader) peekByte() (byte, error) { + if s.Buffered() < 1 { + return 0, io.ErrShortBuffer + } + return s.bufferBytes(s.position)[s.bufferOffset(s.position)], nil +} + +func (s *impl_WindowReader) unreadByte() error { + _, e := s.seek(-1, io.SeekCurrent) + return e +} + +func (s *impl_WindowReader) readRune() (r rune, size int, err error) { + for i := 1; err == nil && i <= 4; i++ { + if s.Buffered() < i { + if _, err = s.fetchBytes(i); err != nil { + return + } + } + t := s.bufferByteRange(s.position, i) + if r, size = utf8.DecodeRune(t); r != utf8.RuneError { + s.advanceGet(size) + return + } + } + return utf8.RuneError, 0, err +} + +func (s *impl_WindowReader) unreadRune() (err error) { + tmps := *s + tmpb := []byte{} + for { + if _, err = tmps.seek(-1, io.SeekCurrent); err == nil { + b, _ := tmps.peekByte() + tmpb = append([]byte{b}, tmpb...) + switch len(tmpb) { + case 1: + if (tmpb[0] & 0xC0) == 0x80 { + continue + } + _, err = s.seek(-int64(len(tmpb)), io.SeekCurrent) + return + case 2: + if (tmpb[0] & 0xC0) == 0x80 { + continue + } + if (tmpb[0] & 0xE0) != 0xC0 { + break + } + _, err = s.seek(-int64(len(tmpb)), io.SeekCurrent) + return + case 3: + if (tmpb[0] & 0xC0) == 0x80 { + continue + } + if (tmpb[0] & 0xF0) != 0xE0 { + break + } + _, err = s.seek(-int64(len(tmpb)), io.SeekCurrent) + return + case 4: + if (tmpb[0] & 0xF8) != 0xF0 { + break + } + _, err = s.seek(-int64(len(tmpb)), io.SeekCurrent) + return + } + } + } + _, err = s.seek(-1, io.SeekCurrent) + return +} diff --git a/example/nolexer/internal/io/stream/internal/stream_public.go b/example/nolexer/internal/io/stream/internal/stream_public.go new file mode 100644 index 00000000..20ed7b5e --- /dev/null +++ b/example/nolexer/internal/io/stream/internal/stream_public.go @@ -0,0 +1,101 @@ +package internal + +import ( + "io" +) + +func NewWindowReader(buf []byte, underlyingReader io.Reader, blksize, smax int, InfoPrefixRoundUp bool) *impl_WindowReader { + if blksize < 0 || smax < blksize { + panic("illegal buffer size") + } + r := &impl_WindowReader{rdr: underlyingReader} + r.bufferBlockSize = blksize + if underlyingReader != nil { + if blksize <= 0 { + r.bufferBlockSize = 1 << 10 + } else if InfoPrefixRoundUp { + for r.bufferBlockSize = 1; blksize > 0; r.bufferBlockSize = r.bufferBlockSize << 1 { + blksize = blksize >> 1 + } + } + if smax > 0 { + r.maxBufferSize = ((smax-1)/r.bufferBlockSize + 1) * r.bufferBlockSize + } + r.buffers = [][]byte{} + } else { + r.buffers = [][]byte{buf} + r.available = len(buf) + r.bufferBlockSize = r.available + r.maxBufferSize = r.available + } + return r +} + +func (s impl_WindowReader) Cap() int { + return len(s.buffers) * s.bufferBlockSize +} + +func (s impl_WindowReader) BlockSize() int { + return s.bufferBlockSize +} + +func (s impl_WindowReader) MaxCap() int { + if s.maxBufferSize > 0 { + return s.maxBufferSize + } + return 1 << 31 +} + +func (s impl_WindowReader) MaxUnreadSize() int { + return s.maxBackOffset() +} + +func (s impl_WindowReader) Buffered() int { + return s.available +} + +func (s impl_WindowReader) ReadPosition() int64 { + return s.absbase + int64(s.position) +} + +func (s *impl_WindowReader) Read(p []byte) (read int, err error) { + s.lockReader() + defer func() { s.unlockReader() }() + return s.read(p) +} + +func (s *impl_WindowReader) Seek(offset int64, whence int) (offs int64, err error) { + s.lockReader() + defer func() { s.unlockReader() }() + return s.seek(offset, whence) +} + +func (s *impl_WindowReader) ReadByte() (byte, error) { + b := []byte{0} + _, err := s.Read(b) + return b[0], err +} + +func (s *impl_WindowReader) PeekByte() (byte, error) { + s.lockReader() + defer func() { s.unlockReader() }() + return s.peekByte() +} + +func (s *impl_WindowReader) UnreadByte() error { + s.lockReader() + defer func() { s.unlockReader() }() + return s.unreadByte() +} + +func (s *impl_WindowReader) ReadRune() (r rune, size int, err error) { + s.lockReader() + defer func() { s.unlockReader() }() + return s.readRune() +} + +func (s *impl_WindowReader) UnreadRune() (err error) { + s.lockReader() + defer func() { s.unlockReader() }() + return s.unreadRune() +} diff --git a/example/nolexer/internal/io/stream/stream.go b/example/nolexer/internal/io/stream/stream.go new file mode 100644 index 00000000..ef4dad2a --- /dev/null +++ b/example/nolexer/internal/io/stream/stream.go @@ -0,0 +1,39 @@ +package stream + +import ( + internal "github.com/maxcalandrelli/gocc/example/nolexer/internal/io/stream/internal" + "io" +) + +type ( + WindowReader interface { + BlockSize() int + Buffered() int + Cap() int + MaxCap() int + Read([]byte) (int, error) + ReadByte() (byte, error) + ReadPosition() int64 + ReadRune() (rune, int, error) + Seek(int64, int) (int64, error) + UnreadByte() error + UnreadRune() error + MaxUnreadSize() int + } +) + +var ( + InfoPrefixRoundUp = false +) + +func NewWindowReaderFromBytes(src []byte) WindowReader { + return internal.NewWindowReader(src, nil, 0, 0, InfoPrefixRoundUp) +} + +func NewWindowReader(rdr io.Reader) WindowReader { + return internal.NewWindowReader(nil, rdr, 0, 0, false) +} + +func NewLimitedWindowReader(rdr io.Reader, sizeMin, sizeMax int) WindowReader { + return internal.NewWindowReader(nil, rdr, sizeMin, sizeMax, InfoPrefixRoundUp) +} diff --git a/example/nolexer/internal/parser/action.go b/example/nolexer/internal/parser/action.go new file mode 100644 index 00000000..54bc55e9 --- /dev/null +++ b/example/nolexer/internal/parser/action.go @@ -0,0 +1,51 @@ +// Code generated by gocc; DO NOT EDIT. + +package parser + +import ( + "fmt" +) + +type action interface { + act() + String() string +} + +type ( + accept bool + shift int // value is next state index + reduce int // value is production index +) + +func (this accept) act() {} +func (this shift) act() {} +func (this reduce) act() {} + +func (this accept) Equal(that action) bool { + if _, ok := that.(accept); ok { + return true + } + return false +} + +func (this reduce) Equal(that action) bool { + that1, ok := that.(reduce) + if !ok { + return false + } + return this == that1 +} + +func (this shift) Equal(that action) bool { + that1, ok := that.(shift) + if !ok { + return false + } + return this == that1 +} + +func (this accept) String() string { return "accept(0)" } +func (this shift) String() string { return fmt.Sprintf("shift:%d", this) } +func (this reduce) String() string { + return fmt.Sprintf("reduce:%d(%s)", this, productionsTable[this].String) +} diff --git a/example/nolexer/internal/parser/actiontable.go b/example/nolexer/internal/parser/actiontable.go new file mode 100644 index 00000000..eb8558e1 --- /dev/null +++ b/example/nolexer/internal/parser/actiontable.go @@ -0,0 +1,91 @@ +// Code generated by gocc; DO NOT EDIT. + +package parser + +type ( + actionTable [numStates]actionRow + cdFunc func(TokenStream, interface{}) (interface{}, error, []byte) + cdAction struct { + tokenIndex int + tokenScanner cdFunc + } + actionRow struct { + canRecover bool + actions [numSymbols]action + cdActions []cdAction + } + actions struct { + table actionTable + } +) + +var parserActions = actions{ + table: actionTable{ + actionRow{ // S0 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // name + shift(3), // "hello" + shift(4), // "hiya" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S1 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + accept(true), // Ω + nil, // name + nil, // "hello" + nil, // "hiya" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S2 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + shift(5), // name + nil, // "hello" + nil, // "hiya" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S3 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + reduce(2), // name, reduce: Saying + nil, // "hello" + nil, // "hiya" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S4 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + reduce(3), // name, reduce: Saying + nil, // "hello" + nil, // "hiya" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S5 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(1), // Ω, reduce: Hello + nil, // name + nil, // "hello" + nil, // "hiya" + }, + cdActions: []cdAction{}, + }, + }, +} diff --git a/example/nolexer/internal/parser/gototable.go b/example/nolexer/internal/parser/gototable.go new file mode 100644 index 00000000..85887079 --- /dev/null +++ b/example/nolexer/internal/parser/gototable.go @@ -0,0 +1,43 @@ +// Code generated by gocc; DO NOT EDIT. + +package parser + +const numNTSymbols = 3 + +type ( + gotoTable [numStates]gotoRow + gotoRow [numNTSymbols]int +) + +var gotoTab = gotoTable{ + gotoRow{ // S0 + -1, // Π + 1, // Π + 2, // Π + }, + gotoRow{ // S1 + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S2 + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S3 + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S4 + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S5 + -1, // Π + -1, // Π + -1, // Π + }, +} diff --git a/example/nolexer/internal/parser/parser.go b/example/nolexer/internal/parser/parser.go new file mode 100644 index 00000000..a72e1e7c --- /dev/null +++ b/example/nolexer/internal/parser/parser.go @@ -0,0 +1,298 @@ +// Code generated by gocc; DO NOT EDIT. + +package parser + +import ( + "errors" + "fmt" + "strings" + + "github.com/maxcalandrelli/gocc/example/nolexer/iface" + parseError "github.com/maxcalandrelli/gocc/example/nolexer/internal/errors" + "github.com/maxcalandrelli/gocc/example/nolexer/internal/token" +) + +const ( + numProductions = 4 + numStates = 6 + numSymbols = 8 +) + +// Stack + +type stack struct { + state []int + attrib []Attrib +} + +const INITIAL_STACK_SIZE = 100 + +func newStack() *stack { + return &stack{ + state: make([]int, 0, INITIAL_STACK_SIZE), + attrib: make([]Attrib, 0, INITIAL_STACK_SIZE), + } +} + +func (s *stack) reset() { + s.state = s.state[:0] + s.attrib = s.attrib[:0] +} + +func (s *stack) push(state int, a Attrib) { + s.state = append(s.state, state) + s.attrib = append(s.attrib, a) +} + +func (s *stack) top() int { + return s.state[len(s.state)-1] +} + +func (s *stack) peek(pos int) int { + return s.state[pos] +} + +func (s *stack) topIndex() int { + return len(s.state) - 1 +} + +func (s *stack) popN(items int) []Attrib { + lo, hi := len(s.state)-items, len(s.state) + + attrib := s.attrib[lo:hi] + + s.state = s.state[:lo] + s.attrib = s.attrib[:lo] + + return attrib +} + +func (s *stack) String() string { + w := new(strings.Builder) + fmt.Fprintf(w, "stack:\n") + for i, st := range s.state { + fmt.Fprintf(w, "\t%d: %d , ", i, st) + if s.attrib[i] == nil { + fmt.Fprintf(w, "nil") + } else { + switch attr := s.attrib[i].(type) { + case *token.Token: + fmt.Fprintf(w, "%s", attr.Lit) + default: + fmt.Fprintf(w, "%v", attr) + } + } + fmt.Fprintf(w, "\n") + } + return w.String() +} + +// Parser + +type Parser struct { + stack *stack + nextToken *token.Token + userContext interface{} +} + +type TokenStream = iface.TokenStream + +func NewParser() *Parser { + return NewParserWithContext(nil) +} + +func NewParserWithContext(u interface{}) *Parser { + p := &Parser{stack: newStack(), userContext: u} + p.Reset() + return p +} + +func (p *Parser) Reset() { + p.stack.reset() + p.stack.push(0, nil) +} + +func (p *Parser) Error(err error, scanner iface.Scanner) (recovered bool, errorAttrib *parseError.Error) { + errorAttrib = &parseError.Error{ + Err: err, + ErrorToken: p.nextToken, + ErrorSymbols: p.popNonRecoveryStates(), + ExpectedTokens: make([]string, 0, 8), + } + for t, action := range parserActions.table[p.stack.top()].actions { + if action != nil { + errorAttrib.ExpectedTokens = append(errorAttrib.ExpectedTokens, token.TokMap.Id(token.Type(t))) + } + } + + if action := parserActions.table[p.stack.top()].actions[token.TokMap.Type("error")]; action != nil { + p.stack.push(int(action.(shift)), errorAttrib) // action can only be shift + } else { + return + } + + if action := parserActions.table[p.stack.top()].actions[p.nextToken.Type]; action != nil { + recovered = true + } + for !recovered && p.nextToken.Type != token.EOF { + p.nextToken = scanner.Scan() + if action := parserActions.table[p.stack.top()].actions[p.nextToken.Type]; action != nil { + recovered = true + } + } + + return +} + +func (p *Parser) popNonRecoveryStates() (removedAttribs []parseError.ErrorSymbol) { + if rs, ok := p.firstRecoveryState(); ok { + errorSymbols := p.stack.popN(p.stack.topIndex() - rs) + removedAttribs = make([]parseError.ErrorSymbol, len(errorSymbols)) + for i, e := range errorSymbols { + removedAttribs[i] = e + } + } else { + removedAttribs = []parseError.ErrorSymbol{} + } + return +} + +// recoveryState points to the highest state on the stack, which can recover +func (p *Parser) firstRecoveryState() (recoveryState int, canRecover bool) { + recoveryState, canRecover = p.stack.topIndex(), parserActions.table[p.stack.top()].canRecover + for recoveryState > 0 && !canRecover { + recoveryState-- + canRecover = parserActions.table[p.stack.peek(recoveryState)].canRecover + } + return +} + +func (p *Parser) newError(err error) error { + e := &parseError.Error{ + Err: err, + StackTop: p.stack.top(), + ErrorToken: p.nextToken, + } + actRow := parserActions.table[p.stack.top()] + for i, t := range actRow.actions { + if t != nil { + e.ExpectedTokens = append(e.ExpectedTokens, token.TokMap.Id(token.Type(i))) + } + } + return e +} + +func (p *Parser) Parse(scanner iface.Scanner) (res interface{}, err error, ptl int) { + return p.parse(scanner, false) +} + +func (p *Parser) ParseLongestPrefix(scanner iface.Scanner) (res interface{}, err error, ptl int) { + return p.parse(scanner, true) +} + +var errNotRepositionable = errors.New("scanner not repositionable") + +func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, err error, ptl int) { + var ( + tokens iface.CheckPointable + afterPos iface.CheckPoint + checkPoint iface.CheckPoint + ) + readNextToken := func() error { + if tokens == nil && (len(parserActions.table[p.stack.top()].cdActions) > 0 || longest) { + return errNotRepositionable + } + checkPoint = tokens.GetCheckPoint() + p.nextToken = scanner.Scan() + if longest { + afterPos = tokens.GetCheckPoint() + } + return nil + } + p.Reset() + tokens, _ = scanner.(iface.CheckPointable) + startCp := tokens.GetCheckPoint() + if err := readNextToken(); err != nil { + return nil, err, tokens.GetCheckPoint().DistanceFrom(startCp) + } + for acc := false; !acc; { + action := parserActions.table[p.stack.top()].actions[p.nextToken.Type] + if action == nil { + // + // If no action, check if we have some context dependent parsing to try + // + if streamScanner, _ := scanner.(iface.StreamScanner); streamScanner != nil { + underlyingStream := streamScanner.GetStream() + for _, cdAction := range parserActions.table[p.stack.top()].cdActions { + tokens.GotoCheckPoint(checkPoint) + cd_res, cd_err, cd_parsed := cdAction.tokenScanner(underlyingStream, p.userContext) + if cd_err == nil && len(cd_parsed) > 0 { + action = parserActions.table[p.stack.top()].actions[cdAction.tokenIndex] + if action != nil { + p.nextToken.Foreign = true + p.nextToken.ForeignAstNode = cd_res + p.nextToken.Lit = cd_parsed + p.nextToken.Type = token.Type(cdAction.tokenIndex) + break + } + } + } + } + } + // + // Still no action? If a longest possible parsing is requested in place + // of a full text, we should try to check if an EOF here would have led + // to a successful parsing instead + // Rember that token.EOF is 1, that is the index of SyntaxEof into symbol table + // Dirty, dirty, dirty... but I found it as it is, and I prefer not to touch + // + if action == nil && longest { + tokens.GotoCheckPoint(checkPoint) + action = parserActions.table[p.stack.top()].actions[token.EOF] + if action == nil { + // + // ok, let's consume the token then + // + tokens.GotoCheckPoint(afterPos) + } + } + + // + // Well, no action is no action after all... + // + if action == nil { + if recovered, errAttrib := p.Error(nil, scanner); !recovered { + p.nextToken = errAttrib.ErrorToken + return nil, p.newError(nil), tokens.GetCheckPoint().DistanceFrom(startCp) + } + if action = parserActions.table[p.stack.top()].actions[p.nextToken.Type]; action == nil { + panic("Error recovery led to invalid action") + } + } + + switch act := action.(type) { + case accept: + res = p.stack.popN(1)[0] + acc = true + case shift: + p.stack.push(int(act), p.nextToken) + if p.nextToken.Foreign { + p.stack.push(int(act), p.nextToken.ForeignAstNode) + } + if err := readNextToken(); err != nil { + return nil, err, tokens.GetCheckPoint().DistanceFrom(startCp) + } + case reduce: + prod := productionsTable[int(act)] + attrib, err := prod.ReduceFunc(p.userContext, p.stack.popN(prod.NumSymbols)) + if err != nil { + return nil, p.newError(err), tokens.GetCheckPoint().DistanceFrom(startCp) + } else { + p.stack.push(gotoTab[p.stack.top()][prod.NTType], attrib) + } + default: + panic("unknown action: " + action.String()) + } + } + return res, nil, tokens.GetCheckPoint().DistanceFrom(startCp) +} diff --git a/example/nolexer/parser/productionstable.go b/example/nolexer/internal/parser/productionstable.go similarity index 68% rename from example/nolexer/parser/productionstable.go rename to example/nolexer/internal/parser/productionstable.go index cdab8012..17e02c08 100644 --- a/example/nolexer/parser/productionstable.go +++ b/example/nolexer/internal/parser/productionstable.go @@ -5,7 +5,7 @@ package parser import ( "fmt" - "github.com/maxcalandrelli/gocc/example/nolexer/token" + "github.com/maxcalandrelli/gocc/example/nolexer/internal/token" ) type ( @@ -17,7 +17,7 @@ type ( NTType int Index int NumSymbols int - ReduceFunc func([]Attrib) (Attrib, error) + ReduceFunc func(interface{}, []Attrib) (Attrib, error) } Attrib interface { } @@ -25,24 +25,24 @@ type ( var productionsTable = ProdTab{ ProdTabEntry{ - String: `S' : Hello << >>`, + String: `S' : Π << >>`, Id: "S'", NTType: 0, Index: 0, NumSymbols: 1, - ReduceFunc: func(X []Attrib) (Attrib, error) { + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { return X[0], nil }, }, ProdTabEntry{ - String: `Hello : Saying name << func () (Attrib, error) { + String: `Hello : Π name << func () (Attrib, error) { fmt.Println(string(X[1].(*token.Token).Lit)); return nil, nil} () >>`, Id: "Hello", NTType: 1, Index: 1, NumSymbols: 2, - ReduceFunc: func(X []Attrib) (Attrib, error) { + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { return func() (Attrib, error) { fmt.Println(string(X[1].(*token.Token).Lit)) return nil, nil @@ -50,14 +50,14 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `Saying : "hello" << func () (Attrib, error) { + String: `Saying : Λ << func () (Attrib, error) { fmt.Print("hello "); return nil, nil} () >>`, Id: "Saying", NTType: 2, Index: 2, NumSymbols: 1, - ReduceFunc: func(X []Attrib) (Attrib, error) { + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { return func() (Attrib, error) { fmt.Print("hello ") return nil, nil @@ -65,14 +65,14 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `Saying : "hiya" << func () (Attrib, error) { + String: `Saying : Λ << func () (Attrib, error) { fmt.Print("hiya "); return nil, nil} () >>`, Id: "Saying", NTType: 2, Index: 3, NumSymbols: 1, - ReduceFunc: func(X []Attrib) (Attrib, error) { + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { return func() (Attrib, error) { fmt.Print("hiya ") return nil, nil diff --git a/example/nolexer/internal/token/token.go b/example/nolexer/internal/token/token.go new file mode 100644 index 00000000..a35e3796 --- /dev/null +++ b/example/nolexer/internal/token/token.go @@ -0,0 +1,91 @@ +// Code generated by gocc; DO NOT EDIT. + +package token + +import ( + "fmt" +) + +type Token struct { + Type + Lit []byte + Pos + ForeignAstNode interface{} + Foreign bool +} + +type Type int + +const ( + INVALID Type = iota + EOF +) + +type Pos struct { + Offset int + Line int + Column int +} + +func (p Pos) String() string { + return fmt.Sprintf("Pos(offset=%d, line=%d, column=%d)", p.Offset, p.Line, p.Column) +} + +func (p Pos) StartingFrom(base Pos) Pos { + r := base + r.Offset += p.Offset + r.Line += p.Line + r.Column = p.Column + if p.Line > 0 && base.Line > 0 { + r.Line-- + } + if r.Column < 1 { + r.Column = 1 + } + return r +} + +type TokenMap struct { + typeMap []string + idMap map[string]Type +} + +func (m TokenMap) Id(tok Type) string { + if int(tok) < len(m.typeMap) { + return m.typeMap[tok] + } + return "unknown" +} + +func (m TokenMap) Type(tok string) Type { + if typ, exist := m.idMap[tok]; exist { + return typ + } + return INVALID +} + +func (m TokenMap) TokenString(tok *Token) string { + return fmt.Sprintf("%s(%d,<%s>)", m.Id(tok.Type), tok.Type, tok.Lit) +} + +func (m TokenMap) StringType(typ Type) string { + return fmt.Sprintf("%s(%d)", m.Id(typ), typ) +} + +var TokMap = TokenMap{ + typeMap: []string{ + "INVALID", + "Ω", + "name", + "Λ", + "Λ", + }, + + idMap: map[string]Type{ + "INVALID": 0, + "Ω": 1, + "name": 2, + "Λ": 3, + "Λ": 4, + }, +} diff --git a/example/nolexer/internal/util/litconv.go b/example/nolexer/internal/util/litconv.go new file mode 100644 index 00000000..1aeb6166 --- /dev/null +++ b/example/nolexer/internal/util/litconv.go @@ -0,0 +1,108 @@ +// Code generated by gocc; DO NOT EDIT. + +package util + +import ( + "fmt" + "strconv" + "unicode" + "unicode/utf8" +) + +/* Interface */ + +/* +Convert the literal value of a scanned token to rune +*/ +func RuneValue(lit []byte) rune { + if lit[1] == '\\' { + return escapeCharVal(lit) + } + r, size := utf8.DecodeRune(lit[1:]) + if size != len(lit)-2 { + panic(fmt.Sprintf("Error decoding rune. Lit: %s, rune: %d, size%d\n", lit, r, size)) + } + return r +} + +/* +Convert the literal value of a scanned token to int64 +*/ +func IntValue(lit []byte) (int64, error) { + return strconv.ParseInt(string(lit), 10, 64) +} + +/* +Convert the literal value of a scanned token to uint64 +*/ +func UintValue(lit []byte) (uint64, error) { + return strconv.ParseUint(string(lit), 10, 64) +} + +/* Util */ + +func escapeCharVal(lit []byte) rune { + var i, base, max uint32 + offset := 2 + switch lit[offset] { + case 'a': + return '\a' + case 'b': + return '\b' + case 'f': + return '\f' + case 'n': + return '\n' + case 'r': + return '\r' + case 't': + return '\t' + case 'v': + return '\v' + case '\\': + return '\\' + case '\'': + return '\'' + case '0', '1', '2', '3', '4', '5', '6', '7': + i, base, max = 3, 8, 255 + case 'x': + i, base, max = 2, 16, 255 + offset++ + case 'u': + i, base, max = 4, 16, unicode.MaxRune + offset++ + case 'U': + i, base, max = 8, 16, unicode.MaxRune + offset++ + default: + panic(fmt.Sprintf("Error decoding character literal: %s\n", lit)) + } + + var x uint32 + for ; i > 0 && offset < len(lit)-1; i-- { + ch, size := utf8.DecodeRune(lit[offset:]) + offset += size + d := uint32(digitVal(ch)) + if d >= base { + panic(fmt.Sprintf("charVal(%s): illegal character (%c) in escape sequence. size=%d, offset=%d", lit, ch, size, offset)) + } + x = x*base + d + } + if x > max || 0xD800 <= x && x < 0xE000 { + panic(fmt.Sprintf("Error decoding escape char value. Lit:%s, offset:%d, escape sequence is invalid Unicode code point\n", lit, offset)) + } + + return rune(x) +} + +func digitVal(ch rune) int { + switch { + case '0' <= ch && ch <= '9': + return int(ch) - '0' + case 'a' <= ch && ch <= 'f': + return int(ch) - 'a' + 10 + case 'A' <= ch && ch <= 'F': + return int(ch) - 'A' + 10 + } + return 16 // larger than any legal digit val +} diff --git a/example/nolexer/internal/util/rune.go b/example/nolexer/internal/util/rune.go new file mode 100644 index 00000000..bd8523a4 --- /dev/null +++ b/example/nolexer/internal/util/rune.go @@ -0,0 +1,39 @@ +// Code generated by gocc; DO NOT EDIT. + +package util + +import ( + "fmt" +) + +func RuneToString(r rune) string { + if r >= 0x20 && r < 0x7f { + return fmt.Sprintf("'%c'", r) + } + switch r { + case 0x07: + return "'\\a'" + case 0x08: + return "'\\b'" + case 0x0C: + return "'\\f'" + case 0x0A: + return "'\\n'" + case 0x0D: + return "'\\r'" + case 0x09: + return "'\\t'" + case 0x0b: + return "'\\v'" + case 0x5c: + return "'\\\\\\'" + case 0x27: + return "'\\''" + case 0x22: + return "'\\\"'" + } + if r < 0x10000 { + return fmt.Sprintf("\\u%04x", r) + } + return fmt.Sprintf("\\U%08x", r) +} diff --git a/example/nolexer/nolexer.bnf b/example/nolexer/nolexer.bnf index a0117c08..b7445aa2 100644 --- a/example/nolexer/nolexer.bnf +++ b/example/nolexer/nolexer.bnf @@ -2,7 +2,7 @@ import ( "fmt" - "github.com/maxcalandrelli/gocc/example/nolexer/token" + "github.com/maxcalandrelli/gocc/example/nolexer/internal/token" ) >> diff --git a/example/nolexer/nolexer_test.go b/example/nolexer/nolexer_test.go index 4a2065a5..dc509d30 100644 --- a/example/nolexer/nolexer_test.go +++ b/example/nolexer/nolexer_test.go @@ -3,14 +3,14 @@ package nolexer import ( "testing" - "github.com/maxcalandrelli/gocc/example/nolexer/parser" + "github.com/maxcalandrelli/gocc/example/nolexer/internal/parser" "github.com/maxcalandrelli/gocc/example/nolexer/scanner" ) func Test1(t *testing.T) { S := scanner.NewString("hiya world") P := parser.NewParser() - if _, e := P.Parse(S); e != nil { + if _, e, _ := P.Parse(S); e != nil { t.Error(e.Error()) } } @@ -18,7 +18,7 @@ func Test1(t *testing.T) { func Test2(t *testing.T) { S := scanner.NewString("hello world") P := parser.NewParser() - if _, e := P.Parse(S); e != nil { + if _, e, _ := P.Parse(S); e != nil { t.Error(e.Error()) } } diff --git a/example/nolexer/parser/actiontable.go b/example/nolexer/parser/actiontable.go deleted file mode 100644 index 12b68618..00000000 --- a/example/nolexer/parser/actiontable.go +++ /dev/null @@ -1,74 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package parser - -type ( - actionTable [numStates]actionRow - actionRow struct { - canRecover bool - actions [numSymbols]action - } -) - -var actionTab = actionTable{ - actionRow{ // S0 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - nil, // $ - nil, // name - shift(3), // hello - shift(4), // hiya - }, - }, - actionRow{ // S1 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - accept(true), // $ - nil, // name - nil, // hello - nil, // hiya - }, - }, - actionRow{ // S2 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - nil, // $ - shift(5), // name - nil, // hello - nil, // hiya - }, - }, - actionRow{ // S3 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - nil, // $ - reduce(2), // name, reduce: Saying - nil, // hello - nil, // hiya - }, - }, - actionRow{ // S4 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - nil, // $ - reduce(3), // name, reduce: Saying - nil, // hello - nil, // hiya - }, - }, - actionRow{ // S5 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - reduce(1), // $, reduce: Hello - nil, // name - nil, // hello - nil, // hiya - }, - }, -} diff --git a/example/nolexer/parser/gototable.go b/example/nolexer/parser/gototable.go deleted file mode 100644 index 4266b515..00000000 --- a/example/nolexer/parser/gototable.go +++ /dev/null @@ -1,43 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package parser - -const numNTSymbols = 3 - -type ( - gotoTable [numStates]gotoRow - gotoRow [numNTSymbols]int -) - -var gotoTab = gotoTable{ - gotoRow{ // S0 - -1, // S' - 1, // Hello - 2, // Saying - }, - gotoRow{ // S1 - -1, // S' - -1, // Hello - -1, // Saying - }, - gotoRow{ // S2 - -1, // S' - -1, // Hello - -1, // Saying - }, - gotoRow{ // S3 - -1, // S' - -1, // Hello - -1, // Saying - }, - gotoRow{ // S4 - -1, // S' - -1, // Hello - -1, // Saying - }, - gotoRow{ // S5 - -1, // S' - -1, // Hello - -1, // Saying - }, -} diff --git a/example/nolexer/parser/parser.go b/example/nolexer/parser/parser.go deleted file mode 100644 index e482fc7e..00000000 --- a/example/nolexer/parser/parser.go +++ /dev/null @@ -1,216 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package parser - -import ( - "fmt" - "strings" - - parseError "github.com/maxcalandrelli/gocc/example/nolexer/errors" - "github.com/maxcalandrelli/gocc/example/nolexer/token" -) - -const ( - numProductions = 4 - numStates = 6 - numSymbols = 8 -) - -// Stack - -type stack struct { - state []int - attrib []Attrib -} - -const iNITIAL_STACK_SIZE = 100 - -func newStack() *stack { - return &stack{ - state: make([]int, 0, iNITIAL_STACK_SIZE), - attrib: make([]Attrib, 0, iNITIAL_STACK_SIZE), - } -} - -func (s *stack) reset() { - s.state = s.state[:0] - s.attrib = s.attrib[:0] -} - -func (s *stack) push(state int, a Attrib) { - s.state = append(s.state, state) - s.attrib = append(s.attrib, a) -} - -func (s *stack) top() int { - return s.state[len(s.state)-1] -} - -func (s *stack) peek(pos int) int { - return s.state[pos] -} - -func (s *stack) topIndex() int { - return len(s.state) - 1 -} - -func (s *stack) popN(items int) []Attrib { - lo, hi := len(s.state)-items, len(s.state) - - attrib := s.attrib[lo:hi] - - s.state = s.state[:lo] - s.attrib = s.attrib[:lo] - - return attrib -} - -func (s *stack) String() string { - w := new(strings.Builder) - fmt.Fprintf(w, "stack:\n") - for i, st := range s.state { - fmt.Fprintf(w, "\t%d: %d , ", i, st) - if s.attrib[i] == nil { - fmt.Fprintf(w, "nil") - } else { - switch attr := s.attrib[i].(type) { - case *token.Token: - fmt.Fprintf(w, "%s", attr.Lit) - default: - fmt.Fprintf(w, "%v", attr) - } - } - fmt.Fprintf(w, "\n") - } - return w.String() -} - -// Parser - -type Parser struct { - stack *stack - nextToken *token.Token - pos int -} - -type Scanner interface { - Scan() (tok *token.Token) -} - -func NewParser() *Parser { - p := &Parser{stack: newStack()} - p.Reset() - return p -} - -func (p *Parser) Reset() { - p.stack.reset() - p.stack.push(0, nil) -} - -func (p *Parser) Error(err error, scanner Scanner) (recovered bool, errorAttrib *parseError.Error) { - errorAttrib = &parseError.Error{ - Err: err, - ErrorToken: p.nextToken, - ErrorSymbols: p.popNonRecoveryStates(), - ExpectedTokens: make([]string, 0, 8), - } - for t, action := range actionTab[p.stack.top()].actions { - if action != nil { - errorAttrib.ExpectedTokens = append(errorAttrib.ExpectedTokens, token.TokMap.Id(token.Type(t))) - } - } - - if action := actionTab[p.stack.top()].actions[token.TokMap.Type("error")]; action != nil { - p.stack.push(int(action.(shift)), errorAttrib) // action can only be shift - } else { - return - } - - if action := actionTab[p.stack.top()].actions[p.nextToken.Type]; action != nil { - recovered = true - } - for !recovered && p.nextToken.Type != token.EOF { - p.nextToken = scanner.Scan() - if action := actionTab[p.stack.top()].actions[p.nextToken.Type]; action != nil { - recovered = true - } - } - - return -} - -func (p *Parser) popNonRecoveryStates() (removedAttribs []parseError.ErrorSymbol) { - if rs, ok := p.firstRecoveryState(); ok { - errorSymbols := p.stack.popN(p.stack.topIndex() - rs) - removedAttribs = make([]parseError.ErrorSymbol, len(errorSymbols)) - for i, e := range errorSymbols { - removedAttribs[i] = e - } - } else { - removedAttribs = []parseError.ErrorSymbol{} - } - return -} - -// recoveryState points to the highest state on the stack, which can recover -func (p *Parser) firstRecoveryState() (recoveryState int, canRecover bool) { - recoveryState, canRecover = p.stack.topIndex(), actionTab[p.stack.top()].canRecover - for recoveryState > 0 && !canRecover { - recoveryState-- - canRecover = actionTab[p.stack.peek(recoveryState)].canRecover - } - return -} - -func (p *Parser) newError(err error) error { - e := &parseError.Error{ - Err: err, - StackTop: p.stack.top(), - ErrorToken: p.nextToken, - } - actRow := actionTab[p.stack.top()] - for i, t := range actRow.actions { - if t != nil { - e.ExpectedTokens = append(e.ExpectedTokens, token.TokMap.Id(token.Type(i))) - } - } - return e -} - -func (p *Parser) Parse(scanner Scanner) (res interface{}, err error) { - p.Reset() - p.nextToken = scanner.Scan() - for acc := false; !acc; { - action := actionTab[p.stack.top()].actions[p.nextToken.Type] - if action == nil { - if recovered, errAttrib := p.Error(nil, scanner); !recovered { - p.nextToken = errAttrib.ErrorToken - return nil, p.newError(nil) - } - if action = actionTab[p.stack.top()].actions[p.nextToken.Type]; action == nil { - panic("Error recovery led to invalid action") - } - } - - switch act := action.(type) { - case accept: - res = p.stack.popN(1)[0] - acc = true - case shift: - p.stack.push(int(act), p.nextToken) - p.nextToken = scanner.Scan() - case reduce: - prod := productionsTable[int(act)] - attrib, err := prod.ReduceFunc(p.stack.popN(prod.NumSymbols)) - if err != nil { - return nil, p.newError(err) - } else { - p.stack.push(gotoTab[p.stack.top()][prod.NTType], attrib) - } - default: - panic("unknown action: " + action.String()) - } - } - return res, nil -} diff --git a/example/nolexer/scanner/scanner.go b/example/nolexer/scanner/scanner.go index 5c2a90e8..c011253f 100644 --- a/example/nolexer/scanner/scanner.go +++ b/example/nolexer/scanner/scanner.go @@ -1,7 +1,7 @@ package scanner import ( - "github.com/maxcalandrelli/gocc/example/nolexer/token" + "github.com/maxcalandrelli/gocc/example/nolexer/internal/token" ) type Scanner struct { diff --git a/example/rr/iface/iface.go b/example/rr/iface/iface.go new file mode 100644 index 00000000..afbf6db2 --- /dev/null +++ b/example/rr/iface/iface.go @@ -0,0 +1,30 @@ +// Code generated by gocc; DO NOT EDIT. + +package iface + +import ( + "github.com/maxcalandrelli/gocc/example/rr/internal/token" + "io" +) + +type ( + Scanner interface { + Scan() (tok *token.Token) + GetStream() TokenStream + } + + CheckPoint interface { + DistanceFrom(CheckPoint) int + } + + CheckPointable interface { + GetCheckPoint() CheckPoint + GotoCheckPoint(CheckPoint) + } + + TokenStream interface { + io.Reader + io.RuneScanner + io.Seeker + } +) diff --git a/example/nolexer/errors/errors.go b/example/rr/internal/errors/errors.go similarity index 95% rename from example/nolexer/errors/errors.go rename to example/rr/internal/errors/errors.go index 089c0156..ab6fc85a 100644 --- a/example/nolexer/errors/errors.go +++ b/example/rr/internal/errors/errors.go @@ -6,7 +6,7 @@ import ( "fmt" "strings" - "github.com/maxcalandrelli/gocc/example/nolexer/token" + "github.com/maxcalandrelli/gocc/example/rr/internal/token" ) type ErrorSymbol interface { diff --git a/example/rr/internal/io/stream/internal/stream_impl.go b/example/rr/internal/io/stream/internal/stream_impl.go new file mode 100644 index 00000000..358aa160 --- /dev/null +++ b/example/rr/internal/io/stream/internal/stream_impl.go @@ -0,0 +1,275 @@ +package internal + +import ( + "io" + "sync" + "unicode/utf8" +) + +type ( + impl_WindowReader struct { + bufferBlockSize int + maxBufferSize int + buffers [][]byte + available int + absbase int64 + position int + eof bool + rdr io.Reader + lock *sync.Mutex + } +) + +func (s *impl_WindowReader) lockReader() { + if s.lock != nil { + s.lock.Lock() + } +} + +func (s *impl_WindowReader) unlockReader() { + if s.lock != nil { + s.lock.Unlock() + } +} + +func (s *impl_WindowReader) seek(offset int64, whence int) (offs int64, err error) { + switch whence { + case io.SeekStart: + return s.seek(offset-s.ReadPosition(), io.SeekCurrent) + case io.SeekCurrent: + switch { + case offset == 0: + return s.ReadPosition(), nil + case offset < 0: + if -offset > int64(s.maxBackOffset()) { + err = io.ErrShortBuffer + } else { + s.advanceGet(int(offset)) + } + case offset > 0: + for offset > 0 && !s.eof { + available := s.Buffered() + if offset <= int64(available) { + s.advanceGet(int(offset)) + break + } + if available > 0 { + s.advanceGet(available) + offset -= int64(available) + } + read, _ := s.fetchBytes(int(offset)) + s.advanceGet(read) + offset -= int64(read) + } + if s.eof { + err = io.EOF + } + } + case io.SeekEnd: + for !s.eof { + s.seek(int64(s.MaxCap()), io.SeekCurrent) + } + s.seek(int64(s.Buffered()), io.SeekCurrent) + } + if s.eof && err == nil && s.Buffered() > 0 { + s.eof = false + } + return s.ReadPosition(), err +} + +func (s impl_WindowReader) maxBackOffset() int { + r := s.position + if s.absbase > 0 { + r = s.Cap() - s.Buffered() + } + return r +} + +func (s impl_WindowReader) bufferIndex(pos int) int { + if pos < 0 { + panic("negative position") + } + return pos / s.bufferBlockSize +} + +func (s impl_WindowReader) bufferBytes(pos int) []byte { + return s.buffers[s.bufferIndex(pos)] +} + +func (s impl_WindowReader) bufferByteRange(pos int, length int) []byte { + p := s.bufferOffset(pos) + return s.bufferBytes(pos)[p : p+length] +} + +func (s impl_WindowReader) bufferOffset(pos int) int { + return pos % s.bufferBlockSize +} + +func (s *impl_WindowReader) advanceGet(n int) { + sz := s.Cap() + switch { + case n < 0: + if -n > s.maxBackOffset() { + panic("underflow") + } + s.position += n + if s.position < 0 { + s.position += sz + s.absbase -= int64(sz) + } + case n > 0: + if n > s.Buffered() { + panic("overflow") + } + s.position += n + if s.position >= sz { + s.position -= sz + s.absbase += int64(sz) + } + } + s.available -= n +} + +func (s *impl_WindowReader) copy(to []byte, length int) { + for offs, cp := 0, 0; length > 0; length -= cp { + s.position %= s.MaxCap() + p := s.bufferOffset(s.position) + b := s.bufferBytes(s.position) + r := s.bufferBlockSize - p + if length <= r { + cp = copy(to[offs:], b[p:p+length]) + } else { + cp = copy(to[offs:], b[p:]) + } + s.advanceGet(cp) + offs += cp + } +} + +func (s *impl_WindowReader) fetchBytes(n int) (read int, err error) { + if s.rdr == nil { + s.eof = true + return 0, io.EOF + } + for n > 0 && s.Buffered() < s.MaxCap() && err == nil { + readNow := n + putpos := s.position + s.available + r := s.bufferBlockSize - s.bufferOffset(putpos) + if readNow > r { + readNow = r + } + for s.bufferIndex(putpos) >= len(s.buffers) && s.Cap() < s.MaxCap() { + s.buffers = append(s.buffers, make([]byte, s.bufferBlockSize)) + } + putpos %= s.MaxCap() + offs := s.bufferOffset(putpos) + if r, err = s.rdr.Read(s.bufferBytes(putpos)[offs : offs+readNow]); r > 0 { + s.available += r + read += r + n -= r + } + } + if n > 0 && err == nil { + err = io.ErrShortBuffer + } + return +} + +func (s *impl_WindowReader) read(p []byte) (read int, err error) { + if s.eof { + return 0, io.EOF + } + for read < len(p) && err == nil { + available := s.Buffered() + if len(p)-read <= available { + s.copy(p[read:], len(p)-read) + read = len(p) + } else { + if available == 0 { + available, err = s.fetchBytes(len(p) - read) + } + s.copy(p[read:], available) + read += available + switch err { + case io.ErrShortBuffer: + err = nil + case io.EOF: + s.eof = true + } + } + } + return +} + +func (s impl_WindowReader) peekByte() (byte, error) { + if s.Buffered() < 1 { + return 0, io.ErrShortBuffer + } + return s.bufferBytes(s.position)[s.bufferOffset(s.position)], nil +} + +func (s *impl_WindowReader) unreadByte() error { + _, e := s.seek(-1, io.SeekCurrent) + return e +} + +func (s *impl_WindowReader) readRune() (r rune, size int, err error) { + for i := 1; err == nil && i <= 4; i++ { + if s.Buffered() < i { + if _, err = s.fetchBytes(i); err != nil { + return + } + } + t := s.bufferByteRange(s.position, i) + if r, size = utf8.DecodeRune(t); r != utf8.RuneError { + s.advanceGet(size) + return + } + } + return utf8.RuneError, 0, err +} + +func (s *impl_WindowReader) unreadRune() (err error) { + tmps := *s + tmpb := []byte{} + for { + if _, err = tmps.seek(-1, io.SeekCurrent); err == nil { + b, _ := tmps.peekByte() + tmpb = append([]byte{b}, tmpb...) + switch len(tmpb) { + case 1: + if (tmpb[0] & 0xC0) == 0x80 { + continue + } + _, err = s.seek(-int64(len(tmpb)), io.SeekCurrent) + return + case 2: + if (tmpb[0] & 0xC0) == 0x80 { + continue + } + if (tmpb[0] & 0xE0) != 0xC0 { + break + } + _, err = s.seek(-int64(len(tmpb)), io.SeekCurrent) + return + case 3: + if (tmpb[0] & 0xC0) == 0x80 { + continue + } + if (tmpb[0] & 0xF0) != 0xE0 { + break + } + _, err = s.seek(-int64(len(tmpb)), io.SeekCurrent) + return + case 4: + if (tmpb[0] & 0xF8) != 0xF0 { + break + } + _, err = s.seek(-int64(len(tmpb)), io.SeekCurrent) + return + } + } + } + _, err = s.seek(-1, io.SeekCurrent) + return +} diff --git a/example/rr/internal/io/stream/internal/stream_public.go b/example/rr/internal/io/stream/internal/stream_public.go new file mode 100644 index 00000000..20ed7b5e --- /dev/null +++ b/example/rr/internal/io/stream/internal/stream_public.go @@ -0,0 +1,101 @@ +package internal + +import ( + "io" +) + +func NewWindowReader(buf []byte, underlyingReader io.Reader, blksize, smax int, InfoPrefixRoundUp bool) *impl_WindowReader { + if blksize < 0 || smax < blksize { + panic("illegal buffer size") + } + r := &impl_WindowReader{rdr: underlyingReader} + r.bufferBlockSize = blksize + if underlyingReader != nil { + if blksize <= 0 { + r.bufferBlockSize = 1 << 10 + } else if InfoPrefixRoundUp { + for r.bufferBlockSize = 1; blksize > 0; r.bufferBlockSize = r.bufferBlockSize << 1 { + blksize = blksize >> 1 + } + } + if smax > 0 { + r.maxBufferSize = ((smax-1)/r.bufferBlockSize + 1) * r.bufferBlockSize + } + r.buffers = [][]byte{} + } else { + r.buffers = [][]byte{buf} + r.available = len(buf) + r.bufferBlockSize = r.available + r.maxBufferSize = r.available + } + return r +} + +func (s impl_WindowReader) Cap() int { + return len(s.buffers) * s.bufferBlockSize +} + +func (s impl_WindowReader) BlockSize() int { + return s.bufferBlockSize +} + +func (s impl_WindowReader) MaxCap() int { + if s.maxBufferSize > 0 { + return s.maxBufferSize + } + return 1 << 31 +} + +func (s impl_WindowReader) MaxUnreadSize() int { + return s.maxBackOffset() +} + +func (s impl_WindowReader) Buffered() int { + return s.available +} + +func (s impl_WindowReader) ReadPosition() int64 { + return s.absbase + int64(s.position) +} + +func (s *impl_WindowReader) Read(p []byte) (read int, err error) { + s.lockReader() + defer func() { s.unlockReader() }() + return s.read(p) +} + +func (s *impl_WindowReader) Seek(offset int64, whence int) (offs int64, err error) { + s.lockReader() + defer func() { s.unlockReader() }() + return s.seek(offset, whence) +} + +func (s *impl_WindowReader) ReadByte() (byte, error) { + b := []byte{0} + _, err := s.Read(b) + return b[0], err +} + +func (s *impl_WindowReader) PeekByte() (byte, error) { + s.lockReader() + defer func() { s.unlockReader() }() + return s.peekByte() +} + +func (s *impl_WindowReader) UnreadByte() error { + s.lockReader() + defer func() { s.unlockReader() }() + return s.unreadByte() +} + +func (s *impl_WindowReader) ReadRune() (r rune, size int, err error) { + s.lockReader() + defer func() { s.unlockReader() }() + return s.readRune() +} + +func (s *impl_WindowReader) UnreadRune() (err error) { + s.lockReader() + defer func() { s.unlockReader() }() + return s.unreadRune() +} diff --git a/example/rr/internal/io/stream/stream.go b/example/rr/internal/io/stream/stream.go new file mode 100644 index 00000000..8ebdb374 --- /dev/null +++ b/example/rr/internal/io/stream/stream.go @@ -0,0 +1,39 @@ +package stream + +import ( + internal "github.com/maxcalandrelli/gocc/example/rr/internal/io/stream/internal" + "io" +) + +type ( + WindowReader interface { + BlockSize() int + Buffered() int + Cap() int + MaxCap() int + Read([]byte) (int, error) + ReadByte() (byte, error) + ReadPosition() int64 + ReadRune() (rune, int, error) + Seek(int64, int) (int64, error) + UnreadByte() error + UnreadRune() error + MaxUnreadSize() int + } +) + +var ( + InfoPrefixRoundUp = false +) + +func NewWindowReaderFromBytes(src []byte) WindowReader { + return internal.NewWindowReader(src, nil, 0, 0, InfoPrefixRoundUp) +} + +func NewWindowReader(rdr io.Reader) WindowReader { + return internal.NewWindowReader(nil, rdr, 0, 0, false) +} + +func NewLimitedWindowReader(rdr io.Reader, sizeMin, sizeMax int) WindowReader { + return internal.NewWindowReader(nil, rdr, sizeMin, sizeMax, InfoPrefixRoundUp) +} diff --git a/example/rr/internal/lexer/acttab.go b/example/rr/internal/lexer/acttab.go new file mode 100644 index 00000000..bf252c2e --- /dev/null +++ b/example/rr/internal/lexer/acttab.go @@ -0,0 +1,39 @@ +// Code generated by gocc; DO NOT EDIT. + +package lexer + +import ( + "fmt" + + "github.com/maxcalandrelli/gocc/example/rr/internal/token" +) + +type ActionTable [NumStates]ActionRow + +type ActionRow struct { + Accept token.Type + Ignore string +} + +func (a ActionRow) String() string { + return fmt.Sprintf("Accept=%d, Ignore=%s", a.Accept, a.Ignore) +} + +var ActTab = ActionTable{ + ActionRow{ // S0, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S1, Ignore("!whitespace") + Accept: -1, + Ignore: "!whitespace", + }, + ActionRow{ // S2, Accept("a") + Accept: 2, + Ignore: "", + }, + ActionRow{ // S3, Accept("c") + Accept: 3, + Ignore: "", + }, +} diff --git a/example/rr/internal/lexer/lexer.go b/example/rr/internal/lexer/lexer.go new file mode 100644 index 00000000..c483a97b --- /dev/null +++ b/example/rr/internal/lexer/lexer.go @@ -0,0 +1,153 @@ +// Code generated by gocc; DO NOT EDIT. + +package lexer + +import ( + + "io" + "bytes" + "os" + + + "github.com/maxcalandrelli/gocc/example/rr/iface" + "github.com/maxcalandrelli/gocc/example/rr/internal/token" + "github.com/maxcalandrelli/gocc/example/rr/internal/io/stream" +) + +const ( + NoState = -1 + NumStates = 4 + NumSymbols = 7 + INVALID_RUNE = rune(-1) +) + +type position struct { + token.Pos +} + +type Lexer struct { + position + stream iface.TokenStream + eof bool +} + +func NewLexerBytes(src []byte) *Lexer { + lexer := &Lexer{stream: bytes.NewReader(src)} + lexer.reset() + return lexer +} + +func NewLexerFile(fpath string) (*Lexer, error) { + s, err := os.Open(fpath) + if err != nil { + return nil, err + } + lexer := &Lexer{stream: stream.NewWindowReader(s)} + lexer.reset() + return lexer, nil +} + +func NewLexer(reader io.Reader) (*Lexer, error) { + lexer := &Lexer{} + lexer.reset() + if lexer.stream, _ = reader.(iface.TokenStream); lexer.stream == nil { + lexer.stream = stream.NewWindowReader(reader) + } + return lexer, nil +} + +func (l *Lexer) reset () { + l.position.Reset() +} + +func (l Lexer) GetStream() iface.TokenStream { + return l.stream +} + +type checkPoint int64 + +func (c checkPoint) DistanceFrom (o iface.CheckPoint) int { + return int (c - o.(checkPoint)) +} + +func (l Lexer) GetCheckPoint() iface.CheckPoint { + pos, _ := l.stream.Seek(0, io.SeekCurrent) + return checkPoint(pos) +} + +func (l Lexer) GotoCheckPoint(cp iface.CheckPoint) { + l.stream.Seek(int64(cp.(checkPoint)), io.SeekStart) +} + +func (l *Lexer) Scan() (tok *token.Token) { + tok = new(token.Token) + tok.Type = token.INVALID + tok.Lit = []byte{} + start := l.position + state := 0 + for state != -1 { + curr, size, err := l.stream.ReadRune() + if size < 1 || err != nil { + curr = INVALID_RUNE + } + if size > 0 { + l.position.Pos.Offset += size + } + nextState := -1 + if curr != INVALID_RUNE { + nextState = TransTab[state](curr) + } + state = nextState + if state != -1 { + switch curr { + case '\n': + l.position.Pos.Line++ + l.position.Pos.Column = 1 + case '\r': + l.position.Pos.Column = 1 + case '\t': + l.position.Pos.Column += 4 + default: + l.position.Pos.Column++ + } + switch { + case ActTab[state].Accept != -1: + tok.Type = ActTab[state].Accept + tok.Lit = append(tok.Lit, string(curr)...) + case ActTab[state].Ignore != "": + start = l.position + state = 0 + tok.Lit = []byte{} + } + } else if curr != INVALID_RUNE { + l.stream.UnreadRune() + } + if err == io.EOF && len(tok.Lit)==0 { + tok.Type = token.EOF + tok.Pos = start.Pos + return + } + } + tok.Pos = start.Pos + return +} + +func (l *Lexer) Reset() { + l.position.Reset() +} + +func (l Lexer) CurrentPosition() position { + return l.position +} + +func (p *position) Reset() { + p.Offset = 0 + p.Line = 1 + p.Column = 1 +} + +func (p position) StartingFrom(base position) position { + r := p + r.Pos = p.Pos.StartingFrom(base.Pos) + return r +} diff --git a/example/rr/internal/lexer/transitiontable.go b/example/rr/internal/lexer/transitiontable.go new file mode 100644 index 00000000..8b22865a --- /dev/null +++ b/example/rr/internal/lexer/transitiontable.go @@ -0,0 +1,49 @@ +// Code generated by gocc; DO NOT EDIT. + +package lexer + +/* +Let s be the current state +Let r be the current input rune +transitionTable[s](r) returns the next state. +*/ +type TransitionTable [NumStates]func(rune) int + +var TransTab = TransitionTable{ + // S0 + func(r rune) int { + switch { + case r == 9: // ['\t','\t'] + return 1 + case r == 10: // ['\n','\n'] + return 1 + case r == 13: // ['\r','\r'] + return 1 + case r == 32: // [' ',' '] + return 1 + case r == 97: // ['a','a'] + return 2 + case r == 99: // ['c','c'] + return 3 + } + return NoState + }, + // S1 + func(r rune) int { + switch { + } + return NoState + }, + // S2 + func(r rune) int { + switch { + } + return NoState + }, + // S3 + func(r rune) int { + switch { + } + return NoState + }, +} diff --git a/example/rr/internal/parser/action.go b/example/rr/internal/parser/action.go new file mode 100644 index 00000000..54bc55e9 --- /dev/null +++ b/example/rr/internal/parser/action.go @@ -0,0 +1,51 @@ +// Code generated by gocc; DO NOT EDIT. + +package parser + +import ( + "fmt" +) + +type action interface { + act() + String() string +} + +type ( + accept bool + shift int // value is next state index + reduce int // value is production index +) + +func (this accept) act() {} +func (this shift) act() {} +func (this reduce) act() {} + +func (this accept) Equal(that action) bool { + if _, ok := that.(accept); ok { + return true + } + return false +} + +func (this reduce) Equal(that action) bool { + that1, ok := that.(reduce) + if !ok { + return false + } + return this == that1 +} + +func (this shift) Equal(that action) bool { + that1, ok := that.(shift) + if !ok { + return false + } + return this == that1 +} + +func (this accept) String() string { return "accept(0)" } +func (this shift) String() string { return fmt.Sprintf("shift:%d", this) } +func (this reduce) String() string { + return fmt.Sprintf("reduce:%d(%s)", this, productionsTable[this].String) +} diff --git a/example/rr/internal/parser/actiontable.go b/example/rr/internal/parser/actiontable.go new file mode 100644 index 00000000..06641ecc --- /dev/null +++ b/example/rr/internal/parser/actiontable.go @@ -0,0 +1,95 @@ +// Code generated by gocc; DO NOT EDIT. + +package parser + +type ( + actionTable [numStates]actionRow + cdFunc func(TokenStream, interface{}) (interface{}, error, []byte) + cdAction struct { + tokenIndex int + tokenScanner cdFunc + } + actionRow struct { + canRecover bool + actions [numSymbols]action + cdActions []cdAction + } + actions struct { + table actionTable + } +) + +var parserActions = actions{ + table: actionTable{ + actionRow{ // S0 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + shift(4), // a + shift(5), // c + }, + cdActions: []cdAction{}, + }, + actionRow{ // S1 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + accept(true), // Ω + nil, // a + nil, // c + }, + cdActions: []cdAction{}, + }, + actionRow{ // S2 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(1), // Ω, reduce: RR + shift(6), // a + nil, // c + }, + cdActions: []cdAction{}, + }, + actionRow{ // S3 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(2), // Ω, reduce: RR + nil, // a + nil, // c + }, + cdActions: []cdAction{}, + }, + actionRow{ // S4 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(3), // Ω, reduce: B + reduce(4), // a, reduce: A + nil, // c + }, + cdActions: []cdAction{}, + }, + actionRow{ // S5 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(6), // Ω, reduce: A + reduce(6), // a, reduce: A + nil, // c + }, + cdActions: []cdAction{}, + }, + actionRow{ // S6 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(5), // Ω, reduce: A + reduce(5), // a, reduce: A + nil, // c + }, + cdActions: []cdAction{}, + }, + }, +} diff --git a/example/rr/internal/parser/gototable.go b/example/rr/internal/parser/gototable.go new file mode 100644 index 00000000..711398c7 --- /dev/null +++ b/example/rr/internal/parser/gototable.go @@ -0,0 +1,55 @@ +// Code generated by gocc; DO NOT EDIT. + +package parser + +const numNTSymbols = 4 + +type ( + gotoTable [numStates]gotoRow + gotoRow [numNTSymbols]int +) + +var gotoTab = gotoTable{ + gotoRow{ // S0 + -1, // Π + 1, // Π + 2, // Π + 3, // Π + }, + gotoRow{ // S1 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S2 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S3 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S4 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S5 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S6 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, +} diff --git a/example/rr/internal/parser/parser.go b/example/rr/internal/parser/parser.go new file mode 100644 index 00000000..25de6fbe --- /dev/null +++ b/example/rr/internal/parser/parser.go @@ -0,0 +1,295 @@ +// Code generated by gocc; DO NOT EDIT. + +package parser + +import ( + "errors" + "fmt" + "strings" + + "github.com/maxcalandrelli/gocc/example/rr/iface" + parseError "github.com/maxcalandrelli/gocc/example/rr/internal/errors" + "github.com/maxcalandrelli/gocc/example/rr/internal/token" +) + +const ( + numProductions = 7 + numStates = 7 + numSymbols = 8 +) + +// Stack + +type stack struct { + state []int + attrib []Attrib +} + +const INITIAL_STACK_SIZE = 100 + +func newStack() *stack { + return &stack{ + state: make([]int, 0, INITIAL_STACK_SIZE), + attrib: make([]Attrib, 0, INITIAL_STACK_SIZE), + } +} + +func (s *stack) reset() { + s.state = s.state[:0] + s.attrib = s.attrib[:0] +} + +func (s *stack) push(state int, a Attrib) { + s.state = append(s.state, state) + s.attrib = append(s.attrib, a) +} + +func (s *stack) top() int { + return s.state[len(s.state)-1] +} + +func (s *stack) peek(pos int) int { + return s.state[pos] +} + +func (s *stack) topIndex() int { + return len(s.state) - 1 +} + +func (s *stack) popN(items int) []Attrib { + lo, hi := len(s.state)-items, len(s.state) + + attrib := s.attrib[lo:hi] + + s.state = s.state[:lo] + s.attrib = s.attrib[:lo] + + return attrib +} + +func (s *stack) String() string { + w := new(strings.Builder) + fmt.Fprintf(w, "stack:\n") + for i, st := range s.state { + fmt.Fprintf(w, "\t%d: %d , ", i, st) + if s.attrib[i] == nil { + fmt.Fprintf(w, "nil") + } else { + switch attr := s.attrib[i].(type) { + case *token.Token: + fmt.Fprintf(w, "%s", attr.Lit) + default: + fmt.Fprintf(w, "%v", attr) + } + } + fmt.Fprintf(w, "\n") + } + return w.String() +} + +// Parser + +type Parser struct { + stack *stack + nextToken *token.Token + userContext interface{} +} + +type TokenStream = iface.TokenStream + +func NewParser() *Parser { + return NewParserWithContext(nil) +} + +func NewParserWithContext(u interface{}) *Parser { + p := &Parser{stack: newStack(), userContext: u} + p.Reset() + return p +} + +func (p *Parser) Reset() { + p.stack.reset() + p.stack.push(0, nil) +} + +func (p *Parser) Error(err error, scanner iface.Scanner) (recovered bool, errorAttrib *parseError.Error) { + errorAttrib = &parseError.Error{ + Err: err, + ErrorToken: p.nextToken, + ErrorSymbols: p.popNonRecoveryStates(), + ExpectedTokens: make([]string, 0, 8), + } + for t, action := range parserActions.table[p.stack.top()].actions { + if action != nil { + errorAttrib.ExpectedTokens = append(errorAttrib.ExpectedTokens, token.TokMap.Id(token.Type(t))) + } + } + + if action := parserActions.table[p.stack.top()].actions[token.TokMap.Type("error")]; action != nil { + p.stack.push(int(action.(shift)), errorAttrib) // action can only be shift + } else { + return + } + + if action := parserActions.table[p.stack.top()].actions[p.nextToken.Type]; action != nil { + recovered = true + } + for !recovered && p.nextToken.Type != token.EOF { + p.nextToken = scanner.Scan() + if action := parserActions.table[p.stack.top()].actions[p.nextToken.Type]; action != nil { + recovered = true + } + } + + return +} + +func (p *Parser) popNonRecoveryStates() (removedAttribs []parseError.ErrorSymbol) { + if rs, ok := p.firstRecoveryState(); ok { + errorSymbols := p.stack.popN(p.stack.topIndex() - rs) + removedAttribs = make([]parseError.ErrorSymbol, len(errorSymbols)) + for i, e := range errorSymbols { + removedAttribs[i] = e + } + } else { + removedAttribs = []parseError.ErrorSymbol{} + } + return +} + +// recoveryState points to the highest state on the stack, which can recover +func (p *Parser) firstRecoveryState() (recoveryState int, canRecover bool) { + recoveryState, canRecover = p.stack.topIndex(), parserActions.table[p.stack.top()].canRecover + for recoveryState > 0 && !canRecover { + recoveryState-- + canRecover = parserActions.table[p.stack.peek(recoveryState)].canRecover + } + return +} + +func (p *Parser) newError(err error) error { + e := &parseError.Error{ + Err: err, + StackTop: p.stack.top(), + ErrorToken: p.nextToken, + } + actRow := parserActions.table[p.stack.top()] + for i, t := range actRow.actions { + if t != nil { + e.ExpectedTokens = append(e.ExpectedTokens, token.TokMap.Id(token.Type(i))) + } + } + return e +} + +func (p *Parser) Parse(scanner iface.Scanner) (res interface{}, err error, ptl int) { + return p.parse(scanner, false) +} + +func (p *Parser) ParseLongestPrefix(scanner iface.Scanner) (res interface{}, err error, ptl int) { + return p.parse(scanner, true) +} + +var errNotRepositionable = errors.New("scanner not repositionable") + +func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, err error, ptl int) { + var ( + tokens iface.CheckPointable + afterPos iface.CheckPoint + checkPoint iface.CheckPoint + ) + readNextToken := func() error { + if tokens == nil && (len(parserActions.table[p.stack.top()].cdActions) > 0 || longest) { + return errNotRepositionable + } + checkPoint = tokens.GetCheckPoint() + p.nextToken = scanner.Scan() + if longest { + afterPos = tokens.GetCheckPoint() + } + return nil + } + p.Reset() + tokens, _ = scanner.(iface.CheckPointable) + startCp := tokens.GetCheckPoint() + if err := readNextToken(); err != nil { + return nil, err, tokens.GetCheckPoint().DistanceFrom(startCp) + } + for acc := false; !acc; { + action := parserActions.table[p.stack.top()].actions[p.nextToken.Type] + if action == nil { + // + // If no action, check if we have some context dependent parsing to try + // + for _, cdAction := range parserActions.table[p.stack.top()].cdActions { + tokens.GotoCheckPoint(checkPoint) + cd_res, cd_err, cd_parsed := cdAction.tokenScanner(scanner.GetStream(), p.userContext) + if cd_err == nil && len(cd_parsed) > 0 { + action = parserActions.table[p.stack.top()].actions[cdAction.tokenIndex] + if action != nil { + p.nextToken.Foreign = true + p.nextToken.ForeignAstNode = cd_res + p.nextToken.Lit = cd_parsed + p.nextToken.Type = token.Type(cdAction.tokenIndex) + break + } + } + } + } + // + // Still no action? If a longest possible parsing is requested in place + // of a full text, we should try to check if an EOF here would have led + // to a successful parsing instead + // Rember that token.EOF is 1, that is the index of SyntaxEof into symbol table + // Dirty, dirty, dirty... but I found it as it is, and I prefer not to touch + // + if action == nil && longest { + tokens.GotoCheckPoint(checkPoint) + action = parserActions.table[p.stack.top()].actions[token.EOF] + if action == nil { + // + // ok, let's consume the token then + // + tokens.GotoCheckPoint(afterPos) + } + } + + // + // Well, no action is no action after all... + // + if action == nil { + if recovered, errAttrib := p.Error(nil, scanner); !recovered { + p.nextToken = errAttrib.ErrorToken + return nil, p.newError(nil), tokens.GetCheckPoint().DistanceFrom(startCp) + } + if action = parserActions.table[p.stack.top()].actions[p.nextToken.Type]; action == nil { + panic("Error recovery led to invalid action") + } + } + + switch act := action.(type) { + case accept: + res = p.stack.popN(1)[0] + acc = true + case shift: + p.stack.push(int(act), p.nextToken) + if p.nextToken.Foreign { + p.stack.push(int(act), p.nextToken.ForeignAstNode) + } + if err := readNextToken(); err != nil { + return nil, err, tokens.GetCheckPoint().DistanceFrom(startCp) + } + case reduce: + prod := productionsTable[int(act)] + attrib, err := prod.ReduceFunc(p.userContext, p.stack.popN(prod.NumSymbols)) + if err != nil { + return nil, p.newError(err), tokens.GetCheckPoint().DistanceFrom(startCp) + } else { + p.stack.push(gotoTab[p.stack.top()][prod.NTType], attrib) + } + default: + panic("unknown action: " + action.String()) + } + } + return res, nil, tokens.GetCheckPoint().DistanceFrom(startCp) +} diff --git a/example/rr/internal/parser/productionstable.go b/example/rr/internal/parser/productionstable.go new file mode 100644 index 00000000..c5bc92c0 --- /dev/null +++ b/example/rr/internal/parser/productionstable.go @@ -0,0 +1,91 @@ +// Code generated by gocc; DO NOT EDIT. + +package parser + +type ( + //TODO: change type and variable names to be consistent with other tables + ProdTab [numProductions]ProdTabEntry + ProdTabEntry struct { + String string + Id string + NTType int + Index int + NumSymbols int + ReduceFunc func(interface{}, []Attrib) (Attrib, error) + } + Attrib interface { + } +) + +var productionsTable = ProdTab{ + ProdTabEntry{ + String: `S' : Π << >>`, + Id: "S'", + NTType: 0, + Index: 0, + NumSymbols: 1, + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { + return X[0], nil + }, + }, + ProdTabEntry{ + String: `RR : Π << >>`, + Id: "RR", + NTType: 1, + Index: 1, + NumSymbols: 1, + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { + return X[0], nil + }, + }, + ProdTabEntry{ + String: `RR : Π << >>`, + Id: "RR", + NTType: 1, + Index: 2, + NumSymbols: 1, + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { + return X[0], nil + }, + }, + ProdTabEntry{ + String: `B : a << "B ", nil >>`, + Id: "B", + NTType: 3, + Index: 3, + NumSymbols: 1, + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { + return "B ", nil + }, + }, + ProdTabEntry{ + String: `A : a << "A0 ", nil >>`, + Id: "A", + NTType: 2, + Index: 4, + NumSymbols: 1, + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { + return "A0 ", nil + }, + }, + ProdTabEntry{ + String: `A : Π a << "A1 ", nil >>`, + Id: "A", + NTType: 2, + Index: 5, + NumSymbols: 2, + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { + return "A1 ", nil + }, + }, + ProdTabEntry{ + String: `A : c << "A2 ", nil >>`, + Id: "A", + NTType: 2, + Index: 6, + NumSymbols: 1, + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { + return "A2 ", nil + }, + }, +} diff --git a/example/rr/internal/token/token.go b/example/rr/internal/token/token.go new file mode 100644 index 00000000..794c93e8 --- /dev/null +++ b/example/rr/internal/token/token.go @@ -0,0 +1,89 @@ +// Code generated by gocc; DO NOT EDIT. + +package token + +import ( + "fmt" +) + +type Token struct { + Type + Lit []byte + Pos + ForeignAstNode interface{} + Foreign bool +} + +type Type int + +const ( + INVALID Type = iota + EOF +) + +type Pos struct { + Offset int + Line int + Column int +} + +func (p Pos) String() string { + return fmt.Sprintf("Pos(offset=%d, line=%d, column=%d)", p.Offset, p.Line, p.Column) +} + +func (p Pos) StartingFrom(base Pos) Pos { + r := base + r.Offset += p.Offset + r.Line += p.Line + r.Column = p.Column + if p.Line > 0 && base.Line > 0 { + r.Line-- + } + if r.Column < 1 { + r.Column = 1 + } + return r +} + +type TokenMap struct { + typeMap []string + idMap map[string]Type +} + +func (m TokenMap) Id(tok Type) string { + if int(tok) < len(m.typeMap) { + return m.typeMap[tok] + } + return "unknown" +} + +func (m TokenMap) Type(tok string) Type { + if typ, exist := m.idMap[tok]; exist { + return typ + } + return INVALID +} + +func (m TokenMap) TokenString(tok *Token) string { + return fmt.Sprintf("%s(%d,<%s>)", m.Id(tok.Type), tok.Type, tok.Lit) +} + +func (m TokenMap) StringType(typ Type) string { + return fmt.Sprintf("%s(%d)", m.Id(typ), typ) +} + +var TokMap = TokenMap{ + typeMap: []string{ + "INVALID", + "Ω", + "a", + "c", + }, + + idMap: map[string]Type{ + "INVALID": 0, + "Ω": 1, + "a": 2, + "c": 3, + }, +} diff --git a/example/rr/internal/util/litconv.go b/example/rr/internal/util/litconv.go new file mode 100644 index 00000000..1aeb6166 --- /dev/null +++ b/example/rr/internal/util/litconv.go @@ -0,0 +1,108 @@ +// Code generated by gocc; DO NOT EDIT. + +package util + +import ( + "fmt" + "strconv" + "unicode" + "unicode/utf8" +) + +/* Interface */ + +/* +Convert the literal value of a scanned token to rune +*/ +func RuneValue(lit []byte) rune { + if lit[1] == '\\' { + return escapeCharVal(lit) + } + r, size := utf8.DecodeRune(lit[1:]) + if size != len(lit)-2 { + panic(fmt.Sprintf("Error decoding rune. Lit: %s, rune: %d, size%d\n", lit, r, size)) + } + return r +} + +/* +Convert the literal value of a scanned token to int64 +*/ +func IntValue(lit []byte) (int64, error) { + return strconv.ParseInt(string(lit), 10, 64) +} + +/* +Convert the literal value of a scanned token to uint64 +*/ +func UintValue(lit []byte) (uint64, error) { + return strconv.ParseUint(string(lit), 10, 64) +} + +/* Util */ + +func escapeCharVal(lit []byte) rune { + var i, base, max uint32 + offset := 2 + switch lit[offset] { + case 'a': + return '\a' + case 'b': + return '\b' + case 'f': + return '\f' + case 'n': + return '\n' + case 'r': + return '\r' + case 't': + return '\t' + case 'v': + return '\v' + case '\\': + return '\\' + case '\'': + return '\'' + case '0', '1', '2', '3', '4', '5', '6', '7': + i, base, max = 3, 8, 255 + case 'x': + i, base, max = 2, 16, 255 + offset++ + case 'u': + i, base, max = 4, 16, unicode.MaxRune + offset++ + case 'U': + i, base, max = 8, 16, unicode.MaxRune + offset++ + default: + panic(fmt.Sprintf("Error decoding character literal: %s\n", lit)) + } + + var x uint32 + for ; i > 0 && offset < len(lit)-1; i-- { + ch, size := utf8.DecodeRune(lit[offset:]) + offset += size + d := uint32(digitVal(ch)) + if d >= base { + panic(fmt.Sprintf("charVal(%s): illegal character (%c) in escape sequence. size=%d, offset=%d", lit, ch, size, offset)) + } + x = x*base + d + } + if x > max || 0xD800 <= x && x < 0xE000 { + panic(fmt.Sprintf("Error decoding escape char value. Lit:%s, offset:%d, escape sequence is invalid Unicode code point\n", lit, offset)) + } + + return rune(x) +} + +func digitVal(ch rune) int { + switch { + case '0' <= ch && ch <= '9': + return int(ch) - '0' + case 'a' <= ch && ch <= 'f': + return int(ch) - 'a' + 10 + case 'A' <= ch && ch <= 'F': + return int(ch) - 'A' + 10 + } + return 16 // larger than any legal digit val +} diff --git a/example/rr/internal/util/rune.go b/example/rr/internal/util/rune.go new file mode 100644 index 00000000..bd8523a4 --- /dev/null +++ b/example/rr/internal/util/rune.go @@ -0,0 +1,39 @@ +// Code generated by gocc; DO NOT EDIT. + +package util + +import ( + "fmt" +) + +func RuneToString(r rune) string { + if r >= 0x20 && r < 0x7f { + return fmt.Sprintf("'%c'", r) + } + switch r { + case 0x07: + return "'\\a'" + case 0x08: + return "'\\b'" + case 0x0C: + return "'\\f'" + case 0x0A: + return "'\\n'" + case 0x0D: + return "'\\r'" + case 0x09: + return "'\\t'" + case 0x0b: + return "'\\v'" + case 0x5c: + return "'\\\\\\'" + case 0x27: + return "'\\''" + case 0x22: + return "'\\\"'" + } + if r < 0x10000 { + return fmt.Sprintf("\\u%04x", r) + } + return fmt.Sprintf("\\U%08x", r) +} diff --git a/example/rr/main/main.go b/example/rr/main/main.go new file mode 100644 index 00000000..d1e020b1 --- /dev/null +++ b/example/rr/main/main.go @@ -0,0 +1,53 @@ +package main + +import ( + "flag" + "fmt" + "os" + "strings" + + rr "github.com/maxcalandrelli/gocc/example/rr" +) + +func showResult(r interface{}, e error, l int) { + if e != nil { + fmt.Fprintf(os.Stderr, "parsing returned the following error: %s\n", e.Error()) + } else { + fmt.Printf("r=%#v, %d bytes\n", r, l) + } +} + +var ( + File string + Text string + Longest bool +) + +func parse(longest bool, lex *rr.Lexer) (res interface{}, err error, ptl int) { + if longest { + return rr.NewParser().ParseLongestPrefix(lex) + } else { + return rr.NewParser().Parse(lex) + } + return +} + +func main() { + flag.StringVar(&File, "file", "", "parse also text in file") + flag.StringVar(&Text, "text", "", "parse also text given with flag") + flag.BoolVar(&Longest, "longest", false, "parse longest possible part") + flag.Parse() + if Text > "" { + showResult(parse(Longest, rr.NewLexerString(Text))) + } + if File > "" { + l, e := rr.NewLexerFile(File) + if e != nil { + panic(e) + } + showResult(parse(Longest, l)) + } + if str := strings.Join(flag.Args(), " "); str > "" { + showResult(parse(Longest, rr.NewLexerString(str))) + } +} diff --git a/example/rr/parser/productionstable.go b/example/rr/parser/productionstable.go index aa11a461..a00d45c6 100644 --- a/example/rr/parser/productionstable.go +++ b/example/rr/parser/productionstable.go @@ -2,6 +2,8 @@ package parser + + type ( //TODO: change type and variable names to be consistent with other tables ProdTab [numProductions]ProdTabEntry diff --git a/example/rr/rr.go b/example/rr/rr.go new file mode 100644 index 00000000..34aee78b --- /dev/null +++ b/example/rr/rr.go @@ -0,0 +1,62 @@ +// Code generated by gocc; DO NOT EDIT. + +package rr + +import ( + "io" + + "github.com/maxcalandrelli/gocc/example/rr/iface" + "github.com/maxcalandrelli/gocc/example/rr/internal/io/stream" + "github.com/maxcalandrelli/gocc/example/rr/internal/lexer" + "github.com/maxcalandrelli/gocc/example/rr/internal/parser" + "github.com/maxcalandrelli/gocc/example/rr/internal/token" +) + +type ( + Token = token.Token + Lexer = lexer.Lexer + Parser = parser.Parser + TokenStream = iface.TokenStream + WindowReader = stream.WindowReader + Scanner = iface.Scanner +) + +func ParseFile(fpath string) (interface{}, error, int) { + if lexer, err := NewLexerFile(fpath); err == nil { + return NewParser().Parse(lexer) + } else { + return nil, err, 0 + } +} + +func ParseText(text string) (interface{}, error, int) { + return NewParser().Parse(NewLexerBytes([]byte(text))) +} + +func NewLexerBytes(src []byte) *lexer.Lexer { + return lexer.NewLexerBytes(src) +} + +func NewLexerString(src string) *lexer.Lexer { + return lexer.NewLexerBytes([]byte(src)) +} + +func NewLexerFile(fpath string) (*lexer.Lexer, error) { + return lexer.NewLexerFile(fpath) +} + +func NewParser() *parser.Parser { + return parser.NewParser() +} + +func NewWindowReaderFromBytes(src []byte) WindowReader { + return stream.NewWindowReaderFromBytes(src) +} + +func NewWindowReader(rdr io.Reader) WindowReader { + return stream.NewWindowReader(rdr) +} + +func NewLimitedWindowReader(rdr io.Reader, sizeMin, sizeMax int) WindowReader { + return stream.NewLimitedWindowReader(rdr, sizeMin, sizeMax) +} diff --git a/example/sr/iface/iface.go b/example/sr/iface/iface.go new file mode 100644 index 00000000..9db0789e --- /dev/null +++ b/example/sr/iface/iface.go @@ -0,0 +1,30 @@ +// Code generated by gocc; DO NOT EDIT. + +package iface + +import ( + "github.com/maxcalandrelli/gocc/example/sr/internal/token" + "io" +) + +type ( + Scanner interface { + Scan() (tok *token.Token) + GetStream() TokenStream + } + + CheckPoint interface { + DistanceFrom(CheckPoint) int + } + + CheckPointable interface { + GetCheckPoint() CheckPoint + GotoCheckPoint(CheckPoint) + } + + TokenStream interface { + io.Reader + io.RuneScanner + io.Seeker + } +) diff --git a/example/sr/internal/errors/errors.go b/example/sr/internal/errors/errors.go new file mode 100644 index 00000000..5127727f --- /dev/null +++ b/example/sr/internal/errors/errors.go @@ -0,0 +1,56 @@ +// Code generated by gocc; DO NOT EDIT. + +package errors + +import ( + "fmt" + "strings" + + "github.com/maxcalandrelli/gocc/example/sr/internal/token" +) + +type ErrorSymbol interface { +} + +type Error struct { + Err error + ErrorToken *token.Token + ErrorSymbols []ErrorSymbol + ExpectedTokens []string + StackTop int +} + +func (e *Error) String() string { + w := new(strings.Builder) + fmt.Fprintf(w, "Error") + if e.Err != nil { + fmt.Fprintf(w, " %s\n", e.Err) + } else { + fmt.Fprintf(w, "\n") + } + fmt.Fprintf(w, "Token: type=%d, lit=%s\n", e.ErrorToken.Type, e.ErrorToken.Lit) + fmt.Fprintf(w, "Pos: offset=%d, line=%d, column=%d\n", e.ErrorToken.Pos.Offset, e.ErrorToken.Pos.Line, e.ErrorToken.Pos.Column) + fmt.Fprintf(w, "Expected one of: ") + for _, sym := range e.ExpectedTokens { + fmt.Fprintf(w, "%s ", sym) + } + fmt.Fprintf(w, "ErrorSymbol:\n") + for _, sym := range e.ErrorSymbols { + fmt.Fprintf(w, "%v\n", sym) + } + return w.String() +} + +func (e *Error) Error() string { + w := new(strings.Builder) + fmt.Fprintf(w, "Error in S%d: %s, %s", e.StackTop, token.TokMap.TokenString(e.ErrorToken), e.ErrorToken.Pos.String()) + if e.Err != nil { + fmt.Fprintf(w, ": %+v", e.Err) + } else { + fmt.Fprintf(w, ", expected one of: ") + for _, expected := range e.ExpectedTokens { + fmt.Fprintf(w, "%s ", expected) + } + } + return w.String() +} diff --git a/example/sr/internal/io/stream/internal/stream_impl.go b/example/sr/internal/io/stream/internal/stream_impl.go new file mode 100644 index 00000000..358aa160 --- /dev/null +++ b/example/sr/internal/io/stream/internal/stream_impl.go @@ -0,0 +1,275 @@ +package internal + +import ( + "io" + "sync" + "unicode/utf8" +) + +type ( + impl_WindowReader struct { + bufferBlockSize int + maxBufferSize int + buffers [][]byte + available int + absbase int64 + position int + eof bool + rdr io.Reader + lock *sync.Mutex + } +) + +func (s *impl_WindowReader) lockReader() { + if s.lock != nil { + s.lock.Lock() + } +} + +func (s *impl_WindowReader) unlockReader() { + if s.lock != nil { + s.lock.Unlock() + } +} + +func (s *impl_WindowReader) seek(offset int64, whence int) (offs int64, err error) { + switch whence { + case io.SeekStart: + return s.seek(offset-s.ReadPosition(), io.SeekCurrent) + case io.SeekCurrent: + switch { + case offset == 0: + return s.ReadPosition(), nil + case offset < 0: + if -offset > int64(s.maxBackOffset()) { + err = io.ErrShortBuffer + } else { + s.advanceGet(int(offset)) + } + case offset > 0: + for offset > 0 && !s.eof { + available := s.Buffered() + if offset <= int64(available) { + s.advanceGet(int(offset)) + break + } + if available > 0 { + s.advanceGet(available) + offset -= int64(available) + } + read, _ := s.fetchBytes(int(offset)) + s.advanceGet(read) + offset -= int64(read) + } + if s.eof { + err = io.EOF + } + } + case io.SeekEnd: + for !s.eof { + s.seek(int64(s.MaxCap()), io.SeekCurrent) + } + s.seek(int64(s.Buffered()), io.SeekCurrent) + } + if s.eof && err == nil && s.Buffered() > 0 { + s.eof = false + } + return s.ReadPosition(), err +} + +func (s impl_WindowReader) maxBackOffset() int { + r := s.position + if s.absbase > 0 { + r = s.Cap() - s.Buffered() + } + return r +} + +func (s impl_WindowReader) bufferIndex(pos int) int { + if pos < 0 { + panic("negative position") + } + return pos / s.bufferBlockSize +} + +func (s impl_WindowReader) bufferBytes(pos int) []byte { + return s.buffers[s.bufferIndex(pos)] +} + +func (s impl_WindowReader) bufferByteRange(pos int, length int) []byte { + p := s.bufferOffset(pos) + return s.bufferBytes(pos)[p : p+length] +} + +func (s impl_WindowReader) bufferOffset(pos int) int { + return pos % s.bufferBlockSize +} + +func (s *impl_WindowReader) advanceGet(n int) { + sz := s.Cap() + switch { + case n < 0: + if -n > s.maxBackOffset() { + panic("underflow") + } + s.position += n + if s.position < 0 { + s.position += sz + s.absbase -= int64(sz) + } + case n > 0: + if n > s.Buffered() { + panic("overflow") + } + s.position += n + if s.position >= sz { + s.position -= sz + s.absbase += int64(sz) + } + } + s.available -= n +} + +func (s *impl_WindowReader) copy(to []byte, length int) { + for offs, cp := 0, 0; length > 0; length -= cp { + s.position %= s.MaxCap() + p := s.bufferOffset(s.position) + b := s.bufferBytes(s.position) + r := s.bufferBlockSize - p + if length <= r { + cp = copy(to[offs:], b[p:p+length]) + } else { + cp = copy(to[offs:], b[p:]) + } + s.advanceGet(cp) + offs += cp + } +} + +func (s *impl_WindowReader) fetchBytes(n int) (read int, err error) { + if s.rdr == nil { + s.eof = true + return 0, io.EOF + } + for n > 0 && s.Buffered() < s.MaxCap() && err == nil { + readNow := n + putpos := s.position + s.available + r := s.bufferBlockSize - s.bufferOffset(putpos) + if readNow > r { + readNow = r + } + for s.bufferIndex(putpos) >= len(s.buffers) && s.Cap() < s.MaxCap() { + s.buffers = append(s.buffers, make([]byte, s.bufferBlockSize)) + } + putpos %= s.MaxCap() + offs := s.bufferOffset(putpos) + if r, err = s.rdr.Read(s.bufferBytes(putpos)[offs : offs+readNow]); r > 0 { + s.available += r + read += r + n -= r + } + } + if n > 0 && err == nil { + err = io.ErrShortBuffer + } + return +} + +func (s *impl_WindowReader) read(p []byte) (read int, err error) { + if s.eof { + return 0, io.EOF + } + for read < len(p) && err == nil { + available := s.Buffered() + if len(p)-read <= available { + s.copy(p[read:], len(p)-read) + read = len(p) + } else { + if available == 0 { + available, err = s.fetchBytes(len(p) - read) + } + s.copy(p[read:], available) + read += available + switch err { + case io.ErrShortBuffer: + err = nil + case io.EOF: + s.eof = true + } + } + } + return +} + +func (s impl_WindowReader) peekByte() (byte, error) { + if s.Buffered() < 1 { + return 0, io.ErrShortBuffer + } + return s.bufferBytes(s.position)[s.bufferOffset(s.position)], nil +} + +func (s *impl_WindowReader) unreadByte() error { + _, e := s.seek(-1, io.SeekCurrent) + return e +} + +func (s *impl_WindowReader) readRune() (r rune, size int, err error) { + for i := 1; err == nil && i <= 4; i++ { + if s.Buffered() < i { + if _, err = s.fetchBytes(i); err != nil { + return + } + } + t := s.bufferByteRange(s.position, i) + if r, size = utf8.DecodeRune(t); r != utf8.RuneError { + s.advanceGet(size) + return + } + } + return utf8.RuneError, 0, err +} + +func (s *impl_WindowReader) unreadRune() (err error) { + tmps := *s + tmpb := []byte{} + for { + if _, err = tmps.seek(-1, io.SeekCurrent); err == nil { + b, _ := tmps.peekByte() + tmpb = append([]byte{b}, tmpb...) + switch len(tmpb) { + case 1: + if (tmpb[0] & 0xC0) == 0x80 { + continue + } + _, err = s.seek(-int64(len(tmpb)), io.SeekCurrent) + return + case 2: + if (tmpb[0] & 0xC0) == 0x80 { + continue + } + if (tmpb[0] & 0xE0) != 0xC0 { + break + } + _, err = s.seek(-int64(len(tmpb)), io.SeekCurrent) + return + case 3: + if (tmpb[0] & 0xC0) == 0x80 { + continue + } + if (tmpb[0] & 0xF0) != 0xE0 { + break + } + _, err = s.seek(-int64(len(tmpb)), io.SeekCurrent) + return + case 4: + if (tmpb[0] & 0xF8) != 0xF0 { + break + } + _, err = s.seek(-int64(len(tmpb)), io.SeekCurrent) + return + } + } + } + _, err = s.seek(-1, io.SeekCurrent) + return +} diff --git a/example/sr/internal/io/stream/internal/stream_public.go b/example/sr/internal/io/stream/internal/stream_public.go new file mode 100644 index 00000000..20ed7b5e --- /dev/null +++ b/example/sr/internal/io/stream/internal/stream_public.go @@ -0,0 +1,101 @@ +package internal + +import ( + "io" +) + +func NewWindowReader(buf []byte, underlyingReader io.Reader, blksize, smax int, InfoPrefixRoundUp bool) *impl_WindowReader { + if blksize < 0 || smax < blksize { + panic("illegal buffer size") + } + r := &impl_WindowReader{rdr: underlyingReader} + r.bufferBlockSize = blksize + if underlyingReader != nil { + if blksize <= 0 { + r.bufferBlockSize = 1 << 10 + } else if InfoPrefixRoundUp { + for r.bufferBlockSize = 1; blksize > 0; r.bufferBlockSize = r.bufferBlockSize << 1 { + blksize = blksize >> 1 + } + } + if smax > 0 { + r.maxBufferSize = ((smax-1)/r.bufferBlockSize + 1) * r.bufferBlockSize + } + r.buffers = [][]byte{} + } else { + r.buffers = [][]byte{buf} + r.available = len(buf) + r.bufferBlockSize = r.available + r.maxBufferSize = r.available + } + return r +} + +func (s impl_WindowReader) Cap() int { + return len(s.buffers) * s.bufferBlockSize +} + +func (s impl_WindowReader) BlockSize() int { + return s.bufferBlockSize +} + +func (s impl_WindowReader) MaxCap() int { + if s.maxBufferSize > 0 { + return s.maxBufferSize + } + return 1 << 31 +} + +func (s impl_WindowReader) MaxUnreadSize() int { + return s.maxBackOffset() +} + +func (s impl_WindowReader) Buffered() int { + return s.available +} + +func (s impl_WindowReader) ReadPosition() int64 { + return s.absbase + int64(s.position) +} + +func (s *impl_WindowReader) Read(p []byte) (read int, err error) { + s.lockReader() + defer func() { s.unlockReader() }() + return s.read(p) +} + +func (s *impl_WindowReader) Seek(offset int64, whence int) (offs int64, err error) { + s.lockReader() + defer func() { s.unlockReader() }() + return s.seek(offset, whence) +} + +func (s *impl_WindowReader) ReadByte() (byte, error) { + b := []byte{0} + _, err := s.Read(b) + return b[0], err +} + +func (s *impl_WindowReader) PeekByte() (byte, error) { + s.lockReader() + defer func() { s.unlockReader() }() + return s.peekByte() +} + +func (s *impl_WindowReader) UnreadByte() error { + s.lockReader() + defer func() { s.unlockReader() }() + return s.unreadByte() +} + +func (s *impl_WindowReader) ReadRune() (r rune, size int, err error) { + s.lockReader() + defer func() { s.unlockReader() }() + return s.readRune() +} + +func (s *impl_WindowReader) UnreadRune() (err error) { + s.lockReader() + defer func() { s.unlockReader() }() + return s.unreadRune() +} diff --git a/example/sr/internal/io/stream/stream.go b/example/sr/internal/io/stream/stream.go new file mode 100644 index 00000000..684e9ad1 --- /dev/null +++ b/example/sr/internal/io/stream/stream.go @@ -0,0 +1,39 @@ +package stream + +import ( + internal "github.com/maxcalandrelli/gocc/example/sr/internal/io/stream/internal" + "io" +) + +type ( + WindowReader interface { + BlockSize() int + Buffered() int + Cap() int + MaxCap() int + Read([]byte) (int, error) + ReadByte() (byte, error) + ReadPosition() int64 + ReadRune() (rune, int, error) + Seek(int64, int) (int64, error) + UnreadByte() error + UnreadRune() error + MaxUnreadSize() int + } +) + +var ( + InfoPrefixRoundUp = false +) + +func NewWindowReaderFromBytes(src []byte) WindowReader { + return internal.NewWindowReader(src, nil, 0, 0, InfoPrefixRoundUp) +} + +func NewWindowReader(rdr io.Reader) WindowReader { + return internal.NewWindowReader(nil, rdr, 0, 0, false) +} + +func NewLimitedWindowReader(rdr io.Reader, sizeMin, sizeMax int) WindowReader { + return internal.NewWindowReader(nil, rdr, sizeMin, sizeMax, InfoPrefixRoundUp) +} diff --git a/example/sr/internal/lexer/acttab.go b/example/sr/internal/lexer/acttab.go new file mode 100644 index 00000000..417bf111 --- /dev/null +++ b/example/sr/internal/lexer/acttab.go @@ -0,0 +1,91 @@ +// Code generated by gocc; DO NOT EDIT. + +package lexer + +import ( + "fmt" + + "github.com/maxcalandrelli/gocc/example/sr/internal/token" +) + +type ActionTable [NumStates]ActionRow + +type ActionRow struct { + Accept token.Type + Ignore string +} + +func (a ActionRow) String() string { + return fmt.Sprintf("Accept=%d, Ignore=%s", a.Accept, a.Ignore) +} + +var ActTab = ActionTable{ + ActionRow{ // S0, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S1, Ignore("!whitespace") + Accept: -1, + Ignore: "!whitespace", + }, + ActionRow{ // S2, Accept("id") + Accept: 3, + Ignore: "", + }, + ActionRow{ // S3, Accept("id") + Accept: 3, + Ignore: "", + }, + ActionRow{ // S4, Accept("id") + Accept: 3, + Ignore: "", + }, + ActionRow{ // S5, Accept("id") + Accept: 3, + Ignore: "", + }, + ActionRow{ // S6, Accept("id") + Accept: 3, + Ignore: "", + }, + ActionRow{ // S7, Accept("id") + Accept: 3, + Ignore: "", + }, + ActionRow{ // S8, Accept("id") + Accept: 3, + Ignore: "", + }, + ActionRow{ // S9, Accept("id") + Accept: 3, + Ignore: "", + }, + ActionRow{ // S10, Accept("id") + Accept: 3, + Ignore: "", + }, + ActionRow{ // S11, Accept("Λ") + Accept: 2, + Ignore: "", + }, + ActionRow{ // S12, Accept("id") + Accept: 3, + Ignore: "", + }, + ActionRow{ // S13, Accept("id") + Accept: 3, + Ignore: "", + }, + ActionRow{ // S14, Accept("id") + Accept: 3, + Ignore: "", + }, + ActionRow{ // S15, Accept("Λ") + Accept: 5, + Ignore: "", + }, + ActionRow{ // S16, Accept("Λ") + Accept: 4, + Ignore: "", + }, +} diff --git a/example/sr/internal/lexer/lexer.go b/example/sr/internal/lexer/lexer.go new file mode 100644 index 00000000..1f99e272 --- /dev/null +++ b/example/sr/internal/lexer/lexer.go @@ -0,0 +1,153 @@ +// Code generated by gocc; DO NOT EDIT. + +package lexer + +import ( + + "io" + "bytes" + "os" + + + "github.com/maxcalandrelli/gocc/example/sr/iface" + "github.com/maxcalandrelli/gocc/example/sr/internal/token" + "github.com/maxcalandrelli/gocc/example/sr/internal/io/stream" +) + +const ( + NoState = -1 + NumStates = 17 + NumSymbols = 20 + INVALID_RUNE = rune(-1) +) + +type position struct { + token.Pos +} + +type Lexer struct { + position + stream iface.TokenStream + eof bool +} + +func NewLexerBytes(src []byte) *Lexer { + lexer := &Lexer{stream: bytes.NewReader(src)} + lexer.reset() + return lexer +} + +func NewLexerFile(fpath string) (*Lexer, error) { + s, err := os.Open(fpath) + if err != nil { + return nil, err + } + lexer := &Lexer{stream: stream.NewWindowReader(s)} + lexer.reset() + return lexer, nil +} + +func NewLexer(reader io.Reader) (*Lexer, error) { + lexer := &Lexer{} + lexer.reset() + if lexer.stream, _ = reader.(iface.TokenStream); lexer.stream == nil { + lexer.stream = stream.NewWindowReader(reader) + } + return lexer, nil +} + +func (l *Lexer) reset () { + l.position.Reset() +} + +func (l Lexer) GetStream() iface.TokenStream { + return l.stream +} + +type checkPoint int64 + +func (c checkPoint) DistanceFrom (o iface.CheckPoint) int { + return int (c - o.(checkPoint)) +} + +func (l Lexer) GetCheckPoint() iface.CheckPoint { + pos, _ := l.stream.Seek(0, io.SeekCurrent) + return checkPoint(pos) +} + +func (l Lexer) GotoCheckPoint(cp iface.CheckPoint) { + l.stream.Seek(int64(cp.(checkPoint)), io.SeekStart) +} + +func (l *Lexer) Scan() (tok *token.Token) { + tok = new(token.Token) + tok.Type = token.INVALID + tok.Lit = []byte{} + start := l.position + state := 0 + for state != -1 { + curr, size, err := l.stream.ReadRune() + if size < 1 || err != nil { + curr = INVALID_RUNE + } + if size > 0 { + l.position.Pos.Offset += size + } + nextState := -1 + if curr != INVALID_RUNE { + nextState = TransTab[state](curr) + } + state = nextState + if state != -1 { + switch curr { + case '\n': + l.position.Pos.Line++ + l.position.Pos.Column = 1 + case '\r': + l.position.Pos.Column = 1 + case '\t': + l.position.Pos.Column += 4 + default: + l.position.Pos.Column++ + } + switch { + case ActTab[state].Accept != -1: + tok.Type = ActTab[state].Accept + tok.Lit = append(tok.Lit, string(curr)...) + case ActTab[state].Ignore != "": + start = l.position + state = 0 + tok.Lit = []byte{} + } + } else if curr != INVALID_RUNE { + l.stream.UnreadRune() + } + if err == io.EOF && len(tok.Lit)==0 { + tok.Type = token.EOF + tok.Pos = start.Pos + return + } + } + tok.Pos = start.Pos + return +} + +func (l *Lexer) Reset() { + l.position.Reset() +} + +func (l Lexer) CurrentPosition() position { + return l.position +} + +func (p *position) Reset() { + p.Offset = 0 + p.Line = 1 + p.Column = 1 +} + +func (p position) StartingFrom(base position) position { + r := p + r.Pos = p.Pos.StartingFrom(base.Pos) + return r +} diff --git a/example/sr/internal/lexer/transitiontable.go b/example/sr/internal/lexer/transitiontable.go new file mode 100644 index 00000000..3d2f9d7a --- /dev/null +++ b/example/sr/internal/lexer/transitiontable.go @@ -0,0 +1,289 @@ +// Code generated by gocc; DO NOT EDIT. + +package lexer + +/* +Let s be the current state +Let r be the current input rune +transitionTable[s](r) returns the next state. +*/ +type TransitionTable [NumStates]func(rune) int + +var TransTab = TransitionTable{ + // S0 + func(r rune) int { + switch { + case r == 9: // ['\t','\t'] + return 1 + case r == 10: // ['\n','\n'] + return 1 + case r == 13: // ['\r','\r'] + return 1 + case r == 32: // [' ',' '] + return 1 + case 65 <= r && r <= 90: // ['A','Z'] + return 2 + case r == 95: // ['_','_'] + return 3 + case 97 <= r && r <= 100: // ['a','d'] + return 2 + case r == 101: // ['e','e'] + return 4 + case 102 <= r && r <= 104: // ['f','h'] + return 2 + case r == 105: // ['i','i'] + return 5 + case 106 <= r && r <= 115: // ['j','s'] + return 2 + case r == 116: // ['t','t'] + return 6 + case 117 <= r && r <= 122: // ['u','z'] + return 2 + } + return NoState + }, + // S1 + func(r rune) int { + switch { + } + return NoState + }, + // S2 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 7 + case 65 <= r && r <= 90: // ['A','Z'] + return 8 + case r == 95: // ['_','_'] + return 9 + case 97 <= r && r <= 122: // ['a','z'] + return 8 + } + return NoState + }, + // S3 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 7 + case 65 <= r && r <= 90: // ['A','Z'] + return 8 + case r == 95: // ['_','_'] + return 9 + case 97 <= r && r <= 122: // ['a','z'] + return 8 + } + return NoState + }, + // S4 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 7 + case 65 <= r && r <= 90: // ['A','Z'] + return 8 + case r == 95: // ['_','_'] + return 9 + case 97 <= r && r <= 107: // ['a','k'] + return 8 + case r == 108: // ['l','l'] + return 10 + case 109 <= r && r <= 122: // ['m','z'] + return 8 + } + return NoState + }, + // S5 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 7 + case 65 <= r && r <= 90: // ['A','Z'] + return 8 + case r == 95: // ['_','_'] + return 9 + case 97 <= r && r <= 101: // ['a','e'] + return 8 + case r == 102: // ['f','f'] + return 11 + case 103 <= r && r <= 122: // ['g','z'] + return 8 + } + return NoState + }, + // S6 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 7 + case 65 <= r && r <= 90: // ['A','Z'] + return 8 + case r == 95: // ['_','_'] + return 9 + case 97 <= r && r <= 103: // ['a','g'] + return 8 + case r == 104: // ['h','h'] + return 12 + case 105 <= r && r <= 122: // ['i','z'] + return 8 + } + return NoState + }, + // S7 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 7 + case 65 <= r && r <= 90: // ['A','Z'] + return 8 + case r == 95: // ['_','_'] + return 9 + case 97 <= r && r <= 122: // ['a','z'] + return 8 + } + return NoState + }, + // S8 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 7 + case 65 <= r && r <= 90: // ['A','Z'] + return 8 + case r == 95: // ['_','_'] + return 9 + case 97 <= r && r <= 122: // ['a','z'] + return 8 + } + return NoState + }, + // S9 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 7 + case 65 <= r && r <= 90: // ['A','Z'] + return 8 + case r == 95: // ['_','_'] + return 9 + case 97 <= r && r <= 122: // ['a','z'] + return 8 + } + return NoState + }, + // S10 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 7 + case 65 <= r && r <= 90: // ['A','Z'] + return 8 + case r == 95: // ['_','_'] + return 9 + case 97 <= r && r <= 114: // ['a','r'] + return 8 + case r == 115: // ['s','s'] + return 13 + case 116 <= r && r <= 122: // ['t','z'] + return 8 + } + return NoState + }, + // S11 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 7 + case 65 <= r && r <= 90: // ['A','Z'] + return 8 + case r == 95: // ['_','_'] + return 9 + case 97 <= r && r <= 122: // ['a','z'] + return 8 + } + return NoState + }, + // S12 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 7 + case 65 <= r && r <= 90: // ['A','Z'] + return 8 + case r == 95: // ['_','_'] + return 9 + case 97 <= r && r <= 100: // ['a','d'] + return 8 + case r == 101: // ['e','e'] + return 14 + case 102 <= r && r <= 122: // ['f','z'] + return 8 + } + return NoState + }, + // S13 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 7 + case 65 <= r && r <= 90: // ['A','Z'] + return 8 + case r == 95: // ['_','_'] + return 9 + case 97 <= r && r <= 100: // ['a','d'] + return 8 + case r == 101: // ['e','e'] + return 15 + case 102 <= r && r <= 122: // ['f','z'] + return 8 + } + return NoState + }, + // S14 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 7 + case 65 <= r && r <= 90: // ['A','Z'] + return 8 + case r == 95: // ['_','_'] + return 9 + case 97 <= r && r <= 109: // ['a','m'] + return 8 + case r == 110: // ['n','n'] + return 16 + case 111 <= r && r <= 122: // ['o','z'] + return 8 + } + return NoState + }, + // S15 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 7 + case 65 <= r && r <= 90: // ['A','Z'] + return 8 + case r == 95: // ['_','_'] + return 9 + case 97 <= r && r <= 122: // ['a','z'] + return 8 + } + return NoState + }, + // S16 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 7 + case 65 <= r && r <= 90: // ['A','Z'] + return 8 + case r == 95: // ['_','_'] + return 9 + case 97 <= r && r <= 122: // ['a','z'] + return 8 + } + return NoState + }, +} diff --git a/example/sr/internal/parser/action.go b/example/sr/internal/parser/action.go new file mode 100644 index 00000000..54bc55e9 --- /dev/null +++ b/example/sr/internal/parser/action.go @@ -0,0 +1,51 @@ +// Code generated by gocc; DO NOT EDIT. + +package parser + +import ( + "fmt" +) + +type action interface { + act() + String() string +} + +type ( + accept bool + shift int // value is next state index + reduce int // value is production index +) + +func (this accept) act() {} +func (this shift) act() {} +func (this reduce) act() {} + +func (this accept) Equal(that action) bool { + if _, ok := that.(accept); ok { + return true + } + return false +} + +func (this reduce) Equal(that action) bool { + that1, ok := that.(reduce) + if !ok { + return false + } + return this == that1 +} + +func (this shift) Equal(that action) bool { + that1, ok := that.(shift) + if !ok { + return false + } + return this == that1 +} + +func (this accept) String() string { return "accept(0)" } +func (this shift) String() string { return fmt.Sprintf("shift:%d", this) } +func (this reduce) String() string { + return fmt.Sprintf("reduce:%d(%s)", this, productionsTable[this].String) +} diff --git a/example/sr/internal/parser/actiontable.go b/example/sr/internal/parser/actiontable.go new file mode 100644 index 00000000..1ff4a333 --- /dev/null +++ b/example/sr/internal/parser/actiontable.go @@ -0,0 +1,217 @@ +// Code generated by gocc; DO NOT EDIT. + +package parser + +type ( + actionTable [numStates]actionRow + cdFunc func(TokenStream, interface{}) (interface{}, error, []byte) + cdAction struct { + tokenIndex int + tokenScanner cdFunc + } + actionRow struct { + canRecover bool + actions [numSymbols]action + cdActions []cdAction + } + actions struct { + table actionTable + } +) + +var parserActions = actions{ + table: actionTable{ + actionRow{ // S0 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + shift(2), // "if" + shift(3), // id + nil, // "then" + nil, // "else" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S1 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + accept(true), // Ω + nil, // "if" + nil, // id + nil, // "then" + nil, // "else" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S2 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // "if" + shift(4), // id + nil, // "then" + nil, // "else" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S3 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(3), // Ω, reduce: Stmt + nil, // "if" + nil, // id + nil, // "then" + nil, // "else" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S4 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // "if" + nil, // id + shift(5), // "then" + nil, // "else" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S5 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + shift(7), // "if" + shift(8), // id + nil, // "then" + nil, // "else" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S6 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(1), // Ω, reduce: Stmt + nil, // "if" + nil, // id + nil, // "then" + shift(9), // "else" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S7 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // "if" + shift(10), // id + nil, // "then" + nil, // "else" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S8 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(3), // Ω, reduce: Stmt + nil, // "if" + nil, // id + nil, // "then" + reduce(3), // "else", reduce: Stmt + }, + cdActions: []cdAction{}, + }, + actionRow{ // S9 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + shift(2), // "if" + shift(3), // id + nil, // "then" + nil, // "else" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S10 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // "if" + nil, // id + shift(12), // "then" + nil, // "else" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S11 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(2), // Ω, reduce: Stmt + nil, // "if" + nil, // id + nil, // "then" + nil, // "else" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S12 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + shift(7), // "if" + shift(8), // id + nil, // "then" + nil, // "else" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S13 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(1), // Ω, reduce: Stmt + nil, // "if" + nil, // id + nil, // "then" + shift(14), // "else" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S14 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + shift(7), // "if" + shift(8), // id + nil, // "then" + nil, // "else" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S15 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(2), // Ω, reduce: Stmt + nil, // "if" + nil, // id + nil, // "then" + reduce(2), // "else", reduce: Stmt + }, + cdActions: []cdAction{}, + }, + }, +} diff --git a/example/sr/internal/parser/gototable.go b/example/sr/internal/parser/gototable.go new file mode 100644 index 00000000..593dc1fd --- /dev/null +++ b/example/sr/internal/parser/gototable.go @@ -0,0 +1,77 @@ +// Code generated by gocc; DO NOT EDIT. + +package parser + +const numNTSymbols = 2 + +type ( + gotoTable [numStates]gotoRow + gotoRow [numNTSymbols]int +) + +var gotoTab = gotoTable{ + gotoRow{ // S0 + -1, // Π + 1, // Π + }, + gotoRow{ // S1 + -1, // Π + -1, // Π + }, + gotoRow{ // S2 + -1, // Π + -1, // Π + }, + gotoRow{ // S3 + -1, // Π + -1, // Π + }, + gotoRow{ // S4 + -1, // Π + -1, // Π + }, + gotoRow{ // S5 + -1, // Π + 6, // Π + }, + gotoRow{ // S6 + -1, // Π + -1, // Π + }, + gotoRow{ // S7 + -1, // Π + -1, // Π + }, + gotoRow{ // S8 + -1, // Π + -1, // Π + }, + gotoRow{ // S9 + -1, // Π + 11, // Π + }, + gotoRow{ // S10 + -1, // Π + -1, // Π + }, + gotoRow{ // S11 + -1, // Π + -1, // Π + }, + gotoRow{ // S12 + -1, // Π + 13, // Π + }, + gotoRow{ // S13 + -1, // Π + -1, // Π + }, + gotoRow{ // S14 + -1, // Π + 15, // Π + }, + gotoRow{ // S15 + -1, // Π + -1, // Π + }, +} diff --git a/example/sr/internal/parser/parser.go b/example/sr/internal/parser/parser.go new file mode 100644 index 00000000..afd4fcc5 --- /dev/null +++ b/example/sr/internal/parser/parser.go @@ -0,0 +1,295 @@ +// Code generated by gocc; DO NOT EDIT. + +package parser + +import ( + "errors" + "fmt" + "strings" + + "github.com/maxcalandrelli/gocc/example/sr/iface" + parseError "github.com/maxcalandrelli/gocc/example/sr/internal/errors" + "github.com/maxcalandrelli/gocc/example/sr/internal/token" +) + +const ( + numProductions = 4 + numStates = 16 + numSymbols = 8 +) + +// Stack + +type stack struct { + state []int + attrib []Attrib +} + +const INITIAL_STACK_SIZE = 100 + +func newStack() *stack { + return &stack{ + state: make([]int, 0, INITIAL_STACK_SIZE), + attrib: make([]Attrib, 0, INITIAL_STACK_SIZE), + } +} + +func (s *stack) reset() { + s.state = s.state[:0] + s.attrib = s.attrib[:0] +} + +func (s *stack) push(state int, a Attrib) { + s.state = append(s.state, state) + s.attrib = append(s.attrib, a) +} + +func (s *stack) top() int { + return s.state[len(s.state)-1] +} + +func (s *stack) peek(pos int) int { + return s.state[pos] +} + +func (s *stack) topIndex() int { + return len(s.state) - 1 +} + +func (s *stack) popN(items int) []Attrib { + lo, hi := len(s.state)-items, len(s.state) + + attrib := s.attrib[lo:hi] + + s.state = s.state[:lo] + s.attrib = s.attrib[:lo] + + return attrib +} + +func (s *stack) String() string { + w := new(strings.Builder) + fmt.Fprintf(w, "stack:\n") + for i, st := range s.state { + fmt.Fprintf(w, "\t%d: %d , ", i, st) + if s.attrib[i] == nil { + fmt.Fprintf(w, "nil") + } else { + switch attr := s.attrib[i].(type) { + case *token.Token: + fmt.Fprintf(w, "%s", attr.Lit) + default: + fmt.Fprintf(w, "%v", attr) + } + } + fmt.Fprintf(w, "\n") + } + return w.String() +} + +// Parser + +type Parser struct { + stack *stack + nextToken *token.Token + userContext interface{} +} + +type TokenStream = iface.TokenStream + +func NewParser() *Parser { + return NewParserWithContext(nil) +} + +func NewParserWithContext(u interface{}) *Parser { + p := &Parser{stack: newStack(), userContext: u} + p.Reset() + return p +} + +func (p *Parser) Reset() { + p.stack.reset() + p.stack.push(0, nil) +} + +func (p *Parser) Error(err error, scanner iface.Scanner) (recovered bool, errorAttrib *parseError.Error) { + errorAttrib = &parseError.Error{ + Err: err, + ErrorToken: p.nextToken, + ErrorSymbols: p.popNonRecoveryStates(), + ExpectedTokens: make([]string, 0, 8), + } + for t, action := range parserActions.table[p.stack.top()].actions { + if action != nil { + errorAttrib.ExpectedTokens = append(errorAttrib.ExpectedTokens, token.TokMap.Id(token.Type(t))) + } + } + + if action := parserActions.table[p.stack.top()].actions[token.TokMap.Type("error")]; action != nil { + p.stack.push(int(action.(shift)), errorAttrib) // action can only be shift + } else { + return + } + + if action := parserActions.table[p.stack.top()].actions[p.nextToken.Type]; action != nil { + recovered = true + } + for !recovered && p.nextToken.Type != token.EOF { + p.nextToken = scanner.Scan() + if action := parserActions.table[p.stack.top()].actions[p.nextToken.Type]; action != nil { + recovered = true + } + } + + return +} + +func (p *Parser) popNonRecoveryStates() (removedAttribs []parseError.ErrorSymbol) { + if rs, ok := p.firstRecoveryState(); ok { + errorSymbols := p.stack.popN(p.stack.topIndex() - rs) + removedAttribs = make([]parseError.ErrorSymbol, len(errorSymbols)) + for i, e := range errorSymbols { + removedAttribs[i] = e + } + } else { + removedAttribs = []parseError.ErrorSymbol{} + } + return +} + +// recoveryState points to the highest state on the stack, which can recover +func (p *Parser) firstRecoveryState() (recoveryState int, canRecover bool) { + recoveryState, canRecover = p.stack.topIndex(), parserActions.table[p.stack.top()].canRecover + for recoveryState > 0 && !canRecover { + recoveryState-- + canRecover = parserActions.table[p.stack.peek(recoveryState)].canRecover + } + return +} + +func (p *Parser) newError(err error) error { + e := &parseError.Error{ + Err: err, + StackTop: p.stack.top(), + ErrorToken: p.nextToken, + } + actRow := parserActions.table[p.stack.top()] + for i, t := range actRow.actions { + if t != nil { + e.ExpectedTokens = append(e.ExpectedTokens, token.TokMap.Id(token.Type(i))) + } + } + return e +} + +func (p *Parser) Parse(scanner iface.Scanner) (res interface{}, err error, ptl int) { + return p.parse(scanner, false) +} + +func (p *Parser) ParseLongestPrefix(scanner iface.Scanner) (res interface{}, err error, ptl int) { + return p.parse(scanner, true) +} + +var errNotRepositionable = errors.New("scanner not repositionable") + +func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, err error, ptl int) { + var ( + tokens iface.CheckPointable + afterPos iface.CheckPoint + checkPoint iface.CheckPoint + ) + readNextToken := func() error { + if tokens == nil && (len(parserActions.table[p.stack.top()].cdActions) > 0 || longest) { + return errNotRepositionable + } + checkPoint = tokens.GetCheckPoint() + p.nextToken = scanner.Scan() + if longest { + afterPos = tokens.GetCheckPoint() + } + return nil + } + p.Reset() + tokens, _ = scanner.(iface.CheckPointable) + startCp := tokens.GetCheckPoint() + if err := readNextToken(); err != nil { + return nil, err, tokens.GetCheckPoint().DistanceFrom(startCp) + } + for acc := false; !acc; { + action := parserActions.table[p.stack.top()].actions[p.nextToken.Type] + if action == nil { + // + // If no action, check if we have some context dependent parsing to try + // + for _, cdAction := range parserActions.table[p.stack.top()].cdActions { + tokens.GotoCheckPoint(checkPoint) + cd_res, cd_err, cd_parsed := cdAction.tokenScanner(scanner.GetStream(), p.userContext) + if cd_err == nil && len(cd_parsed) > 0 { + action = parserActions.table[p.stack.top()].actions[cdAction.tokenIndex] + if action != nil { + p.nextToken.Foreign = true + p.nextToken.ForeignAstNode = cd_res + p.nextToken.Lit = cd_parsed + p.nextToken.Type = token.Type(cdAction.tokenIndex) + break + } + } + } + } + // + // Still no action? If a longest possible parsing is requested in place + // of a full text, we should try to check if an EOF here would have led + // to a successful parsing instead + // Rember that token.EOF is 1, that is the index of SyntaxEof into symbol table + // Dirty, dirty, dirty... but I found it as it is, and I prefer not to touch + // + if action == nil && longest { + tokens.GotoCheckPoint(checkPoint) + action = parserActions.table[p.stack.top()].actions[token.EOF] + if action == nil { + // + // ok, let's consume the token then + // + tokens.GotoCheckPoint(afterPos) + } + } + + // + // Well, no action is no action after all... + // + if action == nil { + if recovered, errAttrib := p.Error(nil, scanner); !recovered { + p.nextToken = errAttrib.ErrorToken + return nil, p.newError(nil), tokens.GetCheckPoint().DistanceFrom(startCp) + } + if action = parserActions.table[p.stack.top()].actions[p.nextToken.Type]; action == nil { + panic("Error recovery led to invalid action") + } + } + + switch act := action.(type) { + case accept: + res = p.stack.popN(1)[0] + acc = true + case shift: + p.stack.push(int(act), p.nextToken) + if p.nextToken.Foreign { + p.stack.push(int(act), p.nextToken.ForeignAstNode) + } + if err := readNextToken(); err != nil { + return nil, err, tokens.GetCheckPoint().DistanceFrom(startCp) + } + case reduce: + prod := productionsTable[int(act)] + attrib, err := prod.ReduceFunc(p.userContext, p.stack.popN(prod.NumSymbols)) + if err != nil { + return nil, p.newError(err), tokens.GetCheckPoint().DistanceFrom(startCp) + } else { + p.stack.push(gotoTab[p.stack.top()][prod.NTType], attrib) + } + default: + panic("unknown action: " + action.String()) + } + } + return res, nil, tokens.GetCheckPoint().DistanceFrom(startCp) +} diff --git a/example/sr/internal/parser/productionstable.go b/example/sr/internal/parser/productionstable.go new file mode 100644 index 00000000..abef01e8 --- /dev/null +++ b/example/sr/internal/parser/productionstable.go @@ -0,0 +1,63 @@ +// Code generated by gocc; DO NOT EDIT. + +package parser + +import "github.com/maxcalandrelli/gocc/example/sr/ast" + +type ( + //TODO: change type and variable names to be consistent with other tables + ProdTab [numProductions]ProdTabEntry + ProdTabEntry struct { + String string + Id string + NTType int + Index int + NumSymbols int + ReduceFunc func(interface{}, []Attrib) (Attrib, error) + } + Attrib interface { + } +) + +var productionsTable = ProdTab{ + ProdTabEntry{ + String: `S' : Π << >>`, + Id: "S'", + NTType: 0, + Index: 0, + NumSymbols: 1, + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { + return X[0], nil + }, + }, + ProdTabEntry{ + String: `Stmt : Λ id Λ Π << ast.NewIf(X[1], X[3]), nil >>`, + Id: "Stmt", + NTType: 1, + Index: 1, + NumSymbols: 4, + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { + return ast.NewIf(X[1], X[3]), nil + }, + }, + ProdTabEntry{ + String: `Stmt : Λ id Λ Π Λ Π << ast.NewIfElse(X[1], X[3], X[5]), nil >>`, + Id: "Stmt", + NTType: 1, + Index: 2, + NumSymbols: 6, + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { + return ast.NewIfElse(X[1], X[3], X[5]), nil + }, + }, + ProdTabEntry{ + String: `Stmt : id << ast.NewIdStmt(X[0]), nil >>`, + Id: "Stmt", + NTType: 1, + Index: 3, + NumSymbols: 1, + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { + return ast.NewIdStmt(X[0]), nil + }, + }, +} diff --git a/example/sr/internal/token/token.go b/example/sr/internal/token/token.go new file mode 100644 index 00000000..5b850a19 --- /dev/null +++ b/example/sr/internal/token/token.go @@ -0,0 +1,93 @@ +// Code generated by gocc; DO NOT EDIT. + +package token + +import ( + "fmt" +) + +type Token struct { + Type + Lit []byte + Pos + ForeignAstNode interface{} + Foreign bool +} + +type Type int + +const ( + INVALID Type = iota + EOF +) + +type Pos struct { + Offset int + Line int + Column int +} + +func (p Pos) String() string { + return fmt.Sprintf("Pos(offset=%d, line=%d, column=%d)", p.Offset, p.Line, p.Column) +} + +func (p Pos) StartingFrom(base Pos) Pos { + r := base + r.Offset += p.Offset + r.Line += p.Line + r.Column = p.Column + if p.Line > 0 && base.Line > 0 { + r.Line-- + } + if r.Column < 1 { + r.Column = 1 + } + return r +} + +type TokenMap struct { + typeMap []string + idMap map[string]Type +} + +func (m TokenMap) Id(tok Type) string { + if int(tok) < len(m.typeMap) { + return m.typeMap[tok] + } + return "unknown" +} + +func (m TokenMap) Type(tok string) Type { + if typ, exist := m.idMap[tok]; exist { + return typ + } + return INVALID +} + +func (m TokenMap) TokenString(tok *Token) string { + return fmt.Sprintf("%s(%d,<%s>)", m.Id(tok.Type), tok.Type, tok.Lit) +} + +func (m TokenMap) StringType(typ Type) string { + return fmt.Sprintf("%s(%d)", m.Id(typ), typ) +} + +var TokMap = TokenMap{ + typeMap: []string{ + "INVALID", + "Ω", + "Λ", + "id", + "Λ", + "Λ", + }, + + idMap: map[string]Type{ + "INVALID": 0, + "Ω": 1, + "Λ": 2, + "id": 3, + "Λ": 4, + "Λ": 5, + }, +} diff --git a/example/sr/internal/util/litconv.go b/example/sr/internal/util/litconv.go new file mode 100644 index 00000000..1aeb6166 --- /dev/null +++ b/example/sr/internal/util/litconv.go @@ -0,0 +1,108 @@ +// Code generated by gocc; DO NOT EDIT. + +package util + +import ( + "fmt" + "strconv" + "unicode" + "unicode/utf8" +) + +/* Interface */ + +/* +Convert the literal value of a scanned token to rune +*/ +func RuneValue(lit []byte) rune { + if lit[1] == '\\' { + return escapeCharVal(lit) + } + r, size := utf8.DecodeRune(lit[1:]) + if size != len(lit)-2 { + panic(fmt.Sprintf("Error decoding rune. Lit: %s, rune: %d, size%d\n", lit, r, size)) + } + return r +} + +/* +Convert the literal value of a scanned token to int64 +*/ +func IntValue(lit []byte) (int64, error) { + return strconv.ParseInt(string(lit), 10, 64) +} + +/* +Convert the literal value of a scanned token to uint64 +*/ +func UintValue(lit []byte) (uint64, error) { + return strconv.ParseUint(string(lit), 10, 64) +} + +/* Util */ + +func escapeCharVal(lit []byte) rune { + var i, base, max uint32 + offset := 2 + switch lit[offset] { + case 'a': + return '\a' + case 'b': + return '\b' + case 'f': + return '\f' + case 'n': + return '\n' + case 'r': + return '\r' + case 't': + return '\t' + case 'v': + return '\v' + case '\\': + return '\\' + case '\'': + return '\'' + case '0', '1', '2', '3', '4', '5', '6', '7': + i, base, max = 3, 8, 255 + case 'x': + i, base, max = 2, 16, 255 + offset++ + case 'u': + i, base, max = 4, 16, unicode.MaxRune + offset++ + case 'U': + i, base, max = 8, 16, unicode.MaxRune + offset++ + default: + panic(fmt.Sprintf("Error decoding character literal: %s\n", lit)) + } + + var x uint32 + for ; i > 0 && offset < len(lit)-1; i-- { + ch, size := utf8.DecodeRune(lit[offset:]) + offset += size + d := uint32(digitVal(ch)) + if d >= base { + panic(fmt.Sprintf("charVal(%s): illegal character (%c) in escape sequence. size=%d, offset=%d", lit, ch, size, offset)) + } + x = x*base + d + } + if x > max || 0xD800 <= x && x < 0xE000 { + panic(fmt.Sprintf("Error decoding escape char value. Lit:%s, offset:%d, escape sequence is invalid Unicode code point\n", lit, offset)) + } + + return rune(x) +} + +func digitVal(ch rune) int { + switch { + case '0' <= ch && ch <= '9': + return int(ch) - '0' + case 'a' <= ch && ch <= 'f': + return int(ch) - 'a' + 10 + case 'A' <= ch && ch <= 'F': + return int(ch) - 'A' + 10 + } + return 16 // larger than any legal digit val +} diff --git a/example/sr/internal/util/rune.go b/example/sr/internal/util/rune.go new file mode 100644 index 00000000..bd8523a4 --- /dev/null +++ b/example/sr/internal/util/rune.go @@ -0,0 +1,39 @@ +// Code generated by gocc; DO NOT EDIT. + +package util + +import ( + "fmt" +) + +func RuneToString(r rune) string { + if r >= 0x20 && r < 0x7f { + return fmt.Sprintf("'%c'", r) + } + switch r { + case 0x07: + return "'\\a'" + case 0x08: + return "'\\b'" + case 0x0C: + return "'\\f'" + case 0x0A: + return "'\\n'" + case 0x0D: + return "'\\r'" + case 0x09: + return "'\\t'" + case 0x0b: + return "'\\v'" + case 0x5c: + return "'\\\\\\'" + case 0x27: + return "'\\''" + case 0x22: + return "'\\\"'" + } + if r < 0x10000 { + return fmt.Sprintf("\\u%04x", r) + } + return fmt.Sprintf("\\U%08x", r) +} diff --git a/example/sr/main/main.go b/example/sr/main/main.go new file mode 100644 index 00000000..8f0a4a7d --- /dev/null +++ b/example/sr/main/main.go @@ -0,0 +1,53 @@ +package main + +import ( + "flag" + "fmt" + "os" + "strings" + + sr "github.com/maxcalandrelli/gocc/example/sr" +) + +func showResult(r interface{}, e error, l int) { + if e != nil { + fmt.Fprintf(os.Stderr, "parsing returned the following error: %s\n", e.Error()) + } else { + fmt.Printf("r=%#v, %d bytes\n", r, l) + } +} + +var ( + File string + Text string + Longest bool +) + +func parse(longest bool, lex *sr.Lexer) (res interface{}, err error, ptl int) { + if longest { + return sr.NewParser().ParseLongestPrefix(lex) + } else { + return sr.NewParser().Parse(lex) + } + return +} + +func main() { + flag.StringVar(&File, "file", "", "parse also text in file") + flag.StringVar(&Text, "text", "", "parse also text given with flag") + flag.BoolVar(&Longest, "longest", false, "parse longest possible part") + flag.Parse() + if Text > "" { + showResult(parse(Longest, sr.NewLexerString(Text))) + } + if File > "" { + l, e := sr.NewLexerFile(File) + if e != nil { + panic(e) + } + showResult(parse(Longest, l)) + } + if str := strings.Join(flag.Args(), " "); str > "" { + showResult(parse(Longest, sr.NewLexerString(str))) + } +} diff --git a/example/sr/sr.go b/example/sr/sr.go new file mode 100644 index 00000000..9aa68b58 --- /dev/null +++ b/example/sr/sr.go @@ -0,0 +1,62 @@ +// Code generated by gocc; DO NOT EDIT. + +package sr + +import ( + "io" + + "github.com/maxcalandrelli/gocc/example/sr/iface" + "github.com/maxcalandrelli/gocc/example/sr/internal/io/stream" + "github.com/maxcalandrelli/gocc/example/sr/internal/lexer" + "github.com/maxcalandrelli/gocc/example/sr/internal/parser" + "github.com/maxcalandrelli/gocc/example/sr/internal/token" +) + +type ( + Token = token.Token + Lexer = lexer.Lexer + Parser = parser.Parser + TokenStream = iface.TokenStream + WindowReader = stream.WindowReader + Scanner = iface.Scanner +) + +func ParseFile(fpath string) (interface{}, error, int) { + if lexer, err := NewLexerFile(fpath); err == nil { + return NewParser().Parse(lexer) + } else { + return nil, err, 0 + } +} + +func ParseText(text string) (interface{}, error, int) { + return NewParser().Parse(NewLexerBytes([]byte(text))) +} + +func NewLexerBytes(src []byte) *lexer.Lexer { + return lexer.NewLexerBytes(src) +} + +func NewLexerString(src string) *lexer.Lexer { + return lexer.NewLexerBytes([]byte(src)) +} + +func NewLexerFile(fpath string) (*lexer.Lexer, error) { + return lexer.NewLexerFile(fpath) +} + +func NewParser() *parser.Parser { + return parser.NewParser() +} + +func NewWindowReaderFromBytes(src []byte) WindowReader { + return stream.NewWindowReaderFromBytes(src) +} + +func NewWindowReader(rdr io.Reader) WindowReader { + return stream.NewWindowReader(rdr) +} + +func NewLimitedWindowReader(rdr io.Reader, sizeMin, sizeMax int) WindowReader { + return stream.NewLimitedWindowReader(rdr, sizeMin, sizeMax) +} diff --git a/internal/base/gen/gen.go b/internal/base/gen/gen.go index 68228d79..d5f06359 100644 --- a/internal/base/gen/gen.go +++ b/internal/base/gen/gen.go @@ -16,8 +16,9 @@ package gen import ( "github.com/maxcalandrelli/gocc/internal/base/gen/golang" + "github.com/maxcalandrelli/gocc/internal/config" ) -func Gen(pkg, outdir, subpath string) { - golang.Gen(pkg, outdir, subpath) +func Gen(pkg, outdir, subpath string, cfg config.Config) { + golang.Gen(pkg, outdir, subpath, cfg) } diff --git a/internal/base/gen/golang/base.go b/internal/base/gen/golang/base.go index 4dbbb864..34bcbe50 100644 --- a/internal/base/gen/golang/base.go +++ b/internal/base/gen/golang/base.go @@ -20,6 +20,8 @@ import ( "path" "text/template" + "github.com/maxcalandrelli/gocc/internal/config" + "github.com/maxcalandrelli/gocc/internal/io" ) @@ -28,18 +30,22 @@ type data struct { Pkg string Outdir string Subpath string + Config config.Config } -func Gen(pkg, outdir, subpath string) { +func Gen(pkg, outdir, subpath string, cfg config.Config) { baseName := path.Base(outdir) d := data{ MyName: baseName, Pkg: pkg, Outdir: outdir, Subpath: subpath, + Config: cfg, + } + if !cfg.NoLexer() { + genBase(d) + genMain(d) } - genBase(d) - genMain(d) genIface(d) } @@ -227,6 +233,9 @@ import ( type ( Scanner interface { Scan() (tok *token.Token) + } + + StreamScanner interface { GetStream() TokenStream } diff --git a/internal/config/config.go b/internal/config/config.go index 53032af9..d1383aac 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -44,7 +44,6 @@ type ( Config interface { Help() bool Verbose() bool - Zip() bool AllowUnreachable() bool AutoResolveLRConf() bool SourceFile() string @@ -53,7 +52,6 @@ type ( NoLexer() bool DebugLexer() bool DebugParser() bool - StockCompiler() bool ErrorsDir() string ParserDir() string @@ -79,8 +77,6 @@ type ( pkg string srcFile string verbose *bool - zip *bool - stockCompiler *bool } ) @@ -114,10 +110,6 @@ func (this *ConfigRecord) Verbose() bool { return *this.verbose } -func (this *ConfigRecord) Zip() bool { - return *this.zip -} - func (this *ConfigRecord) AllowUnreachable() bool { return *this.allowUnreachable } @@ -138,10 +130,6 @@ func (this *ConfigRecord) DebugParser() bool { return *this.debugParser } -func (this *ConfigRecord) StockCompiler() bool { - return *this.stockCompiler -} - func (this *ConfigRecord) SourceFile() string { return this.srcFile } @@ -185,7 +173,6 @@ func (this *ConfigRecord) PrintParams() { fmt.Printf("-p = %v\n", this.pkg) fmt.Printf("-u = %v\n", *this.allowUnreachable) fmt.Printf("-v = %v\n", *this.verbose) - fmt.Printf("-zip = %v\n", *this.zip) } /*** Utility routines ***/ @@ -200,8 +187,6 @@ func (this *ConfigRecord) getFlags() error { flag.StringVar(&this.pkg, "p", defaultPackage(this.outDir), "package") this.allowUnreachable = flag.Bool("u", false, "allow unreachable productions") this.verbose = flag.Bool("v", false, "verbose") - this.zip = flag.Bool("zip", false, "zip the actiontable and gototable (experimental)") - this.stockCompiler = flag.Bool("stock", false, "use the stock compiler from original gocc") flag.Parse() if *this.noLexer && *this.debugLexer { diff --git a/internal/frontend/reparsed/iface/iface.go b/internal/frontend/reparsed/iface/iface.go index beafa1ba..9d14c50f 100644 --- a/internal/frontend/reparsed/iface/iface.go +++ b/internal/frontend/reparsed/iface/iface.go @@ -10,6 +10,9 @@ import ( type ( Scanner interface { Scan() (tok *token.Token) + } + + StreamScanner interface { GetStream() TokenStream } diff --git a/internal/frontend/reparsed/internal/lexer/lexer.go b/internal/frontend/reparsed/internal/lexer/lexer.go index 7912000b..b56d6933 100644 --- a/internal/frontend/reparsed/internal/lexer/lexer.go +++ b/internal/frontend/reparsed/internal/lexer/lexer.go @@ -94,11 +94,9 @@ func (l *Lexer) Scan() (tok *token.Token) { l.position.Pos.Offset += size } nextState := -1 - if err == nil { - if curr != INVALID_RUNE { - nextState = TransTab[state](curr) - } - } + if curr != INVALID_RUNE { + nextState = TransTab[state](curr) + } state = nextState if state != -1 { switch curr { @@ -121,7 +119,7 @@ func (l *Lexer) Scan() (tok *token.Token) { state = 0 tok.Lit = []byte{} } - } else { + } else if curr != INVALID_RUNE { l.stream.UnreadRune() } if err == io.EOF && len(tok.Lit)==0 { diff --git a/internal/frontend/reparsed/internal/parser/parser.go b/internal/frontend/reparsed/internal/parser/parser.go index 5983e060..39e5367a 100644 --- a/internal/frontend/reparsed/internal/parser/parser.go +++ b/internal/frontend/reparsed/internal/parser/parser.go @@ -221,17 +221,20 @@ func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, er // // If no action, check if we have some context dependent parsing to try // - for _, cdAction := range parserActions.table[p.stack.top()].cdActions { - tokens.GotoCheckPoint(checkPoint) - cd_res, cd_err, cd_parsed := cdAction.tokenScanner(scanner.GetStream(), p.userContext) - if cd_err == nil && len(cd_parsed) > 0 { - action = parserActions.table[p.stack.top()].actions[cdAction.tokenIndex] - if action != nil { - p.nextToken.Foreign = true - p.nextToken.ForeignAstNode = cd_res - p.nextToken.Lit = cd_parsed - p.nextToken.Type = token.Type(cdAction.tokenIndex) - break + if streamScanner, _ := scanner.(iface.StreamScanner); streamScanner != nil { + underlyingStream := streamScanner.GetStream() + for _, cdAction := range parserActions.table[p.stack.top()].cdActions { + tokens.GotoCheckPoint(checkPoint) + cd_res, cd_err, cd_parsed := cdAction.tokenScanner(underlyingStream, p.userContext) + if cd_err == nil && len(cd_parsed) > 0 { + action = parserActions.table[p.stack.top()].actions[cdAction.tokenIndex] + if action != nil { + p.nextToken.Foreign = true + p.nextToken.ForeignAstNode = cd_res + p.nextToken.Lit = cd_parsed + p.nextToken.Type = token.Type(cdAction.tokenIndex) + break + } } } } diff --git a/internal/lexer/gen/golang/lexer.go b/internal/lexer/gen/golang/lexer.go index 1cae2a70..db6236ed 100644 --- a/internal/lexer/gen/golang/lexer.go +++ b/internal/lexer/gen/golang/lexer.go @@ -165,18 +165,16 @@ func (l *Lexer) Scan() (tok *token.Token) { l.position.Pos.Offset += size } nextState := -1 - if err == nil { - if curr != INVALID_RUNE { - nextState = TransTab[state](curr) - } - {{- if .Debug}} - fmt.Printf("\tS%d, : tok=%s, rune == %s(%x), next state == %d\n", state, token.TokMap.Id(tok.Type), util.RuneToString(curr), curr, nextState) - fmt.Printf("\t\tpos=%d, size=%d, start=%d\n", l.position.Pos.Offset, size, start.Pos.Offset) - if nextState != -1 { - fmt.Printf("\t\taction:%s\n", ActTab[nextState].String()) - } - {{- end}} - } + if curr != INVALID_RUNE { + nextState = TransTab[state](curr) + } + {{- if .Debug}} + fmt.Printf("\tS%d, : tok=%s, rune == %s(%x), next state == %d\n", state, token.TokMap.Id(tok.Type), util.RuneToString(curr), curr, nextState) + fmt.Printf("\t\tpos=%d, size=%d, start=%d\n", l.position.Pos.Offset, size, start.Pos.Offset) + if nextState != -1 { + fmt.Printf("\t\taction:%s\n", ActTab[nextState].String()) + } + {{- end}} state = nextState if state != -1 { switch curr { @@ -199,7 +197,7 @@ func (l *Lexer) Scan() (tok *token.Token) { state = 0 tok.Lit = []byte{} } - } else { + } else if curr != INVALID_RUNE { l.stream.UnreadRune() } if err == io.EOF && len(tok.Lit)==0 { diff --git a/internal/parser/gen/gen.go b/internal/parser/gen/gen.go index 3bfb327d..aec0822b 100644 --- a/internal/parser/gen/gen.go +++ b/internal/parser/gen/gen.go @@ -34,6 +34,6 @@ func Gen(pkg, outDir, header string, prods ast.SyntaxProdList, symbols *symbols. golang.GenErrors(pkg, outDir, subpath) golang.GenGotoTable(outDir, itemsets, symbols, subpath) golang.GenParser(pkg, outDir, prods, itemsets, symbols, cfg, subpath) - golang.GenProductionsTable(pkg, outDir, header, prods, symbols, itemsets, tokMap, subpath) + golang.GenProductionsTable(pkg, outDir, header, prods, symbols, itemsets, tokMap, subpath, cfg) return } diff --git a/internal/parser/gen/golang/parser.go b/internal/parser/gen/golang/parser.go index 66844c1f..380889ac 100644 --- a/internal/parser/gen/golang/parser.go +++ b/internal/parser/gen/golang/parser.go @@ -48,6 +48,7 @@ type parserData struct { Debug bool PkgPath string SubPath string + Config config.Config NumProductions int NumStates int NumSymbols int @@ -59,6 +60,7 @@ func getParserData(pkg, subpath string, prods ast.SyntaxProdList, itemSets *item Debug: cfg.DebugParser(), PkgPath: pkg, SubPath: subpath, + Config: cfg, NumProductions: len(prods), NumStates: itemSets.Size(), NumSymbols: symbols.NumSymbols(), @@ -296,20 +298,23 @@ func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, er // // If no action, check if we have some context dependent parsing to try // - for _, cdAction := range parserActions.table[p.stack.top()].cdActions { - tokens.GotoCheckPoint (checkPoint) - cd_res, cd_err, cd_parsed := cdAction.tokenScanner(scanner.GetStream(), p.userContext) - if cd_err == nil && len(cd_parsed) > 0 { - action = parserActions.table[p.stack.top()].actions[cdAction.tokenIndex] - if action != nil { - p.nextToken.Foreign = true - p.nextToken.ForeignAstNode = cd_res - p.nextToken.Lit = cd_parsed - p.nextToken.Type = token.Type(cdAction.tokenIndex) - break - } - } - } + if streamScanner, _ := scanner.(iface.StreamScanner) ; streamScanner != nil { + underlyingStream := streamScanner.GetStream() + for _, cdAction := range parserActions.table[p.stack.top()].cdActions { + tokens.GotoCheckPoint (checkPoint) + cd_res, cd_err, cd_parsed := cdAction.tokenScanner(underlyingStream, p.userContext) + if cd_err == nil && len(cd_parsed) > 0 { + action = parserActions.table[p.stack.top()].actions[cdAction.tokenIndex] + if action != nil { + p.nextToken.Foreign = true + p.nextToken.ForeignAstNode = cd_res + p.nextToken.Lit = cd_parsed + p.nextToken.Type = token.Type(cdAction.tokenIndex) + break + } + } + } + } } // // Still no action? If a longest possible parsing is requested in place diff --git a/internal/parser/gen/golang/productionstable.go b/internal/parser/gen/golang/productionstable.go index c4f9807e..d9732cc1 100644 --- a/internal/parser/gen/golang/productionstable.go +++ b/internal/parser/gen/golang/productionstable.go @@ -21,6 +21,8 @@ import ( "path" "text/template" + "github.com/maxcalandrelli/gocc/internal/config" + "github.com/maxcalandrelli/gocc/internal/ast" "github.com/maxcalandrelli/gocc/internal/io" "github.com/maxcalandrelli/gocc/internal/parser/lr1/items" @@ -29,7 +31,7 @@ import ( ) func GenProductionsTable(pkg, outDir, header string, prods ast.SyntaxProdList, symbols *symbols.Symbols, - itemsets *items.ItemSets, tokMap *token.TokenMap, subpath string) { + itemsets *items.ItemSets, tokMap *token.TokenMap, subpath string, cfg config.Config) { fname := path.Join(outDir, subpath, "parser", "productionstable.go") tmpl, err := template.New("parser productions table").Parse(prodsTabSrc[1:]) @@ -37,9 +39,16 @@ func GenProductionsTable(pkg, outDir, header string, prods ast.SyntaxProdList, s panic(err) } wr := new(bytes.Buffer) - if err := tmpl.Execute(wr, getProdsTab(header, prods, symbols, itemsets, tokMap)); err != nil { + pTab := getProdsTab(header, prods, symbols, itemsets, tokMap) + pTab.Pkg = pkg + pTab.Outdir = outDir + pTab.Subpath = subpath + pTab.Config = cfg + + if err := tmpl.Execute(wr, pTab); err != nil { panic(err) } + source, err := format.Source(wr.Bytes()) if err != nil { panic(err) @@ -86,6 +95,10 @@ func getProdsTab(header string, prods ast.SyntaxProdList, symbols *symbols.Symbo type prodsTabData struct { Header string ProdTab []prodTabEntry + Pkg string + Outdir string + Subpath string + Config config.Config } type prodTabEntry struct { diff --git a/main.go b/main.go index d6869fe9..d5599dd9 100644 --- a/main.go +++ b/main.go @@ -86,7 +86,7 @@ func main() { } if cfg.Help() { - fmt.Fprintf(os.Stderr, "gocc version 1.1.0006\n") + fmt.Fprintf(os.Stderr, "gocc version 1.1.0011\n") flag.Usage() } @@ -96,16 +96,6 @@ func main() { grammar interface{} ) ast.StringGetter = func(v interface{}) string { return string(v.(*altfe.Token).Lit) } - /* - srcBuffer, err := ioutil.ReadFile(cfg.SourceFile()) - if err != nil { - fmt.Println(err) - os.Exit(1) - } - scanner := altfe.NewLexer(srcBuffer) - p := altfe.NewParser() - grammar, err = p.Parse(scanner) - */ grammar, err, _ = altfe.ParseFile(cfg.SourceFile()) if err != nil { fmt.Printf("Parse error: %s\n", err) @@ -153,7 +143,7 @@ func main() { genToken.Gen(cfg.Package(), outdir_base, tokenMap, subpath) genUtil.Gen(outdir_base, subpath) - genBase.Gen(cfg.Package(), outdir_base, subpath) + genBase.Gen(cfg.Package(), outdir_base, subpath, cfg) genIo.Gen(cfg.Package(), outdir_base, subpath) } diff --git a/stock/main.go b/stock/main.go index 4d67da50..56405c80 100644 --- a/stock/main.go +++ b/stock/main.go @@ -122,7 +122,7 @@ func main() { genToken.Gen(cfg.Package(), outdir_base, tokenMap, subpath) genUtil.Gen(outdir_base, subpath) - genBase.Gen(cfg.Package(), outdir_base, subpath) + genBase.Gen(cfg.Package(), outdir_base, subpath, cfg) genIo.Gen(cfg.Package(), outdir_base, subpath) } From c2a2cfdc240b501e379a0c2b7876247cd471f8f7 Mon Sep 17 00:00:00 2001 From: Massimiliano Calandrelli Date: Sat, 12 Oct 2019 12:36:37 +0200 Subject: [PATCH 18/33] ... --- example/astx/ast.grammar/ast/grammar.go | 131 + example/astx/ast.grammar/ast/iface/ast.go | 49 + .../ast}/internal/errors/errors.go | 2 +- .../io/stream/internal/stream_impl.go | 0 .../io/stream/internal/stream_public.go | 0 .../ast}/internal/io/stream/stream.go | 2 +- .../ast}/internal/lexer/acttab.go | 2 +- .../ast}/internal/lexer/lexer.go | 51 +- .../ast}/internal/lexer/transitiontable.go | 0 .../ast}/internal/parser/action.go | 0 .../ast}/internal/parser/actiontable.go | 0 .../ast}/internal/parser/gototable.go | 0 .../ast}/internal/parser/parser.go | 49 +- .../ast}/internal/parser/productionstable.go | 0 .../ast}/internal/token/token.go | 3 + .../ast}/internal/util/litconv.go | 0 .../ast}/internal/util/rune.go | 0 .../astx/{ => ast.grammar/ast}/main/main.go | 14 +- example/astx/ast/ast.go | 4 +- example/astx/ast_test.go | 9 +- example/astx/astx.go | 62 - example/astx/iface/iface.go | 30 - example/astx/lexer/acttab.go | 51 - example/astx/lexer/lexer.go | 126 - example/astx/parser/actiontable.go | 54 - example/astx/parser/gototable.go | 38 - example/astx/parser/parser.go | 216 - example/astx/parser/productionstable.go | 63 - example/astx/token/token.go | 72 - example/bools/Makefile | 2 +- example/bools/ast/ast.go | 16 +- example/bools/{example.bnf => bools.bnf} | 0 example/bools/bools.go | 62 - example/bools/bools.grammar/bools/grammar.go | 131 + .../bools/bools.grammar/bools/iface/bools.go | 49 + .../bools/internal/errors/errors.go | 56 + .../io/stream/internal/stream_impl.go | 0 .../io/stream/internal/stream_public.go | 0 .../bools/internal/io/stream/stream.go | 39 + .../bools}/internal/lexer/acttab.go | 2 +- .../bools}/internal/lexer/lexer.go | 51 +- .../bools}/internal/lexer/transitiontable.go | 0 .../bools/internal}/parser/action.go | 0 .../bools}/internal/parser/actiontable.go | 0 .../bools}/internal/parser/gototable.go | 0 .../bools}/internal/parser/parser.go | 49 +- .../internal/parser/productionstable.go | 0 .../bools}/internal/token/token.go | 13 + .../bools/internal}/util/litconv.go | 0 .../bools/internal}/util/rune.go | 0 .../{ => bools.grammar/bools}/main/main.go | 2 +- example/bools/example_test.go | 9 +- example/bools/iface/iface.go | 30 - example/bools/lexer/acttab.go | 111 - example/bools/lexer/lexer.go | 141 - example/bools/lexer/transitiontable.go | 196 - example/bools/parser/actiontable.go | 842 --- example/bools/parser/gototable.go | 381 -- example/bools/parser/parser.go | 216 - example/bools/parser/productionstable.go | 153 - example/bools/token/token.go | 92 - example/calc/calc.bnf | 4 +- example/calc/calc.go | 62 - example/calc/calc.grammar/calc/grammar.go | 131 + example/calc/calc.grammar/calc/iface/calc.go | 49 + .../calc/internal/errors/errors.go | 56 + .../io/stream/internal/stream_impl.go | 0 .../io/stream/internal/stream_public.go | 0 .../calc/internal/io/stream/stream.go | 39 + .../calc}/internal/lexer/acttab.go | 2 +- .../calc}/internal/lexer/lexer.go | 51 +- .../calc}/internal/lexer/transitiontable.go | 0 .../calc}/internal/parser/action.go | 0 .../calc}/internal/parser/actiontable.go | 0 .../calc}/internal/parser/gototable.go | 0 .../calc}/internal/parser/parser.go | 49 +- .../calc}/internal/parser/productionstable.go | 4 +- .../calc}/internal/token/token.go | 8 + .../calc}/internal/util/litconv.go | 0 .../calc.grammar/calc}/internal/util/rune.go | 0 .../calc/{ => calc.grammar/calc}/main/main.go | 2 +- example/calc/calc_test.go | 9 +- example/calc/errors/errors.go | 56 - example/calc/iface/iface.go | 30 - example/calc/internal/errors/errors.go | 56 - example/calc/lexer/acttab.go | 55 - example/calc/lexer/lexer.go | 127 - example/calc/lexer/transitiontable.go | 83 - example/calc/parser/actiontable.go | 290 -- example/calc/parser/gototable.go | 174 - example/calc/parser/parser.go | 216 - example/calc/parser/productionstable.go | 106 - example/calc/token/token.go | 80 - example/ctx/ast/ast.go | 6 +- example/ctx/ctx.go | 62 - example/ctx/ctx.grammar/ctx/grammar.go | 131 + example/ctx/ctx.grammar/ctx/iface/ctx.go | 49 + .../ctx/internal}/errors/errors.go | 2 +- .../io/stream/internal/stream_impl.go | 0 .../io/stream/internal/stream_public.go | 0 .../ctx}/internal/io/stream/stream.go | 2 +- .../ctx}/internal/lexer/acttab.go | 2 +- .../ctx}/internal/lexer/lexer.go | 51 +- .../ctx}/internal/lexer/transitiontable.go | 0 .../ctx/internal}/parser/action.go | 0 .../ctx}/internal/parser/actiontable.go | 0 .../ctx}/internal/parser/gototable.go | 0 .../ctx}/internal/parser/parser.go | 49 +- .../ctx}/internal/parser/productionstable.go | 0 .../ctx}/internal/token/token.go | 5 + .../ctx.grammar/ctx/internal}/util/litconv.go | 0 .../ctx.grammar/ctx/internal}/util/rune.go | 0 .../ctx/{ => ctx.grammar/ctx}/main/main.go | 2 +- example/ctx/errors/errors.go | 56 - example/ctx/iface/iface.go | 30 - example/ctx/internal/errors/errors.go | 56 - example/ctx/lexer/acttab.go | 67 - example/ctx/lexer/lexer.go | 130 - example/ctx/lexer/transitiontable.go | 179 - example/ctx/parser/actiontable.go | 68 - example/ctx/parser/gototable.go | 43 - example/ctx/parser/parser.go | 216 - example/ctx/parser/productionstable.go | 76 - example/ctx/token/token.go | 74 - example/errorrecovery/ast/ast.go | 4 +- example/errorrecovery/doc.go | 2 +- .../errorrecovery/er.grammar/er/grammar.go | 131 + .../errorrecovery/er.grammar/er/iface/er.go | 49 + .../er.grammar/er/internal/errors/errors.go | 56 + .../io/stream/internal/stream_impl.go | 0 .../io/stream/internal/stream_public.go | 0 .../er}/internal/io/stream/stream.go | 2 +- .../er}/internal/lexer/acttab.go | 2 +- .../er}/internal/lexer/lexer.go | 51 +- .../er/internal}/lexer/transitiontable.go | 0 .../er.grammar/er}/internal/parser/action.go | 0 .../er}/internal/parser/actiontable.go | 15 + .../er}/internal/parser/gototable.go | 7 +- .../er}/internal/parser/parser.go | 53 +- .../er}/internal/parser/productionstable.go | 0 .../er}/internal/token/token.go | 5 + .../er.grammar/er}/internal/util/litconv.go | 0 .../er.grammar/er}/internal/util/rune.go | 0 .../errorrecovery/er.grammar/er/main/main.go | 53 + example/errorrecovery/er_test.go | 14 +- example/errorrecovery/errorrecovery.go | 62 - example/errorrecovery/errors/errors.go | 56 - example/errorrecovery/iface/iface.go | 30 - .../errorrecovery/internal/errors/errors.go | 56 - .../internal/lexer/transitiontable.go | 109 - .../errorrecovery/internal/parser/action.go | 51 - example/errorrecovery/lexer/acttab.go | 51 - example/errorrecovery/lexer/lexer.go | 126 - .../errorrecovery/lexer/transitiontable.go | 109 - example/errorrecovery/main/main.go | 53 - example/errorrecovery/parser/action.go | 51 - example/errorrecovery/parser/actiontable.go | 68 - example/errorrecovery/parser/gototable.go | 43 - example/errorrecovery/parser/parser.go | 216 - .../errorrecovery/parser/productionstable.go | 73 - example/errorrecovery/parser/symbols.go | 44 - example/errorrecovery/token/token.go | 74 - example/errorrecovery/util/litconv.go | 108 - example/errorrecovery/util/rune.go | 39 - example/mail/iface/iface.go | 30 - example/mail/internal/io/stream/stream.go | 39 - example/mail/internal/util/litconv.go | 108 - example/mail/internal/util/rune.go | 39 - example/mail/lexer/acttab.go | 83 - example/mail/lexer/lexer.go | 149 - example/mail/lexer/transitiontable.go | 510 -- example/mail/mail.go | 62 - example/mail/mail.grammar/mail/grammar.go | 42 + .../mail.grammar/mail/iface/mail.go} | 17 +- .../io/stream/internal/stream_impl.go | 0 .../io/stream/internal/stream_public.go | 0 .../mail/internal/io/stream/stream.go | 39 + .../mail}/internal/lexer/acttab.go | 2 +- .../mail}/internal/lexer/lexer.go | 51 +- .../mail}/internal/lexer/transitiontable.go | 0 .../mail}/internal/token/token.go | 3 + .../mail/internal}/util/litconv.go | 0 .../mail.grammar/mail/internal}/util/rune.go | 0 example/mail/main/main.go | 53 - example/mail/parser_test.go | 14 +- example/mail/token/token.go | 72 - example/mail/util/litconv.go | 108 - example/mail/util/rune.go | 39 - example/nolexer/internal/errors/errors.go | 56 - example/nolexer/internal/io/stream/stream.go | 39 - example/nolexer/internal/parser/action.go | 51 - example/nolexer/internal/parser/parser.go | 298 -- example/nolexer/internal/util/litconv.go | 108 - example/nolexer/internal/util/rune.go | 39 - example/nolexer/nolexer.bnf | 2 +- .../nolexer.grammar/nolexer/grammar.go | 31 + .../nolexer.grammar/nolexer/iface/nolexer.go | 49 + .../nolexer/internal/errors/errors.go | 56 + .../io/stream/internal/stream_impl.go | 0 .../io/stream/internal/stream_public.go | 0 .../nolexer/internal/io/stream/stream.go | 39 + .../nolexer/internal}/parser/action.go | 0 .../nolexer}/internal/parser/actiontable.go | 0 .../nolexer}/internal/parser/gototable.go | 0 .../nolexer/internal/parser/parser.go | 326 ++ .../internal/parser/productionstable.go | 2 +- .../nolexer}/internal/token/token.go | 9 + .../nolexer}/internal/util/litconv.go | 0 .../nolexer}/internal/util/rune.go | 0 example/nolexer/nolexer_test.go | 6 +- example/nolexer/scanner/scanner.go | 18 +- example/rr/errors/errors.go | 56 - example/rr/iface/iface.go | 30 - example/rr/internal/errors/errors.go | 56 - example/rr/internal/io/stream/stream.go | 39 - example/rr/internal/parser/action.go | 51 - example/rr/internal/util/litconv.go | 108 - example/rr/internal/util/rune.go | 39 - example/rr/lexer/acttab.go | 39 - example/rr/lexer/lexer.go | 123 - example/rr/lexer/transitiontable.go | 49 - example/rr/parser/action.go | 51 - example/rr/parser/actiontable.go | 77 - example/rr/parser/gototable.go | 55 - example/rr/parser/parser.go | 216 - example/rr/parser/productionstable.go | 93 - example/rr/rr.go | 62 - example/rr/rr.grammar/rr/grammar.go | 131 + example/rr/rr.grammar/rr/iface/rr.go | 49 + .../rr.grammar/rr}/internal/errors/errors.go | 2 +- .../io/stream/internal/stream_impl.go | 0 .../io/stream/internal/stream_public.go | 0 .../rr}/internal/io/stream/stream.go | 2 +- .../rr}/internal/lexer/acttab.go | 2 +- .../rr}/internal/lexer/lexer.go | 51 +- .../rr}/internal/lexer/transitiontable.go | 0 .../rr.grammar/rr}/internal/parser/action.go | 0 .../rr}/internal/parser/actiontable.go | 0 .../rr}/internal/parser/gototable.go | 0 .../rr}/internal/parser/parser.go | 49 +- .../rr}/internal/parser/productionstable.go | 0 .../rr}/internal/token/token.go | 3 + .../rr.grammar/rr/internal}/util/litconv.go | 0 .../rr.grammar/rr/internal}/util/rune.go | 0 example/rr/{ => rr.grammar/rr}/main/main.go | 2 +- example/rr/rr_test.go | 10 +- example/rr/token/token.go | 74 - example/rr/util/litconv.go | 108 - example/rr/util/rune.go | 39 - example/sr/ast/ast.go | 8 +- example/sr/errors/errors.go | 56 - example/sr/iface/iface.go | 30 - example/sr/internal/errors/errors.go | 56 - example/sr/internal/io/stream/stream.go | 39 - example/sr/internal/parser/action.go | 51 - example/sr/internal/util/litconv.go | 108 - example/sr/internal/util/rune.go | 39 - example/sr/lexer/acttab.go | 91 - example/sr/lexer/lexer.go | 136 - example/sr/lexer/transitiontable.go | 289 -- example/sr/parser/action.go | 51 - example/sr/parser/actiontable.go | 190 - example/sr/parser/gototable.go | 77 - example/sr/parser/parser.go | 216 - example/sr/parser/productionstable.go | 63 - example/sr/sr.go | 62 - example/sr/sr.grammar/sr/grammar.go | 131 + example/sr/sr.grammar/sr/iface/sr.go | 49 + .../sr.grammar/sr/internal}/errors/errors.go | 2 +- .../io/stream/internal/stream_impl.go | 0 .../io/stream/internal/stream_public.go | 0 .../sr}/internal/io/stream/stream.go | 2 +- .../sr}/internal/lexer/acttab.go | 2 +- .../sr}/internal/lexer/lexer.go | 51 +- .../sr}/internal/lexer/transitiontable.go | 0 .../sr.grammar/sr/internal}/parser/action.go | 0 .../sr}/internal/parser/actiontable.go | 0 .../sr}/internal/parser/gototable.go | 0 .../sr}/internal/parser/parser.go | 49 +- .../sr}/internal/parser/productionstable.go | 0 .../sr}/internal/token/token.go | 7 + .../sr.grammar/sr}/internal/util/litconv.go | 0 .../sr.grammar/sr}/internal/util/rune.go | 0 example/sr/{ => sr.grammar/sr}/main/main.go | 2 +- example/sr/sr_test.go | 9 +- example/sr/token/token.go | 78 - example/sr/util/litconv.go | 108 - example/sr/util/rune.go | 39 - internal/ast/syntaxerror.go | 2 + internal/ast/syntaxprodid.go | 1 - internal/base/gen/gen.go | 4 +- internal/base/gen/golang/base.go | 205 +- internal/config/config.go | 46 +- internal/frontend/reparsed/grammar.go | 131 + internal/frontend/reparsed/iface/gocc2.go | 49 + .../reparsed/internal/errors/next/errors.go | 56 - .../iface.go => internal/iface/gocc2.go} | 0 .../frontend/reparsed/internal/lexer/lexer.go | 45 +- .../reparsed/internal/lexer/next/acttab.go | 459 -- .../reparsed/internal/lexer/next/lexer.go | 161 - .../internal/lexer/next/transitiontable.go | 1299 ----- .../reparsed/internal/parser/next/action.go | 51 - .../internal/parser/next/actiontable.go | 4605 ----------------- .../internal/parser/next/gototable.go | 3073 ----------- .../reparsed/internal/parser/next/parser.go | 229 - .../internal/parser/next/productionstable.go | 495 -- .../reparsed/internal/parser/parser.go | 66 +- .../reparsed/internal/token/next/token.go | 131 - .../frontend/reparsed/internal/token/token.go | 20 + internal/frontend/reparsed/main/main.go | 14 +- internal/frontend/reparsed/main/next/main.go | 40 - internal/frontend/reparsed/next/reparsed.go | 51 - internal/frontend/reparsed/reparsed.go | 62 - internal/io/gen/golang/gen.go | 1 - internal/lexer/gen/golang/gen.go | 8 +- internal/lexer/gen/golang/lexer.go | 89 +- internal/parser/gen/gen.go | 14 +- internal/parser/gen/golang/parser.go | 78 +- internal/token/gen/gen.go | 5 +- internal/token/gen/golang/token.go | 32 +- internal/token/tokenmap.go | 6 + internal/util/litconv.go | 2 +- main.go | 21 +- stock/main.go | 20 +- 324 files changed, 3551 insertions(+), 22995 deletions(-) create mode 100644 example/astx/ast.grammar/ast/grammar.go create mode 100644 example/astx/ast.grammar/ast/iface/ast.go rename example/astx/{ => ast.grammar/ast}/internal/errors/errors.go (94%) rename example/astx/{ => ast.grammar/ast}/internal/io/stream/internal/stream_impl.go (100%) rename example/astx/{ => ast.grammar/ast}/internal/io/stream/internal/stream_public.go (100%) rename example/astx/{ => ast.grammar/ast}/internal/io/stream/stream.go (88%) rename example/astx/{ => ast.grammar/ast}/internal/lexer/acttab.go (90%) rename example/astx/{ => ast.grammar/ast}/internal/lexer/lexer.go (71%) rename example/astx/{ => ast.grammar/ast}/internal/lexer/transitiontable.go (100%) rename example/astx/{ => ast.grammar/ast}/internal/parser/action.go (100%) rename example/astx/{ => ast.grammar/ast}/internal/parser/actiontable.go (100%) rename example/astx/{ => ast.grammar/ast}/internal/parser/gototable.go (100%) rename example/astx/{ => ast.grammar/ast}/internal/parser/parser.go (85%) rename example/astx/{ => ast.grammar/ast}/internal/parser/productionstable.go (100%) rename example/astx/{ => ast.grammar/ast}/internal/token/token.go (95%) rename example/astx/{ => ast.grammar/ast}/internal/util/litconv.go (100%) rename example/astx/{ => ast.grammar/ast}/internal/util/rune.go (100%) rename example/astx/{ => ast.grammar/ast}/main/main.go (66%) delete mode 100644 example/astx/astx.go delete mode 100644 example/astx/iface/iface.go delete mode 100644 example/astx/lexer/acttab.go delete mode 100644 example/astx/lexer/lexer.go delete mode 100644 example/astx/parser/actiontable.go delete mode 100644 example/astx/parser/gototable.go delete mode 100644 example/astx/parser/parser.go delete mode 100644 example/astx/parser/productionstable.go delete mode 100644 example/astx/token/token.go rename example/bools/{example.bnf => bools.bnf} (100%) delete mode 100644 example/bools/bools.go create mode 100644 example/bools/bools.grammar/bools/grammar.go create mode 100644 example/bools/bools.grammar/bools/iface/bools.go create mode 100644 example/bools/bools.grammar/bools/internal/errors/errors.go rename example/bools/{ => bools.grammar/bools}/internal/io/stream/internal/stream_impl.go (100%) rename example/bools/{ => bools.grammar/bools}/internal/io/stream/internal/stream_public.go (100%) create mode 100644 example/bools/bools.grammar/bools/internal/io/stream/stream.go rename example/bools/{ => bools.grammar/bools}/internal/lexer/acttab.go (95%) rename example/bools/{ => bools.grammar/bools}/internal/lexer/lexer.go (71%) rename example/bools/{ => bools.grammar/bools}/internal/lexer/transitiontable.go (100%) rename example/{astx => bools/bools.grammar/bools/internal}/parser/action.go (100%) rename example/bools/{ => bools.grammar/bools}/internal/parser/actiontable.go (100%) rename example/bools/{ => bools.grammar/bools}/internal/parser/gototable.go (100%) rename example/bools/{ => bools.grammar/bools}/internal/parser/parser.go (84%) rename example/bools/{ => bools.grammar/bools}/internal/parser/productionstable.go (100%) rename example/bools/{ => bools.grammar/bools}/internal/token/token.go (89%) rename example/{astx => bools/bools.grammar/bools/internal}/util/litconv.go (100%) rename example/{astx => bools/bools.grammar/bools/internal}/util/rune.go (100%) rename example/bools/{ => bools.grammar/bools}/main/main.go (93%) delete mode 100644 example/bools/iface/iface.go delete mode 100644 example/bools/lexer/acttab.go delete mode 100644 example/bools/lexer/lexer.go delete mode 100644 example/bools/lexer/transitiontable.go delete mode 100644 example/bools/parser/actiontable.go delete mode 100644 example/bools/parser/gototable.go delete mode 100644 example/bools/parser/parser.go delete mode 100644 example/bools/parser/productionstable.go delete mode 100644 example/bools/token/token.go delete mode 100644 example/calc/calc.go create mode 100644 example/calc/calc.grammar/calc/grammar.go create mode 100644 example/calc/calc.grammar/calc/iface/calc.go create mode 100644 example/calc/calc.grammar/calc/internal/errors/errors.go rename example/calc/{ => calc.grammar/calc}/internal/io/stream/internal/stream_impl.go (100%) rename example/calc/{ => calc.grammar/calc}/internal/io/stream/internal/stream_public.go (100%) create mode 100644 example/calc/calc.grammar/calc/internal/io/stream/stream.go rename example/calc/{ => calc.grammar/calc}/internal/lexer/acttab.go (91%) rename example/calc/{ => calc.grammar/calc}/internal/lexer/lexer.go (71%) rename example/calc/{ => calc.grammar/calc}/internal/lexer/transitiontable.go (100%) rename example/{bools => calc/calc.grammar/calc}/internal/parser/action.go (100%) rename example/calc/{ => calc.grammar/calc}/internal/parser/actiontable.go (100%) rename example/calc/{ => calc.grammar/calc}/internal/parser/gototable.go (100%) rename example/calc/{ => calc.grammar/calc}/internal/parser/parser.go (85%) rename example/calc/{ => calc.grammar/calc}/internal/parser/productionstable.go (93%) rename example/calc/{ => calc.grammar/calc}/internal/token/token.go (93%) rename example/{bools => calc/calc.grammar/calc}/internal/util/litconv.go (100%) rename example/{bools => calc/calc.grammar/calc}/internal/util/rune.go (100%) rename example/calc/{ => calc.grammar/calc}/main/main.go (93%) delete mode 100644 example/calc/errors/errors.go delete mode 100644 example/calc/iface/iface.go delete mode 100644 example/calc/internal/errors/errors.go delete mode 100644 example/calc/lexer/acttab.go delete mode 100644 example/calc/lexer/lexer.go delete mode 100644 example/calc/lexer/transitiontable.go delete mode 100644 example/calc/parser/actiontable.go delete mode 100644 example/calc/parser/gototable.go delete mode 100644 example/calc/parser/parser.go delete mode 100644 example/calc/parser/productionstable.go delete mode 100644 example/calc/token/token.go delete mode 100644 example/ctx/ctx.go create mode 100644 example/ctx/ctx.grammar/ctx/grammar.go create mode 100644 example/ctx/ctx.grammar/ctx/iface/ctx.go rename example/{bools => ctx/ctx.grammar/ctx/internal}/errors/errors.go (94%) rename example/ctx/{ => ctx.grammar/ctx}/internal/io/stream/internal/stream_impl.go (100%) rename example/ctx/{ => ctx.grammar/ctx}/internal/io/stream/internal/stream_public.go (100%) rename example/{bools => ctx/ctx.grammar/ctx}/internal/io/stream/stream.go (88%) rename example/ctx/{ => ctx.grammar/ctx}/internal/lexer/acttab.go (92%) rename example/ctx/{ => ctx.grammar/ctx}/internal/lexer/lexer.go (71%) rename example/ctx/{ => ctx.grammar/ctx}/internal/lexer/transitiontable.go (100%) rename example/{bools => ctx/ctx.grammar/ctx/internal}/parser/action.go (100%) rename example/ctx/{ => ctx.grammar/ctx}/internal/parser/actiontable.go (100%) rename example/ctx/{ => ctx.grammar/ctx}/internal/parser/gototable.go (100%) rename example/ctx/{ => ctx.grammar/ctx}/internal/parser/parser.go (85%) rename example/ctx/{ => ctx.grammar/ctx}/internal/parser/productionstable.go (100%) rename example/ctx/{ => ctx.grammar/ctx}/internal/token/token.go (95%) rename example/{bools => ctx/ctx.grammar/ctx/internal}/util/litconv.go (100%) rename example/{bools => ctx/ctx.grammar/ctx/internal}/util/rune.go (100%) rename example/ctx/{ => ctx.grammar/ctx}/main/main.go (94%) delete mode 100644 example/ctx/errors/errors.go delete mode 100644 example/ctx/iface/iface.go delete mode 100644 example/ctx/internal/errors/errors.go delete mode 100644 example/ctx/lexer/acttab.go delete mode 100644 example/ctx/lexer/lexer.go delete mode 100644 example/ctx/lexer/transitiontable.go delete mode 100644 example/ctx/parser/actiontable.go delete mode 100644 example/ctx/parser/gototable.go delete mode 100644 example/ctx/parser/parser.go delete mode 100644 example/ctx/parser/productionstable.go delete mode 100644 example/ctx/token/token.go create mode 100644 example/errorrecovery/er.grammar/er/grammar.go create mode 100644 example/errorrecovery/er.grammar/er/iface/er.go create mode 100644 example/errorrecovery/er.grammar/er/internal/errors/errors.go rename example/errorrecovery/{ => er.grammar/er}/internal/io/stream/internal/stream_impl.go (100%) rename example/errorrecovery/{ => er.grammar/er}/internal/io/stream/internal/stream_public.go (100%) rename example/errorrecovery/{ => er.grammar/er}/internal/io/stream/stream.go (95%) rename example/errorrecovery/{ => er.grammar/er}/internal/lexer/acttab.go (89%) rename example/errorrecovery/{ => er.grammar/er}/internal/lexer/lexer.go (71%) rename example/{astx => errorrecovery/er.grammar/er/internal}/lexer/transitiontable.go (100%) rename example/{calc => errorrecovery/er.grammar/er}/internal/parser/action.go (100%) rename example/errorrecovery/{ => er.grammar/er}/internal/parser/actiontable.go (77%) rename example/errorrecovery/{ => er.grammar/er}/internal/parser/gototable.go (85%) rename example/errorrecovery/{ => er.grammar/er}/internal/parser/parser.go (85%) rename example/errorrecovery/{ => er.grammar/er}/internal/parser/productionstable.go (100%) rename example/errorrecovery/{ => er.grammar/er}/internal/token/token.go (94%) rename example/{calc => errorrecovery/er.grammar/er}/internal/util/litconv.go (100%) rename example/{calc => errorrecovery/er.grammar/er}/internal/util/rune.go (100%) create mode 100644 example/errorrecovery/er.grammar/er/main/main.go delete mode 100644 example/errorrecovery/errorrecovery.go delete mode 100644 example/errorrecovery/errors/errors.go delete mode 100644 example/errorrecovery/iface/iface.go delete mode 100644 example/errorrecovery/internal/errors/errors.go delete mode 100644 example/errorrecovery/internal/lexer/transitiontable.go delete mode 100644 example/errorrecovery/internal/parser/action.go delete mode 100644 example/errorrecovery/lexer/acttab.go delete mode 100644 example/errorrecovery/lexer/lexer.go delete mode 100644 example/errorrecovery/lexer/transitiontable.go delete mode 100644 example/errorrecovery/main/main.go delete mode 100644 example/errorrecovery/parser/action.go delete mode 100644 example/errorrecovery/parser/actiontable.go delete mode 100644 example/errorrecovery/parser/gototable.go delete mode 100644 example/errorrecovery/parser/parser.go delete mode 100644 example/errorrecovery/parser/productionstable.go delete mode 100644 example/errorrecovery/parser/symbols.go delete mode 100644 example/errorrecovery/token/token.go delete mode 100644 example/errorrecovery/util/litconv.go delete mode 100644 example/errorrecovery/util/rune.go delete mode 100644 example/mail/iface/iface.go delete mode 100644 example/mail/internal/io/stream/stream.go delete mode 100644 example/mail/internal/util/litconv.go delete mode 100644 example/mail/internal/util/rune.go delete mode 100644 example/mail/lexer/acttab.go delete mode 100644 example/mail/lexer/lexer.go delete mode 100644 example/mail/lexer/transitiontable.go delete mode 100644 example/mail/mail.go create mode 100644 example/mail/mail.grammar/mail/grammar.go rename example/{nolexer/iface/iface.go => mail/mail.grammar/mail/iface/mail.go} (57%) rename example/mail/{ => mail.grammar/mail}/internal/io/stream/internal/stream_impl.go (100%) rename example/mail/{ => mail.grammar/mail}/internal/io/stream/internal/stream_public.go (100%) create mode 100644 example/mail/mail.grammar/mail/internal/io/stream/stream.go rename example/mail/{ => mail.grammar/mail}/internal/lexer/acttab.go (93%) rename example/mail/{ => mail.grammar/mail}/internal/lexer/lexer.go (71%) rename example/mail/{ => mail.grammar/mail}/internal/lexer/transitiontable.go (100%) rename example/mail/{ => mail.grammar/mail}/internal/token/token.go (96%) rename example/{calc => mail/mail.grammar/mail/internal}/util/litconv.go (100%) rename example/{calc => mail/mail.grammar/mail/internal}/util/rune.go (100%) delete mode 100644 example/mail/main/main.go delete mode 100644 example/mail/token/token.go delete mode 100644 example/mail/util/litconv.go delete mode 100644 example/mail/util/rune.go delete mode 100644 example/nolexer/internal/errors/errors.go delete mode 100644 example/nolexer/internal/io/stream/stream.go delete mode 100644 example/nolexer/internal/parser/action.go delete mode 100644 example/nolexer/internal/parser/parser.go delete mode 100644 example/nolexer/internal/util/litconv.go delete mode 100644 example/nolexer/internal/util/rune.go create mode 100644 example/nolexer/nolexer.grammar/nolexer/grammar.go create mode 100644 example/nolexer/nolexer.grammar/nolexer/iface/nolexer.go create mode 100644 example/nolexer/nolexer.grammar/nolexer/internal/errors/errors.go rename example/nolexer/{ => nolexer.grammar/nolexer}/internal/io/stream/internal/stream_impl.go (100%) rename example/nolexer/{ => nolexer.grammar/nolexer}/internal/io/stream/internal/stream_public.go (100%) create mode 100644 example/nolexer/nolexer.grammar/nolexer/internal/io/stream/stream.go rename example/{calc => nolexer/nolexer.grammar/nolexer/internal}/parser/action.go (100%) rename example/nolexer/{ => nolexer.grammar/nolexer}/internal/parser/actiontable.go (100%) rename example/nolexer/{ => nolexer.grammar/nolexer}/internal/parser/gototable.go (100%) create mode 100644 example/nolexer/nolexer.grammar/nolexer/internal/parser/parser.go rename example/nolexer/{ => nolexer.grammar/nolexer}/internal/parser/productionstable.go (95%) rename example/nolexer/{ => nolexer.grammar/nolexer}/internal/token/token.go (90%) rename example/{ctx => nolexer/nolexer.grammar/nolexer}/internal/util/litconv.go (100%) rename example/{ctx => nolexer/nolexer.grammar/nolexer}/internal/util/rune.go (100%) delete mode 100644 example/rr/errors/errors.go delete mode 100644 example/rr/iface/iface.go delete mode 100644 example/rr/internal/errors/errors.go delete mode 100644 example/rr/internal/io/stream/stream.go delete mode 100644 example/rr/internal/parser/action.go delete mode 100644 example/rr/internal/util/litconv.go delete mode 100644 example/rr/internal/util/rune.go delete mode 100644 example/rr/lexer/acttab.go delete mode 100644 example/rr/lexer/lexer.go delete mode 100644 example/rr/lexer/transitiontable.go delete mode 100644 example/rr/parser/action.go delete mode 100644 example/rr/parser/actiontable.go delete mode 100644 example/rr/parser/gototable.go delete mode 100644 example/rr/parser/parser.go delete mode 100644 example/rr/parser/productionstable.go delete mode 100644 example/rr/rr.go create mode 100644 example/rr/rr.grammar/rr/grammar.go create mode 100644 example/rr/rr.grammar/rr/iface/rr.go rename example/{bools => rr/rr.grammar/rr}/internal/errors/errors.go (94%) rename example/rr/{ => rr.grammar/rr}/internal/io/stream/internal/stream_impl.go (100%) rename example/rr/{ => rr.grammar/rr}/internal/io/stream/internal/stream_public.go (100%) rename example/{calc => rr/rr.grammar/rr}/internal/io/stream/stream.go (89%) rename example/rr/{ => rr.grammar/rr}/internal/lexer/acttab.go (88%) rename example/rr/{ => rr.grammar/rr}/internal/lexer/lexer.go (71%) rename example/rr/{ => rr.grammar/rr}/internal/lexer/transitiontable.go (100%) rename example/{ctx => rr/rr.grammar/rr}/internal/parser/action.go (100%) rename example/rr/{ => rr.grammar/rr}/internal/parser/actiontable.go (100%) rename example/rr/{ => rr.grammar/rr}/internal/parser/gototable.go (100%) rename example/rr/{ => rr.grammar/rr}/internal/parser/parser.go (85%) rename example/rr/{ => rr.grammar/rr}/internal/parser/productionstable.go (100%) rename example/rr/{ => rr.grammar/rr}/internal/token/token.go (96%) rename example/{ctx => rr/rr.grammar/rr/internal}/util/litconv.go (100%) rename example/{ctx => rr/rr.grammar/rr/internal}/util/rune.go (100%) rename example/rr/{ => rr.grammar/rr}/main/main.go (94%) delete mode 100644 example/rr/token/token.go delete mode 100644 example/rr/util/litconv.go delete mode 100644 example/rr/util/rune.go delete mode 100644 example/sr/errors/errors.go delete mode 100644 example/sr/iface/iface.go delete mode 100644 example/sr/internal/errors/errors.go delete mode 100644 example/sr/internal/io/stream/stream.go delete mode 100644 example/sr/internal/parser/action.go delete mode 100644 example/sr/internal/util/litconv.go delete mode 100644 example/sr/internal/util/rune.go delete mode 100644 example/sr/lexer/acttab.go delete mode 100644 example/sr/lexer/lexer.go delete mode 100644 example/sr/lexer/transitiontable.go delete mode 100644 example/sr/parser/action.go delete mode 100644 example/sr/parser/actiontable.go delete mode 100644 example/sr/parser/gototable.go delete mode 100644 example/sr/parser/parser.go delete mode 100644 example/sr/parser/productionstable.go delete mode 100644 example/sr/sr.go create mode 100644 example/sr/sr.grammar/sr/grammar.go create mode 100644 example/sr/sr.grammar/sr/iface/sr.go rename example/{astx => sr/sr.grammar/sr/internal}/errors/errors.go (94%) rename example/sr/{ => sr.grammar/sr}/internal/io/stream/internal/stream_impl.go (100%) rename example/sr/{ => sr.grammar/sr}/internal/io/stream/internal/stream_public.go (100%) rename example/{ctx => sr/sr.grammar/sr}/internal/io/stream/stream.go (89%) rename example/sr/{ => sr.grammar/sr}/internal/lexer/acttab.go (95%) rename example/sr/{ => sr.grammar/sr}/internal/lexer/lexer.go (71%) rename example/sr/{ => sr.grammar/sr}/internal/lexer/transitiontable.go (100%) rename example/{ctx => sr/sr.grammar/sr/internal}/parser/action.go (100%) rename example/sr/{ => sr.grammar/sr}/internal/parser/actiontable.go (100%) rename example/sr/{ => sr.grammar/sr}/internal/parser/gototable.go (100%) rename example/sr/{ => sr.grammar/sr}/internal/parser/parser.go (85%) rename example/sr/{ => sr.grammar/sr}/internal/parser/productionstable.go (100%) rename example/sr/{ => sr.grammar/sr}/internal/token/token.go (93%) rename example/{errorrecovery => sr/sr.grammar/sr}/internal/util/litconv.go (100%) rename example/{errorrecovery => sr/sr.grammar/sr}/internal/util/rune.go (100%) rename example/sr/{ => sr.grammar/sr}/main/main.go (94%) delete mode 100644 example/sr/token/token.go delete mode 100644 example/sr/util/litconv.go delete mode 100644 example/sr/util/rune.go create mode 100644 internal/frontend/reparsed/grammar.go create mode 100644 internal/frontend/reparsed/iface/gocc2.go delete mode 100644 internal/frontend/reparsed/internal/errors/next/errors.go rename internal/frontend/reparsed/{iface/iface.go => internal/iface/gocc2.go} (100%) delete mode 100644 internal/frontend/reparsed/internal/lexer/next/acttab.go delete mode 100644 internal/frontend/reparsed/internal/lexer/next/lexer.go delete mode 100644 internal/frontend/reparsed/internal/lexer/next/transitiontable.go delete mode 100644 internal/frontend/reparsed/internal/parser/next/action.go delete mode 100644 internal/frontend/reparsed/internal/parser/next/actiontable.go delete mode 100644 internal/frontend/reparsed/internal/parser/next/gototable.go delete mode 100644 internal/frontend/reparsed/internal/parser/next/parser.go delete mode 100644 internal/frontend/reparsed/internal/parser/next/productionstable.go delete mode 100644 internal/frontend/reparsed/internal/token/next/token.go delete mode 100644 internal/frontend/reparsed/main/next/main.go delete mode 100644 internal/frontend/reparsed/next/reparsed.go delete mode 100644 internal/frontend/reparsed/reparsed.go diff --git a/example/astx/ast.grammar/ast/grammar.go b/example/astx/ast.grammar/ast/grammar.go new file mode 100644 index 00000000..4bea5881 --- /dev/null +++ b/example/astx/ast.grammar/ast/grammar.go @@ -0,0 +1,131 @@ +// Code generated by gocc; DO NOT EDIT. + +package ast + +import ( + "io" + + "github.com/maxcalandrelli/gocc/example/astx/ast.grammar/ast/internal/errors" + "github.com/maxcalandrelli/gocc/example/astx/ast.grammar/ast/internal/lexer" + "github.com/maxcalandrelli/gocc/example/astx/ast.grammar/ast/internal/parser" + "github.com/maxcalandrelli/gocc/example/astx/ast.grammar/ast/internal/token" +) + +const ( + INVALID = token.INVALID + EOF = token.EOF +) + +type ( + Token = token.Token + TokenMap = token.TokenMap + Pos = token.Pos + ErrorSymbol = errors.ErrorSymbol + Error = errors.Error + Lexer = lexer.Lexer + Parser = parser.Parser +) + +func NewParser() *parser.Parser { + return parser.NewParser() +} + +func ParseFile(fpath string) (interface{}, error, int) { + if lexer, err := NewLexerFile(fpath); err == nil { + return NewParser().Parse(lexer) + } else { + return nil, err, 0 + } +} + +func ParseText(text string, userData interface{}) (interface{}, error, int) { + return NewParser().Parse(NewLexerBytes([]byte(text))) +} + +func Parse(stream io.Reader) (interface{}, error, int) { + lex, err := NewLexer(stream) + if lex == nil { + return nil, err, 0 + } + return NewParser().Parse(lex) +} + +func ParseFileWithData(fpath string, userData interface{}) (interface{}, error, int) { + if lexer, err := NewLexerFile(fpath); err == nil { + return NewParser().SetContext(userData).Parse(lexer) + } else { + return nil, err, 0 + } +} + +func ParseStringWithData(text string, userData interface{}) (interface{}, error, int) { + return NewParser().SetContext(userData).Parse(NewLexerBytes([]byte(text))) +} + +func ParseWithData(stream io.Reader, userData interface{}) (interface{}, error, int) { + lex, err := NewLexer(stream) + if lex == nil { + return nil, err, 0 + } + return NewParser().SetContext(userData).Parse(lex) +} + +func ParseFilePartial(fpath string) (interface{}, error, int) { + if lexer, err := NewLexerFile(fpath); err == nil { + return NewParser().ParseLongestPrefix(lexer) + } else { + return nil, err, 0 + } +} + +func ParseTextPartial(text string, userData interface{}) (interface{}, error, int) { + return NewParser().ParseLongestPrefix(NewLexerBytes([]byte(text))) +} + +func ParsePartial(stream io.Reader) (interface{}, error, int) { + lex, err := NewLexer(stream) + if lex == nil { + return nil, err, 0 + } + return NewParser().ParseLongestPrefix(lex) +} + +func ParseFileWithDataPartial(fpath string, userData interface{}) (interface{}, error, int) { + if lexer, err := NewLexerFile(fpath); err == nil { + return NewParser().SetContext(userData).ParseLongestPrefix(lexer) + } else { + return nil, err, 0 + } +} + +func ParseStringWithDataPartial(text string, userData interface{}) (interface{}, error, int) { + return NewParser().SetContext(userData).ParseLongestPrefix(NewLexerBytes([]byte(text))) +} + +func ParseWithDataPartial(stream io.Reader, userData interface{}) (interface{}, error, int) { + lex, err := NewLexer(stream) + if lex == nil { + return nil, err, 0 + } + return NewParser().SetContext(userData).ParseLongestPrefix(lex) +} + +func NewLexerBytes(src []byte) *lexer.Lexer { + return lexer.NewLexerBytes(src) +} + +func NewLexerString(src string) *lexer.Lexer { + return lexer.NewLexerBytes([]byte(src)) +} + +func NewLexerFile(fpath string) (*lexer.Lexer, error) { + return lexer.NewLexerFile(fpath) +} + +func NewLexer(reader io.Reader) (*lexer.Lexer, error) { + return lexer.NewLexer(reader) +} + +func GetTokenMap() TokenMap { + return token.TokMap +} diff --git a/example/astx/ast.grammar/ast/iface/ast.go b/example/astx/ast.grammar/ast/iface/ast.go new file mode 100644 index 00000000..60b0ba11 --- /dev/null +++ b/example/astx/ast.grammar/ast/iface/ast.go @@ -0,0 +1,49 @@ +// Code generated by gocc; DO NOT EDIT. + +package iface + +import ( + "github.com/maxcalandrelli/gocc/example/astx/ast.grammar/ast/internal/errors" + "github.com/maxcalandrelli/gocc/example/astx/ast.grammar/ast/internal/token" + "io" +) + +type ( + Token = token.Token + TokenMap = token.TokenMap + Pos = token.Pos + ErrorSymbol = errors.ErrorSymbol + Error = errors.Error + + Scanner interface { + Scan() (tok *Token) + } + + StreamScanner interface { + GetStream() TokenStream + } + + CheckPoint interface { + DistanceFrom(CheckPoint) int + } + + CheckPointable interface { + GetCheckPoint() CheckPoint + GotoCheckPoint(CheckPoint) + } + + TokenStream interface { + io.Reader + io.RuneScanner + io.Seeker + } +) + +const ( + INVALID = token.INVALID + EOF = token.EOF +) + +func GetTokenMap() TokenMap { + return token.TokMap +} diff --git a/example/astx/internal/errors/errors.go b/example/astx/ast.grammar/ast/internal/errors/errors.go similarity index 94% rename from example/astx/internal/errors/errors.go rename to example/astx/ast.grammar/ast/internal/errors/errors.go index ec96bb8d..40f47a5b 100644 --- a/example/astx/internal/errors/errors.go +++ b/example/astx/ast.grammar/ast/internal/errors/errors.go @@ -6,7 +6,7 @@ import ( "fmt" "strings" - "github.com/maxcalandrelli/gocc/example/astx/internal/token" + "github.com/maxcalandrelli/gocc/example/astx/ast.grammar/ast/internal/token" ) type ErrorSymbol interface { diff --git a/example/astx/internal/io/stream/internal/stream_impl.go b/example/astx/ast.grammar/ast/internal/io/stream/internal/stream_impl.go similarity index 100% rename from example/astx/internal/io/stream/internal/stream_impl.go rename to example/astx/ast.grammar/ast/internal/io/stream/internal/stream_impl.go diff --git a/example/astx/internal/io/stream/internal/stream_public.go b/example/astx/ast.grammar/ast/internal/io/stream/internal/stream_public.go similarity index 100% rename from example/astx/internal/io/stream/internal/stream_public.go rename to example/astx/ast.grammar/ast/internal/io/stream/internal/stream_public.go diff --git a/example/astx/internal/io/stream/stream.go b/example/astx/ast.grammar/ast/internal/io/stream/stream.go similarity index 88% rename from example/astx/internal/io/stream/stream.go rename to example/astx/ast.grammar/ast/internal/io/stream/stream.go index f8fcd588..601690af 100644 --- a/example/astx/internal/io/stream/stream.go +++ b/example/astx/ast.grammar/ast/internal/io/stream/stream.go @@ -1,7 +1,7 @@ package stream import ( - internal "github.com/maxcalandrelli/gocc/example/astx/internal/io/stream/internal" + internal "github.com/maxcalandrelli/gocc/example/astx/ast.grammar/ast/internal/io/stream/internal" "io" ) diff --git a/example/astx/internal/lexer/acttab.go b/example/astx/ast.grammar/ast/internal/lexer/acttab.go similarity index 90% rename from example/astx/internal/lexer/acttab.go rename to example/astx/ast.grammar/ast/internal/lexer/acttab.go index 8c3c7f8b..a2318bb6 100644 --- a/example/astx/internal/lexer/acttab.go +++ b/example/astx/ast.grammar/ast/internal/lexer/acttab.go @@ -5,7 +5,7 @@ package lexer import ( "fmt" - "github.com/maxcalandrelli/gocc/example/astx/internal/token" + "github.com/maxcalandrelli/gocc/example/astx/ast.grammar/ast/internal/token" ) type ActionTable [NumStates]ActionRow diff --git a/example/astx/internal/lexer/lexer.go b/example/astx/ast.grammar/ast/internal/lexer/lexer.go similarity index 71% rename from example/astx/internal/lexer/lexer.go rename to example/astx/ast.grammar/ast/internal/lexer/lexer.go index ec4a29ad..be094234 100644 --- a/example/astx/internal/lexer/lexer.go +++ b/example/astx/ast.grammar/ast/internal/lexer/lexer.go @@ -9,9 +9,9 @@ import ( "os" - "github.com/maxcalandrelli/gocc/example/astx/iface" - "github.com/maxcalandrelli/gocc/example/astx/internal/token" - "github.com/maxcalandrelli/gocc/example/astx/internal/io/stream" + "github.com/maxcalandrelli/gocc/example/astx/ast.grammar/ast/iface" + "github.com/maxcalandrelli/gocc/example/astx/ast.grammar/ast/internal/token" + "github.com/maxcalandrelli/gocc/example/astx/ast.grammar/ast/internal/io/stream" ) const ( @@ -37,6 +37,10 @@ func NewLexerBytes(src []byte) *Lexer { return lexer } +func NewLexerString(src string) *Lexer { + return NewLexerBytes([]byte(src)) +} + func NewLexerFile(fpath string) (*Lexer, error) { s, err := os.Open(fpath) if err != nil { @@ -66,11 +70,18 @@ func (l Lexer) GetStream() iface.TokenStream { type checkPoint int64 +func (c checkPoint) value () int64 { + return int64(c) +} + func (c checkPoint) DistanceFrom (o iface.CheckPoint) int { - return int (c - o.(checkPoint)) + return int (c.value() - o.(checkPoint).value()) } -func (l Lexer) GetCheckPoint() iface.CheckPoint { +func (l *Lexer) GetCheckPoint() iface.CheckPoint { + if l == nil { + return checkPoint(0) + } pos, _ := l.stream.Seek(0, io.SeekCurrent) return checkPoint(pos) } @@ -99,17 +110,17 @@ func (l *Lexer) Scan() (tok *token.Token) { } state = nextState if state != -1 { - switch curr { - case '\n': - l.position.Pos.Line++ - l.position.Pos.Column = 1 - case '\r': - l.position.Pos.Column = 1 - case '\t': - l.position.Pos.Column += 4 - default: - l.position.Pos.Column++ - } + switch curr { + case '\n': + l.position.Pos.Line++ + l.position.Pos.Column = 1 + case '\r': + l.position.Pos.Column = 1 + case '\t': + l.position.Pos.Column += 4 + default: + l.position.Pos.Column++ + } switch { case ActTab[state].Accept != -1: tok.Type = ActTab[state].Accept @@ -119,8 +130,12 @@ func (l *Lexer) Scan() (tok *token.Token) { state = 0 tok.Lit = []byte{} } - } else if curr != INVALID_RUNE { - l.stream.UnreadRune() + } else if curr != INVALID_RUNE{ + if len(tok.Lit) == 0 { + tok.Lit = append(tok.Lit, string(curr)...) + } else { + l.stream.UnreadRune() + } } if err == io.EOF && len(tok.Lit)==0 { tok.Type = token.EOF diff --git a/example/astx/internal/lexer/transitiontable.go b/example/astx/ast.grammar/ast/internal/lexer/transitiontable.go similarity index 100% rename from example/astx/internal/lexer/transitiontable.go rename to example/astx/ast.grammar/ast/internal/lexer/transitiontable.go diff --git a/example/astx/internal/parser/action.go b/example/astx/ast.grammar/ast/internal/parser/action.go similarity index 100% rename from example/astx/internal/parser/action.go rename to example/astx/ast.grammar/ast/internal/parser/action.go diff --git a/example/astx/internal/parser/actiontable.go b/example/astx/ast.grammar/ast/internal/parser/actiontable.go similarity index 100% rename from example/astx/internal/parser/actiontable.go rename to example/astx/ast.grammar/ast/internal/parser/actiontable.go diff --git a/example/astx/internal/parser/gototable.go b/example/astx/ast.grammar/ast/internal/parser/gototable.go similarity index 100% rename from example/astx/internal/parser/gototable.go rename to example/astx/ast.grammar/ast/internal/parser/gototable.go diff --git a/example/astx/internal/parser/parser.go b/example/astx/ast.grammar/ast/internal/parser/parser.go similarity index 85% rename from example/astx/internal/parser/parser.go rename to example/astx/ast.grammar/ast/internal/parser/parser.go index 69013844..964e4061 100644 --- a/example/astx/internal/parser/parser.go +++ b/example/astx/ast.grammar/ast/internal/parser/parser.go @@ -7,9 +7,9 @@ import ( "fmt" "strings" - "github.com/maxcalandrelli/gocc/example/astx/iface" - parseError "github.com/maxcalandrelli/gocc/example/astx/internal/errors" - "github.com/maxcalandrelli/gocc/example/astx/internal/token" + "github.com/maxcalandrelli/gocc/example/astx/ast.grammar/ast/iface" + parseError "github.com/maxcalandrelli/gocc/example/astx/ast.grammar/ast/internal/errors" + "github.com/maxcalandrelli/gocc/example/astx/ast.grammar/ast/internal/token" ) const ( @@ -95,7 +95,21 @@ type Parser struct { userContext interface{} } -type TokenStream = iface.TokenStream +type ( + TokenStream = iface.TokenStream + fakeCp struct{} + fakeCheckPointable struct{} +) + +func (f fakeCheckPointable) GetCheckPoint() iface.CheckPoint { + return fakeCp{} +} + +func (f fakeCheckPointable) GotoCheckPoint(iface.CheckPoint) {} + +func (f fakeCp) DistanceFrom(o iface.CheckPoint) int { + return 0 +} func NewParser() *Parser { return NewParserWithContext(nil) @@ -112,6 +126,15 @@ func (p *Parser) Reset() { p.stack.push(0, nil) } +func (p *Parser) SetContext(ctx interface{}) *Parser { + p.userContext = ctx + return p +} + +func (p Parser) GetContext() interface{} { + return p.userContext +} + func (p *Parser) Error(err error, scanner iface.Scanner) (recovered bool, errorAttrib *parseError.Error) { errorAttrib = &parseError.Error{ Err: err, @@ -125,7 +148,7 @@ func (p *Parser) Error(err error, scanner iface.Scanner) (recovered bool, errorA } } - if action := parserActions.table[p.stack.top()].actions[token.TokMap.Type("error")]; action != nil { + if action := parserActions.table[p.stack.top()].actions[token.TokMap.Type("λ")]; action != nil { p.stack.push(int(action.(shift)), errorAttrib) // action can only be shift } else { return @@ -202,7 +225,9 @@ func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, er if tokens == nil && (len(parserActions.table[p.stack.top()].cdActions) > 0 || longest) { return errNotRepositionable } - checkPoint = tokens.GetCheckPoint() + if longest { + checkPoint = tokens.GetCheckPoint() + } p.nextToken = scanner.Scan() if longest { afterPos = tokens.GetCheckPoint() @@ -210,20 +235,26 @@ func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, er return nil } p.Reset() - tokens, _ = scanner.(iface.CheckPointable) + if tokens, _ = scanner.(iface.CheckPointable); tokens == nil { + tokens = fakeCheckPointable{} + } + underlyingStream := TokenStream(nil) + if streamScanner, _ := scanner.(iface.StreamScanner); streamScanner != nil { + underlyingStream = streamScanner.GetStream() + } startCp := tokens.GetCheckPoint() if err := readNextToken(); err != nil { return nil, err, tokens.GetCheckPoint().DistanceFrom(startCp) } for acc := false; !acc; { action := parserActions.table[p.stack.top()].actions[p.nextToken.Type] - if action == nil { + if action == nil && underlyingStream != nil && len(parserActions.table[p.stack.top()].cdActions) > 0 { // // If no action, check if we have some context dependent parsing to try // for _, cdAction := range parserActions.table[p.stack.top()].cdActions { tokens.GotoCheckPoint(checkPoint) - cd_res, cd_err, cd_parsed := cdAction.tokenScanner(scanner.GetStream(), p.userContext) + cd_res, cd_err, cd_parsed := cdAction.tokenScanner(underlyingStream, p.userContext) if cd_err == nil && len(cd_parsed) > 0 { action = parserActions.table[p.stack.top()].actions[cdAction.tokenIndex] if action != nil { diff --git a/example/astx/internal/parser/productionstable.go b/example/astx/ast.grammar/ast/internal/parser/productionstable.go similarity index 100% rename from example/astx/internal/parser/productionstable.go rename to example/astx/ast.grammar/ast/internal/parser/productionstable.go diff --git a/example/astx/internal/token/token.go b/example/astx/ast.grammar/ast/internal/token/token.go similarity index 95% rename from example/astx/internal/token/token.go rename to example/astx/ast.grammar/ast/internal/token/token.go index 58432cfc..0a391a0b 100644 --- a/example/astx/internal/token/token.go +++ b/example/astx/ast.grammar/ast/internal/token/token.go @@ -48,6 +48,7 @@ func (p Pos) StartingFrom(base Pos) Pos { type TokenMap struct { typeMap []string idMap map[string]Type + litMap map[string]Type } func (m TokenMap) Id(tok Type) string { @@ -84,4 +85,6 @@ var TokMap = TokenMap{ "Ω": 1, "id": 2, }, + + litMap: map[string]Type{}, } diff --git a/example/astx/internal/util/litconv.go b/example/astx/ast.grammar/ast/internal/util/litconv.go similarity index 100% rename from example/astx/internal/util/litconv.go rename to example/astx/ast.grammar/ast/internal/util/litconv.go diff --git a/example/astx/internal/util/rune.go b/example/astx/ast.grammar/ast/internal/util/rune.go similarity index 100% rename from example/astx/internal/util/rune.go rename to example/astx/ast.grammar/ast/internal/util/rune.go diff --git a/example/astx/main/main.go b/example/astx/ast.grammar/ast/main/main.go similarity index 66% rename from example/astx/main/main.go rename to example/astx/ast.grammar/ast/main/main.go index 1b547c2a..897b31a0 100644 --- a/example/astx/main/main.go +++ b/example/astx/ast.grammar/ast/main/main.go @@ -6,7 +6,7 @@ import ( "os" "strings" - astx "github.com/maxcalandrelli/gocc/example/astx" + ast "github.com/maxcalandrelli/gocc/example/astx/ast.grammar/ast" ) func showResult(r interface{}, e error, l int) { @@ -23,11 +23,11 @@ var ( Longest bool ) -func parse(longest bool, lex *astx.Lexer) (res interface{}, err error, ptl int) { +func parse(longest bool, lex *ast.Lexer) (res interface{}, err error, ptl int) { if longest { - return astx.NewParser().ParseLongestPrefix(lex) + return ast.NewParser().ParseLongestPrefix(lex) } else { - return astx.NewParser().Parse(lex) + return ast.NewParser().Parse(lex) } return } @@ -38,16 +38,16 @@ func main() { flag.BoolVar(&Longest, "longest", false, "parse longest possible part") flag.Parse() if Text > "" { - showResult(parse(Longest, astx.NewLexerString(Text))) + showResult(parse(Longest, ast.NewLexerString(Text))) } if File > "" { - l, e := astx.NewLexerFile(File) + l, e := ast.NewLexerFile(File) if e != nil { panic(e) } showResult(parse(Longest, l)) } if str := strings.Join(flag.Args(), " "); str > "" { - showResult(parse(Longest, astx.NewLexerString(str))) + showResult(parse(Longest, ast.NewLexerString(str))) } } diff --git a/example/astx/ast/ast.go b/example/astx/ast/ast.go index 268ed2f0..8b9d8f42 100644 --- a/example/astx/ast/ast.go +++ b/example/astx/ast/ast.go @@ -1,7 +1,7 @@ package ast import ( - "github.com/maxcalandrelli/gocc/example/astx/token" + "github.com/maxcalandrelli/gocc/example/astx/ast.grammar/ast/iface" ) type ( @@ -18,5 +18,5 @@ func AppendStmt(stmtList, stmt interface{}) (StmtList, error) { } func NewStmt(stmtList interface{}) (Stmt, error) { - return Stmt(stmtList.(*token.Token).Lit), nil + return Stmt(stmtList.(*iface.Token).Lit), nil } diff --git a/example/astx/ast_test.go b/example/astx/ast_test.go index c7844fdd..9e6b1c4b 100644 --- a/example/astx/ast_test.go +++ b/example/astx/ast_test.go @@ -5,8 +5,7 @@ import ( "testing" "github.com/maxcalandrelli/gocc/example/astx/ast" - "github.com/maxcalandrelli/gocc/example/astx/lexer" - "github.com/maxcalandrelli/gocc/example/astx/parser" + grammar "github.com/maxcalandrelli/gocc/example/astx/ast.grammar/ast" ) func TestPass(t *testing.T) { @@ -28,9 +27,9 @@ func TestFail(t *testing.T) { func test(src []byte) (astree ast.StmtList, err error) { fmt.Printf("input: %s\n", src) - s := lexer.NewLexer(src) - p := parser.NewParser() - a, err := p.Parse(s) + s := grammar.NewLexerBytes(src) + p := grammar.NewParser() + a, err, _ := p.Parse(s) if err == nil { astree = a.(ast.StmtList) } diff --git a/example/astx/astx.go b/example/astx/astx.go deleted file mode 100644 index 66a94f5c..00000000 --- a/example/astx/astx.go +++ /dev/null @@ -1,62 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package astx - -import ( - "io" - - "github.com/maxcalandrelli/gocc/example/astx/iface" - "github.com/maxcalandrelli/gocc/example/astx/internal/io/stream" - "github.com/maxcalandrelli/gocc/example/astx/internal/lexer" - "github.com/maxcalandrelli/gocc/example/astx/internal/parser" - "github.com/maxcalandrelli/gocc/example/astx/internal/token" -) - -type ( - Token = token.Token - Lexer = lexer.Lexer - Parser = parser.Parser - TokenStream = iface.TokenStream - WindowReader = stream.WindowReader - Scanner = iface.Scanner -) - -func ParseFile(fpath string) (interface{}, error, int) { - if lexer, err := NewLexerFile(fpath); err == nil { - return NewParser().Parse(lexer) - } else { - return nil, err, 0 - } -} - -func ParseText(text string) (interface{}, error, int) { - return NewParser().Parse(NewLexerBytes([]byte(text))) -} - -func NewLexerBytes(src []byte) *lexer.Lexer { - return lexer.NewLexerBytes(src) -} - -func NewLexerString(src string) *lexer.Lexer { - return lexer.NewLexerBytes([]byte(src)) -} - -func NewLexerFile(fpath string) (*lexer.Lexer, error) { - return lexer.NewLexerFile(fpath) -} - -func NewParser() *parser.Parser { - return parser.NewParser() -} - -func NewWindowReaderFromBytes(src []byte) WindowReader { - return stream.NewWindowReaderFromBytes(src) -} - -func NewWindowReader(rdr io.Reader) WindowReader { - return stream.NewWindowReader(rdr) -} - -func NewLimitedWindowReader(rdr io.Reader, sizeMin, sizeMax int) WindowReader { - return stream.NewLimitedWindowReader(rdr, sizeMin, sizeMax) -} diff --git a/example/astx/iface/iface.go b/example/astx/iface/iface.go deleted file mode 100644 index 46188297..00000000 --- a/example/astx/iface/iface.go +++ /dev/null @@ -1,30 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package iface - -import ( - "github.com/maxcalandrelli/gocc/example/astx/internal/token" - "io" -) - -type ( - Scanner interface { - Scan() (tok *token.Token) - GetStream() TokenStream - } - - CheckPoint interface { - DistanceFrom(CheckPoint) int - } - - CheckPointable interface { - GetCheckPoint() CheckPoint - GotoCheckPoint(CheckPoint) - } - - TokenStream interface { - io.Reader - io.RuneScanner - io.Seeker - } -) diff --git a/example/astx/lexer/acttab.go b/example/astx/lexer/acttab.go deleted file mode 100644 index c43f5d24..00000000 --- a/example/astx/lexer/acttab.go +++ /dev/null @@ -1,51 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package lexer - -import ( - "fmt" - - "github.com/maxcalandrelli/gocc/example/astx/token" -) - -type ActionTable [NumStates]ActionRow - -type ActionRow struct { - Accept token.Type - Ignore string -} - -func (a ActionRow) String() string { - return fmt.Sprintf("Accept=%d, Ignore=%s", a.Accept, a.Ignore) -} - -var ActTab = ActionTable{ - ActionRow{ // S0 - Accept: 0, - Ignore: "", - }, - ActionRow{ // S1 - Accept: -1, - Ignore: "!whitespace", - }, - ActionRow{ // S2 - Accept: 2, - Ignore: "", - }, - ActionRow{ // S3 - Accept: 2, - Ignore: "", - }, - ActionRow{ // S4 - Accept: 2, - Ignore: "", - }, - ActionRow{ // S5 - Accept: 2, - Ignore: "", - }, - ActionRow{ // S6 - Accept: 2, - Ignore: "", - }, -} diff --git a/example/astx/lexer/lexer.go b/example/astx/lexer/lexer.go deleted file mode 100644 index 41f924a0..00000000 --- a/example/astx/lexer/lexer.go +++ /dev/null @@ -1,126 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package lexer - -import ( - "io/ioutil" - "unicode/utf8" - - "github.com/maxcalandrelli/gocc/example/astx/token" -) - -const ( - NoState = -1 - NumStates = 7 - NumSymbols = 10 -) - -type Lexer struct { - src []byte - pos int - line int - column int -} - -func NewLexer(src []byte) *Lexer { - lexer := &Lexer{ - src: src, - pos: 0, - line: 1, - column: 1, - } - return lexer -} - -func NewLexerFile(fpath string) (*Lexer, error) { - src, err := ioutil.ReadFile(fpath) - if err != nil { - return nil, err - } - return NewLexer(src), nil -} - -func (l *Lexer) Scan() (tok *token.Token) { - tok = new(token.Token) - if l.pos >= len(l.src) { - tok.Type = token.EOF - tok.Pos.Offset, tok.Pos.Line, tok.Pos.Column = l.pos, l.line, l.column - return - } - start, startLine, startColumn, end := l.pos, l.line, l.column, 0 - tok.Type = token.INVALID - state, rune1, size := 0, rune(-1), 0 - for state != -1 { - if l.pos >= len(l.src) { - rune1 = -1 - } else { - rune1, size = utf8.DecodeRune(l.src[l.pos:]) - l.pos += size - } - - nextState := -1 - if rune1 != -1 { - nextState = TransTab[state](rune1) - } - state = nextState - - if state != -1 { - - switch rune1 { - case '\n': - l.line++ - l.column = 1 - case '\r': - l.column = 1 - case '\t': - l.column += 4 - default: - l.column++ - } - - switch { - case ActTab[state].Accept != -1: - tok.Type = ActTab[state].Accept - end = l.pos - case ActTab[state].Ignore != "": - start, startLine, startColumn = l.pos, l.line, l.column - state = 0 - if start >= len(l.src) { - tok.Type = token.EOF - } - - } - } else { - if tok.Type == token.INVALID { - end = l.pos - } - } - } - if end > start { - l.pos = end - tok.Lit = l.src[start:end] - } else { - tok.Lit = []byte{} - } - tok.Pos.Offset, tok.Pos.Line, tok.Pos.Column = start, startLine, startColumn - - return -} - -func (l *Lexer) Reset() { - l.pos = 0 -} - -/* -Lexer symbols: -0: '_' -1: '_' -2: ' ' -3: '\t' -4: '\n' -5: '\r' -6: 'a'-'z' -7: 'A'-'Z' -8: '0'-'9' -9: . -*/ diff --git a/example/astx/parser/actiontable.go b/example/astx/parser/actiontable.go deleted file mode 100644 index 5a87c2d9..00000000 --- a/example/astx/parser/actiontable.go +++ /dev/null @@ -1,54 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package parser - -type ( - actionTable [numStates]actionRow - actionRow struct { - canRecover bool - actions [numSymbols]action - } -) - -var actionTab = actionTable{ - actionRow{ // S0 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - nil, // $ - shift(3), // id - }, - }, - actionRow{ // S1 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - accept(true), // $ - shift(3), // id - }, - }, - actionRow{ // S2 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - reduce(1), // $, reduce: StmtList - reduce(1), // id, reduce: StmtList - }, - }, - actionRow{ // S3 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - reduce(3), // $, reduce: Stmt - reduce(3), // id, reduce: Stmt - }, - }, - actionRow{ // S4 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - reduce(2), // $, reduce: StmtList - reduce(2), // id, reduce: StmtList - }, - }, -} diff --git a/example/astx/parser/gototable.go b/example/astx/parser/gototable.go deleted file mode 100644 index 365a4be8..00000000 --- a/example/astx/parser/gototable.go +++ /dev/null @@ -1,38 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package parser - -const numNTSymbols = 3 - -type ( - gotoTable [numStates]gotoRow - gotoRow [numNTSymbols]int -) - -var gotoTab = gotoTable{ - gotoRow{ // S0 - -1, // S' - 1, // StmtList - 2, // Stmt - }, - gotoRow{ // S1 - -1, // S' - -1, // StmtList - 4, // Stmt - }, - gotoRow{ // S2 - -1, // S' - -1, // StmtList - -1, // Stmt - }, - gotoRow{ // S3 - -1, // S' - -1, // StmtList - -1, // Stmt - }, - gotoRow{ // S4 - -1, // S' - -1, // StmtList - -1, // Stmt - }, -} diff --git a/example/astx/parser/parser.go b/example/astx/parser/parser.go deleted file mode 100644 index 589aa2c2..00000000 --- a/example/astx/parser/parser.go +++ /dev/null @@ -1,216 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package parser - -import ( - "fmt" - "strings" - - parseError "github.com/maxcalandrelli/gocc/example/astx/errors" - "github.com/maxcalandrelli/gocc/example/astx/token" -) - -const ( - numProductions = 4 - numStates = 5 - numSymbols = 6 -) - -// Stack - -type stack struct { - state []int - attrib []Attrib -} - -const iNITIAL_STACK_SIZE = 100 - -func newStack() *stack { - return &stack{ - state: make([]int, 0, iNITIAL_STACK_SIZE), - attrib: make([]Attrib, 0, iNITIAL_STACK_SIZE), - } -} - -func (s *stack) reset() { - s.state = s.state[:0] - s.attrib = s.attrib[:0] -} - -func (s *stack) push(state int, a Attrib) { - s.state = append(s.state, state) - s.attrib = append(s.attrib, a) -} - -func (s *stack) top() int { - return s.state[len(s.state)-1] -} - -func (s *stack) peek(pos int) int { - return s.state[pos] -} - -func (s *stack) topIndex() int { - return len(s.state) - 1 -} - -func (s *stack) popN(items int) []Attrib { - lo, hi := len(s.state)-items, len(s.state) - - attrib := s.attrib[lo:hi] - - s.state = s.state[:lo] - s.attrib = s.attrib[:lo] - - return attrib -} - -func (s *stack) String() string { - w := new(strings.Builder) - fmt.Fprintf(w, "stack:\n") - for i, st := range s.state { - fmt.Fprintf(w, "\t%d: %d , ", i, st) - if s.attrib[i] == nil { - fmt.Fprintf(w, "nil") - } else { - switch attr := s.attrib[i].(type) { - case *token.Token: - fmt.Fprintf(w, "%s", attr.Lit) - default: - fmt.Fprintf(w, "%v", attr) - } - } - fmt.Fprintf(w, "\n") - } - return w.String() -} - -// Parser - -type Parser struct { - stack *stack - nextToken *token.Token - pos int -} - -type Scanner interface { - Scan() (tok *token.Token) -} - -func NewParser() *Parser { - p := &Parser{stack: newStack()} - p.Reset() - return p -} - -func (p *Parser) Reset() { - p.stack.reset() - p.stack.push(0, nil) -} - -func (p *Parser) Error(err error, scanner Scanner) (recovered bool, errorAttrib *parseError.Error) { - errorAttrib = &parseError.Error{ - Err: err, - ErrorToken: p.nextToken, - ErrorSymbols: p.popNonRecoveryStates(), - ExpectedTokens: make([]string, 0, 8), - } - for t, action := range actionTab[p.stack.top()].actions { - if action != nil { - errorAttrib.ExpectedTokens = append(errorAttrib.ExpectedTokens, token.TokMap.Id(token.Type(t))) - } - } - - if action := actionTab[p.stack.top()].actions[token.TokMap.Type("error")]; action != nil { - p.stack.push(int(action.(shift)), errorAttrib) // action can only be shift - } else { - return - } - - if action := actionTab[p.stack.top()].actions[p.nextToken.Type]; action != nil { - recovered = true - } - for !recovered && p.nextToken.Type != token.EOF { - p.nextToken = scanner.Scan() - if action := actionTab[p.stack.top()].actions[p.nextToken.Type]; action != nil { - recovered = true - } - } - - return -} - -func (p *Parser) popNonRecoveryStates() (removedAttribs []parseError.ErrorSymbol) { - if rs, ok := p.firstRecoveryState(); ok { - errorSymbols := p.stack.popN(p.stack.topIndex() - rs) - removedAttribs = make([]parseError.ErrorSymbol, len(errorSymbols)) - for i, e := range errorSymbols { - removedAttribs[i] = e - } - } else { - removedAttribs = []parseError.ErrorSymbol{} - } - return -} - -// recoveryState points to the highest state on the stack, which can recover -func (p *Parser) firstRecoveryState() (recoveryState int, canRecover bool) { - recoveryState, canRecover = p.stack.topIndex(), actionTab[p.stack.top()].canRecover - for recoveryState > 0 && !canRecover { - recoveryState-- - canRecover = actionTab[p.stack.peek(recoveryState)].canRecover - } - return -} - -func (p *Parser) newError(err error) error { - e := &parseError.Error{ - Err: err, - StackTop: p.stack.top(), - ErrorToken: p.nextToken, - } - actRow := actionTab[p.stack.top()] - for i, t := range actRow.actions { - if t != nil { - e.ExpectedTokens = append(e.ExpectedTokens, token.TokMap.Id(token.Type(i))) - } - } - return e -} - -func (p *Parser) Parse(scanner Scanner) (res interface{}, err error) { - p.Reset() - p.nextToken = scanner.Scan() - for acc := false; !acc; { - action := actionTab[p.stack.top()].actions[p.nextToken.Type] - if action == nil { - if recovered, errAttrib := p.Error(nil, scanner); !recovered { - p.nextToken = errAttrib.ErrorToken - return nil, p.newError(nil) - } - if action = actionTab[p.stack.top()].actions[p.nextToken.Type]; action == nil { - panic("Error recovery led to invalid action") - } - } - - switch act := action.(type) { - case accept: - res = p.stack.popN(1)[0] - acc = true - case shift: - p.stack.push(int(act), p.nextToken) - p.nextToken = scanner.Scan() - case reduce: - prod := productionsTable[int(act)] - attrib, err := prod.ReduceFunc(p.stack.popN(prod.NumSymbols)) - if err != nil { - return nil, p.newError(err) - } else { - p.stack.push(gotoTab[p.stack.top()][prod.NTType], attrib) - } - default: - panic("unknown action: " + action.String()) - } - } - return res, nil -} diff --git a/example/astx/parser/productionstable.go b/example/astx/parser/productionstable.go deleted file mode 100644 index 1b603b16..00000000 --- a/example/astx/parser/productionstable.go +++ /dev/null @@ -1,63 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package parser - -import "github.com/maxcalandrelli/gocc/example/astx/ast" - -type ( - //TODO: change type and variable names to be consistent with other tables - ProdTab [numProductions]ProdTabEntry - ProdTabEntry struct { - String string - Id string - NTType int - Index int - NumSymbols int - ReduceFunc func([]Attrib) (Attrib, error) - } - Attrib interface { - } -) - -var productionsTable = ProdTab{ - ProdTabEntry{ - String: `S' : StmtList << >>`, - Id: "S'", - NTType: 0, - Index: 0, - NumSymbols: 1, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return X[0], nil - }, - }, - ProdTabEntry{ - String: `StmtList : Stmt << ast.NewStmtList(X[0]) >>`, - Id: "StmtList", - NTType: 1, - Index: 1, - NumSymbols: 1, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return ast.NewStmtList(X[0]) - }, - }, - ProdTabEntry{ - String: `StmtList : StmtList Stmt << ast.AppendStmt(X[0], X[1]) >>`, - Id: "StmtList", - NTType: 1, - Index: 2, - NumSymbols: 2, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return ast.AppendStmt(X[0], X[1]) - }, - }, - ProdTabEntry{ - String: `Stmt : id << ast.NewStmt(X[0]) >>`, - Id: "Stmt", - NTType: 2, - Index: 3, - NumSymbols: 1, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return ast.NewStmt(X[0]) - }, - }, -} diff --git a/example/astx/token/token.go b/example/astx/token/token.go deleted file mode 100644 index 501b01ac..00000000 --- a/example/astx/token/token.go +++ /dev/null @@ -1,72 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package token - -import ( - "fmt" -) - -type Token struct { - Type - Lit []byte - Pos -} - -type Type int - -const ( - INVALID Type = iota - EOF -) - -type Pos struct { - Offset int - Line int - Column int -} - -func (p Pos) String() string { - return fmt.Sprintf("Pos(offset=%d, line=%d, column=%d)", p.Offset, p.Line, p.Column) -} - -type TokenMap struct { - typeMap []string - idMap map[string]Type -} - -func (m TokenMap) Id(tok Type) string { - if int(tok) < len(m.typeMap) { - return m.typeMap[tok] - } - return "unknown" -} - -func (m TokenMap) Type(tok string) Type { - if typ, exist := m.idMap[tok]; exist { - return typ - } - return INVALID -} - -func (m TokenMap) TokenString(tok *Token) string { - //TODO: refactor to print pos & token string properly - return fmt.Sprintf("%s(%d,%s)", m.Id(tok.Type), tok.Type, tok.Lit) -} - -func (m TokenMap) StringType(typ Type) string { - return fmt.Sprintf("%s(%d)", m.Id(typ), typ) -} - -var TokMap = TokenMap{ - typeMap: []string{ - "INVALID", - "$", - "id", - }, - - idMap: map[string]Type{ - "INVALID": 0, - "$": 1, - "id": 2, - }, -} diff --git a/example/bools/Makefile b/example/bools/Makefile index 5a3f73ed..e46e6f3e 100644 --- a/example/bools/Makefile +++ b/example/bools/Makefile @@ -1,2 +1,2 @@ regenerate: - gocc -a example.bnf \ No newline at end of file + gocc -a bools.bnf diff --git a/example/bools/ast/ast.go b/example/bools/ast/ast.go index b7ebfb9d..12698fa5 100644 --- a/example/bools/ast/ast.go +++ b/example/bools/ast/ast.go @@ -18,8 +18,7 @@ import ( "strconv" "strings" - "github.com/maxcalandrelli/gocc/example/bools/token" - "github.com/maxcalandrelli/gocc/example/bools/util" + "github.com/maxcalandrelli/gocc/example/bools/bools.grammar/bools/iface" ) type Attrib interface{} @@ -103,12 +102,17 @@ type LessThanExpr struct { B int64 } +func IntValue(lit []byte) (int64, error) { + return strconv.ParseInt(string(lit), 10, 64) +} + + func NewLessThanExpr(a, b Attrib) (*LessThanExpr, error) { - aint, err := util.IntValue(a.(*token.Token).Lit) + aint, err := IntValue(a.(*iface.Token).Lit) if err != nil { return nil, err } - bint, err := util.IntValue(b.(*token.Token).Lit) + bint, err := IntValue(b.(*iface.Token).Lit) if err != nil { return nil, err } @@ -129,11 +133,11 @@ type SubStringExpr struct { } func NewSubStringExpr(a, b Attrib) (*SubStringExpr, error) { - astr, err := strconv.Unquote(string(a.(*token.Token).Lit)) + astr, err := strconv.Unquote(string(a.(*iface.Token).Lit)) if err != nil { return nil, err } - bstr, err := strconv.Unquote(string(b.(*token.Token).Lit)) + bstr, err := strconv.Unquote(string(b.(*iface.Token).Lit)) if err != nil { return nil, err } diff --git a/example/bools/example.bnf b/example/bools/bools.bnf similarity index 100% rename from example/bools/example.bnf rename to example/bools/bools.bnf diff --git a/example/bools/bools.go b/example/bools/bools.go deleted file mode 100644 index d43a82de..00000000 --- a/example/bools/bools.go +++ /dev/null @@ -1,62 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package bools - -import ( - "io" - - "github.com/maxcalandrelli/gocc/example/bools/iface" - "github.com/maxcalandrelli/gocc/example/bools/internal/io/stream" - "github.com/maxcalandrelli/gocc/example/bools/internal/lexer" - "github.com/maxcalandrelli/gocc/example/bools/internal/parser" - "github.com/maxcalandrelli/gocc/example/bools/internal/token" -) - -type ( - Token = token.Token - Lexer = lexer.Lexer - Parser = parser.Parser - TokenStream = iface.TokenStream - WindowReader = stream.WindowReader - Scanner = iface.Scanner -) - -func ParseFile(fpath string) (interface{}, error, int) { - if lexer, err := NewLexerFile(fpath); err == nil { - return NewParser().Parse(lexer) - } else { - return nil, err, 0 - } -} - -func ParseText(text string) (interface{}, error, int) { - return NewParser().Parse(NewLexerBytes([]byte(text))) -} - -func NewLexerBytes(src []byte) *lexer.Lexer { - return lexer.NewLexerBytes(src) -} - -func NewLexerString(src string) *lexer.Lexer { - return lexer.NewLexerBytes([]byte(src)) -} - -func NewLexerFile(fpath string) (*lexer.Lexer, error) { - return lexer.NewLexerFile(fpath) -} - -func NewParser() *parser.Parser { - return parser.NewParser() -} - -func NewWindowReaderFromBytes(src []byte) WindowReader { - return stream.NewWindowReaderFromBytes(src) -} - -func NewWindowReader(rdr io.Reader) WindowReader { - return stream.NewWindowReader(rdr) -} - -func NewLimitedWindowReader(rdr io.Reader, sizeMin, sizeMax int) WindowReader { - return stream.NewLimitedWindowReader(rdr, sizeMin, sizeMax) -} diff --git a/example/bools/bools.grammar/bools/grammar.go b/example/bools/bools.grammar/bools/grammar.go new file mode 100644 index 00000000..6ff0816f --- /dev/null +++ b/example/bools/bools.grammar/bools/grammar.go @@ -0,0 +1,131 @@ +// Code generated by gocc; DO NOT EDIT. + +package bools + +import ( + "io" + + "github.com/maxcalandrelli/gocc/example/bools/bools.grammar/bools/internal/errors" + "github.com/maxcalandrelli/gocc/example/bools/bools.grammar/bools/internal/lexer" + "github.com/maxcalandrelli/gocc/example/bools/bools.grammar/bools/internal/parser" + "github.com/maxcalandrelli/gocc/example/bools/bools.grammar/bools/internal/token" +) + +const ( + INVALID = token.INVALID + EOF = token.EOF +) + +type ( + Token = token.Token + TokenMap = token.TokenMap + Pos = token.Pos + ErrorSymbol = errors.ErrorSymbol + Error = errors.Error + Lexer = lexer.Lexer + Parser = parser.Parser +) + +func NewParser() *parser.Parser { + return parser.NewParser() +} + +func ParseFile(fpath string) (interface{}, error, int) { + if lexer, err := NewLexerFile(fpath); err == nil { + return NewParser().Parse(lexer) + } else { + return nil, err, 0 + } +} + +func ParseText(text string, userData interface{}) (interface{}, error, int) { + return NewParser().Parse(NewLexerBytes([]byte(text))) +} + +func Parse(stream io.Reader) (interface{}, error, int) { + lex, err := NewLexer(stream) + if lex == nil { + return nil, err, 0 + } + return NewParser().Parse(lex) +} + +func ParseFileWithData(fpath string, userData interface{}) (interface{}, error, int) { + if lexer, err := NewLexerFile(fpath); err == nil { + return NewParser().SetContext(userData).Parse(lexer) + } else { + return nil, err, 0 + } +} + +func ParseStringWithData(text string, userData interface{}) (interface{}, error, int) { + return NewParser().SetContext(userData).Parse(NewLexerBytes([]byte(text))) +} + +func ParseWithData(stream io.Reader, userData interface{}) (interface{}, error, int) { + lex, err := NewLexer(stream) + if lex == nil { + return nil, err, 0 + } + return NewParser().SetContext(userData).Parse(lex) +} + +func ParseFilePartial(fpath string) (interface{}, error, int) { + if lexer, err := NewLexerFile(fpath); err == nil { + return NewParser().ParseLongestPrefix(lexer) + } else { + return nil, err, 0 + } +} + +func ParseTextPartial(text string, userData interface{}) (interface{}, error, int) { + return NewParser().ParseLongestPrefix(NewLexerBytes([]byte(text))) +} + +func ParsePartial(stream io.Reader) (interface{}, error, int) { + lex, err := NewLexer(stream) + if lex == nil { + return nil, err, 0 + } + return NewParser().ParseLongestPrefix(lex) +} + +func ParseFileWithDataPartial(fpath string, userData interface{}) (interface{}, error, int) { + if lexer, err := NewLexerFile(fpath); err == nil { + return NewParser().SetContext(userData).ParseLongestPrefix(lexer) + } else { + return nil, err, 0 + } +} + +func ParseStringWithDataPartial(text string, userData interface{}) (interface{}, error, int) { + return NewParser().SetContext(userData).ParseLongestPrefix(NewLexerBytes([]byte(text))) +} + +func ParseWithDataPartial(stream io.Reader, userData interface{}) (interface{}, error, int) { + lex, err := NewLexer(stream) + if lex == nil { + return nil, err, 0 + } + return NewParser().SetContext(userData).ParseLongestPrefix(lex) +} + +func NewLexerBytes(src []byte) *lexer.Lexer { + return lexer.NewLexerBytes(src) +} + +func NewLexerString(src string) *lexer.Lexer { + return lexer.NewLexerBytes([]byte(src)) +} + +func NewLexerFile(fpath string) (*lexer.Lexer, error) { + return lexer.NewLexerFile(fpath) +} + +func NewLexer(reader io.Reader) (*lexer.Lexer, error) { + return lexer.NewLexer(reader) +} + +func GetTokenMap() TokenMap { + return token.TokMap +} diff --git a/example/bools/bools.grammar/bools/iface/bools.go b/example/bools/bools.grammar/bools/iface/bools.go new file mode 100644 index 00000000..c73b05de --- /dev/null +++ b/example/bools/bools.grammar/bools/iface/bools.go @@ -0,0 +1,49 @@ +// Code generated by gocc; DO NOT EDIT. + +package iface + +import ( + "github.com/maxcalandrelli/gocc/example/bools/bools.grammar/bools/internal/errors" + "github.com/maxcalandrelli/gocc/example/bools/bools.grammar/bools/internal/token" + "io" +) + +type ( + Token = token.Token + TokenMap = token.TokenMap + Pos = token.Pos + ErrorSymbol = errors.ErrorSymbol + Error = errors.Error + + Scanner interface { + Scan() (tok *Token) + } + + StreamScanner interface { + GetStream() TokenStream + } + + CheckPoint interface { + DistanceFrom(CheckPoint) int + } + + CheckPointable interface { + GetCheckPoint() CheckPoint + GotoCheckPoint(CheckPoint) + } + + TokenStream interface { + io.Reader + io.RuneScanner + io.Seeker + } +) + +const ( + INVALID = token.INVALID + EOF = token.EOF +) + +func GetTokenMap() TokenMap { + return token.TokMap +} diff --git a/example/bools/bools.grammar/bools/internal/errors/errors.go b/example/bools/bools.grammar/bools/internal/errors/errors.go new file mode 100644 index 00000000..158778b3 --- /dev/null +++ b/example/bools/bools.grammar/bools/internal/errors/errors.go @@ -0,0 +1,56 @@ +// Code generated by gocc; DO NOT EDIT. + +package errors + +import ( + "fmt" + "strings" + + "github.com/maxcalandrelli/gocc/example/bools/bools.grammar/bools/internal/token" +) + +type ErrorSymbol interface { +} + +type Error struct { + Err error + ErrorToken *token.Token + ErrorSymbols []ErrorSymbol + ExpectedTokens []string + StackTop int +} + +func (e *Error) String() string { + w := new(strings.Builder) + fmt.Fprintf(w, "Error") + if e.Err != nil { + fmt.Fprintf(w, " %s\n", e.Err) + } else { + fmt.Fprintf(w, "\n") + } + fmt.Fprintf(w, "Token: type=%d, lit=%s\n", e.ErrorToken.Type, e.ErrorToken.Lit) + fmt.Fprintf(w, "Pos: offset=%d, line=%d, column=%d\n", e.ErrorToken.Pos.Offset, e.ErrorToken.Pos.Line, e.ErrorToken.Pos.Column) + fmt.Fprintf(w, "Expected one of: ") + for _, sym := range e.ExpectedTokens { + fmt.Fprintf(w, "%s ", sym) + } + fmt.Fprintf(w, "ErrorSymbol:\n") + for _, sym := range e.ErrorSymbols { + fmt.Fprintf(w, "%v\n", sym) + } + return w.String() +} + +func (e *Error) Error() string { + w := new(strings.Builder) + fmt.Fprintf(w, "Error in S%d: %s, %s", e.StackTop, token.TokMap.TokenString(e.ErrorToken), e.ErrorToken.Pos.String()) + if e.Err != nil { + fmt.Fprintf(w, ": %+v", e.Err) + } else { + fmt.Fprintf(w, ", expected one of: ") + for _, expected := range e.ExpectedTokens { + fmt.Fprintf(w, "%s ", expected) + } + } + return w.String() +} diff --git a/example/bools/internal/io/stream/internal/stream_impl.go b/example/bools/bools.grammar/bools/internal/io/stream/internal/stream_impl.go similarity index 100% rename from example/bools/internal/io/stream/internal/stream_impl.go rename to example/bools/bools.grammar/bools/internal/io/stream/internal/stream_impl.go diff --git a/example/bools/internal/io/stream/internal/stream_public.go b/example/bools/bools.grammar/bools/internal/io/stream/internal/stream_public.go similarity index 100% rename from example/bools/internal/io/stream/internal/stream_public.go rename to example/bools/bools.grammar/bools/internal/io/stream/internal/stream_public.go diff --git a/example/bools/bools.grammar/bools/internal/io/stream/stream.go b/example/bools/bools.grammar/bools/internal/io/stream/stream.go new file mode 100644 index 00000000..99295ee6 --- /dev/null +++ b/example/bools/bools.grammar/bools/internal/io/stream/stream.go @@ -0,0 +1,39 @@ +package stream + +import ( + internal "github.com/maxcalandrelli/gocc/example/bools/bools.grammar/bools/internal/io/stream/internal" + "io" +) + +type ( + WindowReader interface { + BlockSize() int + Buffered() int + Cap() int + MaxCap() int + Read([]byte) (int, error) + ReadByte() (byte, error) + ReadPosition() int64 + ReadRune() (rune, int, error) + Seek(int64, int) (int64, error) + UnreadByte() error + UnreadRune() error + MaxUnreadSize() int + } +) + +var ( + InfoPrefixRoundUp = false +) + +func NewWindowReaderFromBytes(src []byte) WindowReader { + return internal.NewWindowReader(src, nil, 0, 0, InfoPrefixRoundUp) +} + +func NewWindowReader(rdr io.Reader) WindowReader { + return internal.NewWindowReader(nil, rdr, 0, 0, false) +} + +func NewLimitedWindowReader(rdr io.Reader, sizeMin, sizeMax int) WindowReader { + return internal.NewWindowReader(nil, rdr, sizeMin, sizeMax, InfoPrefixRoundUp) +} diff --git a/example/bools/internal/lexer/acttab.go b/example/bools/bools.grammar/bools/internal/lexer/acttab.go similarity index 95% rename from example/bools/internal/lexer/acttab.go rename to example/bools/bools.grammar/bools/internal/lexer/acttab.go index 138c1581..8925225f 100644 --- a/example/bools/internal/lexer/acttab.go +++ b/example/bools/bools.grammar/bools/internal/lexer/acttab.go @@ -5,7 +5,7 @@ package lexer import ( "fmt" - "github.com/maxcalandrelli/gocc/example/bools/internal/token" + "github.com/maxcalandrelli/gocc/example/bools/bools.grammar/bools/internal/token" ) type ActionTable [NumStates]ActionRow diff --git a/example/bools/internal/lexer/lexer.go b/example/bools/bools.grammar/bools/internal/lexer/lexer.go similarity index 71% rename from example/bools/internal/lexer/lexer.go rename to example/bools/bools.grammar/bools/internal/lexer/lexer.go index 07c86b15..6fcc393f 100644 --- a/example/bools/internal/lexer/lexer.go +++ b/example/bools/bools.grammar/bools/internal/lexer/lexer.go @@ -9,9 +9,9 @@ import ( "os" - "github.com/maxcalandrelli/gocc/example/bools/iface" - "github.com/maxcalandrelli/gocc/example/bools/internal/token" - "github.com/maxcalandrelli/gocc/example/bools/internal/io/stream" + "github.com/maxcalandrelli/gocc/example/bools/bools.grammar/bools/iface" + "github.com/maxcalandrelli/gocc/example/bools/bools.grammar/bools/internal/token" + "github.com/maxcalandrelli/gocc/example/bools/bools.grammar/bools/internal/io/stream" ) const ( @@ -37,6 +37,10 @@ func NewLexerBytes(src []byte) *Lexer { return lexer } +func NewLexerString(src string) *Lexer { + return NewLexerBytes([]byte(src)) +} + func NewLexerFile(fpath string) (*Lexer, error) { s, err := os.Open(fpath) if err != nil { @@ -66,11 +70,18 @@ func (l Lexer) GetStream() iface.TokenStream { type checkPoint int64 +func (c checkPoint) value () int64 { + return int64(c) +} + func (c checkPoint) DistanceFrom (o iface.CheckPoint) int { - return int (c - o.(checkPoint)) + return int (c.value() - o.(checkPoint).value()) } -func (l Lexer) GetCheckPoint() iface.CheckPoint { +func (l *Lexer) GetCheckPoint() iface.CheckPoint { + if l == nil { + return checkPoint(0) + } pos, _ := l.stream.Seek(0, io.SeekCurrent) return checkPoint(pos) } @@ -99,17 +110,17 @@ func (l *Lexer) Scan() (tok *token.Token) { } state = nextState if state != -1 { - switch curr { - case '\n': - l.position.Pos.Line++ - l.position.Pos.Column = 1 - case '\r': - l.position.Pos.Column = 1 - case '\t': - l.position.Pos.Column += 4 - default: - l.position.Pos.Column++ - } + switch curr { + case '\n': + l.position.Pos.Line++ + l.position.Pos.Column = 1 + case '\r': + l.position.Pos.Column = 1 + case '\t': + l.position.Pos.Column += 4 + default: + l.position.Pos.Column++ + } switch { case ActTab[state].Accept != -1: tok.Type = ActTab[state].Accept @@ -119,8 +130,12 @@ func (l *Lexer) Scan() (tok *token.Token) { state = 0 tok.Lit = []byte{} } - } else if curr != INVALID_RUNE { - l.stream.UnreadRune() + } else if curr != INVALID_RUNE{ + if len(tok.Lit) == 0 { + tok.Lit = append(tok.Lit, string(curr)...) + } else { + l.stream.UnreadRune() + } } if err == io.EOF && len(tok.Lit)==0 { tok.Type = token.EOF diff --git a/example/bools/internal/lexer/transitiontable.go b/example/bools/bools.grammar/bools/internal/lexer/transitiontable.go similarity index 100% rename from example/bools/internal/lexer/transitiontable.go rename to example/bools/bools.grammar/bools/internal/lexer/transitiontable.go diff --git a/example/astx/parser/action.go b/example/bools/bools.grammar/bools/internal/parser/action.go similarity index 100% rename from example/astx/parser/action.go rename to example/bools/bools.grammar/bools/internal/parser/action.go diff --git a/example/bools/internal/parser/actiontable.go b/example/bools/bools.grammar/bools/internal/parser/actiontable.go similarity index 100% rename from example/bools/internal/parser/actiontable.go rename to example/bools/bools.grammar/bools/internal/parser/actiontable.go diff --git a/example/bools/internal/parser/gototable.go b/example/bools/bools.grammar/bools/internal/parser/gototable.go similarity index 100% rename from example/bools/internal/parser/gototable.go rename to example/bools/bools.grammar/bools/internal/parser/gototable.go diff --git a/example/bools/internal/parser/parser.go b/example/bools/bools.grammar/bools/internal/parser/parser.go similarity index 84% rename from example/bools/internal/parser/parser.go rename to example/bools/bools.grammar/bools/internal/parser/parser.go index c25ae1ec..035102b0 100644 --- a/example/bools/internal/parser/parser.go +++ b/example/bools/bools.grammar/bools/internal/parser/parser.go @@ -7,9 +7,9 @@ import ( "fmt" "strings" - "github.com/maxcalandrelli/gocc/example/bools/iface" - parseError "github.com/maxcalandrelli/gocc/example/bools/internal/errors" - "github.com/maxcalandrelli/gocc/example/bools/internal/token" + "github.com/maxcalandrelli/gocc/example/bools/bools.grammar/bools/iface" + parseError "github.com/maxcalandrelli/gocc/example/bools/bools.grammar/bools/internal/errors" + "github.com/maxcalandrelli/gocc/example/bools/bools.grammar/bools/internal/token" ) const ( @@ -95,7 +95,21 @@ type Parser struct { userContext interface{} } -type TokenStream = iface.TokenStream +type ( + TokenStream = iface.TokenStream + fakeCp struct{} + fakeCheckPointable struct{} +) + +func (f fakeCheckPointable) GetCheckPoint() iface.CheckPoint { + return fakeCp{} +} + +func (f fakeCheckPointable) GotoCheckPoint(iface.CheckPoint) {} + +func (f fakeCp) DistanceFrom(o iface.CheckPoint) int { + return 0 +} func NewParser() *Parser { return NewParserWithContext(nil) @@ -112,6 +126,15 @@ func (p *Parser) Reset() { p.stack.push(0, nil) } +func (p *Parser) SetContext(ctx interface{}) *Parser { + p.userContext = ctx + return p +} + +func (p Parser) GetContext() interface{} { + return p.userContext +} + func (p *Parser) Error(err error, scanner iface.Scanner) (recovered bool, errorAttrib *parseError.Error) { errorAttrib = &parseError.Error{ Err: err, @@ -125,7 +148,7 @@ func (p *Parser) Error(err error, scanner iface.Scanner) (recovered bool, errorA } } - if action := parserActions.table[p.stack.top()].actions[token.TokMap.Type("error")]; action != nil { + if action := parserActions.table[p.stack.top()].actions[token.TokMap.Type("λ")]; action != nil { p.stack.push(int(action.(shift)), errorAttrib) // action can only be shift } else { return @@ -202,7 +225,9 @@ func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, er if tokens == nil && (len(parserActions.table[p.stack.top()].cdActions) > 0 || longest) { return errNotRepositionable } - checkPoint = tokens.GetCheckPoint() + if longest { + checkPoint = tokens.GetCheckPoint() + } p.nextToken = scanner.Scan() if longest { afterPos = tokens.GetCheckPoint() @@ -210,20 +235,26 @@ func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, er return nil } p.Reset() - tokens, _ = scanner.(iface.CheckPointable) + if tokens, _ = scanner.(iface.CheckPointable); tokens == nil { + tokens = fakeCheckPointable{} + } + underlyingStream := TokenStream(nil) + if streamScanner, _ := scanner.(iface.StreamScanner); streamScanner != nil { + underlyingStream = streamScanner.GetStream() + } startCp := tokens.GetCheckPoint() if err := readNextToken(); err != nil { return nil, err, tokens.GetCheckPoint().DistanceFrom(startCp) } for acc := false; !acc; { action := parserActions.table[p.stack.top()].actions[p.nextToken.Type] - if action == nil { + if action == nil && underlyingStream != nil && len(parserActions.table[p.stack.top()].cdActions) > 0 { // // If no action, check if we have some context dependent parsing to try // for _, cdAction := range parserActions.table[p.stack.top()].cdActions { tokens.GotoCheckPoint(checkPoint) - cd_res, cd_err, cd_parsed := cdAction.tokenScanner(scanner.GetStream(), p.userContext) + cd_res, cd_err, cd_parsed := cdAction.tokenScanner(underlyingStream, p.userContext) if cd_err == nil && len(cd_parsed) > 0 { action = parserActions.table[p.stack.top()].actions[cdAction.tokenIndex] if action != nil { diff --git a/example/bools/internal/parser/productionstable.go b/example/bools/bools.grammar/bools/internal/parser/productionstable.go similarity index 100% rename from example/bools/internal/parser/productionstable.go rename to example/bools/bools.grammar/bools/internal/parser/productionstable.go diff --git a/example/bools/internal/token/token.go b/example/bools/bools.grammar/bools/internal/token/token.go similarity index 89% rename from example/bools/internal/token/token.go rename to example/bools/bools.grammar/bools/internal/token/token.go index 54ef22ac..5b07ee14 100644 --- a/example/bools/internal/token/token.go +++ b/example/bools/bools.grammar/bools/internal/token/token.go @@ -48,6 +48,7 @@ func (p Pos) StartingFrom(base Pos) Pos { type TokenMap struct { typeMap []string idMap map[string]Type + litMap map[string]Type } func (m TokenMap) Id(tok Type) string { @@ -104,4 +105,16 @@ var TokMap = TokenMap{ "string_lit": 11, "Λ": 12, }, + + litMap: map[string]Type{ + ")": 5, + "false": 7, + "in": 12, + "true": 6, + "<": 9, + ">": 10, + "&": 2, + "|": 3, + "(": 4, + }, } diff --git a/example/astx/util/litconv.go b/example/bools/bools.grammar/bools/internal/util/litconv.go similarity index 100% rename from example/astx/util/litconv.go rename to example/bools/bools.grammar/bools/internal/util/litconv.go diff --git a/example/astx/util/rune.go b/example/bools/bools.grammar/bools/internal/util/rune.go similarity index 100% rename from example/astx/util/rune.go rename to example/bools/bools.grammar/bools/internal/util/rune.go diff --git a/example/bools/main/main.go b/example/bools/bools.grammar/bools/main/main.go similarity index 93% rename from example/bools/main/main.go rename to example/bools/bools.grammar/bools/main/main.go index 945b2a0b..62d09d69 100644 --- a/example/bools/main/main.go +++ b/example/bools/bools.grammar/bools/main/main.go @@ -6,7 +6,7 @@ import ( "os" "strings" - bools "github.com/maxcalandrelli/gocc/example/bools" + bools "github.com/maxcalandrelli/gocc/example/bools/bools.grammar/bools" ) func showResult(r interface{}, e error, l int) { diff --git a/example/bools/example_test.go b/example/bools/example_test.go index 374d0eaf..3d7e79a5 100644 --- a/example/bools/example_test.go +++ b/example/bools/example_test.go @@ -18,14 +18,13 @@ import ( "testing" "github.com/maxcalandrelli/gocc/example/bools/ast" - "github.com/maxcalandrelli/gocc/example/bools/lexer" - "github.com/maxcalandrelli/gocc/example/bools/parser" + "github.com/maxcalandrelli/gocc/example/bools/bools.grammar/bools" ) func testEval(t *testing.T, exampleStr string, output bool) { - lex := lexer.NewLexer([]byte(exampleStr)) - p := parser.NewParser() - st, err := p.Parse(lex) + lex := bools.NewLexerString(exampleStr) + p := bools.NewParser() + st, err, _ := p.Parse(lex) if err != nil { panic(err) } diff --git a/example/bools/iface/iface.go b/example/bools/iface/iface.go deleted file mode 100644 index 33d90ba8..00000000 --- a/example/bools/iface/iface.go +++ /dev/null @@ -1,30 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package iface - -import ( - "github.com/maxcalandrelli/gocc/example/bools/internal/token" - "io" -) - -type ( - Scanner interface { - Scan() (tok *token.Token) - GetStream() TokenStream - } - - CheckPoint interface { - DistanceFrom(CheckPoint) int - } - - CheckPointable interface { - GetCheckPoint() CheckPoint - GotoCheckPoint(CheckPoint) - } - - TokenStream interface { - io.Reader - io.RuneScanner - io.Seeker - } -) diff --git a/example/bools/lexer/acttab.go b/example/bools/lexer/acttab.go deleted file mode 100644 index e70d0168..00000000 --- a/example/bools/lexer/acttab.go +++ /dev/null @@ -1,111 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package lexer - -import ( - "fmt" - - "github.com/maxcalandrelli/gocc/example/bools/token" -) - -type ActionTable [NumStates]ActionRow - -type ActionRow struct { - Accept token.Type - Ignore string -} - -func (a ActionRow) String() string { - return fmt.Sprintf("Accept=%d, Ignore=%s", a.Accept, a.Ignore) -} - -var ActTab = ActionTable{ - ActionRow{ // S0 - Accept: 0, - Ignore: "", - }, - ActionRow{ // S1 - Accept: -1, - Ignore: "!whitespace", - }, - ActionRow{ // S2 - Accept: 0, - Ignore: "", - }, - ActionRow{ // S3 - Accept: 2, - Ignore: "", - }, - ActionRow{ // S4 - Accept: 4, - Ignore: "", - }, - ActionRow{ // S5 - Accept: 5, - Ignore: "", - }, - ActionRow{ // S6 - Accept: 8, - Ignore: "", - }, - ActionRow{ // S7 - Accept: 9, - Ignore: "", - }, - ActionRow{ // S8 - Accept: 10, - Ignore: "", - }, - ActionRow{ // S9 - Accept: 0, - Ignore: "", - }, - ActionRow{ // S10 - Accept: 0, - Ignore: "", - }, - ActionRow{ // S11 - Accept: 0, - Ignore: "", - }, - ActionRow{ // S12 - Accept: 3, - Ignore: "", - }, - ActionRow{ // S13 - Accept: 11, - Ignore: "", - }, - ActionRow{ // S14 - Accept: 0, - Ignore: "", - }, - ActionRow{ // S15 - Accept: 12, - Ignore: "", - }, - ActionRow{ // S16 - Accept: 0, - Ignore: "", - }, - ActionRow{ // S17 - Accept: 0, - Ignore: "", - }, - ActionRow{ // S18 - Accept: 0, - Ignore: "", - }, - ActionRow{ // S19 - Accept: 0, - Ignore: "", - }, - ActionRow{ // S20 - Accept: 6, - Ignore: "", - }, - ActionRow{ // S21 - Accept: 7, - Ignore: "", - }, -} diff --git a/example/bools/lexer/lexer.go b/example/bools/lexer/lexer.go deleted file mode 100644 index 55efb5c6..00000000 --- a/example/bools/lexer/lexer.go +++ /dev/null @@ -1,141 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package lexer - -import ( - "io/ioutil" - "unicode/utf8" - - "github.com/maxcalandrelli/gocc/example/bools/token" -) - -const ( - NoState = -1 - NumStates = 22 - NumSymbols = 25 -) - -type Lexer struct { - src []byte - pos int - line int - column int -} - -func NewLexer(src []byte) *Lexer { - lexer := &Lexer{ - src: src, - pos: 0, - line: 1, - column: 1, - } - return lexer -} - -func NewLexerFile(fpath string) (*Lexer, error) { - src, err := ioutil.ReadFile(fpath) - if err != nil { - return nil, err - } - return NewLexer(src), nil -} - -func (l *Lexer) Scan() (tok *token.Token) { - tok = new(token.Token) - if l.pos >= len(l.src) { - tok.Type = token.EOF - tok.Pos.Offset, tok.Pos.Line, tok.Pos.Column = l.pos, l.line, l.column - return - } - start, startLine, startColumn, end := l.pos, l.line, l.column, 0 - tok.Type = token.INVALID - state, rune1, size := 0, rune(-1), 0 - for state != -1 { - if l.pos >= len(l.src) { - rune1 = -1 - } else { - rune1, size = utf8.DecodeRune(l.src[l.pos:]) - l.pos += size - } - - nextState := -1 - if rune1 != -1 { - nextState = TransTab[state](rune1) - } - state = nextState - - if state != -1 { - - switch rune1 { - case '\n': - l.line++ - l.column = 1 - case '\r': - l.column = 1 - case '\t': - l.column += 4 - default: - l.column++ - } - - switch { - case ActTab[state].Accept != -1: - tok.Type = ActTab[state].Accept - end = l.pos - case ActTab[state].Ignore != "": - start, startLine, startColumn = l.pos, l.line, l.column - state = 0 - if start >= len(l.src) { - tok.Type = token.EOF - } - - } - } else { - if tok.Type == token.INVALID { - end = l.pos - } - } - } - if end > start { - l.pos = end - tok.Lit = l.src[start:end] - } else { - tok.Lit = []byte{} - } - tok.Pos.Offset, tok.Pos.Line, tok.Pos.Column = start, startLine, startColumn - - return -} - -func (l *Lexer) Reset() { - l.pos = 0 -} - -/* -Lexer symbols: -0: '"' -1: '"' -2: '&' -3: '|' -4: '(' -5: ')' -6: 't' -7: 'r' -8: 'u' -9: 'e' -10: 'f' -11: 'a' -12: 'l' -13: 's' -14: 'e' -15: '<' -16: '>' -17: 'i' -18: 'n' -19: ' ' -20: '\t' -21: '\n' -22: '\r' -23: '0'-'9' -24: . -*/ diff --git a/example/bools/lexer/transitiontable.go b/example/bools/lexer/transitiontable.go deleted file mode 100644 index d8e02d47..00000000 --- a/example/bools/lexer/transitiontable.go +++ /dev/null @@ -1,196 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package lexer - -/* -Let s be the current state -Let r be the current input rune -transitionTable[s](r) returns the next state. -*/ -type TransitionTable [NumStates]func(rune) int - -var TransTab = TransitionTable{ - // S0 - func(r rune) int { - switch { - case r == 9: // ['\t','\t'] - return 1 - case r == 10: // ['\n','\n'] - return 1 - case r == 13: // ['\r','\r'] - return 1 - case r == 32: // [' ',' '] - return 1 - case r == 34: // ['"','"'] - return 2 - case r == 38: // ['&','&'] - return 3 - case r == 40: // ['(','('] - return 4 - case r == 41: // [')',')'] - return 5 - case 48 <= r && r <= 57: // ['0','9'] - return 6 - case r == 60: // ['<','<'] - return 7 - case r == 62: // ['>','>'] - return 8 - case r == 102: // ['f','f'] - return 9 - case r == 105: // ['i','i'] - return 10 - case r == 116: // ['t','t'] - return 11 - case r == 124: // ['|','|'] - return 12 - } - return NoState - }, - // S1 - func(r rune) int { - switch { - } - return NoState - }, - // S2 - func(r rune) int { - switch { - case r == 34: // ['"','"'] - return 13 - default: - return 2 - } - }, - // S3 - func(r rune) int { - switch { - } - return NoState - }, - // S4 - func(r rune) int { - switch { - } - return NoState - }, - // S5 - func(r rune) int { - switch { - } - return NoState - }, - // S6 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 6 - } - return NoState - }, - // S7 - func(r rune) int { - switch { - } - return NoState - }, - // S8 - func(r rune) int { - switch { - } - return NoState - }, - // S9 - func(r rune) int { - switch { - case r == 97: // ['a','a'] - return 14 - } - return NoState - }, - // S10 - func(r rune) int { - switch { - case r == 110: // ['n','n'] - return 15 - } - return NoState - }, - // S11 - func(r rune) int { - switch { - case r == 114: // ['r','r'] - return 16 - } - return NoState - }, - // S12 - func(r rune) int { - switch { - } - return NoState - }, - // S13 - func(r rune) int { - switch { - } - return NoState - }, - // S14 - func(r rune) int { - switch { - case r == 108: // ['l','l'] - return 17 - } - return NoState - }, - // S15 - func(r rune) int { - switch { - } - return NoState - }, - // S16 - func(r rune) int { - switch { - case r == 117: // ['u','u'] - return 18 - } - return NoState - }, - // S17 - func(r rune) int { - switch { - case r == 115: // ['s','s'] - return 19 - } - return NoState - }, - // S18 - func(r rune) int { - switch { - case r == 101: // ['e','e'] - return 20 - } - return NoState - }, - // S19 - func(r rune) int { - switch { - case r == 101: // ['e','e'] - return 21 - } - return NoState - }, - // S20 - func(r rune) int { - switch { - } - return NoState - }, - // S21 - func(r rune) int { - switch { - } - return NoState - }, -} diff --git a/example/bools/parser/actiontable.go b/example/bools/parser/actiontable.go deleted file mode 100644 index b55e6f90..00000000 --- a/example/bools/parser/actiontable.go +++ /dev/null @@ -1,842 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package parser - -type ( - actionTable [numStates]actionRow - actionRow struct { - canRecover bool - actions [numSymbols]action - } -) - -var actionTab = actionTable{ - actionRow{ // S0 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - nil, // $ - nil, // & - nil, // | - shift(4), // ( - nil, // ) - shift(5), // true - shift(6), // false - shift(9), // int_lit - nil, // < - nil, // > - shift(10), // string_lit - nil, // in - }, - }, - actionRow{ // S1 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - accept(true), // $ - shift(11), // & - shift(12), // | - nil, // ( - nil, // ) - nil, // true - nil, // false - nil, // int_lit - nil, // < - nil, // > - nil, // string_lit - nil, // in - }, - }, - actionRow{ // S2 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - reduce(1), // $, reduce: BoolExpr - reduce(1), // &, reduce: BoolExpr - reduce(1), // |, reduce: BoolExpr - nil, // ( - nil, // ) - nil, // true - nil, // false - nil, // int_lit - nil, // < - nil, // > - nil, // string_lit - nil, // in - }, - }, - actionRow{ // S3 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - reduce(2), // $, reduce: BoolExpr1 - reduce(2), // &, reduce: BoolExpr1 - reduce(2), // |, reduce: BoolExpr1 - nil, // ( - nil, // ) - nil, // true - nil, // false - nil, // int_lit - nil, // < - nil, // > - nil, // string_lit - nil, // in - }, - }, - actionRow{ // S4 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - nil, // $ - nil, // & - nil, // | - shift(16), // ( - nil, // ) - shift(17), // true - shift(18), // false - shift(21), // int_lit - nil, // < - nil, // > - shift(22), // string_lit - nil, // in - }, - }, - actionRow{ // S5 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - reduce(6), // $, reduce: Val - reduce(6), // &, reduce: Val - reduce(6), // |, reduce: Val - nil, // ( - nil, // ) - nil, // true - nil, // false - nil, // int_lit - nil, // < - nil, // > - nil, // string_lit - nil, // in - }, - }, - actionRow{ // S6 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - reduce(7), // $, reduce: Val - reduce(7), // &, reduce: Val - reduce(7), // |, reduce: Val - nil, // ( - nil, // ) - nil, // true - nil, // false - nil, // int_lit - nil, // < - nil, // > - nil, // string_lit - nil, // in - }, - }, - actionRow{ // S7 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - reduce(8), // $, reduce: Val - reduce(8), // &, reduce: Val - reduce(8), // |, reduce: Val - nil, // ( - nil, // ) - nil, // true - nil, // false - nil, // int_lit - nil, // < - nil, // > - nil, // string_lit - nil, // in - }, - }, - actionRow{ // S8 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - reduce(9), // $, reduce: Val - reduce(9), // &, reduce: Val - reduce(9), // |, reduce: Val - nil, // ( - nil, // ) - nil, // true - nil, // false - nil, // int_lit - nil, // < - nil, // > - nil, // string_lit - nil, // in - }, - }, - actionRow{ // S9 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - nil, // $ - nil, // & - nil, // | - nil, // ( - nil, // ) - nil, // true - nil, // false - nil, // int_lit - shift(23), // < - shift(24), // > - nil, // string_lit - nil, // in - }, - }, - actionRow{ // S10 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - nil, // $ - nil, // & - nil, // | - nil, // ( - nil, // ) - nil, // true - nil, // false - nil, // int_lit - nil, // < - nil, // > - nil, // string_lit - shift(25), // in - }, - }, - actionRow{ // S11 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - nil, // $ - nil, // & - nil, // | - shift(4), // ( - nil, // ) - shift(5), // true - shift(6), // false - shift(9), // int_lit - nil, // < - nil, // > - shift(10), // string_lit - nil, // in - }, - }, - actionRow{ // S12 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - nil, // $ - nil, // & - nil, // | - shift(4), // ( - nil, // ) - shift(5), // true - shift(6), // false - shift(9), // int_lit - nil, // < - nil, // > - shift(10), // string_lit - nil, // in - }, - }, - actionRow{ // S13 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - nil, // $ - shift(29), // & - shift(30), // | - nil, // ( - shift(31), // ) - nil, // true - nil, // false - nil, // int_lit - nil, // < - nil, // > - nil, // string_lit - nil, // in - }, - }, - actionRow{ // S14 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - nil, // $ - reduce(1), // &, reduce: BoolExpr - reduce(1), // |, reduce: BoolExpr - nil, // ( - reduce(1), // ), reduce: BoolExpr - nil, // true - nil, // false - nil, // int_lit - nil, // < - nil, // > - nil, // string_lit - nil, // in - }, - }, - actionRow{ // S15 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - nil, // $ - reduce(2), // &, reduce: BoolExpr1 - reduce(2), // |, reduce: BoolExpr1 - nil, // ( - reduce(2), // ), reduce: BoolExpr1 - nil, // true - nil, // false - nil, // int_lit - nil, // < - nil, // > - nil, // string_lit - nil, // in - }, - }, - actionRow{ // S16 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - nil, // $ - nil, // & - nil, // | - shift(16), // ( - nil, // ) - shift(17), // true - shift(18), // false - shift(21), // int_lit - nil, // < - nil, // > - shift(22), // string_lit - nil, // in - }, - }, - actionRow{ // S17 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - nil, // $ - reduce(6), // &, reduce: Val - reduce(6), // |, reduce: Val - nil, // ( - reduce(6), // ), reduce: Val - nil, // true - nil, // false - nil, // int_lit - nil, // < - nil, // > - nil, // string_lit - nil, // in - }, - }, - actionRow{ // S18 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - nil, // $ - reduce(7), // &, reduce: Val - reduce(7), // |, reduce: Val - nil, // ( - reduce(7), // ), reduce: Val - nil, // true - nil, // false - nil, // int_lit - nil, // < - nil, // > - nil, // string_lit - nil, // in - }, - }, - actionRow{ // S19 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - nil, // $ - reduce(8), // &, reduce: Val - reduce(8), // |, reduce: Val - nil, // ( - reduce(8), // ), reduce: Val - nil, // true - nil, // false - nil, // int_lit - nil, // < - nil, // > - nil, // string_lit - nil, // in - }, - }, - actionRow{ // S20 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - nil, // $ - reduce(9), // &, reduce: Val - reduce(9), // |, reduce: Val - nil, // ( - reduce(9), // ), reduce: Val - nil, // true - nil, // false - nil, // int_lit - nil, // < - nil, // > - nil, // string_lit - nil, // in - }, - }, - actionRow{ // S21 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - nil, // $ - nil, // & - nil, // | - nil, // ( - nil, // ) - nil, // true - nil, // false - nil, // int_lit - shift(33), // < - shift(34), // > - nil, // string_lit - nil, // in - }, - }, - actionRow{ // S22 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - nil, // $ - nil, // & - nil, // | - nil, // ( - nil, // ) - nil, // true - nil, // false - nil, // int_lit - nil, // < - nil, // > - nil, // string_lit - shift(35), // in - }, - }, - actionRow{ // S23 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - nil, // $ - nil, // & - nil, // | - nil, // ( - nil, // ) - nil, // true - nil, // false - shift(36), // int_lit - nil, // < - nil, // > - nil, // string_lit - nil, // in - }, - }, - actionRow{ // S24 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - nil, // $ - nil, // & - nil, // | - nil, // ( - nil, // ) - nil, // true - nil, // false - shift(37), // int_lit - nil, // < - nil, // > - nil, // string_lit - nil, // in - }, - }, - actionRow{ // S25 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - nil, // $ - nil, // & - nil, // | - nil, // ( - nil, // ) - nil, // true - nil, // false - nil, // int_lit - nil, // < - nil, // > - shift(38), // string_lit - nil, // in - }, - }, - actionRow{ // S26 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - nil, // $ - shift(11), // & - shift(12), // | - nil, // ( - nil, // ) - nil, // true - nil, // false - nil, // int_lit - nil, // < - nil, // > - nil, // string_lit - nil, // in - }, - }, - actionRow{ // S27 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - reduce(3), // $, reduce: BoolExpr1 - reduce(1), // &, reduce: BoolExpr - reduce(1), // |, reduce: BoolExpr - nil, // ( - nil, // ) - nil, // true - nil, // false - nil, // int_lit - nil, // < - nil, // > - nil, // string_lit - nil, // in - }, - }, - actionRow{ // S28 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - reduce(4), // $, reduce: BoolExpr1 - reduce(1), // &, reduce: BoolExpr - reduce(1), // |, reduce: BoolExpr - nil, // ( - nil, // ) - nil, // true - nil, // false - nil, // int_lit - nil, // < - nil, // > - nil, // string_lit - nil, // in - }, - }, - actionRow{ // S29 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - nil, // $ - nil, // & - nil, // | - shift(16), // ( - nil, // ) - shift(17), // true - shift(18), // false - shift(21), // int_lit - nil, // < - nil, // > - shift(22), // string_lit - nil, // in - }, - }, - actionRow{ // S30 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - nil, // $ - nil, // & - nil, // | - shift(16), // ( - nil, // ) - shift(17), // true - shift(18), // false - shift(21), // int_lit - nil, // < - nil, // > - shift(22), // string_lit - nil, // in - }, - }, - actionRow{ // S31 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - reduce(5), // $, reduce: BoolExpr1 - reduce(5), // &, reduce: BoolExpr1 - reduce(5), // |, reduce: BoolExpr1 - nil, // ( - nil, // ) - nil, // true - nil, // false - nil, // int_lit - nil, // < - nil, // > - nil, // string_lit - nil, // in - }, - }, - actionRow{ // S32 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - nil, // $ - shift(29), // & - shift(30), // | - nil, // ( - shift(42), // ) - nil, // true - nil, // false - nil, // int_lit - nil, // < - nil, // > - nil, // string_lit - nil, // in - }, - }, - actionRow{ // S33 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - nil, // $ - nil, // & - nil, // | - nil, // ( - nil, // ) - nil, // true - nil, // false - shift(43), // int_lit - nil, // < - nil, // > - nil, // string_lit - nil, // in - }, - }, - actionRow{ // S34 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - nil, // $ - nil, // & - nil, // | - nil, // ( - nil, // ) - nil, // true - nil, // false - shift(44), // int_lit - nil, // < - nil, // > - nil, // string_lit - nil, // in - }, - }, - actionRow{ // S35 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - nil, // $ - nil, // & - nil, // | - nil, // ( - nil, // ) - nil, // true - nil, // false - nil, // int_lit - nil, // < - nil, // > - shift(45), // string_lit - nil, // in - }, - }, - actionRow{ // S36 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - reduce(10), // $, reduce: CompareExpr - reduce(10), // &, reduce: CompareExpr - reduce(10), // |, reduce: CompareExpr - nil, // ( - nil, // ) - nil, // true - nil, // false - nil, // int_lit - nil, // < - nil, // > - nil, // string_lit - nil, // in - }, - }, - actionRow{ // S37 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - reduce(11), // $, reduce: CompareExpr - reduce(11), // &, reduce: CompareExpr - reduce(11), // |, reduce: CompareExpr - nil, // ( - nil, // ) - nil, // true - nil, // false - nil, // int_lit - nil, // < - nil, // > - nil, // string_lit - nil, // in - }, - }, - actionRow{ // S38 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - reduce(12), // $, reduce: SubStringExpr - reduce(12), // &, reduce: SubStringExpr - reduce(12), // |, reduce: SubStringExpr - nil, // ( - nil, // ) - nil, // true - nil, // false - nil, // int_lit - nil, // < - nil, // > - nil, // string_lit - nil, // in - }, - }, - actionRow{ // S39 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - nil, // $ - shift(29), // & - shift(30), // | - nil, // ( - nil, // ) - nil, // true - nil, // false - nil, // int_lit - nil, // < - nil, // > - nil, // string_lit - nil, // in - }, - }, - actionRow{ // S40 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - nil, // $ - reduce(1), // &, reduce: BoolExpr - reduce(1), // |, reduce: BoolExpr - nil, // ( - reduce(3), // ), reduce: BoolExpr1 - nil, // true - nil, // false - nil, // int_lit - nil, // < - nil, // > - nil, // string_lit - nil, // in - }, - }, - actionRow{ // S41 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - nil, // $ - reduce(1), // &, reduce: BoolExpr - reduce(1), // |, reduce: BoolExpr - nil, // ( - reduce(4), // ), reduce: BoolExpr1 - nil, // true - nil, // false - nil, // int_lit - nil, // < - nil, // > - nil, // string_lit - nil, // in - }, - }, - actionRow{ // S42 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - nil, // $ - reduce(5), // &, reduce: BoolExpr1 - reduce(5), // |, reduce: BoolExpr1 - nil, // ( - reduce(5), // ), reduce: BoolExpr1 - nil, // true - nil, // false - nil, // int_lit - nil, // < - nil, // > - nil, // string_lit - nil, // in - }, - }, - actionRow{ // S43 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - nil, // $ - reduce(10), // &, reduce: CompareExpr - reduce(10), // |, reduce: CompareExpr - nil, // ( - reduce(10), // ), reduce: CompareExpr - nil, // true - nil, // false - nil, // int_lit - nil, // < - nil, // > - nil, // string_lit - nil, // in - }, - }, - actionRow{ // S44 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - nil, // $ - reduce(11), // &, reduce: CompareExpr - reduce(11), // |, reduce: CompareExpr - nil, // ( - reduce(11), // ), reduce: CompareExpr - nil, // true - nil, // false - nil, // int_lit - nil, // < - nil, // > - nil, // string_lit - nil, // in - }, - }, - actionRow{ // S45 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - nil, // $ - reduce(12), // &, reduce: SubStringExpr - reduce(12), // |, reduce: SubStringExpr - nil, // ( - reduce(12), // ), reduce: SubStringExpr - nil, // true - nil, // false - nil, // int_lit - nil, // < - nil, // > - nil, // string_lit - nil, // in - }, - }, -} diff --git a/example/bools/parser/gototable.go b/example/bools/parser/gototable.go deleted file mode 100644 index d8853cb9..00000000 --- a/example/bools/parser/gototable.go +++ /dev/null @@ -1,381 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package parser - -const numNTSymbols = 6 - -type ( - gotoTable [numStates]gotoRow - gotoRow [numNTSymbols]int -) - -var gotoTab = gotoTable{ - gotoRow{ // S0 - -1, // S' - 1, // BoolExpr - 2, // BoolExpr1 - 3, // Val - 7, // CompareExpr - 8, // SubStringExpr - }, - gotoRow{ // S1 - -1, // S' - -1, // BoolExpr - -1, // BoolExpr1 - -1, // Val - -1, // CompareExpr - -1, // SubStringExpr - }, - gotoRow{ // S2 - -1, // S' - -1, // BoolExpr - -1, // BoolExpr1 - -1, // Val - -1, // CompareExpr - -1, // SubStringExpr - }, - gotoRow{ // S3 - -1, // S' - -1, // BoolExpr - -1, // BoolExpr1 - -1, // Val - -1, // CompareExpr - -1, // SubStringExpr - }, - gotoRow{ // S4 - -1, // S' - 13, // BoolExpr - 14, // BoolExpr1 - 15, // Val - 19, // CompareExpr - 20, // SubStringExpr - }, - gotoRow{ // S5 - -1, // S' - -1, // BoolExpr - -1, // BoolExpr1 - -1, // Val - -1, // CompareExpr - -1, // SubStringExpr - }, - gotoRow{ // S6 - -1, // S' - -1, // BoolExpr - -1, // BoolExpr1 - -1, // Val - -1, // CompareExpr - -1, // SubStringExpr - }, - gotoRow{ // S7 - -1, // S' - -1, // BoolExpr - -1, // BoolExpr1 - -1, // Val - -1, // CompareExpr - -1, // SubStringExpr - }, - gotoRow{ // S8 - -1, // S' - -1, // BoolExpr - -1, // BoolExpr1 - -1, // Val - -1, // CompareExpr - -1, // SubStringExpr - }, - gotoRow{ // S9 - -1, // S' - -1, // BoolExpr - -1, // BoolExpr1 - -1, // Val - -1, // CompareExpr - -1, // SubStringExpr - }, - gotoRow{ // S10 - -1, // S' - -1, // BoolExpr - -1, // BoolExpr1 - -1, // Val - -1, // CompareExpr - -1, // SubStringExpr - }, - gotoRow{ // S11 - -1, // S' - 26, // BoolExpr - 27, // BoolExpr1 - 3, // Val - 7, // CompareExpr - 8, // SubStringExpr - }, - gotoRow{ // S12 - -1, // S' - 26, // BoolExpr - 28, // BoolExpr1 - 3, // Val - 7, // CompareExpr - 8, // SubStringExpr - }, - gotoRow{ // S13 - -1, // S' - -1, // BoolExpr - -1, // BoolExpr1 - -1, // Val - -1, // CompareExpr - -1, // SubStringExpr - }, - gotoRow{ // S14 - -1, // S' - -1, // BoolExpr - -1, // BoolExpr1 - -1, // Val - -1, // CompareExpr - -1, // SubStringExpr - }, - gotoRow{ // S15 - -1, // S' - -1, // BoolExpr - -1, // BoolExpr1 - -1, // Val - -1, // CompareExpr - -1, // SubStringExpr - }, - gotoRow{ // S16 - -1, // S' - 32, // BoolExpr - 14, // BoolExpr1 - 15, // Val - 19, // CompareExpr - 20, // SubStringExpr - }, - gotoRow{ // S17 - -1, // S' - -1, // BoolExpr - -1, // BoolExpr1 - -1, // Val - -1, // CompareExpr - -1, // SubStringExpr - }, - gotoRow{ // S18 - -1, // S' - -1, // BoolExpr - -1, // BoolExpr1 - -1, // Val - -1, // CompareExpr - -1, // SubStringExpr - }, - gotoRow{ // S19 - -1, // S' - -1, // BoolExpr - -1, // BoolExpr1 - -1, // Val - -1, // CompareExpr - -1, // SubStringExpr - }, - gotoRow{ // S20 - -1, // S' - -1, // BoolExpr - -1, // BoolExpr1 - -1, // Val - -1, // CompareExpr - -1, // SubStringExpr - }, - gotoRow{ // S21 - -1, // S' - -1, // BoolExpr - -1, // BoolExpr1 - -1, // Val - -1, // CompareExpr - -1, // SubStringExpr - }, - gotoRow{ // S22 - -1, // S' - -1, // BoolExpr - -1, // BoolExpr1 - -1, // Val - -1, // CompareExpr - -1, // SubStringExpr - }, - gotoRow{ // S23 - -1, // S' - -1, // BoolExpr - -1, // BoolExpr1 - -1, // Val - -1, // CompareExpr - -1, // SubStringExpr - }, - gotoRow{ // S24 - -1, // S' - -1, // BoolExpr - -1, // BoolExpr1 - -1, // Val - -1, // CompareExpr - -1, // SubStringExpr - }, - gotoRow{ // S25 - -1, // S' - -1, // BoolExpr - -1, // BoolExpr1 - -1, // Val - -1, // CompareExpr - -1, // SubStringExpr - }, - gotoRow{ // S26 - -1, // S' - -1, // BoolExpr - -1, // BoolExpr1 - -1, // Val - -1, // CompareExpr - -1, // SubStringExpr - }, - gotoRow{ // S27 - -1, // S' - -1, // BoolExpr - -1, // BoolExpr1 - -1, // Val - -1, // CompareExpr - -1, // SubStringExpr - }, - gotoRow{ // S28 - -1, // S' - -1, // BoolExpr - -1, // BoolExpr1 - -1, // Val - -1, // CompareExpr - -1, // SubStringExpr - }, - gotoRow{ // S29 - -1, // S' - 39, // BoolExpr - 40, // BoolExpr1 - 15, // Val - 19, // CompareExpr - 20, // SubStringExpr - }, - gotoRow{ // S30 - -1, // S' - 39, // BoolExpr - 41, // BoolExpr1 - 15, // Val - 19, // CompareExpr - 20, // SubStringExpr - }, - gotoRow{ // S31 - -1, // S' - -1, // BoolExpr - -1, // BoolExpr1 - -1, // Val - -1, // CompareExpr - -1, // SubStringExpr - }, - gotoRow{ // S32 - -1, // S' - -1, // BoolExpr - -1, // BoolExpr1 - -1, // Val - -1, // CompareExpr - -1, // SubStringExpr - }, - gotoRow{ // S33 - -1, // S' - -1, // BoolExpr - -1, // BoolExpr1 - -1, // Val - -1, // CompareExpr - -1, // SubStringExpr - }, - gotoRow{ // S34 - -1, // S' - -1, // BoolExpr - -1, // BoolExpr1 - -1, // Val - -1, // CompareExpr - -1, // SubStringExpr - }, - gotoRow{ // S35 - -1, // S' - -1, // BoolExpr - -1, // BoolExpr1 - -1, // Val - -1, // CompareExpr - -1, // SubStringExpr - }, - gotoRow{ // S36 - -1, // S' - -1, // BoolExpr - -1, // BoolExpr1 - -1, // Val - -1, // CompareExpr - -1, // SubStringExpr - }, - gotoRow{ // S37 - -1, // S' - -1, // BoolExpr - -1, // BoolExpr1 - -1, // Val - -1, // CompareExpr - -1, // SubStringExpr - }, - gotoRow{ // S38 - -1, // S' - -1, // BoolExpr - -1, // BoolExpr1 - -1, // Val - -1, // CompareExpr - -1, // SubStringExpr - }, - gotoRow{ // S39 - -1, // S' - -1, // BoolExpr - -1, // BoolExpr1 - -1, // Val - -1, // CompareExpr - -1, // SubStringExpr - }, - gotoRow{ // S40 - -1, // S' - -1, // BoolExpr - -1, // BoolExpr1 - -1, // Val - -1, // CompareExpr - -1, // SubStringExpr - }, - gotoRow{ // S41 - -1, // S' - -1, // BoolExpr - -1, // BoolExpr1 - -1, // Val - -1, // CompareExpr - -1, // SubStringExpr - }, - gotoRow{ // S42 - -1, // S' - -1, // BoolExpr - -1, // BoolExpr1 - -1, // Val - -1, // CompareExpr - -1, // SubStringExpr - }, - gotoRow{ // S43 - -1, // S' - -1, // BoolExpr - -1, // BoolExpr1 - -1, // Val - -1, // CompareExpr - -1, // SubStringExpr - }, - gotoRow{ // S44 - -1, // S' - -1, // BoolExpr - -1, // BoolExpr1 - -1, // Val - -1, // CompareExpr - -1, // SubStringExpr - }, - gotoRow{ // S45 - -1, // S' - -1, // BoolExpr - -1, // BoolExpr1 - -1, // Val - -1, // CompareExpr - -1, // SubStringExpr - }, -} diff --git a/example/bools/parser/parser.go b/example/bools/parser/parser.go deleted file mode 100644 index baba1de0..00000000 --- a/example/bools/parser/parser.go +++ /dev/null @@ -1,216 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package parser - -import ( - "fmt" - "strings" - - parseError "github.com/maxcalandrelli/gocc/example/bools/errors" - "github.com/maxcalandrelli/gocc/example/bools/token" -) - -const ( - numProductions = 13 - numStates = 46 - numSymbols = 19 -) - -// Stack - -type stack struct { - state []int - attrib []Attrib -} - -const iNITIAL_STACK_SIZE = 100 - -func newStack() *stack { - return &stack{ - state: make([]int, 0, iNITIAL_STACK_SIZE), - attrib: make([]Attrib, 0, iNITIAL_STACK_SIZE), - } -} - -func (s *stack) reset() { - s.state = s.state[:0] - s.attrib = s.attrib[:0] -} - -func (s *stack) push(state int, a Attrib) { - s.state = append(s.state, state) - s.attrib = append(s.attrib, a) -} - -func (s *stack) top() int { - return s.state[len(s.state)-1] -} - -func (s *stack) peek(pos int) int { - return s.state[pos] -} - -func (s *stack) topIndex() int { - return len(s.state) - 1 -} - -func (s *stack) popN(items int) []Attrib { - lo, hi := len(s.state)-items, len(s.state) - - attrib := s.attrib[lo:hi] - - s.state = s.state[:lo] - s.attrib = s.attrib[:lo] - - return attrib -} - -func (s *stack) String() string { - w := new(strings.Builder) - fmt.Fprintf(w, "stack:\n") - for i, st := range s.state { - fmt.Fprintf(w, "\t%d: %d , ", i, st) - if s.attrib[i] == nil { - fmt.Fprintf(w, "nil") - } else { - switch attr := s.attrib[i].(type) { - case *token.Token: - fmt.Fprintf(w, "%s", attr.Lit) - default: - fmt.Fprintf(w, "%v", attr) - } - } - fmt.Fprintf(w, "\n") - } - return w.String() -} - -// Parser - -type Parser struct { - stack *stack - nextToken *token.Token - pos int -} - -type Scanner interface { - Scan() (tok *token.Token) -} - -func NewParser() *Parser { - p := &Parser{stack: newStack()} - p.Reset() - return p -} - -func (p *Parser) Reset() { - p.stack.reset() - p.stack.push(0, nil) -} - -func (p *Parser) Error(err error, scanner Scanner) (recovered bool, errorAttrib *parseError.Error) { - errorAttrib = &parseError.Error{ - Err: err, - ErrorToken: p.nextToken, - ErrorSymbols: p.popNonRecoveryStates(), - ExpectedTokens: make([]string, 0, 8), - } - for t, action := range actionTab[p.stack.top()].actions { - if action != nil { - errorAttrib.ExpectedTokens = append(errorAttrib.ExpectedTokens, token.TokMap.Id(token.Type(t))) - } - } - - if action := actionTab[p.stack.top()].actions[token.TokMap.Type("error")]; action != nil { - p.stack.push(int(action.(shift)), errorAttrib) // action can only be shift - } else { - return - } - - if action := actionTab[p.stack.top()].actions[p.nextToken.Type]; action != nil { - recovered = true - } - for !recovered && p.nextToken.Type != token.EOF { - p.nextToken = scanner.Scan() - if action := actionTab[p.stack.top()].actions[p.nextToken.Type]; action != nil { - recovered = true - } - } - - return -} - -func (p *Parser) popNonRecoveryStates() (removedAttribs []parseError.ErrorSymbol) { - if rs, ok := p.firstRecoveryState(); ok { - errorSymbols := p.stack.popN(p.stack.topIndex() - rs) - removedAttribs = make([]parseError.ErrorSymbol, len(errorSymbols)) - for i, e := range errorSymbols { - removedAttribs[i] = e - } - } else { - removedAttribs = []parseError.ErrorSymbol{} - } - return -} - -// recoveryState points to the highest state on the stack, which can recover -func (p *Parser) firstRecoveryState() (recoveryState int, canRecover bool) { - recoveryState, canRecover = p.stack.topIndex(), actionTab[p.stack.top()].canRecover - for recoveryState > 0 && !canRecover { - recoveryState-- - canRecover = actionTab[p.stack.peek(recoveryState)].canRecover - } - return -} - -func (p *Parser) newError(err error) error { - e := &parseError.Error{ - Err: err, - StackTop: p.stack.top(), - ErrorToken: p.nextToken, - } - actRow := actionTab[p.stack.top()] - for i, t := range actRow.actions { - if t != nil { - e.ExpectedTokens = append(e.ExpectedTokens, token.TokMap.Id(token.Type(i))) - } - } - return e -} - -func (p *Parser) Parse(scanner Scanner) (res interface{}, err error) { - p.Reset() - p.nextToken = scanner.Scan() - for acc := false; !acc; { - action := actionTab[p.stack.top()].actions[p.nextToken.Type] - if action == nil { - if recovered, errAttrib := p.Error(nil, scanner); !recovered { - p.nextToken = errAttrib.ErrorToken - return nil, p.newError(nil) - } - if action = actionTab[p.stack.top()].actions[p.nextToken.Type]; action == nil { - panic("Error recovery led to invalid action") - } - } - - switch act := action.(type) { - case accept: - res = p.stack.popN(1)[0] - acc = true - case shift: - p.stack.push(int(act), p.nextToken) - p.nextToken = scanner.Scan() - case reduce: - prod := productionsTable[int(act)] - attrib, err := prod.ReduceFunc(p.stack.popN(prod.NumSymbols)) - if err != nil { - return nil, p.newError(err) - } else { - p.stack.push(gotoTab[p.stack.top()][prod.NTType], attrib) - } - default: - panic("unknown action: " + action.String()) - } - } - return res, nil -} diff --git a/example/bools/parser/productionstable.go b/example/bools/parser/productionstable.go deleted file mode 100644 index 67618ea5..00000000 --- a/example/bools/parser/productionstable.go +++ /dev/null @@ -1,153 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package parser - -import ( "github.com/maxcalandrelli/gocc/example/bools/ast" ) - -type ( - //TODO: change type and variable names to be consistent with other tables - ProdTab [numProductions]ProdTabEntry - ProdTabEntry struct { - String string - Id string - NTType int - Index int - NumSymbols int - ReduceFunc func([]Attrib) (Attrib, error) - } - Attrib interface { - } -) - -var productionsTable = ProdTab{ - ProdTabEntry{ - String: `S' : BoolExpr << >>`, - Id: "S'", - NTType: 0, - Index: 0, - NumSymbols: 1, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return X[0], nil - }, - }, - ProdTabEntry{ - String: `BoolExpr : BoolExpr1 << X[0], nil >>`, - Id: "BoolExpr", - NTType: 1, - Index: 1, - NumSymbols: 1, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return X[0], nil - }, - }, - ProdTabEntry{ - String: `BoolExpr1 : Val << X[0], nil >>`, - Id: "BoolExpr1", - NTType: 2, - Index: 2, - NumSymbols: 1, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return X[0], nil - }, - }, - ProdTabEntry{ - String: `BoolExpr1 : BoolExpr "&" BoolExpr1 << ast.NewBoolAndExpr(X[0], X[2]) >>`, - Id: "BoolExpr1", - NTType: 2, - Index: 3, - NumSymbols: 3, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return ast.NewBoolAndExpr(X[0], X[2]) - }, - }, - ProdTabEntry{ - String: `BoolExpr1 : BoolExpr "|" BoolExpr1 << ast.NewBoolOrExpr(X[0], X[2]) >>`, - Id: "BoolExpr1", - NTType: 2, - Index: 4, - NumSymbols: 3, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return ast.NewBoolOrExpr(X[0], X[2]) - }, - }, - ProdTabEntry{ - String: `BoolExpr1 : "(" BoolExpr ")" << ast.NewBoolGroupExpr(X[1]) >>`, - Id: "BoolExpr1", - NTType: 2, - Index: 5, - NumSymbols: 3, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return ast.NewBoolGroupExpr(X[1]) - }, - }, - ProdTabEntry{ - String: `Val : "true" << ast.TRUE, nil >>`, - Id: "Val", - NTType: 3, - Index: 6, - NumSymbols: 1, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return ast.TRUE, nil - }, - }, - ProdTabEntry{ - String: `Val : "false" << ast.FALSE, nil >>`, - Id: "Val", - NTType: 3, - Index: 7, - NumSymbols: 1, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return ast.FALSE, nil - }, - }, - ProdTabEntry{ - String: `Val : CompareExpr << X[0], nil >>`, - Id: "Val", - NTType: 3, - Index: 8, - NumSymbols: 1, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return X[0], nil - }, - }, - ProdTabEntry{ - String: `Val : SubStringExpr << X[0], nil >>`, - Id: "Val", - NTType: 3, - Index: 9, - NumSymbols: 1, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return X[0], nil - }, - }, - ProdTabEntry{ - String: `CompareExpr : int_lit "<" int_lit << ast.NewLessThanExpr(X[0], X[2]) >>`, - Id: "CompareExpr", - NTType: 4, - Index: 10, - NumSymbols: 3, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return ast.NewLessThanExpr(X[0], X[2]) - }, - }, - ProdTabEntry{ - String: `CompareExpr : int_lit ">" int_lit << ast.NewLessThanExpr(X[2], X[0]) >>`, - Id: "CompareExpr", - NTType: 4, - Index: 11, - NumSymbols: 3, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return ast.NewLessThanExpr(X[2], X[0]) - }, - }, - ProdTabEntry{ - String: `SubStringExpr : string_lit "in" string_lit << ast.NewSubStringExpr(X[0], X[2]) >>`, - Id: "SubStringExpr", - NTType: 5, - Index: 12, - NumSymbols: 3, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return ast.NewSubStringExpr(X[0], X[2]) - }, - }, -} diff --git a/example/bools/token/token.go b/example/bools/token/token.go deleted file mode 100644 index 548c16a3..00000000 --- a/example/bools/token/token.go +++ /dev/null @@ -1,92 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package token - -import ( - "fmt" -) - -type Token struct { - Type - Lit []byte - Pos -} - -type Type int - -const ( - INVALID Type = iota - EOF -) - -type Pos struct { - Offset int - Line int - Column int -} - -func (p Pos) String() string { - return fmt.Sprintf("Pos(offset=%d, line=%d, column=%d)", p.Offset, p.Line, p.Column) -} - -type TokenMap struct { - typeMap []string - idMap map[string]Type -} - -func (m TokenMap) Id(tok Type) string { - if int(tok) < len(m.typeMap) { - return m.typeMap[tok] - } - return "unknown" -} - -func (m TokenMap) Type(tok string) Type { - if typ, exist := m.idMap[tok]; exist { - return typ - } - return INVALID -} - -func (m TokenMap) TokenString(tok *Token) string { - //TODO: refactor to print pos & token string properly - return fmt.Sprintf("%s(%d,%s)", m.Id(tok.Type), tok.Type, tok.Lit) -} - -func (m TokenMap) StringType(typ Type) string { - return fmt.Sprintf("%s(%d)", m.Id(typ), typ) -} - -var TokMap = TokenMap{ - typeMap: []string{ - "INVALID", - "$", - "&", - "|", - "(", - ")", - "true", - "false", - "int_lit", - "<", - ">", - "string_lit", - "in", - }, - - idMap: map[string]Type{ - "INVALID": 0, - "$": 1, - "&": 2, - "|": 3, - "(": 4, - ")": 5, - "true": 6, - "false": 7, - "int_lit": 8, - "<": 9, - ">": 10, - "string_lit": 11, - "in": 12, - }, -} diff --git a/example/calc/calc.bnf b/example/calc/calc.bnf index 345ca13e..547ba4cd 100644 --- a/example/calc/calc.bnf +++ b/example/calc/calc.bnf @@ -10,8 +10,8 @@ int64 : '1'-'9' {_digit} ; << import( - "github.com/maxcalandrelli/gocc/example/calc/token" - "github.com/maxcalandrelli/gocc/example/calc/util" + "github.com/maxcalandrelli/gocc/example/calc/calc.grammar/calc/internal/token" + "github.com/maxcalandrelli/gocc/example/calc/calc.grammar/calc/internal/util" ) >> diff --git a/example/calc/calc.go b/example/calc/calc.go deleted file mode 100644 index 57479229..00000000 --- a/example/calc/calc.go +++ /dev/null @@ -1,62 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package calc - -import ( - "io" - - "github.com/maxcalandrelli/gocc/example/calc/iface" - "github.com/maxcalandrelli/gocc/example/calc/internal/io/stream" - "github.com/maxcalandrelli/gocc/example/calc/internal/lexer" - "github.com/maxcalandrelli/gocc/example/calc/internal/parser" - "github.com/maxcalandrelli/gocc/example/calc/internal/token" -) - -type ( - Token = token.Token - Lexer = lexer.Lexer - Parser = parser.Parser - TokenStream = iface.TokenStream - WindowReader = stream.WindowReader - Scanner = iface.Scanner -) - -func ParseFile(fpath string) (interface{}, error, int) { - if lexer, err := NewLexerFile(fpath); err == nil { - return NewParser().Parse(lexer) - } else { - return nil, err, 0 - } -} - -func ParseText(text string) (interface{}, error, int) { - return NewParser().Parse(NewLexerBytes([]byte(text))) -} - -func NewLexerBytes(src []byte) *lexer.Lexer { - return lexer.NewLexerBytes(src) -} - -func NewLexerString(src string) *lexer.Lexer { - return lexer.NewLexerBytes([]byte(src)) -} - -func NewLexerFile(fpath string) (*lexer.Lexer, error) { - return lexer.NewLexerFile(fpath) -} - -func NewParser() *parser.Parser { - return parser.NewParser() -} - -func NewWindowReaderFromBytes(src []byte) WindowReader { - return stream.NewWindowReaderFromBytes(src) -} - -func NewWindowReader(rdr io.Reader) WindowReader { - return stream.NewWindowReader(rdr) -} - -func NewLimitedWindowReader(rdr io.Reader, sizeMin, sizeMax int) WindowReader { - return stream.NewLimitedWindowReader(rdr, sizeMin, sizeMax) -} diff --git a/example/calc/calc.grammar/calc/grammar.go b/example/calc/calc.grammar/calc/grammar.go new file mode 100644 index 00000000..d812f339 --- /dev/null +++ b/example/calc/calc.grammar/calc/grammar.go @@ -0,0 +1,131 @@ +// Code generated by gocc; DO NOT EDIT. + +package calc + +import ( + "io" + + "github.com/maxcalandrelli/gocc/example/calc/calc.grammar/calc/internal/errors" + "github.com/maxcalandrelli/gocc/example/calc/calc.grammar/calc/internal/lexer" + "github.com/maxcalandrelli/gocc/example/calc/calc.grammar/calc/internal/parser" + "github.com/maxcalandrelli/gocc/example/calc/calc.grammar/calc/internal/token" +) + +const ( + INVALID = token.INVALID + EOF = token.EOF +) + +type ( + Token = token.Token + TokenMap = token.TokenMap + Pos = token.Pos + ErrorSymbol = errors.ErrorSymbol + Error = errors.Error + Lexer = lexer.Lexer + Parser = parser.Parser +) + +func NewParser() *parser.Parser { + return parser.NewParser() +} + +func ParseFile(fpath string) (interface{}, error, int) { + if lexer, err := NewLexerFile(fpath); err == nil { + return NewParser().Parse(lexer) + } else { + return nil, err, 0 + } +} + +func ParseText(text string, userData interface{}) (interface{}, error, int) { + return NewParser().Parse(NewLexerBytes([]byte(text))) +} + +func Parse(stream io.Reader) (interface{}, error, int) { + lex, err := NewLexer(stream) + if lex == nil { + return nil, err, 0 + } + return NewParser().Parse(lex) +} + +func ParseFileWithData(fpath string, userData interface{}) (interface{}, error, int) { + if lexer, err := NewLexerFile(fpath); err == nil { + return NewParser().SetContext(userData).Parse(lexer) + } else { + return nil, err, 0 + } +} + +func ParseStringWithData(text string, userData interface{}) (interface{}, error, int) { + return NewParser().SetContext(userData).Parse(NewLexerBytes([]byte(text))) +} + +func ParseWithData(stream io.Reader, userData interface{}) (interface{}, error, int) { + lex, err := NewLexer(stream) + if lex == nil { + return nil, err, 0 + } + return NewParser().SetContext(userData).Parse(lex) +} + +func ParseFilePartial(fpath string) (interface{}, error, int) { + if lexer, err := NewLexerFile(fpath); err == nil { + return NewParser().ParseLongestPrefix(lexer) + } else { + return nil, err, 0 + } +} + +func ParseTextPartial(text string, userData interface{}) (interface{}, error, int) { + return NewParser().ParseLongestPrefix(NewLexerBytes([]byte(text))) +} + +func ParsePartial(stream io.Reader) (interface{}, error, int) { + lex, err := NewLexer(stream) + if lex == nil { + return nil, err, 0 + } + return NewParser().ParseLongestPrefix(lex) +} + +func ParseFileWithDataPartial(fpath string, userData interface{}) (interface{}, error, int) { + if lexer, err := NewLexerFile(fpath); err == nil { + return NewParser().SetContext(userData).ParseLongestPrefix(lexer) + } else { + return nil, err, 0 + } +} + +func ParseStringWithDataPartial(text string, userData interface{}) (interface{}, error, int) { + return NewParser().SetContext(userData).ParseLongestPrefix(NewLexerBytes([]byte(text))) +} + +func ParseWithDataPartial(stream io.Reader, userData interface{}) (interface{}, error, int) { + lex, err := NewLexer(stream) + if lex == nil { + return nil, err, 0 + } + return NewParser().SetContext(userData).ParseLongestPrefix(lex) +} + +func NewLexerBytes(src []byte) *lexer.Lexer { + return lexer.NewLexerBytes(src) +} + +func NewLexerString(src string) *lexer.Lexer { + return lexer.NewLexerBytes([]byte(src)) +} + +func NewLexerFile(fpath string) (*lexer.Lexer, error) { + return lexer.NewLexerFile(fpath) +} + +func NewLexer(reader io.Reader) (*lexer.Lexer, error) { + return lexer.NewLexer(reader) +} + +func GetTokenMap() TokenMap { + return token.TokMap +} diff --git a/example/calc/calc.grammar/calc/iface/calc.go b/example/calc/calc.grammar/calc/iface/calc.go new file mode 100644 index 00000000..6a75ee1a --- /dev/null +++ b/example/calc/calc.grammar/calc/iface/calc.go @@ -0,0 +1,49 @@ +// Code generated by gocc; DO NOT EDIT. + +package iface + +import ( + "github.com/maxcalandrelli/gocc/example/calc/calc.grammar/calc/internal/errors" + "github.com/maxcalandrelli/gocc/example/calc/calc.grammar/calc/internal/token" + "io" +) + +type ( + Token = token.Token + TokenMap = token.TokenMap + Pos = token.Pos + ErrorSymbol = errors.ErrorSymbol + Error = errors.Error + + Scanner interface { + Scan() (tok *Token) + } + + StreamScanner interface { + GetStream() TokenStream + } + + CheckPoint interface { + DistanceFrom(CheckPoint) int + } + + CheckPointable interface { + GetCheckPoint() CheckPoint + GotoCheckPoint(CheckPoint) + } + + TokenStream interface { + io.Reader + io.RuneScanner + io.Seeker + } +) + +const ( + INVALID = token.INVALID + EOF = token.EOF +) + +func GetTokenMap() TokenMap { + return token.TokMap +} diff --git a/example/calc/calc.grammar/calc/internal/errors/errors.go b/example/calc/calc.grammar/calc/internal/errors/errors.go new file mode 100644 index 00000000..169169ed --- /dev/null +++ b/example/calc/calc.grammar/calc/internal/errors/errors.go @@ -0,0 +1,56 @@ +// Code generated by gocc; DO NOT EDIT. + +package errors + +import ( + "fmt" + "strings" + + "github.com/maxcalandrelli/gocc/example/calc/calc.grammar/calc/internal/token" +) + +type ErrorSymbol interface { +} + +type Error struct { + Err error + ErrorToken *token.Token + ErrorSymbols []ErrorSymbol + ExpectedTokens []string + StackTop int +} + +func (e *Error) String() string { + w := new(strings.Builder) + fmt.Fprintf(w, "Error") + if e.Err != nil { + fmt.Fprintf(w, " %s\n", e.Err) + } else { + fmt.Fprintf(w, "\n") + } + fmt.Fprintf(w, "Token: type=%d, lit=%s\n", e.ErrorToken.Type, e.ErrorToken.Lit) + fmt.Fprintf(w, "Pos: offset=%d, line=%d, column=%d\n", e.ErrorToken.Pos.Offset, e.ErrorToken.Pos.Line, e.ErrorToken.Pos.Column) + fmt.Fprintf(w, "Expected one of: ") + for _, sym := range e.ExpectedTokens { + fmt.Fprintf(w, "%s ", sym) + } + fmt.Fprintf(w, "ErrorSymbol:\n") + for _, sym := range e.ErrorSymbols { + fmt.Fprintf(w, "%v\n", sym) + } + return w.String() +} + +func (e *Error) Error() string { + w := new(strings.Builder) + fmt.Fprintf(w, "Error in S%d: %s, %s", e.StackTop, token.TokMap.TokenString(e.ErrorToken), e.ErrorToken.Pos.String()) + if e.Err != nil { + fmt.Fprintf(w, ": %+v", e.Err) + } else { + fmt.Fprintf(w, ", expected one of: ") + for _, expected := range e.ExpectedTokens { + fmt.Fprintf(w, "%s ", expected) + } + } + return w.String() +} diff --git a/example/calc/internal/io/stream/internal/stream_impl.go b/example/calc/calc.grammar/calc/internal/io/stream/internal/stream_impl.go similarity index 100% rename from example/calc/internal/io/stream/internal/stream_impl.go rename to example/calc/calc.grammar/calc/internal/io/stream/internal/stream_impl.go diff --git a/example/calc/internal/io/stream/internal/stream_public.go b/example/calc/calc.grammar/calc/internal/io/stream/internal/stream_public.go similarity index 100% rename from example/calc/internal/io/stream/internal/stream_public.go rename to example/calc/calc.grammar/calc/internal/io/stream/internal/stream_public.go diff --git a/example/calc/calc.grammar/calc/internal/io/stream/stream.go b/example/calc/calc.grammar/calc/internal/io/stream/stream.go new file mode 100644 index 00000000..7ac9fc98 --- /dev/null +++ b/example/calc/calc.grammar/calc/internal/io/stream/stream.go @@ -0,0 +1,39 @@ +package stream + +import ( + internal "github.com/maxcalandrelli/gocc/example/calc/calc.grammar/calc/internal/io/stream/internal" + "io" +) + +type ( + WindowReader interface { + BlockSize() int + Buffered() int + Cap() int + MaxCap() int + Read([]byte) (int, error) + ReadByte() (byte, error) + ReadPosition() int64 + ReadRune() (rune, int, error) + Seek(int64, int) (int64, error) + UnreadByte() error + UnreadRune() error + MaxUnreadSize() int + } +) + +var ( + InfoPrefixRoundUp = false +) + +func NewWindowReaderFromBytes(src []byte) WindowReader { + return internal.NewWindowReader(src, nil, 0, 0, InfoPrefixRoundUp) +} + +func NewWindowReader(rdr io.Reader) WindowReader { + return internal.NewWindowReader(nil, rdr, 0, 0, false) +} + +func NewLimitedWindowReader(rdr io.Reader, sizeMin, sizeMax int) WindowReader { + return internal.NewWindowReader(nil, rdr, sizeMin, sizeMax, InfoPrefixRoundUp) +} diff --git a/example/calc/internal/lexer/acttab.go b/example/calc/calc.grammar/calc/internal/lexer/acttab.go similarity index 91% rename from example/calc/internal/lexer/acttab.go rename to example/calc/calc.grammar/calc/internal/lexer/acttab.go index 58aa3971..cbd91e61 100644 --- a/example/calc/internal/lexer/acttab.go +++ b/example/calc/calc.grammar/calc/internal/lexer/acttab.go @@ -5,7 +5,7 @@ package lexer import ( "fmt" - "github.com/maxcalandrelli/gocc/example/calc/internal/token" + "github.com/maxcalandrelli/gocc/example/calc/calc.grammar/calc/internal/token" ) type ActionTable [NumStates]ActionRow diff --git a/example/calc/internal/lexer/lexer.go b/example/calc/calc.grammar/calc/internal/lexer/lexer.go similarity index 71% rename from example/calc/internal/lexer/lexer.go rename to example/calc/calc.grammar/calc/internal/lexer/lexer.go index 922767db..681db6f0 100644 --- a/example/calc/internal/lexer/lexer.go +++ b/example/calc/calc.grammar/calc/internal/lexer/lexer.go @@ -9,9 +9,9 @@ import ( "os" - "github.com/maxcalandrelli/gocc/example/calc/iface" - "github.com/maxcalandrelli/gocc/example/calc/internal/token" - "github.com/maxcalandrelli/gocc/example/calc/internal/io/stream" + "github.com/maxcalandrelli/gocc/example/calc/calc.grammar/calc/iface" + "github.com/maxcalandrelli/gocc/example/calc/calc.grammar/calc/internal/token" + "github.com/maxcalandrelli/gocc/example/calc/calc.grammar/calc/internal/io/stream" ) const ( @@ -37,6 +37,10 @@ func NewLexerBytes(src []byte) *Lexer { return lexer } +func NewLexerString(src string) *Lexer { + return NewLexerBytes([]byte(src)) +} + func NewLexerFile(fpath string) (*Lexer, error) { s, err := os.Open(fpath) if err != nil { @@ -66,11 +70,18 @@ func (l Lexer) GetStream() iface.TokenStream { type checkPoint int64 +func (c checkPoint) value () int64 { + return int64(c) +} + func (c checkPoint) DistanceFrom (o iface.CheckPoint) int { - return int (c - o.(checkPoint)) + return int (c.value() - o.(checkPoint).value()) } -func (l Lexer) GetCheckPoint() iface.CheckPoint { +func (l *Lexer) GetCheckPoint() iface.CheckPoint { + if l == nil { + return checkPoint(0) + } pos, _ := l.stream.Seek(0, io.SeekCurrent) return checkPoint(pos) } @@ -99,17 +110,17 @@ func (l *Lexer) Scan() (tok *token.Token) { } state = nextState if state != -1 { - switch curr { - case '\n': - l.position.Pos.Line++ - l.position.Pos.Column = 1 - case '\r': - l.position.Pos.Column = 1 - case '\t': - l.position.Pos.Column += 4 - default: - l.position.Pos.Column++ - } + switch curr { + case '\n': + l.position.Pos.Line++ + l.position.Pos.Column = 1 + case '\r': + l.position.Pos.Column = 1 + case '\t': + l.position.Pos.Column += 4 + default: + l.position.Pos.Column++ + } switch { case ActTab[state].Accept != -1: tok.Type = ActTab[state].Accept @@ -119,8 +130,12 @@ func (l *Lexer) Scan() (tok *token.Token) { state = 0 tok.Lit = []byte{} } - } else if curr != INVALID_RUNE { - l.stream.UnreadRune() + } else if curr != INVALID_RUNE{ + if len(tok.Lit) == 0 { + tok.Lit = append(tok.Lit, string(curr)...) + } else { + l.stream.UnreadRune() + } } if err == io.EOF && len(tok.Lit)==0 { tok.Type = token.EOF diff --git a/example/calc/internal/lexer/transitiontable.go b/example/calc/calc.grammar/calc/internal/lexer/transitiontable.go similarity index 100% rename from example/calc/internal/lexer/transitiontable.go rename to example/calc/calc.grammar/calc/internal/lexer/transitiontable.go diff --git a/example/bools/internal/parser/action.go b/example/calc/calc.grammar/calc/internal/parser/action.go similarity index 100% rename from example/bools/internal/parser/action.go rename to example/calc/calc.grammar/calc/internal/parser/action.go diff --git a/example/calc/internal/parser/actiontable.go b/example/calc/calc.grammar/calc/internal/parser/actiontable.go similarity index 100% rename from example/calc/internal/parser/actiontable.go rename to example/calc/calc.grammar/calc/internal/parser/actiontable.go diff --git a/example/calc/internal/parser/gototable.go b/example/calc/calc.grammar/calc/internal/parser/gototable.go similarity index 100% rename from example/calc/internal/parser/gototable.go rename to example/calc/calc.grammar/calc/internal/parser/gototable.go diff --git a/example/calc/internal/parser/parser.go b/example/calc/calc.grammar/calc/internal/parser/parser.go similarity index 85% rename from example/calc/internal/parser/parser.go rename to example/calc/calc.grammar/calc/internal/parser/parser.go index 8491041e..33441494 100644 --- a/example/calc/internal/parser/parser.go +++ b/example/calc/calc.grammar/calc/internal/parser/parser.go @@ -7,9 +7,9 @@ import ( "fmt" "strings" - "github.com/maxcalandrelli/gocc/example/calc/iface" - parseError "github.com/maxcalandrelli/gocc/example/calc/internal/errors" - "github.com/maxcalandrelli/gocc/example/calc/internal/token" + "github.com/maxcalandrelli/gocc/example/calc/calc.grammar/calc/iface" + parseError "github.com/maxcalandrelli/gocc/example/calc/calc.grammar/calc/internal/errors" + "github.com/maxcalandrelli/gocc/example/calc/calc.grammar/calc/internal/token" ) const ( @@ -95,7 +95,21 @@ type Parser struct { userContext interface{} } -type TokenStream = iface.TokenStream +type ( + TokenStream = iface.TokenStream + fakeCp struct{} + fakeCheckPointable struct{} +) + +func (f fakeCheckPointable) GetCheckPoint() iface.CheckPoint { + return fakeCp{} +} + +func (f fakeCheckPointable) GotoCheckPoint(iface.CheckPoint) {} + +func (f fakeCp) DistanceFrom(o iface.CheckPoint) int { + return 0 +} func NewParser() *Parser { return NewParserWithContext(nil) @@ -112,6 +126,15 @@ func (p *Parser) Reset() { p.stack.push(0, nil) } +func (p *Parser) SetContext(ctx interface{}) *Parser { + p.userContext = ctx + return p +} + +func (p Parser) GetContext() interface{} { + return p.userContext +} + func (p *Parser) Error(err error, scanner iface.Scanner) (recovered bool, errorAttrib *parseError.Error) { errorAttrib = &parseError.Error{ Err: err, @@ -125,7 +148,7 @@ func (p *Parser) Error(err error, scanner iface.Scanner) (recovered bool, errorA } } - if action := parserActions.table[p.stack.top()].actions[token.TokMap.Type("error")]; action != nil { + if action := parserActions.table[p.stack.top()].actions[token.TokMap.Type("λ")]; action != nil { p.stack.push(int(action.(shift)), errorAttrib) // action can only be shift } else { return @@ -202,7 +225,9 @@ func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, er if tokens == nil && (len(parserActions.table[p.stack.top()].cdActions) > 0 || longest) { return errNotRepositionable } - checkPoint = tokens.GetCheckPoint() + if longest { + checkPoint = tokens.GetCheckPoint() + } p.nextToken = scanner.Scan() if longest { afterPos = tokens.GetCheckPoint() @@ -210,20 +235,26 @@ func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, er return nil } p.Reset() - tokens, _ = scanner.(iface.CheckPointable) + if tokens, _ = scanner.(iface.CheckPointable); tokens == nil { + tokens = fakeCheckPointable{} + } + underlyingStream := TokenStream(nil) + if streamScanner, _ := scanner.(iface.StreamScanner); streamScanner != nil { + underlyingStream = streamScanner.GetStream() + } startCp := tokens.GetCheckPoint() if err := readNextToken(); err != nil { return nil, err, tokens.GetCheckPoint().DistanceFrom(startCp) } for acc := false; !acc; { action := parserActions.table[p.stack.top()].actions[p.nextToken.Type] - if action == nil { + if action == nil && underlyingStream != nil && len(parserActions.table[p.stack.top()].cdActions) > 0 { // // If no action, check if we have some context dependent parsing to try // for _, cdAction := range parserActions.table[p.stack.top()].cdActions { tokens.GotoCheckPoint(checkPoint) - cd_res, cd_err, cd_parsed := cdAction.tokenScanner(scanner.GetStream(), p.userContext) + cd_res, cd_err, cd_parsed := cdAction.tokenScanner(underlyingStream, p.userContext) if cd_err == nil && len(cd_parsed) > 0 { action = parserActions.table[p.stack.top()].actions[cdAction.tokenIndex] if action != nil { diff --git a/example/calc/internal/parser/productionstable.go b/example/calc/calc.grammar/calc/internal/parser/productionstable.go similarity index 93% rename from example/calc/internal/parser/productionstable.go rename to example/calc/calc.grammar/calc/internal/parser/productionstable.go index 0793b676..20f534a1 100644 --- a/example/calc/internal/parser/productionstable.go +++ b/example/calc/calc.grammar/calc/internal/parser/productionstable.go @@ -3,8 +3,8 @@ package parser import ( - "github.com/maxcalandrelli/gocc/example/calc/token" - "github.com/maxcalandrelli/gocc/example/calc/util" + "github.com/maxcalandrelli/gocc/example/calc/calc.grammar/calc/internal/token" + "github.com/maxcalandrelli/gocc/example/calc/calc.grammar/calc/internal/util" ) type ( diff --git a/example/calc/internal/token/token.go b/example/calc/calc.grammar/calc/internal/token/token.go similarity index 93% rename from example/calc/internal/token/token.go rename to example/calc/calc.grammar/calc/internal/token/token.go index 1554717a..de95ccf2 100644 --- a/example/calc/internal/token/token.go +++ b/example/calc/calc.grammar/calc/internal/token/token.go @@ -48,6 +48,7 @@ func (p Pos) StartingFrom(base Pos) Pos { type TokenMap struct { typeMap []string idMap map[string]Type + litMap map[string]Type } func (m TokenMap) Id(tok Type) string { @@ -92,4 +93,11 @@ var TokMap = TokenMap{ "Λ<)>": 5, "int64": 6, }, + + litMap: map[string]Type{ + "+": 2, + "*": 3, + "(": 4, + ")": 5, + }, } diff --git a/example/bools/internal/util/litconv.go b/example/calc/calc.grammar/calc/internal/util/litconv.go similarity index 100% rename from example/bools/internal/util/litconv.go rename to example/calc/calc.grammar/calc/internal/util/litconv.go diff --git a/example/bools/internal/util/rune.go b/example/calc/calc.grammar/calc/internal/util/rune.go similarity index 100% rename from example/bools/internal/util/rune.go rename to example/calc/calc.grammar/calc/internal/util/rune.go diff --git a/example/calc/main/main.go b/example/calc/calc.grammar/calc/main/main.go similarity index 93% rename from example/calc/main/main.go rename to example/calc/calc.grammar/calc/main/main.go index 1d135453..b5befd80 100644 --- a/example/calc/main/main.go +++ b/example/calc/calc.grammar/calc/main/main.go @@ -6,7 +6,7 @@ import ( "os" "strings" - calc "github.com/maxcalandrelli/gocc/example/calc" + calc "github.com/maxcalandrelli/gocc/example/calc/calc.grammar/calc" ) func showResult(r interface{}, e error, l int) { diff --git a/example/calc/calc_test.go b/example/calc/calc_test.go index 13c5eb6c..a7239ec8 100644 --- a/example/calc/calc_test.go +++ b/example/calc/calc_test.go @@ -3,8 +3,7 @@ package calc import ( "testing" - "github.com/maxcalandrelli/gocc/example/calc/lexer" - "github.com/maxcalandrelli/gocc/example/calc/parser" + "github.com/maxcalandrelli/gocc/example/calc/calc.grammar/calc" ) type TI struct { @@ -19,10 +18,10 @@ var testData = []*TI{ } func Test1(t *testing.T) { - p := parser.NewParser() + p := calc.NewParser() for _, ts := range testData { - s := lexer.NewLexer([]byte(ts.src)) - sum, err := p.Parse(s) + s := calc.NewLexerString(ts.src) + sum, err, _ := p.Parse(s) if err != nil { t.Error(err) } diff --git a/example/calc/errors/errors.go b/example/calc/errors/errors.go deleted file mode 100644 index 4ade5796..00000000 --- a/example/calc/errors/errors.go +++ /dev/null @@ -1,56 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package errors - -import ( - "fmt" - "strings" - - "github.com/maxcalandrelli/gocc/example/calc/token" -) - -type ErrorSymbol interface { -} - -type Error struct { - Err error - ErrorToken *token.Token - ErrorSymbols []ErrorSymbol - ExpectedTokens []string - StackTop int -} - -func (e *Error) String() string { - w := new(strings.Builder) - fmt.Fprintf(w, "Error") - if e.Err != nil { - fmt.Fprintf(w, " %s\n", e.Err) - } else { - fmt.Fprintf(w, "\n") - } - fmt.Fprintf(w, "Token: type=%d, lit=%s\n", e.ErrorToken.Type, e.ErrorToken.Lit) - fmt.Fprintf(w, "Pos: offset=%d, line=%d, column=%d\n", e.ErrorToken.Pos.Offset, e.ErrorToken.Pos.Line, e.ErrorToken.Pos.Column) - fmt.Fprintf(w, "Expected one of: ") - for _, sym := range e.ExpectedTokens { - fmt.Fprintf(w, "%s ", sym) - } - fmt.Fprintf(w, "ErrorSymbol:\n") - for _, sym := range e.ErrorSymbols { - fmt.Fprintf(w, "%v\n", sym) - } - return w.String() -} - -func (e *Error) Error() string { - w := new(strings.Builder) - fmt.Fprintf(w, "Error in S%d: %s, %s", e.StackTop, token.TokMap.TokenString(e.ErrorToken), e.ErrorToken.Pos.String()) - if e.Err != nil { - fmt.Fprintf(w, ": %+v", e.Err) - } else { - fmt.Fprintf(w, ", expected one of: ") - for _, expected := range e.ExpectedTokens { - fmt.Fprintf(w, "%s ", expected) - } - } - return w.String() -} diff --git a/example/calc/iface/iface.go b/example/calc/iface/iface.go deleted file mode 100644 index 1ad96ebe..00000000 --- a/example/calc/iface/iface.go +++ /dev/null @@ -1,30 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package iface - -import ( - "github.com/maxcalandrelli/gocc/example/calc/internal/token" - "io" -) - -type ( - Scanner interface { - Scan() (tok *token.Token) - GetStream() TokenStream - } - - CheckPoint interface { - DistanceFrom(CheckPoint) int - } - - CheckPointable interface { - GetCheckPoint() CheckPoint - GotoCheckPoint(CheckPoint) - } - - TokenStream interface { - io.Reader - io.RuneScanner - io.Seeker - } -) diff --git a/example/calc/internal/errors/errors.go b/example/calc/internal/errors/errors.go deleted file mode 100644 index 39b5229d..00000000 --- a/example/calc/internal/errors/errors.go +++ /dev/null @@ -1,56 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package errors - -import ( - "fmt" - "strings" - - "github.com/maxcalandrelli/gocc/example/calc/internal/token" -) - -type ErrorSymbol interface { -} - -type Error struct { - Err error - ErrorToken *token.Token - ErrorSymbols []ErrorSymbol - ExpectedTokens []string - StackTop int -} - -func (e *Error) String() string { - w := new(strings.Builder) - fmt.Fprintf(w, "Error") - if e.Err != nil { - fmt.Fprintf(w, " %s\n", e.Err) - } else { - fmt.Fprintf(w, "\n") - } - fmt.Fprintf(w, "Token: type=%d, lit=%s\n", e.ErrorToken.Type, e.ErrorToken.Lit) - fmt.Fprintf(w, "Pos: offset=%d, line=%d, column=%d\n", e.ErrorToken.Pos.Offset, e.ErrorToken.Pos.Line, e.ErrorToken.Pos.Column) - fmt.Fprintf(w, "Expected one of: ") - for _, sym := range e.ExpectedTokens { - fmt.Fprintf(w, "%s ", sym) - } - fmt.Fprintf(w, "ErrorSymbol:\n") - for _, sym := range e.ErrorSymbols { - fmt.Fprintf(w, "%v\n", sym) - } - return w.String() -} - -func (e *Error) Error() string { - w := new(strings.Builder) - fmt.Fprintf(w, "Error in S%d: %s, %s", e.StackTop, token.TokMap.TokenString(e.ErrorToken), e.ErrorToken.Pos.String()) - if e.Err != nil { - fmt.Fprintf(w, ": %+v", e.Err) - } else { - fmt.Fprintf(w, ", expected one of: ") - for _, expected := range e.ExpectedTokens { - fmt.Fprintf(w, "%s ", expected) - } - } - return w.String() -} diff --git a/example/calc/lexer/acttab.go b/example/calc/lexer/acttab.go deleted file mode 100644 index 67a021e4..00000000 --- a/example/calc/lexer/acttab.go +++ /dev/null @@ -1,55 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package lexer - -import ( - "fmt" - - "github.com/maxcalandrelli/gocc/example/calc/token" -) - -type ActionTable [NumStates]ActionRow - -type ActionRow struct { - Accept token.Type - Ignore string -} - -func (a ActionRow) String() string { - return fmt.Sprintf("Accept=%d, Ignore=%s", a.Accept, a.Ignore) -} - -var ActTab = ActionTable{ - ActionRow{ // S0 - Accept: 0, - Ignore: "", - }, - ActionRow{ // S1 - Accept: -1, - Ignore: "!whitespace", - }, - ActionRow{ // S2 - Accept: 4, - Ignore: "", - }, - ActionRow{ // S3 - Accept: 5, - Ignore: "", - }, - ActionRow{ // S4 - Accept: 3, - Ignore: "", - }, - ActionRow{ // S5 - Accept: 2, - Ignore: "", - }, - ActionRow{ // S6 - Accept: 6, - Ignore: "", - }, - ActionRow{ // S7 - Accept: 6, - Ignore: "", - }, -} diff --git a/example/calc/lexer/lexer.go b/example/calc/lexer/lexer.go deleted file mode 100644 index 51ec617d..00000000 --- a/example/calc/lexer/lexer.go +++ /dev/null @@ -1,127 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package lexer - -import ( - "io/ioutil" - "unicode/utf8" - - "github.com/maxcalandrelli/gocc/example/calc/token" -) - -const ( - NoState = -1 - NumStates = 8 - NumSymbols = 11 -) - -type Lexer struct { - src []byte - pos int - line int - column int -} - -func NewLexer(src []byte) *Lexer { - lexer := &Lexer{ - src: src, - pos: 0, - line: 1, - column: 1, - } - return lexer -} - -func NewLexerFile(fpath string) (*Lexer, error) { - src, err := ioutil.ReadFile(fpath) - if err != nil { - return nil, err - } - return NewLexer(src), nil -} - -func (l *Lexer) Scan() (tok *token.Token) { - tok = new(token.Token) - if l.pos >= len(l.src) { - tok.Type = token.EOF - tok.Pos.Offset, tok.Pos.Line, tok.Pos.Column = l.pos, l.line, l.column - return - } - start, startLine, startColumn, end := l.pos, l.line, l.column, 0 - tok.Type = token.INVALID - state, rune1, size := 0, rune(-1), 0 - for state != -1 { - if l.pos >= len(l.src) { - rune1 = -1 - } else { - rune1, size = utf8.DecodeRune(l.src[l.pos:]) - l.pos += size - } - - nextState := -1 - if rune1 != -1 { - nextState = TransTab[state](rune1) - } - state = nextState - - if state != -1 { - - switch rune1 { - case '\n': - l.line++ - l.column = 1 - case '\r': - l.column = 1 - case '\t': - l.column += 4 - default: - l.column++ - } - - switch { - case ActTab[state].Accept != -1: - tok.Type = ActTab[state].Accept - end = l.pos - case ActTab[state].Ignore != "": - start, startLine, startColumn = l.pos, l.line, l.column - state = 0 - if start >= len(l.src) { - tok.Type = token.EOF - } - - } - } else { - if tok.Type == token.INVALID { - end = l.pos - } - } - } - if end > start { - l.pos = end - tok.Lit = l.src[start:end] - } else { - tok.Lit = []byte{} - } - tok.Pos.Offset, tok.Pos.Line, tok.Pos.Column = start, startLine, startColumn - - return -} - -func (l *Lexer) Reset() { - l.pos = 0 -} - -/* -Lexer symbols: -0: '+' -1: '*' -2: '(' -3: ')' -4: ' ' -5: '\t' -6: '\n' -7: '\r' -8: '1'-'9' -9: '0'-'9' -10: . -*/ diff --git a/example/calc/lexer/transitiontable.go b/example/calc/lexer/transitiontable.go deleted file mode 100644 index 9edc0aec..00000000 --- a/example/calc/lexer/transitiontable.go +++ /dev/null @@ -1,83 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package lexer - -/* -Let s be the current state -Let r be the current input rune -transitionTable[s](r) returns the next state. -*/ -type TransitionTable [NumStates]func(rune) int - -var TransTab = TransitionTable{ - // S0 - func(r rune) int { - switch { - case r == 9: // ['\t','\t'] - return 1 - case r == 10: // ['\n','\n'] - return 1 - case r == 13: // ['\r','\r'] - return 1 - case r == 32: // [' ',' '] - return 1 - case r == 40: // ['(','('] - return 2 - case r == 41: // [')',')'] - return 3 - case r == 42: // ['*','*'] - return 4 - case r == 43: // ['+','+'] - return 5 - case 49 <= r && r <= 57: // ['1','9'] - return 6 - } - return NoState - }, - // S1 - func(r rune) int { - switch { - } - return NoState - }, - // S2 - func(r rune) int { - switch { - } - return NoState - }, - // S3 - func(r rune) int { - switch { - } - return NoState - }, - // S4 - func(r rune) int { - switch { - } - return NoState - }, - // S5 - func(r rune) int { - switch { - } - return NoState - }, - // S6 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 7 - } - return NoState - }, - // S7 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 7 - } - return NoState - }, -} diff --git a/example/calc/parser/actiontable.go b/example/calc/parser/actiontable.go deleted file mode 100644 index 190f9dd6..00000000 --- a/example/calc/parser/actiontable.go +++ /dev/null @@ -1,290 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package parser - -type ( - actionTable [numStates]actionRow - actionRow struct { - canRecover bool - actions [numSymbols]action - } -) - -var actionTab = actionTable{ - actionRow{ // S0 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - nil, // $ - nil, // + - nil, // * - shift(5), // ( - nil, // ) - shift(6), // int64 - }, - }, - actionRow{ // S1 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - accept(true), // $ - nil, // + - nil, // * - nil, // ( - nil, // ) - nil, // int64 - }, - }, - actionRow{ // S2 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - reduce(1), // $, reduce: Calc - shift(7), // + - nil, // * - nil, // ( - nil, // ) - nil, // int64 - }, - }, - actionRow{ // S3 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - reduce(3), // $, reduce: Expr - reduce(3), // +, reduce: Expr - shift(8), // * - nil, // ( - nil, // ) - nil, // int64 - }, - }, - actionRow{ // S4 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - reduce(5), // $, reduce: Term - reduce(5), // +, reduce: Term - reduce(5), // *, reduce: Term - nil, // ( - nil, // ) - nil, // int64 - }, - }, - actionRow{ // S5 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - nil, // $ - nil, // + - nil, // * - shift(12), // ( - nil, // ) - shift(13), // int64 - }, - }, - actionRow{ // S6 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - reduce(7), // $, reduce: Factor - reduce(7), // +, reduce: Factor - reduce(7), // *, reduce: Factor - nil, // ( - nil, // ) - nil, // int64 - }, - }, - actionRow{ // S7 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - nil, // $ - nil, // + - nil, // * - shift(5), // ( - nil, // ) - shift(6), // int64 - }, - }, - actionRow{ // S8 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - nil, // $ - nil, // + - nil, // * - shift(5), // ( - nil, // ) - shift(6), // int64 - }, - }, - actionRow{ // S9 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - nil, // $ - shift(16), // + - nil, // * - nil, // ( - shift(17), // ) - nil, // int64 - }, - }, - actionRow{ // S10 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - nil, // $ - reduce(3), // +, reduce: Expr - shift(18), // * - nil, // ( - reduce(3), // ), reduce: Expr - nil, // int64 - }, - }, - actionRow{ // S11 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - nil, // $ - reduce(5), // +, reduce: Term - reduce(5), // *, reduce: Term - nil, // ( - reduce(5), // ), reduce: Term - nil, // int64 - }, - }, - actionRow{ // S12 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - nil, // $ - nil, // + - nil, // * - shift(12), // ( - nil, // ) - shift(13), // int64 - }, - }, - actionRow{ // S13 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - nil, // $ - reduce(7), // +, reduce: Factor - reduce(7), // *, reduce: Factor - nil, // ( - reduce(7), // ), reduce: Factor - nil, // int64 - }, - }, - actionRow{ // S14 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - reduce(2), // $, reduce: Expr - reduce(2), // +, reduce: Expr - shift(8), // * - nil, // ( - nil, // ) - nil, // int64 - }, - }, - actionRow{ // S15 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - reduce(4), // $, reduce: Term - reduce(4), // +, reduce: Term - reduce(4), // *, reduce: Term - nil, // ( - nil, // ) - nil, // int64 - }, - }, - actionRow{ // S16 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - nil, // $ - nil, // + - nil, // * - shift(12), // ( - nil, // ) - shift(13), // int64 - }, - }, - actionRow{ // S17 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - reduce(6), // $, reduce: Factor - reduce(6), // +, reduce: Factor - reduce(6), // *, reduce: Factor - nil, // ( - nil, // ) - nil, // int64 - }, - }, - actionRow{ // S18 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - nil, // $ - nil, // + - nil, // * - shift(12), // ( - nil, // ) - shift(13), // int64 - }, - }, - actionRow{ // S19 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - nil, // $ - shift(16), // + - nil, // * - nil, // ( - shift(22), // ) - nil, // int64 - }, - }, - actionRow{ // S20 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - nil, // $ - reduce(2), // +, reduce: Expr - shift(18), // * - nil, // ( - reduce(2), // ), reduce: Expr - nil, // int64 - }, - }, - actionRow{ // S21 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - nil, // $ - reduce(4), // +, reduce: Term - reduce(4), // *, reduce: Term - nil, // ( - reduce(4), // ), reduce: Term - nil, // int64 - }, - }, - actionRow{ // S22 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - nil, // $ - reduce(6), // +, reduce: Factor - reduce(6), // *, reduce: Factor - nil, // ( - reduce(6), // ), reduce: Factor - nil, // int64 - }, - }, -} diff --git a/example/calc/parser/gototable.go b/example/calc/parser/gototable.go deleted file mode 100644 index 8c87d854..00000000 --- a/example/calc/parser/gototable.go +++ /dev/null @@ -1,174 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package parser - -const numNTSymbols = 5 - -type ( - gotoTable [numStates]gotoRow - gotoRow [numNTSymbols]int -) - -var gotoTab = gotoTable{ - gotoRow{ // S0 - -1, // S' - 1, // Calc - 2, // Expr - 3, // Term - 4, // Factor - }, - gotoRow{ // S1 - -1, // S' - -1, // Calc - -1, // Expr - -1, // Term - -1, // Factor - }, - gotoRow{ // S2 - -1, // S' - -1, // Calc - -1, // Expr - -1, // Term - -1, // Factor - }, - gotoRow{ // S3 - -1, // S' - -1, // Calc - -1, // Expr - -1, // Term - -1, // Factor - }, - gotoRow{ // S4 - -1, // S' - -1, // Calc - -1, // Expr - -1, // Term - -1, // Factor - }, - gotoRow{ // S5 - -1, // S' - -1, // Calc - 9, // Expr - 10, // Term - 11, // Factor - }, - gotoRow{ // S6 - -1, // S' - -1, // Calc - -1, // Expr - -1, // Term - -1, // Factor - }, - gotoRow{ // S7 - -1, // S' - -1, // Calc - -1, // Expr - 14, // Term - 4, // Factor - }, - gotoRow{ // S8 - -1, // S' - -1, // Calc - -1, // Expr - -1, // Term - 15, // Factor - }, - gotoRow{ // S9 - -1, // S' - -1, // Calc - -1, // Expr - -1, // Term - -1, // Factor - }, - gotoRow{ // S10 - -1, // S' - -1, // Calc - -1, // Expr - -1, // Term - -1, // Factor - }, - gotoRow{ // S11 - -1, // S' - -1, // Calc - -1, // Expr - -1, // Term - -1, // Factor - }, - gotoRow{ // S12 - -1, // S' - -1, // Calc - 19, // Expr - 10, // Term - 11, // Factor - }, - gotoRow{ // S13 - -1, // S' - -1, // Calc - -1, // Expr - -1, // Term - -1, // Factor - }, - gotoRow{ // S14 - -1, // S' - -1, // Calc - -1, // Expr - -1, // Term - -1, // Factor - }, - gotoRow{ // S15 - -1, // S' - -1, // Calc - -1, // Expr - -1, // Term - -1, // Factor - }, - gotoRow{ // S16 - -1, // S' - -1, // Calc - -1, // Expr - 20, // Term - 11, // Factor - }, - gotoRow{ // S17 - -1, // S' - -1, // Calc - -1, // Expr - -1, // Term - -1, // Factor - }, - gotoRow{ // S18 - -1, // S' - -1, // Calc - -1, // Expr - -1, // Term - 21, // Factor - }, - gotoRow{ // S19 - -1, // S' - -1, // Calc - -1, // Expr - -1, // Term - -1, // Factor - }, - gotoRow{ // S20 - -1, // S' - -1, // Calc - -1, // Expr - -1, // Term - -1, // Factor - }, - gotoRow{ // S21 - -1, // S' - -1, // Calc - -1, // Expr - -1, // Term - -1, // Factor - }, - gotoRow{ // S22 - -1, // S' - -1, // Calc - -1, // Expr - -1, // Term - -1, // Factor - }, -} diff --git a/example/calc/parser/parser.go b/example/calc/parser/parser.go deleted file mode 100644 index 96906ab5..00000000 --- a/example/calc/parser/parser.go +++ /dev/null @@ -1,216 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package parser - -import ( - "fmt" - "strings" - - parseError "github.com/maxcalandrelli/gocc/example/calc/errors" - "github.com/maxcalandrelli/gocc/example/calc/token" -) - -const ( - numProductions = 8 - numStates = 23 - numSymbols = 12 -) - -// Stack - -type stack struct { - state []int - attrib []Attrib -} - -const iNITIAL_STACK_SIZE = 100 - -func newStack() *stack { - return &stack{ - state: make([]int, 0, iNITIAL_STACK_SIZE), - attrib: make([]Attrib, 0, iNITIAL_STACK_SIZE), - } -} - -func (s *stack) reset() { - s.state = s.state[:0] - s.attrib = s.attrib[:0] -} - -func (s *stack) push(state int, a Attrib) { - s.state = append(s.state, state) - s.attrib = append(s.attrib, a) -} - -func (s *stack) top() int { - return s.state[len(s.state)-1] -} - -func (s *stack) peek(pos int) int { - return s.state[pos] -} - -func (s *stack) topIndex() int { - return len(s.state) - 1 -} - -func (s *stack) popN(items int) []Attrib { - lo, hi := len(s.state)-items, len(s.state) - - attrib := s.attrib[lo:hi] - - s.state = s.state[:lo] - s.attrib = s.attrib[:lo] - - return attrib -} - -func (s *stack) String() string { - w := new(strings.Builder) - fmt.Fprintf(w, "stack:\n") - for i, st := range s.state { - fmt.Fprintf(w, "\t%d: %d , ", i, st) - if s.attrib[i] == nil { - fmt.Fprintf(w, "nil") - } else { - switch attr := s.attrib[i].(type) { - case *token.Token: - fmt.Fprintf(w, "%s", attr.Lit) - default: - fmt.Fprintf(w, "%v", attr) - } - } - fmt.Fprintf(w, "\n") - } - return w.String() -} - -// Parser - -type Parser struct { - stack *stack - nextToken *token.Token - pos int -} - -type Scanner interface { - Scan() (tok *token.Token) -} - -func NewParser() *Parser { - p := &Parser{stack: newStack()} - p.Reset() - return p -} - -func (p *Parser) Reset() { - p.stack.reset() - p.stack.push(0, nil) -} - -func (p *Parser) Error(err error, scanner Scanner) (recovered bool, errorAttrib *parseError.Error) { - errorAttrib = &parseError.Error{ - Err: err, - ErrorToken: p.nextToken, - ErrorSymbols: p.popNonRecoveryStates(), - ExpectedTokens: make([]string, 0, 8), - } - for t, action := range actionTab[p.stack.top()].actions { - if action != nil { - errorAttrib.ExpectedTokens = append(errorAttrib.ExpectedTokens, token.TokMap.Id(token.Type(t))) - } - } - - if action := actionTab[p.stack.top()].actions[token.TokMap.Type("error")]; action != nil { - p.stack.push(int(action.(shift)), errorAttrib) // action can only be shift - } else { - return - } - - if action := actionTab[p.stack.top()].actions[p.nextToken.Type]; action != nil { - recovered = true - } - for !recovered && p.nextToken.Type != token.EOF { - p.nextToken = scanner.Scan() - if action := actionTab[p.stack.top()].actions[p.nextToken.Type]; action != nil { - recovered = true - } - } - - return -} - -func (p *Parser) popNonRecoveryStates() (removedAttribs []parseError.ErrorSymbol) { - if rs, ok := p.firstRecoveryState(); ok { - errorSymbols := p.stack.popN(p.stack.topIndex() - rs) - removedAttribs = make([]parseError.ErrorSymbol, len(errorSymbols)) - for i, e := range errorSymbols { - removedAttribs[i] = e - } - } else { - removedAttribs = []parseError.ErrorSymbol{} - } - return -} - -// recoveryState points to the highest state on the stack, which can recover -func (p *Parser) firstRecoveryState() (recoveryState int, canRecover bool) { - recoveryState, canRecover = p.stack.topIndex(), actionTab[p.stack.top()].canRecover - for recoveryState > 0 && !canRecover { - recoveryState-- - canRecover = actionTab[p.stack.peek(recoveryState)].canRecover - } - return -} - -func (p *Parser) newError(err error) error { - e := &parseError.Error{ - Err: err, - StackTop: p.stack.top(), - ErrorToken: p.nextToken, - } - actRow := actionTab[p.stack.top()] - for i, t := range actRow.actions { - if t != nil { - e.ExpectedTokens = append(e.ExpectedTokens, token.TokMap.Id(token.Type(i))) - } - } - return e -} - -func (p *Parser) Parse(scanner Scanner) (res interface{}, err error) { - p.Reset() - p.nextToken = scanner.Scan() - for acc := false; !acc; { - action := actionTab[p.stack.top()].actions[p.nextToken.Type] - if action == nil { - if recovered, errAttrib := p.Error(nil, scanner); !recovered { - p.nextToken = errAttrib.ErrorToken - return nil, p.newError(nil) - } - if action = actionTab[p.stack.top()].actions[p.nextToken.Type]; action == nil { - panic("Error recovery led to invalid action") - } - } - - switch act := action.(type) { - case accept: - res = p.stack.popN(1)[0] - acc = true - case shift: - p.stack.push(int(act), p.nextToken) - p.nextToken = scanner.Scan() - case reduce: - prod := productionsTable[int(act)] - attrib, err := prod.ReduceFunc(p.stack.popN(prod.NumSymbols)) - if err != nil { - return nil, p.newError(err) - } else { - p.stack.push(gotoTab[p.stack.top()][prod.NTType], attrib) - } - default: - panic("unknown action: " + action.String()) - } - } - return res, nil -} diff --git a/example/calc/parser/productionstable.go b/example/calc/parser/productionstable.go deleted file mode 100644 index 958958d3..00000000 --- a/example/calc/parser/productionstable.go +++ /dev/null @@ -1,106 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package parser - -import( - "github.com/maxcalandrelli/gocc/example/calc/token" - "github.com/maxcalandrelli/gocc/example/calc/util" -) - -type ( - //TODO: change type and variable names to be consistent with other tables - ProdTab [numProductions]ProdTabEntry - ProdTabEntry struct { - String string - Id string - NTType int - Index int - NumSymbols int - ReduceFunc func([]Attrib) (Attrib, error) - } - Attrib interface { - } -) - -var productionsTable = ProdTab{ - ProdTabEntry{ - String: `S' : Calc << >>`, - Id: "S'", - NTType: 0, - Index: 0, - NumSymbols: 1, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return X[0], nil - }, - }, - ProdTabEntry{ - String: `Calc : Expr << >>`, - Id: "Calc", - NTType: 1, - Index: 1, - NumSymbols: 1, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return X[0], nil - }, - }, - ProdTabEntry{ - String: `Expr : Expr "+" Term << X[0].(int64) + X[2].(int64), nil >>`, - Id: "Expr", - NTType: 2, - Index: 2, - NumSymbols: 3, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return X[0].(int64) + X[2].(int64), nil - }, - }, - ProdTabEntry{ - String: `Expr : Term << >>`, - Id: "Expr", - NTType: 2, - Index: 3, - NumSymbols: 1, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return X[0], nil - }, - }, - ProdTabEntry{ - String: `Term : Term "*" Factor << X[0].(int64) * X[2].(int64), nil >>`, - Id: "Term", - NTType: 3, - Index: 4, - NumSymbols: 3, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return X[0].(int64) * X[2].(int64), nil - }, - }, - ProdTabEntry{ - String: `Term : Factor << >>`, - Id: "Term", - NTType: 3, - Index: 5, - NumSymbols: 1, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return X[0], nil - }, - }, - ProdTabEntry{ - String: `Factor : "(" Expr ")" << X[1], nil >>`, - Id: "Factor", - NTType: 4, - Index: 6, - NumSymbols: 3, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return X[1], nil - }, - }, - ProdTabEntry{ - String: `Factor : int64 << util.IntValue(X[0].(*token.Token).Lit) >>`, - Id: "Factor", - NTType: 4, - Index: 7, - NumSymbols: 1, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return util.IntValue(X[0].(*token.Token).Lit) - }, - }, -} diff --git a/example/calc/token/token.go b/example/calc/token/token.go deleted file mode 100644 index 947cc338..00000000 --- a/example/calc/token/token.go +++ /dev/null @@ -1,80 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package token - -import ( - "fmt" -) - -type Token struct { - Type - Lit []byte - Pos -} - -type Type int - -const ( - INVALID Type = iota - EOF -) - -type Pos struct { - Offset int - Line int - Column int -} - -func (p Pos) String() string { - return fmt.Sprintf("Pos(offset=%d, line=%d, column=%d)", p.Offset, p.Line, p.Column) -} - -type TokenMap struct { - typeMap []string - idMap map[string]Type -} - -func (m TokenMap) Id(tok Type) string { - if int(tok) < len(m.typeMap) { - return m.typeMap[tok] - } - return "unknown" -} - -func (m TokenMap) Type(tok string) Type { - if typ, exist := m.idMap[tok]; exist { - return typ - } - return INVALID -} - -func (m TokenMap) TokenString(tok *Token) string { - //TODO: refactor to print pos & token string properly - return fmt.Sprintf("%s(%d,%s)", m.Id(tok.Type), tok.Type, tok.Lit) -} - -func (m TokenMap) StringType(typ Type) string { - return fmt.Sprintf("%s(%d)", m.Id(typ), typ) -} - -var TokMap = TokenMap{ - typeMap: []string{ - "INVALID", - "$", - "+", - "*", - "(", - ")", - "int64", - }, - - idMap: map[string]Type{ - "INVALID": 0, - "$": 1, - "+": 2, - "*": 3, - "(": 4, - ")": 5, - "int64": 6, - }, -} diff --git a/example/ctx/ast/ast.go b/example/ctx/ast/ast.go index 06ae99bf..1e7cffa0 100644 --- a/example/ctx/ast/ast.go +++ b/example/ctx/ast/ast.go @@ -3,9 +3,7 @@ package ast import ( "fmt" - calc_lexer "github.com/maxcalandrelli/gocc/example/calc/lexer" - calc_parser "github.com/maxcalandrelli/gocc/example/calc/parser" - "github.com/maxcalandrelli/gocc/example/ctx/token" + "github.com/maxcalandrelli/gocc/example/calc/calc.grammar/calc" ) type ( @@ -26,6 +24,6 @@ func NewStmt(stmtList interface{}) (Stmt, error) { } func Calc(verb interface{}) (Stmt, error) { - calc_parser.NewParser().Parse(calc_lexer.NewLexer()) + calc_parser.NewParser().Parse(calc.NewLexerString()) return fmt.Sprintf("%s ") } diff --git a/example/ctx/ctx.go b/example/ctx/ctx.go deleted file mode 100644 index 9df8ed71..00000000 --- a/example/ctx/ctx.go +++ /dev/null @@ -1,62 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package ctx - -import ( - "io" - - "github.com/maxcalandrelli/gocc/example/ctx/iface" - "github.com/maxcalandrelli/gocc/example/ctx/internal/io/stream" - "github.com/maxcalandrelli/gocc/example/ctx/internal/lexer" - "github.com/maxcalandrelli/gocc/example/ctx/internal/parser" - "github.com/maxcalandrelli/gocc/example/ctx/internal/token" -) - -type ( - Token = token.Token - Lexer = lexer.Lexer - Parser = parser.Parser - TokenStream = iface.TokenStream - WindowReader = stream.WindowReader - Scanner = iface.Scanner -) - -func ParseFile(fpath string) (interface{}, error, int) { - if lexer, err := NewLexerFile(fpath); err == nil { - return NewParser().Parse(lexer) - } else { - return nil, err, 0 - } -} - -func ParseText(text string) (interface{}, error, int) { - return NewParser().Parse(NewLexerBytes([]byte(text))) -} - -func NewLexerBytes(src []byte) *lexer.Lexer { - return lexer.NewLexerBytes(src) -} - -func NewLexerString(src string) *lexer.Lexer { - return lexer.NewLexerBytes([]byte(src)) -} - -func NewLexerFile(fpath string) (*lexer.Lexer, error) { - return lexer.NewLexerFile(fpath) -} - -func NewParser() *parser.Parser { - return parser.NewParser() -} - -func NewWindowReaderFromBytes(src []byte) WindowReader { - return stream.NewWindowReaderFromBytes(src) -} - -func NewWindowReader(rdr io.Reader) WindowReader { - return stream.NewWindowReader(rdr) -} - -func NewLimitedWindowReader(rdr io.Reader, sizeMin, sizeMax int) WindowReader { - return stream.NewLimitedWindowReader(rdr, sizeMin, sizeMax) -} diff --git a/example/ctx/ctx.grammar/ctx/grammar.go b/example/ctx/ctx.grammar/ctx/grammar.go new file mode 100644 index 00000000..f546ea17 --- /dev/null +++ b/example/ctx/ctx.grammar/ctx/grammar.go @@ -0,0 +1,131 @@ +// Code generated by gocc; DO NOT EDIT. + +package ctx + +import ( + "io" + + "github.com/maxcalandrelli/gocc/example/ctx/ctx.grammar/ctx/internal/errors" + "github.com/maxcalandrelli/gocc/example/ctx/ctx.grammar/ctx/internal/lexer" + "github.com/maxcalandrelli/gocc/example/ctx/ctx.grammar/ctx/internal/parser" + "github.com/maxcalandrelli/gocc/example/ctx/ctx.grammar/ctx/internal/token" +) + +const ( + INVALID = token.INVALID + EOF = token.EOF +) + +type ( + Token = token.Token + TokenMap = token.TokenMap + Pos = token.Pos + ErrorSymbol = errors.ErrorSymbol + Error = errors.Error + Lexer = lexer.Lexer + Parser = parser.Parser +) + +func NewParser() *parser.Parser { + return parser.NewParser() +} + +func ParseFile(fpath string) (interface{}, error, int) { + if lexer, err := NewLexerFile(fpath); err == nil { + return NewParser().Parse(lexer) + } else { + return nil, err, 0 + } +} + +func ParseText(text string, userData interface{}) (interface{}, error, int) { + return NewParser().Parse(NewLexerBytes([]byte(text))) +} + +func Parse(stream io.Reader) (interface{}, error, int) { + lex, err := NewLexer(stream) + if lex == nil { + return nil, err, 0 + } + return NewParser().Parse(lex) +} + +func ParseFileWithData(fpath string, userData interface{}) (interface{}, error, int) { + if lexer, err := NewLexerFile(fpath); err == nil { + return NewParser().SetContext(userData).Parse(lexer) + } else { + return nil, err, 0 + } +} + +func ParseStringWithData(text string, userData interface{}) (interface{}, error, int) { + return NewParser().SetContext(userData).Parse(NewLexerBytes([]byte(text))) +} + +func ParseWithData(stream io.Reader, userData interface{}) (interface{}, error, int) { + lex, err := NewLexer(stream) + if lex == nil { + return nil, err, 0 + } + return NewParser().SetContext(userData).Parse(lex) +} + +func ParseFilePartial(fpath string) (interface{}, error, int) { + if lexer, err := NewLexerFile(fpath); err == nil { + return NewParser().ParseLongestPrefix(lexer) + } else { + return nil, err, 0 + } +} + +func ParseTextPartial(text string, userData interface{}) (interface{}, error, int) { + return NewParser().ParseLongestPrefix(NewLexerBytes([]byte(text))) +} + +func ParsePartial(stream io.Reader) (interface{}, error, int) { + lex, err := NewLexer(stream) + if lex == nil { + return nil, err, 0 + } + return NewParser().ParseLongestPrefix(lex) +} + +func ParseFileWithDataPartial(fpath string, userData interface{}) (interface{}, error, int) { + if lexer, err := NewLexerFile(fpath); err == nil { + return NewParser().SetContext(userData).ParseLongestPrefix(lexer) + } else { + return nil, err, 0 + } +} + +func ParseStringWithDataPartial(text string, userData interface{}) (interface{}, error, int) { + return NewParser().SetContext(userData).ParseLongestPrefix(NewLexerBytes([]byte(text))) +} + +func ParseWithDataPartial(stream io.Reader, userData interface{}) (interface{}, error, int) { + lex, err := NewLexer(stream) + if lex == nil { + return nil, err, 0 + } + return NewParser().SetContext(userData).ParseLongestPrefix(lex) +} + +func NewLexerBytes(src []byte) *lexer.Lexer { + return lexer.NewLexerBytes(src) +} + +func NewLexerString(src string) *lexer.Lexer { + return lexer.NewLexerBytes([]byte(src)) +} + +func NewLexerFile(fpath string) (*lexer.Lexer, error) { + return lexer.NewLexerFile(fpath) +} + +func NewLexer(reader io.Reader) (*lexer.Lexer, error) { + return lexer.NewLexer(reader) +} + +func GetTokenMap() TokenMap { + return token.TokMap +} diff --git a/example/ctx/ctx.grammar/ctx/iface/ctx.go b/example/ctx/ctx.grammar/ctx/iface/ctx.go new file mode 100644 index 00000000..beb2a6ea --- /dev/null +++ b/example/ctx/ctx.grammar/ctx/iface/ctx.go @@ -0,0 +1,49 @@ +// Code generated by gocc; DO NOT EDIT. + +package iface + +import ( + "github.com/maxcalandrelli/gocc/example/ctx/ctx.grammar/ctx/internal/errors" + "github.com/maxcalandrelli/gocc/example/ctx/ctx.grammar/ctx/internal/token" + "io" +) + +type ( + Token = token.Token + TokenMap = token.TokenMap + Pos = token.Pos + ErrorSymbol = errors.ErrorSymbol + Error = errors.Error + + Scanner interface { + Scan() (tok *Token) + } + + StreamScanner interface { + GetStream() TokenStream + } + + CheckPoint interface { + DistanceFrom(CheckPoint) int + } + + CheckPointable interface { + GetCheckPoint() CheckPoint + GotoCheckPoint(CheckPoint) + } + + TokenStream interface { + io.Reader + io.RuneScanner + io.Seeker + } +) + +const ( + INVALID = token.INVALID + EOF = token.EOF +) + +func GetTokenMap() TokenMap { + return token.TokMap +} diff --git a/example/bools/errors/errors.go b/example/ctx/ctx.grammar/ctx/internal/errors/errors.go similarity index 94% rename from example/bools/errors/errors.go rename to example/ctx/ctx.grammar/ctx/internal/errors/errors.go index 5ddaa2db..ed3d3028 100644 --- a/example/bools/errors/errors.go +++ b/example/ctx/ctx.grammar/ctx/internal/errors/errors.go @@ -6,7 +6,7 @@ import ( "fmt" "strings" - "github.com/maxcalandrelli/gocc/example/bools/token" + "github.com/maxcalandrelli/gocc/example/ctx/ctx.grammar/ctx/internal/token" ) type ErrorSymbol interface { diff --git a/example/ctx/internal/io/stream/internal/stream_impl.go b/example/ctx/ctx.grammar/ctx/internal/io/stream/internal/stream_impl.go similarity index 100% rename from example/ctx/internal/io/stream/internal/stream_impl.go rename to example/ctx/ctx.grammar/ctx/internal/io/stream/internal/stream_impl.go diff --git a/example/ctx/internal/io/stream/internal/stream_public.go b/example/ctx/ctx.grammar/ctx/internal/io/stream/internal/stream_public.go similarity index 100% rename from example/ctx/internal/io/stream/internal/stream_public.go rename to example/ctx/ctx.grammar/ctx/internal/io/stream/internal/stream_public.go diff --git a/example/bools/internal/io/stream/stream.go b/example/ctx/ctx.grammar/ctx/internal/io/stream/stream.go similarity index 88% rename from example/bools/internal/io/stream/stream.go rename to example/ctx/ctx.grammar/ctx/internal/io/stream/stream.go index 9540add0..dde77a90 100644 --- a/example/bools/internal/io/stream/stream.go +++ b/example/ctx/ctx.grammar/ctx/internal/io/stream/stream.go @@ -1,7 +1,7 @@ package stream import ( - internal "github.com/maxcalandrelli/gocc/example/bools/internal/io/stream/internal" + internal "github.com/maxcalandrelli/gocc/example/ctx/ctx.grammar/ctx/internal/io/stream/internal" "io" ) diff --git a/example/ctx/internal/lexer/acttab.go b/example/ctx/ctx.grammar/ctx/internal/lexer/acttab.go similarity index 92% rename from example/ctx/internal/lexer/acttab.go rename to example/ctx/ctx.grammar/ctx/internal/lexer/acttab.go index c9966aa5..7b07780a 100644 --- a/example/ctx/internal/lexer/acttab.go +++ b/example/ctx/ctx.grammar/ctx/internal/lexer/acttab.go @@ -5,7 +5,7 @@ package lexer import ( "fmt" - "github.com/maxcalandrelli/gocc/example/ctx/internal/token" + "github.com/maxcalandrelli/gocc/example/ctx/ctx.grammar/ctx/internal/token" ) type ActionTable [NumStates]ActionRow diff --git a/example/ctx/internal/lexer/lexer.go b/example/ctx/ctx.grammar/ctx/internal/lexer/lexer.go similarity index 71% rename from example/ctx/internal/lexer/lexer.go rename to example/ctx/ctx.grammar/ctx/internal/lexer/lexer.go index f6c53a0f..ebb63906 100644 --- a/example/ctx/internal/lexer/lexer.go +++ b/example/ctx/ctx.grammar/ctx/internal/lexer/lexer.go @@ -9,9 +9,9 @@ import ( "os" - "github.com/maxcalandrelli/gocc/example/ctx/iface" - "github.com/maxcalandrelli/gocc/example/ctx/internal/token" - "github.com/maxcalandrelli/gocc/example/ctx/internal/io/stream" + "github.com/maxcalandrelli/gocc/example/ctx/ctx.grammar/ctx/iface" + "github.com/maxcalandrelli/gocc/example/ctx/ctx.grammar/ctx/internal/token" + "github.com/maxcalandrelli/gocc/example/ctx/ctx.grammar/ctx/internal/io/stream" ) const ( @@ -37,6 +37,10 @@ func NewLexerBytes(src []byte) *Lexer { return lexer } +func NewLexerString(src string) *Lexer { + return NewLexerBytes([]byte(src)) +} + func NewLexerFile(fpath string) (*Lexer, error) { s, err := os.Open(fpath) if err != nil { @@ -66,11 +70,18 @@ func (l Lexer) GetStream() iface.TokenStream { type checkPoint int64 +func (c checkPoint) value () int64 { + return int64(c) +} + func (c checkPoint) DistanceFrom (o iface.CheckPoint) int { - return int (c - o.(checkPoint)) + return int (c.value() - o.(checkPoint).value()) } -func (l Lexer) GetCheckPoint() iface.CheckPoint { +func (l *Lexer) GetCheckPoint() iface.CheckPoint { + if l == nil { + return checkPoint(0) + } pos, _ := l.stream.Seek(0, io.SeekCurrent) return checkPoint(pos) } @@ -99,17 +110,17 @@ func (l *Lexer) Scan() (tok *token.Token) { } state = nextState if state != -1 { - switch curr { - case '\n': - l.position.Pos.Line++ - l.position.Pos.Column = 1 - case '\r': - l.position.Pos.Column = 1 - case '\t': - l.position.Pos.Column += 4 - default: - l.position.Pos.Column++ - } + switch curr { + case '\n': + l.position.Pos.Line++ + l.position.Pos.Column = 1 + case '\r': + l.position.Pos.Column = 1 + case '\t': + l.position.Pos.Column += 4 + default: + l.position.Pos.Column++ + } switch { case ActTab[state].Accept != -1: tok.Type = ActTab[state].Accept @@ -119,8 +130,12 @@ func (l *Lexer) Scan() (tok *token.Token) { state = 0 tok.Lit = []byte{} } - } else if curr != INVALID_RUNE { - l.stream.UnreadRune() + } else if curr != INVALID_RUNE{ + if len(tok.Lit) == 0 { + tok.Lit = append(tok.Lit, string(curr)...) + } else { + l.stream.UnreadRune() + } } if err == io.EOF && len(tok.Lit)==0 { tok.Type = token.EOF diff --git a/example/ctx/internal/lexer/transitiontable.go b/example/ctx/ctx.grammar/ctx/internal/lexer/transitiontable.go similarity index 100% rename from example/ctx/internal/lexer/transitiontable.go rename to example/ctx/ctx.grammar/ctx/internal/lexer/transitiontable.go diff --git a/example/bools/parser/action.go b/example/ctx/ctx.grammar/ctx/internal/parser/action.go similarity index 100% rename from example/bools/parser/action.go rename to example/ctx/ctx.grammar/ctx/internal/parser/action.go diff --git a/example/ctx/internal/parser/actiontable.go b/example/ctx/ctx.grammar/ctx/internal/parser/actiontable.go similarity index 100% rename from example/ctx/internal/parser/actiontable.go rename to example/ctx/ctx.grammar/ctx/internal/parser/actiontable.go diff --git a/example/ctx/internal/parser/gototable.go b/example/ctx/ctx.grammar/ctx/internal/parser/gototable.go similarity index 100% rename from example/ctx/internal/parser/gototable.go rename to example/ctx/ctx.grammar/ctx/internal/parser/gototable.go diff --git a/example/ctx/internal/parser/parser.go b/example/ctx/ctx.grammar/ctx/internal/parser/parser.go similarity index 85% rename from example/ctx/internal/parser/parser.go rename to example/ctx/ctx.grammar/ctx/internal/parser/parser.go index 4c5da4db..33db025a 100644 --- a/example/ctx/internal/parser/parser.go +++ b/example/ctx/ctx.grammar/ctx/internal/parser/parser.go @@ -7,9 +7,9 @@ import ( "fmt" "strings" - "github.com/maxcalandrelli/gocc/example/ctx/iface" - parseError "github.com/maxcalandrelli/gocc/example/ctx/internal/errors" - "github.com/maxcalandrelli/gocc/example/ctx/internal/token" + "github.com/maxcalandrelli/gocc/example/ctx/ctx.grammar/ctx/iface" + parseError "github.com/maxcalandrelli/gocc/example/ctx/ctx.grammar/ctx/internal/errors" + "github.com/maxcalandrelli/gocc/example/ctx/ctx.grammar/ctx/internal/token" ) const ( @@ -95,7 +95,21 @@ type Parser struct { userContext interface{} } -type TokenStream = iface.TokenStream +type ( + TokenStream = iface.TokenStream + fakeCp struct{} + fakeCheckPointable struct{} +) + +func (f fakeCheckPointable) GetCheckPoint() iface.CheckPoint { + return fakeCp{} +} + +func (f fakeCheckPointable) GotoCheckPoint(iface.CheckPoint) {} + +func (f fakeCp) DistanceFrom(o iface.CheckPoint) int { + return 0 +} func NewParser() *Parser { return NewParserWithContext(nil) @@ -112,6 +126,15 @@ func (p *Parser) Reset() { p.stack.push(0, nil) } +func (p *Parser) SetContext(ctx interface{}) *Parser { + p.userContext = ctx + return p +} + +func (p Parser) GetContext() interface{} { + return p.userContext +} + func (p *Parser) Error(err error, scanner iface.Scanner) (recovered bool, errorAttrib *parseError.Error) { errorAttrib = &parseError.Error{ Err: err, @@ -125,7 +148,7 @@ func (p *Parser) Error(err error, scanner iface.Scanner) (recovered bool, errorA } } - if action := parserActions.table[p.stack.top()].actions[token.TokMap.Type("error")]; action != nil { + if action := parserActions.table[p.stack.top()].actions[token.TokMap.Type("λ")]; action != nil { p.stack.push(int(action.(shift)), errorAttrib) // action can only be shift } else { return @@ -202,7 +225,9 @@ func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, er if tokens == nil && (len(parserActions.table[p.stack.top()].cdActions) > 0 || longest) { return errNotRepositionable } - checkPoint = tokens.GetCheckPoint() + if longest { + checkPoint = tokens.GetCheckPoint() + } p.nextToken = scanner.Scan() if longest { afterPos = tokens.GetCheckPoint() @@ -210,20 +235,26 @@ func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, er return nil } p.Reset() - tokens, _ = scanner.(iface.CheckPointable) + if tokens, _ = scanner.(iface.CheckPointable); tokens == nil { + tokens = fakeCheckPointable{} + } + underlyingStream := TokenStream(nil) + if streamScanner, _ := scanner.(iface.StreamScanner); streamScanner != nil { + underlyingStream = streamScanner.GetStream() + } startCp := tokens.GetCheckPoint() if err := readNextToken(); err != nil { return nil, err, tokens.GetCheckPoint().DistanceFrom(startCp) } for acc := false; !acc; { action := parserActions.table[p.stack.top()].actions[p.nextToken.Type] - if action == nil { + if action == nil && underlyingStream != nil && len(parserActions.table[p.stack.top()].cdActions) > 0 { // // If no action, check if we have some context dependent parsing to try // for _, cdAction := range parserActions.table[p.stack.top()].cdActions { tokens.GotoCheckPoint(checkPoint) - cd_res, cd_err, cd_parsed := cdAction.tokenScanner(scanner.GetStream(), p.userContext) + cd_res, cd_err, cd_parsed := cdAction.tokenScanner(underlyingStream, p.userContext) if cd_err == nil && len(cd_parsed) > 0 { action = parserActions.table[p.stack.top()].actions[cdAction.tokenIndex] if action != nil { diff --git a/example/ctx/internal/parser/productionstable.go b/example/ctx/ctx.grammar/ctx/internal/parser/productionstable.go similarity index 100% rename from example/ctx/internal/parser/productionstable.go rename to example/ctx/ctx.grammar/ctx/internal/parser/productionstable.go diff --git a/example/ctx/internal/token/token.go b/example/ctx/ctx.grammar/ctx/internal/token/token.go similarity index 95% rename from example/ctx/internal/token/token.go rename to example/ctx/ctx.grammar/ctx/internal/token/token.go index ff662bb5..15be3f53 100644 --- a/example/ctx/internal/token/token.go +++ b/example/ctx/ctx.grammar/ctx/internal/token/token.go @@ -48,6 +48,7 @@ func (p Pos) StartingFrom(base Pos) Pos { type TokenMap struct { typeMap []string idMap map[string]Type + litMap map[string]Type } func (m TokenMap) Id(tok Type) string { @@ -86,4 +87,8 @@ var TokMap = TokenMap{ "id": 2, "Λ": 3, }, + + litMap: map[string]Type{ + "calc": 3, + }, } diff --git a/example/bools/util/litconv.go b/example/ctx/ctx.grammar/ctx/internal/util/litconv.go similarity index 100% rename from example/bools/util/litconv.go rename to example/ctx/ctx.grammar/ctx/internal/util/litconv.go diff --git a/example/bools/util/rune.go b/example/ctx/ctx.grammar/ctx/internal/util/rune.go similarity index 100% rename from example/bools/util/rune.go rename to example/ctx/ctx.grammar/ctx/internal/util/rune.go diff --git a/example/ctx/main/main.go b/example/ctx/ctx.grammar/ctx/main/main.go similarity index 94% rename from example/ctx/main/main.go rename to example/ctx/ctx.grammar/ctx/main/main.go index 71222e72..5ba66677 100644 --- a/example/ctx/main/main.go +++ b/example/ctx/ctx.grammar/ctx/main/main.go @@ -6,7 +6,7 @@ import ( "os" "strings" - ctx "github.com/maxcalandrelli/gocc/example/ctx" + ctx "github.com/maxcalandrelli/gocc/example/ctx/ctx.grammar/ctx" ) func showResult(r interface{}, e error, l int) { diff --git a/example/ctx/errors/errors.go b/example/ctx/errors/errors.go deleted file mode 100644 index 2813cd3b..00000000 --- a/example/ctx/errors/errors.go +++ /dev/null @@ -1,56 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package errors - -import ( - "fmt" - "strings" - - "github.com/maxcalandrelli/gocc/example/ctx/token" -) - -type ErrorSymbol interface { -} - -type Error struct { - Err error - ErrorToken *token.Token - ErrorSymbols []ErrorSymbol - ExpectedTokens []string - StackTop int -} - -func (e *Error) String() string { - w := new(strings.Builder) - fmt.Fprintf(w, "Error") - if e.Err != nil { - fmt.Fprintf(w, " %s\n", e.Err) - } else { - fmt.Fprintf(w, "\n") - } - fmt.Fprintf(w, "Token: type=%d, lit=%s\n", e.ErrorToken.Type, e.ErrorToken.Lit) - fmt.Fprintf(w, "Pos: offset=%d, line=%d, column=%d\n", e.ErrorToken.Pos.Offset, e.ErrorToken.Pos.Line, e.ErrorToken.Pos.Column) - fmt.Fprintf(w, "Expected one of: ") - for _, sym := range e.ExpectedTokens { - fmt.Fprintf(w, "%s ", sym) - } - fmt.Fprintf(w, "ErrorSymbol:\n") - for _, sym := range e.ErrorSymbols { - fmt.Fprintf(w, "%v\n", sym) - } - return w.String() -} - -func (e *Error) Error() string { - w := new(strings.Builder) - fmt.Fprintf(w, "Error in S%d: %s, %s", e.StackTop, token.TokMap.TokenString(e.ErrorToken), e.ErrorToken.Pos.String()) - if e.Err != nil { - fmt.Fprintf(w, ": %+v", e.Err) - } else { - fmt.Fprintf(w, ", expected one of: ") - for _, expected := range e.ExpectedTokens { - fmt.Fprintf(w, "%s ", expected) - } - } - return w.String() -} diff --git a/example/ctx/iface/iface.go b/example/ctx/iface/iface.go deleted file mode 100644 index 3d301025..00000000 --- a/example/ctx/iface/iface.go +++ /dev/null @@ -1,30 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package iface - -import ( - "github.com/maxcalandrelli/gocc/example/ctx/internal/token" - "io" -) - -type ( - Scanner interface { - Scan() (tok *token.Token) - GetStream() TokenStream - } - - CheckPoint interface { - DistanceFrom(CheckPoint) int - } - - CheckPointable interface { - GetCheckPoint() CheckPoint - GotoCheckPoint(CheckPoint) - } - - TokenStream interface { - io.Reader - io.RuneScanner - io.Seeker - } -) diff --git a/example/ctx/internal/errors/errors.go b/example/ctx/internal/errors/errors.go deleted file mode 100644 index 409cc47e..00000000 --- a/example/ctx/internal/errors/errors.go +++ /dev/null @@ -1,56 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package errors - -import ( - "fmt" - "strings" - - "github.com/maxcalandrelli/gocc/example/ctx/internal/token" -) - -type ErrorSymbol interface { -} - -type Error struct { - Err error - ErrorToken *token.Token - ErrorSymbols []ErrorSymbol - ExpectedTokens []string - StackTop int -} - -func (e *Error) String() string { - w := new(strings.Builder) - fmt.Fprintf(w, "Error") - if e.Err != nil { - fmt.Fprintf(w, " %s\n", e.Err) - } else { - fmt.Fprintf(w, "\n") - } - fmt.Fprintf(w, "Token: type=%d, lit=%s\n", e.ErrorToken.Type, e.ErrorToken.Lit) - fmt.Fprintf(w, "Pos: offset=%d, line=%d, column=%d\n", e.ErrorToken.Pos.Offset, e.ErrorToken.Pos.Line, e.ErrorToken.Pos.Column) - fmt.Fprintf(w, "Expected one of: ") - for _, sym := range e.ExpectedTokens { - fmt.Fprintf(w, "%s ", sym) - } - fmt.Fprintf(w, "ErrorSymbol:\n") - for _, sym := range e.ErrorSymbols { - fmt.Fprintf(w, "%v\n", sym) - } - return w.String() -} - -func (e *Error) Error() string { - w := new(strings.Builder) - fmt.Fprintf(w, "Error in S%d: %s, %s", e.StackTop, token.TokMap.TokenString(e.ErrorToken), e.ErrorToken.Pos.String()) - if e.Err != nil { - fmt.Fprintf(w, ": %+v", e.Err) - } else { - fmt.Fprintf(w, ", expected one of: ") - for _, expected := range e.ExpectedTokens { - fmt.Fprintf(w, "%s ", expected) - } - } - return w.String() -} diff --git a/example/ctx/lexer/acttab.go b/example/ctx/lexer/acttab.go deleted file mode 100644 index b5ae1a0f..00000000 --- a/example/ctx/lexer/acttab.go +++ /dev/null @@ -1,67 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package lexer - -import ( - "fmt" - - "github.com/maxcalandrelli/gocc/example/ctx/token" -) - -type ActionTable [NumStates]ActionRow - -type ActionRow struct { - Accept token.Type - Ignore string -} - -func (a ActionRow) String() string { - return fmt.Sprintf("Accept=%d, Ignore=%s", a.Accept, a.Ignore) -} - -var ActTab = ActionTable{ - ActionRow{ // S0 - Accept: 0, - Ignore: "", - }, - ActionRow{ // S1 - Accept: -1, - Ignore: "!whitespace", - }, - ActionRow{ // S2 - Accept: 2, - Ignore: "", - }, - ActionRow{ // S3 - Accept: 2, - Ignore: "", - }, - ActionRow{ // S4 - Accept: 2, - Ignore: "", - }, - ActionRow{ // S5 - Accept: 2, - Ignore: "", - }, - ActionRow{ // S6 - Accept: 2, - Ignore: "", - }, - ActionRow{ // S7 - Accept: 2, - Ignore: "", - }, - ActionRow{ // S8 - Accept: 2, - Ignore: "", - }, - ActionRow{ // S9 - Accept: 2, - Ignore: "", - }, - ActionRow{ // S10 - Accept: 3, - Ignore: "", - }, -} diff --git a/example/ctx/lexer/lexer.go b/example/ctx/lexer/lexer.go deleted file mode 100644 index b50c20d4..00000000 --- a/example/ctx/lexer/lexer.go +++ /dev/null @@ -1,130 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package lexer - -import ( - "io/ioutil" - "unicode/utf8" - - "github.com/maxcalandrelli/gocc/example/ctx/token" -) - -const ( - NoState = -1 - NumStates = 11 - NumSymbols = 14 -) - -type Lexer struct { - src []byte - pos int - line int - column int -} - -func NewLexer(src []byte) *Lexer { - lexer := &Lexer{ - src: src, - pos: 0, - line: 1, - column: 1, - } - return lexer -} - -func NewLexerFile(fpath string) (*Lexer, error) { - src, err := ioutil.ReadFile(fpath) - if err != nil { - return nil, err - } - return NewLexer(src), nil -} - -func (l *Lexer) Scan() (tok *token.Token) { - tok = new(token.Token) - if l.pos >= len(l.src) { - tok.Type = token.EOF - tok.Pos.Offset, tok.Pos.Line, tok.Pos.Column = l.pos, l.line, l.column - return - } - start, startLine, startColumn, end := l.pos, l.line, l.column, 0 - tok.Type = token.INVALID - state, rune1, size := 0, rune(-1), 0 - for state != -1 { - if l.pos >= len(l.src) { - rune1 = -1 - } else { - rune1, size = utf8.DecodeRune(l.src[l.pos:]) - l.pos += size - } - - nextState := -1 - if rune1 != -1 { - nextState = TransTab[state](rune1) - } - state = nextState - - if state != -1 { - - switch rune1 { - case '\n': - l.line++ - l.column = 1 - case '\r': - l.column = 1 - case '\t': - l.column += 4 - default: - l.column++ - } - - switch { - case ActTab[state].Accept != -1: - tok.Type = ActTab[state].Accept - end = l.pos - case ActTab[state].Ignore != "": - start, startLine, startColumn = l.pos, l.line, l.column - state = 0 - if start >= len(l.src) { - tok.Type = token.EOF - } - - } - } else { - if tok.Type == token.INVALID { - end = l.pos - } - } - } - if end > start { - l.pos = end - tok.Lit = l.src[start:end] - } else { - tok.Lit = []byte{} - } - tok.Pos.Offset, tok.Pos.Line, tok.Pos.Column = start, startLine, startColumn - - return -} - -func (l *Lexer) Reset() { - l.pos = 0 -} - -/* -Lexer symbols: -0: '_' -1: 'c' -2: 'a' -3: 'l' -4: 'c' -5: '_' -6: ' ' -7: '\t' -8: '\n' -9: '\r' -10: 'a'-'z' -11: 'A'-'Z' -12: '0'-'9' -13: . -*/ diff --git a/example/ctx/lexer/transitiontable.go b/example/ctx/lexer/transitiontable.go deleted file mode 100644 index ae790a2c..00000000 --- a/example/ctx/lexer/transitiontable.go +++ /dev/null @@ -1,179 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package lexer - -/* -Let s be the current state -Let r be the current input rune -transitionTable[s](r) returns the next state. -*/ -type TransitionTable [NumStates]func(rune) int - -var TransTab = TransitionTable{ - // S0 - func(r rune) int { - switch { - case r == 9: // ['\t','\t'] - return 1 - case r == 10: // ['\n','\n'] - return 1 - case r == 13: // ['\r','\r'] - return 1 - case r == 32: // [' ',' '] - return 1 - case 65 <= r && r <= 90: // ['A','Z'] - return 2 - case r == 95: // ['_','_'] - return 3 - case 97 <= r && r <= 98: // ['a','b'] - return 2 - case r == 99: // ['c','c'] - return 4 - case 100 <= r && r <= 122: // ['d','z'] - return 2 - } - return NoState - }, - // S1 - func(r rune) int { - switch { - } - return NoState - }, - // S2 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 5 - case 65 <= r && r <= 90: // ['A','Z'] - return 6 - case r == 95: // ['_','_'] - return 7 - case 97 <= r && r <= 122: // ['a','z'] - return 6 - } - return NoState - }, - // S3 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 5 - case 65 <= r && r <= 90: // ['A','Z'] - return 6 - case r == 95: // ['_','_'] - return 7 - case 97 <= r && r <= 122: // ['a','z'] - return 6 - } - return NoState - }, - // S4 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 5 - case 65 <= r && r <= 90: // ['A','Z'] - return 6 - case r == 95: // ['_','_'] - return 7 - case r == 97: // ['a','a'] - return 8 - case 98 <= r && r <= 122: // ['b','z'] - return 6 - } - return NoState - }, - // S5 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 5 - case 65 <= r && r <= 90: // ['A','Z'] - return 6 - case r == 95: // ['_','_'] - return 7 - case 97 <= r && r <= 122: // ['a','z'] - return 6 - } - return NoState - }, - // S6 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 5 - case 65 <= r && r <= 90: // ['A','Z'] - return 6 - case r == 95: // ['_','_'] - return 7 - case 97 <= r && r <= 122: // ['a','z'] - return 6 - } - return NoState - }, - // S7 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 5 - case 65 <= r && r <= 90: // ['A','Z'] - return 6 - case r == 95: // ['_','_'] - return 7 - case 97 <= r && r <= 122: // ['a','z'] - return 6 - } - return NoState - }, - // S8 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 5 - case 65 <= r && r <= 90: // ['A','Z'] - return 6 - case r == 95: // ['_','_'] - return 7 - case 97 <= r && r <= 107: // ['a','k'] - return 6 - case r == 108: // ['l','l'] - return 9 - case 109 <= r && r <= 122: // ['m','z'] - return 6 - } - return NoState - }, - // S9 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 5 - case 65 <= r && r <= 90: // ['A','Z'] - return 6 - case r == 95: // ['_','_'] - return 7 - case 97 <= r && r <= 98: // ['a','b'] - return 6 - case r == 99: // ['c','c'] - return 10 - case 100 <= r && r <= 122: // ['d','z'] - return 6 - } - return NoState - }, - // S10 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 5 - case 65 <= r && r <= 90: // ['A','Z'] - return 6 - case r == 95: // ['_','_'] - return 7 - case 97 <= r && r <= 122: // ['a','z'] - return 6 - } - return NoState - }, -} diff --git a/example/ctx/parser/actiontable.go b/example/ctx/parser/actiontable.go deleted file mode 100644 index fb2b7b80..00000000 --- a/example/ctx/parser/actiontable.go +++ /dev/null @@ -1,68 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package parser - -type ( - actionTable [numStates]actionRow - actionRow struct { - canRecover bool - actions [numSymbols]action - } -) - -var actionTab = actionTable{ - actionRow{ // S0 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - nil, // $ - shift(3), // id - shift(4), // calc - }, - }, - actionRow{ // S1 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - accept(true), // $ - shift(3), // id - shift(4), // calc - }, - }, - actionRow{ // S2 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - reduce(1), // $, reduce: StmtList - reduce(1), // id, reduce: StmtList - reduce(1), // calc, reduce: StmtList - }, - }, - actionRow{ // S3 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - reduce(3), // $, reduce: Stmt - reduce(3), // id, reduce: Stmt - reduce(3), // calc, reduce: Stmt - }, - }, - actionRow{ // S4 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - reduce(4), // $, reduce: Stmt - reduce(4), // id, reduce: Stmt - reduce(4), // calc, reduce: Stmt - }, - }, - actionRow{ // S5 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - reduce(2), // $, reduce: StmtList - reduce(2), // id, reduce: StmtList - reduce(2), // calc, reduce: StmtList - }, - }, -} diff --git a/example/ctx/parser/gototable.go b/example/ctx/parser/gototable.go deleted file mode 100644 index 2b3a2108..00000000 --- a/example/ctx/parser/gototable.go +++ /dev/null @@ -1,43 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package parser - -const numNTSymbols = 3 - -type ( - gotoTable [numStates]gotoRow - gotoRow [numNTSymbols]int -) - -var gotoTab = gotoTable{ - gotoRow{ // S0 - -1, // S' - 1, // StmtList - 2, // Stmt - }, - gotoRow{ // S1 - -1, // S' - -1, // StmtList - 5, // Stmt - }, - gotoRow{ // S2 - -1, // S' - -1, // StmtList - -1, // Stmt - }, - gotoRow{ // S3 - -1, // S' - -1, // StmtList - -1, // Stmt - }, - gotoRow{ // S4 - -1, // S' - -1, // StmtList - -1, // Stmt - }, - gotoRow{ // S5 - -1, // S' - -1, // StmtList - -1, // Stmt - }, -} diff --git a/example/ctx/parser/parser.go b/example/ctx/parser/parser.go deleted file mode 100644 index 72353f50..00000000 --- a/example/ctx/parser/parser.go +++ /dev/null @@ -1,216 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package parser - -import ( - "fmt" - "strings" - - parseError "github.com/maxcalandrelli/gocc/example/ctx/errors" - "github.com/maxcalandrelli/gocc/example/ctx/token" -) - -const ( - numProductions = 5 - numStates = 6 - numSymbols = 7 -) - -// Stack - -type stack struct { - state []int - attrib []Attrib -} - -const iNITIAL_STACK_SIZE = 100 - -func newStack() *stack { - return &stack{ - state: make([]int, 0, iNITIAL_STACK_SIZE), - attrib: make([]Attrib, 0, iNITIAL_STACK_SIZE), - } -} - -func (s *stack) reset() { - s.state = s.state[:0] - s.attrib = s.attrib[:0] -} - -func (s *stack) push(state int, a Attrib) { - s.state = append(s.state, state) - s.attrib = append(s.attrib, a) -} - -func (s *stack) top() int { - return s.state[len(s.state)-1] -} - -func (s *stack) peek(pos int) int { - return s.state[pos] -} - -func (s *stack) topIndex() int { - return len(s.state) - 1 -} - -func (s *stack) popN(items int) []Attrib { - lo, hi := len(s.state)-items, len(s.state) - - attrib := s.attrib[lo:hi] - - s.state = s.state[:lo] - s.attrib = s.attrib[:lo] - - return attrib -} - -func (s *stack) String() string { - w := new(strings.Builder) - fmt.Fprintf(w, "stack:\n") - for i, st := range s.state { - fmt.Fprintf(w, "\t%d: %d , ", i, st) - if s.attrib[i] == nil { - fmt.Fprintf(w, "nil") - } else { - switch attr := s.attrib[i].(type) { - case *token.Token: - fmt.Fprintf(w, "%s", attr.Lit) - default: - fmt.Fprintf(w, "%v", attr) - } - } - fmt.Fprintf(w, "\n") - } - return w.String() -} - -// Parser - -type Parser struct { - stack *stack - nextToken *token.Token - pos int -} - -type Scanner interface { - Scan() (tok *token.Token) -} - -func NewParser() *Parser { - p := &Parser{stack: newStack()} - p.Reset() - return p -} - -func (p *Parser) Reset() { - p.stack.reset() - p.stack.push(0, nil) -} - -func (p *Parser) Error(err error, scanner Scanner) (recovered bool, errorAttrib *parseError.Error) { - errorAttrib = &parseError.Error{ - Err: err, - ErrorToken: p.nextToken, - ErrorSymbols: p.popNonRecoveryStates(), - ExpectedTokens: make([]string, 0, 8), - } - for t, action := range actionTab[p.stack.top()].actions { - if action != nil { - errorAttrib.ExpectedTokens = append(errorAttrib.ExpectedTokens, token.TokMap.Id(token.Type(t))) - } - } - - if action := actionTab[p.stack.top()].actions[token.TokMap.Type("error")]; action != nil { - p.stack.push(int(action.(shift)), errorAttrib) // action can only be shift - } else { - return - } - - if action := actionTab[p.stack.top()].actions[p.nextToken.Type]; action != nil { - recovered = true - } - for !recovered && p.nextToken.Type != token.EOF { - p.nextToken = scanner.Scan() - if action := actionTab[p.stack.top()].actions[p.nextToken.Type]; action != nil { - recovered = true - } - } - - return -} - -func (p *Parser) popNonRecoveryStates() (removedAttribs []parseError.ErrorSymbol) { - if rs, ok := p.firstRecoveryState(); ok { - errorSymbols := p.stack.popN(p.stack.topIndex() - rs) - removedAttribs = make([]parseError.ErrorSymbol, len(errorSymbols)) - for i, e := range errorSymbols { - removedAttribs[i] = e - } - } else { - removedAttribs = []parseError.ErrorSymbol{} - } - return -} - -// recoveryState points to the highest state on the stack, which can recover -func (p *Parser) firstRecoveryState() (recoveryState int, canRecover bool) { - recoveryState, canRecover = p.stack.topIndex(), actionTab[p.stack.top()].canRecover - for recoveryState > 0 && !canRecover { - recoveryState-- - canRecover = actionTab[p.stack.peek(recoveryState)].canRecover - } - return -} - -func (p *Parser) newError(err error) error { - e := &parseError.Error{ - Err: err, - StackTop: p.stack.top(), - ErrorToken: p.nextToken, - } - actRow := actionTab[p.stack.top()] - for i, t := range actRow.actions { - if t != nil { - e.ExpectedTokens = append(e.ExpectedTokens, token.TokMap.Id(token.Type(i))) - } - } - return e -} - -func (p *Parser) Parse(scanner Scanner) (res interface{}, err error) { - p.Reset() - p.nextToken = scanner.Scan() - for acc := false; !acc; { - action := actionTab[p.stack.top()].actions[p.nextToken.Type] - if action == nil { - if recovered, errAttrib := p.Error(nil, scanner); !recovered { - p.nextToken = errAttrib.ErrorToken - return nil, p.newError(nil) - } - if action = actionTab[p.stack.top()].actions[p.nextToken.Type]; action == nil { - panic("Error recovery led to invalid action") - } - } - - switch act := action.(type) { - case accept: - res = p.stack.popN(1)[0] - acc = true - case shift: - p.stack.push(int(act), p.nextToken) - p.nextToken = scanner.Scan() - case reduce: - prod := productionsTable[int(act)] - attrib, err := prod.ReduceFunc(p.stack.popN(prod.NumSymbols)) - if err != nil { - return nil, p.newError(err) - } else { - p.stack.push(gotoTab[p.stack.top()][prod.NTType], attrib) - } - default: - panic("unknown action: " + action.String()) - } - } - return res, nil -} diff --git a/example/ctx/parser/productionstable.go b/example/ctx/parser/productionstable.go deleted file mode 100644 index 653b4435..00000000 --- a/example/ctx/parser/productionstable.go +++ /dev/null @@ -1,76 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package parser - -import ( - "github.com/maxcalandrelli/gocc/example/ctx/ast" - "github.com/maxcalandrelli/gocc/example/ctx/ast" - ) - -type ( - //TODO: change type and variable names to be consistent with other tables - ProdTab [numProductions]ProdTabEntry - ProdTabEntry struct { - String string - Id string - NTType int - Index int - NumSymbols int - ReduceFunc func([]Attrib) (Attrib, error) - } - Attrib interface { - } -) - -var productionsTable = ProdTab{ - ProdTabEntry{ - String: `S' : StmtList << >>`, - Id: "S'", - NTType: 0, - Index: 0, - NumSymbols: 1, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return X[0], nil - }, - }, - ProdTabEntry{ - String: `StmtList : Stmt << ast.NewStmtList(X[0]) >>`, - Id: "StmtList", - NTType: 1, - Index: 1, - NumSymbols: 1, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return ast.NewStmtList(X[0]) - }, - }, - ProdTabEntry{ - String: `StmtList : StmtList Stmt << ast.AppendStmt(X[0], X[1]) >>`, - Id: "StmtList", - NTType: 1, - Index: 2, - NumSymbols: 2, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return ast.AppendStmt(X[0], X[1]) - }, - }, - ProdTabEntry{ - String: `Stmt : id << ast.NewStmt(X[0]) >>`, - Id: "Stmt", - NTType: 2, - Index: 3, - NumSymbols: 1, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return ast.NewStmt(X[0]) - }, - }, - ProdTabEntry{ - String: `Stmt : "calc" << ast.Calc(X[0]) >>`, - Id: "Stmt", - NTType: 2, - Index: 4, - NumSymbols: 1, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return ast.Calc(X[0]) - }, - }, -} diff --git a/example/ctx/token/token.go b/example/ctx/token/token.go deleted file mode 100644 index d190e977..00000000 --- a/example/ctx/token/token.go +++ /dev/null @@ -1,74 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package token - -import ( - "fmt" -) - -type Token struct { - Type - Lit []byte - Pos -} - -type Type int - -const ( - INVALID Type = iota - EOF -) - -type Pos struct { - Offset int - Line int - Column int -} - -func (p Pos) String() string { - return fmt.Sprintf("Pos(offset=%d, line=%d, column=%d)", p.Offset, p.Line, p.Column) -} - -type TokenMap struct { - typeMap []string - idMap map[string]Type -} - -func (m TokenMap) Id(tok Type) string { - if int(tok) < len(m.typeMap) { - return m.typeMap[tok] - } - return "unknown" -} - -func (m TokenMap) Type(tok string) Type { - if typ, exist := m.idMap[tok]; exist { - return typ - } - return INVALID -} - -func (m TokenMap) TokenString(tok *Token) string { - //TODO: refactor to print pos & token string properly - return fmt.Sprintf("%s(%d,%s)", m.Id(tok.Type), tok.Type, tok.Lit) -} - -func (m TokenMap) StringType(typ Type) string { - return fmt.Sprintf("%s(%d)", m.Id(typ), typ) -} - -var TokMap = TokenMap{ - typeMap: []string{ - "INVALID", - "$", - "id", - "calc", - }, - - idMap: map[string]Type{ - "INVALID": 0, - "$": 1, - "id": 2, - "calc": 3, - }, -} diff --git a/example/errorrecovery/ast/ast.go b/example/errorrecovery/ast/ast.go index d93fd66a..49fc98e9 100644 --- a/example/errorrecovery/ast/ast.go +++ b/example/errorrecovery/ast/ast.go @@ -1,7 +1,7 @@ package ast import ( - "github.com/maxcalandrelli/gocc/example/errorrecovery/token" + "github.com/maxcalandrelli/gocc/example/errorrecovery/er.grammar/er/iface" ) type ( @@ -18,5 +18,5 @@ func AppendStmt(stmtList, stmt interface{}) (StmtList, error) { } func NewStmt(stmtList interface{}) (Stmt, error) { - return Stmt(stmtList.(*token.Token).Lit), nil + return Stmt(stmtList.(*iface.Token).Lit), nil } diff --git a/example/errorrecovery/doc.go b/example/errorrecovery/doc.go index d42ebcab..861c091d 100644 --- a/example/errorrecovery/doc.go +++ b/example/errorrecovery/doc.go @@ -1 +1 @@ -package astx +package er diff --git a/example/errorrecovery/er.grammar/er/grammar.go b/example/errorrecovery/er.grammar/er/grammar.go new file mode 100644 index 00000000..b565b6b2 --- /dev/null +++ b/example/errorrecovery/er.grammar/er/grammar.go @@ -0,0 +1,131 @@ +// Code generated by gocc; DO NOT EDIT. + +package er + +import ( + "io" + + "github.com/maxcalandrelli/gocc/example/errorrecovery/er.grammar/er/internal/errors" + "github.com/maxcalandrelli/gocc/example/errorrecovery/er.grammar/er/internal/lexer" + "github.com/maxcalandrelli/gocc/example/errorrecovery/er.grammar/er/internal/parser" + "github.com/maxcalandrelli/gocc/example/errorrecovery/er.grammar/er/internal/token" +) + +const ( + INVALID = token.INVALID + EOF = token.EOF +) + +type ( + Token = token.Token + TokenMap = token.TokenMap + Pos = token.Pos + ErrorSymbol = errors.ErrorSymbol + Error = errors.Error + Lexer = lexer.Lexer + Parser = parser.Parser +) + +func NewParser() *parser.Parser { + return parser.NewParser() +} + +func ParseFile(fpath string) (interface{}, error, int) { + if lexer, err := NewLexerFile(fpath); err == nil { + return NewParser().Parse(lexer) + } else { + return nil, err, 0 + } +} + +func ParseText(text string, userData interface{}) (interface{}, error, int) { + return NewParser().Parse(NewLexerBytes([]byte(text))) +} + +func Parse(stream io.Reader) (interface{}, error, int) { + lex, err := NewLexer(stream) + if lex == nil { + return nil, err, 0 + } + return NewParser().Parse(lex) +} + +func ParseFileWithData(fpath string, userData interface{}) (interface{}, error, int) { + if lexer, err := NewLexerFile(fpath); err == nil { + return NewParser().SetContext(userData).Parse(lexer) + } else { + return nil, err, 0 + } +} + +func ParseStringWithData(text string, userData interface{}) (interface{}, error, int) { + return NewParser().SetContext(userData).Parse(NewLexerBytes([]byte(text))) +} + +func ParseWithData(stream io.Reader, userData interface{}) (interface{}, error, int) { + lex, err := NewLexer(stream) + if lex == nil { + return nil, err, 0 + } + return NewParser().SetContext(userData).Parse(lex) +} + +func ParseFilePartial(fpath string) (interface{}, error, int) { + if lexer, err := NewLexerFile(fpath); err == nil { + return NewParser().ParseLongestPrefix(lexer) + } else { + return nil, err, 0 + } +} + +func ParseTextPartial(text string, userData interface{}) (interface{}, error, int) { + return NewParser().ParseLongestPrefix(NewLexerBytes([]byte(text))) +} + +func ParsePartial(stream io.Reader) (interface{}, error, int) { + lex, err := NewLexer(stream) + if lex == nil { + return nil, err, 0 + } + return NewParser().ParseLongestPrefix(lex) +} + +func ParseFileWithDataPartial(fpath string, userData interface{}) (interface{}, error, int) { + if lexer, err := NewLexerFile(fpath); err == nil { + return NewParser().SetContext(userData).ParseLongestPrefix(lexer) + } else { + return nil, err, 0 + } +} + +func ParseStringWithDataPartial(text string, userData interface{}) (interface{}, error, int) { + return NewParser().SetContext(userData).ParseLongestPrefix(NewLexerBytes([]byte(text))) +} + +func ParseWithDataPartial(stream io.Reader, userData interface{}) (interface{}, error, int) { + lex, err := NewLexer(stream) + if lex == nil { + return nil, err, 0 + } + return NewParser().SetContext(userData).ParseLongestPrefix(lex) +} + +func NewLexerBytes(src []byte) *lexer.Lexer { + return lexer.NewLexerBytes(src) +} + +func NewLexerString(src string) *lexer.Lexer { + return lexer.NewLexerBytes([]byte(src)) +} + +func NewLexerFile(fpath string) (*lexer.Lexer, error) { + return lexer.NewLexerFile(fpath) +} + +func NewLexer(reader io.Reader) (*lexer.Lexer, error) { + return lexer.NewLexer(reader) +} + +func GetTokenMap() TokenMap { + return token.TokMap +} diff --git a/example/errorrecovery/er.grammar/er/iface/er.go b/example/errorrecovery/er.grammar/er/iface/er.go new file mode 100644 index 00000000..e4181d34 --- /dev/null +++ b/example/errorrecovery/er.grammar/er/iface/er.go @@ -0,0 +1,49 @@ +// Code generated by gocc; DO NOT EDIT. + +package iface + +import ( + "github.com/maxcalandrelli/gocc/example/errorrecovery/er.grammar/er/internal/errors" + "github.com/maxcalandrelli/gocc/example/errorrecovery/er.grammar/er/internal/token" + "io" +) + +type ( + Token = token.Token + TokenMap = token.TokenMap + Pos = token.Pos + ErrorSymbol = errors.ErrorSymbol + Error = errors.Error + + Scanner interface { + Scan() (tok *Token) + } + + StreamScanner interface { + GetStream() TokenStream + } + + CheckPoint interface { + DistanceFrom(CheckPoint) int + } + + CheckPointable interface { + GetCheckPoint() CheckPoint + GotoCheckPoint(CheckPoint) + } + + TokenStream interface { + io.Reader + io.RuneScanner + io.Seeker + } +) + +const ( + INVALID = token.INVALID + EOF = token.EOF +) + +func GetTokenMap() TokenMap { + return token.TokMap +} diff --git a/example/errorrecovery/er.grammar/er/internal/errors/errors.go b/example/errorrecovery/er.grammar/er/internal/errors/errors.go new file mode 100644 index 00000000..4f697864 --- /dev/null +++ b/example/errorrecovery/er.grammar/er/internal/errors/errors.go @@ -0,0 +1,56 @@ +// Code generated by gocc; DO NOT EDIT. + +package errors + +import ( + "fmt" + "strings" + + "github.com/maxcalandrelli/gocc/example/errorrecovery/er.grammar/er/internal/token" +) + +type ErrorSymbol interface { +} + +type Error struct { + Err error + ErrorToken *token.Token + ErrorSymbols []ErrorSymbol + ExpectedTokens []string + StackTop int +} + +func (e *Error) String() string { + w := new(strings.Builder) + fmt.Fprintf(w, "Error") + if e.Err != nil { + fmt.Fprintf(w, " %s\n", e.Err) + } else { + fmt.Fprintf(w, "\n") + } + fmt.Fprintf(w, "Token: type=%d, lit=%s\n", e.ErrorToken.Type, e.ErrorToken.Lit) + fmt.Fprintf(w, "Pos: offset=%d, line=%d, column=%d\n", e.ErrorToken.Pos.Offset, e.ErrorToken.Pos.Line, e.ErrorToken.Pos.Column) + fmt.Fprintf(w, "Expected one of: ") + for _, sym := range e.ExpectedTokens { + fmt.Fprintf(w, "%s ", sym) + } + fmt.Fprintf(w, "ErrorSymbol:\n") + for _, sym := range e.ErrorSymbols { + fmt.Fprintf(w, "%v\n", sym) + } + return w.String() +} + +func (e *Error) Error() string { + w := new(strings.Builder) + fmt.Fprintf(w, "Error in S%d: %s, %s", e.StackTop, token.TokMap.TokenString(e.ErrorToken), e.ErrorToken.Pos.String()) + if e.Err != nil { + fmt.Fprintf(w, ": %+v", e.Err) + } else { + fmt.Fprintf(w, ", expected one of: ") + for _, expected := range e.ExpectedTokens { + fmt.Fprintf(w, "%s ", expected) + } + } + return w.String() +} diff --git a/example/errorrecovery/internal/io/stream/internal/stream_impl.go b/example/errorrecovery/er.grammar/er/internal/io/stream/internal/stream_impl.go similarity index 100% rename from example/errorrecovery/internal/io/stream/internal/stream_impl.go rename to example/errorrecovery/er.grammar/er/internal/io/stream/internal/stream_impl.go diff --git a/example/errorrecovery/internal/io/stream/internal/stream_public.go b/example/errorrecovery/er.grammar/er/internal/io/stream/internal/stream_public.go similarity index 100% rename from example/errorrecovery/internal/io/stream/internal/stream_public.go rename to example/errorrecovery/er.grammar/er/internal/io/stream/internal/stream_public.go diff --git a/example/errorrecovery/internal/io/stream/stream.go b/example/errorrecovery/er.grammar/er/internal/io/stream/stream.go similarity index 95% rename from example/errorrecovery/internal/io/stream/stream.go rename to example/errorrecovery/er.grammar/er/internal/io/stream/stream.go index 5afc1043..cd9c46eb 100644 --- a/example/errorrecovery/internal/io/stream/stream.go +++ b/example/errorrecovery/er.grammar/er/internal/io/stream/stream.go @@ -1,7 +1,7 @@ package stream import ( - internal "github.com/maxcalandrelli/gocc/example/errorrecovery/internal/io/stream/internal" + internal "github.com/maxcalandrelli/gocc/example/errorrecovery/er.grammar/er/internal/io/stream/internal" "io" ) diff --git a/example/errorrecovery/internal/lexer/acttab.go b/example/errorrecovery/er.grammar/er/internal/lexer/acttab.go similarity index 89% rename from example/errorrecovery/internal/lexer/acttab.go rename to example/errorrecovery/er.grammar/er/internal/lexer/acttab.go index 6c1bd404..482f67a3 100644 --- a/example/errorrecovery/internal/lexer/acttab.go +++ b/example/errorrecovery/er.grammar/er/internal/lexer/acttab.go @@ -5,7 +5,7 @@ package lexer import ( "fmt" - "github.com/maxcalandrelli/gocc/example/errorrecovery/internal/token" + "github.com/maxcalandrelli/gocc/example/errorrecovery/er.grammar/er/internal/token" ) type ActionTable [NumStates]ActionRow diff --git a/example/errorrecovery/internal/lexer/lexer.go b/example/errorrecovery/er.grammar/er/internal/lexer/lexer.go similarity index 71% rename from example/errorrecovery/internal/lexer/lexer.go rename to example/errorrecovery/er.grammar/er/internal/lexer/lexer.go index 1afa07bb..347e3e25 100644 --- a/example/errorrecovery/internal/lexer/lexer.go +++ b/example/errorrecovery/er.grammar/er/internal/lexer/lexer.go @@ -9,9 +9,9 @@ import ( "os" - "github.com/maxcalandrelli/gocc/example/errorrecovery/iface" - "github.com/maxcalandrelli/gocc/example/errorrecovery/internal/token" - "github.com/maxcalandrelli/gocc/example/errorrecovery/internal/io/stream" + "github.com/maxcalandrelli/gocc/example/errorrecovery/er.grammar/er/iface" + "github.com/maxcalandrelli/gocc/example/errorrecovery/er.grammar/er/internal/token" + "github.com/maxcalandrelli/gocc/example/errorrecovery/er.grammar/er/internal/io/stream" ) const ( @@ -37,6 +37,10 @@ func NewLexerBytes(src []byte) *Lexer { return lexer } +func NewLexerString(src string) *Lexer { + return NewLexerBytes([]byte(src)) +} + func NewLexerFile(fpath string) (*Lexer, error) { s, err := os.Open(fpath) if err != nil { @@ -66,11 +70,18 @@ func (l Lexer) GetStream() iface.TokenStream { type checkPoint int64 +func (c checkPoint) value () int64 { + return int64(c) +} + func (c checkPoint) DistanceFrom (o iface.CheckPoint) int { - return int (c - o.(checkPoint)) + return int (c.value() - o.(checkPoint).value()) } -func (l Lexer) GetCheckPoint() iface.CheckPoint { +func (l *Lexer) GetCheckPoint() iface.CheckPoint { + if l == nil { + return checkPoint(0) + } pos, _ := l.stream.Seek(0, io.SeekCurrent) return checkPoint(pos) } @@ -99,17 +110,17 @@ func (l *Lexer) Scan() (tok *token.Token) { } state = nextState if state != -1 { - switch curr { - case '\n': - l.position.Pos.Line++ - l.position.Pos.Column = 1 - case '\r': - l.position.Pos.Column = 1 - case '\t': - l.position.Pos.Column += 4 - default: - l.position.Pos.Column++ - } + switch curr { + case '\n': + l.position.Pos.Line++ + l.position.Pos.Column = 1 + case '\r': + l.position.Pos.Column = 1 + case '\t': + l.position.Pos.Column += 4 + default: + l.position.Pos.Column++ + } switch { case ActTab[state].Accept != -1: tok.Type = ActTab[state].Accept @@ -119,8 +130,12 @@ func (l *Lexer) Scan() (tok *token.Token) { state = 0 tok.Lit = []byte{} } - } else if curr != INVALID_RUNE { - l.stream.UnreadRune() + } else if curr != INVALID_RUNE{ + if len(tok.Lit) == 0 { + tok.Lit = append(tok.Lit, string(curr)...) + } else { + l.stream.UnreadRune() + } } if err == io.EOF && len(tok.Lit)==0 { tok.Type = token.EOF diff --git a/example/astx/lexer/transitiontable.go b/example/errorrecovery/er.grammar/er/internal/lexer/transitiontable.go similarity index 100% rename from example/astx/lexer/transitiontable.go rename to example/errorrecovery/er.grammar/er/internal/lexer/transitiontable.go diff --git a/example/calc/internal/parser/action.go b/example/errorrecovery/er.grammar/er/internal/parser/action.go similarity index 100% rename from example/calc/internal/parser/action.go rename to example/errorrecovery/er.grammar/er/internal/parser/action.go diff --git a/example/errorrecovery/internal/parser/actiontable.go b/example/errorrecovery/er.grammar/er/internal/parser/actiontable.go similarity index 77% rename from example/errorrecovery/internal/parser/actiontable.go rename to example/errorrecovery/er.grammar/er/internal/parser/actiontable.go index cff78c91..b9defbbf 100644 --- a/example/errorrecovery/internal/parser/actiontable.go +++ b/example/errorrecovery/er.grammar/er/internal/parser/actiontable.go @@ -27,6 +27,7 @@ var parserActions = actions{ nil, // ά nil, // Ω shift(3), // id + shift(4), // error }, cdActions: []cdAction{}, }, @@ -36,6 +37,7 @@ var parserActions = actions{ nil, // ά accept(true), // Ω shift(3), // id + shift(4), // error }, cdActions: []cdAction{}, }, @@ -45,6 +47,7 @@ var parserActions = actions{ nil, // ά reduce(1), // Ω, reduce: StmtList reduce(1), // id, reduce: StmtList + reduce(1), // error, reduce: StmtList }, cdActions: []cdAction{}, }, @@ -54,15 +57,27 @@ var parserActions = actions{ nil, // ά reduce(3), // Ω, reduce: Stmt reduce(3), // id, reduce: Stmt + reduce(3), // error, reduce: Stmt }, cdActions: []cdAction{}, }, actionRow{ // S4 + canRecover: true, + actions: [numSymbols]action{ + nil, // ά + reduce(4), // Ω, reduce: Stmt + reduce(4), // id, reduce: Stmt + reduce(4), // error, reduce: Stmt + }, + cdActions: []cdAction{}, + }, + actionRow{ // S5 canRecover: false, actions: [numSymbols]action{ nil, // ά reduce(2), // Ω, reduce: StmtList reduce(2), // id, reduce: StmtList + reduce(2), // error, reduce: StmtList }, cdActions: []cdAction{}, }, diff --git a/example/errorrecovery/internal/parser/gototable.go b/example/errorrecovery/er.grammar/er/internal/parser/gototable.go similarity index 85% rename from example/errorrecovery/internal/parser/gototable.go rename to example/errorrecovery/er.grammar/er/internal/parser/gototable.go index 3fc118e2..443ec029 100644 --- a/example/errorrecovery/internal/parser/gototable.go +++ b/example/errorrecovery/er.grammar/er/internal/parser/gototable.go @@ -18,7 +18,7 @@ var gotoTab = gotoTable{ gotoRow{ // S1 -1, // Π -1, // Π - 4, // Π + 5, // Π }, gotoRow{ // S2 -1, // Π @@ -35,4 +35,9 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, + gotoRow{ // S5 + -1, // Π + -1, // Π + -1, // Π + }, } diff --git a/example/errorrecovery/internal/parser/parser.go b/example/errorrecovery/er.grammar/er/internal/parser/parser.go similarity index 85% rename from example/errorrecovery/internal/parser/parser.go rename to example/errorrecovery/er.grammar/er/internal/parser/parser.go index a6c0bc41..30ef15e3 100644 --- a/example/errorrecovery/internal/parser/parser.go +++ b/example/errorrecovery/er.grammar/er/internal/parser/parser.go @@ -7,15 +7,15 @@ import ( "fmt" "strings" - "github.com/maxcalandrelli/gocc/example/errorrecovery/iface" - parseError "github.com/maxcalandrelli/gocc/example/errorrecovery/internal/errors" - "github.com/maxcalandrelli/gocc/example/errorrecovery/internal/token" + "github.com/maxcalandrelli/gocc/example/errorrecovery/er.grammar/er/iface" + parseError "github.com/maxcalandrelli/gocc/example/errorrecovery/er.grammar/er/internal/errors" + "github.com/maxcalandrelli/gocc/example/errorrecovery/er.grammar/er/internal/token" ) const ( numProductions = 5 - numStates = 5 - numSymbols = 6 + numStates = 6 + numSymbols = 7 ) // Stack @@ -95,7 +95,21 @@ type Parser struct { userContext interface{} } -type TokenStream = iface.TokenStream +type ( + TokenStream = iface.TokenStream + fakeCp struct{} + fakeCheckPointable struct{} +) + +func (f fakeCheckPointable) GetCheckPoint() iface.CheckPoint { + return fakeCp{} +} + +func (f fakeCheckPointable) GotoCheckPoint(iface.CheckPoint) {} + +func (f fakeCp) DistanceFrom(o iface.CheckPoint) int { + return 0 +} func NewParser() *Parser { return NewParserWithContext(nil) @@ -112,6 +126,15 @@ func (p *Parser) Reset() { p.stack.push(0, nil) } +func (p *Parser) SetContext(ctx interface{}) *Parser { + p.userContext = ctx + return p +} + +func (p Parser) GetContext() interface{} { + return p.userContext +} + func (p *Parser) Error(err error, scanner iface.Scanner) (recovered bool, errorAttrib *parseError.Error) { errorAttrib = &parseError.Error{ Err: err, @@ -125,7 +148,7 @@ func (p *Parser) Error(err error, scanner iface.Scanner) (recovered bool, errorA } } - if action := parserActions.table[p.stack.top()].actions[token.TokMap.Type("error")]; action != nil { + if action := parserActions.table[p.stack.top()].actions[token.TokMap.Type("λ")]; action != nil { p.stack.push(int(action.(shift)), errorAttrib) // action can only be shift } else { return @@ -202,7 +225,9 @@ func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, er if tokens == nil && (len(parserActions.table[p.stack.top()].cdActions) > 0 || longest) { return errNotRepositionable } - checkPoint = tokens.GetCheckPoint() + if longest { + checkPoint = tokens.GetCheckPoint() + } p.nextToken = scanner.Scan() if longest { afterPos = tokens.GetCheckPoint() @@ -210,20 +235,26 @@ func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, er return nil } p.Reset() - tokens, _ = scanner.(iface.CheckPointable) + if tokens, _ = scanner.(iface.CheckPointable); tokens == nil { + tokens = fakeCheckPointable{} + } + underlyingStream := TokenStream(nil) + if streamScanner, _ := scanner.(iface.StreamScanner); streamScanner != nil { + underlyingStream = streamScanner.GetStream() + } startCp := tokens.GetCheckPoint() if err := readNextToken(); err != nil { return nil, err, tokens.GetCheckPoint().DistanceFrom(startCp) } for acc := false; !acc; { action := parserActions.table[p.stack.top()].actions[p.nextToken.Type] - if action == nil { + if action == nil && underlyingStream != nil && len(parserActions.table[p.stack.top()].cdActions) > 0 { // // If no action, check if we have some context dependent parsing to try // for _, cdAction := range parserActions.table[p.stack.top()].cdActions { tokens.GotoCheckPoint(checkPoint) - cd_res, cd_err, cd_parsed := cdAction.tokenScanner(scanner.GetStream(), p.userContext) + cd_res, cd_err, cd_parsed := cdAction.tokenScanner(underlyingStream, p.userContext) if cd_err == nil && len(cd_parsed) > 0 { action = parserActions.table[p.stack.top()].actions[cdAction.tokenIndex] if action != nil { diff --git a/example/errorrecovery/internal/parser/productionstable.go b/example/errorrecovery/er.grammar/er/internal/parser/productionstable.go similarity index 100% rename from example/errorrecovery/internal/parser/productionstable.go rename to example/errorrecovery/er.grammar/er/internal/parser/productionstable.go diff --git a/example/errorrecovery/internal/token/token.go b/example/errorrecovery/er.grammar/er/internal/token/token.go similarity index 94% rename from example/errorrecovery/internal/token/token.go rename to example/errorrecovery/er.grammar/er/internal/token/token.go index 58432cfc..f546b2a4 100644 --- a/example/errorrecovery/internal/token/token.go +++ b/example/errorrecovery/er.grammar/er/internal/token/token.go @@ -48,6 +48,7 @@ func (p Pos) StartingFrom(base Pos) Pos { type TokenMap struct { typeMap []string idMap map[string]Type + litMap map[string]Type } func (m TokenMap) Id(tok Type) string { @@ -77,11 +78,15 @@ var TokMap = TokenMap{ "INVALID", "Ω", "id", + "λ", }, idMap: map[string]Type{ "INVALID": 0, "Ω": 1, "id": 2, + "λ": 3, }, + + litMap: map[string]Type{}, } diff --git a/example/calc/internal/util/litconv.go b/example/errorrecovery/er.grammar/er/internal/util/litconv.go similarity index 100% rename from example/calc/internal/util/litconv.go rename to example/errorrecovery/er.grammar/er/internal/util/litconv.go diff --git a/example/calc/internal/util/rune.go b/example/errorrecovery/er.grammar/er/internal/util/rune.go similarity index 100% rename from example/calc/internal/util/rune.go rename to example/errorrecovery/er.grammar/er/internal/util/rune.go diff --git a/example/errorrecovery/er.grammar/er/main/main.go b/example/errorrecovery/er.grammar/er/main/main.go new file mode 100644 index 00000000..65c19181 --- /dev/null +++ b/example/errorrecovery/er.grammar/er/main/main.go @@ -0,0 +1,53 @@ +package main + +import ( + "flag" + "fmt" + "os" + "strings" + + er "github.com/maxcalandrelli/gocc/example/errorrecovery/er.grammar/er" +) + +func showResult(r interface{}, e error, l int) { + if e != nil { + fmt.Fprintf(os.Stderr, "parsing returned the following error: %s\n", e.Error()) + } else { + fmt.Printf("r=%#v, %d bytes\n", r, l) + } +} + +var ( + File string + Text string + Longest bool +) + +func parse(longest bool, lex *er.Lexer) (res interface{}, err error, ptl int) { + if longest { + return er.NewParser().ParseLongestPrefix(lex) + } else { + return er.NewParser().Parse(lex) + } + return +} + +func main() { + flag.StringVar(&File, "file", "", "parse also text in file") + flag.StringVar(&Text, "text", "", "parse also text given with flag") + flag.BoolVar(&Longest, "longest", false, "parse longest possible part") + flag.Parse() + if Text > "" { + showResult(parse(Longest, er.NewLexerString(Text))) + } + if File > "" { + l, e := er.NewLexerFile(File) + if e != nil { + panic(e) + } + showResult(parse(Longest, l)) + } + if str := strings.Join(flag.Args(), " "); str > "" { + showResult(parse(Longest, er.NewLexerString(str))) + } +} diff --git a/example/errorrecovery/er_test.go b/example/errorrecovery/er_test.go index c0780374..a789cefb 100644 --- a/example/errorrecovery/er_test.go +++ b/example/errorrecovery/er_test.go @@ -1,13 +1,11 @@ -package astx +package er import ( "fmt" "testing" "github.com/maxcalandrelli/gocc/example/errorrecovery/ast" - "github.com/maxcalandrelli/gocc/example/errorrecovery/errors" - "github.com/maxcalandrelli/gocc/example/errorrecovery/lexer" - "github.com/maxcalandrelli/gocc/example/errorrecovery/parser" + "github.com/maxcalandrelli/gocc/example/errorrecovery/er.grammar/er" ) func TestFail(t *testing.T) { @@ -18,7 +16,7 @@ func TestFail(t *testing.T) { fmt.Print("output: [\n") for _, s := range sml { switch sym := s.(type) { - case *errors.Error: + case *er.Error: fmt.Printf("%s\n", sym) default: fmt.Printf("\t%v\n", sym) @@ -29,9 +27,9 @@ func TestFail(t *testing.T) { func test(src []byte) (astree ast.StmtList, err error) { fmt.Printf("input: %s\n", src) - s := lexer.NewLexer([]byte(src)) - p := parser.NewParser() - a, err := p.Parse(s) + s := er.NewLexerBytes(src) + p := er.NewParser() + a, err, _ := p.Parse(s) if err == nil { astree = a.(ast.StmtList) } diff --git a/example/errorrecovery/errorrecovery.go b/example/errorrecovery/errorrecovery.go deleted file mode 100644 index b8faa3d8..00000000 --- a/example/errorrecovery/errorrecovery.go +++ /dev/null @@ -1,62 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package errorrecovery - -import ( - "io" - - "github.com/maxcalandrelli/gocc/example/errorrecovery/iface" - "github.com/maxcalandrelli/gocc/example/errorrecovery/internal/io/stream" - "github.com/maxcalandrelli/gocc/example/errorrecovery/internal/lexer" - "github.com/maxcalandrelli/gocc/example/errorrecovery/internal/parser" - "github.com/maxcalandrelli/gocc/example/errorrecovery/internal/token" -) - -type ( - Token = token.Token - Lexer = lexer.Lexer - Parser = parser.Parser - TokenStream = iface.TokenStream - WindowReader = stream.WindowReader - Scanner = iface.Scanner -) - -func ParseFile(fpath string) (interface{}, error, int) { - if lexer, err := NewLexerFile(fpath); err == nil { - return NewParser().Parse(lexer) - } else { - return nil, err, 0 - } -} - -func ParseText(text string) (interface{}, error, int) { - return NewParser().Parse(NewLexerBytes([]byte(text))) -} - -func NewLexerBytes(src []byte) *lexer.Lexer { - return lexer.NewLexerBytes(src) -} - -func NewLexerString(src string) *lexer.Lexer { - return lexer.NewLexerBytes([]byte(src)) -} - -func NewLexerFile(fpath string) (*lexer.Lexer, error) { - return lexer.NewLexerFile(fpath) -} - -func NewParser() *parser.Parser { - return parser.NewParser() -} - -func NewWindowReaderFromBytes(src []byte) WindowReader { - return stream.NewWindowReaderFromBytes(src) -} - -func NewWindowReader(rdr io.Reader) WindowReader { - return stream.NewWindowReader(rdr) -} - -func NewLimitedWindowReader(rdr io.Reader, sizeMin, sizeMax int) WindowReader { - return stream.NewLimitedWindowReader(rdr, sizeMin, sizeMax) -} diff --git a/example/errorrecovery/errors/errors.go b/example/errorrecovery/errors/errors.go deleted file mode 100644 index 080d53c1..00000000 --- a/example/errorrecovery/errors/errors.go +++ /dev/null @@ -1,56 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package errors - -import ( - "fmt" - "strings" - - "github.com/maxcalandrelli/gocc/example/errorrecovery/token" -) - -type ErrorSymbol interface { -} - -type Error struct { - Err error - ErrorToken *token.Token - ErrorSymbols []ErrorSymbol - ExpectedTokens []string - StackTop int -} - -func (e *Error) String() string { - w := new(strings.Builder) - fmt.Fprintf(w, "Error") - if e.Err != nil { - fmt.Fprintf(w, " %s\n", e.Err) - } else { - fmt.Fprintf(w, "\n") - } - fmt.Fprintf(w, "Token: type=%d, lit=%s\n", e.ErrorToken.Type, e.ErrorToken.Lit) - fmt.Fprintf(w, "Pos: offset=%d, line=%d, column=%d\n", e.ErrorToken.Pos.Offset, e.ErrorToken.Pos.Line, e.ErrorToken.Pos.Column) - fmt.Fprintf(w, "Expected one of: ") - for _, sym := range e.ExpectedTokens { - fmt.Fprintf(w, "%s ", sym) - } - fmt.Fprintf(w, "ErrorSymbol:\n") - for _, sym := range e.ErrorSymbols { - fmt.Fprintf(w, "%v\n", sym) - } - return w.String() -} - -func (e *Error) Error() string { - w := new(strings.Builder) - fmt.Fprintf(w, "Error in S%d: %s, %s", e.StackTop, token.TokMap.TokenString(e.ErrorToken), e.ErrorToken.Pos.String()) - if e.Err != nil { - fmt.Fprintf(w, ": %+v", e.Err) - } else { - fmt.Fprintf(w, ", expected one of: ") - for _, expected := range e.ExpectedTokens { - fmt.Fprintf(w, "%s ", expected) - } - } - return w.String() -} diff --git a/example/errorrecovery/iface/iface.go b/example/errorrecovery/iface/iface.go deleted file mode 100644 index a7175c9c..00000000 --- a/example/errorrecovery/iface/iface.go +++ /dev/null @@ -1,30 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package iface - -import ( - "github.com/maxcalandrelli/gocc/example/errorrecovery/internal/token" - "io" -) - -type ( - Scanner interface { - Scan() (tok *token.Token) - GetStream() TokenStream - } - - CheckPoint interface { - DistanceFrom(CheckPoint) int - } - - CheckPointable interface { - GetCheckPoint() CheckPoint - GotoCheckPoint(CheckPoint) - } - - TokenStream interface { - io.Reader - io.RuneScanner - io.Seeker - } -) diff --git a/example/errorrecovery/internal/errors/errors.go b/example/errorrecovery/internal/errors/errors.go deleted file mode 100644 index ac18f939..00000000 --- a/example/errorrecovery/internal/errors/errors.go +++ /dev/null @@ -1,56 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package errors - -import ( - "fmt" - "strings" - - "github.com/maxcalandrelli/gocc/example/errorrecovery/internal/token" -) - -type ErrorSymbol interface { -} - -type Error struct { - Err error - ErrorToken *token.Token - ErrorSymbols []ErrorSymbol - ExpectedTokens []string - StackTop int -} - -func (e *Error) String() string { - w := new(strings.Builder) - fmt.Fprintf(w, "Error") - if e.Err != nil { - fmt.Fprintf(w, " %s\n", e.Err) - } else { - fmt.Fprintf(w, "\n") - } - fmt.Fprintf(w, "Token: type=%d, lit=%s\n", e.ErrorToken.Type, e.ErrorToken.Lit) - fmt.Fprintf(w, "Pos: offset=%d, line=%d, column=%d\n", e.ErrorToken.Pos.Offset, e.ErrorToken.Pos.Line, e.ErrorToken.Pos.Column) - fmt.Fprintf(w, "Expected one of: ") - for _, sym := range e.ExpectedTokens { - fmt.Fprintf(w, "%s ", sym) - } - fmt.Fprintf(w, "ErrorSymbol:\n") - for _, sym := range e.ErrorSymbols { - fmt.Fprintf(w, "%v\n", sym) - } - return w.String() -} - -func (e *Error) Error() string { - w := new(strings.Builder) - fmt.Fprintf(w, "Error in S%d: %s, %s", e.StackTop, token.TokMap.TokenString(e.ErrorToken), e.ErrorToken.Pos.String()) - if e.Err != nil { - fmt.Fprintf(w, ": %+v", e.Err) - } else { - fmt.Fprintf(w, ", expected one of: ") - for _, expected := range e.ExpectedTokens { - fmt.Fprintf(w, "%s ", expected) - } - } - return w.String() -} diff --git a/example/errorrecovery/internal/lexer/transitiontable.go b/example/errorrecovery/internal/lexer/transitiontable.go deleted file mode 100644 index 50dd04da..00000000 --- a/example/errorrecovery/internal/lexer/transitiontable.go +++ /dev/null @@ -1,109 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package lexer - -/* -Let s be the current state -Let r be the current input rune -transitionTable[s](r) returns the next state. -*/ -type TransitionTable [NumStates]func(rune) int - -var TransTab = TransitionTable{ - // S0 - func(r rune) int { - switch { - case r == 9: // ['\t','\t'] - return 1 - case r == 10: // ['\n','\n'] - return 1 - case r == 13: // ['\r','\r'] - return 1 - case r == 32: // [' ',' '] - return 1 - case 65 <= r && r <= 90: // ['A','Z'] - return 2 - case r == 95: // ['_','_'] - return 3 - case 97 <= r && r <= 122: // ['a','z'] - return 2 - } - return NoState - }, - // S1 - func(r rune) int { - switch { - } - return NoState - }, - // S2 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 4 - case 65 <= r && r <= 90: // ['A','Z'] - return 5 - case r == 95: // ['_','_'] - return 6 - case 97 <= r && r <= 122: // ['a','z'] - return 5 - } - return NoState - }, - // S3 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 4 - case 65 <= r && r <= 90: // ['A','Z'] - return 5 - case r == 95: // ['_','_'] - return 6 - case 97 <= r && r <= 122: // ['a','z'] - return 5 - } - return NoState - }, - // S4 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 4 - case 65 <= r && r <= 90: // ['A','Z'] - return 5 - case r == 95: // ['_','_'] - return 6 - case 97 <= r && r <= 122: // ['a','z'] - return 5 - } - return NoState - }, - // S5 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 4 - case 65 <= r && r <= 90: // ['A','Z'] - return 5 - case r == 95: // ['_','_'] - return 6 - case 97 <= r && r <= 122: // ['a','z'] - return 5 - } - return NoState - }, - // S6 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 4 - case 65 <= r && r <= 90: // ['A','Z'] - return 5 - case r == 95: // ['_','_'] - return 6 - case 97 <= r && r <= 122: // ['a','z'] - return 5 - } - return NoState - }, -} diff --git a/example/errorrecovery/internal/parser/action.go b/example/errorrecovery/internal/parser/action.go deleted file mode 100644 index 54bc55e9..00000000 --- a/example/errorrecovery/internal/parser/action.go +++ /dev/null @@ -1,51 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package parser - -import ( - "fmt" -) - -type action interface { - act() - String() string -} - -type ( - accept bool - shift int // value is next state index - reduce int // value is production index -) - -func (this accept) act() {} -func (this shift) act() {} -func (this reduce) act() {} - -func (this accept) Equal(that action) bool { - if _, ok := that.(accept); ok { - return true - } - return false -} - -func (this reduce) Equal(that action) bool { - that1, ok := that.(reduce) - if !ok { - return false - } - return this == that1 -} - -func (this shift) Equal(that action) bool { - that1, ok := that.(shift) - if !ok { - return false - } - return this == that1 -} - -func (this accept) String() string { return "accept(0)" } -func (this shift) String() string { return fmt.Sprintf("shift:%d", this) } -func (this reduce) String() string { - return fmt.Sprintf("reduce:%d(%s)", this, productionsTable[this].String) -} diff --git a/example/errorrecovery/lexer/acttab.go b/example/errorrecovery/lexer/acttab.go deleted file mode 100644 index b52bf53a..00000000 --- a/example/errorrecovery/lexer/acttab.go +++ /dev/null @@ -1,51 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package lexer - -import ( - "fmt" - - "github.com/maxcalandrelli/gocc/example/errorrecovery/token" -) - -type ActionTable [NumStates]ActionRow - -type ActionRow struct { - Accept token.Type - Ignore string -} - -func (a ActionRow) String() string { - return fmt.Sprintf("Accept=%d, Ignore=%s", a.Accept, a.Ignore) -} - -var ActTab = ActionTable{ - ActionRow{ // S0 - Accept: 0, - Ignore: "", - }, - ActionRow{ // S1 - Accept: -1, - Ignore: "!whitespace", - }, - ActionRow{ // S2 - Accept: 2, - Ignore: "", - }, - ActionRow{ // S3 - Accept: 2, - Ignore: "", - }, - ActionRow{ // S4 - Accept: 2, - Ignore: "", - }, - ActionRow{ // S5 - Accept: 2, - Ignore: "", - }, - ActionRow{ // S6 - Accept: 2, - Ignore: "", - }, -} diff --git a/example/errorrecovery/lexer/lexer.go b/example/errorrecovery/lexer/lexer.go deleted file mode 100644 index 9fcf2aa1..00000000 --- a/example/errorrecovery/lexer/lexer.go +++ /dev/null @@ -1,126 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package lexer - -import ( - "io/ioutil" - "unicode/utf8" - - "github.com/maxcalandrelli/gocc/example/errorrecovery/token" -) - -const ( - NoState = -1 - NumStates = 7 - NumSymbols = 10 -) - -type Lexer struct { - src []byte - pos int - line int - column int -} - -func NewLexer(src []byte) *Lexer { - lexer := &Lexer{ - src: src, - pos: 0, - line: 1, - column: 1, - } - return lexer -} - -func NewLexerFile(fpath string) (*Lexer, error) { - src, err := ioutil.ReadFile(fpath) - if err != nil { - return nil, err - } - return NewLexer(src), nil -} - -func (l *Lexer) Scan() (tok *token.Token) { - tok = new(token.Token) - if l.pos >= len(l.src) { - tok.Type = token.EOF - tok.Pos.Offset, tok.Pos.Line, tok.Pos.Column = l.pos, l.line, l.column - return - } - start, startLine, startColumn, end := l.pos, l.line, l.column, 0 - tok.Type = token.INVALID - state, rune1, size := 0, rune(-1), 0 - for state != -1 { - if l.pos >= len(l.src) { - rune1 = -1 - } else { - rune1, size = utf8.DecodeRune(l.src[l.pos:]) - l.pos += size - } - - nextState := -1 - if rune1 != -1 { - nextState = TransTab[state](rune1) - } - state = nextState - - if state != -1 { - - switch rune1 { - case '\n': - l.line++ - l.column = 1 - case '\r': - l.column = 1 - case '\t': - l.column += 4 - default: - l.column++ - } - - switch { - case ActTab[state].Accept != -1: - tok.Type = ActTab[state].Accept - end = l.pos - case ActTab[state].Ignore != "": - start, startLine, startColumn = l.pos, l.line, l.column - state = 0 - if start >= len(l.src) { - tok.Type = token.EOF - } - - } - } else { - if tok.Type == token.INVALID { - end = l.pos - } - } - } - if end > start { - l.pos = end - tok.Lit = l.src[start:end] - } else { - tok.Lit = []byte{} - } - tok.Pos.Offset, tok.Pos.Line, tok.Pos.Column = start, startLine, startColumn - - return -} - -func (l *Lexer) Reset() { - l.pos = 0 -} - -/* -Lexer symbols: -0: '_' -1: '_' -2: ' ' -3: '\t' -4: '\n' -5: '\r' -6: 'a'-'z' -7: 'A'-'Z' -8: '0'-'9' -9: . -*/ diff --git a/example/errorrecovery/lexer/transitiontable.go b/example/errorrecovery/lexer/transitiontable.go deleted file mode 100644 index 50dd04da..00000000 --- a/example/errorrecovery/lexer/transitiontable.go +++ /dev/null @@ -1,109 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package lexer - -/* -Let s be the current state -Let r be the current input rune -transitionTable[s](r) returns the next state. -*/ -type TransitionTable [NumStates]func(rune) int - -var TransTab = TransitionTable{ - // S0 - func(r rune) int { - switch { - case r == 9: // ['\t','\t'] - return 1 - case r == 10: // ['\n','\n'] - return 1 - case r == 13: // ['\r','\r'] - return 1 - case r == 32: // [' ',' '] - return 1 - case 65 <= r && r <= 90: // ['A','Z'] - return 2 - case r == 95: // ['_','_'] - return 3 - case 97 <= r && r <= 122: // ['a','z'] - return 2 - } - return NoState - }, - // S1 - func(r rune) int { - switch { - } - return NoState - }, - // S2 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 4 - case 65 <= r && r <= 90: // ['A','Z'] - return 5 - case r == 95: // ['_','_'] - return 6 - case 97 <= r && r <= 122: // ['a','z'] - return 5 - } - return NoState - }, - // S3 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 4 - case 65 <= r && r <= 90: // ['A','Z'] - return 5 - case r == 95: // ['_','_'] - return 6 - case 97 <= r && r <= 122: // ['a','z'] - return 5 - } - return NoState - }, - // S4 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 4 - case 65 <= r && r <= 90: // ['A','Z'] - return 5 - case r == 95: // ['_','_'] - return 6 - case 97 <= r && r <= 122: // ['a','z'] - return 5 - } - return NoState - }, - // S5 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 4 - case 65 <= r && r <= 90: // ['A','Z'] - return 5 - case r == 95: // ['_','_'] - return 6 - case 97 <= r && r <= 122: // ['a','z'] - return 5 - } - return NoState - }, - // S6 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 4 - case 65 <= r && r <= 90: // ['A','Z'] - return 5 - case r == 95: // ['_','_'] - return 6 - case 97 <= r && r <= 122: // ['a','z'] - return 5 - } - return NoState - }, -} diff --git a/example/errorrecovery/main/main.go b/example/errorrecovery/main/main.go deleted file mode 100644 index f31ff541..00000000 --- a/example/errorrecovery/main/main.go +++ /dev/null @@ -1,53 +0,0 @@ -package main - -import ( - "flag" - "fmt" - "os" - "strings" - - errorrecovery "github.com/maxcalandrelli/gocc/example/errorrecovery" -) - -func showResult(r interface{}, e error, l int) { - if e != nil { - fmt.Fprintf(os.Stderr, "parsing returned the following error: %s\n", e.Error()) - } else { - fmt.Printf("r=%#v, %d bytes\n", r, l) - } -} - -var ( - File string - Text string - Longest bool -) - -func parse(longest bool, lex *errorrecovery.Lexer) (res interface{}, err error, ptl int) { - if longest { - return errorrecovery.NewParser().ParseLongestPrefix(lex) - } else { - return errorrecovery.NewParser().Parse(lex) - } - return -} - -func main() { - flag.StringVar(&File, "file", "", "parse also text in file") - flag.StringVar(&Text, "text", "", "parse also text given with flag") - flag.BoolVar(&Longest, "longest", false, "parse longest possible part") - flag.Parse() - if Text > "" { - showResult(parse(Longest, errorrecovery.NewLexerString(Text))) - } - if File > "" { - l, e := errorrecovery.NewLexerFile(File) - if e != nil { - panic(e) - } - showResult(parse(Longest, l)) - } - if str := strings.Join(flag.Args(), " "); str > "" { - showResult(parse(Longest, errorrecovery.NewLexerString(str))) - } -} diff --git a/example/errorrecovery/parser/action.go b/example/errorrecovery/parser/action.go deleted file mode 100644 index 54bc55e9..00000000 --- a/example/errorrecovery/parser/action.go +++ /dev/null @@ -1,51 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package parser - -import ( - "fmt" -) - -type action interface { - act() - String() string -} - -type ( - accept bool - shift int // value is next state index - reduce int // value is production index -) - -func (this accept) act() {} -func (this shift) act() {} -func (this reduce) act() {} - -func (this accept) Equal(that action) bool { - if _, ok := that.(accept); ok { - return true - } - return false -} - -func (this reduce) Equal(that action) bool { - that1, ok := that.(reduce) - if !ok { - return false - } - return this == that1 -} - -func (this shift) Equal(that action) bool { - that1, ok := that.(shift) - if !ok { - return false - } - return this == that1 -} - -func (this accept) String() string { return "accept(0)" } -func (this shift) String() string { return fmt.Sprintf("shift:%d", this) } -func (this reduce) String() string { - return fmt.Sprintf("reduce:%d(%s)", this, productionsTable[this].String) -} diff --git a/example/errorrecovery/parser/actiontable.go b/example/errorrecovery/parser/actiontable.go deleted file mode 100644 index 58496c7f..00000000 --- a/example/errorrecovery/parser/actiontable.go +++ /dev/null @@ -1,68 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package parser - -type ( - actionTable [numStates]actionRow - actionRow struct { - canRecover bool - actions [numSymbols]action - } -) - -var actionTab = actionTable{ - actionRow{ // S0 - canRecover: true, - actions: [numSymbols]action{ - nil, // INVALID - nil, // $ - shift(3), // id - shift(4), // error - }, - }, - actionRow{ // S1 - canRecover: true, - actions: [numSymbols]action{ - nil, // INVALID - accept(true), // $ - shift(3), // id - shift(4), // error - }, - }, - actionRow{ // S2 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - reduce(1), // $, reduce: StmtList - reduce(1), // id, reduce: StmtList - reduce(1), // error, reduce: StmtList - }, - }, - actionRow{ // S3 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - reduce(3), // $, reduce: Stmt - reduce(3), // id, reduce: Stmt - reduce(3), // error, reduce: Stmt - }, - }, - actionRow{ // S4 - canRecover: true, - actions: [numSymbols]action{ - nil, // INVALID - reduce(4), // $, reduce: Stmt - reduce(4), // id, reduce: Stmt - reduce(4), // error, reduce: Stmt - }, - }, - actionRow{ // S5 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - reduce(2), // $, reduce: StmtList - reduce(2), // id, reduce: StmtList - reduce(2), // error, reduce: StmtList - }, - }, -} diff --git a/example/errorrecovery/parser/gototable.go b/example/errorrecovery/parser/gototable.go deleted file mode 100644 index 2b3a2108..00000000 --- a/example/errorrecovery/parser/gototable.go +++ /dev/null @@ -1,43 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package parser - -const numNTSymbols = 3 - -type ( - gotoTable [numStates]gotoRow - gotoRow [numNTSymbols]int -) - -var gotoTab = gotoTable{ - gotoRow{ // S0 - -1, // S' - 1, // StmtList - 2, // Stmt - }, - gotoRow{ // S1 - -1, // S' - -1, // StmtList - 5, // Stmt - }, - gotoRow{ // S2 - -1, // S' - -1, // StmtList - -1, // Stmt - }, - gotoRow{ // S3 - -1, // S' - -1, // StmtList - -1, // Stmt - }, - gotoRow{ // S4 - -1, // S' - -1, // StmtList - -1, // Stmt - }, - gotoRow{ // S5 - -1, // S' - -1, // StmtList - -1, // Stmt - }, -} diff --git a/example/errorrecovery/parser/parser.go b/example/errorrecovery/parser/parser.go deleted file mode 100644 index 1fac0920..00000000 --- a/example/errorrecovery/parser/parser.go +++ /dev/null @@ -1,216 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package parser - -import ( - "fmt" - "strings" - - parseError "github.com/maxcalandrelli/gocc/example/errorrecovery/errors" - "github.com/maxcalandrelli/gocc/example/errorrecovery/token" -) - -const ( - numProductions = 5 - numStates = 6 - numSymbols = 7 -) - -// Stack - -type stack struct { - state []int - attrib []Attrib -} - -const iNITIAL_STACK_SIZE = 100 - -func newStack() *stack { - return &stack{ - state: make([]int, 0, iNITIAL_STACK_SIZE), - attrib: make([]Attrib, 0, iNITIAL_STACK_SIZE), - } -} - -func (s *stack) reset() { - s.state = s.state[:0] - s.attrib = s.attrib[:0] -} - -func (s *stack) push(state int, a Attrib) { - s.state = append(s.state, state) - s.attrib = append(s.attrib, a) -} - -func (s *stack) top() int { - return s.state[len(s.state)-1] -} - -func (s *stack) peek(pos int) int { - return s.state[pos] -} - -func (s *stack) topIndex() int { - return len(s.state) - 1 -} - -func (s *stack) popN(items int) []Attrib { - lo, hi := len(s.state)-items, len(s.state) - - attrib := s.attrib[lo:hi] - - s.state = s.state[:lo] - s.attrib = s.attrib[:lo] - - return attrib -} - -func (s *stack) String() string { - w := new(strings.Builder) - fmt.Fprintf(w, "stack:\n") - for i, st := range s.state { - fmt.Fprintf(w, "\t%d: %d , ", i, st) - if s.attrib[i] == nil { - fmt.Fprintf(w, "nil") - } else { - switch attr := s.attrib[i].(type) { - case *token.Token: - fmt.Fprintf(w, "%s", attr.Lit) - default: - fmt.Fprintf(w, "%v", attr) - } - } - fmt.Fprintf(w, "\n") - } - return w.String() -} - -// Parser - -type Parser struct { - stack *stack - nextToken *token.Token - pos int -} - -type Scanner interface { - Scan() (tok *token.Token) -} - -func NewParser() *Parser { - p := &Parser{stack: newStack()} - p.Reset() - return p -} - -func (p *Parser) Reset() { - p.stack.reset() - p.stack.push(0, nil) -} - -func (p *Parser) Error(err error, scanner Scanner) (recovered bool, errorAttrib *parseError.Error) { - errorAttrib = &parseError.Error{ - Err: err, - ErrorToken: p.nextToken, - ErrorSymbols: p.popNonRecoveryStates(), - ExpectedTokens: make([]string, 0, 8), - } - for t, action := range actionTab[p.stack.top()].actions { - if action != nil { - errorAttrib.ExpectedTokens = append(errorAttrib.ExpectedTokens, token.TokMap.Id(token.Type(t))) - } - } - - if action := actionTab[p.stack.top()].actions[token.TokMap.Type("error")]; action != nil { - p.stack.push(int(action.(shift)), errorAttrib) // action can only be shift - } else { - return - } - - if action := actionTab[p.stack.top()].actions[p.nextToken.Type]; action != nil { - recovered = true - } - for !recovered && p.nextToken.Type != token.EOF { - p.nextToken = scanner.Scan() - if action := actionTab[p.stack.top()].actions[p.nextToken.Type]; action != nil { - recovered = true - } - } - - return -} - -func (p *Parser) popNonRecoveryStates() (removedAttribs []parseError.ErrorSymbol) { - if rs, ok := p.firstRecoveryState(); ok { - errorSymbols := p.stack.popN(p.stack.topIndex() - rs) - removedAttribs = make([]parseError.ErrorSymbol, len(errorSymbols)) - for i, e := range errorSymbols { - removedAttribs[i] = e - } - } else { - removedAttribs = []parseError.ErrorSymbol{} - } - return -} - -// recoveryState points to the highest state on the stack, which can recover -func (p *Parser) firstRecoveryState() (recoveryState int, canRecover bool) { - recoveryState, canRecover = p.stack.topIndex(), actionTab[p.stack.top()].canRecover - for recoveryState > 0 && !canRecover { - recoveryState-- - canRecover = actionTab[p.stack.peek(recoveryState)].canRecover - } - return -} - -func (p *Parser) newError(err error) error { - e := &parseError.Error{ - Err: err, - StackTop: p.stack.top(), - ErrorToken: p.nextToken, - } - actRow := actionTab[p.stack.top()] - for i, t := range actRow.actions { - if t != nil { - e.ExpectedTokens = append(e.ExpectedTokens, token.TokMap.Id(token.Type(i))) - } - } - return e -} - -func (p *Parser) Parse(scanner Scanner) (res interface{}, err error) { - p.Reset() - p.nextToken = scanner.Scan() - for acc := false; !acc; { - action := actionTab[p.stack.top()].actions[p.nextToken.Type] - if action == nil { - if recovered, errAttrib := p.Error(nil, scanner); !recovered { - p.nextToken = errAttrib.ErrorToken - return nil, p.newError(nil) - } - if action = actionTab[p.stack.top()].actions[p.nextToken.Type]; action == nil { - panic("Error recovery led to invalid action") - } - } - - switch act := action.(type) { - case accept: - res = p.stack.popN(1)[0] - acc = true - case shift: - p.stack.push(int(act), p.nextToken) - p.nextToken = scanner.Scan() - case reduce: - prod := productionsTable[int(act)] - attrib, err := prod.ReduceFunc(p.stack.popN(prod.NumSymbols)) - if err != nil { - return nil, p.newError(err) - } else { - p.stack.push(gotoTab[p.stack.top()][prod.NTType], attrib) - } - default: - panic("unknown action: " + action.String()) - } - } - return res, nil -} diff --git a/example/errorrecovery/parser/productionstable.go b/example/errorrecovery/parser/productionstable.go deleted file mode 100644 index 0c73061c..00000000 --- a/example/errorrecovery/parser/productionstable.go +++ /dev/null @@ -1,73 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package parser - -import "github.com/maxcalandrelli/gocc/example/errorrecovery/ast" - -type ( - //TODO: change type and variable names to be consistent with other tables - ProdTab [numProductions]ProdTabEntry - ProdTabEntry struct { - String string - Id string - NTType int - Index int - NumSymbols int - ReduceFunc func([]Attrib) (Attrib, error) - } - Attrib interface { - } -) - -var productionsTable = ProdTab{ - ProdTabEntry{ - String: `S' : StmtList << >>`, - Id: "S'", - NTType: 0, - Index: 0, - NumSymbols: 1, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return X[0], nil - }, - }, - ProdTabEntry{ - String: `StmtList : Stmt << ast.NewStmtList(X[0]) >>`, - Id: "StmtList", - NTType: 1, - Index: 1, - NumSymbols: 1, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return ast.NewStmtList(X[0]) - }, - }, - ProdTabEntry{ - String: `StmtList : StmtList Stmt << ast.AppendStmt(X[0], X[1]) >>`, - Id: "StmtList", - NTType: 1, - Index: 2, - NumSymbols: 2, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return ast.AppendStmt(X[0], X[1]) - }, - }, - ProdTabEntry{ - String: `Stmt : id << ast.NewStmt(X[0]) >>`, - Id: "Stmt", - NTType: 2, - Index: 3, - NumSymbols: 1, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return ast.NewStmt(X[0]) - }, - }, - ProdTabEntry{ - String: `Stmt : error << >>`, - Id: "Stmt", - NTType: 2, - Index: 4, - NumSymbols: 1, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return X[0], nil - }, - }, -} diff --git a/example/errorrecovery/parser/symbols.go b/example/errorrecovery/parser/symbols.go deleted file mode 100644 index 478177ee..00000000 --- a/example/errorrecovery/parser/symbols.go +++ /dev/null @@ -1,44 +0,0 @@ -package parser - -type symbol struct { - Name string - IsTerminal bool -} - -var symbols = [numSymbols]symbol{ - - { - Name: "INVALID", - IsTerminal: true, - }, - - { - Name: "$", - IsTerminal: true, - }, - - { - Name: "S'", - IsTerminal: false, - }, - - { - Name: "StmtList", - IsTerminal: false, - }, - - { - Name: "Stmt", - IsTerminal: false, - }, - - { - Name: "id", - IsTerminal: true, - }, - - { - Name: "error", - IsTerminal: true, - }, -} diff --git a/example/errorrecovery/token/token.go b/example/errorrecovery/token/token.go deleted file mode 100644 index 4b15584d..00000000 --- a/example/errorrecovery/token/token.go +++ /dev/null @@ -1,74 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package token - -import ( - "fmt" -) - -type Token struct { - Type - Lit []byte - Pos -} - -type Type int - -const ( - INVALID Type = iota - EOF -) - -type Pos struct { - Offset int - Line int - Column int -} - -func (p Pos) String() string { - return fmt.Sprintf("Pos(offset=%d, line=%d, column=%d)", p.Offset, p.Line, p.Column) -} - -type TokenMap struct { - typeMap []string - idMap map[string]Type -} - -func (m TokenMap) Id(tok Type) string { - if int(tok) < len(m.typeMap) { - return m.typeMap[tok] - } - return "unknown" -} - -func (m TokenMap) Type(tok string) Type { - if typ, exist := m.idMap[tok]; exist { - return typ - } - return INVALID -} - -func (m TokenMap) TokenString(tok *Token) string { - //TODO: refactor to print pos & token string properly - return fmt.Sprintf("%s(%d,%s)", m.Id(tok.Type), tok.Type, tok.Lit) -} - -func (m TokenMap) StringType(typ Type) string { - return fmt.Sprintf("%s(%d)", m.Id(typ), typ) -} - -var TokMap = TokenMap{ - typeMap: []string{ - "INVALID", - "$", - "id", - "error", - }, - - idMap: map[string]Type{ - "INVALID": 0, - "$": 1, - "id": 2, - "error": 3, - }, -} diff --git a/example/errorrecovery/util/litconv.go b/example/errorrecovery/util/litconv.go deleted file mode 100644 index 1aeb6166..00000000 --- a/example/errorrecovery/util/litconv.go +++ /dev/null @@ -1,108 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package util - -import ( - "fmt" - "strconv" - "unicode" - "unicode/utf8" -) - -/* Interface */ - -/* -Convert the literal value of a scanned token to rune -*/ -func RuneValue(lit []byte) rune { - if lit[1] == '\\' { - return escapeCharVal(lit) - } - r, size := utf8.DecodeRune(lit[1:]) - if size != len(lit)-2 { - panic(fmt.Sprintf("Error decoding rune. Lit: %s, rune: %d, size%d\n", lit, r, size)) - } - return r -} - -/* -Convert the literal value of a scanned token to int64 -*/ -func IntValue(lit []byte) (int64, error) { - return strconv.ParseInt(string(lit), 10, 64) -} - -/* -Convert the literal value of a scanned token to uint64 -*/ -func UintValue(lit []byte) (uint64, error) { - return strconv.ParseUint(string(lit), 10, 64) -} - -/* Util */ - -func escapeCharVal(lit []byte) rune { - var i, base, max uint32 - offset := 2 - switch lit[offset] { - case 'a': - return '\a' - case 'b': - return '\b' - case 'f': - return '\f' - case 'n': - return '\n' - case 'r': - return '\r' - case 't': - return '\t' - case 'v': - return '\v' - case '\\': - return '\\' - case '\'': - return '\'' - case '0', '1', '2', '3', '4', '5', '6', '7': - i, base, max = 3, 8, 255 - case 'x': - i, base, max = 2, 16, 255 - offset++ - case 'u': - i, base, max = 4, 16, unicode.MaxRune - offset++ - case 'U': - i, base, max = 8, 16, unicode.MaxRune - offset++ - default: - panic(fmt.Sprintf("Error decoding character literal: %s\n", lit)) - } - - var x uint32 - for ; i > 0 && offset < len(lit)-1; i-- { - ch, size := utf8.DecodeRune(lit[offset:]) - offset += size - d := uint32(digitVal(ch)) - if d >= base { - panic(fmt.Sprintf("charVal(%s): illegal character (%c) in escape sequence. size=%d, offset=%d", lit, ch, size, offset)) - } - x = x*base + d - } - if x > max || 0xD800 <= x && x < 0xE000 { - panic(fmt.Sprintf("Error decoding escape char value. Lit:%s, offset:%d, escape sequence is invalid Unicode code point\n", lit, offset)) - } - - return rune(x) -} - -func digitVal(ch rune) int { - switch { - case '0' <= ch && ch <= '9': - return int(ch) - '0' - case 'a' <= ch && ch <= 'f': - return int(ch) - 'a' + 10 - case 'A' <= ch && ch <= 'F': - return int(ch) - 'A' + 10 - } - return 16 // larger than any legal digit val -} diff --git a/example/errorrecovery/util/rune.go b/example/errorrecovery/util/rune.go deleted file mode 100644 index bd8523a4..00000000 --- a/example/errorrecovery/util/rune.go +++ /dev/null @@ -1,39 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package util - -import ( - "fmt" -) - -func RuneToString(r rune) string { - if r >= 0x20 && r < 0x7f { - return fmt.Sprintf("'%c'", r) - } - switch r { - case 0x07: - return "'\\a'" - case 0x08: - return "'\\b'" - case 0x0C: - return "'\\f'" - case 0x0A: - return "'\\n'" - case 0x0D: - return "'\\r'" - case 0x09: - return "'\\t'" - case 0x0b: - return "'\\v'" - case 0x5c: - return "'\\\\\\'" - case 0x27: - return "'\\''" - case 0x22: - return "'\\\"'" - } - if r < 0x10000 { - return fmt.Sprintf("\\u%04x", r) - } - return fmt.Sprintf("\\U%08x", r) -} diff --git a/example/mail/iface/iface.go b/example/mail/iface/iface.go deleted file mode 100644 index 6774b3cc..00000000 --- a/example/mail/iface/iface.go +++ /dev/null @@ -1,30 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package iface - -import ( - "github.com/maxcalandrelli/gocc/example/mail/internal/token" - "io" -) - -type ( - Scanner interface { - Scan() (tok *token.Token) - GetStream() TokenStream - } - - CheckPoint interface { - DistanceFrom(CheckPoint) int - } - - CheckPointable interface { - GetCheckPoint() CheckPoint - GotoCheckPoint(CheckPoint) - } - - TokenStream interface { - io.Reader - io.RuneScanner - io.Seeker - } -) diff --git a/example/mail/internal/io/stream/stream.go b/example/mail/internal/io/stream/stream.go deleted file mode 100644 index eb4b534f..00000000 --- a/example/mail/internal/io/stream/stream.go +++ /dev/null @@ -1,39 +0,0 @@ -package stream - -import ( - internal "github.com/maxcalandrelli/gocc/example/mail/internal/io/stream/internal" - "io" -) - -type ( - WindowReader interface { - BlockSize() int - Buffered() int - Cap() int - MaxCap() int - Read([]byte) (int, error) - ReadByte() (byte, error) - ReadPosition() int64 - ReadRune() (rune, int, error) - Seek(int64, int) (int64, error) - UnreadByte() error - UnreadRune() error - MaxUnreadSize() int - } -) - -var ( - InfoPrefixRoundUp = false -) - -func NewWindowReaderFromBytes(src []byte) WindowReader { - return internal.NewWindowReader(src, nil, 0, 0, InfoPrefixRoundUp) -} - -func NewWindowReader(rdr io.Reader) WindowReader { - return internal.NewWindowReader(nil, rdr, 0, 0, false) -} - -func NewLimitedWindowReader(rdr io.Reader, sizeMin, sizeMax int) WindowReader { - return internal.NewWindowReader(nil, rdr, sizeMin, sizeMax, InfoPrefixRoundUp) -} diff --git a/example/mail/internal/util/litconv.go b/example/mail/internal/util/litconv.go deleted file mode 100644 index 1aeb6166..00000000 --- a/example/mail/internal/util/litconv.go +++ /dev/null @@ -1,108 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package util - -import ( - "fmt" - "strconv" - "unicode" - "unicode/utf8" -) - -/* Interface */ - -/* -Convert the literal value of a scanned token to rune -*/ -func RuneValue(lit []byte) rune { - if lit[1] == '\\' { - return escapeCharVal(lit) - } - r, size := utf8.DecodeRune(lit[1:]) - if size != len(lit)-2 { - panic(fmt.Sprintf("Error decoding rune. Lit: %s, rune: %d, size%d\n", lit, r, size)) - } - return r -} - -/* -Convert the literal value of a scanned token to int64 -*/ -func IntValue(lit []byte) (int64, error) { - return strconv.ParseInt(string(lit), 10, 64) -} - -/* -Convert the literal value of a scanned token to uint64 -*/ -func UintValue(lit []byte) (uint64, error) { - return strconv.ParseUint(string(lit), 10, 64) -} - -/* Util */ - -func escapeCharVal(lit []byte) rune { - var i, base, max uint32 - offset := 2 - switch lit[offset] { - case 'a': - return '\a' - case 'b': - return '\b' - case 'f': - return '\f' - case 'n': - return '\n' - case 'r': - return '\r' - case 't': - return '\t' - case 'v': - return '\v' - case '\\': - return '\\' - case '\'': - return '\'' - case '0', '1', '2', '3', '4', '5', '6', '7': - i, base, max = 3, 8, 255 - case 'x': - i, base, max = 2, 16, 255 - offset++ - case 'u': - i, base, max = 4, 16, unicode.MaxRune - offset++ - case 'U': - i, base, max = 8, 16, unicode.MaxRune - offset++ - default: - panic(fmt.Sprintf("Error decoding character literal: %s\n", lit)) - } - - var x uint32 - for ; i > 0 && offset < len(lit)-1; i-- { - ch, size := utf8.DecodeRune(lit[offset:]) - offset += size - d := uint32(digitVal(ch)) - if d >= base { - panic(fmt.Sprintf("charVal(%s): illegal character (%c) in escape sequence. size=%d, offset=%d", lit, ch, size, offset)) - } - x = x*base + d - } - if x > max || 0xD800 <= x && x < 0xE000 { - panic(fmt.Sprintf("Error decoding escape char value. Lit:%s, offset:%d, escape sequence is invalid Unicode code point\n", lit, offset)) - } - - return rune(x) -} - -func digitVal(ch rune) int { - switch { - case '0' <= ch && ch <= '9': - return int(ch) - '0' - case 'a' <= ch && ch <= 'f': - return int(ch) - 'a' + 10 - case 'A' <= ch && ch <= 'F': - return int(ch) - 'A' + 10 - } - return 16 // larger than any legal digit val -} diff --git a/example/mail/internal/util/rune.go b/example/mail/internal/util/rune.go deleted file mode 100644 index bd8523a4..00000000 --- a/example/mail/internal/util/rune.go +++ /dev/null @@ -1,39 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package util - -import ( - "fmt" -) - -func RuneToString(r rune) string { - if r >= 0x20 && r < 0x7f { - return fmt.Sprintf("'%c'", r) - } - switch r { - case 0x07: - return "'\\a'" - case 0x08: - return "'\\b'" - case 0x0C: - return "'\\f'" - case 0x0A: - return "'\\n'" - case 0x0D: - return "'\\r'" - case 0x09: - return "'\\t'" - case 0x0b: - return "'\\v'" - case 0x5c: - return "'\\\\\\'" - case 0x27: - return "'\\''" - case 0x22: - return "'\\\"'" - } - if r < 0x10000 { - return fmt.Sprintf("\\u%04x", r) - } - return fmt.Sprintf("\\U%08x", r) -} diff --git a/example/mail/lexer/acttab.go b/example/mail/lexer/acttab.go deleted file mode 100644 index 86e27dc3..00000000 --- a/example/mail/lexer/acttab.go +++ /dev/null @@ -1,83 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package lexer - -import ( - "fmt" - - "github.com/maxcalandrelli/gocc/example/mail/token" -) - -type ActionTable [NumStates]ActionRow - -type ActionRow struct { - Accept token.Type - Ignore string -} - -func (a ActionRow) String() string { - return fmt.Sprintf("Accept=%d, Ignore=%s", a.Accept, a.Ignore) -} - -var ActTab = ActionTable{ - ActionRow{ // S0 - Accept: 0, - Ignore: "", - }, - ActionRow{ // S1 - Accept: -1, - Ignore: "!whitespace", - }, - ActionRow{ // S2 - Accept: 0, - Ignore: "", - }, - ActionRow{ // S3 - Accept: 0, - Ignore: "", - }, - ActionRow{ // S4 - Accept: 0, - Ignore: "", - }, - ActionRow{ // S5 - Accept: 0, - Ignore: "", - }, - ActionRow{ // S6 - Accept: 0, - Ignore: "", - }, - ActionRow{ // S7 - Accept: 0, - Ignore: "", - }, - ActionRow{ // S8 - Accept: 0, - Ignore: "", - }, - ActionRow{ // S9 - Accept: 2, - Ignore: "", - }, - ActionRow{ // S10 - Accept: 0, - Ignore: "", - }, - ActionRow{ // S11 - Accept: 0, - Ignore: "", - }, - ActionRow{ // S12 - Accept: 0, - Ignore: "", - }, - ActionRow{ // S13 - Accept: 0, - Ignore: "", - }, - ActionRow{ // S14 - Accept: 2, - Ignore: "", - }, -} diff --git a/example/mail/lexer/lexer.go b/example/mail/lexer/lexer.go deleted file mode 100644 index f07b285a..00000000 --- a/example/mail/lexer/lexer.go +++ /dev/null @@ -1,149 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package lexer - -import ( - "io/ioutil" - "unicode/utf8" - - "github.com/maxcalandrelli/gocc/example/mail/token" -) - -const ( - NoState = -1 - NumStates = 15 - NumSymbols = 33 -) - -type Lexer struct { - src []byte - pos int - line int - column int -} - -func NewLexer(src []byte) *Lexer { - lexer := &Lexer{ - src: src, - pos: 0, - line: 1, - column: 1, - } - return lexer -} - -func NewLexerFile(fpath string) (*Lexer, error) { - src, err := ioutil.ReadFile(fpath) - if err != nil { - return nil, err - } - return NewLexer(src), nil -} - -func (l *Lexer) Scan() (tok *token.Token) { - tok = new(token.Token) - if l.pos >= len(l.src) { - tok.Type = token.EOF - tok.Pos.Offset, tok.Pos.Line, tok.Pos.Column = l.pos, l.line, l.column - return - } - start, startLine, startColumn, end := l.pos, l.line, l.column, 0 - tok.Type = token.INVALID - state, rune1, size := 0, rune(-1), 0 - for state != -1 { - if l.pos >= len(l.src) { - rune1 = -1 - } else { - rune1, size = utf8.DecodeRune(l.src[l.pos:]) - l.pos += size - } - - nextState := -1 - if rune1 != -1 { - nextState = TransTab[state](rune1) - } - state = nextState - - if state != -1 { - - switch rune1 { - case '\n': - l.line++ - l.column = 1 - case '\r': - l.column = 1 - case '\t': - l.column += 4 - default: - l.column++ - } - - switch { - case ActTab[state].Accept != -1: - tok.Type = ActTab[state].Accept - end = l.pos - case ActTab[state].Ignore != "": - start, startLine, startColumn = l.pos, l.line, l.column - state = 0 - if start >= len(l.src) { - tok.Type = token.EOF - } - - } - } else { - if tok.Type == token.INVALID { - end = l.pos - } - } - } - if end > start { - l.pos = end - tok.Lit = l.src[start:end] - } else { - tok.Lit = []byte{} - } - tok.Pos.Offset, tok.Pos.Line, tok.Pos.Column = start, startLine, startColumn - - return -} - -func (l *Lexer) Reset() { - l.pos = 0 -} - -/* -Lexer symbols: -0: '@' -1: '!' -2: '#' -3: '$' -4: '%' -5: '&' -6: ''' -7: '*' -8: '+' -9: '-' -10: '/' -11: '=' -12: '?' -13: '^' -14: '_' -15: '`' -16: '{' -17: '|' -18: '}' -19: '~' -20: '.' -21: '\' -22: '"' -23: '"' -24: '\t' -25: '\n' -26: '\r' -27: ' ' -28: 'A'-'Z' -29: 'a'-'z' -30: '0'-'9' -31: \u0100-\U0010ffff -32: . -*/ diff --git a/example/mail/lexer/transitiontable.go b/example/mail/lexer/transitiontable.go deleted file mode 100644 index d3c1c3a4..00000000 --- a/example/mail/lexer/transitiontable.go +++ /dev/null @@ -1,510 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package lexer - -/* -Let s be the current state -Let r be the current input rune -transitionTable[s](r) returns the next state. -*/ -type TransitionTable [NumStates]func(rune) int - -var TransTab = TransitionTable{ - // S0 - func(r rune) int { - switch { - case r == 9: // ['\t','\t'] - return 1 - case r == 10: // ['\n','\n'] - return 1 - case r == 13: // ['\r','\r'] - return 1 - case r == 32: // [' ',' '] - return 1 - case r == 33: // ['!','!'] - return 2 - case r == 34: // ['"','"'] - return 3 - case r == 35: // ['#','#'] - return 2 - case r == 36: // ['$','$'] - return 2 - case r == 37: // ['%','%'] - return 2 - case r == 38: // ['&','&'] - return 2 - case r == 39: // [''','''] - return 2 - case r == 42: // ['*','*'] - return 2 - case r == 43: // ['+','+'] - return 2 - case r == 45: // ['-','-'] - return 2 - case r == 47: // ['/','/'] - return 2 - case 48 <= r && r <= 57: // ['0','9'] - return 2 - case r == 61: // ['=','='] - return 2 - case r == 63: // ['?','?'] - return 2 - case 65 <= r && r <= 90: // ['A','Z'] - return 2 - case r == 94: // ['^','^'] - return 2 - case r == 95: // ['_','_'] - return 2 - case r == 96: // ['`','`'] - return 2 - case 97 <= r && r <= 122: // ['a','z'] - return 2 - case r == 123: // ['{','{'] - return 2 - case r == 124: // ['|','|'] - return 2 - case r == 125: // ['}','}'] - return 2 - case r == 126: // ['~','~'] - return 2 - case 256 <= r && r <= 1114111: // [\u0100,\U0010ffff] - return 2 - } - return NoState - }, - // S1 - func(r rune) int { - switch { - } - return NoState - }, - // S2 - func(r rune) int { - switch { - case r == 33: // ['!','!'] - return 2 - case r == 35: // ['#','#'] - return 2 - case r == 36: // ['$','$'] - return 2 - case r == 37: // ['%','%'] - return 2 - case r == 38: // ['&','&'] - return 2 - case r == 39: // [''','''] - return 2 - case r == 42: // ['*','*'] - return 2 - case r == 43: // ['+','+'] - return 2 - case r == 45: // ['-','-'] - return 2 - case r == 46: // ['.','.'] - return 4 - case r == 47: // ['/','/'] - return 2 - case 48 <= r && r <= 57: // ['0','9'] - return 2 - case r == 61: // ['=','='] - return 2 - case r == 63: // ['?','?'] - return 2 - case r == 64: // ['@','@'] - return 5 - case 65 <= r && r <= 90: // ['A','Z'] - return 2 - case r == 94: // ['^','^'] - return 2 - case r == 95: // ['_','_'] - return 2 - case r == 96: // ['`','`'] - return 2 - case 97 <= r && r <= 122: // ['a','z'] - return 2 - case r == 123: // ['{','{'] - return 2 - case r == 124: // ['|','|'] - return 2 - case r == 125: // ['}','}'] - return 2 - case r == 126: // ['~','~'] - return 2 - case 256 <= r && r <= 1114111: // [\u0100,\U0010ffff] - return 2 - } - return NoState - }, - // S3 - func(r rune) int { - switch { - case r == 92: // ['\','\'] - return 6 - default: - return 7 - } - }, - // S4 - func(r rune) int { - switch { - case r == 33: // ['!','!'] - return 8 - case r == 35: // ['#','#'] - return 8 - case r == 36: // ['$','$'] - return 8 - case r == 37: // ['%','%'] - return 8 - case r == 38: // ['&','&'] - return 8 - case r == 39: // [''','''] - return 8 - case r == 42: // ['*','*'] - return 8 - case r == 43: // ['+','+'] - return 8 - case r == 45: // ['-','-'] - return 8 - case r == 47: // ['/','/'] - return 8 - case 48 <= r && r <= 57: // ['0','9'] - return 8 - case r == 61: // ['=','='] - return 8 - case r == 63: // ['?','?'] - return 8 - case 65 <= r && r <= 90: // ['A','Z'] - return 8 - case r == 94: // ['^','^'] - return 8 - case r == 95: // ['_','_'] - return 8 - case r == 96: // ['`','`'] - return 8 - case 97 <= r && r <= 122: // ['a','z'] - return 8 - case r == 123: // ['{','{'] - return 8 - case r == 124: // ['|','|'] - return 8 - case r == 125: // ['}','}'] - return 8 - case r == 126: // ['~','~'] - return 8 - case 256 <= r && r <= 1114111: // [\u0100,\U0010ffff] - return 8 - } - return NoState - }, - // S5 - func(r rune) int { - switch { - case r == 33: // ['!','!'] - return 9 - case r == 35: // ['#','#'] - return 9 - case r == 36: // ['$','$'] - return 9 - case r == 37: // ['%','%'] - return 9 - case r == 38: // ['&','&'] - return 9 - case r == 39: // [''','''] - return 9 - case r == 42: // ['*','*'] - return 9 - case r == 43: // ['+','+'] - return 9 - case r == 45: // ['-','-'] - return 9 - case r == 47: // ['/','/'] - return 9 - case 48 <= r && r <= 57: // ['0','9'] - return 9 - case r == 61: // ['=','='] - return 9 - case r == 63: // ['?','?'] - return 9 - case 65 <= r && r <= 90: // ['A','Z'] - return 9 - case r == 94: // ['^','^'] - return 9 - case r == 95: // ['_','_'] - return 9 - case r == 96: // ['`','`'] - return 9 - case 97 <= r && r <= 122: // ['a','z'] - return 9 - case r == 123: // ['{','{'] - return 9 - case r == 124: // ['|','|'] - return 9 - case r == 125: // ['}','}'] - return 9 - case r == 126: // ['~','~'] - return 9 - case 256 <= r && r <= 1114111: // [\u0100,\U0010ffff] - return 9 - } - return NoState - }, - // S6 - func(r rune) int { - switch { - default: - return 10 - } - }, - // S7 - func(r rune) int { - switch { - case r == 34: // ['"','"'] - return 11 - case r == 92: // ['\','\'] - return 12 - default: - return 7 - } - }, - // S8 - func(r rune) int { - switch { - case r == 33: // ['!','!'] - return 8 - case r == 35: // ['#','#'] - return 8 - case r == 36: // ['$','$'] - return 8 - case r == 37: // ['%','%'] - return 8 - case r == 38: // ['&','&'] - return 8 - case r == 39: // [''','''] - return 8 - case r == 42: // ['*','*'] - return 8 - case r == 43: // ['+','+'] - return 8 - case r == 45: // ['-','-'] - return 8 - case r == 46: // ['.','.'] - return 4 - case r == 47: // ['/','/'] - return 8 - case 48 <= r && r <= 57: // ['0','9'] - return 8 - case r == 61: // ['=','='] - return 8 - case r == 63: // ['?','?'] - return 8 - case r == 64: // ['@','@'] - return 5 - case 65 <= r && r <= 90: // ['A','Z'] - return 8 - case r == 94: // ['^','^'] - return 8 - case r == 95: // ['_','_'] - return 8 - case r == 96: // ['`','`'] - return 8 - case 97 <= r && r <= 122: // ['a','z'] - return 8 - case r == 123: // ['{','{'] - return 8 - case r == 124: // ['|','|'] - return 8 - case r == 125: // ['}','}'] - return 8 - case r == 126: // ['~','~'] - return 8 - case 256 <= r && r <= 1114111: // [\u0100,\U0010ffff] - return 8 - } - return NoState - }, - // S9 - func(r rune) int { - switch { - case r == 33: // ['!','!'] - return 9 - case r == 35: // ['#','#'] - return 9 - case r == 36: // ['$','$'] - return 9 - case r == 37: // ['%','%'] - return 9 - case r == 38: // ['&','&'] - return 9 - case r == 39: // [''','''] - return 9 - case r == 42: // ['*','*'] - return 9 - case r == 43: // ['+','+'] - return 9 - case r == 45: // ['-','-'] - return 9 - case r == 46: // ['.','.'] - return 13 - case r == 47: // ['/','/'] - return 9 - case 48 <= r && r <= 57: // ['0','9'] - return 9 - case r == 61: // ['=','='] - return 9 - case r == 63: // ['?','?'] - return 9 - case 65 <= r && r <= 90: // ['A','Z'] - return 9 - case r == 94: // ['^','^'] - return 9 - case r == 95: // ['_','_'] - return 9 - case r == 96: // ['`','`'] - return 9 - case 97 <= r && r <= 122: // ['a','z'] - return 9 - case r == 123: // ['{','{'] - return 9 - case r == 124: // ['|','|'] - return 9 - case r == 125: // ['}','}'] - return 9 - case r == 126: // ['~','~'] - return 9 - case 256 <= r && r <= 1114111: // [\u0100,\U0010ffff] - return 9 - } - return NoState - }, - // S10 - func(r rune) int { - switch { - case r == 34: // ['"','"'] - return 11 - case r == 92: // ['\','\'] - return 12 - default: - return 7 - } - }, - // S11 - func(r rune) int { - switch { - case r == 64: // ['@','@'] - return 5 - } - return NoState - }, - // S12 - func(r rune) int { - switch { - default: - return 10 - } - }, - // S13 - func(r rune) int { - switch { - case r == 33: // ['!','!'] - return 14 - case r == 35: // ['#','#'] - return 14 - case r == 36: // ['$','$'] - return 14 - case r == 37: // ['%','%'] - return 14 - case r == 38: // ['&','&'] - return 14 - case r == 39: // [''','''] - return 14 - case r == 42: // ['*','*'] - return 14 - case r == 43: // ['+','+'] - return 14 - case r == 45: // ['-','-'] - return 14 - case r == 47: // ['/','/'] - return 14 - case 48 <= r && r <= 57: // ['0','9'] - return 14 - case r == 61: // ['=','='] - return 14 - case r == 63: // ['?','?'] - return 14 - case 65 <= r && r <= 90: // ['A','Z'] - return 14 - case r == 94: // ['^','^'] - return 14 - case r == 95: // ['_','_'] - return 14 - case r == 96: // ['`','`'] - return 14 - case 97 <= r && r <= 122: // ['a','z'] - return 14 - case r == 123: // ['{','{'] - return 14 - case r == 124: // ['|','|'] - return 14 - case r == 125: // ['}','}'] - return 14 - case r == 126: // ['~','~'] - return 14 - case 256 <= r && r <= 1114111: // [\u0100,\U0010ffff] - return 14 - } - return NoState - }, - // S14 - func(r rune) int { - switch { - case r == 33: // ['!','!'] - return 14 - case r == 35: // ['#','#'] - return 14 - case r == 36: // ['$','$'] - return 14 - case r == 37: // ['%','%'] - return 14 - case r == 38: // ['&','&'] - return 14 - case r == 39: // [''','''] - return 14 - case r == 42: // ['*','*'] - return 14 - case r == 43: // ['+','+'] - return 14 - case r == 45: // ['-','-'] - return 14 - case r == 46: // ['.','.'] - return 13 - case r == 47: // ['/','/'] - return 14 - case 48 <= r && r <= 57: // ['0','9'] - return 14 - case r == 61: // ['=','='] - return 14 - case r == 63: // ['?','?'] - return 14 - case 65 <= r && r <= 90: // ['A','Z'] - return 14 - case r == 94: // ['^','^'] - return 14 - case r == 95: // ['_','_'] - return 14 - case r == 96: // ['`','`'] - return 14 - case 97 <= r && r <= 122: // ['a','z'] - return 14 - case r == 123: // ['{','{'] - return 14 - case r == 124: // ['|','|'] - return 14 - case r == 125: // ['}','}'] - return 14 - case r == 126: // ['~','~'] - return 14 - case 256 <= r && r <= 1114111: // [\u0100,\U0010ffff] - return 14 - } - return NoState - }, -} diff --git a/example/mail/mail.go b/example/mail/mail.go deleted file mode 100644 index a366d111..00000000 --- a/example/mail/mail.go +++ /dev/null @@ -1,62 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package mail - -import ( - "io" - - "github.com/maxcalandrelli/gocc/example/mail/iface" - "github.com/maxcalandrelli/gocc/example/mail/internal/io/stream" - "github.com/maxcalandrelli/gocc/example/mail/internal/lexer" - "github.com/maxcalandrelli/gocc/example/mail/internal/parser" - "github.com/maxcalandrelli/gocc/example/mail/internal/token" -) - -type ( - Token = token.Token - Lexer = lexer.Lexer - Parser = parser.Parser - TokenStream = iface.TokenStream - WindowReader = stream.WindowReader - Scanner = iface.Scanner -) - -func ParseFile(fpath string) (interface{}, error, int) { - if lexer, err := NewLexerFile(fpath); err == nil { - return NewParser().Parse(lexer) - } else { - return nil, err, 0 - } -} - -func ParseText(text string) (interface{}, error, int) { - return NewParser().Parse(NewLexerBytes([]byte(text))) -} - -func NewLexerBytes(src []byte) *lexer.Lexer { - return lexer.NewLexerBytes(src) -} - -func NewLexerString(src string) *lexer.Lexer { - return lexer.NewLexerBytes([]byte(src)) -} - -func NewLexerFile(fpath string) (*lexer.Lexer, error) { - return lexer.NewLexerFile(fpath) -} - -func NewParser() *parser.Parser { - return parser.NewParser() -} - -func NewWindowReaderFromBytes(src []byte) WindowReader { - return stream.NewWindowReaderFromBytes(src) -} - -func NewWindowReader(rdr io.Reader) WindowReader { - return stream.NewWindowReader(rdr) -} - -func NewLimitedWindowReader(rdr io.Reader, sizeMin, sizeMax int) WindowReader { - return stream.NewLimitedWindowReader(rdr, sizeMin, sizeMax) -} diff --git a/example/mail/mail.grammar/mail/grammar.go b/example/mail/mail.grammar/mail/grammar.go new file mode 100644 index 00000000..f86055e2 --- /dev/null +++ b/example/mail/mail.grammar/mail/grammar.go @@ -0,0 +1,42 @@ +// Code generated by gocc; DO NOT EDIT. + +package mail + +import ( + "io" + + "github.com/maxcalandrelli/gocc/example/mail/mail.grammar/mail/internal/lexer" + "github.com/maxcalandrelli/gocc/example/mail/mail.grammar/mail/internal/token" +) + +const ( + INVALID = token.INVALID + EOF = token.EOF +) + +type ( + Token = token.Token + TokenMap = token.TokenMap + Pos = token.Pos + Lexer = lexer.Lexer +) + +func NewLexerBytes(src []byte) *lexer.Lexer { + return lexer.NewLexerBytes(src) +} + +func NewLexerString(src string) *lexer.Lexer { + return lexer.NewLexerBytes([]byte(src)) +} + +func NewLexerFile(fpath string) (*lexer.Lexer, error) { + return lexer.NewLexerFile(fpath) +} + +func NewLexer(reader io.Reader) (*lexer.Lexer, error) { + return lexer.NewLexer(reader) +} + +func GetTokenMap() TokenMap { + return token.TokMap +} diff --git a/example/nolexer/iface/iface.go b/example/mail/mail.grammar/mail/iface/mail.go similarity index 57% rename from example/nolexer/iface/iface.go rename to example/mail/mail.grammar/mail/iface/mail.go index ff6e65c1..7486e79c 100644 --- a/example/nolexer/iface/iface.go +++ b/example/mail/mail.grammar/mail/iface/mail.go @@ -3,13 +3,17 @@ package iface import ( - "github.com/maxcalandrelli/gocc/example/nolexer/internal/token" + "github.com/maxcalandrelli/gocc/example/mail/mail.grammar/mail/internal/token" "io" ) type ( + Token = token.Token + TokenMap = token.TokenMap + Pos = token.Pos + Scanner interface { - Scan() (tok *token.Token) + Scan() (tok *Token) } StreamScanner interface { @@ -31,3 +35,12 @@ type ( io.Seeker } ) + +const ( + INVALID = token.INVALID + EOF = token.EOF +) + +func GetTokenMap() TokenMap { + return token.TokMap +} diff --git a/example/mail/internal/io/stream/internal/stream_impl.go b/example/mail/mail.grammar/mail/internal/io/stream/internal/stream_impl.go similarity index 100% rename from example/mail/internal/io/stream/internal/stream_impl.go rename to example/mail/mail.grammar/mail/internal/io/stream/internal/stream_impl.go diff --git a/example/mail/internal/io/stream/internal/stream_public.go b/example/mail/mail.grammar/mail/internal/io/stream/internal/stream_public.go similarity index 100% rename from example/mail/internal/io/stream/internal/stream_public.go rename to example/mail/mail.grammar/mail/internal/io/stream/internal/stream_public.go diff --git a/example/mail/mail.grammar/mail/internal/io/stream/stream.go b/example/mail/mail.grammar/mail/internal/io/stream/stream.go new file mode 100644 index 00000000..5bca95d1 --- /dev/null +++ b/example/mail/mail.grammar/mail/internal/io/stream/stream.go @@ -0,0 +1,39 @@ +package stream + +import ( + internal "github.com/maxcalandrelli/gocc/example/mail/mail.grammar/mail/internal/io/stream/internal" + "io" +) + +type ( + WindowReader interface { + BlockSize() int + Buffered() int + Cap() int + MaxCap() int + Read([]byte) (int, error) + ReadByte() (byte, error) + ReadPosition() int64 + ReadRune() (rune, int, error) + Seek(int64, int) (int64, error) + UnreadByte() error + UnreadRune() error + MaxUnreadSize() int + } +) + +var ( + InfoPrefixRoundUp = false +) + +func NewWindowReaderFromBytes(src []byte) WindowReader { + return internal.NewWindowReader(src, nil, 0, 0, InfoPrefixRoundUp) +} + +func NewWindowReader(rdr io.Reader) WindowReader { + return internal.NewWindowReader(nil, rdr, 0, 0, false) +} + +func NewLimitedWindowReader(rdr io.Reader, sizeMin, sizeMax int) WindowReader { + return internal.NewWindowReader(nil, rdr, sizeMin, sizeMax, InfoPrefixRoundUp) +} diff --git a/example/mail/internal/lexer/acttab.go b/example/mail/mail.grammar/mail/internal/lexer/acttab.go similarity index 93% rename from example/mail/internal/lexer/acttab.go rename to example/mail/mail.grammar/mail/internal/lexer/acttab.go index d876c8f3..ca737869 100644 --- a/example/mail/internal/lexer/acttab.go +++ b/example/mail/mail.grammar/mail/internal/lexer/acttab.go @@ -5,7 +5,7 @@ package lexer import ( "fmt" - "github.com/maxcalandrelli/gocc/example/mail/internal/token" + "github.com/maxcalandrelli/gocc/example/mail/mail.grammar/mail/internal/token" ) type ActionTable [NumStates]ActionRow diff --git a/example/mail/internal/lexer/lexer.go b/example/mail/mail.grammar/mail/internal/lexer/lexer.go similarity index 71% rename from example/mail/internal/lexer/lexer.go rename to example/mail/mail.grammar/mail/internal/lexer/lexer.go index a60677fa..594bbb9f 100644 --- a/example/mail/internal/lexer/lexer.go +++ b/example/mail/mail.grammar/mail/internal/lexer/lexer.go @@ -9,9 +9,9 @@ import ( "os" - "github.com/maxcalandrelli/gocc/example/mail/iface" - "github.com/maxcalandrelli/gocc/example/mail/internal/token" - "github.com/maxcalandrelli/gocc/example/mail/internal/io/stream" + "github.com/maxcalandrelli/gocc/example/mail/mail.grammar/mail/iface" + "github.com/maxcalandrelli/gocc/example/mail/mail.grammar/mail/internal/token" + "github.com/maxcalandrelli/gocc/example/mail/mail.grammar/mail/internal/io/stream" ) const ( @@ -37,6 +37,10 @@ func NewLexerBytes(src []byte) *Lexer { return lexer } +func NewLexerString(src string) *Lexer { + return NewLexerBytes([]byte(src)) +} + func NewLexerFile(fpath string) (*Lexer, error) { s, err := os.Open(fpath) if err != nil { @@ -66,11 +70,18 @@ func (l Lexer) GetStream() iface.TokenStream { type checkPoint int64 +func (c checkPoint) value () int64 { + return int64(c) +} + func (c checkPoint) DistanceFrom (o iface.CheckPoint) int { - return int (c - o.(checkPoint)) + return int (c.value() - o.(checkPoint).value()) } -func (l Lexer) GetCheckPoint() iface.CheckPoint { +func (l *Lexer) GetCheckPoint() iface.CheckPoint { + if l == nil { + return checkPoint(0) + } pos, _ := l.stream.Seek(0, io.SeekCurrent) return checkPoint(pos) } @@ -99,17 +110,17 @@ func (l *Lexer) Scan() (tok *token.Token) { } state = nextState if state != -1 { - switch curr { - case '\n': - l.position.Pos.Line++ - l.position.Pos.Column = 1 - case '\r': - l.position.Pos.Column = 1 - case '\t': - l.position.Pos.Column += 4 - default: - l.position.Pos.Column++ - } + switch curr { + case '\n': + l.position.Pos.Line++ + l.position.Pos.Column = 1 + case '\r': + l.position.Pos.Column = 1 + case '\t': + l.position.Pos.Column += 4 + default: + l.position.Pos.Column++ + } switch { case ActTab[state].Accept != -1: tok.Type = ActTab[state].Accept @@ -119,8 +130,12 @@ func (l *Lexer) Scan() (tok *token.Token) { state = 0 tok.Lit = []byte{} } - } else if curr != INVALID_RUNE { - l.stream.UnreadRune() + } else if curr != INVALID_RUNE{ + if len(tok.Lit) == 0 { + tok.Lit = append(tok.Lit, string(curr)...) + } else { + l.stream.UnreadRune() + } } if err == io.EOF && len(tok.Lit)==0 { tok.Type = token.EOF diff --git a/example/mail/internal/lexer/transitiontable.go b/example/mail/mail.grammar/mail/internal/lexer/transitiontable.go similarity index 100% rename from example/mail/internal/lexer/transitiontable.go rename to example/mail/mail.grammar/mail/internal/lexer/transitiontable.go diff --git a/example/mail/internal/token/token.go b/example/mail/mail.grammar/mail/internal/token/token.go similarity index 96% rename from example/mail/internal/token/token.go rename to example/mail/mail.grammar/mail/internal/token/token.go index cefacb55..3d696bdc 100644 --- a/example/mail/internal/token/token.go +++ b/example/mail/mail.grammar/mail/internal/token/token.go @@ -48,6 +48,7 @@ func (p Pos) StartingFrom(base Pos) Pos { type TokenMap struct { typeMap []string idMap map[string]Type + litMap map[string]Type } func (m TokenMap) Id(tok Type) string { @@ -84,4 +85,6 @@ var TokMap = TokenMap{ "Ω": 1, "addrspec": 2, }, + + litMap: map[string]Type{}, } diff --git a/example/calc/util/litconv.go b/example/mail/mail.grammar/mail/internal/util/litconv.go similarity index 100% rename from example/calc/util/litconv.go rename to example/mail/mail.grammar/mail/internal/util/litconv.go diff --git a/example/calc/util/rune.go b/example/mail/mail.grammar/mail/internal/util/rune.go similarity index 100% rename from example/calc/util/rune.go rename to example/mail/mail.grammar/mail/internal/util/rune.go diff --git a/example/mail/main/main.go b/example/mail/main/main.go deleted file mode 100644 index 6a8a9ef4..00000000 --- a/example/mail/main/main.go +++ /dev/null @@ -1,53 +0,0 @@ -package main - -import ( - "flag" - "fmt" - "os" - "strings" - - mail "github.com/maxcalandrelli/gocc/example/mail" -) - -func showResult(r interface{}, e error, l int) { - if e != nil { - fmt.Fprintf(os.Stderr, "parsing returned the following error: %s\n", e.Error()) - } else { - fmt.Printf("r=%#v, %d bytes\n", r, l) - } -} - -var ( - File string - Text string - Longest bool -) - -func parse(longest bool, lex *mail.Lexer) (res interface{}, err error, ptl int) { - if longest { - return mail.NewParser().ParseLongestPrefix(lex) - } else { - return mail.NewParser().Parse(lex) - } - return -} - -func main() { - flag.StringVar(&File, "file", "", "parse also text in file") - flag.StringVar(&Text, "text", "", "parse also text given with flag") - flag.BoolVar(&Longest, "longest", false, "parse longest possible part") - flag.Parse() - if Text > "" { - showResult(parse(Longest, mail.NewLexerString(Text))) - } - if File > "" { - l, e := mail.NewLexerFile(File) - if e != nil { - panic(e) - } - showResult(parse(Longest, l)) - } - if str := strings.Join(flag.Args(), " "); str > "" { - showResult(parse(Longest, mail.NewLexerString(str))) - } -} diff --git a/example/mail/parser_test.go b/example/mail/parser_test.go index b6c53596..5c478df4 100644 --- a/example/mail/parser_test.go +++ b/example/mail/parser_test.go @@ -2,9 +2,7 @@ package mail import ( "testing" - - "github.com/maxcalandrelli/gocc/example/mail/lexer" - "github.com/maxcalandrelli/gocc/example/mail/token" + "github.com/maxcalandrelli/gocc/example/mail/mail.grammar/mail" ) var testData1 = map[string]bool{ @@ -16,14 +14,14 @@ var testData1 = map[string]bool{ func Test1(t *testing.T) { for input, ok := range testData1 { - l := lexer.NewLexer([]byte(input)) + l := mail.NewLexerString(input) tok := l.Scan() switch { - case tok.Type == token.INVALID: + case tok.Type == mail.INVALID: if ok { t.Errorf("%s", input) } - case tok.Type == token.TokMap.Type("addrspec"): + case tok.Type == mail.GetTokenMap().Type("addrspec"): if !ok { t.Errorf("%s", input) } @@ -46,9 +44,9 @@ var testData2 = ` ` func Test2(t *testing.T) { - l := lexer.NewLexer([]byte(testData2)) + l := mail.NewLexerString(testData2) num := 0 - for tok := l.Scan(); tok.Type == token.TokMap.Type("addrspec"); tok = l.Scan() { + for tok := l.Scan(); tok.Type == mail.GetTokenMap().Type("addrspec"); tok = l.Scan() { if string(tok.Lit) != checkData2[num] { t.Errorf("%s != %s", string(tok.Lit), checkData2[num]) } diff --git a/example/mail/token/token.go b/example/mail/token/token.go deleted file mode 100644 index 507c565f..00000000 --- a/example/mail/token/token.go +++ /dev/null @@ -1,72 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package token - -import ( - "fmt" -) - -type Token struct { - Type - Lit []byte - Pos -} - -type Type int - -const ( - INVALID Type = iota - EOF -) - -type Pos struct { - Offset int - Line int - Column int -} - -func (p Pos) String() string { - return fmt.Sprintf("Pos(offset=%d, line=%d, column=%d)", p.Offset, p.Line, p.Column) -} - -type TokenMap struct { - typeMap []string - idMap map[string]Type -} - -func (m TokenMap) Id(tok Type) string { - if int(tok) < len(m.typeMap) { - return m.typeMap[tok] - } - return "unknown" -} - -func (m TokenMap) Type(tok string) Type { - if typ, exist := m.idMap[tok]; exist { - return typ - } - return INVALID -} - -func (m TokenMap) TokenString(tok *Token) string { - //TODO: refactor to print pos & token string properly - return fmt.Sprintf("%s(%d,%s)", m.Id(tok.Type), tok.Type, tok.Lit) -} - -func (m TokenMap) StringType(typ Type) string { - return fmt.Sprintf("%s(%d)", m.Id(typ), typ) -} - -var TokMap = TokenMap{ - typeMap: []string{ - "INVALID", - "$", - "addrspec", - }, - - idMap: map[string]Type{ - "INVALID": 0, - "$": 1, - "addrspec": 2, - }, -} diff --git a/example/mail/util/litconv.go b/example/mail/util/litconv.go deleted file mode 100644 index 1aeb6166..00000000 --- a/example/mail/util/litconv.go +++ /dev/null @@ -1,108 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package util - -import ( - "fmt" - "strconv" - "unicode" - "unicode/utf8" -) - -/* Interface */ - -/* -Convert the literal value of a scanned token to rune -*/ -func RuneValue(lit []byte) rune { - if lit[1] == '\\' { - return escapeCharVal(lit) - } - r, size := utf8.DecodeRune(lit[1:]) - if size != len(lit)-2 { - panic(fmt.Sprintf("Error decoding rune. Lit: %s, rune: %d, size%d\n", lit, r, size)) - } - return r -} - -/* -Convert the literal value of a scanned token to int64 -*/ -func IntValue(lit []byte) (int64, error) { - return strconv.ParseInt(string(lit), 10, 64) -} - -/* -Convert the literal value of a scanned token to uint64 -*/ -func UintValue(lit []byte) (uint64, error) { - return strconv.ParseUint(string(lit), 10, 64) -} - -/* Util */ - -func escapeCharVal(lit []byte) rune { - var i, base, max uint32 - offset := 2 - switch lit[offset] { - case 'a': - return '\a' - case 'b': - return '\b' - case 'f': - return '\f' - case 'n': - return '\n' - case 'r': - return '\r' - case 't': - return '\t' - case 'v': - return '\v' - case '\\': - return '\\' - case '\'': - return '\'' - case '0', '1', '2', '3', '4', '5', '6', '7': - i, base, max = 3, 8, 255 - case 'x': - i, base, max = 2, 16, 255 - offset++ - case 'u': - i, base, max = 4, 16, unicode.MaxRune - offset++ - case 'U': - i, base, max = 8, 16, unicode.MaxRune - offset++ - default: - panic(fmt.Sprintf("Error decoding character literal: %s\n", lit)) - } - - var x uint32 - for ; i > 0 && offset < len(lit)-1; i-- { - ch, size := utf8.DecodeRune(lit[offset:]) - offset += size - d := uint32(digitVal(ch)) - if d >= base { - panic(fmt.Sprintf("charVal(%s): illegal character (%c) in escape sequence. size=%d, offset=%d", lit, ch, size, offset)) - } - x = x*base + d - } - if x > max || 0xD800 <= x && x < 0xE000 { - panic(fmt.Sprintf("Error decoding escape char value. Lit:%s, offset:%d, escape sequence is invalid Unicode code point\n", lit, offset)) - } - - return rune(x) -} - -func digitVal(ch rune) int { - switch { - case '0' <= ch && ch <= '9': - return int(ch) - '0' - case 'a' <= ch && ch <= 'f': - return int(ch) - 'a' + 10 - case 'A' <= ch && ch <= 'F': - return int(ch) - 'A' + 10 - } - return 16 // larger than any legal digit val -} diff --git a/example/mail/util/rune.go b/example/mail/util/rune.go deleted file mode 100644 index bd8523a4..00000000 --- a/example/mail/util/rune.go +++ /dev/null @@ -1,39 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package util - -import ( - "fmt" -) - -func RuneToString(r rune) string { - if r >= 0x20 && r < 0x7f { - return fmt.Sprintf("'%c'", r) - } - switch r { - case 0x07: - return "'\\a'" - case 0x08: - return "'\\b'" - case 0x0C: - return "'\\f'" - case 0x0A: - return "'\\n'" - case 0x0D: - return "'\\r'" - case 0x09: - return "'\\t'" - case 0x0b: - return "'\\v'" - case 0x5c: - return "'\\\\\\'" - case 0x27: - return "'\\''" - case 0x22: - return "'\\\"'" - } - if r < 0x10000 { - return fmt.Sprintf("\\u%04x", r) - } - return fmt.Sprintf("\\U%08x", r) -} diff --git a/example/nolexer/internal/errors/errors.go b/example/nolexer/internal/errors/errors.go deleted file mode 100644 index 2992ec3f..00000000 --- a/example/nolexer/internal/errors/errors.go +++ /dev/null @@ -1,56 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package errors - -import ( - "fmt" - "strings" - - "github.com/maxcalandrelli/gocc/example/nolexer/internal/token" -) - -type ErrorSymbol interface { -} - -type Error struct { - Err error - ErrorToken *token.Token - ErrorSymbols []ErrorSymbol - ExpectedTokens []string - StackTop int -} - -func (e *Error) String() string { - w := new(strings.Builder) - fmt.Fprintf(w, "Error") - if e.Err != nil { - fmt.Fprintf(w, " %s\n", e.Err) - } else { - fmt.Fprintf(w, "\n") - } - fmt.Fprintf(w, "Token: type=%d, lit=%s\n", e.ErrorToken.Type, e.ErrorToken.Lit) - fmt.Fprintf(w, "Pos: offset=%d, line=%d, column=%d\n", e.ErrorToken.Pos.Offset, e.ErrorToken.Pos.Line, e.ErrorToken.Pos.Column) - fmt.Fprintf(w, "Expected one of: ") - for _, sym := range e.ExpectedTokens { - fmt.Fprintf(w, "%s ", sym) - } - fmt.Fprintf(w, "ErrorSymbol:\n") - for _, sym := range e.ErrorSymbols { - fmt.Fprintf(w, "%v\n", sym) - } - return w.String() -} - -func (e *Error) Error() string { - w := new(strings.Builder) - fmt.Fprintf(w, "Error in S%d: %s, %s", e.StackTop, token.TokMap.TokenString(e.ErrorToken), e.ErrorToken.Pos.String()) - if e.Err != nil { - fmt.Fprintf(w, ": %+v", e.Err) - } else { - fmt.Fprintf(w, ", expected one of: ") - for _, expected := range e.ExpectedTokens { - fmt.Fprintf(w, "%s ", expected) - } - } - return w.String() -} diff --git a/example/nolexer/internal/io/stream/stream.go b/example/nolexer/internal/io/stream/stream.go deleted file mode 100644 index ef4dad2a..00000000 --- a/example/nolexer/internal/io/stream/stream.go +++ /dev/null @@ -1,39 +0,0 @@ -package stream - -import ( - internal "github.com/maxcalandrelli/gocc/example/nolexer/internal/io/stream/internal" - "io" -) - -type ( - WindowReader interface { - BlockSize() int - Buffered() int - Cap() int - MaxCap() int - Read([]byte) (int, error) - ReadByte() (byte, error) - ReadPosition() int64 - ReadRune() (rune, int, error) - Seek(int64, int) (int64, error) - UnreadByte() error - UnreadRune() error - MaxUnreadSize() int - } -) - -var ( - InfoPrefixRoundUp = false -) - -func NewWindowReaderFromBytes(src []byte) WindowReader { - return internal.NewWindowReader(src, nil, 0, 0, InfoPrefixRoundUp) -} - -func NewWindowReader(rdr io.Reader) WindowReader { - return internal.NewWindowReader(nil, rdr, 0, 0, false) -} - -func NewLimitedWindowReader(rdr io.Reader, sizeMin, sizeMax int) WindowReader { - return internal.NewWindowReader(nil, rdr, sizeMin, sizeMax, InfoPrefixRoundUp) -} diff --git a/example/nolexer/internal/parser/action.go b/example/nolexer/internal/parser/action.go deleted file mode 100644 index 54bc55e9..00000000 --- a/example/nolexer/internal/parser/action.go +++ /dev/null @@ -1,51 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package parser - -import ( - "fmt" -) - -type action interface { - act() - String() string -} - -type ( - accept bool - shift int // value is next state index - reduce int // value is production index -) - -func (this accept) act() {} -func (this shift) act() {} -func (this reduce) act() {} - -func (this accept) Equal(that action) bool { - if _, ok := that.(accept); ok { - return true - } - return false -} - -func (this reduce) Equal(that action) bool { - that1, ok := that.(reduce) - if !ok { - return false - } - return this == that1 -} - -func (this shift) Equal(that action) bool { - that1, ok := that.(shift) - if !ok { - return false - } - return this == that1 -} - -func (this accept) String() string { return "accept(0)" } -func (this shift) String() string { return fmt.Sprintf("shift:%d", this) } -func (this reduce) String() string { - return fmt.Sprintf("reduce:%d(%s)", this, productionsTable[this].String) -} diff --git a/example/nolexer/internal/parser/parser.go b/example/nolexer/internal/parser/parser.go deleted file mode 100644 index a72e1e7c..00000000 --- a/example/nolexer/internal/parser/parser.go +++ /dev/null @@ -1,298 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package parser - -import ( - "errors" - "fmt" - "strings" - - "github.com/maxcalandrelli/gocc/example/nolexer/iface" - parseError "github.com/maxcalandrelli/gocc/example/nolexer/internal/errors" - "github.com/maxcalandrelli/gocc/example/nolexer/internal/token" -) - -const ( - numProductions = 4 - numStates = 6 - numSymbols = 8 -) - -// Stack - -type stack struct { - state []int - attrib []Attrib -} - -const INITIAL_STACK_SIZE = 100 - -func newStack() *stack { - return &stack{ - state: make([]int, 0, INITIAL_STACK_SIZE), - attrib: make([]Attrib, 0, INITIAL_STACK_SIZE), - } -} - -func (s *stack) reset() { - s.state = s.state[:0] - s.attrib = s.attrib[:0] -} - -func (s *stack) push(state int, a Attrib) { - s.state = append(s.state, state) - s.attrib = append(s.attrib, a) -} - -func (s *stack) top() int { - return s.state[len(s.state)-1] -} - -func (s *stack) peek(pos int) int { - return s.state[pos] -} - -func (s *stack) topIndex() int { - return len(s.state) - 1 -} - -func (s *stack) popN(items int) []Attrib { - lo, hi := len(s.state)-items, len(s.state) - - attrib := s.attrib[lo:hi] - - s.state = s.state[:lo] - s.attrib = s.attrib[:lo] - - return attrib -} - -func (s *stack) String() string { - w := new(strings.Builder) - fmt.Fprintf(w, "stack:\n") - for i, st := range s.state { - fmt.Fprintf(w, "\t%d: %d , ", i, st) - if s.attrib[i] == nil { - fmt.Fprintf(w, "nil") - } else { - switch attr := s.attrib[i].(type) { - case *token.Token: - fmt.Fprintf(w, "%s", attr.Lit) - default: - fmt.Fprintf(w, "%v", attr) - } - } - fmt.Fprintf(w, "\n") - } - return w.String() -} - -// Parser - -type Parser struct { - stack *stack - nextToken *token.Token - userContext interface{} -} - -type TokenStream = iface.TokenStream - -func NewParser() *Parser { - return NewParserWithContext(nil) -} - -func NewParserWithContext(u interface{}) *Parser { - p := &Parser{stack: newStack(), userContext: u} - p.Reset() - return p -} - -func (p *Parser) Reset() { - p.stack.reset() - p.stack.push(0, nil) -} - -func (p *Parser) Error(err error, scanner iface.Scanner) (recovered bool, errorAttrib *parseError.Error) { - errorAttrib = &parseError.Error{ - Err: err, - ErrorToken: p.nextToken, - ErrorSymbols: p.popNonRecoveryStates(), - ExpectedTokens: make([]string, 0, 8), - } - for t, action := range parserActions.table[p.stack.top()].actions { - if action != nil { - errorAttrib.ExpectedTokens = append(errorAttrib.ExpectedTokens, token.TokMap.Id(token.Type(t))) - } - } - - if action := parserActions.table[p.stack.top()].actions[token.TokMap.Type("error")]; action != nil { - p.stack.push(int(action.(shift)), errorAttrib) // action can only be shift - } else { - return - } - - if action := parserActions.table[p.stack.top()].actions[p.nextToken.Type]; action != nil { - recovered = true - } - for !recovered && p.nextToken.Type != token.EOF { - p.nextToken = scanner.Scan() - if action := parserActions.table[p.stack.top()].actions[p.nextToken.Type]; action != nil { - recovered = true - } - } - - return -} - -func (p *Parser) popNonRecoveryStates() (removedAttribs []parseError.ErrorSymbol) { - if rs, ok := p.firstRecoveryState(); ok { - errorSymbols := p.stack.popN(p.stack.topIndex() - rs) - removedAttribs = make([]parseError.ErrorSymbol, len(errorSymbols)) - for i, e := range errorSymbols { - removedAttribs[i] = e - } - } else { - removedAttribs = []parseError.ErrorSymbol{} - } - return -} - -// recoveryState points to the highest state on the stack, which can recover -func (p *Parser) firstRecoveryState() (recoveryState int, canRecover bool) { - recoveryState, canRecover = p.stack.topIndex(), parserActions.table[p.stack.top()].canRecover - for recoveryState > 0 && !canRecover { - recoveryState-- - canRecover = parserActions.table[p.stack.peek(recoveryState)].canRecover - } - return -} - -func (p *Parser) newError(err error) error { - e := &parseError.Error{ - Err: err, - StackTop: p.stack.top(), - ErrorToken: p.nextToken, - } - actRow := parserActions.table[p.stack.top()] - for i, t := range actRow.actions { - if t != nil { - e.ExpectedTokens = append(e.ExpectedTokens, token.TokMap.Id(token.Type(i))) - } - } - return e -} - -func (p *Parser) Parse(scanner iface.Scanner) (res interface{}, err error, ptl int) { - return p.parse(scanner, false) -} - -func (p *Parser) ParseLongestPrefix(scanner iface.Scanner) (res interface{}, err error, ptl int) { - return p.parse(scanner, true) -} - -var errNotRepositionable = errors.New("scanner not repositionable") - -func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, err error, ptl int) { - var ( - tokens iface.CheckPointable - afterPos iface.CheckPoint - checkPoint iface.CheckPoint - ) - readNextToken := func() error { - if tokens == nil && (len(parserActions.table[p.stack.top()].cdActions) > 0 || longest) { - return errNotRepositionable - } - checkPoint = tokens.GetCheckPoint() - p.nextToken = scanner.Scan() - if longest { - afterPos = tokens.GetCheckPoint() - } - return nil - } - p.Reset() - tokens, _ = scanner.(iface.CheckPointable) - startCp := tokens.GetCheckPoint() - if err := readNextToken(); err != nil { - return nil, err, tokens.GetCheckPoint().DistanceFrom(startCp) - } - for acc := false; !acc; { - action := parserActions.table[p.stack.top()].actions[p.nextToken.Type] - if action == nil { - // - // If no action, check if we have some context dependent parsing to try - // - if streamScanner, _ := scanner.(iface.StreamScanner); streamScanner != nil { - underlyingStream := streamScanner.GetStream() - for _, cdAction := range parserActions.table[p.stack.top()].cdActions { - tokens.GotoCheckPoint(checkPoint) - cd_res, cd_err, cd_parsed := cdAction.tokenScanner(underlyingStream, p.userContext) - if cd_err == nil && len(cd_parsed) > 0 { - action = parserActions.table[p.stack.top()].actions[cdAction.tokenIndex] - if action != nil { - p.nextToken.Foreign = true - p.nextToken.ForeignAstNode = cd_res - p.nextToken.Lit = cd_parsed - p.nextToken.Type = token.Type(cdAction.tokenIndex) - break - } - } - } - } - } - // - // Still no action? If a longest possible parsing is requested in place - // of a full text, we should try to check if an EOF here would have led - // to a successful parsing instead - // Rember that token.EOF is 1, that is the index of SyntaxEof into symbol table - // Dirty, dirty, dirty... but I found it as it is, and I prefer not to touch - // - if action == nil && longest { - tokens.GotoCheckPoint(checkPoint) - action = parserActions.table[p.stack.top()].actions[token.EOF] - if action == nil { - // - // ok, let's consume the token then - // - tokens.GotoCheckPoint(afterPos) - } - } - - // - // Well, no action is no action after all... - // - if action == nil { - if recovered, errAttrib := p.Error(nil, scanner); !recovered { - p.nextToken = errAttrib.ErrorToken - return nil, p.newError(nil), tokens.GetCheckPoint().DistanceFrom(startCp) - } - if action = parserActions.table[p.stack.top()].actions[p.nextToken.Type]; action == nil { - panic("Error recovery led to invalid action") - } - } - - switch act := action.(type) { - case accept: - res = p.stack.popN(1)[0] - acc = true - case shift: - p.stack.push(int(act), p.nextToken) - if p.nextToken.Foreign { - p.stack.push(int(act), p.nextToken.ForeignAstNode) - } - if err := readNextToken(); err != nil { - return nil, err, tokens.GetCheckPoint().DistanceFrom(startCp) - } - case reduce: - prod := productionsTable[int(act)] - attrib, err := prod.ReduceFunc(p.userContext, p.stack.popN(prod.NumSymbols)) - if err != nil { - return nil, p.newError(err), tokens.GetCheckPoint().DistanceFrom(startCp) - } else { - p.stack.push(gotoTab[p.stack.top()][prod.NTType], attrib) - } - default: - panic("unknown action: " + action.String()) - } - } - return res, nil, tokens.GetCheckPoint().DistanceFrom(startCp) -} diff --git a/example/nolexer/internal/util/litconv.go b/example/nolexer/internal/util/litconv.go deleted file mode 100644 index 1aeb6166..00000000 --- a/example/nolexer/internal/util/litconv.go +++ /dev/null @@ -1,108 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package util - -import ( - "fmt" - "strconv" - "unicode" - "unicode/utf8" -) - -/* Interface */ - -/* -Convert the literal value of a scanned token to rune -*/ -func RuneValue(lit []byte) rune { - if lit[1] == '\\' { - return escapeCharVal(lit) - } - r, size := utf8.DecodeRune(lit[1:]) - if size != len(lit)-2 { - panic(fmt.Sprintf("Error decoding rune. Lit: %s, rune: %d, size%d\n", lit, r, size)) - } - return r -} - -/* -Convert the literal value of a scanned token to int64 -*/ -func IntValue(lit []byte) (int64, error) { - return strconv.ParseInt(string(lit), 10, 64) -} - -/* -Convert the literal value of a scanned token to uint64 -*/ -func UintValue(lit []byte) (uint64, error) { - return strconv.ParseUint(string(lit), 10, 64) -} - -/* Util */ - -func escapeCharVal(lit []byte) rune { - var i, base, max uint32 - offset := 2 - switch lit[offset] { - case 'a': - return '\a' - case 'b': - return '\b' - case 'f': - return '\f' - case 'n': - return '\n' - case 'r': - return '\r' - case 't': - return '\t' - case 'v': - return '\v' - case '\\': - return '\\' - case '\'': - return '\'' - case '0', '1', '2', '3', '4', '5', '6', '7': - i, base, max = 3, 8, 255 - case 'x': - i, base, max = 2, 16, 255 - offset++ - case 'u': - i, base, max = 4, 16, unicode.MaxRune - offset++ - case 'U': - i, base, max = 8, 16, unicode.MaxRune - offset++ - default: - panic(fmt.Sprintf("Error decoding character literal: %s\n", lit)) - } - - var x uint32 - for ; i > 0 && offset < len(lit)-1; i-- { - ch, size := utf8.DecodeRune(lit[offset:]) - offset += size - d := uint32(digitVal(ch)) - if d >= base { - panic(fmt.Sprintf("charVal(%s): illegal character (%c) in escape sequence. size=%d, offset=%d", lit, ch, size, offset)) - } - x = x*base + d - } - if x > max || 0xD800 <= x && x < 0xE000 { - panic(fmt.Sprintf("Error decoding escape char value. Lit:%s, offset:%d, escape sequence is invalid Unicode code point\n", lit, offset)) - } - - return rune(x) -} - -func digitVal(ch rune) int { - switch { - case '0' <= ch && ch <= '9': - return int(ch) - '0' - case 'a' <= ch && ch <= 'f': - return int(ch) - 'a' + 10 - case 'A' <= ch && ch <= 'F': - return int(ch) - 'A' + 10 - } - return 16 // larger than any legal digit val -} diff --git a/example/nolexer/internal/util/rune.go b/example/nolexer/internal/util/rune.go deleted file mode 100644 index bd8523a4..00000000 --- a/example/nolexer/internal/util/rune.go +++ /dev/null @@ -1,39 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package util - -import ( - "fmt" -) - -func RuneToString(r rune) string { - if r >= 0x20 && r < 0x7f { - return fmt.Sprintf("'%c'", r) - } - switch r { - case 0x07: - return "'\\a'" - case 0x08: - return "'\\b'" - case 0x0C: - return "'\\f'" - case 0x0A: - return "'\\n'" - case 0x0D: - return "'\\r'" - case 0x09: - return "'\\t'" - case 0x0b: - return "'\\v'" - case 0x5c: - return "'\\\\\\'" - case 0x27: - return "'\\''" - case 0x22: - return "'\\\"'" - } - if r < 0x10000 { - return fmt.Sprintf("\\u%04x", r) - } - return fmt.Sprintf("\\U%08x", r) -} diff --git a/example/nolexer/nolexer.bnf b/example/nolexer/nolexer.bnf index b7445aa2..b387f0c7 100644 --- a/example/nolexer/nolexer.bnf +++ b/example/nolexer/nolexer.bnf @@ -2,7 +2,7 @@ import ( "fmt" - "github.com/maxcalandrelli/gocc/example/nolexer/internal/token" + "github.com/maxcalandrelli/gocc/example/nolexer/nolexer.grammar/nolexer/internal/token" ) >> diff --git a/example/nolexer/nolexer.grammar/nolexer/grammar.go b/example/nolexer/nolexer.grammar/nolexer/grammar.go new file mode 100644 index 00000000..73cb5264 --- /dev/null +++ b/example/nolexer/nolexer.grammar/nolexer/grammar.go @@ -0,0 +1,31 @@ +// Code generated by gocc; DO NOT EDIT. + +package nolexer + +import ( + "github.com/maxcalandrelli/gocc/example/nolexer/nolexer.grammar/nolexer/internal/errors" + "github.com/maxcalandrelli/gocc/example/nolexer/nolexer.grammar/nolexer/internal/parser" + "github.com/maxcalandrelli/gocc/example/nolexer/nolexer.grammar/nolexer/internal/token" +) + +const ( + INVALID = token.INVALID + EOF = token.EOF +) + +type ( + Token = token.Token + TokenMap = token.TokenMap + Pos = token.Pos + ErrorSymbol = errors.ErrorSymbol + Error = errors.Error + Parser = parser.Parser +) + +func NewParser() *parser.Parser { + return parser.NewParser() +} + +func GetTokenMap() TokenMap { + return token.TokMap +} diff --git a/example/nolexer/nolexer.grammar/nolexer/iface/nolexer.go b/example/nolexer/nolexer.grammar/nolexer/iface/nolexer.go new file mode 100644 index 00000000..3c417178 --- /dev/null +++ b/example/nolexer/nolexer.grammar/nolexer/iface/nolexer.go @@ -0,0 +1,49 @@ +// Code generated by gocc; DO NOT EDIT. + +package iface + +import ( + "github.com/maxcalandrelli/gocc/example/nolexer/nolexer.grammar/nolexer/internal/errors" + "github.com/maxcalandrelli/gocc/example/nolexer/nolexer.grammar/nolexer/internal/token" + "io" +) + +type ( + Token = token.Token + TokenMap = token.TokenMap + Pos = token.Pos + ErrorSymbol = errors.ErrorSymbol + Error = errors.Error + + Scanner interface { + Scan() (tok *Token) + } + + StreamScanner interface { + GetStream() TokenStream + } + + CheckPoint interface { + DistanceFrom(CheckPoint) int + } + + CheckPointable interface { + GetCheckPoint() CheckPoint + GotoCheckPoint(CheckPoint) + } + + TokenStream interface { + io.Reader + io.RuneScanner + io.Seeker + } +) + +const ( + INVALID = token.INVALID + EOF = token.EOF +) + +func GetTokenMap() TokenMap { + return token.TokMap +} diff --git a/example/nolexer/nolexer.grammar/nolexer/internal/errors/errors.go b/example/nolexer/nolexer.grammar/nolexer/internal/errors/errors.go new file mode 100644 index 00000000..49ca2da2 --- /dev/null +++ b/example/nolexer/nolexer.grammar/nolexer/internal/errors/errors.go @@ -0,0 +1,56 @@ +// Code generated by gocc; DO NOT EDIT. + +package errors + +import ( + "fmt" + "strings" + + "github.com/maxcalandrelli/gocc/example/nolexer/nolexer.grammar/nolexer/internal/token" +) + +type ErrorSymbol interface { +} + +type Error struct { + Err error + ErrorToken *token.Token + ErrorSymbols []ErrorSymbol + ExpectedTokens []string + StackTop int +} + +func (e *Error) String() string { + w := new(strings.Builder) + fmt.Fprintf(w, "Error") + if e.Err != nil { + fmt.Fprintf(w, " %s\n", e.Err) + } else { + fmt.Fprintf(w, "\n") + } + fmt.Fprintf(w, "Token: type=%d, lit=%s\n", e.ErrorToken.Type, e.ErrorToken.Lit) + fmt.Fprintf(w, "Pos: offset=%d, line=%d, column=%d\n", e.ErrorToken.Pos.Offset, e.ErrorToken.Pos.Line, e.ErrorToken.Pos.Column) + fmt.Fprintf(w, "Expected one of: ") + for _, sym := range e.ExpectedTokens { + fmt.Fprintf(w, "%s ", sym) + } + fmt.Fprintf(w, "ErrorSymbol:\n") + for _, sym := range e.ErrorSymbols { + fmt.Fprintf(w, "%v\n", sym) + } + return w.String() +} + +func (e *Error) Error() string { + w := new(strings.Builder) + fmt.Fprintf(w, "Error in S%d: %s, %s", e.StackTop, token.TokMap.TokenString(e.ErrorToken), e.ErrorToken.Pos.String()) + if e.Err != nil { + fmt.Fprintf(w, ": %+v", e.Err) + } else { + fmt.Fprintf(w, ", expected one of: ") + for _, expected := range e.ExpectedTokens { + fmt.Fprintf(w, "%s ", expected) + } + } + return w.String() +} diff --git a/example/nolexer/internal/io/stream/internal/stream_impl.go b/example/nolexer/nolexer.grammar/nolexer/internal/io/stream/internal/stream_impl.go similarity index 100% rename from example/nolexer/internal/io/stream/internal/stream_impl.go rename to example/nolexer/nolexer.grammar/nolexer/internal/io/stream/internal/stream_impl.go diff --git a/example/nolexer/internal/io/stream/internal/stream_public.go b/example/nolexer/nolexer.grammar/nolexer/internal/io/stream/internal/stream_public.go similarity index 100% rename from example/nolexer/internal/io/stream/internal/stream_public.go rename to example/nolexer/nolexer.grammar/nolexer/internal/io/stream/internal/stream_public.go diff --git a/example/nolexer/nolexer.grammar/nolexer/internal/io/stream/stream.go b/example/nolexer/nolexer.grammar/nolexer/internal/io/stream/stream.go new file mode 100644 index 00000000..2ab99c38 --- /dev/null +++ b/example/nolexer/nolexer.grammar/nolexer/internal/io/stream/stream.go @@ -0,0 +1,39 @@ +package stream + +import ( + internal "github.com/maxcalandrelli/gocc/example/nolexer/nolexer.grammar/nolexer/internal/io/stream/internal" + "io" +) + +type ( + WindowReader interface { + BlockSize() int + Buffered() int + Cap() int + MaxCap() int + Read([]byte) (int, error) + ReadByte() (byte, error) + ReadPosition() int64 + ReadRune() (rune, int, error) + Seek(int64, int) (int64, error) + UnreadByte() error + UnreadRune() error + MaxUnreadSize() int + } +) + +var ( + InfoPrefixRoundUp = false +) + +func NewWindowReaderFromBytes(src []byte) WindowReader { + return internal.NewWindowReader(src, nil, 0, 0, InfoPrefixRoundUp) +} + +func NewWindowReader(rdr io.Reader) WindowReader { + return internal.NewWindowReader(nil, rdr, 0, 0, false) +} + +func NewLimitedWindowReader(rdr io.Reader, sizeMin, sizeMax int) WindowReader { + return internal.NewWindowReader(nil, rdr, sizeMin, sizeMax, InfoPrefixRoundUp) +} diff --git a/example/calc/parser/action.go b/example/nolexer/nolexer.grammar/nolexer/internal/parser/action.go similarity index 100% rename from example/calc/parser/action.go rename to example/nolexer/nolexer.grammar/nolexer/internal/parser/action.go diff --git a/example/nolexer/internal/parser/actiontable.go b/example/nolexer/nolexer.grammar/nolexer/internal/parser/actiontable.go similarity index 100% rename from example/nolexer/internal/parser/actiontable.go rename to example/nolexer/nolexer.grammar/nolexer/internal/parser/actiontable.go diff --git a/example/nolexer/internal/parser/gototable.go b/example/nolexer/nolexer.grammar/nolexer/internal/parser/gototable.go similarity index 100% rename from example/nolexer/internal/parser/gototable.go rename to example/nolexer/nolexer.grammar/nolexer/internal/parser/gototable.go diff --git a/example/nolexer/nolexer.grammar/nolexer/internal/parser/parser.go b/example/nolexer/nolexer.grammar/nolexer/internal/parser/parser.go new file mode 100644 index 00000000..5c3f78fc --- /dev/null +++ b/example/nolexer/nolexer.grammar/nolexer/internal/parser/parser.go @@ -0,0 +1,326 @@ +// Code generated by gocc; DO NOT EDIT. + +package parser + +import ( + "errors" + "fmt" + "strings" + + "github.com/maxcalandrelli/gocc/example/nolexer/nolexer.grammar/nolexer/iface" + parseError "github.com/maxcalandrelli/gocc/example/nolexer/nolexer.grammar/nolexer/internal/errors" + "github.com/maxcalandrelli/gocc/example/nolexer/nolexer.grammar/nolexer/internal/token" +) + +const ( + numProductions = 4 + numStates = 6 + numSymbols = 8 +) + +// Stack + +type stack struct { + state []int + attrib []Attrib +} + +const INITIAL_STACK_SIZE = 100 + +func newStack() *stack { + return &stack{ + state: make([]int, 0, INITIAL_STACK_SIZE), + attrib: make([]Attrib, 0, INITIAL_STACK_SIZE), + } +} + +func (s *stack) reset() { + s.state = s.state[:0] + s.attrib = s.attrib[:0] +} + +func (s *stack) push(state int, a Attrib) { + s.state = append(s.state, state) + s.attrib = append(s.attrib, a) +} + +func (s *stack) top() int { + return s.state[len(s.state)-1] +} + +func (s *stack) peek(pos int) int { + return s.state[pos] +} + +func (s *stack) topIndex() int { + return len(s.state) - 1 +} + +func (s *stack) popN(items int) []Attrib { + lo, hi := len(s.state)-items, len(s.state) + + attrib := s.attrib[lo:hi] + + s.state = s.state[:lo] + s.attrib = s.attrib[:lo] + + return attrib +} + +func (s *stack) String() string { + w := new(strings.Builder) + fmt.Fprintf(w, "stack:\n") + for i, st := range s.state { + fmt.Fprintf(w, "\t%d: %d , ", i, st) + if s.attrib[i] == nil { + fmt.Fprintf(w, "nil") + } else { + switch attr := s.attrib[i].(type) { + case *token.Token: + fmt.Fprintf(w, "%s", attr.Lit) + default: + fmt.Fprintf(w, "%v", attr) + } + } + fmt.Fprintf(w, "\n") + } + return w.String() +} + +// Parser + +type Parser struct { + stack *stack + nextToken *token.Token + userContext interface{} +} + +type ( + TokenStream = iface.TokenStream + fakeCp struct{} + fakeCheckPointable struct{} +) + +func (f fakeCheckPointable) GetCheckPoint() iface.CheckPoint { + return fakeCp{} +} + +func (f fakeCheckPointable) GotoCheckPoint(iface.CheckPoint) {} + +func (f fakeCp) DistanceFrom(o iface.CheckPoint) int { + return 0 +} + +func NewParser() *Parser { + return NewParserWithContext(nil) +} + +func NewParserWithContext(u interface{}) *Parser { + p := &Parser{stack: newStack(), userContext: u} + p.Reset() + return p +} + +func (p *Parser) Reset() { + p.stack.reset() + p.stack.push(0, nil) +} + +func (p *Parser) SetContext(ctx interface{}) *Parser { + p.userContext = ctx + return p +} + +func (p Parser) GetContext() interface{} { + return p.userContext +} + +func (p *Parser) Error(err error, scanner iface.Scanner) (recovered bool, errorAttrib *parseError.Error) { + errorAttrib = &parseError.Error{ + Err: err, + ErrorToken: p.nextToken, + ErrorSymbols: p.popNonRecoveryStates(), + ExpectedTokens: make([]string, 0, 8), + } + for t, action := range parserActions.table[p.stack.top()].actions { + if action != nil { + errorAttrib.ExpectedTokens = append(errorAttrib.ExpectedTokens, token.TokMap.Id(token.Type(t))) + } + } + + if action := parserActions.table[p.stack.top()].actions[token.TokMap.Type("λ")]; action != nil { + p.stack.push(int(action.(shift)), errorAttrib) // action can only be shift + } else { + return + } + + if action := parserActions.table[p.stack.top()].actions[p.nextToken.Type]; action != nil { + recovered = true + } + for !recovered && p.nextToken.Type != token.EOF { + p.nextToken = scanner.Scan() + if action := parserActions.table[p.stack.top()].actions[p.nextToken.Type]; action != nil { + recovered = true + } + } + + return +} + +func (p *Parser) popNonRecoveryStates() (removedAttribs []parseError.ErrorSymbol) { + if rs, ok := p.firstRecoveryState(); ok { + errorSymbols := p.stack.popN(p.stack.topIndex() - rs) + removedAttribs = make([]parseError.ErrorSymbol, len(errorSymbols)) + for i, e := range errorSymbols { + removedAttribs[i] = e + } + } else { + removedAttribs = []parseError.ErrorSymbol{} + } + return +} + +// recoveryState points to the highest state on the stack, which can recover +func (p *Parser) firstRecoveryState() (recoveryState int, canRecover bool) { + recoveryState, canRecover = p.stack.topIndex(), parserActions.table[p.stack.top()].canRecover + for recoveryState > 0 && !canRecover { + recoveryState-- + canRecover = parserActions.table[p.stack.peek(recoveryState)].canRecover + } + return +} + +func (p *Parser) newError(err error) error { + e := &parseError.Error{ + Err: err, + StackTop: p.stack.top(), + ErrorToken: p.nextToken, + } + actRow := parserActions.table[p.stack.top()] + for i, t := range actRow.actions { + if t != nil { + e.ExpectedTokens = append(e.ExpectedTokens, token.TokMap.Id(token.Type(i))) + } + } + return e +} + +func (p *Parser) Parse(scanner iface.Scanner) (res interface{}, err error, ptl int) { + return p.parse(scanner, false) +} + +func (p *Parser) ParseLongestPrefix(scanner iface.Scanner) (res interface{}, err error, ptl int) { + return p.parse(scanner, true) +} + +var errNotRepositionable = errors.New("scanner not repositionable") + +func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, err error, ptl int) { + var ( + tokens iface.CheckPointable + afterPos iface.CheckPoint + checkPoint iface.CheckPoint + ) + readNextToken := func() error { + if tokens == nil && (len(parserActions.table[p.stack.top()].cdActions) > 0 || longest) { + return errNotRepositionable + } + if longest { + checkPoint = tokens.GetCheckPoint() + } + p.nextToken = scanner.Scan() + if longest { + afterPos = tokens.GetCheckPoint() + } + return nil + } + p.Reset() + if tokens, _ = scanner.(iface.CheckPointable); tokens == nil { + tokens = fakeCheckPointable{} + } + underlyingStream := TokenStream(nil) + if streamScanner, _ := scanner.(iface.StreamScanner); streamScanner != nil { + underlyingStream = streamScanner.GetStream() + } + startCp := tokens.GetCheckPoint() + if err := readNextToken(); err != nil { + return nil, err, tokens.GetCheckPoint().DistanceFrom(startCp) + } + for acc := false; !acc; { + action := parserActions.table[p.stack.top()].actions[p.nextToken.Type] + if action == nil && underlyingStream != nil && len(parserActions.table[p.stack.top()].cdActions) > 0 { + // + // If no action, check if we have some context dependent parsing to try + // + for _, cdAction := range parserActions.table[p.stack.top()].cdActions { + tokens.GotoCheckPoint(checkPoint) + cd_res, cd_err, cd_parsed := cdAction.tokenScanner(underlyingStream, p.userContext) + if cd_err == nil && len(cd_parsed) > 0 { + action = parserActions.table[p.stack.top()].actions[cdAction.tokenIndex] + if action != nil { + p.nextToken.Foreign = true + p.nextToken.ForeignAstNode = cd_res + p.nextToken.Lit = cd_parsed + p.nextToken.Type = token.Type(cdAction.tokenIndex) + break + } + } + } + } + // + // Still no action? If a longest possible parsing is requested in place + // of a full text, we should try to check if an EOF here would have led + // to a successful parsing instead + // Rember that token.EOF is 1, that is the index of SyntaxEof into symbol table + // Dirty, dirty, dirty... but I found it as it is, and I prefer not to touch + // + if action == nil && longest { + tokens.GotoCheckPoint(checkPoint) + action = parserActions.table[p.stack.top()].actions[token.EOF] + if action == nil { + // + // ok, let's consume the token then + // + tokens.GotoCheckPoint(afterPos) + } + } + + // + // Well, no action is no action after all... + // + if action == nil { + if recovered, errAttrib := p.Error(nil, scanner); !recovered { + p.nextToken = errAttrib.ErrorToken + return nil, p.newError(nil), tokens.GetCheckPoint().DistanceFrom(startCp) + } + if action = parserActions.table[p.stack.top()].actions[p.nextToken.Type]; action == nil { + panic("Error recovery led to invalid action") + } + } + + switch act := action.(type) { + case accept: + res = p.stack.popN(1)[0] + acc = true + case shift: + p.stack.push(int(act), p.nextToken) + if p.nextToken.Foreign { + p.stack.push(int(act), p.nextToken.ForeignAstNode) + } + if err := readNextToken(); err != nil { + return nil, err, tokens.GetCheckPoint().DistanceFrom(startCp) + } + case reduce: + prod := productionsTable[int(act)] + attrib, err := prod.ReduceFunc(p.userContext, p.stack.popN(prod.NumSymbols)) + if err != nil { + return nil, p.newError(err), tokens.GetCheckPoint().DistanceFrom(startCp) + } else { + p.stack.push(gotoTab[p.stack.top()][prod.NTType], attrib) + } + default: + panic("unknown action: " + action.String()) + } + } + return res, nil, tokens.GetCheckPoint().DistanceFrom(startCp) +} diff --git a/example/nolexer/internal/parser/productionstable.go b/example/nolexer/nolexer.grammar/nolexer/internal/parser/productionstable.go similarity index 95% rename from example/nolexer/internal/parser/productionstable.go rename to example/nolexer/nolexer.grammar/nolexer/internal/parser/productionstable.go index 17e02c08..2b85021e 100644 --- a/example/nolexer/internal/parser/productionstable.go +++ b/example/nolexer/nolexer.grammar/nolexer/internal/parser/productionstable.go @@ -5,7 +5,7 @@ package parser import ( "fmt" - "github.com/maxcalandrelli/gocc/example/nolexer/internal/token" + "github.com/maxcalandrelli/gocc/example/nolexer/nolexer.grammar/nolexer/internal/token" ) type ( diff --git a/example/nolexer/internal/token/token.go b/example/nolexer/nolexer.grammar/nolexer/internal/token/token.go similarity index 90% rename from example/nolexer/internal/token/token.go rename to example/nolexer/nolexer.grammar/nolexer/internal/token/token.go index a35e3796..8cb4f4e0 100644 --- a/example/nolexer/internal/token/token.go +++ b/example/nolexer/nolexer.grammar/nolexer/internal/token/token.go @@ -48,6 +48,7 @@ func (p Pos) StartingFrom(base Pos) Pos { type TokenMap struct { typeMap []string idMap map[string]Type + litMap map[string]Type } func (m TokenMap) Id(tok Type) string { @@ -61,6 +62,9 @@ func (m TokenMap) Type(tok string) Type { if typ, exist := m.idMap[tok]; exist { return typ } + if typ, exist := m.litMap[tok]; exist { + return typ + } return INVALID } @@ -88,4 +92,9 @@ var TokMap = TokenMap{ "Λ": 3, "Λ": 4, }, + + litMap: map[string]Type{ + "hello": 3, + "hiya": 4, + }, } diff --git a/example/ctx/internal/util/litconv.go b/example/nolexer/nolexer.grammar/nolexer/internal/util/litconv.go similarity index 100% rename from example/ctx/internal/util/litconv.go rename to example/nolexer/nolexer.grammar/nolexer/internal/util/litconv.go diff --git a/example/ctx/internal/util/rune.go b/example/nolexer/nolexer.grammar/nolexer/internal/util/rune.go similarity index 100% rename from example/ctx/internal/util/rune.go rename to example/nolexer/nolexer.grammar/nolexer/internal/util/rune.go diff --git a/example/nolexer/nolexer_test.go b/example/nolexer/nolexer_test.go index dc509d30..6c76e6da 100644 --- a/example/nolexer/nolexer_test.go +++ b/example/nolexer/nolexer_test.go @@ -3,13 +3,13 @@ package nolexer import ( "testing" - "github.com/maxcalandrelli/gocc/example/nolexer/internal/parser" + "github.com/maxcalandrelli/gocc/example/nolexer/nolexer.grammar/nolexer" "github.com/maxcalandrelli/gocc/example/nolexer/scanner" ) func Test1(t *testing.T) { S := scanner.NewString("hiya world") - P := parser.NewParser() + P := nolexer.NewParser() if _, e, _ := P.Parse(S); e != nil { t.Error(e.Error()) } @@ -17,7 +17,7 @@ func Test1(t *testing.T) { func Test2(t *testing.T) { S := scanner.NewString("hello world") - P := parser.NewParser() + P := nolexer.NewParser() if _, e, _ := P.Parse(S); e != nil { t.Error(e.Error()) } diff --git a/example/nolexer/scanner/scanner.go b/example/nolexer/scanner/scanner.go index c011253f..e85b2aed 100644 --- a/example/nolexer/scanner/scanner.go +++ b/example/nolexer/scanner/scanner.go @@ -1,7 +1,7 @@ package scanner import ( - "github.com/maxcalandrelli/gocc/example/nolexer/internal/token" + "github.com/maxcalandrelli/gocc/example/nolexer/nolexer.grammar/nolexer/iface" ) type Scanner struct { @@ -35,11 +35,11 @@ func (S *Scanner) scanId() string { return string(S.src[pos : S.pos-1]) } -func (S *Scanner) Scan() (tok *token.Token) { +func (S *Scanner) Scan() (tok *iface.Token) { S.skipWhiteSpace() if S.pos >= len(S.src) { - return &token.Token{Type: token.EOF} + return &iface.Token{Type: iface.EOF} } pos := S.pos @@ -47,16 +47,16 @@ func (S *Scanner) Scan() (tok *token.Token) { lit := S.scanId() switch lit { case "hiya": - return &token.Token{Type: token.TokMap.Type("hiya"), + return &iface.Token{Type: iface.GetTokenMap().Type("hiya"), Lit: []byte("hiya"), - Pos: token.Pos{Offset: pos}} + Pos: iface.Pos{Offset: pos}} case "hello": - return &token.Token{Type: token.TokMap.Type("hello"), + return &iface.Token{Type: iface.GetTokenMap().Type("hello"), Lit: []byte("hello"), - Pos: token.Pos{Offset: pos}} + Pos: iface.Pos{Offset: pos}} default: - return &token.Token{Type: token.TokMap.Type("name"), + return &iface.Token{Type: iface.GetTokenMap().Type("name"), Lit: []byte(lit), - Pos: token.Pos{Offset: pos}} + Pos: iface.Pos{Offset: pos}} } } diff --git a/example/rr/errors/errors.go b/example/rr/errors/errors.go deleted file mode 100644 index 3c4e6e52..00000000 --- a/example/rr/errors/errors.go +++ /dev/null @@ -1,56 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package errors - -import ( - "fmt" - "strings" - - "github.com/maxcalandrelli/gocc/example/rr/token" -) - -type ErrorSymbol interface { -} - -type Error struct { - Err error - ErrorToken *token.Token - ErrorSymbols []ErrorSymbol - ExpectedTokens []string - StackTop int -} - -func (e *Error) String() string { - w := new(strings.Builder) - fmt.Fprintf(w, "Error") - if e.Err != nil { - fmt.Fprintf(w, " %s\n", e.Err) - } else { - fmt.Fprintf(w, "\n") - } - fmt.Fprintf(w, "Token: type=%d, lit=%s\n", e.ErrorToken.Type, e.ErrorToken.Lit) - fmt.Fprintf(w, "Pos: offset=%d, line=%d, column=%d\n", e.ErrorToken.Pos.Offset, e.ErrorToken.Pos.Line, e.ErrorToken.Pos.Column) - fmt.Fprintf(w, "Expected one of: ") - for _, sym := range e.ExpectedTokens { - fmt.Fprintf(w, "%s ", sym) - } - fmt.Fprintf(w, "ErrorSymbol:\n") - for _, sym := range e.ErrorSymbols { - fmt.Fprintf(w, "%v\n", sym) - } - return w.String() -} - -func (e *Error) Error() string { - w := new(strings.Builder) - fmt.Fprintf(w, "Error in S%d: %s, %s", e.StackTop, token.TokMap.TokenString(e.ErrorToken), e.ErrorToken.Pos.String()) - if e.Err != nil { - fmt.Fprintf(w, ": %+v", e.Err) - } else { - fmt.Fprintf(w, ", expected one of: ") - for _, expected := range e.ExpectedTokens { - fmt.Fprintf(w, "%s ", expected) - } - } - return w.String() -} diff --git a/example/rr/iface/iface.go b/example/rr/iface/iface.go deleted file mode 100644 index afbf6db2..00000000 --- a/example/rr/iface/iface.go +++ /dev/null @@ -1,30 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package iface - -import ( - "github.com/maxcalandrelli/gocc/example/rr/internal/token" - "io" -) - -type ( - Scanner interface { - Scan() (tok *token.Token) - GetStream() TokenStream - } - - CheckPoint interface { - DistanceFrom(CheckPoint) int - } - - CheckPointable interface { - GetCheckPoint() CheckPoint - GotoCheckPoint(CheckPoint) - } - - TokenStream interface { - io.Reader - io.RuneScanner - io.Seeker - } -) diff --git a/example/rr/internal/errors/errors.go b/example/rr/internal/errors/errors.go deleted file mode 100644 index ab6fc85a..00000000 --- a/example/rr/internal/errors/errors.go +++ /dev/null @@ -1,56 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package errors - -import ( - "fmt" - "strings" - - "github.com/maxcalandrelli/gocc/example/rr/internal/token" -) - -type ErrorSymbol interface { -} - -type Error struct { - Err error - ErrorToken *token.Token - ErrorSymbols []ErrorSymbol - ExpectedTokens []string - StackTop int -} - -func (e *Error) String() string { - w := new(strings.Builder) - fmt.Fprintf(w, "Error") - if e.Err != nil { - fmt.Fprintf(w, " %s\n", e.Err) - } else { - fmt.Fprintf(w, "\n") - } - fmt.Fprintf(w, "Token: type=%d, lit=%s\n", e.ErrorToken.Type, e.ErrorToken.Lit) - fmt.Fprintf(w, "Pos: offset=%d, line=%d, column=%d\n", e.ErrorToken.Pos.Offset, e.ErrorToken.Pos.Line, e.ErrorToken.Pos.Column) - fmt.Fprintf(w, "Expected one of: ") - for _, sym := range e.ExpectedTokens { - fmt.Fprintf(w, "%s ", sym) - } - fmt.Fprintf(w, "ErrorSymbol:\n") - for _, sym := range e.ErrorSymbols { - fmt.Fprintf(w, "%v\n", sym) - } - return w.String() -} - -func (e *Error) Error() string { - w := new(strings.Builder) - fmt.Fprintf(w, "Error in S%d: %s, %s", e.StackTop, token.TokMap.TokenString(e.ErrorToken), e.ErrorToken.Pos.String()) - if e.Err != nil { - fmt.Fprintf(w, ": %+v", e.Err) - } else { - fmt.Fprintf(w, ", expected one of: ") - for _, expected := range e.ExpectedTokens { - fmt.Fprintf(w, "%s ", expected) - } - } - return w.String() -} diff --git a/example/rr/internal/io/stream/stream.go b/example/rr/internal/io/stream/stream.go deleted file mode 100644 index 8ebdb374..00000000 --- a/example/rr/internal/io/stream/stream.go +++ /dev/null @@ -1,39 +0,0 @@ -package stream - -import ( - internal "github.com/maxcalandrelli/gocc/example/rr/internal/io/stream/internal" - "io" -) - -type ( - WindowReader interface { - BlockSize() int - Buffered() int - Cap() int - MaxCap() int - Read([]byte) (int, error) - ReadByte() (byte, error) - ReadPosition() int64 - ReadRune() (rune, int, error) - Seek(int64, int) (int64, error) - UnreadByte() error - UnreadRune() error - MaxUnreadSize() int - } -) - -var ( - InfoPrefixRoundUp = false -) - -func NewWindowReaderFromBytes(src []byte) WindowReader { - return internal.NewWindowReader(src, nil, 0, 0, InfoPrefixRoundUp) -} - -func NewWindowReader(rdr io.Reader) WindowReader { - return internal.NewWindowReader(nil, rdr, 0, 0, false) -} - -func NewLimitedWindowReader(rdr io.Reader, sizeMin, sizeMax int) WindowReader { - return internal.NewWindowReader(nil, rdr, sizeMin, sizeMax, InfoPrefixRoundUp) -} diff --git a/example/rr/internal/parser/action.go b/example/rr/internal/parser/action.go deleted file mode 100644 index 54bc55e9..00000000 --- a/example/rr/internal/parser/action.go +++ /dev/null @@ -1,51 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package parser - -import ( - "fmt" -) - -type action interface { - act() - String() string -} - -type ( - accept bool - shift int // value is next state index - reduce int // value is production index -) - -func (this accept) act() {} -func (this shift) act() {} -func (this reduce) act() {} - -func (this accept) Equal(that action) bool { - if _, ok := that.(accept); ok { - return true - } - return false -} - -func (this reduce) Equal(that action) bool { - that1, ok := that.(reduce) - if !ok { - return false - } - return this == that1 -} - -func (this shift) Equal(that action) bool { - that1, ok := that.(shift) - if !ok { - return false - } - return this == that1 -} - -func (this accept) String() string { return "accept(0)" } -func (this shift) String() string { return fmt.Sprintf("shift:%d", this) } -func (this reduce) String() string { - return fmt.Sprintf("reduce:%d(%s)", this, productionsTable[this].String) -} diff --git a/example/rr/internal/util/litconv.go b/example/rr/internal/util/litconv.go deleted file mode 100644 index 1aeb6166..00000000 --- a/example/rr/internal/util/litconv.go +++ /dev/null @@ -1,108 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package util - -import ( - "fmt" - "strconv" - "unicode" - "unicode/utf8" -) - -/* Interface */ - -/* -Convert the literal value of a scanned token to rune -*/ -func RuneValue(lit []byte) rune { - if lit[1] == '\\' { - return escapeCharVal(lit) - } - r, size := utf8.DecodeRune(lit[1:]) - if size != len(lit)-2 { - panic(fmt.Sprintf("Error decoding rune. Lit: %s, rune: %d, size%d\n", lit, r, size)) - } - return r -} - -/* -Convert the literal value of a scanned token to int64 -*/ -func IntValue(lit []byte) (int64, error) { - return strconv.ParseInt(string(lit), 10, 64) -} - -/* -Convert the literal value of a scanned token to uint64 -*/ -func UintValue(lit []byte) (uint64, error) { - return strconv.ParseUint(string(lit), 10, 64) -} - -/* Util */ - -func escapeCharVal(lit []byte) rune { - var i, base, max uint32 - offset := 2 - switch lit[offset] { - case 'a': - return '\a' - case 'b': - return '\b' - case 'f': - return '\f' - case 'n': - return '\n' - case 'r': - return '\r' - case 't': - return '\t' - case 'v': - return '\v' - case '\\': - return '\\' - case '\'': - return '\'' - case '0', '1', '2', '3', '4', '5', '6', '7': - i, base, max = 3, 8, 255 - case 'x': - i, base, max = 2, 16, 255 - offset++ - case 'u': - i, base, max = 4, 16, unicode.MaxRune - offset++ - case 'U': - i, base, max = 8, 16, unicode.MaxRune - offset++ - default: - panic(fmt.Sprintf("Error decoding character literal: %s\n", lit)) - } - - var x uint32 - for ; i > 0 && offset < len(lit)-1; i-- { - ch, size := utf8.DecodeRune(lit[offset:]) - offset += size - d := uint32(digitVal(ch)) - if d >= base { - panic(fmt.Sprintf("charVal(%s): illegal character (%c) in escape sequence. size=%d, offset=%d", lit, ch, size, offset)) - } - x = x*base + d - } - if x > max || 0xD800 <= x && x < 0xE000 { - panic(fmt.Sprintf("Error decoding escape char value. Lit:%s, offset:%d, escape sequence is invalid Unicode code point\n", lit, offset)) - } - - return rune(x) -} - -func digitVal(ch rune) int { - switch { - case '0' <= ch && ch <= '9': - return int(ch) - '0' - case 'a' <= ch && ch <= 'f': - return int(ch) - 'a' + 10 - case 'A' <= ch && ch <= 'F': - return int(ch) - 'A' + 10 - } - return 16 // larger than any legal digit val -} diff --git a/example/rr/internal/util/rune.go b/example/rr/internal/util/rune.go deleted file mode 100644 index bd8523a4..00000000 --- a/example/rr/internal/util/rune.go +++ /dev/null @@ -1,39 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package util - -import ( - "fmt" -) - -func RuneToString(r rune) string { - if r >= 0x20 && r < 0x7f { - return fmt.Sprintf("'%c'", r) - } - switch r { - case 0x07: - return "'\\a'" - case 0x08: - return "'\\b'" - case 0x0C: - return "'\\f'" - case 0x0A: - return "'\\n'" - case 0x0D: - return "'\\r'" - case 0x09: - return "'\\t'" - case 0x0b: - return "'\\v'" - case 0x5c: - return "'\\\\\\'" - case 0x27: - return "'\\''" - case 0x22: - return "'\\\"'" - } - if r < 0x10000 { - return fmt.Sprintf("\\u%04x", r) - } - return fmt.Sprintf("\\U%08x", r) -} diff --git a/example/rr/lexer/acttab.go b/example/rr/lexer/acttab.go deleted file mode 100644 index 158ec859..00000000 --- a/example/rr/lexer/acttab.go +++ /dev/null @@ -1,39 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package lexer - -import ( - "fmt" - - "github.com/maxcalandrelli/gocc/example/rr/token" -) - -type ActionTable [NumStates]ActionRow - -type ActionRow struct { - Accept token.Type - Ignore string -} - -func (a ActionRow) String() string { - return fmt.Sprintf("Accept=%d, Ignore=%s", a.Accept, a.Ignore) -} - -var ActTab = ActionTable{ - ActionRow{ // S0 - Accept: 0, - Ignore: "", - }, - ActionRow{ // S1 - Accept: -1, - Ignore: "!whitespace", - }, - ActionRow{ // S2 - Accept: 2, - Ignore: "", - }, - ActionRow{ // S3 - Accept: 3, - Ignore: "", - }, -} diff --git a/example/rr/lexer/lexer.go b/example/rr/lexer/lexer.go deleted file mode 100644 index 381c57f5..00000000 --- a/example/rr/lexer/lexer.go +++ /dev/null @@ -1,123 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package lexer - -import ( - "io/ioutil" - "unicode/utf8" - - "github.com/maxcalandrelli/gocc/example/rr/token" -) - -const ( - NoState = -1 - NumStates = 4 - NumSymbols = 7 -) - -type Lexer struct { - src []byte - pos int - line int - column int -} - -func NewLexer(src []byte) *Lexer { - lexer := &Lexer{ - src: src, - pos: 0, - line: 1, - column: 1, - } - return lexer -} - -func NewLexerFile(fpath string) (*Lexer, error) { - src, err := ioutil.ReadFile(fpath) - if err != nil { - return nil, err - } - return NewLexer(src), nil -} - -func (l *Lexer) Scan() (tok *token.Token) { - tok = new(token.Token) - if l.pos >= len(l.src) { - tok.Type = token.EOF - tok.Pos.Offset, tok.Pos.Line, tok.Pos.Column = l.pos, l.line, l.column - return - } - start, startLine, startColumn, end := l.pos, l.line, l.column, 0 - tok.Type = token.INVALID - state, rune1, size := 0, rune(-1), 0 - for state != -1 { - if l.pos >= len(l.src) { - rune1 = -1 - } else { - rune1, size = utf8.DecodeRune(l.src[l.pos:]) - l.pos += size - } - - nextState := -1 - if rune1 != -1 { - nextState = TransTab[state](rune1) - } - state = nextState - - if state != -1 { - - switch rune1 { - case '\n': - l.line++ - l.column = 1 - case '\r': - l.column = 1 - case '\t': - l.column += 4 - default: - l.column++ - } - - switch { - case ActTab[state].Accept != -1: - tok.Type = ActTab[state].Accept - end = l.pos - case ActTab[state].Ignore != "": - start, startLine, startColumn = l.pos, l.line, l.column - state = 0 - if start >= len(l.src) { - tok.Type = token.EOF - } - - } - } else { - if tok.Type == token.INVALID { - end = l.pos - } - } - } - if end > start { - l.pos = end - tok.Lit = l.src[start:end] - } else { - tok.Lit = []byte{} - } - tok.Pos.Offset, tok.Pos.Line, tok.Pos.Column = start, startLine, startColumn - - return -} - -func (l *Lexer) Reset() { - l.pos = 0 -} - -/* -Lexer symbols: -0: 'a' -1: 'c' -2: ' ' -3: '\t' -4: '\n' -5: '\r' -6: . -*/ diff --git a/example/rr/lexer/transitiontable.go b/example/rr/lexer/transitiontable.go deleted file mode 100644 index 8b22865a..00000000 --- a/example/rr/lexer/transitiontable.go +++ /dev/null @@ -1,49 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package lexer - -/* -Let s be the current state -Let r be the current input rune -transitionTable[s](r) returns the next state. -*/ -type TransitionTable [NumStates]func(rune) int - -var TransTab = TransitionTable{ - // S0 - func(r rune) int { - switch { - case r == 9: // ['\t','\t'] - return 1 - case r == 10: // ['\n','\n'] - return 1 - case r == 13: // ['\r','\r'] - return 1 - case r == 32: // [' ',' '] - return 1 - case r == 97: // ['a','a'] - return 2 - case r == 99: // ['c','c'] - return 3 - } - return NoState - }, - // S1 - func(r rune) int { - switch { - } - return NoState - }, - // S2 - func(r rune) int { - switch { - } - return NoState - }, - // S3 - func(r rune) int { - switch { - } - return NoState - }, -} diff --git a/example/rr/parser/action.go b/example/rr/parser/action.go deleted file mode 100644 index 54bc55e9..00000000 --- a/example/rr/parser/action.go +++ /dev/null @@ -1,51 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package parser - -import ( - "fmt" -) - -type action interface { - act() - String() string -} - -type ( - accept bool - shift int // value is next state index - reduce int // value is production index -) - -func (this accept) act() {} -func (this shift) act() {} -func (this reduce) act() {} - -func (this accept) Equal(that action) bool { - if _, ok := that.(accept); ok { - return true - } - return false -} - -func (this reduce) Equal(that action) bool { - that1, ok := that.(reduce) - if !ok { - return false - } - return this == that1 -} - -func (this shift) Equal(that action) bool { - that1, ok := that.(shift) - if !ok { - return false - } - return this == that1 -} - -func (this accept) String() string { return "accept(0)" } -func (this shift) String() string { return fmt.Sprintf("shift:%d", this) } -func (this reduce) String() string { - return fmt.Sprintf("reduce:%d(%s)", this, productionsTable[this].String) -} diff --git a/example/rr/parser/actiontable.go b/example/rr/parser/actiontable.go deleted file mode 100644 index c11c48b1..00000000 --- a/example/rr/parser/actiontable.go +++ /dev/null @@ -1,77 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package parser - -type ( - actionTable [numStates]actionRow - actionRow struct { - canRecover bool - actions [numSymbols]action - } -) - -var actionTab = actionTable{ - actionRow{ // S0 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - nil, // $ - shift(4), // a - shift(5), // c - }, - }, - actionRow{ // S1 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - accept(true), // $ - nil, // a - nil, // c - }, - }, - actionRow{ // S2 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - reduce(1), // $, reduce: RR - shift(6), // a - nil, // c - }, - }, - actionRow{ // S3 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - reduce(2), // $, reduce: RR - nil, // a - nil, // c - }, - }, - actionRow{ // S4 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - reduce(3), // $, reduce: B - reduce(4), // a, reduce: A - nil, // c - }, - }, - actionRow{ // S5 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - reduce(6), // $, reduce: A - reduce(6), // a, reduce: A - nil, // c - }, - }, - actionRow{ // S6 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - reduce(5), // $, reduce: A - reduce(5), // a, reduce: A - nil, // c - }, - }, -} diff --git a/example/rr/parser/gototable.go b/example/rr/parser/gototable.go deleted file mode 100644 index be09ff64..00000000 --- a/example/rr/parser/gototable.go +++ /dev/null @@ -1,55 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package parser - -const numNTSymbols = 4 - -type ( - gotoTable [numStates]gotoRow - gotoRow [numNTSymbols]int -) - -var gotoTab = gotoTable{ - gotoRow{ // S0 - -1, // S' - 1, // RR - 3, // B - 2, // A - }, - gotoRow{ // S1 - -1, // S' - -1, // RR - -1, // B - -1, // A - }, - gotoRow{ // S2 - -1, // S' - -1, // RR - -1, // B - -1, // A - }, - gotoRow{ // S3 - -1, // S' - -1, // RR - -1, // B - -1, // A - }, - gotoRow{ // S4 - -1, // S' - -1, // RR - -1, // B - -1, // A - }, - gotoRow{ // S5 - -1, // S' - -1, // RR - -1, // B - -1, // A - }, - gotoRow{ // S6 - -1, // S' - -1, // RR - -1, // B - -1, // A - }, -} diff --git a/example/rr/parser/parser.go b/example/rr/parser/parser.go deleted file mode 100644 index b4cc2dc7..00000000 --- a/example/rr/parser/parser.go +++ /dev/null @@ -1,216 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package parser - -import ( - "fmt" - "strings" - - parseError "github.com/maxcalandrelli/gocc/example/rr/errors" - "github.com/maxcalandrelli/gocc/example/rr/token" -) - -const ( - numProductions = 7 - numStates = 7 - numSymbols = 8 -) - -// Stack - -type stack struct { - state []int - attrib []Attrib -} - -const iNITIAL_STACK_SIZE = 100 - -func newStack() *stack { - return &stack{ - state: make([]int, 0, iNITIAL_STACK_SIZE), - attrib: make([]Attrib, 0, iNITIAL_STACK_SIZE), - } -} - -func (s *stack) reset() { - s.state = s.state[:0] - s.attrib = s.attrib[:0] -} - -func (s *stack) push(state int, a Attrib) { - s.state = append(s.state, state) - s.attrib = append(s.attrib, a) -} - -func (s *stack) top() int { - return s.state[len(s.state)-1] -} - -func (s *stack) peek(pos int) int { - return s.state[pos] -} - -func (s *stack) topIndex() int { - return len(s.state) - 1 -} - -func (s *stack) popN(items int) []Attrib { - lo, hi := len(s.state)-items, len(s.state) - - attrib := s.attrib[lo:hi] - - s.state = s.state[:lo] - s.attrib = s.attrib[:lo] - - return attrib -} - -func (s *stack) String() string { - w := new(strings.Builder) - fmt.Fprintf(w, "stack:\n") - for i, st := range s.state { - fmt.Fprintf(w, "\t%d: %d , ", i, st) - if s.attrib[i] == nil { - fmt.Fprintf(w, "nil") - } else { - switch attr := s.attrib[i].(type) { - case *token.Token: - fmt.Fprintf(w, "%s", attr.Lit) - default: - fmt.Fprintf(w, "%v", attr) - } - } - fmt.Fprintf(w, "\n") - } - return w.String() -} - -// Parser - -type Parser struct { - stack *stack - nextToken *token.Token - pos int -} - -type Scanner interface { - Scan() (tok *token.Token) -} - -func NewParser() *Parser { - p := &Parser{stack: newStack()} - p.Reset() - return p -} - -func (p *Parser) Reset() { - p.stack.reset() - p.stack.push(0, nil) -} - -func (p *Parser) Error(err error, scanner Scanner) (recovered bool, errorAttrib *parseError.Error) { - errorAttrib = &parseError.Error{ - Err: err, - ErrorToken: p.nextToken, - ErrorSymbols: p.popNonRecoveryStates(), - ExpectedTokens: make([]string, 0, 8), - } - for t, action := range actionTab[p.stack.top()].actions { - if action != nil { - errorAttrib.ExpectedTokens = append(errorAttrib.ExpectedTokens, token.TokMap.Id(token.Type(t))) - } - } - - if action := actionTab[p.stack.top()].actions[token.TokMap.Type("error")]; action != nil { - p.stack.push(int(action.(shift)), errorAttrib) // action can only be shift - } else { - return - } - - if action := actionTab[p.stack.top()].actions[p.nextToken.Type]; action != nil { - recovered = true - } - for !recovered && p.nextToken.Type != token.EOF { - p.nextToken = scanner.Scan() - if action := actionTab[p.stack.top()].actions[p.nextToken.Type]; action != nil { - recovered = true - } - } - - return -} - -func (p *Parser) popNonRecoveryStates() (removedAttribs []parseError.ErrorSymbol) { - if rs, ok := p.firstRecoveryState(); ok { - errorSymbols := p.stack.popN(p.stack.topIndex() - rs) - removedAttribs = make([]parseError.ErrorSymbol, len(errorSymbols)) - for i, e := range errorSymbols { - removedAttribs[i] = e - } - } else { - removedAttribs = []parseError.ErrorSymbol{} - } - return -} - -// recoveryState points to the highest state on the stack, which can recover -func (p *Parser) firstRecoveryState() (recoveryState int, canRecover bool) { - recoveryState, canRecover = p.stack.topIndex(), actionTab[p.stack.top()].canRecover - for recoveryState > 0 && !canRecover { - recoveryState-- - canRecover = actionTab[p.stack.peek(recoveryState)].canRecover - } - return -} - -func (p *Parser) newError(err error) error { - e := &parseError.Error{ - Err: err, - StackTop: p.stack.top(), - ErrorToken: p.nextToken, - } - actRow := actionTab[p.stack.top()] - for i, t := range actRow.actions { - if t != nil { - e.ExpectedTokens = append(e.ExpectedTokens, token.TokMap.Id(token.Type(i))) - } - } - return e -} - -func (p *Parser) Parse(scanner Scanner) (res interface{}, err error) { - p.Reset() - p.nextToken = scanner.Scan() - for acc := false; !acc; { - action := actionTab[p.stack.top()].actions[p.nextToken.Type] - if action == nil { - if recovered, errAttrib := p.Error(nil, scanner); !recovered { - p.nextToken = errAttrib.ErrorToken - return nil, p.newError(nil) - } - if action = actionTab[p.stack.top()].actions[p.nextToken.Type]; action == nil { - panic("Error recovery led to invalid action") - } - } - - switch act := action.(type) { - case accept: - res = p.stack.popN(1)[0] - acc = true - case shift: - p.stack.push(int(act), p.nextToken) - p.nextToken = scanner.Scan() - case reduce: - prod := productionsTable[int(act)] - attrib, err := prod.ReduceFunc(p.stack.popN(prod.NumSymbols)) - if err != nil { - return nil, p.newError(err) - } else { - p.stack.push(gotoTab[p.stack.top()][prod.NTType], attrib) - } - default: - panic("unknown action: " + action.String()) - } - } - return res, nil -} diff --git a/example/rr/parser/productionstable.go b/example/rr/parser/productionstable.go deleted file mode 100644 index a00d45c6..00000000 --- a/example/rr/parser/productionstable.go +++ /dev/null @@ -1,93 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package parser - - - -type ( - //TODO: change type and variable names to be consistent with other tables - ProdTab [numProductions]ProdTabEntry - ProdTabEntry struct { - String string - Id string - NTType int - Index int - NumSymbols int - ReduceFunc func([]Attrib) (Attrib, error) - } - Attrib interface { - } -) - -var productionsTable = ProdTab{ - ProdTabEntry{ - String: `S' : RR << >>`, - Id: "S'", - NTType: 0, - Index: 0, - NumSymbols: 1, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return X[0], nil - }, - }, - ProdTabEntry{ - String: `RR : A << >>`, - Id: "RR", - NTType: 1, - Index: 1, - NumSymbols: 1, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return X[0], nil - }, - }, - ProdTabEntry{ - String: `RR : B << >>`, - Id: "RR", - NTType: 1, - Index: 2, - NumSymbols: 1, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return X[0], nil - }, - }, - ProdTabEntry{ - String: `B : a << "B ", nil >>`, - Id: "B", - NTType: 2, - Index: 3, - NumSymbols: 1, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return "B ", nil - }, - }, - ProdTabEntry{ - String: `A : a << "A0 ", nil >>`, - Id: "A", - NTType: 3, - Index: 4, - NumSymbols: 1, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return "A0 ", nil - }, - }, - ProdTabEntry{ - String: `A : A a << "A1 ", nil >>`, - Id: "A", - NTType: 3, - Index: 5, - NumSymbols: 2, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return "A1 ", nil - }, - }, - ProdTabEntry{ - String: `A : c << "A2 ", nil >>`, - Id: "A", - NTType: 3, - Index: 6, - NumSymbols: 1, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return "A2 ", nil - }, - }, -} diff --git a/example/rr/rr.go b/example/rr/rr.go deleted file mode 100644 index 34aee78b..00000000 --- a/example/rr/rr.go +++ /dev/null @@ -1,62 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package rr - -import ( - "io" - - "github.com/maxcalandrelli/gocc/example/rr/iface" - "github.com/maxcalandrelli/gocc/example/rr/internal/io/stream" - "github.com/maxcalandrelli/gocc/example/rr/internal/lexer" - "github.com/maxcalandrelli/gocc/example/rr/internal/parser" - "github.com/maxcalandrelli/gocc/example/rr/internal/token" -) - -type ( - Token = token.Token - Lexer = lexer.Lexer - Parser = parser.Parser - TokenStream = iface.TokenStream - WindowReader = stream.WindowReader - Scanner = iface.Scanner -) - -func ParseFile(fpath string) (interface{}, error, int) { - if lexer, err := NewLexerFile(fpath); err == nil { - return NewParser().Parse(lexer) - } else { - return nil, err, 0 - } -} - -func ParseText(text string) (interface{}, error, int) { - return NewParser().Parse(NewLexerBytes([]byte(text))) -} - -func NewLexerBytes(src []byte) *lexer.Lexer { - return lexer.NewLexerBytes(src) -} - -func NewLexerString(src string) *lexer.Lexer { - return lexer.NewLexerBytes([]byte(src)) -} - -func NewLexerFile(fpath string) (*lexer.Lexer, error) { - return lexer.NewLexerFile(fpath) -} - -func NewParser() *parser.Parser { - return parser.NewParser() -} - -func NewWindowReaderFromBytes(src []byte) WindowReader { - return stream.NewWindowReaderFromBytes(src) -} - -func NewWindowReader(rdr io.Reader) WindowReader { - return stream.NewWindowReader(rdr) -} - -func NewLimitedWindowReader(rdr io.Reader, sizeMin, sizeMax int) WindowReader { - return stream.NewLimitedWindowReader(rdr, sizeMin, sizeMax) -} diff --git a/example/rr/rr.grammar/rr/grammar.go b/example/rr/rr.grammar/rr/grammar.go new file mode 100644 index 00000000..3e147ce6 --- /dev/null +++ b/example/rr/rr.grammar/rr/grammar.go @@ -0,0 +1,131 @@ +// Code generated by gocc; DO NOT EDIT. + +package rr + +import ( + "io" + + "github.com/maxcalandrelli/gocc/example/rr/rr.grammar/rr/internal/errors" + "github.com/maxcalandrelli/gocc/example/rr/rr.grammar/rr/internal/lexer" + "github.com/maxcalandrelli/gocc/example/rr/rr.grammar/rr/internal/parser" + "github.com/maxcalandrelli/gocc/example/rr/rr.grammar/rr/internal/token" +) + +const ( + INVALID = token.INVALID + EOF = token.EOF +) + +type ( + Token = token.Token + TokenMap = token.TokenMap + Pos = token.Pos + ErrorSymbol = errors.ErrorSymbol + Error = errors.Error + Lexer = lexer.Lexer + Parser = parser.Parser +) + +func NewParser() *parser.Parser { + return parser.NewParser() +} + +func ParseFile(fpath string) (interface{}, error, int) { + if lexer, err := NewLexerFile(fpath); err == nil { + return NewParser().Parse(lexer) + } else { + return nil, err, 0 + } +} + +func ParseText(text string, userData interface{}) (interface{}, error, int) { + return NewParser().Parse(NewLexerBytes([]byte(text))) +} + +func Parse(stream io.Reader) (interface{}, error, int) { + lex, err := NewLexer(stream) + if lex == nil { + return nil, err, 0 + } + return NewParser().Parse(lex) +} + +func ParseFileWithData(fpath string, userData interface{}) (interface{}, error, int) { + if lexer, err := NewLexerFile(fpath); err == nil { + return NewParser().SetContext(userData).Parse(lexer) + } else { + return nil, err, 0 + } +} + +func ParseStringWithData(text string, userData interface{}) (interface{}, error, int) { + return NewParser().SetContext(userData).Parse(NewLexerBytes([]byte(text))) +} + +func ParseWithData(stream io.Reader, userData interface{}) (interface{}, error, int) { + lex, err := NewLexer(stream) + if lex == nil { + return nil, err, 0 + } + return NewParser().SetContext(userData).Parse(lex) +} + +func ParseFilePartial(fpath string) (interface{}, error, int) { + if lexer, err := NewLexerFile(fpath); err == nil { + return NewParser().ParseLongestPrefix(lexer) + } else { + return nil, err, 0 + } +} + +func ParseTextPartial(text string, userData interface{}) (interface{}, error, int) { + return NewParser().ParseLongestPrefix(NewLexerBytes([]byte(text))) +} + +func ParsePartial(stream io.Reader) (interface{}, error, int) { + lex, err := NewLexer(stream) + if lex == nil { + return nil, err, 0 + } + return NewParser().ParseLongestPrefix(lex) +} + +func ParseFileWithDataPartial(fpath string, userData interface{}) (interface{}, error, int) { + if lexer, err := NewLexerFile(fpath); err == nil { + return NewParser().SetContext(userData).ParseLongestPrefix(lexer) + } else { + return nil, err, 0 + } +} + +func ParseStringWithDataPartial(text string, userData interface{}) (interface{}, error, int) { + return NewParser().SetContext(userData).ParseLongestPrefix(NewLexerBytes([]byte(text))) +} + +func ParseWithDataPartial(stream io.Reader, userData interface{}) (interface{}, error, int) { + lex, err := NewLexer(stream) + if lex == nil { + return nil, err, 0 + } + return NewParser().SetContext(userData).ParseLongestPrefix(lex) +} + +func NewLexerBytes(src []byte) *lexer.Lexer { + return lexer.NewLexerBytes(src) +} + +func NewLexerString(src string) *lexer.Lexer { + return lexer.NewLexerBytes([]byte(src)) +} + +func NewLexerFile(fpath string) (*lexer.Lexer, error) { + return lexer.NewLexerFile(fpath) +} + +func NewLexer(reader io.Reader) (*lexer.Lexer, error) { + return lexer.NewLexer(reader) +} + +func GetTokenMap() TokenMap { + return token.TokMap +} diff --git a/example/rr/rr.grammar/rr/iface/rr.go b/example/rr/rr.grammar/rr/iface/rr.go new file mode 100644 index 00000000..0827c63b --- /dev/null +++ b/example/rr/rr.grammar/rr/iface/rr.go @@ -0,0 +1,49 @@ +// Code generated by gocc; DO NOT EDIT. + +package iface + +import ( + "github.com/maxcalandrelli/gocc/example/rr/rr.grammar/rr/internal/errors" + "github.com/maxcalandrelli/gocc/example/rr/rr.grammar/rr/internal/token" + "io" +) + +type ( + Token = token.Token + TokenMap = token.TokenMap + Pos = token.Pos + ErrorSymbol = errors.ErrorSymbol + Error = errors.Error + + Scanner interface { + Scan() (tok *Token) + } + + StreamScanner interface { + GetStream() TokenStream + } + + CheckPoint interface { + DistanceFrom(CheckPoint) int + } + + CheckPointable interface { + GetCheckPoint() CheckPoint + GotoCheckPoint(CheckPoint) + } + + TokenStream interface { + io.Reader + io.RuneScanner + io.Seeker + } +) + +const ( + INVALID = token.INVALID + EOF = token.EOF +) + +func GetTokenMap() TokenMap { + return token.TokMap +} diff --git a/example/bools/internal/errors/errors.go b/example/rr/rr.grammar/rr/internal/errors/errors.go similarity index 94% rename from example/bools/internal/errors/errors.go rename to example/rr/rr.grammar/rr/internal/errors/errors.go index 79b5a0fe..2faf2534 100644 --- a/example/bools/internal/errors/errors.go +++ b/example/rr/rr.grammar/rr/internal/errors/errors.go @@ -6,7 +6,7 @@ import ( "fmt" "strings" - "github.com/maxcalandrelli/gocc/example/bools/internal/token" + "github.com/maxcalandrelli/gocc/example/rr/rr.grammar/rr/internal/token" ) type ErrorSymbol interface { diff --git a/example/rr/internal/io/stream/internal/stream_impl.go b/example/rr/rr.grammar/rr/internal/io/stream/internal/stream_impl.go similarity index 100% rename from example/rr/internal/io/stream/internal/stream_impl.go rename to example/rr/rr.grammar/rr/internal/io/stream/internal/stream_impl.go diff --git a/example/rr/internal/io/stream/internal/stream_public.go b/example/rr/rr.grammar/rr/internal/io/stream/internal/stream_public.go similarity index 100% rename from example/rr/internal/io/stream/internal/stream_public.go rename to example/rr/rr.grammar/rr/internal/io/stream/internal/stream_public.go diff --git a/example/calc/internal/io/stream/stream.go b/example/rr/rr.grammar/rr/internal/io/stream/stream.go similarity index 89% rename from example/calc/internal/io/stream/stream.go rename to example/rr/rr.grammar/rr/internal/io/stream/stream.go index 8a8b3233..c1d75800 100644 --- a/example/calc/internal/io/stream/stream.go +++ b/example/rr/rr.grammar/rr/internal/io/stream/stream.go @@ -1,7 +1,7 @@ package stream import ( - internal "github.com/maxcalandrelli/gocc/example/calc/internal/io/stream/internal" + internal "github.com/maxcalandrelli/gocc/example/rr/rr.grammar/rr/internal/io/stream/internal" "io" ) diff --git a/example/rr/internal/lexer/acttab.go b/example/rr/rr.grammar/rr/internal/lexer/acttab.go similarity index 88% rename from example/rr/internal/lexer/acttab.go rename to example/rr/rr.grammar/rr/internal/lexer/acttab.go index bf252c2e..d0a104eb 100644 --- a/example/rr/internal/lexer/acttab.go +++ b/example/rr/rr.grammar/rr/internal/lexer/acttab.go @@ -5,7 +5,7 @@ package lexer import ( "fmt" - "github.com/maxcalandrelli/gocc/example/rr/internal/token" + "github.com/maxcalandrelli/gocc/example/rr/rr.grammar/rr/internal/token" ) type ActionTable [NumStates]ActionRow diff --git a/example/rr/internal/lexer/lexer.go b/example/rr/rr.grammar/rr/internal/lexer/lexer.go similarity index 71% rename from example/rr/internal/lexer/lexer.go rename to example/rr/rr.grammar/rr/internal/lexer/lexer.go index c483a97b..501c0fb2 100644 --- a/example/rr/internal/lexer/lexer.go +++ b/example/rr/rr.grammar/rr/internal/lexer/lexer.go @@ -9,9 +9,9 @@ import ( "os" - "github.com/maxcalandrelli/gocc/example/rr/iface" - "github.com/maxcalandrelli/gocc/example/rr/internal/token" - "github.com/maxcalandrelli/gocc/example/rr/internal/io/stream" + "github.com/maxcalandrelli/gocc/example/rr/rr.grammar/rr/iface" + "github.com/maxcalandrelli/gocc/example/rr/rr.grammar/rr/internal/token" + "github.com/maxcalandrelli/gocc/example/rr/rr.grammar/rr/internal/io/stream" ) const ( @@ -37,6 +37,10 @@ func NewLexerBytes(src []byte) *Lexer { return lexer } +func NewLexerString(src string) *Lexer { + return NewLexerBytes([]byte(src)) +} + func NewLexerFile(fpath string) (*Lexer, error) { s, err := os.Open(fpath) if err != nil { @@ -66,11 +70,18 @@ func (l Lexer) GetStream() iface.TokenStream { type checkPoint int64 +func (c checkPoint) value () int64 { + return int64(c) +} + func (c checkPoint) DistanceFrom (o iface.CheckPoint) int { - return int (c - o.(checkPoint)) + return int (c.value() - o.(checkPoint).value()) } -func (l Lexer) GetCheckPoint() iface.CheckPoint { +func (l *Lexer) GetCheckPoint() iface.CheckPoint { + if l == nil { + return checkPoint(0) + } pos, _ := l.stream.Seek(0, io.SeekCurrent) return checkPoint(pos) } @@ -99,17 +110,17 @@ func (l *Lexer) Scan() (tok *token.Token) { } state = nextState if state != -1 { - switch curr { - case '\n': - l.position.Pos.Line++ - l.position.Pos.Column = 1 - case '\r': - l.position.Pos.Column = 1 - case '\t': - l.position.Pos.Column += 4 - default: - l.position.Pos.Column++ - } + switch curr { + case '\n': + l.position.Pos.Line++ + l.position.Pos.Column = 1 + case '\r': + l.position.Pos.Column = 1 + case '\t': + l.position.Pos.Column += 4 + default: + l.position.Pos.Column++ + } switch { case ActTab[state].Accept != -1: tok.Type = ActTab[state].Accept @@ -119,8 +130,12 @@ func (l *Lexer) Scan() (tok *token.Token) { state = 0 tok.Lit = []byte{} } - } else if curr != INVALID_RUNE { - l.stream.UnreadRune() + } else if curr != INVALID_RUNE{ + if len(tok.Lit) == 0 { + tok.Lit = append(tok.Lit, string(curr)...) + } else { + l.stream.UnreadRune() + } } if err == io.EOF && len(tok.Lit)==0 { tok.Type = token.EOF diff --git a/example/rr/internal/lexer/transitiontable.go b/example/rr/rr.grammar/rr/internal/lexer/transitiontable.go similarity index 100% rename from example/rr/internal/lexer/transitiontable.go rename to example/rr/rr.grammar/rr/internal/lexer/transitiontable.go diff --git a/example/ctx/internal/parser/action.go b/example/rr/rr.grammar/rr/internal/parser/action.go similarity index 100% rename from example/ctx/internal/parser/action.go rename to example/rr/rr.grammar/rr/internal/parser/action.go diff --git a/example/rr/internal/parser/actiontable.go b/example/rr/rr.grammar/rr/internal/parser/actiontable.go similarity index 100% rename from example/rr/internal/parser/actiontable.go rename to example/rr/rr.grammar/rr/internal/parser/actiontable.go diff --git a/example/rr/internal/parser/gototable.go b/example/rr/rr.grammar/rr/internal/parser/gototable.go similarity index 100% rename from example/rr/internal/parser/gototable.go rename to example/rr/rr.grammar/rr/internal/parser/gototable.go diff --git a/example/rr/internal/parser/parser.go b/example/rr/rr.grammar/rr/internal/parser/parser.go similarity index 85% rename from example/rr/internal/parser/parser.go rename to example/rr/rr.grammar/rr/internal/parser/parser.go index 25de6fbe..3f459423 100644 --- a/example/rr/internal/parser/parser.go +++ b/example/rr/rr.grammar/rr/internal/parser/parser.go @@ -7,9 +7,9 @@ import ( "fmt" "strings" - "github.com/maxcalandrelli/gocc/example/rr/iface" - parseError "github.com/maxcalandrelli/gocc/example/rr/internal/errors" - "github.com/maxcalandrelli/gocc/example/rr/internal/token" + "github.com/maxcalandrelli/gocc/example/rr/rr.grammar/rr/iface" + parseError "github.com/maxcalandrelli/gocc/example/rr/rr.grammar/rr/internal/errors" + "github.com/maxcalandrelli/gocc/example/rr/rr.grammar/rr/internal/token" ) const ( @@ -95,7 +95,21 @@ type Parser struct { userContext interface{} } -type TokenStream = iface.TokenStream +type ( + TokenStream = iface.TokenStream + fakeCp struct{} + fakeCheckPointable struct{} +) + +func (f fakeCheckPointable) GetCheckPoint() iface.CheckPoint { + return fakeCp{} +} + +func (f fakeCheckPointable) GotoCheckPoint(iface.CheckPoint) {} + +func (f fakeCp) DistanceFrom(o iface.CheckPoint) int { + return 0 +} func NewParser() *Parser { return NewParserWithContext(nil) @@ -112,6 +126,15 @@ func (p *Parser) Reset() { p.stack.push(0, nil) } +func (p *Parser) SetContext(ctx interface{}) *Parser { + p.userContext = ctx + return p +} + +func (p Parser) GetContext() interface{} { + return p.userContext +} + func (p *Parser) Error(err error, scanner iface.Scanner) (recovered bool, errorAttrib *parseError.Error) { errorAttrib = &parseError.Error{ Err: err, @@ -125,7 +148,7 @@ func (p *Parser) Error(err error, scanner iface.Scanner) (recovered bool, errorA } } - if action := parserActions.table[p.stack.top()].actions[token.TokMap.Type("error")]; action != nil { + if action := parserActions.table[p.stack.top()].actions[token.TokMap.Type("λ")]; action != nil { p.stack.push(int(action.(shift)), errorAttrib) // action can only be shift } else { return @@ -202,7 +225,9 @@ func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, er if tokens == nil && (len(parserActions.table[p.stack.top()].cdActions) > 0 || longest) { return errNotRepositionable } - checkPoint = tokens.GetCheckPoint() + if longest { + checkPoint = tokens.GetCheckPoint() + } p.nextToken = scanner.Scan() if longest { afterPos = tokens.GetCheckPoint() @@ -210,20 +235,26 @@ func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, er return nil } p.Reset() - tokens, _ = scanner.(iface.CheckPointable) + if tokens, _ = scanner.(iface.CheckPointable); tokens == nil { + tokens = fakeCheckPointable{} + } + underlyingStream := TokenStream(nil) + if streamScanner, _ := scanner.(iface.StreamScanner); streamScanner != nil { + underlyingStream = streamScanner.GetStream() + } startCp := tokens.GetCheckPoint() if err := readNextToken(); err != nil { return nil, err, tokens.GetCheckPoint().DistanceFrom(startCp) } for acc := false; !acc; { action := parserActions.table[p.stack.top()].actions[p.nextToken.Type] - if action == nil { + if action == nil && underlyingStream != nil && len(parserActions.table[p.stack.top()].cdActions) > 0 { // // If no action, check if we have some context dependent parsing to try // for _, cdAction := range parserActions.table[p.stack.top()].cdActions { tokens.GotoCheckPoint(checkPoint) - cd_res, cd_err, cd_parsed := cdAction.tokenScanner(scanner.GetStream(), p.userContext) + cd_res, cd_err, cd_parsed := cdAction.tokenScanner(underlyingStream, p.userContext) if cd_err == nil && len(cd_parsed) > 0 { action = parserActions.table[p.stack.top()].actions[cdAction.tokenIndex] if action != nil { diff --git a/example/rr/internal/parser/productionstable.go b/example/rr/rr.grammar/rr/internal/parser/productionstable.go similarity index 100% rename from example/rr/internal/parser/productionstable.go rename to example/rr/rr.grammar/rr/internal/parser/productionstable.go diff --git a/example/rr/internal/token/token.go b/example/rr/rr.grammar/rr/internal/token/token.go similarity index 96% rename from example/rr/internal/token/token.go rename to example/rr/rr.grammar/rr/internal/token/token.go index 794c93e8..872e0ea0 100644 --- a/example/rr/internal/token/token.go +++ b/example/rr/rr.grammar/rr/internal/token/token.go @@ -48,6 +48,7 @@ func (p Pos) StartingFrom(base Pos) Pos { type TokenMap struct { typeMap []string idMap map[string]Type + litMap map[string]Type } func (m TokenMap) Id(tok Type) string { @@ -86,4 +87,6 @@ var TokMap = TokenMap{ "a": 2, "c": 3, }, + + litMap: map[string]Type{}, } diff --git a/example/ctx/util/litconv.go b/example/rr/rr.grammar/rr/internal/util/litconv.go similarity index 100% rename from example/ctx/util/litconv.go rename to example/rr/rr.grammar/rr/internal/util/litconv.go diff --git a/example/ctx/util/rune.go b/example/rr/rr.grammar/rr/internal/util/rune.go similarity index 100% rename from example/ctx/util/rune.go rename to example/rr/rr.grammar/rr/internal/util/rune.go diff --git a/example/rr/main/main.go b/example/rr/rr.grammar/rr/main/main.go similarity index 94% rename from example/rr/main/main.go rename to example/rr/rr.grammar/rr/main/main.go index d1e020b1..56a86a8a 100644 --- a/example/rr/main/main.go +++ b/example/rr/rr.grammar/rr/main/main.go @@ -6,7 +6,7 @@ import ( "os" "strings" - rr "github.com/maxcalandrelli/gocc/example/rr" + rr "github.com/maxcalandrelli/gocc/example/rr/rr.grammar/rr" ) func showResult(r interface{}, e error, l int) { diff --git a/example/rr/rr_test.go b/example/rr/rr_test.go index 50a3cd0b..5dab0761 100644 --- a/example/rr/rr_test.go +++ b/example/rr/rr_test.go @@ -17,15 +17,13 @@ package rr import ( "fmt" "testing" - - "github.com/maxcalandrelli/gocc/example/rr/lexer" - "github.com/maxcalandrelli/gocc/example/rr/parser" + "github.com/maxcalandrelli/gocc/example/rr/rr.grammar/rr" ) func parse(src string) (ast string, err error) { - l := lexer.NewLexer([]byte(src)) - p := parser.NewParser() - res, err := p.Parse(l) + l := rr.NewLexerString(src) + p := rr.NewParser() + res, err, _ := p.Parse(l) if err == nil { ast = res.(string) } diff --git a/example/rr/token/token.go b/example/rr/token/token.go deleted file mode 100644 index bdb8a703..00000000 --- a/example/rr/token/token.go +++ /dev/null @@ -1,74 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package token - -import ( - "fmt" -) - -type Token struct { - Type - Lit []byte - Pos -} - -type Type int - -const ( - INVALID Type = iota - EOF -) - -type Pos struct { - Offset int - Line int - Column int -} - -func (p Pos) String() string { - return fmt.Sprintf("Pos(offset=%d, line=%d, column=%d)", p.Offset, p.Line, p.Column) -} - -type TokenMap struct { - typeMap []string - idMap map[string]Type -} - -func (m TokenMap) Id(tok Type) string { - if int(tok) < len(m.typeMap) { - return m.typeMap[tok] - } - return "unknown" -} - -func (m TokenMap) Type(tok string) Type { - if typ, exist := m.idMap[tok]; exist { - return typ - } - return INVALID -} - -func (m TokenMap) TokenString(tok *Token) string { - //TODO: refactor to print pos & token string properly - return fmt.Sprintf("%s(%d,%s)", m.Id(tok.Type), tok.Type, tok.Lit) -} - -func (m TokenMap) StringType(typ Type) string { - return fmt.Sprintf("%s(%d)", m.Id(typ), typ) -} - -var TokMap = TokenMap{ - typeMap: []string{ - "INVALID", - "$", - "a", - "c", - }, - - idMap: map[string]Type{ - "INVALID": 0, - "$": 1, - "a": 2, - "c": 3, - }, -} diff --git a/example/rr/util/litconv.go b/example/rr/util/litconv.go deleted file mode 100644 index 1aeb6166..00000000 --- a/example/rr/util/litconv.go +++ /dev/null @@ -1,108 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package util - -import ( - "fmt" - "strconv" - "unicode" - "unicode/utf8" -) - -/* Interface */ - -/* -Convert the literal value of a scanned token to rune -*/ -func RuneValue(lit []byte) rune { - if lit[1] == '\\' { - return escapeCharVal(lit) - } - r, size := utf8.DecodeRune(lit[1:]) - if size != len(lit)-2 { - panic(fmt.Sprintf("Error decoding rune. Lit: %s, rune: %d, size%d\n", lit, r, size)) - } - return r -} - -/* -Convert the literal value of a scanned token to int64 -*/ -func IntValue(lit []byte) (int64, error) { - return strconv.ParseInt(string(lit), 10, 64) -} - -/* -Convert the literal value of a scanned token to uint64 -*/ -func UintValue(lit []byte) (uint64, error) { - return strconv.ParseUint(string(lit), 10, 64) -} - -/* Util */ - -func escapeCharVal(lit []byte) rune { - var i, base, max uint32 - offset := 2 - switch lit[offset] { - case 'a': - return '\a' - case 'b': - return '\b' - case 'f': - return '\f' - case 'n': - return '\n' - case 'r': - return '\r' - case 't': - return '\t' - case 'v': - return '\v' - case '\\': - return '\\' - case '\'': - return '\'' - case '0', '1', '2', '3', '4', '5', '6', '7': - i, base, max = 3, 8, 255 - case 'x': - i, base, max = 2, 16, 255 - offset++ - case 'u': - i, base, max = 4, 16, unicode.MaxRune - offset++ - case 'U': - i, base, max = 8, 16, unicode.MaxRune - offset++ - default: - panic(fmt.Sprintf("Error decoding character literal: %s\n", lit)) - } - - var x uint32 - for ; i > 0 && offset < len(lit)-1; i-- { - ch, size := utf8.DecodeRune(lit[offset:]) - offset += size - d := uint32(digitVal(ch)) - if d >= base { - panic(fmt.Sprintf("charVal(%s): illegal character (%c) in escape sequence. size=%d, offset=%d", lit, ch, size, offset)) - } - x = x*base + d - } - if x > max || 0xD800 <= x && x < 0xE000 { - panic(fmt.Sprintf("Error decoding escape char value. Lit:%s, offset:%d, escape sequence is invalid Unicode code point\n", lit, offset)) - } - - return rune(x) -} - -func digitVal(ch rune) int { - switch { - case '0' <= ch && ch <= '9': - return int(ch) - '0' - case 'a' <= ch && ch <= 'f': - return int(ch) - 'a' + 10 - case 'A' <= ch && ch <= 'F': - return int(ch) - 'A' + 10 - } - return 16 // larger than any legal digit val -} diff --git a/example/rr/util/rune.go b/example/rr/util/rune.go deleted file mode 100644 index bd8523a4..00000000 --- a/example/rr/util/rune.go +++ /dev/null @@ -1,39 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package util - -import ( - "fmt" -) - -func RuneToString(r rune) string { - if r >= 0x20 && r < 0x7f { - return fmt.Sprintf("'%c'", r) - } - switch r { - case 0x07: - return "'\\a'" - case 0x08: - return "'\\b'" - case 0x0C: - return "'\\f'" - case 0x0A: - return "'\\n'" - case 0x0D: - return "'\\r'" - case 0x09: - return "'\\t'" - case 0x0b: - return "'\\v'" - case 0x5c: - return "'\\\\\\'" - case 0x27: - return "'\\''" - case 0x22: - return "'\\\"'" - } - if r < 0x10000 { - return fmt.Sprintf("\\u%04x", r) - } - return fmt.Sprintf("\\U%08x", r) -} diff --git a/example/sr/ast/ast.go b/example/sr/ast/ast.go index 7344c3f2..6fb9b210 100644 --- a/example/sr/ast/ast.go +++ b/example/sr/ast/ast.go @@ -1,7 +1,7 @@ package ast import ( - "github.com/maxcalandrelli/gocc/example/sr/token" + "github.com/maxcalandrelli/gocc/example/sr/sr.grammar/sr/iface" ) type ( @@ -30,7 +30,7 @@ type ( func NewIf(cnd, stmt Attrib) (ifs *If) { ifs = &If{ - C: string(cnd.(*token.Token).Lit), + C: string(cnd.(*iface.Token).Lit), S: stmt.(Stmt), } return @@ -38,7 +38,7 @@ func NewIf(cnd, stmt Attrib) (ifs *If) { func NewIfElse(cnd, stmt1, stmt2 Attrib) (ies *IfElse) { ies = &IfElse{ - C: string(cnd.(*token.Token).Lit), + C: string(cnd.(*iface.Token).Lit), S1: stmt1.(Stmt), S2: stmt2.(Stmt), } @@ -46,7 +46,7 @@ func NewIfElse(cnd, stmt1, stmt2 Attrib) (ies *IfElse) { } func NewIdStmt(s Attrib) (is IdStmt) { - is = IdStmt(string(s.(*token.Token).Lit)) + is = IdStmt(string(s.(*iface.Token).Lit)) return } diff --git a/example/sr/errors/errors.go b/example/sr/errors/errors.go deleted file mode 100644 index 215ea08c..00000000 --- a/example/sr/errors/errors.go +++ /dev/null @@ -1,56 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package errors - -import ( - "fmt" - "strings" - - "github.com/maxcalandrelli/gocc/example/sr/token" -) - -type ErrorSymbol interface { -} - -type Error struct { - Err error - ErrorToken *token.Token - ErrorSymbols []ErrorSymbol - ExpectedTokens []string - StackTop int -} - -func (e *Error) String() string { - w := new(strings.Builder) - fmt.Fprintf(w, "Error") - if e.Err != nil { - fmt.Fprintf(w, " %s\n", e.Err) - } else { - fmt.Fprintf(w, "\n") - } - fmt.Fprintf(w, "Token: type=%d, lit=%s\n", e.ErrorToken.Type, e.ErrorToken.Lit) - fmt.Fprintf(w, "Pos: offset=%d, line=%d, column=%d\n", e.ErrorToken.Pos.Offset, e.ErrorToken.Pos.Line, e.ErrorToken.Pos.Column) - fmt.Fprintf(w, "Expected one of: ") - for _, sym := range e.ExpectedTokens { - fmt.Fprintf(w, "%s ", sym) - } - fmt.Fprintf(w, "ErrorSymbol:\n") - for _, sym := range e.ErrorSymbols { - fmt.Fprintf(w, "%v\n", sym) - } - return w.String() -} - -func (e *Error) Error() string { - w := new(strings.Builder) - fmt.Fprintf(w, "Error in S%d: %s, %s", e.StackTop, token.TokMap.TokenString(e.ErrorToken), e.ErrorToken.Pos.String()) - if e.Err != nil { - fmt.Fprintf(w, ": %+v", e.Err) - } else { - fmt.Fprintf(w, ", expected one of: ") - for _, expected := range e.ExpectedTokens { - fmt.Fprintf(w, "%s ", expected) - } - } - return w.String() -} diff --git a/example/sr/iface/iface.go b/example/sr/iface/iface.go deleted file mode 100644 index 9db0789e..00000000 --- a/example/sr/iface/iface.go +++ /dev/null @@ -1,30 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package iface - -import ( - "github.com/maxcalandrelli/gocc/example/sr/internal/token" - "io" -) - -type ( - Scanner interface { - Scan() (tok *token.Token) - GetStream() TokenStream - } - - CheckPoint interface { - DistanceFrom(CheckPoint) int - } - - CheckPointable interface { - GetCheckPoint() CheckPoint - GotoCheckPoint(CheckPoint) - } - - TokenStream interface { - io.Reader - io.RuneScanner - io.Seeker - } -) diff --git a/example/sr/internal/errors/errors.go b/example/sr/internal/errors/errors.go deleted file mode 100644 index 5127727f..00000000 --- a/example/sr/internal/errors/errors.go +++ /dev/null @@ -1,56 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package errors - -import ( - "fmt" - "strings" - - "github.com/maxcalandrelli/gocc/example/sr/internal/token" -) - -type ErrorSymbol interface { -} - -type Error struct { - Err error - ErrorToken *token.Token - ErrorSymbols []ErrorSymbol - ExpectedTokens []string - StackTop int -} - -func (e *Error) String() string { - w := new(strings.Builder) - fmt.Fprintf(w, "Error") - if e.Err != nil { - fmt.Fprintf(w, " %s\n", e.Err) - } else { - fmt.Fprintf(w, "\n") - } - fmt.Fprintf(w, "Token: type=%d, lit=%s\n", e.ErrorToken.Type, e.ErrorToken.Lit) - fmt.Fprintf(w, "Pos: offset=%d, line=%d, column=%d\n", e.ErrorToken.Pos.Offset, e.ErrorToken.Pos.Line, e.ErrorToken.Pos.Column) - fmt.Fprintf(w, "Expected one of: ") - for _, sym := range e.ExpectedTokens { - fmt.Fprintf(w, "%s ", sym) - } - fmt.Fprintf(w, "ErrorSymbol:\n") - for _, sym := range e.ErrorSymbols { - fmt.Fprintf(w, "%v\n", sym) - } - return w.String() -} - -func (e *Error) Error() string { - w := new(strings.Builder) - fmt.Fprintf(w, "Error in S%d: %s, %s", e.StackTop, token.TokMap.TokenString(e.ErrorToken), e.ErrorToken.Pos.String()) - if e.Err != nil { - fmt.Fprintf(w, ": %+v", e.Err) - } else { - fmt.Fprintf(w, ", expected one of: ") - for _, expected := range e.ExpectedTokens { - fmt.Fprintf(w, "%s ", expected) - } - } - return w.String() -} diff --git a/example/sr/internal/io/stream/stream.go b/example/sr/internal/io/stream/stream.go deleted file mode 100644 index 684e9ad1..00000000 --- a/example/sr/internal/io/stream/stream.go +++ /dev/null @@ -1,39 +0,0 @@ -package stream - -import ( - internal "github.com/maxcalandrelli/gocc/example/sr/internal/io/stream/internal" - "io" -) - -type ( - WindowReader interface { - BlockSize() int - Buffered() int - Cap() int - MaxCap() int - Read([]byte) (int, error) - ReadByte() (byte, error) - ReadPosition() int64 - ReadRune() (rune, int, error) - Seek(int64, int) (int64, error) - UnreadByte() error - UnreadRune() error - MaxUnreadSize() int - } -) - -var ( - InfoPrefixRoundUp = false -) - -func NewWindowReaderFromBytes(src []byte) WindowReader { - return internal.NewWindowReader(src, nil, 0, 0, InfoPrefixRoundUp) -} - -func NewWindowReader(rdr io.Reader) WindowReader { - return internal.NewWindowReader(nil, rdr, 0, 0, false) -} - -func NewLimitedWindowReader(rdr io.Reader, sizeMin, sizeMax int) WindowReader { - return internal.NewWindowReader(nil, rdr, sizeMin, sizeMax, InfoPrefixRoundUp) -} diff --git a/example/sr/internal/parser/action.go b/example/sr/internal/parser/action.go deleted file mode 100644 index 54bc55e9..00000000 --- a/example/sr/internal/parser/action.go +++ /dev/null @@ -1,51 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package parser - -import ( - "fmt" -) - -type action interface { - act() - String() string -} - -type ( - accept bool - shift int // value is next state index - reduce int // value is production index -) - -func (this accept) act() {} -func (this shift) act() {} -func (this reduce) act() {} - -func (this accept) Equal(that action) bool { - if _, ok := that.(accept); ok { - return true - } - return false -} - -func (this reduce) Equal(that action) bool { - that1, ok := that.(reduce) - if !ok { - return false - } - return this == that1 -} - -func (this shift) Equal(that action) bool { - that1, ok := that.(shift) - if !ok { - return false - } - return this == that1 -} - -func (this accept) String() string { return "accept(0)" } -func (this shift) String() string { return fmt.Sprintf("shift:%d", this) } -func (this reduce) String() string { - return fmt.Sprintf("reduce:%d(%s)", this, productionsTable[this].String) -} diff --git a/example/sr/internal/util/litconv.go b/example/sr/internal/util/litconv.go deleted file mode 100644 index 1aeb6166..00000000 --- a/example/sr/internal/util/litconv.go +++ /dev/null @@ -1,108 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package util - -import ( - "fmt" - "strconv" - "unicode" - "unicode/utf8" -) - -/* Interface */ - -/* -Convert the literal value of a scanned token to rune -*/ -func RuneValue(lit []byte) rune { - if lit[1] == '\\' { - return escapeCharVal(lit) - } - r, size := utf8.DecodeRune(lit[1:]) - if size != len(lit)-2 { - panic(fmt.Sprintf("Error decoding rune. Lit: %s, rune: %d, size%d\n", lit, r, size)) - } - return r -} - -/* -Convert the literal value of a scanned token to int64 -*/ -func IntValue(lit []byte) (int64, error) { - return strconv.ParseInt(string(lit), 10, 64) -} - -/* -Convert the literal value of a scanned token to uint64 -*/ -func UintValue(lit []byte) (uint64, error) { - return strconv.ParseUint(string(lit), 10, 64) -} - -/* Util */ - -func escapeCharVal(lit []byte) rune { - var i, base, max uint32 - offset := 2 - switch lit[offset] { - case 'a': - return '\a' - case 'b': - return '\b' - case 'f': - return '\f' - case 'n': - return '\n' - case 'r': - return '\r' - case 't': - return '\t' - case 'v': - return '\v' - case '\\': - return '\\' - case '\'': - return '\'' - case '0', '1', '2', '3', '4', '5', '6', '7': - i, base, max = 3, 8, 255 - case 'x': - i, base, max = 2, 16, 255 - offset++ - case 'u': - i, base, max = 4, 16, unicode.MaxRune - offset++ - case 'U': - i, base, max = 8, 16, unicode.MaxRune - offset++ - default: - panic(fmt.Sprintf("Error decoding character literal: %s\n", lit)) - } - - var x uint32 - for ; i > 0 && offset < len(lit)-1; i-- { - ch, size := utf8.DecodeRune(lit[offset:]) - offset += size - d := uint32(digitVal(ch)) - if d >= base { - panic(fmt.Sprintf("charVal(%s): illegal character (%c) in escape sequence. size=%d, offset=%d", lit, ch, size, offset)) - } - x = x*base + d - } - if x > max || 0xD800 <= x && x < 0xE000 { - panic(fmt.Sprintf("Error decoding escape char value. Lit:%s, offset:%d, escape sequence is invalid Unicode code point\n", lit, offset)) - } - - return rune(x) -} - -func digitVal(ch rune) int { - switch { - case '0' <= ch && ch <= '9': - return int(ch) - '0' - case 'a' <= ch && ch <= 'f': - return int(ch) - 'a' + 10 - case 'A' <= ch && ch <= 'F': - return int(ch) - 'A' + 10 - } - return 16 // larger than any legal digit val -} diff --git a/example/sr/internal/util/rune.go b/example/sr/internal/util/rune.go deleted file mode 100644 index bd8523a4..00000000 --- a/example/sr/internal/util/rune.go +++ /dev/null @@ -1,39 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package util - -import ( - "fmt" -) - -func RuneToString(r rune) string { - if r >= 0x20 && r < 0x7f { - return fmt.Sprintf("'%c'", r) - } - switch r { - case 0x07: - return "'\\a'" - case 0x08: - return "'\\b'" - case 0x0C: - return "'\\f'" - case 0x0A: - return "'\\n'" - case 0x0D: - return "'\\r'" - case 0x09: - return "'\\t'" - case 0x0b: - return "'\\v'" - case 0x5c: - return "'\\\\\\'" - case 0x27: - return "'\\''" - case 0x22: - return "'\\\"'" - } - if r < 0x10000 { - return fmt.Sprintf("\\u%04x", r) - } - return fmt.Sprintf("\\U%08x", r) -} diff --git a/example/sr/lexer/acttab.go b/example/sr/lexer/acttab.go deleted file mode 100644 index fb4f352d..00000000 --- a/example/sr/lexer/acttab.go +++ /dev/null @@ -1,91 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package lexer - -import ( - "fmt" - - "github.com/maxcalandrelli/gocc/example/sr/token" -) - -type ActionTable [NumStates]ActionRow - -type ActionRow struct { - Accept token.Type - Ignore string -} - -func (a ActionRow) String() string { - return fmt.Sprintf("Accept=%d, Ignore=%s", a.Accept, a.Ignore) -} - -var ActTab = ActionTable{ - ActionRow{ // S0 - Accept: 0, - Ignore: "", - }, - ActionRow{ // S1 - Accept: -1, - Ignore: "!whitespace", - }, - ActionRow{ // S2 - Accept: 3, - Ignore: "", - }, - ActionRow{ // S3 - Accept: 3, - Ignore: "", - }, - ActionRow{ // S4 - Accept: 3, - Ignore: "", - }, - ActionRow{ // S5 - Accept: 3, - Ignore: "", - }, - ActionRow{ // S6 - Accept: 3, - Ignore: "", - }, - ActionRow{ // S7 - Accept: 3, - Ignore: "", - }, - ActionRow{ // S8 - Accept: 3, - Ignore: "", - }, - ActionRow{ // S9 - Accept: 3, - Ignore: "", - }, - ActionRow{ // S10 - Accept: 3, - Ignore: "", - }, - ActionRow{ // S11 - Accept: 2, - Ignore: "", - }, - ActionRow{ // S12 - Accept: 3, - Ignore: "", - }, - ActionRow{ // S13 - Accept: 3, - Ignore: "", - }, - ActionRow{ // S14 - Accept: 3, - Ignore: "", - }, - ActionRow{ // S15 - Accept: 5, - Ignore: "", - }, - ActionRow{ // S16 - Accept: 4, - Ignore: "", - }, -} diff --git a/example/sr/lexer/lexer.go b/example/sr/lexer/lexer.go deleted file mode 100644 index 569bf840..00000000 --- a/example/sr/lexer/lexer.go +++ /dev/null @@ -1,136 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package lexer - -import ( - "io/ioutil" - "unicode/utf8" - - "github.com/maxcalandrelli/gocc/example/sr/token" -) - -const ( - NoState = -1 - NumStates = 17 - NumSymbols = 20 -) - -type Lexer struct { - src []byte - pos int - line int - column int -} - -func NewLexer(src []byte) *Lexer { - lexer := &Lexer{ - src: src, - pos: 0, - line: 1, - column: 1, - } - return lexer -} - -func NewLexerFile(fpath string) (*Lexer, error) { - src, err := ioutil.ReadFile(fpath) - if err != nil { - return nil, err - } - return NewLexer(src), nil -} - -func (l *Lexer) Scan() (tok *token.Token) { - tok = new(token.Token) - if l.pos >= len(l.src) { - tok.Type = token.EOF - tok.Pos.Offset, tok.Pos.Line, tok.Pos.Column = l.pos, l.line, l.column - return - } - start, startLine, startColumn, end := l.pos, l.line, l.column, 0 - tok.Type = token.INVALID - state, rune1, size := 0, rune(-1), 0 - for state != -1 { - if l.pos >= len(l.src) { - rune1 = -1 - } else { - rune1, size = utf8.DecodeRune(l.src[l.pos:]) - l.pos += size - } - - nextState := -1 - if rune1 != -1 { - nextState = TransTab[state](rune1) - } - state = nextState - - if state != -1 { - - switch rune1 { - case '\n': - l.line++ - l.column = 1 - case '\r': - l.column = 1 - case '\t': - l.column += 4 - default: - l.column++ - } - - switch { - case ActTab[state].Accept != -1: - tok.Type = ActTab[state].Accept - end = l.pos - case ActTab[state].Ignore != "": - start, startLine, startColumn = l.pos, l.line, l.column - state = 0 - if start >= len(l.src) { - tok.Type = token.EOF - } - - } - } else { - if tok.Type == token.INVALID { - end = l.pos - } - } - } - if end > start { - l.pos = end - tok.Lit = l.src[start:end] - } else { - tok.Lit = []byte{} - } - tok.Pos.Offset, tok.Pos.Line, tok.Pos.Column = start, startLine, startColumn - - return -} - -func (l *Lexer) Reset() { - l.pos = 0 -} - -/* -Lexer symbols: -0: '_' -1: 'i' -2: 'f' -3: 't' -4: 'h' -5: 'e' -6: 'n' -7: 'e' -8: 'l' -9: 's' -10: 'e' -11: '_' -12: ' ' -13: '\t' -14: '\n' -15: '\r' -16: 'a'-'z' -17: 'A'-'Z' -18: '0'-'9' -19: . -*/ diff --git a/example/sr/lexer/transitiontable.go b/example/sr/lexer/transitiontable.go deleted file mode 100644 index 3d2f9d7a..00000000 --- a/example/sr/lexer/transitiontable.go +++ /dev/null @@ -1,289 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package lexer - -/* -Let s be the current state -Let r be the current input rune -transitionTable[s](r) returns the next state. -*/ -type TransitionTable [NumStates]func(rune) int - -var TransTab = TransitionTable{ - // S0 - func(r rune) int { - switch { - case r == 9: // ['\t','\t'] - return 1 - case r == 10: // ['\n','\n'] - return 1 - case r == 13: // ['\r','\r'] - return 1 - case r == 32: // [' ',' '] - return 1 - case 65 <= r && r <= 90: // ['A','Z'] - return 2 - case r == 95: // ['_','_'] - return 3 - case 97 <= r && r <= 100: // ['a','d'] - return 2 - case r == 101: // ['e','e'] - return 4 - case 102 <= r && r <= 104: // ['f','h'] - return 2 - case r == 105: // ['i','i'] - return 5 - case 106 <= r && r <= 115: // ['j','s'] - return 2 - case r == 116: // ['t','t'] - return 6 - case 117 <= r && r <= 122: // ['u','z'] - return 2 - } - return NoState - }, - // S1 - func(r rune) int { - switch { - } - return NoState - }, - // S2 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 7 - case 65 <= r && r <= 90: // ['A','Z'] - return 8 - case r == 95: // ['_','_'] - return 9 - case 97 <= r && r <= 122: // ['a','z'] - return 8 - } - return NoState - }, - // S3 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 7 - case 65 <= r && r <= 90: // ['A','Z'] - return 8 - case r == 95: // ['_','_'] - return 9 - case 97 <= r && r <= 122: // ['a','z'] - return 8 - } - return NoState - }, - // S4 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 7 - case 65 <= r && r <= 90: // ['A','Z'] - return 8 - case r == 95: // ['_','_'] - return 9 - case 97 <= r && r <= 107: // ['a','k'] - return 8 - case r == 108: // ['l','l'] - return 10 - case 109 <= r && r <= 122: // ['m','z'] - return 8 - } - return NoState - }, - // S5 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 7 - case 65 <= r && r <= 90: // ['A','Z'] - return 8 - case r == 95: // ['_','_'] - return 9 - case 97 <= r && r <= 101: // ['a','e'] - return 8 - case r == 102: // ['f','f'] - return 11 - case 103 <= r && r <= 122: // ['g','z'] - return 8 - } - return NoState - }, - // S6 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 7 - case 65 <= r && r <= 90: // ['A','Z'] - return 8 - case r == 95: // ['_','_'] - return 9 - case 97 <= r && r <= 103: // ['a','g'] - return 8 - case r == 104: // ['h','h'] - return 12 - case 105 <= r && r <= 122: // ['i','z'] - return 8 - } - return NoState - }, - // S7 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 7 - case 65 <= r && r <= 90: // ['A','Z'] - return 8 - case r == 95: // ['_','_'] - return 9 - case 97 <= r && r <= 122: // ['a','z'] - return 8 - } - return NoState - }, - // S8 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 7 - case 65 <= r && r <= 90: // ['A','Z'] - return 8 - case r == 95: // ['_','_'] - return 9 - case 97 <= r && r <= 122: // ['a','z'] - return 8 - } - return NoState - }, - // S9 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 7 - case 65 <= r && r <= 90: // ['A','Z'] - return 8 - case r == 95: // ['_','_'] - return 9 - case 97 <= r && r <= 122: // ['a','z'] - return 8 - } - return NoState - }, - // S10 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 7 - case 65 <= r && r <= 90: // ['A','Z'] - return 8 - case r == 95: // ['_','_'] - return 9 - case 97 <= r && r <= 114: // ['a','r'] - return 8 - case r == 115: // ['s','s'] - return 13 - case 116 <= r && r <= 122: // ['t','z'] - return 8 - } - return NoState - }, - // S11 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 7 - case 65 <= r && r <= 90: // ['A','Z'] - return 8 - case r == 95: // ['_','_'] - return 9 - case 97 <= r && r <= 122: // ['a','z'] - return 8 - } - return NoState - }, - // S12 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 7 - case 65 <= r && r <= 90: // ['A','Z'] - return 8 - case r == 95: // ['_','_'] - return 9 - case 97 <= r && r <= 100: // ['a','d'] - return 8 - case r == 101: // ['e','e'] - return 14 - case 102 <= r && r <= 122: // ['f','z'] - return 8 - } - return NoState - }, - // S13 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 7 - case 65 <= r && r <= 90: // ['A','Z'] - return 8 - case r == 95: // ['_','_'] - return 9 - case 97 <= r && r <= 100: // ['a','d'] - return 8 - case r == 101: // ['e','e'] - return 15 - case 102 <= r && r <= 122: // ['f','z'] - return 8 - } - return NoState - }, - // S14 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 7 - case 65 <= r && r <= 90: // ['A','Z'] - return 8 - case r == 95: // ['_','_'] - return 9 - case 97 <= r && r <= 109: // ['a','m'] - return 8 - case r == 110: // ['n','n'] - return 16 - case 111 <= r && r <= 122: // ['o','z'] - return 8 - } - return NoState - }, - // S15 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 7 - case 65 <= r && r <= 90: // ['A','Z'] - return 8 - case r == 95: // ['_','_'] - return 9 - case 97 <= r && r <= 122: // ['a','z'] - return 8 - } - return NoState - }, - // S16 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 7 - case 65 <= r && r <= 90: // ['A','Z'] - return 8 - case r == 95: // ['_','_'] - return 9 - case 97 <= r && r <= 122: // ['a','z'] - return 8 - } - return NoState - }, -} diff --git a/example/sr/parser/action.go b/example/sr/parser/action.go deleted file mode 100644 index 54bc55e9..00000000 --- a/example/sr/parser/action.go +++ /dev/null @@ -1,51 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package parser - -import ( - "fmt" -) - -type action interface { - act() - String() string -} - -type ( - accept bool - shift int // value is next state index - reduce int // value is production index -) - -func (this accept) act() {} -func (this shift) act() {} -func (this reduce) act() {} - -func (this accept) Equal(that action) bool { - if _, ok := that.(accept); ok { - return true - } - return false -} - -func (this reduce) Equal(that action) bool { - that1, ok := that.(reduce) - if !ok { - return false - } - return this == that1 -} - -func (this shift) Equal(that action) bool { - that1, ok := that.(shift) - if !ok { - return false - } - return this == that1 -} - -func (this accept) String() string { return "accept(0)" } -func (this shift) String() string { return fmt.Sprintf("shift:%d", this) } -func (this reduce) String() string { - return fmt.Sprintf("reduce:%d(%s)", this, productionsTable[this].String) -} diff --git a/example/sr/parser/actiontable.go b/example/sr/parser/actiontable.go deleted file mode 100644 index fa0bc033..00000000 --- a/example/sr/parser/actiontable.go +++ /dev/null @@ -1,190 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package parser - -type ( - actionTable [numStates]actionRow - actionRow struct { - canRecover bool - actions [numSymbols]action - } -) - -var actionTab = actionTable{ - actionRow{ // S0 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - nil, // $ - shift(2), // if - shift(3), // id - nil, // then - nil, // else - }, - }, - actionRow{ // S1 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - accept(true), // $ - nil, // if - nil, // id - nil, // then - nil, // else - }, - }, - actionRow{ // S2 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - nil, // $ - nil, // if - shift(4), // id - nil, // then - nil, // else - }, - }, - actionRow{ // S3 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - reduce(3), // $, reduce: Stmt - nil, // if - nil, // id - nil, // then - nil, // else - }, - }, - actionRow{ // S4 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - nil, // $ - nil, // if - nil, // id - shift(5), // then - nil, // else - }, - }, - actionRow{ // S5 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - nil, // $ - shift(7), // if - shift(8), // id - nil, // then - nil, // else - }, - }, - actionRow{ // S6 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - reduce(1), // $, reduce: Stmt - nil, // if - nil, // id - nil, // then - shift(9), // else - }, - }, - actionRow{ // S7 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - nil, // $ - nil, // if - shift(10), // id - nil, // then - nil, // else - }, - }, - actionRow{ // S8 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - reduce(3), // $, reduce: Stmt - nil, // if - nil, // id - nil, // then - reduce(3), // else, reduce: Stmt - }, - }, - actionRow{ // S9 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - nil, // $ - shift(2), // if - shift(3), // id - nil, // then - nil, // else - }, - }, - actionRow{ // S10 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - nil, // $ - nil, // if - nil, // id - shift(12), // then - nil, // else - }, - }, - actionRow{ // S11 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - reduce(2), // $, reduce: Stmt - nil, // if - nil, // id - nil, // then - nil, // else - }, - }, - actionRow{ // S12 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - nil, // $ - shift(7), // if - shift(8), // id - nil, // then - nil, // else - }, - }, - actionRow{ // S13 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - reduce(1), // $, reduce: Stmt - nil, // if - nil, // id - nil, // then - shift(14), // else - }, - }, - actionRow{ // S14 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - nil, // $ - shift(7), // if - shift(8), // id - nil, // then - nil, // else - }, - }, - actionRow{ // S15 - canRecover: false, - actions: [numSymbols]action{ - nil, // INVALID - reduce(2), // $, reduce: Stmt - nil, // if - nil, // id - nil, // then - reduce(2), // else, reduce: Stmt - }, - }, -} diff --git a/example/sr/parser/gototable.go b/example/sr/parser/gototable.go deleted file mode 100644 index a33711b5..00000000 --- a/example/sr/parser/gototable.go +++ /dev/null @@ -1,77 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package parser - -const numNTSymbols = 2 - -type ( - gotoTable [numStates]gotoRow - gotoRow [numNTSymbols]int -) - -var gotoTab = gotoTable{ - gotoRow{ // S0 - -1, // S' - 1, // Stmt - }, - gotoRow{ // S1 - -1, // S' - -1, // Stmt - }, - gotoRow{ // S2 - -1, // S' - -1, // Stmt - }, - gotoRow{ // S3 - -1, // S' - -1, // Stmt - }, - gotoRow{ // S4 - -1, // S' - -1, // Stmt - }, - gotoRow{ // S5 - -1, // S' - 6, // Stmt - }, - gotoRow{ // S6 - -1, // S' - -1, // Stmt - }, - gotoRow{ // S7 - -1, // S' - -1, // Stmt - }, - gotoRow{ // S8 - -1, // S' - -1, // Stmt - }, - gotoRow{ // S9 - -1, // S' - 11, // Stmt - }, - gotoRow{ // S10 - -1, // S' - -1, // Stmt - }, - gotoRow{ // S11 - -1, // S' - -1, // Stmt - }, - gotoRow{ // S12 - -1, // S' - 13, // Stmt - }, - gotoRow{ // S13 - -1, // S' - -1, // Stmt - }, - gotoRow{ // S14 - -1, // S' - 15, // Stmt - }, - gotoRow{ // S15 - -1, // S' - -1, // Stmt - }, -} diff --git a/example/sr/parser/parser.go b/example/sr/parser/parser.go deleted file mode 100644 index 3a90e7c9..00000000 --- a/example/sr/parser/parser.go +++ /dev/null @@ -1,216 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package parser - -import ( - "fmt" - "strings" - - parseError "github.com/maxcalandrelli/gocc/example/sr/errors" - "github.com/maxcalandrelli/gocc/example/sr/token" -) - -const ( - numProductions = 4 - numStates = 16 - numSymbols = 8 -) - -// Stack - -type stack struct { - state []int - attrib []Attrib -} - -const iNITIAL_STACK_SIZE = 100 - -func newStack() *stack { - return &stack{ - state: make([]int, 0, iNITIAL_STACK_SIZE), - attrib: make([]Attrib, 0, iNITIAL_STACK_SIZE), - } -} - -func (s *stack) reset() { - s.state = s.state[:0] - s.attrib = s.attrib[:0] -} - -func (s *stack) push(state int, a Attrib) { - s.state = append(s.state, state) - s.attrib = append(s.attrib, a) -} - -func (s *stack) top() int { - return s.state[len(s.state)-1] -} - -func (s *stack) peek(pos int) int { - return s.state[pos] -} - -func (s *stack) topIndex() int { - return len(s.state) - 1 -} - -func (s *stack) popN(items int) []Attrib { - lo, hi := len(s.state)-items, len(s.state) - - attrib := s.attrib[lo:hi] - - s.state = s.state[:lo] - s.attrib = s.attrib[:lo] - - return attrib -} - -func (s *stack) String() string { - w := new(strings.Builder) - fmt.Fprintf(w, "stack:\n") - for i, st := range s.state { - fmt.Fprintf(w, "\t%d: %d , ", i, st) - if s.attrib[i] == nil { - fmt.Fprintf(w, "nil") - } else { - switch attr := s.attrib[i].(type) { - case *token.Token: - fmt.Fprintf(w, "%s", attr.Lit) - default: - fmt.Fprintf(w, "%v", attr) - } - } - fmt.Fprintf(w, "\n") - } - return w.String() -} - -// Parser - -type Parser struct { - stack *stack - nextToken *token.Token - pos int -} - -type Scanner interface { - Scan() (tok *token.Token) -} - -func NewParser() *Parser { - p := &Parser{stack: newStack()} - p.Reset() - return p -} - -func (p *Parser) Reset() { - p.stack.reset() - p.stack.push(0, nil) -} - -func (p *Parser) Error(err error, scanner Scanner) (recovered bool, errorAttrib *parseError.Error) { - errorAttrib = &parseError.Error{ - Err: err, - ErrorToken: p.nextToken, - ErrorSymbols: p.popNonRecoveryStates(), - ExpectedTokens: make([]string, 0, 8), - } - for t, action := range actionTab[p.stack.top()].actions { - if action != nil { - errorAttrib.ExpectedTokens = append(errorAttrib.ExpectedTokens, token.TokMap.Id(token.Type(t))) - } - } - - if action := actionTab[p.stack.top()].actions[token.TokMap.Type("error")]; action != nil { - p.stack.push(int(action.(shift)), errorAttrib) // action can only be shift - } else { - return - } - - if action := actionTab[p.stack.top()].actions[p.nextToken.Type]; action != nil { - recovered = true - } - for !recovered && p.nextToken.Type != token.EOF { - p.nextToken = scanner.Scan() - if action := actionTab[p.stack.top()].actions[p.nextToken.Type]; action != nil { - recovered = true - } - } - - return -} - -func (p *Parser) popNonRecoveryStates() (removedAttribs []parseError.ErrorSymbol) { - if rs, ok := p.firstRecoveryState(); ok { - errorSymbols := p.stack.popN(p.stack.topIndex() - rs) - removedAttribs = make([]parseError.ErrorSymbol, len(errorSymbols)) - for i, e := range errorSymbols { - removedAttribs[i] = e - } - } else { - removedAttribs = []parseError.ErrorSymbol{} - } - return -} - -// recoveryState points to the highest state on the stack, which can recover -func (p *Parser) firstRecoveryState() (recoveryState int, canRecover bool) { - recoveryState, canRecover = p.stack.topIndex(), actionTab[p.stack.top()].canRecover - for recoveryState > 0 && !canRecover { - recoveryState-- - canRecover = actionTab[p.stack.peek(recoveryState)].canRecover - } - return -} - -func (p *Parser) newError(err error) error { - e := &parseError.Error{ - Err: err, - StackTop: p.stack.top(), - ErrorToken: p.nextToken, - } - actRow := actionTab[p.stack.top()] - for i, t := range actRow.actions { - if t != nil { - e.ExpectedTokens = append(e.ExpectedTokens, token.TokMap.Id(token.Type(i))) - } - } - return e -} - -func (p *Parser) Parse(scanner Scanner) (res interface{}, err error) { - p.Reset() - p.nextToken = scanner.Scan() - for acc := false; !acc; { - action := actionTab[p.stack.top()].actions[p.nextToken.Type] - if action == nil { - if recovered, errAttrib := p.Error(nil, scanner); !recovered { - p.nextToken = errAttrib.ErrorToken - return nil, p.newError(nil) - } - if action = actionTab[p.stack.top()].actions[p.nextToken.Type]; action == nil { - panic("Error recovery led to invalid action") - } - } - - switch act := action.(type) { - case accept: - res = p.stack.popN(1)[0] - acc = true - case shift: - p.stack.push(int(act), p.nextToken) - p.nextToken = scanner.Scan() - case reduce: - prod := productionsTable[int(act)] - attrib, err := prod.ReduceFunc(p.stack.popN(prod.NumSymbols)) - if err != nil { - return nil, p.newError(err) - } else { - p.stack.push(gotoTab[p.stack.top()][prod.NTType], attrib) - } - default: - panic("unknown action: " + action.String()) - } - } - return res, nil -} diff --git a/example/sr/parser/productionstable.go b/example/sr/parser/productionstable.go deleted file mode 100644 index 0d89cbb6..00000000 --- a/example/sr/parser/productionstable.go +++ /dev/null @@ -1,63 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package parser - -import "github.com/maxcalandrelli/gocc/example/sr/ast" - -type ( - //TODO: change type and variable names to be consistent with other tables - ProdTab [numProductions]ProdTabEntry - ProdTabEntry struct { - String string - Id string - NTType int - Index int - NumSymbols int - ReduceFunc func([]Attrib) (Attrib, error) - } - Attrib interface { - } -) - -var productionsTable = ProdTab{ - ProdTabEntry{ - String: `S' : Stmt << >>`, - Id: "S'", - NTType: 0, - Index: 0, - NumSymbols: 1, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return X[0], nil - }, - }, - ProdTabEntry{ - String: `Stmt : "if" id "then" Stmt << ast.NewIf(X[1], X[3]), nil >>`, - Id: "Stmt", - NTType: 1, - Index: 1, - NumSymbols: 4, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return ast.NewIf(X[1], X[3]), nil - }, - }, - ProdTabEntry{ - String: `Stmt : "if" id "then" Stmt "else" Stmt << ast.NewIfElse(X[1], X[3], X[5]), nil >>`, - Id: "Stmt", - NTType: 1, - Index: 2, - NumSymbols: 6, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return ast.NewIfElse(X[1], X[3], X[5]), nil - }, - }, - ProdTabEntry{ - String: `Stmt : id << ast.NewIdStmt(X[0]), nil >>`, - Id: "Stmt", - NTType: 1, - Index: 3, - NumSymbols: 1, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return ast.NewIdStmt(X[0]), nil - }, - }, -} diff --git a/example/sr/sr.go b/example/sr/sr.go deleted file mode 100644 index 9aa68b58..00000000 --- a/example/sr/sr.go +++ /dev/null @@ -1,62 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package sr - -import ( - "io" - - "github.com/maxcalandrelli/gocc/example/sr/iface" - "github.com/maxcalandrelli/gocc/example/sr/internal/io/stream" - "github.com/maxcalandrelli/gocc/example/sr/internal/lexer" - "github.com/maxcalandrelli/gocc/example/sr/internal/parser" - "github.com/maxcalandrelli/gocc/example/sr/internal/token" -) - -type ( - Token = token.Token - Lexer = lexer.Lexer - Parser = parser.Parser - TokenStream = iface.TokenStream - WindowReader = stream.WindowReader - Scanner = iface.Scanner -) - -func ParseFile(fpath string) (interface{}, error, int) { - if lexer, err := NewLexerFile(fpath); err == nil { - return NewParser().Parse(lexer) - } else { - return nil, err, 0 - } -} - -func ParseText(text string) (interface{}, error, int) { - return NewParser().Parse(NewLexerBytes([]byte(text))) -} - -func NewLexerBytes(src []byte) *lexer.Lexer { - return lexer.NewLexerBytes(src) -} - -func NewLexerString(src string) *lexer.Lexer { - return lexer.NewLexerBytes([]byte(src)) -} - -func NewLexerFile(fpath string) (*lexer.Lexer, error) { - return lexer.NewLexerFile(fpath) -} - -func NewParser() *parser.Parser { - return parser.NewParser() -} - -func NewWindowReaderFromBytes(src []byte) WindowReader { - return stream.NewWindowReaderFromBytes(src) -} - -func NewWindowReader(rdr io.Reader) WindowReader { - return stream.NewWindowReader(rdr) -} - -func NewLimitedWindowReader(rdr io.Reader, sizeMin, sizeMax int) WindowReader { - return stream.NewLimitedWindowReader(rdr, sizeMin, sizeMax) -} diff --git a/example/sr/sr.grammar/sr/grammar.go b/example/sr/sr.grammar/sr/grammar.go new file mode 100644 index 00000000..1a9879da --- /dev/null +++ b/example/sr/sr.grammar/sr/grammar.go @@ -0,0 +1,131 @@ +// Code generated by gocc; DO NOT EDIT. + +package sr + +import ( + "io" + + "github.com/maxcalandrelli/gocc/example/sr/sr.grammar/sr/internal/errors" + "github.com/maxcalandrelli/gocc/example/sr/sr.grammar/sr/internal/lexer" + "github.com/maxcalandrelli/gocc/example/sr/sr.grammar/sr/internal/parser" + "github.com/maxcalandrelli/gocc/example/sr/sr.grammar/sr/internal/token" +) + +const ( + INVALID = token.INVALID + EOF = token.EOF +) + +type ( + Token = token.Token + TokenMap = token.TokenMap + Pos = token.Pos + ErrorSymbol = errors.ErrorSymbol + Error = errors.Error + Lexer = lexer.Lexer + Parser = parser.Parser +) + +func NewParser() *parser.Parser { + return parser.NewParser() +} + +func ParseFile(fpath string) (interface{}, error, int) { + if lexer, err := NewLexerFile(fpath); err == nil { + return NewParser().Parse(lexer) + } else { + return nil, err, 0 + } +} + +func ParseText(text string, userData interface{}) (interface{}, error, int) { + return NewParser().Parse(NewLexerBytes([]byte(text))) +} + +func Parse(stream io.Reader) (interface{}, error, int) { + lex, err := NewLexer(stream) + if lex == nil { + return nil, err, 0 + } + return NewParser().Parse(lex) +} + +func ParseFileWithData(fpath string, userData interface{}) (interface{}, error, int) { + if lexer, err := NewLexerFile(fpath); err == nil { + return NewParser().SetContext(userData).Parse(lexer) + } else { + return nil, err, 0 + } +} + +func ParseStringWithData(text string, userData interface{}) (interface{}, error, int) { + return NewParser().SetContext(userData).Parse(NewLexerBytes([]byte(text))) +} + +func ParseWithData(stream io.Reader, userData interface{}) (interface{}, error, int) { + lex, err := NewLexer(stream) + if lex == nil { + return nil, err, 0 + } + return NewParser().SetContext(userData).Parse(lex) +} + +func ParseFilePartial(fpath string) (interface{}, error, int) { + if lexer, err := NewLexerFile(fpath); err == nil { + return NewParser().ParseLongestPrefix(lexer) + } else { + return nil, err, 0 + } +} + +func ParseTextPartial(text string, userData interface{}) (interface{}, error, int) { + return NewParser().ParseLongestPrefix(NewLexerBytes([]byte(text))) +} + +func ParsePartial(stream io.Reader) (interface{}, error, int) { + lex, err := NewLexer(stream) + if lex == nil { + return nil, err, 0 + } + return NewParser().ParseLongestPrefix(lex) +} + +func ParseFileWithDataPartial(fpath string, userData interface{}) (interface{}, error, int) { + if lexer, err := NewLexerFile(fpath); err == nil { + return NewParser().SetContext(userData).ParseLongestPrefix(lexer) + } else { + return nil, err, 0 + } +} + +func ParseStringWithDataPartial(text string, userData interface{}) (interface{}, error, int) { + return NewParser().SetContext(userData).ParseLongestPrefix(NewLexerBytes([]byte(text))) +} + +func ParseWithDataPartial(stream io.Reader, userData interface{}) (interface{}, error, int) { + lex, err := NewLexer(stream) + if lex == nil { + return nil, err, 0 + } + return NewParser().SetContext(userData).ParseLongestPrefix(lex) +} + +func NewLexerBytes(src []byte) *lexer.Lexer { + return lexer.NewLexerBytes(src) +} + +func NewLexerString(src string) *lexer.Lexer { + return lexer.NewLexerBytes([]byte(src)) +} + +func NewLexerFile(fpath string) (*lexer.Lexer, error) { + return lexer.NewLexerFile(fpath) +} + +func NewLexer(reader io.Reader) (*lexer.Lexer, error) { + return lexer.NewLexer(reader) +} + +func GetTokenMap() TokenMap { + return token.TokMap +} diff --git a/example/sr/sr.grammar/sr/iface/sr.go b/example/sr/sr.grammar/sr/iface/sr.go new file mode 100644 index 00000000..0b696f32 --- /dev/null +++ b/example/sr/sr.grammar/sr/iface/sr.go @@ -0,0 +1,49 @@ +// Code generated by gocc; DO NOT EDIT. + +package iface + +import ( + "github.com/maxcalandrelli/gocc/example/sr/sr.grammar/sr/internal/errors" + "github.com/maxcalandrelli/gocc/example/sr/sr.grammar/sr/internal/token" + "io" +) + +type ( + Token = token.Token + TokenMap = token.TokenMap + Pos = token.Pos + ErrorSymbol = errors.ErrorSymbol + Error = errors.Error + + Scanner interface { + Scan() (tok *Token) + } + + StreamScanner interface { + GetStream() TokenStream + } + + CheckPoint interface { + DistanceFrom(CheckPoint) int + } + + CheckPointable interface { + GetCheckPoint() CheckPoint + GotoCheckPoint(CheckPoint) + } + + TokenStream interface { + io.Reader + io.RuneScanner + io.Seeker + } +) + +const ( + INVALID = token.INVALID + EOF = token.EOF +) + +func GetTokenMap() TokenMap { + return token.TokMap +} diff --git a/example/astx/errors/errors.go b/example/sr/sr.grammar/sr/internal/errors/errors.go similarity index 94% rename from example/astx/errors/errors.go rename to example/sr/sr.grammar/sr/internal/errors/errors.go index 5aad6b75..bfee4741 100644 --- a/example/astx/errors/errors.go +++ b/example/sr/sr.grammar/sr/internal/errors/errors.go @@ -6,7 +6,7 @@ import ( "fmt" "strings" - "github.com/maxcalandrelli/gocc/example/astx/token" + "github.com/maxcalandrelli/gocc/example/sr/sr.grammar/sr/internal/token" ) type ErrorSymbol interface { diff --git a/example/sr/internal/io/stream/internal/stream_impl.go b/example/sr/sr.grammar/sr/internal/io/stream/internal/stream_impl.go similarity index 100% rename from example/sr/internal/io/stream/internal/stream_impl.go rename to example/sr/sr.grammar/sr/internal/io/stream/internal/stream_impl.go diff --git a/example/sr/internal/io/stream/internal/stream_public.go b/example/sr/sr.grammar/sr/internal/io/stream/internal/stream_public.go similarity index 100% rename from example/sr/internal/io/stream/internal/stream_public.go rename to example/sr/sr.grammar/sr/internal/io/stream/internal/stream_public.go diff --git a/example/ctx/internal/io/stream/stream.go b/example/sr/sr.grammar/sr/internal/io/stream/stream.go similarity index 89% rename from example/ctx/internal/io/stream/stream.go rename to example/sr/sr.grammar/sr/internal/io/stream/stream.go index cbaa8749..672d6370 100644 --- a/example/ctx/internal/io/stream/stream.go +++ b/example/sr/sr.grammar/sr/internal/io/stream/stream.go @@ -1,7 +1,7 @@ package stream import ( - internal "github.com/maxcalandrelli/gocc/example/ctx/internal/io/stream/internal" + internal "github.com/maxcalandrelli/gocc/example/sr/sr.grammar/sr/internal/io/stream/internal" "io" ) diff --git a/example/sr/internal/lexer/acttab.go b/example/sr/sr.grammar/sr/internal/lexer/acttab.go similarity index 95% rename from example/sr/internal/lexer/acttab.go rename to example/sr/sr.grammar/sr/internal/lexer/acttab.go index 417bf111..7fd1dc0c 100644 --- a/example/sr/internal/lexer/acttab.go +++ b/example/sr/sr.grammar/sr/internal/lexer/acttab.go @@ -5,7 +5,7 @@ package lexer import ( "fmt" - "github.com/maxcalandrelli/gocc/example/sr/internal/token" + "github.com/maxcalandrelli/gocc/example/sr/sr.grammar/sr/internal/token" ) type ActionTable [NumStates]ActionRow diff --git a/example/sr/internal/lexer/lexer.go b/example/sr/sr.grammar/sr/internal/lexer/lexer.go similarity index 71% rename from example/sr/internal/lexer/lexer.go rename to example/sr/sr.grammar/sr/internal/lexer/lexer.go index 1f99e272..633983b8 100644 --- a/example/sr/internal/lexer/lexer.go +++ b/example/sr/sr.grammar/sr/internal/lexer/lexer.go @@ -9,9 +9,9 @@ import ( "os" - "github.com/maxcalandrelli/gocc/example/sr/iface" - "github.com/maxcalandrelli/gocc/example/sr/internal/token" - "github.com/maxcalandrelli/gocc/example/sr/internal/io/stream" + "github.com/maxcalandrelli/gocc/example/sr/sr.grammar/sr/iface" + "github.com/maxcalandrelli/gocc/example/sr/sr.grammar/sr/internal/token" + "github.com/maxcalandrelli/gocc/example/sr/sr.grammar/sr/internal/io/stream" ) const ( @@ -37,6 +37,10 @@ func NewLexerBytes(src []byte) *Lexer { return lexer } +func NewLexerString(src string) *Lexer { + return NewLexerBytes([]byte(src)) +} + func NewLexerFile(fpath string) (*Lexer, error) { s, err := os.Open(fpath) if err != nil { @@ -66,11 +70,18 @@ func (l Lexer) GetStream() iface.TokenStream { type checkPoint int64 +func (c checkPoint) value () int64 { + return int64(c) +} + func (c checkPoint) DistanceFrom (o iface.CheckPoint) int { - return int (c - o.(checkPoint)) + return int (c.value() - o.(checkPoint).value()) } -func (l Lexer) GetCheckPoint() iface.CheckPoint { +func (l *Lexer) GetCheckPoint() iface.CheckPoint { + if l == nil { + return checkPoint(0) + } pos, _ := l.stream.Seek(0, io.SeekCurrent) return checkPoint(pos) } @@ -99,17 +110,17 @@ func (l *Lexer) Scan() (tok *token.Token) { } state = nextState if state != -1 { - switch curr { - case '\n': - l.position.Pos.Line++ - l.position.Pos.Column = 1 - case '\r': - l.position.Pos.Column = 1 - case '\t': - l.position.Pos.Column += 4 - default: - l.position.Pos.Column++ - } + switch curr { + case '\n': + l.position.Pos.Line++ + l.position.Pos.Column = 1 + case '\r': + l.position.Pos.Column = 1 + case '\t': + l.position.Pos.Column += 4 + default: + l.position.Pos.Column++ + } switch { case ActTab[state].Accept != -1: tok.Type = ActTab[state].Accept @@ -119,8 +130,12 @@ func (l *Lexer) Scan() (tok *token.Token) { state = 0 tok.Lit = []byte{} } - } else if curr != INVALID_RUNE { - l.stream.UnreadRune() + } else if curr != INVALID_RUNE{ + if len(tok.Lit) == 0 { + tok.Lit = append(tok.Lit, string(curr)...) + } else { + l.stream.UnreadRune() + } } if err == io.EOF && len(tok.Lit)==0 { tok.Type = token.EOF diff --git a/example/sr/internal/lexer/transitiontable.go b/example/sr/sr.grammar/sr/internal/lexer/transitiontable.go similarity index 100% rename from example/sr/internal/lexer/transitiontable.go rename to example/sr/sr.grammar/sr/internal/lexer/transitiontable.go diff --git a/example/ctx/parser/action.go b/example/sr/sr.grammar/sr/internal/parser/action.go similarity index 100% rename from example/ctx/parser/action.go rename to example/sr/sr.grammar/sr/internal/parser/action.go diff --git a/example/sr/internal/parser/actiontable.go b/example/sr/sr.grammar/sr/internal/parser/actiontable.go similarity index 100% rename from example/sr/internal/parser/actiontable.go rename to example/sr/sr.grammar/sr/internal/parser/actiontable.go diff --git a/example/sr/internal/parser/gototable.go b/example/sr/sr.grammar/sr/internal/parser/gototable.go similarity index 100% rename from example/sr/internal/parser/gototable.go rename to example/sr/sr.grammar/sr/internal/parser/gototable.go diff --git a/example/sr/internal/parser/parser.go b/example/sr/sr.grammar/sr/internal/parser/parser.go similarity index 85% rename from example/sr/internal/parser/parser.go rename to example/sr/sr.grammar/sr/internal/parser/parser.go index afd4fcc5..36380fa2 100644 --- a/example/sr/internal/parser/parser.go +++ b/example/sr/sr.grammar/sr/internal/parser/parser.go @@ -7,9 +7,9 @@ import ( "fmt" "strings" - "github.com/maxcalandrelli/gocc/example/sr/iface" - parseError "github.com/maxcalandrelli/gocc/example/sr/internal/errors" - "github.com/maxcalandrelli/gocc/example/sr/internal/token" + "github.com/maxcalandrelli/gocc/example/sr/sr.grammar/sr/iface" + parseError "github.com/maxcalandrelli/gocc/example/sr/sr.grammar/sr/internal/errors" + "github.com/maxcalandrelli/gocc/example/sr/sr.grammar/sr/internal/token" ) const ( @@ -95,7 +95,21 @@ type Parser struct { userContext interface{} } -type TokenStream = iface.TokenStream +type ( + TokenStream = iface.TokenStream + fakeCp struct{} + fakeCheckPointable struct{} +) + +func (f fakeCheckPointable) GetCheckPoint() iface.CheckPoint { + return fakeCp{} +} + +func (f fakeCheckPointable) GotoCheckPoint(iface.CheckPoint) {} + +func (f fakeCp) DistanceFrom(o iface.CheckPoint) int { + return 0 +} func NewParser() *Parser { return NewParserWithContext(nil) @@ -112,6 +126,15 @@ func (p *Parser) Reset() { p.stack.push(0, nil) } +func (p *Parser) SetContext(ctx interface{}) *Parser { + p.userContext = ctx + return p +} + +func (p Parser) GetContext() interface{} { + return p.userContext +} + func (p *Parser) Error(err error, scanner iface.Scanner) (recovered bool, errorAttrib *parseError.Error) { errorAttrib = &parseError.Error{ Err: err, @@ -125,7 +148,7 @@ func (p *Parser) Error(err error, scanner iface.Scanner) (recovered bool, errorA } } - if action := parserActions.table[p.stack.top()].actions[token.TokMap.Type("error")]; action != nil { + if action := parserActions.table[p.stack.top()].actions[token.TokMap.Type("λ")]; action != nil { p.stack.push(int(action.(shift)), errorAttrib) // action can only be shift } else { return @@ -202,7 +225,9 @@ func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, er if tokens == nil && (len(parserActions.table[p.stack.top()].cdActions) > 0 || longest) { return errNotRepositionable } - checkPoint = tokens.GetCheckPoint() + if longest { + checkPoint = tokens.GetCheckPoint() + } p.nextToken = scanner.Scan() if longest { afterPos = tokens.GetCheckPoint() @@ -210,20 +235,26 @@ func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, er return nil } p.Reset() - tokens, _ = scanner.(iface.CheckPointable) + if tokens, _ = scanner.(iface.CheckPointable); tokens == nil { + tokens = fakeCheckPointable{} + } + underlyingStream := TokenStream(nil) + if streamScanner, _ := scanner.(iface.StreamScanner); streamScanner != nil { + underlyingStream = streamScanner.GetStream() + } startCp := tokens.GetCheckPoint() if err := readNextToken(); err != nil { return nil, err, tokens.GetCheckPoint().DistanceFrom(startCp) } for acc := false; !acc; { action := parserActions.table[p.stack.top()].actions[p.nextToken.Type] - if action == nil { + if action == nil && underlyingStream != nil && len(parserActions.table[p.stack.top()].cdActions) > 0 { // // If no action, check if we have some context dependent parsing to try // for _, cdAction := range parserActions.table[p.stack.top()].cdActions { tokens.GotoCheckPoint(checkPoint) - cd_res, cd_err, cd_parsed := cdAction.tokenScanner(scanner.GetStream(), p.userContext) + cd_res, cd_err, cd_parsed := cdAction.tokenScanner(underlyingStream, p.userContext) if cd_err == nil && len(cd_parsed) > 0 { action = parserActions.table[p.stack.top()].actions[cdAction.tokenIndex] if action != nil { diff --git a/example/sr/internal/parser/productionstable.go b/example/sr/sr.grammar/sr/internal/parser/productionstable.go similarity index 100% rename from example/sr/internal/parser/productionstable.go rename to example/sr/sr.grammar/sr/internal/parser/productionstable.go diff --git a/example/sr/internal/token/token.go b/example/sr/sr.grammar/sr/internal/token/token.go similarity index 93% rename from example/sr/internal/token/token.go rename to example/sr/sr.grammar/sr/internal/token/token.go index 5b850a19..340679f2 100644 --- a/example/sr/internal/token/token.go +++ b/example/sr/sr.grammar/sr/internal/token/token.go @@ -48,6 +48,7 @@ func (p Pos) StartingFrom(base Pos) Pos { type TokenMap struct { typeMap []string idMap map[string]Type + litMap map[string]Type } func (m TokenMap) Id(tok Type) string { @@ -90,4 +91,10 @@ var TokMap = TokenMap{ "Λ": 4, "Λ": 5, }, + + litMap: map[string]Type{ + "if": 2, + "then": 4, + "else": 5, + }, } diff --git a/example/errorrecovery/internal/util/litconv.go b/example/sr/sr.grammar/sr/internal/util/litconv.go similarity index 100% rename from example/errorrecovery/internal/util/litconv.go rename to example/sr/sr.grammar/sr/internal/util/litconv.go diff --git a/example/errorrecovery/internal/util/rune.go b/example/sr/sr.grammar/sr/internal/util/rune.go similarity index 100% rename from example/errorrecovery/internal/util/rune.go rename to example/sr/sr.grammar/sr/internal/util/rune.go diff --git a/example/sr/main/main.go b/example/sr/sr.grammar/sr/main/main.go similarity index 94% rename from example/sr/main/main.go rename to example/sr/sr.grammar/sr/main/main.go index 8f0a4a7d..0bbf0676 100644 --- a/example/sr/main/main.go +++ b/example/sr/sr.grammar/sr/main/main.go @@ -6,7 +6,7 @@ import ( "os" "strings" - sr "github.com/maxcalandrelli/gocc/example/sr" + sr "github.com/maxcalandrelli/gocc/example/sr/sr.grammar/sr" ) func showResult(r interface{}, e error, l int) { diff --git a/example/sr/sr_test.go b/example/sr/sr_test.go index 19a88ea4..118852db 100644 --- a/example/sr/sr_test.go +++ b/example/sr/sr_test.go @@ -4,14 +4,13 @@ import ( "testing" "github.com/maxcalandrelli/gocc/example/sr/ast" - "github.com/maxcalandrelli/gocc/example/sr/lexer" - "github.com/maxcalandrelli/gocc/example/sr/parser" + "github.com/maxcalandrelli/gocc/example/sr/sr.grammar/sr" ) func parse(src string) (stmt ast.Stmt, err error) { - lex := lexer.NewLexer([]byte(src)) - p := parser.NewParser() - if res, err := p.Parse(lex); err == nil { + lex := sr.NewLexerString(src) + p := sr.NewParser() + if res, err, _ := p.Parse(lex); err == nil { stmt = res.(ast.Stmt) } return diff --git a/example/sr/token/token.go b/example/sr/token/token.go deleted file mode 100644 index e6c12d19..00000000 --- a/example/sr/token/token.go +++ /dev/null @@ -1,78 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package token - -import ( - "fmt" -) - -type Token struct { - Type - Lit []byte - Pos -} - -type Type int - -const ( - INVALID Type = iota - EOF -) - -type Pos struct { - Offset int - Line int - Column int -} - -func (p Pos) String() string { - return fmt.Sprintf("Pos(offset=%d, line=%d, column=%d)", p.Offset, p.Line, p.Column) -} - -type TokenMap struct { - typeMap []string - idMap map[string]Type -} - -func (m TokenMap) Id(tok Type) string { - if int(tok) < len(m.typeMap) { - return m.typeMap[tok] - } - return "unknown" -} - -func (m TokenMap) Type(tok string) Type { - if typ, exist := m.idMap[tok]; exist { - return typ - } - return INVALID -} - -func (m TokenMap) TokenString(tok *Token) string { - //TODO: refactor to print pos & token string properly - return fmt.Sprintf("%s(%d,%s)", m.Id(tok.Type), tok.Type, tok.Lit) -} - -func (m TokenMap) StringType(typ Type) string { - return fmt.Sprintf("%s(%d)", m.Id(typ), typ) -} - -var TokMap = TokenMap{ - typeMap: []string{ - "INVALID", - "$", - "if", - "id", - "then", - "else", - }, - - idMap: map[string]Type{ - "INVALID": 0, - "$": 1, - "if": 2, - "id": 3, - "then": 4, - "else": 5, - }, -} diff --git a/example/sr/util/litconv.go b/example/sr/util/litconv.go deleted file mode 100644 index 1aeb6166..00000000 --- a/example/sr/util/litconv.go +++ /dev/null @@ -1,108 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package util - -import ( - "fmt" - "strconv" - "unicode" - "unicode/utf8" -) - -/* Interface */ - -/* -Convert the literal value of a scanned token to rune -*/ -func RuneValue(lit []byte) rune { - if lit[1] == '\\' { - return escapeCharVal(lit) - } - r, size := utf8.DecodeRune(lit[1:]) - if size != len(lit)-2 { - panic(fmt.Sprintf("Error decoding rune. Lit: %s, rune: %d, size%d\n", lit, r, size)) - } - return r -} - -/* -Convert the literal value of a scanned token to int64 -*/ -func IntValue(lit []byte) (int64, error) { - return strconv.ParseInt(string(lit), 10, 64) -} - -/* -Convert the literal value of a scanned token to uint64 -*/ -func UintValue(lit []byte) (uint64, error) { - return strconv.ParseUint(string(lit), 10, 64) -} - -/* Util */ - -func escapeCharVal(lit []byte) rune { - var i, base, max uint32 - offset := 2 - switch lit[offset] { - case 'a': - return '\a' - case 'b': - return '\b' - case 'f': - return '\f' - case 'n': - return '\n' - case 'r': - return '\r' - case 't': - return '\t' - case 'v': - return '\v' - case '\\': - return '\\' - case '\'': - return '\'' - case '0', '1', '2', '3', '4', '5', '6', '7': - i, base, max = 3, 8, 255 - case 'x': - i, base, max = 2, 16, 255 - offset++ - case 'u': - i, base, max = 4, 16, unicode.MaxRune - offset++ - case 'U': - i, base, max = 8, 16, unicode.MaxRune - offset++ - default: - panic(fmt.Sprintf("Error decoding character literal: %s\n", lit)) - } - - var x uint32 - for ; i > 0 && offset < len(lit)-1; i-- { - ch, size := utf8.DecodeRune(lit[offset:]) - offset += size - d := uint32(digitVal(ch)) - if d >= base { - panic(fmt.Sprintf("charVal(%s): illegal character (%c) in escape sequence. size=%d, offset=%d", lit, ch, size, offset)) - } - x = x*base + d - } - if x > max || 0xD800 <= x && x < 0xE000 { - panic(fmt.Sprintf("Error decoding escape char value. Lit:%s, offset:%d, escape sequence is invalid Unicode code point\n", lit, offset)) - } - - return rune(x) -} - -func digitVal(ch rune) int { - switch { - case '0' <= ch && ch <= '9': - return int(ch) - '0' - case 'a' <= ch && ch <= 'f': - return int(ch) - 'a' + 10 - case 'A' <= ch && ch <= 'F': - return int(ch) - 'A' + 10 - } - return 16 // larger than any legal digit val -} diff --git a/example/sr/util/rune.go b/example/sr/util/rune.go deleted file mode 100644 index bd8523a4..00000000 --- a/example/sr/util/rune.go +++ /dev/null @@ -1,39 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package util - -import ( - "fmt" -) - -func RuneToString(r rune) string { - if r >= 0x20 && r < 0x7f { - return fmt.Sprintf("'%c'", r) - } - switch r { - case 0x07: - return "'\\a'" - case 0x08: - return "'\\b'" - case 0x0C: - return "'\\f'" - case 0x0A: - return "'\\n'" - case 0x0D: - return "'\\r'" - case 0x09: - return "'\\t'" - case 0x0b: - return "'\\v'" - case 0x5c: - return "'\\\\\\'" - case 0x27: - return "'\\''" - case 0x22: - return "'\\\"'" - } - if r < 0x10000 { - return fmt.Sprintf("\\u%04x", r) - } - return fmt.Sprintf("\\U%08x", r) -} diff --git a/internal/ast/syntaxerror.go b/internal/ast/syntaxerror.go index ad8f7aae..b4305bee 100644 --- a/internal/ast/syntaxerror.go +++ b/internal/ast/syntaxerror.go @@ -35,6 +35,8 @@ func (SyntaxError) String() string { func (SyntaxError) IsError() bool { return true } +func (SyntaxError) IsTerminal() bool { return true } + func (SyntaxError) SymbolName() string { return config.INTERNAL_SYMBOL_ERROR } diff --git a/internal/ast/syntaxprodid.go b/internal/ast/syntaxprodid.go index a60cf78e..18892839 100644 --- a/internal/ast/syntaxprodid.go +++ b/internal/ast/syntaxprodid.go @@ -43,7 +43,6 @@ func (this SyntaxProdId) String() string { } func (this SyntaxProdId) SymbolName() string { - //return this.SymbolString() return fmt.Sprintf("%s<%s>", config.INTERNAL_SYMBOL_PROD, this.string) } diff --git a/internal/base/gen/gen.go b/internal/base/gen/gen.go index d5f06359..ea602053 100644 --- a/internal/base/gen/gen.go +++ b/internal/base/gen/gen.go @@ -19,6 +19,6 @@ import ( "github.com/maxcalandrelli/gocc/internal/config" ) -func Gen(pkg, outdir, subpath string, cfg config.Config) { - golang.Gen(pkg, outdir, subpath, cfg) +func Gen(pkg, outdir, internal, iface string, cfg config.Config, hasSyntax bool) { + golang.Gen(pkg, outdir, internal, iface, cfg, hasSyntax) } diff --git a/internal/base/gen/golang/base.go b/internal/base/gen/golang/base.go index 34bcbe50..4199eb48 100644 --- a/internal/base/gen/golang/base.go +++ b/internal/base/gen/golang/base.go @@ -16,48 +16,52 @@ package golang import ( "bytes" + "fmt" "go/format" "path" "text/template" "github.com/maxcalandrelli/gocc/internal/config" - "github.com/maxcalandrelli/gocc/internal/io" ) type data struct { - MyName string - Pkg string - Outdir string - Subpath string - Config config.Config + MyName string + Pkg string + Outdir string + InternalSubdir string + Config config.Config + HasSyntax bool + IfaceDir string + ExportWindowReader bool } -func Gen(pkg, outdir, subpath string, cfg config.Config) { - baseName := path.Base(outdir) +func Gen(pkg, outdir, internal, iface string, cfg config.Config, hasSyntax bool) { d := data{ - MyName: baseName, - Pkg: pkg, - Outdir: outdir, - Subpath: subpath, - Config: cfg, + MyName: cfg.ProjectName(), + Pkg: pkg, + Outdir: outdir, + InternalSubdir: internal, + Config: cfg, + HasSyntax: hasSyntax, + IfaceDir: iface, + ExportWindowReader: false, } - if !cfg.NoLexer() { - genBase(d) + if !cfg.NoLexer() && hasSyntax { genMain(d) } + genBase(d) genIface(d) } func genBase(d data) { - basePath := path.Join(d.Outdir, d.MyName+".go") + basePath := path.Join(d.Outdir, "grammar.go") tmpl, err := template.New(d.MyName).Parse(baseSrc[1:]) if err != nil { panic(err) } buf := new(bytes.Buffer) err = tmpl.Execute(buf, d) - // Use go/format to indent the idMap literal correctly. source, err := format.Source(buf.Bytes()) if err != nil { panic(err) @@ -82,7 +86,7 @@ func genMain(d data) { } func genIface(d data) { - basePath := path.Join(d.Outdir, "iface", "iface.go") + basePath := path.Join(d.Outdir, d.IfaceDir, fmt.Sprintf("%s.go", d.MyName)) tmpl, err := template.New(d.MyName).Parse(ifaceSrc[1:]) if err != nil { panic(err) @@ -103,24 +107,53 @@ const baseSrc string = ` package {{.MyName}} import ( + {{- if not .Config.NoLexer }} "io" + {{- end}} + + "{{.Pkg}}/{{.InternalSubdir}}/token" + {{- if not .Config.NoLexer }} + "{{.Pkg}}/{{.InternalSubdir}}/lexer" + {{- end}} + {{- if .HasSyntax}} + "{{.Pkg}}/{{.InternalSubdir}}/errors" + "{{.Pkg}}/{{.InternalSubdir}}/parser" + {{- end}} + {{- if .ExportWindowReader }} + "{{.Pkg}}/{{.InternalSubdir}}/io/stream" + {{- end}} +) - "{{.Pkg}}/{{.Subpath}}/token" - "{{.Pkg}}/{{.Subpath}}/lexer" - "{{.Pkg}}/{{.Subpath}}/parser" - "{{.Pkg}}/{{.Subpath}}/io/stream" - "{{.Pkg}}/iface" +const ( + INVALID = token.INVALID + EOF = token.EOF ) type ( Token = token.Token + TokenMap = token.TokenMap + Pos = token.Pos + {{- if .HasSyntax}} + ErrorSymbol = errors.ErrorSymbol + Error = errors.Error + {{- end}} + {{- if not .Config.NoLexer }} Lexer = lexer.Lexer - Parser = parser.Parser - TokenStream = iface.TokenStream + {{- end}} + {{- if .ExportWindowReader }} WindowReader = stream.WindowReader - Scanner = iface.Scanner + {{- end}} + {{- if .HasSyntax}} + Parser = parser.Parser + {{- end}} ) +{{- if .HasSyntax}} +func NewParser() *parser.Parser { + return parser.NewParser() +} + +{{- if not .Config.NoLexer }} func ParseFile(fpath string) (interface{}, error, int) { if lexer, err := NewLexerFile(fpath); err == nil { @@ -130,10 +163,84 @@ func ParseFile(fpath string) (interface{}, error, int) { } } -func ParseText(text string) (interface{}, error, int) { +func ParseText(text string, userData interface{}) (interface{}, error, int) { return NewParser().Parse(NewLexerBytes([]byte(text))) } +func Parse(stream io.Reader) (interface{}, error, int) { + lex, err := NewLexer(stream) + if lex == nil { + return nil, err, 0 + } + return NewParser().Parse(lex) +} + +func ParseFileWithData(fpath string, userData interface{}) (interface{}, error, int) { + if lexer, err := NewLexerFile(fpath); err == nil { + return NewParser().SetContext(userData).Parse(lexer) + } else { + return nil, err, 0 + } +} + +func ParseStringWithData(text string, userData interface{}) (interface{}, error, int) { + return NewParser().SetContext(userData).Parse(NewLexerBytes([]byte(text))) +} + +func ParseWithData(stream io.Reader, userData interface{}) (interface{}, error, int) { + lex, err := NewLexer(stream) + if lex == nil { + return nil, err, 0 + } + return NewParser().SetContext(userData).Parse(lex) +} + + +func ParseFilePartial(fpath string) (interface{}, error, int) { + if lexer, err := NewLexerFile(fpath); err == nil { + return NewParser().ParseLongestPrefix(lexer) + } else { + return nil, err, 0 + } +} + +func ParseTextPartial(text string, userData interface{}) (interface{}, error, int) { + return NewParser().ParseLongestPrefix(NewLexerBytes([]byte(text))) +} + +func ParsePartial(stream io.Reader) (interface{}, error, int) { + lex, err := NewLexer(stream) + if lex == nil { + return nil, err, 0 + } + return NewParser().ParseLongestPrefix(lex) +} + +func ParseFileWithDataPartial(fpath string, userData interface{}) (interface{}, error, int) { + if lexer, err := NewLexerFile(fpath); err == nil { + return NewParser().SetContext(userData).ParseLongestPrefix(lexer) + } else { + return nil, err, 0 + } +} + +func ParseStringWithDataPartial(text string, userData interface{}) (interface{}, error, int) { + return NewParser().SetContext(userData).ParseLongestPrefix(NewLexerBytes([]byte(text))) +} + +func ParseWithDataPartial(stream io.Reader, userData interface{}) (interface{}, error, int) { + lex, err := NewLexer(stream) + if lex == nil { + return nil, err, 0 + } + return NewParser().SetContext(userData).ParseLongestPrefix(lex) +} + + +{{- end}} +{{- end}} +{{- if not .Config.NoLexer }} + func NewLexerBytes(src []byte) *lexer.Lexer { return lexer.NewLexerBytes(src) } @@ -146,11 +253,12 @@ func NewLexerFile(fpath string) (*lexer.Lexer, error) { return lexer.NewLexerFile(fpath) } -func NewParser() *parser.Parser { - return parser.NewParser() +func NewLexer(reader io.Reader) (*lexer.Lexer, error) { + return lexer.NewLexer(reader) } +{{- end}} - +{{- if .ExportWindowReader }} func NewWindowReaderFromBytes(src []byte) WindowReader { return stream.NewWindowReaderFromBytes(src) } @@ -162,6 +270,12 @@ func NewWindowReader(rdr io.Reader) WindowReader { func NewLimitedWindowReader(rdr io.Reader, sizeMin, sizeMax int) WindowReader { return stream.NewLimitedWindowReader(rdr, sizeMin, sizeMax) } +{{- end}} + + +func GetTokenMap() TokenMap { + return token.TokMap +} ` @@ -227,12 +341,23 @@ package iface import ( "io" - "{{.Pkg}}/{{.Subpath}}/token" + "{{.Pkg}}/{{.InternalSubdir}}/token" + {{- if .HasSyntax}} + "{{.Pkg}}/{{.InternalSubdir}}/errors" + {{- end}} ) type ( + Token = token.Token + TokenMap = token.TokenMap + Pos = token.Pos + {{- if .HasSyntax}} + ErrorSymbol = errors.ErrorSymbol + Error = errors.Error + {{- end}} + Scanner interface { - Scan() (tok *token.Token) + Scan() (tok *Token) } StreamScanner interface { @@ -244,16 +369,26 @@ type ( } CheckPointable interface { - GetCheckPoint() CheckPoint + GetCheckPoint() CheckPoint GotoCheckPoint(CheckPoint) } TokenStream interface { io.Reader - io.RuneScanner - io.Seeker + io.RuneScanner + io.Seeker } ) +const ( + INVALID = token.INVALID + EOF = token.EOF +) + +func GetTokenMap() TokenMap { + return token.TokMap +} + + ` diff --git a/internal/config/config.go b/internal/config/config.go index d1383aac..e8bc238d 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -22,10 +22,13 @@ import ( "os" "path" "path/filepath" + "regexp" "strings" ) const ( + VERSION = "1.1.0035" + INTERNAL_SYMBOL_EMPTY = "ε" INTERNAL_SYMBOL_ERROR = "λ" // (λάθος) INTERNAL_SYMBOL_INVALID = "INVALID" // (άκυρος) @@ -48,6 +51,7 @@ type ( AutoResolveLRConf() bool SourceFile() string OutDir() string + InternalSubdir() string NoLexer() bool DebugLexer() bool @@ -76,6 +80,7 @@ type ( outDir string pkg string srcFile string + internal string verbose *bool } ) @@ -154,12 +159,17 @@ func (this *ConfigRecord) TokenDir() string { return path.Join(this.outDir, "token") } +func (this *ConfigRecord) InternalSubdir() string { + return this.internal +} + func (this *ConfigRecord) Package() string { return this.pkg } func (this *ConfigRecord) ProjectName() string { - _, file := path.Split(this.pkg) + _, file := path.Split(this.srcFile) + file = file[:len(file)-len(path.Ext(file))] return file } @@ -173,6 +183,7 @@ func (this *ConfigRecord) PrintParams() { fmt.Printf("-p = %v\n", this.pkg) fmt.Printf("-u = %v\n", *this.allowUnreachable) fmt.Printf("-v = %v\n", *this.verbose) + fmt.Printf("-internal = %v\n", this.internal) } /*** Utility routines ***/ @@ -183,8 +194,9 @@ func (this *ConfigRecord) getFlags() error { this.debugParser = flag.Bool("debug_parser", false, "enable debug logging in parser") this.help = flag.Bool("h", false, "help") this.noLexer = flag.Bool("no_lexer", false, "do not generate a lexer") - flag.StringVar(&this.outDir, "o", this.workingDir, "output dir.") + flag.StringVar(&this.outDir, "o", path.Join(this.workingDir, "@f.grammar", "@f"), "output directory format (@f='name' if input file is 'name.bnf')") flag.StringVar(&this.pkg, "p", defaultPackage(this.outDir), "package") + flag.StringVar(&this.internal, "internal", "internal", "internal subdir name") this.allowUnreachable = flag.Bool("u", false, "allow unreachable productions") this.verbose = flag.Bool("v", false, "verbose") flag.Parse() @@ -192,26 +204,32 @@ func (this *ConfigRecord) getFlags() error { if *this.noLexer && *this.debugLexer { return errors.New("no_lexer and debug_lexer cannot both be set") } - - this.outDir = getOutDir(this.outDir, this.workingDir) - if this.outDir != this.workingDir { - this.pkg = defaultPackage(this.outDir) - } - if len(flag.Args()) != 1 && !*this.help { return errors.New("Too few arguments") } this.srcFile = flag.Arg(0) - + this.outDir = getOutDir(this.outDir, this.workingDir, this.srcFile) + if this.outDir != this.workingDir { + this.pkg = defaultPackage(this.outDir) + } return nil } -func getOutDir(outDirSpec, wd string) string { - if strings.HasPrefix(outDirSpec, wd) { - return outDirSpec - } - return path.Join(wd, outDirSpec) +func getOutDir(outDirSpec, wd, src string) string { + pattern := func() string { + if strings.HasPrefix(outDirSpec, wd) { + return outDirSpec + } + if path.IsAbs(outDirSpec) { + return outDirSpec + } + return path.Join(wd, outDirSpec) + }() + _, fname := path.Split(src) + fname = fname[:len(fname)-len(path.Ext(fname))] + res := regexp.MustCompile("@f").ReplaceAllString(pattern, fname) + return res } func defaultPackage(wd string) string { diff --git a/internal/frontend/reparsed/grammar.go b/internal/frontend/reparsed/grammar.go new file mode 100644 index 00000000..7dd2c6f1 --- /dev/null +++ b/internal/frontend/reparsed/grammar.go @@ -0,0 +1,131 @@ +// Code generated by gocc; DO NOT EDIT. + +package gocc2 + +import ( + "io" + + "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/internal/errors" + "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/internal/lexer" + "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/internal/parser" + "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/internal/token" +) + +const ( + INVALID = token.INVALID + EOF = token.EOF +) + +type ( + Token = token.Token + TokenMap = token.TokenMap + Pos = token.Pos + ErrorSymbol = errors.ErrorSymbol + Error = errors.Error + Lexer = lexer.Lexer + Parser = parser.Parser +) + +func NewParser() *parser.Parser { + return parser.NewParser() +} + +func ParseFile(fpath string) (interface{}, error, int) { + if lexer, err := NewLexerFile(fpath); err == nil { + return NewParser().Parse(lexer) + } else { + return nil, err, 0 + } +} + +func ParseText(text string, userData interface{}) (interface{}, error, int) { + return NewParser().Parse(NewLexerBytes([]byte(text))) +} + +func Parse(stream io.Reader) (interface{}, error, int) { + lex, err := NewLexer(stream) + if lex == nil { + return nil, err, 0 + } + return NewParser().Parse(lex) +} + +func ParseFileWithData(fpath string, userData interface{}) (interface{}, error, int) { + if lexer, err := NewLexerFile(fpath); err == nil { + return NewParser().SetContext(userData).Parse(lexer) + } else { + return nil, err, 0 + } +} + +func ParseStringWithData(text string, userData interface{}) (interface{}, error, int) { + return NewParser().SetContext(userData).Parse(NewLexerBytes([]byte(text))) +} + +func ParseWithData(stream io.Reader, userData interface{}) (interface{}, error, int) { + lex, err := NewLexer(stream) + if lex == nil { + return nil, err, 0 + } + return NewParser().SetContext(userData).Parse(lex) +} + +func ParseFilePartial(fpath string) (interface{}, error, int) { + if lexer, err := NewLexerFile(fpath); err == nil { + return NewParser().ParseLongestPrefix(lexer) + } else { + return nil, err, 0 + } +} + +func ParseTextPartial(text string, userData interface{}) (interface{}, error, int) { + return NewParser().ParseLongestPrefix(NewLexerBytes([]byte(text))) +} + +func ParsePartial(stream io.Reader) (interface{}, error, int) { + lex, err := NewLexer(stream) + if lex == nil { + return nil, err, 0 + } + return NewParser().ParseLongestPrefix(lex) +} + +func ParseFileWithDataPartial(fpath string, userData interface{}) (interface{}, error, int) { + if lexer, err := NewLexerFile(fpath); err == nil { + return NewParser().SetContext(userData).ParseLongestPrefix(lexer) + } else { + return nil, err, 0 + } +} + +func ParseStringWithDataPartial(text string, userData interface{}) (interface{}, error, int) { + return NewParser().SetContext(userData).ParseLongestPrefix(NewLexerBytes([]byte(text))) +} + +func ParseWithDataPartial(stream io.Reader, userData interface{}) (interface{}, error, int) { + lex, err := NewLexer(stream) + if lex == nil { + return nil, err, 0 + } + return NewParser().SetContext(userData).ParseLongestPrefix(lex) +} + +func NewLexerBytes(src []byte) *lexer.Lexer { + return lexer.NewLexerBytes(src) +} + +func NewLexerString(src string) *lexer.Lexer { + return lexer.NewLexerBytes([]byte(src)) +} + +func NewLexerFile(fpath string) (*lexer.Lexer, error) { + return lexer.NewLexerFile(fpath) +} + +func NewLexer(reader io.Reader) (*lexer.Lexer, error) { + return lexer.NewLexer(reader) +} + +func GetTokenMap() TokenMap { + return token.TokMap +} diff --git a/internal/frontend/reparsed/iface/gocc2.go b/internal/frontend/reparsed/iface/gocc2.go new file mode 100644 index 00000000..c11ff9fd --- /dev/null +++ b/internal/frontend/reparsed/iface/gocc2.go @@ -0,0 +1,49 @@ +// Code generated by gocc; DO NOT EDIT. + +package iface + +import ( + "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/internal/errors" + "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/internal/token" + "io" +) + +type ( + Token = token.Token + TokenMap = token.TokenMap + Pos = token.Pos + ErrorSymbol = errors.ErrorSymbol + Error = errors.Error + + Scanner interface { + Scan() (tok *Token) + } + + StreamScanner interface { + GetStream() TokenStream + } + + CheckPoint interface { + DistanceFrom(CheckPoint) int + } + + CheckPointable interface { + GetCheckPoint() CheckPoint + GotoCheckPoint(CheckPoint) + } + + TokenStream interface { + io.Reader + io.RuneScanner + io.Seeker + } +) + +const ( + INVALID = token.INVALID + EOF = token.EOF +) + +func GetTokenMap() TokenMap { + return token.TokMap +} diff --git a/internal/frontend/reparsed/internal/errors/next/errors.go b/internal/frontend/reparsed/internal/errors/next/errors.go deleted file mode 100644 index 1c32b551..00000000 --- a/internal/frontend/reparsed/internal/errors/next/errors.go +++ /dev/null @@ -1,56 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package errors - -import ( - "fmt" - "strings" - - token "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/internal/token/next" -) - -type ErrorSymbol interface { -} - -type Error struct { - Err error - ErrorToken *token.Token - ErrorSymbols []ErrorSymbol - ExpectedTokens []string - StackTop int -} - -func (e *Error) String() string { - w := new(strings.Builder) - fmt.Fprintf(w, "Error") - if e.Err != nil { - fmt.Fprintf(w, " %s\n", e.Err) - } else { - fmt.Fprintf(w, "\n") - } - fmt.Fprintf(w, "Token: type=%d, lit=%s\n", e.ErrorToken.Type, e.ErrorToken.Lit) - fmt.Fprintf(w, "Pos: offset=%d, line=%d, column=%d\n", e.ErrorToken.Pos.Offset, e.ErrorToken.Pos.Line, e.ErrorToken.Pos.Column) - fmt.Fprintf(w, "Expected one of: ") - for _, sym := range e.ExpectedTokens { - fmt.Fprintf(w, "%s ", sym) - } - fmt.Fprintf(w, "ErrorSymbol:\n") - for _, sym := range e.ErrorSymbols { - fmt.Fprintf(w, "%v\n", sym) - } - return w.String() -} - -func (e *Error) Error() string { - w := new(strings.Builder) - fmt.Fprintf(w, "Error in S%d: %s, %s", e.StackTop, token.TokMap.TokenString(e.ErrorToken), e.ErrorToken.Pos.String()) - if e.Err != nil { - fmt.Fprintf(w, ": %+v", e.Err) - } else { - fmt.Fprintf(w, ", expected one of: ") - for _, expected := range e.ExpectedTokens { - fmt.Fprintf(w, "%s ", expected) - } - } - return w.String() -} diff --git a/internal/frontend/reparsed/iface/iface.go b/internal/frontend/reparsed/internal/iface/gocc2.go similarity index 100% rename from internal/frontend/reparsed/iface/iface.go rename to internal/frontend/reparsed/internal/iface/gocc2.go diff --git a/internal/frontend/reparsed/internal/lexer/lexer.go b/internal/frontend/reparsed/internal/lexer/lexer.go index b56d6933..799492b6 100644 --- a/internal/frontend/reparsed/internal/lexer/lexer.go +++ b/internal/frontend/reparsed/internal/lexer/lexer.go @@ -37,6 +37,10 @@ func NewLexerBytes(src []byte) *Lexer { return lexer } +func NewLexerString(src string) *Lexer { + return NewLexerBytes([]byte(src)) +} + func NewLexerFile(fpath string) (*Lexer, error) { s, err := os.Open(fpath) if err != nil { @@ -66,11 +70,18 @@ func (l Lexer) GetStream() iface.TokenStream { type checkPoint int64 +func (c checkPoint) value () int64 { + return int64(c) +} + func (c checkPoint) DistanceFrom (o iface.CheckPoint) int { - return int (c - o.(checkPoint)) + return int (c.value() - o.(checkPoint).value()) } -func (l Lexer) GetCheckPoint() iface.CheckPoint { +func (l *Lexer) GetCheckPoint() iface.CheckPoint { + if l == nil { + return checkPoint(0) + } pos, _ := l.stream.Seek(0, io.SeekCurrent) return checkPoint(pos) } @@ -99,17 +110,17 @@ func (l *Lexer) Scan() (tok *token.Token) { } state = nextState if state != -1 { - switch curr { - case '\n': - l.position.Pos.Line++ - l.position.Pos.Column = 1 - case '\r': - l.position.Pos.Column = 1 - case '\t': - l.position.Pos.Column += 4 - default: - l.position.Pos.Column++ - } + switch curr { + case '\n': + l.position.Pos.Line++ + l.position.Pos.Column = 1 + case '\r': + l.position.Pos.Column = 1 + case '\t': + l.position.Pos.Column += 4 + default: + l.position.Pos.Column++ + } switch { case ActTab[state].Accept != -1: tok.Type = ActTab[state].Accept @@ -119,8 +130,12 @@ func (l *Lexer) Scan() (tok *token.Token) { state = 0 tok.Lit = []byte{} } - } else if curr != INVALID_RUNE { - l.stream.UnreadRune() + } else if curr != INVALID_RUNE{ + if len(tok.Lit) == 0 { + tok.Lit = append(tok.Lit, string(curr)...) + } else { + l.stream.UnreadRune() + } } if err == io.EOF && len(tok.Lit)==0 { tok.Type = token.EOF diff --git a/internal/frontend/reparsed/internal/lexer/next/acttab.go b/internal/frontend/reparsed/internal/lexer/next/acttab.go deleted file mode 100644 index 5aa89985..00000000 --- a/internal/frontend/reparsed/internal/lexer/next/acttab.go +++ /dev/null @@ -1,459 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package lexer - -import ( - "fmt" - - token "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/internal/token/next" -) - -type ActionTable [NumStates]ActionRow - -type ActionRow struct { - Accept token.Type - Ignore string -} - -func (a ActionRow) String() string { - return fmt.Sprintf("Accept=%d, Ignore=%s", a.Accept, a.Ignore) -} - -var ActTab = ActionTable{ - ActionRow{ // S0, - Accept: 0, - Ignore: "", - }, - ActionRow{ // S1, Ignore("!whitespace") - Accept: -1, - Ignore: "!whitespace", - }, - ActionRow{ // S2, - Accept: 0, - Ignore: "", - }, - ActionRow{ // S3, - Accept: 0, - Ignore: "", - }, - ActionRow{ // S4, - Accept: 0, - Ignore: "", - }, - ActionRow{ // S5, Accept("Λ<(>") - Accept: 12, - Ignore: "", - }, - ActionRow{ // S6, Accept("Λ<)>") - Accept: 13, - Ignore: "", - }, - ActionRow{ // S7, Accept("Λ<->") - Accept: 10, - Ignore: "", - }, - ActionRow{ // S8, Accept("Λ<.>") - Accept: 8, - Ignore: "", - }, - ActionRow{ // S9, - Accept: 0, - Ignore: "", - }, - ActionRow{ // S10, Accept("Λ<:>") - Accept: 3, - Ignore: "", - }, - ActionRow{ // S11, Accept("Λ<;>") - Accept: 4, - Ignore: "", - }, - ActionRow{ // S12, - Accept: 0, - Ignore: "", - }, - ActionRow{ // S13, Accept("prodId") - Accept: 19, - Ignore: "", - }, - ActionRow{ // S14, Accept("Λ<[>") - Accept: 14, - Ignore: "", - }, - ActionRow{ // S15, Accept("Λ<]>") - Accept: 15, - Ignore: "", - }, - ActionRow{ // S16, Accept("regDefId") - Accept: 5, - Ignore: "", - }, - ActionRow{ // S17, - Accept: 0, - Ignore: "", - }, - ActionRow{ // S18, Accept("tokId") - Accept: 2, - Ignore: "", - }, - ActionRow{ // S19, Accept("tokId") - Accept: 2, - Ignore: "", - }, - ActionRow{ // S20, Accept("Λ<{>") - Accept: 16, - Ignore: "", - }, - ActionRow{ // S21, Accept("Λ<|>") - Accept: 7, - Ignore: "", - }, - ActionRow{ // S22, Accept("Λ<}>") - Accept: 17, - Ignore: "", - }, - ActionRow{ // S23, Accept("Λ<~>") - Accept: 11, - Ignore: "", - }, - ActionRow{ // S24, Accept("Λ<ε>") - Accept: 24, - Ignore: "", - }, - ActionRow{ // S25, Accept("Λ<λ>") - Accept: 22, - Ignore: "", - }, - ActionRow{ // S26, Accept("ignoredTokId") - Accept: 6, - Ignore: "", - }, - ActionRow{ // S27, Accept("string_lit") - Accept: 20, - Ignore: "", - }, - ActionRow{ // S28, - Accept: 0, - Ignore: "", - }, - ActionRow{ // S29, - Accept: 0, - Ignore: "", - }, - ActionRow{ // S30, - Accept: 0, - Ignore: "", - }, - ActionRow{ // S31, - Accept: 0, - Ignore: "", - }, - ActionRow{ // S32, - Accept: 0, - Ignore: "", - }, - ActionRow{ // S33, - Accept: 0, - Ignore: "", - }, - ActionRow{ // S34, - Accept: 0, - Ignore: "", - }, - ActionRow{ // S35, Accept("prodId") - Accept: 19, - Ignore: "", - }, - ActionRow{ // S36, Accept("prodId") - Accept: 19, - Ignore: "", - }, - ActionRow{ // S37, Accept("prodId") - Accept: 19, - Ignore: "", - }, - ActionRow{ // S38, Accept("prodId") - Accept: 19, - Ignore: "", - }, - ActionRow{ // S39, Accept("regDefId") - Accept: 5, - Ignore: "", - }, - ActionRow{ // S40, Accept("regDefId") - Accept: 5, - Ignore: "", - }, - ActionRow{ // S41, Accept("regDefId") - Accept: 5, - Ignore: "", - }, - ActionRow{ // S42, Accept("regDefId") - Accept: 5, - Ignore: "", - }, - ActionRow{ // S43, Accept("string_lit") - Accept: 20, - Ignore: "", - }, - ActionRow{ // S44, Accept("tokId") - Accept: 2, - Ignore: "", - }, - ActionRow{ // S45, Accept("tokId") - Accept: 2, - Ignore: "", - }, - ActionRow{ // S46, Accept("tokId") - Accept: 2, - Ignore: "", - }, - ActionRow{ // S47, Accept("tokId") - Accept: 2, - Ignore: "", - }, - ActionRow{ // S48, Accept("tokId") - Accept: 2, - Ignore: "", - }, - ActionRow{ // S49, Accept("tokId") - Accept: 2, - Ignore: "", - }, - ActionRow{ // S50, Accept("ignoredTokId") - Accept: 6, - Ignore: "", - }, - ActionRow{ // S51, Accept("ignoredTokId") - Accept: 6, - Ignore: "", - }, - ActionRow{ // S52, Accept("ignoredTokId") - Accept: 6, - Ignore: "", - }, - ActionRow{ // S53, Accept("ignoredTokId") - Accept: 6, - Ignore: "", - }, - ActionRow{ // S54, - Accept: 0, - Ignore: "", - }, - ActionRow{ // S55, - Accept: 0, - Ignore: "", - }, - ActionRow{ // S56, - Accept: 0, - Ignore: "", - }, - ActionRow{ // S57, - Accept: 0, - Ignore: "", - }, - ActionRow{ // S58, - Accept: 0, - Ignore: "", - }, - ActionRow{ // S59, - Accept: 0, - Ignore: "", - }, - ActionRow{ // S60, - Accept: 0, - Ignore: "", - }, - ActionRow{ // S61, - Accept: 0, - Ignore: "", - }, - ActionRow{ // S62, - Accept: 0, - Ignore: "", - }, - ActionRow{ // S63, - Accept: 0, - Ignore: "", - }, - ActionRow{ // S64, Accept("char_lit") - Accept: 9, - Ignore: "", - }, - ActionRow{ // S65, - Accept: 0, - Ignore: "", - }, - ActionRow{ // S66, Ignore("!comment") - Accept: -1, - Ignore: "!comment", - }, - ActionRow{ // S67, - Accept: 0, - Ignore: "", - }, - ActionRow{ // S68, Accept("tokId") - Accept: 2, - Ignore: "", - }, - ActionRow{ // S69, Accept("tokId") - Accept: 2, - Ignore: "", - }, - ActionRow{ // S70, - Accept: 0, - Ignore: "", - }, - ActionRow{ // S71, - Accept: 0, - Ignore: "", - }, - ActionRow{ // S72, - Accept: 0, - Ignore: "", - }, - ActionRow{ // S73, - Accept: 0, - Ignore: "", - }, - ActionRow{ // S74, - Accept: 0, - Ignore: "", - }, - ActionRow{ // S75, - Accept: 0, - Ignore: "", - }, - ActionRow{ // S76, - Accept: 0, - Ignore: "", - }, - ActionRow{ // S77, - Accept: 0, - Ignore: "", - }, - ActionRow{ // S78, Ignore("!comment") - Accept: -1, - Ignore: "!comment", - }, - ActionRow{ // S79, - Accept: 0, - Ignore: "", - }, - ActionRow{ // S80, Accept("tokId") - Accept: 2, - Ignore: "", - }, - ActionRow{ // S81, Accept("tokId") - Accept: 2, - Ignore: "", - }, - ActionRow{ // S82, - Accept: 0, - Ignore: "", - }, - ActionRow{ // S83, - Accept: 0, - Ignore: "", - }, - ActionRow{ // S84, - Accept: 0, - Ignore: "", - }, - ActionRow{ // S85, - Accept: 0, - Ignore: "", - }, - ActionRow{ // S86, - Accept: 0, - Ignore: "", - }, - ActionRow{ // S87, - Accept: 0, - Ignore: "", - }, - ActionRow{ // S88, - Accept: 0, - Ignore: "", - }, - ActionRow{ // S89, - Accept: 0, - Ignore: "", - }, - ActionRow{ // S90, Accept("g_sdt_lit") - Accept: 18, - Ignore: "", - }, - ActionRow{ // S91, Accept("Λ") - Accept: 23, - Ignore: "", - }, - ActionRow{ // S92, Accept("Λ") - Accept: 21, - Ignore: "", - }, - ActionRow{ // S93, - Accept: 0, - Ignore: "", - }, - ActionRow{ // S94, - Accept: 0, - Ignore: "", - }, - ActionRow{ // S95, - Accept: 0, - Ignore: "", - }, - ActionRow{ // S96, - Accept: 0, - Ignore: "", - }, - ActionRow{ // S97, - Accept: 0, - Ignore: "", - }, - ActionRow{ // S98, - Accept: 0, - Ignore: "", - }, - ActionRow{ // S99, - Accept: 0, - Ignore: "", - }, - ActionRow{ // S100, - Accept: 0, - Ignore: "", - }, - ActionRow{ // S101, - Accept: 0, - Ignore: "", - }, - ActionRow{ // S102, - Accept: 0, - Ignore: "", - }, - ActionRow{ // S103, - Accept: 0, - Ignore: "", - }, - ActionRow{ // S104, - Accept: 0, - Ignore: "", - }, - ActionRow{ // S105, - Accept: 0, - Ignore: "", - }, - ActionRow{ // S106, - Accept: 0, - Ignore: "", - }, - ActionRow{ // S107, - Accept: 0, - Ignore: "", - }, - ActionRow{ // S108, - Accept: 0, - Ignore: "", - }, -} diff --git a/internal/frontend/reparsed/internal/lexer/next/lexer.go b/internal/frontend/reparsed/internal/lexer/next/lexer.go deleted file mode 100644 index 0ac30ac0..00000000 --- a/internal/frontend/reparsed/internal/lexer/next/lexer.go +++ /dev/null @@ -1,161 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package lexer - -import ( - "bytes" - "io" - "os" - - "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/internal/io/stream" - token "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/internal/token/next" -) - -const ( - NoState = -1 - NumStates = 109 - NumSymbols = 75 -) - -type Position struct { - token.Pos - StreamPosition int64 -} - -type lexerStream interface { - io.RuneReader - io.Seeker -} - -type Lexer struct { - Position - stream lexerStream - eof bool -} - -func NewLexer(src []byte) *Lexer { - lexer := &Lexer{stream: bytes.NewReader(src)} - lexer.Position.Reset() - return lexer -} - -func NewLexerFile(fpath string) (*Lexer, error) { - s, err := os.Open(fpath) - if err != nil { - return nil, err - } - lexer := &Lexer{stream: stream.NewWindowReader(s)} - lexer.Position.Reset() - return lexer, nil -} - -func NewLexerStream(reader io.Reader) (*Lexer, error) { - lexer := &Lexer{} - lexer.Position.Reset() - if lexer.stream, _ = reader.(lexerStream); lexer.stream == nil { - lexer.stream = stream.NewWindowReader(reader) - } else { - lexer.Position.StreamPosition, _ = lexer.stream.Seek(0, io.SeekCurrent) - } - return lexer, nil -} - -func (l *Lexer) Scan() (tok *token.Token) { - tok = new(token.Token) - if l.eof { - tok.Type = token.EOF - tok.Pos = l.Position.Pos - return - } - l.Position.StreamPosition, _ = l.stream.Seek(0, io.SeekCurrent) - start, end := l.Position, Position{} - tok.Type = token.INVALID - tok.Lit = []byte{} - state, rune1 := 0, rune(-1) - for state != -1 { - if l.eof { - rune1 = -1 - } else { - rune2, size, err := l.stream.ReadRune() - if err == io.EOF { - l.eof = true - err = nil - } - if err == nil && size > 0 { - rune1 = rune2 - l.Position.StreamPosition += int64(size) - l.Position.Pos.Offset += size - } - } - - nextState := -1 - if rune1 != -1 { - nextState = TransTab[state](rune1) - } - state = nextState - - if state != -1 { - switch rune1 { - case '\n': - l.Position.Pos.Line++ - l.Position.Pos.Column = 1 - case '\r': - l.Position.Pos.Column = 1 - case '\t': - l.Position.Pos.Column += 4 - default: - l.Position.Pos.Column++ - } - - switch { - case ActTab[state].Accept != -1: - tok.Type = ActTab[state].Accept - l.Position.StreamPosition, _ = l.stream.Seek(0, io.SeekCurrent) - end = l.Position - tok.Lit = append(tok.Lit, string(rune1)...) - case ActTab[state].Ignore != "": - start = l.Position - state = 0 - tok.Lit = []byte{} - if l.eof { - tok.Type = token.EOF - } - - } - } else { - if tok.Type == token.INVALID { - end = l.Position - } - } - } - if end.Pos.Offset > start.Pos.Offset { - l.Reposition(end) - } - tok.Pos = start.Pos - return -} - -func (l *Lexer) Reset() { - l.Position.Reset() -} - -func (l *Lexer) Reposition(p Position) { - l.Position = p - l.stream.Seek(l.Position.StreamPosition, io.SeekStart) -} - -func (l Lexer) CurrentPosition() Position { - return l.Position -} - -func (p *Position) Reset() { - p.Offset = 0 - p.Line = 1 - p.Column = 1 -} - -func (p Position) StartingFrom(base Position) Position { - r := p - r.Pos = p.Pos.StartingFrom(base.Pos) - return r -} diff --git a/internal/frontend/reparsed/internal/lexer/next/transitiontable.go b/internal/frontend/reparsed/internal/lexer/next/transitiontable.go deleted file mode 100644 index 9cf91598..00000000 --- a/internal/frontend/reparsed/internal/lexer/next/transitiontable.go +++ /dev/null @@ -1,1299 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package lexer - -/* -Let s be the current state -Let r be the current input rune -transitionTable[s](r) returns the next state. -*/ -type TransitionTable [NumStates]func(rune) int - -var TransTab = TransitionTable{ - // S0 - func(r rune) int { - switch { - case r == 9: // ['\t','\t'] - return 1 - case r == 10: // ['\n','\n'] - return 1 - case r == 13: // ['\r','\r'] - return 1 - case r == 32: // [' ',' '] - return 1 - case r == 33: // ['!','!'] - return 2 - case r == 34: // ['"','"'] - return 3 - case r == 39: // [''','''] - return 4 - case r == 40: // ['(','('] - return 5 - case r == 41: // [')',')'] - return 6 - case r == 45: // ['-','-'] - return 7 - case r == 46: // ['.','.'] - return 8 - case r == 47: // ['/','/'] - return 9 - case r == 58: // [':',':'] - return 10 - case r == 59: // [';',';'] - return 11 - case r == 60: // ['<','<'] - return 12 - case 65 <= r && r <= 90: // ['A','Z'] - return 13 - case r == 91: // ['[','['] - return 14 - case r == 93: // [']',']'] - return 15 - case r == 95: // ['_','_'] - return 16 - case r == 96: // ['`','`'] - return 17 - case 97 <= r && r <= 100: // ['a','d'] - return 18 - case r == 101: // ['e','e'] - return 19 - case 102 <= r && r <= 122: // ['f','z'] - return 18 - case r == 123: // ['{','{'] - return 20 - case r == 124: // ['|','|'] - return 21 - case r == 125: // ['}','}'] - return 22 - case r == 126: // ['~','~'] - return 23 - case r == 949: // [\u03b5,\u03b5] - return 24 - case r == 955: // [\u03bb,\u03bb] - return 25 - } - return NoState - }, - // S1 - func(r rune) int { - switch { - } - return NoState - }, - // S2 - func(r rune) int { - switch { - case 97 <= r && r <= 122: // ['a','z'] - return 26 - } - return NoState - }, - // S3 - func(r rune) int { - switch { - case r == 34: // ['"','"'] - return 27 - case r == 92: // ['\','\'] - return 28 - default: - return 29 - } - }, - // S4 - func(r rune) int { - switch { - case r == 92: // ['\','\'] - return 30 - default: - return 31 - } - }, - // S5 - func(r rune) int { - switch { - } - return NoState - }, - // S6 - func(r rune) int { - switch { - } - return NoState - }, - // S7 - func(r rune) int { - switch { - } - return NoState - }, - // S8 - func(r rune) int { - switch { - } - return NoState - }, - // S9 - func(r rune) int { - switch { - case r == 42: // ['*','*'] - return 32 - case r == 47: // ['/','/'] - return 33 - } - return NoState - }, - // S10 - func(r rune) int { - switch { - } - return NoState - }, - // S11 - func(r rune) int { - switch { - } - return NoState - }, - // S12 - func(r rune) int { - switch { - case r == 60: // ['<','<'] - return 34 - } - return NoState - }, - // S13 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 35 - case 65 <= r && r <= 90: // ['A','Z'] - return 36 - case r == 95: // ['_','_'] - return 37 - case 97 <= r && r <= 122: // ['a','z'] - return 38 - } - return NoState - }, - // S14 - func(r rune) int { - switch { - } - return NoState - }, - // S15 - func(r rune) int { - switch { - } - return NoState - }, - // S16 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 39 - case 65 <= r && r <= 90: // ['A','Z'] - return 40 - case r == 95: // ['_','_'] - return 41 - case 97 <= r && r <= 122: // ['a','z'] - return 42 - } - return NoState - }, - // S17 - func(r rune) int { - switch { - case r == 96: // ['`','`'] - return 43 - default: - return 17 - } - }, - // S18 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 44 - case 65 <= r && r <= 90: // ['A','Z'] - return 45 - case r == 95: // ['_','_'] - return 46 - case 97 <= r && r <= 122: // ['a','z'] - return 47 - } - return NoState - }, - // S19 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 44 - case 65 <= r && r <= 90: // ['A','Z'] - return 45 - case r == 95: // ['_','_'] - return 46 - case 97 <= r && r <= 108: // ['a','l'] - return 47 - case r == 109: // ['m','m'] - return 48 - case 110 <= r && r <= 113: // ['n','q'] - return 47 - case r == 114: // ['r','r'] - return 49 - case 115 <= r && r <= 122: // ['s','z'] - return 47 - } - return NoState - }, - // S20 - func(r rune) int { - switch { - } - return NoState - }, - // S21 - func(r rune) int { - switch { - } - return NoState - }, - // S22 - func(r rune) int { - switch { - } - return NoState - }, - // S23 - func(r rune) int { - switch { - } - return NoState - }, - // S24 - func(r rune) int { - switch { - } - return NoState - }, - // S25 - func(r rune) int { - switch { - } - return NoState - }, - // S26 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 50 - case 65 <= r && r <= 90: // ['A','Z'] - return 51 - case r == 95: // ['_','_'] - return 52 - case 97 <= r && r <= 122: // ['a','z'] - return 53 - } - return NoState - }, - // S27 - func(r rune) int { - switch { - } - return NoState - }, - // S28 - func(r rune) int { - switch { - case r == 34: // ['"','"'] - return 54 - case r == 39: // [''','''] - return 54 - case 48 <= r && r <= 55: // ['0','7'] - return 55 - case r == 85: // ['U','U'] - return 56 - case r == 92: // ['\','\'] - return 54 - case r == 97: // ['a','a'] - return 54 - case r == 98: // ['b','b'] - return 54 - case r == 102: // ['f','f'] - return 54 - case r == 110: // ['n','n'] - return 54 - case r == 114: // ['r','r'] - return 54 - case r == 116: // ['t','t'] - return 54 - case r == 117: // ['u','u'] - return 57 - case r == 118: // ['v','v'] - return 54 - case r == 120: // ['x','x'] - return 58 - } - return NoState - }, - // S29 - func(r rune) int { - switch { - case r == 34: // ['"','"'] - return 27 - case r == 92: // ['\','\'] - return 28 - default: - return 29 - } - }, - // S30 - func(r rune) int { - switch { - case r == 34: // ['"','"'] - return 59 - case r == 39: // [''','''] - return 59 - case 48 <= r && r <= 55: // ['0','7'] - return 60 - case r == 85: // ['U','U'] - return 61 - case r == 92: // ['\','\'] - return 59 - case r == 97: // ['a','a'] - return 59 - case r == 98: // ['b','b'] - return 59 - case r == 102: // ['f','f'] - return 59 - case r == 110: // ['n','n'] - return 59 - case r == 114: // ['r','r'] - return 59 - case r == 116: // ['t','t'] - return 59 - case r == 117: // ['u','u'] - return 62 - case r == 118: // ['v','v'] - return 59 - case r == 120: // ['x','x'] - return 63 - } - return NoState - }, - // S31 - func(r rune) int { - switch { - case r == 39: // [''','''] - return 64 - } - return NoState - }, - // S32 - func(r rune) int { - switch { - case r == 42: // ['*','*'] - return 65 - default: - return 32 - } - }, - // S33 - func(r rune) int { - switch { - case r == 10: // ['\n','\n'] - return 66 - default: - return 33 - } - }, - // S34 - func(r rune) int { - switch { - default: - return 67 - } - }, - // S35 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 35 - case 65 <= r && r <= 90: // ['A','Z'] - return 36 - case r == 95: // ['_','_'] - return 37 - case 97 <= r && r <= 122: // ['a','z'] - return 38 - } - return NoState - }, - // S36 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 35 - case 65 <= r && r <= 90: // ['A','Z'] - return 36 - case r == 95: // ['_','_'] - return 37 - case 97 <= r && r <= 122: // ['a','z'] - return 38 - } - return NoState - }, - // S37 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 35 - case 65 <= r && r <= 90: // ['A','Z'] - return 36 - case r == 95: // ['_','_'] - return 37 - case 97 <= r && r <= 122: // ['a','z'] - return 38 - } - return NoState - }, - // S38 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 35 - case 65 <= r && r <= 90: // ['A','Z'] - return 36 - case r == 95: // ['_','_'] - return 37 - case 97 <= r && r <= 122: // ['a','z'] - return 38 - } - return NoState - }, - // S39 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 39 - case 65 <= r && r <= 90: // ['A','Z'] - return 40 - case r == 95: // ['_','_'] - return 41 - case 97 <= r && r <= 122: // ['a','z'] - return 42 - } - return NoState - }, - // S40 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 39 - case 65 <= r && r <= 90: // ['A','Z'] - return 40 - case r == 95: // ['_','_'] - return 41 - case 97 <= r && r <= 122: // ['a','z'] - return 42 - } - return NoState - }, - // S41 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 39 - case 65 <= r && r <= 90: // ['A','Z'] - return 40 - case r == 95: // ['_','_'] - return 41 - case 97 <= r && r <= 122: // ['a','z'] - return 42 - } - return NoState - }, - // S42 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 39 - case 65 <= r && r <= 90: // ['A','Z'] - return 40 - case r == 95: // ['_','_'] - return 41 - case 97 <= r && r <= 122: // ['a','z'] - return 42 - } - return NoState - }, - // S43 - func(r rune) int { - switch { - } - return NoState - }, - // S44 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 44 - case 65 <= r && r <= 90: // ['A','Z'] - return 45 - case r == 95: // ['_','_'] - return 46 - case 97 <= r && r <= 122: // ['a','z'] - return 47 - } - return NoState - }, - // S45 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 44 - case 65 <= r && r <= 90: // ['A','Z'] - return 45 - case r == 95: // ['_','_'] - return 46 - case 97 <= r && r <= 122: // ['a','z'] - return 47 - } - return NoState - }, - // S46 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 44 - case 65 <= r && r <= 90: // ['A','Z'] - return 45 - case r == 95: // ['_','_'] - return 46 - case 97 <= r && r <= 122: // ['a','z'] - return 47 - } - return NoState - }, - // S47 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 44 - case 65 <= r && r <= 90: // ['A','Z'] - return 45 - case r == 95: // ['_','_'] - return 46 - case 97 <= r && r <= 122: // ['a','z'] - return 47 - } - return NoState - }, - // S48 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 44 - case 65 <= r && r <= 90: // ['A','Z'] - return 45 - case r == 95: // ['_','_'] - return 46 - case 97 <= r && r <= 111: // ['a','o'] - return 47 - case r == 112: // ['p','p'] - return 68 - case 113 <= r && r <= 122: // ['q','z'] - return 47 - } - return NoState - }, - // S49 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 44 - case 65 <= r && r <= 90: // ['A','Z'] - return 45 - case r == 95: // ['_','_'] - return 46 - case 97 <= r && r <= 113: // ['a','q'] - return 47 - case r == 114: // ['r','r'] - return 69 - case 115 <= r && r <= 122: // ['s','z'] - return 47 - } - return NoState - }, - // S50 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 50 - case 65 <= r && r <= 90: // ['A','Z'] - return 51 - case r == 95: // ['_','_'] - return 52 - case 97 <= r && r <= 122: // ['a','z'] - return 53 - } - return NoState - }, - // S51 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 50 - case 65 <= r && r <= 90: // ['A','Z'] - return 51 - case r == 95: // ['_','_'] - return 52 - case 97 <= r && r <= 122: // ['a','z'] - return 53 - } - return NoState - }, - // S52 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 50 - case 65 <= r && r <= 90: // ['A','Z'] - return 51 - case r == 95: // ['_','_'] - return 52 - case 97 <= r && r <= 122: // ['a','z'] - return 53 - } - return NoState - }, - // S53 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 50 - case 65 <= r && r <= 90: // ['A','Z'] - return 51 - case r == 95: // ['_','_'] - return 52 - case 97 <= r && r <= 122: // ['a','z'] - return 53 - } - return NoState - }, - // S54 - func(r rune) int { - switch { - case r == 34: // ['"','"'] - return 27 - case r == 92: // ['\','\'] - return 28 - default: - return 29 - } - }, - // S55 - func(r rune) int { - switch { - case 48 <= r && r <= 55: // ['0','7'] - return 70 - } - return NoState - }, - // S56 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 71 - case 65 <= r && r <= 70: // ['A','F'] - return 71 - case 97 <= r && r <= 102: // ['a','f'] - return 71 - } - return NoState - }, - // S57 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 72 - case 65 <= r && r <= 70: // ['A','F'] - return 72 - case 97 <= r && r <= 102: // ['a','f'] - return 72 - } - return NoState - }, - // S58 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 73 - case 65 <= r && r <= 70: // ['A','F'] - return 73 - case 97 <= r && r <= 102: // ['a','f'] - return 73 - } - return NoState - }, - // S59 - func(r rune) int { - switch { - case r == 39: // [''','''] - return 64 - } - return NoState - }, - // S60 - func(r rune) int { - switch { - case 48 <= r && r <= 55: // ['0','7'] - return 74 - } - return NoState - }, - // S61 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 75 - case 65 <= r && r <= 70: // ['A','F'] - return 75 - case 97 <= r && r <= 102: // ['a','f'] - return 75 - } - return NoState - }, - // S62 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 76 - case 65 <= r && r <= 70: // ['A','F'] - return 76 - case 97 <= r && r <= 102: // ['a','f'] - return 76 - } - return NoState - }, - // S63 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 77 - case 65 <= r && r <= 70: // ['A','F'] - return 77 - case 97 <= r && r <= 102: // ['a','f'] - return 77 - } - return NoState - }, - // S64 - func(r rune) int { - switch { - } - return NoState - }, - // S65 - func(r rune) int { - switch { - case r == 42: // ['*','*'] - return 65 - case r == 47: // ['/','/'] - return 78 - default: - return 32 - } - }, - // S66 - func(r rune) int { - switch { - } - return NoState - }, - // S67 - func(r rune) int { - switch { - case r == 62: // ['>','>'] - return 79 - default: - return 67 - } - }, - // S68 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 44 - case 65 <= r && r <= 90: // ['A','Z'] - return 45 - case r == 95: // ['_','_'] - return 46 - case 97 <= r && r <= 115: // ['a','s'] - return 47 - case r == 116: // ['t','t'] - return 80 - case 117 <= r && r <= 122: // ['u','z'] - return 47 - } - return NoState - }, - // S69 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 44 - case 65 <= r && r <= 90: // ['A','Z'] - return 45 - case r == 95: // ['_','_'] - return 46 - case 97 <= r && r <= 110: // ['a','n'] - return 47 - case r == 111: // ['o','o'] - return 81 - case 112 <= r && r <= 122: // ['p','z'] - return 47 - } - return NoState - }, - // S70 - func(r rune) int { - switch { - case 48 <= r && r <= 55: // ['0','7'] - return 82 - } - return NoState - }, - // S71 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 83 - case 65 <= r && r <= 70: // ['A','F'] - return 83 - case 97 <= r && r <= 102: // ['a','f'] - return 83 - } - return NoState - }, - // S72 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 84 - case 65 <= r && r <= 70: // ['A','F'] - return 84 - case 97 <= r && r <= 102: // ['a','f'] - return 84 - } - return NoState - }, - // S73 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 85 - case 65 <= r && r <= 70: // ['A','F'] - return 85 - case 97 <= r && r <= 102: // ['a','f'] - return 85 - } - return NoState - }, - // S74 - func(r rune) int { - switch { - case 48 <= r && r <= 55: // ['0','7'] - return 86 - } - return NoState - }, - // S75 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 87 - case 65 <= r && r <= 70: // ['A','F'] - return 87 - case 97 <= r && r <= 102: // ['a','f'] - return 87 - } - return NoState - }, - // S76 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 88 - case 65 <= r && r <= 70: // ['A','F'] - return 88 - case 97 <= r && r <= 102: // ['a','f'] - return 88 - } - return NoState - }, - // S77 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 89 - case 65 <= r && r <= 70: // ['A','F'] - return 89 - case 97 <= r && r <= 102: // ['a','f'] - return 89 - } - return NoState - }, - // S78 - func(r rune) int { - switch { - } - return NoState - }, - // S79 - func(r rune) int { - switch { - case r == 62: // ['>','>'] - return 90 - } - return NoState - }, - // S80 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 44 - case 65 <= r && r <= 90: // ['A','Z'] - return 45 - case r == 95: // ['_','_'] - return 46 - case 97 <= r && r <= 120: // ['a','x'] - return 47 - case r == 121: // ['y','y'] - return 91 - case r == 122: // ['z','z'] - return 47 - } - return NoState - }, - // S81 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 44 - case 65 <= r && r <= 90: // ['A','Z'] - return 45 - case r == 95: // ['_','_'] - return 46 - case 97 <= r && r <= 113: // ['a','q'] - return 47 - case r == 114: // ['r','r'] - return 92 - case 115 <= r && r <= 122: // ['s','z'] - return 47 - } - return NoState - }, - // S82 - func(r rune) int { - switch { - case r == 34: // ['"','"'] - return 27 - case r == 92: // ['\','\'] - return 28 - default: - return 29 - } - }, - // S83 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 93 - case 65 <= r && r <= 70: // ['A','F'] - return 93 - case 97 <= r && r <= 102: // ['a','f'] - return 93 - } - return NoState - }, - // S84 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 94 - case 65 <= r && r <= 70: // ['A','F'] - return 94 - case 97 <= r && r <= 102: // ['a','f'] - return 94 - } - return NoState - }, - // S85 - func(r rune) int { - switch { - case r == 34: // ['"','"'] - return 27 - case r == 92: // ['\','\'] - return 28 - default: - return 29 - } - }, - // S86 - func(r rune) int { - switch { - case r == 39: // [''','''] - return 64 - } - return NoState - }, - // S87 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 95 - case 65 <= r && r <= 70: // ['A','F'] - return 95 - case 97 <= r && r <= 102: // ['a','f'] - return 95 - } - return NoState - }, - // S88 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 96 - case 65 <= r && r <= 70: // ['A','F'] - return 96 - case 97 <= r && r <= 102: // ['a','f'] - return 96 - } - return NoState - }, - // S89 - func(r rune) int { - switch { - case r == 39: // [''','''] - return 64 - } - return NoState - }, - // S90 - func(r rune) int { - switch { - } - return NoState - }, - // S91 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 44 - case 65 <= r && r <= 90: // ['A','Z'] - return 45 - case r == 95: // ['_','_'] - return 46 - case 97 <= r && r <= 122: // ['a','z'] - return 47 - } - return NoState - }, - // S92 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 44 - case 65 <= r && r <= 90: // ['A','Z'] - return 45 - case r == 95: // ['_','_'] - return 46 - case 97 <= r && r <= 122: // ['a','z'] - return 47 - } - return NoState - }, - // S93 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 97 - case 65 <= r && r <= 70: // ['A','F'] - return 97 - case 97 <= r && r <= 102: // ['a','f'] - return 97 - } - return NoState - }, - // S94 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 98 - case 65 <= r && r <= 70: // ['A','F'] - return 98 - case 97 <= r && r <= 102: // ['a','f'] - return 98 - } - return NoState - }, - // S95 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 99 - case 65 <= r && r <= 70: // ['A','F'] - return 99 - case 97 <= r && r <= 102: // ['a','f'] - return 99 - } - return NoState - }, - // S96 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 100 - case 65 <= r && r <= 70: // ['A','F'] - return 100 - case 97 <= r && r <= 102: // ['a','f'] - return 100 - } - return NoState - }, - // S97 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 101 - case 65 <= r && r <= 70: // ['A','F'] - return 101 - case 97 <= r && r <= 102: // ['a','f'] - return 101 - } - return NoState - }, - // S98 - func(r rune) int { - switch { - case r == 34: // ['"','"'] - return 27 - case r == 92: // ['\','\'] - return 28 - default: - return 29 - } - }, - // S99 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 102 - case 65 <= r && r <= 70: // ['A','F'] - return 102 - case 97 <= r && r <= 102: // ['a','f'] - return 102 - } - return NoState - }, - // S100 - func(r rune) int { - switch { - case r == 39: // [''','''] - return 64 - } - return NoState - }, - // S101 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 103 - case 65 <= r && r <= 70: // ['A','F'] - return 103 - case 97 <= r && r <= 102: // ['a','f'] - return 103 - } - return NoState - }, - // S102 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 104 - case 65 <= r && r <= 70: // ['A','F'] - return 104 - case 97 <= r && r <= 102: // ['a','f'] - return 104 - } - return NoState - }, - // S103 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 105 - case 65 <= r && r <= 70: // ['A','F'] - return 105 - case 97 <= r && r <= 102: // ['a','f'] - return 105 - } - return NoState - }, - // S104 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 106 - case 65 <= r && r <= 70: // ['A','F'] - return 106 - case 97 <= r && r <= 102: // ['a','f'] - return 106 - } - return NoState - }, - // S105 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 107 - case 65 <= r && r <= 70: // ['A','F'] - return 107 - case 97 <= r && r <= 102: // ['a','f'] - return 107 - } - return NoState - }, - // S106 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 108 - case 65 <= r && r <= 70: // ['A','F'] - return 108 - case 97 <= r && r <= 102: // ['a','f'] - return 108 - } - return NoState - }, - // S107 - func(r rune) int { - switch { - case r == 34: // ['"','"'] - return 27 - case r == 92: // ['\','\'] - return 28 - default: - return 29 - } - }, - // S108 - func(r rune) int { - switch { - case r == 39: // [''','''] - return 64 - } - return NoState - }, -} diff --git a/internal/frontend/reparsed/internal/parser/next/action.go b/internal/frontend/reparsed/internal/parser/next/action.go deleted file mode 100644 index 54bc55e9..00000000 --- a/internal/frontend/reparsed/internal/parser/next/action.go +++ /dev/null @@ -1,51 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package parser - -import ( - "fmt" -) - -type action interface { - act() - String() string -} - -type ( - accept bool - shift int // value is next state index - reduce int // value is production index -) - -func (this accept) act() {} -func (this shift) act() {} -func (this reduce) act() {} - -func (this accept) Equal(that action) bool { - if _, ok := that.(accept); ok { - return true - } - return false -} - -func (this reduce) Equal(that action) bool { - that1, ok := that.(reduce) - if !ok { - return false - } - return this == that1 -} - -func (this shift) Equal(that action) bool { - that1, ok := that.(shift) - if !ok { - return false - } - return this == that1 -} - -func (this accept) String() string { return "accept(0)" } -func (this shift) String() string { return fmt.Sprintf("shift:%d", this) } -func (this reduce) String() string { - return fmt.Sprintf("reduce:%d(%s)", this, productionsTable[this].String) -} diff --git a/internal/frontend/reparsed/internal/parser/next/actiontable.go b/internal/frontend/reparsed/internal/parser/next/actiontable.go deleted file mode 100644 index 8baba045..00000000 --- a/internal/frontend/reparsed/internal/parser/next/actiontable.go +++ /dev/null @@ -1,4605 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package parser - -type ( - actionTable [numStates]actionRow - actionRow struct { - canRecover bool - actions [numSymbols]action - contextDependentTokens []int - } -) - -var actionTab = actionTable{ - actionRow{ // S0 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - shift(9), // tokId - nil, // ":" - nil, // ";" - shift(10), // regDefId - shift(11), // ignoredTokId - nil, // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - shift(12), // g_sdt_lit - shift(13), // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S1 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - accept(true), // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S2 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - reduce(2), // Ω, reduce: Grammar - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - shift(12), // g_sdt_lit - shift(13), // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S3 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - reduce(3), // Ω, reduce: Grammar - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S4 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - reduce(4), // Ω, reduce: LexicalPart - shift(9), // tokId - nil, // ":" - nil, // ";" - shift(10), // regDefId - shift(11), // ignoredTokId - nil, // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - reduce(4), // g_sdt_lit, reduce: LexicalPart - reduce(4), // prodId, reduce: LexicalPart - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S5 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - reduce(5), // Ω, reduce: LexProductions - reduce(5), // tokId, reduce: LexProductions - nil, // ":" - nil, // ";" - reduce(5), // regDefId, reduce: LexProductions - reduce(5), // ignoredTokId, reduce: LexProductions - nil, // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - reduce(5), // g_sdt_lit, reduce: LexProductions - reduce(5), // prodId, reduce: LexProductions - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S6 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - shift(13), // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S7 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - reduce(24), // Ω, reduce: SyntaxPart - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - shift(13), // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S8 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - reduce(26), // Ω, reduce: SyntaxProdList - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - reduce(26), // prodId, reduce: SyntaxProdList - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S9 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - shift(18), // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S10 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - shift(19), // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S11 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - shift(20), // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S12 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - reduce(25), // prodId, reduce: FileHeader - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S13 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - shift(21), // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S14 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - reduce(1), // Ω, reduce: Grammar - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S15 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - reduce(6), // Ω, reduce: LexProductions - reduce(6), // tokId, reduce: LexProductions - nil, // ":" - nil, // ";" - reduce(6), // regDefId, reduce: LexProductions - reduce(6), // ignoredTokId, reduce: LexProductions - nil, // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - reduce(6), // g_sdt_lit, reduce: LexProductions - reduce(6), // prodId, reduce: LexProductions - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S16 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - reduce(23), // Ω, reduce: SyntaxPart - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - shift(13), // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S17 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - reduce(27), // Ω, reduce: SyntaxProdList - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - reduce(27), // prodId, reduce: SyntaxProdList - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S18 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - shift(25), // regDefId - nil, // ignoredTokId - nil, // "|" - shift(26), // "." - shift(27), // char_lit - nil, // "-" - shift(28), // "~" - shift(29), // "(" - nil, // ")" - shift(30), // "[" - nil, // "]" - shift(31), // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S19 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - shift(25), // regDefId - nil, // ignoredTokId - nil, // "|" - shift(26), // "." - shift(27), // char_lit - nil, // "-" - shift(28), // "~" - shift(29), // "(" - nil, // ")" - shift(30), // "[" - nil, // "]" - shift(31), // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S20 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - shift(25), // regDefId - nil, // ignoredTokId - nil, // "|" - shift(26), // "." - shift(27), // char_lit - nil, // "-" - shift(28), // "~" - shift(29), // "(" - nil, // ")" - shift(30), // "[" - nil, // "]" - shift(31), // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S21 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - shift(40), // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - shift(41), // prodId - shift(42), // string_lit - shift(43), // "error" - shift(44), // "λ" - shift(45), // "empty" - shift(46), // "ε" - }, - }, - actionRow{ // S22 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - shift(47), // ";" - nil, // regDefId - nil, // ignoredTokId - shift(48), // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S23 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - reduce(10), // ";", reduce: LexPattern - shift(25), // regDefId - nil, // ignoredTokId - reduce(10), // "|", reduce: LexPattern - shift(26), // "." - shift(27), // char_lit - nil, // "-" - shift(28), // "~" - shift(29), // "(" - nil, // ")" - shift(30), // "[" - nil, // "]" - shift(31), // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S24 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - reduce(12), // ";", reduce: LexAlt - reduce(12), // regDefId, reduce: LexAlt - nil, // ignoredTokId - reduce(12), // "|", reduce: LexAlt - reduce(12), // ".", reduce: LexAlt - reduce(12), // char_lit, reduce: LexAlt - nil, // "-" - reduce(12), // "~", reduce: LexAlt - reduce(12), // "(", reduce: LexAlt - nil, // ")" - reduce(12), // "[", reduce: LexAlt - nil, // "]" - reduce(12), // "{", reduce: LexAlt - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S25 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - reduce(19), // ";", reduce: LexTerm - reduce(19), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(19), // "|", reduce: LexTerm - reduce(19), // ".", reduce: LexTerm - reduce(19), // char_lit, reduce: LexTerm - nil, // "-" - reduce(19), // "~", reduce: LexTerm - reduce(19), // "(", reduce: LexTerm - nil, // ")" - reduce(19), // "[", reduce: LexTerm - nil, // "]" - reduce(19), // "{", reduce: LexTerm - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S26 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - reduce(14), // ";", reduce: LexTerm - reduce(14), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(14), // "|", reduce: LexTerm - reduce(14), // ".", reduce: LexTerm - reduce(14), // char_lit, reduce: LexTerm - nil, // "-" - reduce(14), // "~", reduce: LexTerm - reduce(14), // "(", reduce: LexTerm - nil, // ")" - reduce(14), // "[", reduce: LexTerm - nil, // "]" - reduce(14), // "{", reduce: LexTerm - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S27 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - reduce(15), // ";", reduce: LexTerm - reduce(15), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(15), // "|", reduce: LexTerm - reduce(15), // ".", reduce: LexTerm - reduce(15), // char_lit, reduce: LexTerm - shift(50), // "-" - reduce(15), // "~", reduce: LexTerm - reduce(15), // "(", reduce: LexTerm - nil, // ")" - reduce(15), // "[", reduce: LexTerm - nil, // "]" - reduce(15), // "{", reduce: LexTerm - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S28 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - shift(51), // char_lit - nil, // "-" - nil, // "~" - shift(52), // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S29 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - shift(56), // regDefId - nil, // ignoredTokId - nil, // "|" - shift(57), // "." - shift(58), // char_lit - nil, // "-" - shift(59), // "~" - shift(60), // "(" - nil, // ")" - shift(61), // "[" - nil, // "]" - shift(62), // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S30 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - shift(66), // regDefId - nil, // ignoredTokId - nil, // "|" - shift(67), // "." - shift(68), // char_lit - nil, // "-" - shift(69), // "~" - shift(70), // "(" - nil, // ")" - shift(71), // "[" - nil, // "]" - shift(72), // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S31 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - shift(76), // regDefId - nil, // ignoredTokId - nil, // "|" - shift(77), // "." - shift(78), // char_lit - nil, // "-" - shift(79), // "~" - shift(80), // "(" - nil, // ")" - shift(81), // "[" - nil, // "]" - shift(82), // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S32 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - shift(83), // ";" - nil, // regDefId - nil, // ignoredTokId - shift(48), // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S33 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - shift(84), // ";" - nil, // regDefId - nil, // ignoredTokId - shift(48), // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S34 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - shift(85), // ";" - nil, // regDefId - nil, // ignoredTokId - shift(86), // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S35 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - reduce(29), // ";", reduce: Alternatives - nil, // regDefId - nil, // ignoredTokId - reduce(29), // "|", reduce: Alternatives - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S36 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - shift(40), // tokId - nil, // ":" - reduce(31), // ";", reduce: SyntaxBody - nil, // regDefId - nil, // ignoredTokId - reduce(31), // "|", reduce: SyntaxBody - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - shift(88), // g_sdt_lit - shift(41), // prodId - shift(42), // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S37 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - shift(40), // tokId - nil, // ":" - reduce(33), // ";", reduce: SyntaxBody - nil, // regDefId - nil, // ignoredTokId - reduce(33), // "|", reduce: SyntaxBody - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - shift(90), // g_sdt_lit - shift(41), // prodId - shift(42), // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S38 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - reduce(37), // ";", reduce: SyntaxBody - nil, // regDefId - nil, // ignoredTokId - reduce(37), // "|", reduce: SyntaxBody - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S39 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - reduce(38), // tokId, reduce: Symbols - nil, // ":" - reduce(38), // ";", reduce: Symbols - nil, // regDefId - nil, // ignoredTokId - reduce(38), // "|", reduce: Symbols - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - reduce(38), // g_sdt_lit, reduce: Symbols - reduce(38), // prodId, reduce: Symbols - reduce(38), // string_lit, reduce: Symbols - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S40 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - reduce(41), // tokId, reduce: Symbol - nil, // ":" - reduce(41), // ";", reduce: Symbol - nil, // regDefId - nil, // ignoredTokId - reduce(41), // "|", reduce: Symbol - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - reduce(41), // g_sdt_lit, reduce: Symbol - reduce(41), // prodId, reduce: Symbol - reduce(41), // string_lit, reduce: Symbol - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S41 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - reduce(40), // tokId, reduce: Symbol - nil, // ":" - reduce(40), // ";", reduce: Symbol - nil, // regDefId - nil, // ignoredTokId - reduce(40), // "|", reduce: Symbol - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - reduce(40), // g_sdt_lit, reduce: Symbol - reduce(40), // prodId, reduce: Symbol - reduce(40), // string_lit, reduce: Symbol - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S42 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - reduce(42), // tokId, reduce: Symbol - nil, // ":" - reduce(42), // ";", reduce: Symbol - nil, // regDefId - nil, // ignoredTokId - reduce(42), // "|", reduce: Symbol - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - reduce(42), // g_sdt_lit, reduce: Symbol - reduce(42), // prodId, reduce: Symbol - reduce(42), // string_lit, reduce: Symbol - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S43 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - reduce(43), // tokId, reduce: ErrorSymbol - nil, // ":" - reduce(43), // ";", reduce: ErrorSymbol - nil, // regDefId - nil, // ignoredTokId - reduce(43), // "|", reduce: ErrorSymbol - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - reduce(43), // g_sdt_lit, reduce: ErrorSymbol - reduce(43), // prodId, reduce: ErrorSymbol - reduce(43), // string_lit, reduce: ErrorSymbol - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S44 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - reduce(44), // tokId, reduce: ErrorSymbol - nil, // ":" - reduce(44), // ";", reduce: ErrorSymbol - nil, // regDefId - nil, // ignoredTokId - reduce(44), // "|", reduce: ErrorSymbol - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - reduce(44), // g_sdt_lit, reduce: ErrorSymbol - reduce(44), // prodId, reduce: ErrorSymbol - reduce(44), // string_lit, reduce: ErrorSymbol - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S45 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - reduce(45), // ";", reduce: EpsilonSymbol - nil, // regDefId - nil, // ignoredTokId - reduce(45), // "|", reduce: EpsilonSymbol - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S46 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - reduce(46), // ";", reduce: EpsilonSymbol - nil, // regDefId - nil, // ignoredTokId - reduce(46), // "|", reduce: EpsilonSymbol - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S47 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - reduce(7), // Ω, reduce: LexProduction - reduce(7), // tokId, reduce: LexProduction - nil, // ":" - nil, // ";" - reduce(7), // regDefId, reduce: LexProduction - reduce(7), // ignoredTokId, reduce: LexProduction - nil, // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - reduce(7), // g_sdt_lit, reduce: LexProduction - reduce(7), // prodId, reduce: LexProduction - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S48 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - shift(25), // regDefId - nil, // ignoredTokId - nil, // "|" - shift(26), // "." - shift(27), // char_lit - nil, // "-" - shift(28), // "~" - shift(29), // "(" - nil, // ")" - shift(30), // "[" - nil, // "]" - shift(31), // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S49 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - reduce(13), // ";", reduce: LexAlt - reduce(13), // regDefId, reduce: LexAlt - nil, // ignoredTokId - reduce(13), // "|", reduce: LexAlt - reduce(13), // ".", reduce: LexAlt - reduce(13), // char_lit, reduce: LexAlt - nil, // "-" - reduce(13), // "~", reduce: LexAlt - reduce(13), // "(", reduce: LexAlt - nil, // ")" - reduce(13), // "[", reduce: LexAlt - nil, // "]" - reduce(13), // "{", reduce: LexAlt - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S50 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - shift(92), // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S51 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - reduce(17), // ";", reduce: LexTerm - reduce(17), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(17), // "|", reduce: LexTerm - reduce(17), // ".", reduce: LexTerm - reduce(17), // char_lit, reduce: LexTerm - nil, // "-" - reduce(17), // "~", reduce: LexTerm - reduce(17), // "(", reduce: LexTerm - nil, // ")" - reduce(17), // "[", reduce: LexTerm - nil, // "]" - reduce(17), // "{", reduce: LexTerm - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S52 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - shift(93), // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S53 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - shift(94), // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - shift(95), // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S54 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - shift(56), // regDefId - nil, // ignoredTokId - reduce(10), // "|", reduce: LexPattern - shift(57), // "." - shift(58), // char_lit - nil, // "-" - shift(59), // "~" - shift(60), // "(" - reduce(10), // ")", reduce: LexPattern - shift(61), // "[" - nil, // "]" - shift(62), // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S55 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(12), // regDefId, reduce: LexAlt - nil, // ignoredTokId - reduce(12), // "|", reduce: LexAlt - reduce(12), // ".", reduce: LexAlt - reduce(12), // char_lit, reduce: LexAlt - nil, // "-" - reduce(12), // "~", reduce: LexAlt - reduce(12), // "(", reduce: LexAlt - reduce(12), // ")", reduce: LexAlt - reduce(12), // "[", reduce: LexAlt - nil, // "]" - reduce(12), // "{", reduce: LexAlt - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S56 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(19), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(19), // "|", reduce: LexTerm - reduce(19), // ".", reduce: LexTerm - reduce(19), // char_lit, reduce: LexTerm - nil, // "-" - reduce(19), // "~", reduce: LexTerm - reduce(19), // "(", reduce: LexTerm - reduce(19), // ")", reduce: LexTerm - reduce(19), // "[", reduce: LexTerm - nil, // "]" - reduce(19), // "{", reduce: LexTerm - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S57 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(14), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(14), // "|", reduce: LexTerm - reduce(14), // ".", reduce: LexTerm - reduce(14), // char_lit, reduce: LexTerm - nil, // "-" - reduce(14), // "~", reduce: LexTerm - reduce(14), // "(", reduce: LexTerm - reduce(14), // ")", reduce: LexTerm - reduce(14), // "[", reduce: LexTerm - nil, // "]" - reduce(14), // "{", reduce: LexTerm - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S58 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(15), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(15), // "|", reduce: LexTerm - reduce(15), // ".", reduce: LexTerm - reduce(15), // char_lit, reduce: LexTerm - shift(97), // "-" - reduce(15), // "~", reduce: LexTerm - reduce(15), // "(", reduce: LexTerm - reduce(15), // ")", reduce: LexTerm - reduce(15), // "[", reduce: LexTerm - nil, // "]" - reduce(15), // "{", reduce: LexTerm - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S59 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - shift(98), // char_lit - nil, // "-" - nil, // "~" - shift(99), // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S60 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - shift(56), // regDefId - nil, // ignoredTokId - nil, // "|" - shift(57), // "." - shift(58), // char_lit - nil, // "-" - shift(59), // "~" - shift(60), // "(" - nil, // ")" - shift(61), // "[" - nil, // "]" - shift(62), // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S61 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - shift(66), // regDefId - nil, // ignoredTokId - nil, // "|" - shift(67), // "." - shift(68), // char_lit - nil, // "-" - shift(69), // "~" - shift(70), // "(" - nil, // ")" - shift(71), // "[" - nil, // "]" - shift(72), // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S62 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - shift(76), // regDefId - nil, // ignoredTokId - nil, // "|" - shift(77), // "." - shift(78), // char_lit - nil, // "-" - shift(79), // "~" - shift(80), // "(" - nil, // ")" - shift(81), // "[" - nil, // "]" - shift(82), // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S63 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - shift(103), // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - shift(104), // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S64 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - shift(66), // regDefId - nil, // ignoredTokId - reduce(10), // "|", reduce: LexPattern - shift(67), // "." - shift(68), // char_lit - nil, // "-" - shift(69), // "~" - shift(70), // "(" - nil, // ")" - shift(71), // "[" - reduce(10), // "]", reduce: LexPattern - shift(72), // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S65 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(12), // regDefId, reduce: LexAlt - nil, // ignoredTokId - reduce(12), // "|", reduce: LexAlt - reduce(12), // ".", reduce: LexAlt - reduce(12), // char_lit, reduce: LexAlt - nil, // "-" - reduce(12), // "~", reduce: LexAlt - reduce(12), // "(", reduce: LexAlt - nil, // ")" - reduce(12), // "[", reduce: LexAlt - reduce(12), // "]", reduce: LexAlt - reduce(12), // "{", reduce: LexAlt - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S66 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(19), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(19), // "|", reduce: LexTerm - reduce(19), // ".", reduce: LexTerm - reduce(19), // char_lit, reduce: LexTerm - nil, // "-" - reduce(19), // "~", reduce: LexTerm - reduce(19), // "(", reduce: LexTerm - nil, // ")" - reduce(19), // "[", reduce: LexTerm - reduce(19), // "]", reduce: LexTerm - reduce(19), // "{", reduce: LexTerm - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S67 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(14), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(14), // "|", reduce: LexTerm - reduce(14), // ".", reduce: LexTerm - reduce(14), // char_lit, reduce: LexTerm - nil, // "-" - reduce(14), // "~", reduce: LexTerm - reduce(14), // "(", reduce: LexTerm - nil, // ")" - reduce(14), // "[", reduce: LexTerm - reduce(14), // "]", reduce: LexTerm - reduce(14), // "{", reduce: LexTerm - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S68 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(15), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(15), // "|", reduce: LexTerm - reduce(15), // ".", reduce: LexTerm - reduce(15), // char_lit, reduce: LexTerm - shift(106), // "-" - reduce(15), // "~", reduce: LexTerm - reduce(15), // "(", reduce: LexTerm - nil, // ")" - reduce(15), // "[", reduce: LexTerm - reduce(15), // "]", reduce: LexTerm - reduce(15), // "{", reduce: LexTerm - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S69 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - shift(107), // char_lit - nil, // "-" - nil, // "~" - shift(108), // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S70 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - shift(56), // regDefId - nil, // ignoredTokId - nil, // "|" - shift(57), // "." - shift(58), // char_lit - nil, // "-" - shift(59), // "~" - shift(60), // "(" - nil, // ")" - shift(61), // "[" - nil, // "]" - shift(62), // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S71 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - shift(66), // regDefId - nil, // ignoredTokId - nil, // "|" - shift(67), // "." - shift(68), // char_lit - nil, // "-" - shift(69), // "~" - shift(70), // "(" - nil, // ")" - shift(71), // "[" - nil, // "]" - shift(72), // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S72 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - shift(76), // regDefId - nil, // ignoredTokId - nil, // "|" - shift(77), // "." - shift(78), // char_lit - nil, // "-" - shift(79), // "~" - shift(80), // "(" - nil, // ")" - shift(81), // "[" - nil, // "]" - shift(82), // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S73 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - shift(112), // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - shift(113), // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S74 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - shift(76), // regDefId - nil, // ignoredTokId - reduce(10), // "|", reduce: LexPattern - shift(77), // "." - shift(78), // char_lit - nil, // "-" - shift(79), // "~" - shift(80), // "(" - nil, // ")" - shift(81), // "[" - nil, // "]" - shift(82), // "{" - reduce(10), // "}", reduce: LexPattern - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S75 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(12), // regDefId, reduce: LexAlt - nil, // ignoredTokId - reduce(12), // "|", reduce: LexAlt - reduce(12), // ".", reduce: LexAlt - reduce(12), // char_lit, reduce: LexAlt - nil, // "-" - reduce(12), // "~", reduce: LexAlt - reduce(12), // "(", reduce: LexAlt - nil, // ")" - reduce(12), // "[", reduce: LexAlt - nil, // "]" - reduce(12), // "{", reduce: LexAlt - reduce(12), // "}", reduce: LexAlt - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S76 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(19), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(19), // "|", reduce: LexTerm - reduce(19), // ".", reduce: LexTerm - reduce(19), // char_lit, reduce: LexTerm - nil, // "-" - reduce(19), // "~", reduce: LexTerm - reduce(19), // "(", reduce: LexTerm - nil, // ")" - reduce(19), // "[", reduce: LexTerm - nil, // "]" - reduce(19), // "{", reduce: LexTerm - reduce(19), // "}", reduce: LexTerm - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S77 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(14), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(14), // "|", reduce: LexTerm - reduce(14), // ".", reduce: LexTerm - reduce(14), // char_lit, reduce: LexTerm - nil, // "-" - reduce(14), // "~", reduce: LexTerm - reduce(14), // "(", reduce: LexTerm - nil, // ")" - reduce(14), // "[", reduce: LexTerm - nil, // "]" - reduce(14), // "{", reduce: LexTerm - reduce(14), // "}", reduce: LexTerm - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S78 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(15), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(15), // "|", reduce: LexTerm - reduce(15), // ".", reduce: LexTerm - reduce(15), // char_lit, reduce: LexTerm - shift(115), // "-" - reduce(15), // "~", reduce: LexTerm - reduce(15), // "(", reduce: LexTerm - nil, // ")" - reduce(15), // "[", reduce: LexTerm - nil, // "]" - reduce(15), // "{", reduce: LexTerm - reduce(15), // "}", reduce: LexTerm - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S79 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - shift(116), // char_lit - nil, // "-" - nil, // "~" - shift(117), // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S80 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - shift(56), // regDefId - nil, // ignoredTokId - nil, // "|" - shift(57), // "." - shift(58), // char_lit - nil, // "-" - shift(59), // "~" - shift(60), // "(" - nil, // ")" - shift(61), // "[" - nil, // "]" - shift(62), // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S81 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - shift(66), // regDefId - nil, // ignoredTokId - nil, // "|" - shift(67), // "." - shift(68), // char_lit - nil, // "-" - shift(69), // "~" - shift(70), // "(" - nil, // ")" - shift(71), // "[" - nil, // "]" - shift(72), // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S82 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - shift(76), // regDefId - nil, // ignoredTokId - nil, // "|" - shift(77), // "." - shift(78), // char_lit - nil, // "-" - shift(79), // "~" - shift(80), // "(" - nil, // ")" - shift(81), // "[" - nil, // "]" - shift(82), // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S83 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - reduce(8), // Ω, reduce: LexProduction - reduce(8), // tokId, reduce: LexProduction - nil, // ":" - nil, // ";" - reduce(8), // regDefId, reduce: LexProduction - reduce(8), // ignoredTokId, reduce: LexProduction - nil, // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - reduce(8), // g_sdt_lit, reduce: LexProduction - reduce(8), // prodId, reduce: LexProduction - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S84 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - reduce(9), // Ω, reduce: LexProduction - reduce(9), // tokId, reduce: LexProduction - nil, // ":" - nil, // ";" - reduce(9), // regDefId, reduce: LexProduction - reduce(9), // ignoredTokId, reduce: LexProduction - nil, // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - reduce(9), // g_sdt_lit, reduce: LexProduction - reduce(9), // prodId, reduce: LexProduction - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S85 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - reduce(28), // Ω, reduce: SyntaxProduction - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - reduce(28), // prodId, reduce: SyntaxProduction - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S86 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - shift(40), // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - shift(41), // prodId - shift(42), // string_lit - shift(43), // "error" - shift(44), // "λ" - shift(45), // "empty" - shift(46), // "ε" - }, - }, - actionRow{ // S87 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - reduce(39), // tokId, reduce: Symbols - nil, // ":" - reduce(39), // ";", reduce: Symbols - nil, // regDefId - nil, // ignoredTokId - reduce(39), // "|", reduce: Symbols - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - reduce(39), // g_sdt_lit, reduce: Symbols - reduce(39), // prodId, reduce: Symbols - reduce(39), // string_lit, reduce: Symbols - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S88 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - reduce(32), // ";", reduce: SyntaxBody - nil, // regDefId - nil, // ignoredTokId - reduce(32), // "|", reduce: SyntaxBody - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S89 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - shift(40), // tokId - nil, // ":" - reduce(34), // ";", reduce: SyntaxBody - nil, // regDefId - nil, // ignoredTokId - reduce(34), // "|", reduce: SyntaxBody - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - shift(122), // g_sdt_lit - shift(41), // prodId - shift(42), // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S90 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - reduce(36), // ";", reduce: SyntaxBody - nil, // regDefId - nil, // ignoredTokId - reduce(36), // "|", reduce: SyntaxBody - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S91 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - reduce(11), // ";", reduce: LexPattern - shift(25), // regDefId - nil, // ignoredTokId - reduce(11), // "|", reduce: LexPattern - shift(26), // "." - shift(27), // char_lit - nil, // "-" - shift(28), // "~" - shift(29), // "(" - nil, // ")" - shift(30), // "[" - nil, // "]" - shift(31), // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S92 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - reduce(16), // ";", reduce: LexTerm - reduce(16), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(16), // "|", reduce: LexTerm - reduce(16), // ".", reduce: LexTerm - reduce(16), // char_lit, reduce: LexTerm - nil, // "-" - reduce(16), // "~", reduce: LexTerm - reduce(16), // "(", reduce: LexTerm - nil, // ")" - reduce(16), // "[", reduce: LexTerm - nil, // "]" - reduce(16), // "{", reduce: LexTerm - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S93 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - nil, // char_lit - shift(123), // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S94 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - shift(56), // regDefId - nil, // ignoredTokId - nil, // "|" - shift(57), // "." - shift(58), // char_lit - nil, // "-" - shift(59), // "~" - shift(60), // "(" - nil, // ")" - shift(61), // "[" - nil, // "]" - shift(62), // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S95 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - reduce(22), // ";", reduce: LexTerm - reduce(22), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(22), // "|", reduce: LexTerm - reduce(22), // ".", reduce: LexTerm - reduce(22), // char_lit, reduce: LexTerm - nil, // "-" - reduce(22), // "~", reduce: LexTerm - reduce(22), // "(", reduce: LexTerm - nil, // ")" - reduce(22), // "[", reduce: LexTerm - nil, // "]" - reduce(22), // "{", reduce: LexTerm - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S96 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(13), // regDefId, reduce: LexAlt - nil, // ignoredTokId - reduce(13), // "|", reduce: LexAlt - reduce(13), // ".", reduce: LexAlt - reduce(13), // char_lit, reduce: LexAlt - nil, // "-" - reduce(13), // "~", reduce: LexAlt - reduce(13), // "(", reduce: LexAlt - reduce(13), // ")", reduce: LexAlt - reduce(13), // "[", reduce: LexAlt - nil, // "]" - reduce(13), // "{", reduce: LexAlt - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S97 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - shift(125), // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S98 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(17), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(17), // "|", reduce: LexTerm - reduce(17), // ".", reduce: LexTerm - reduce(17), // char_lit, reduce: LexTerm - nil, // "-" - reduce(17), // "~", reduce: LexTerm - reduce(17), // "(", reduce: LexTerm - reduce(17), // ")", reduce: LexTerm - reduce(17), // "[", reduce: LexTerm - nil, // "]" - reduce(17), // "{", reduce: LexTerm - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S99 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - shift(126), // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S100 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - shift(94), // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - shift(127), // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S101 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - shift(103), // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - shift(128), // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S102 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - shift(112), // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - shift(129), // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S103 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - shift(66), // regDefId - nil, // ignoredTokId - nil, // "|" - shift(67), // "." - shift(68), // char_lit - nil, // "-" - shift(69), // "~" - shift(70), // "(" - nil, // ")" - shift(71), // "[" - nil, // "]" - shift(72), // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S104 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - reduce(20), // ";", reduce: LexTerm - reduce(20), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(20), // "|", reduce: LexTerm - reduce(20), // ".", reduce: LexTerm - reduce(20), // char_lit, reduce: LexTerm - nil, // "-" - reduce(20), // "~", reduce: LexTerm - reduce(20), // "(", reduce: LexTerm - nil, // ")" - reduce(20), // "[", reduce: LexTerm - nil, // "]" - reduce(20), // "{", reduce: LexTerm - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S105 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(13), // regDefId, reduce: LexAlt - nil, // ignoredTokId - reduce(13), // "|", reduce: LexAlt - reduce(13), // ".", reduce: LexAlt - reduce(13), // char_lit, reduce: LexAlt - nil, // "-" - reduce(13), // "~", reduce: LexAlt - reduce(13), // "(", reduce: LexAlt - nil, // ")" - reduce(13), // "[", reduce: LexAlt - reduce(13), // "]", reduce: LexAlt - reduce(13), // "{", reduce: LexAlt - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S106 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - shift(131), // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S107 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(17), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(17), // "|", reduce: LexTerm - reduce(17), // ".", reduce: LexTerm - reduce(17), // char_lit, reduce: LexTerm - nil, // "-" - reduce(17), // "~", reduce: LexTerm - reduce(17), // "(", reduce: LexTerm - nil, // ")" - reduce(17), // "[", reduce: LexTerm - reduce(17), // "]", reduce: LexTerm - reduce(17), // "{", reduce: LexTerm - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S108 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - shift(132), // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S109 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - shift(94), // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - shift(133), // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S110 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - shift(103), // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - shift(134), // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S111 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - shift(112), // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - shift(135), // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S112 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - shift(76), // regDefId - nil, // ignoredTokId - nil, // "|" - shift(77), // "." - shift(78), // char_lit - nil, // "-" - shift(79), // "~" - shift(80), // "(" - nil, // ")" - shift(81), // "[" - nil, // "]" - shift(82), // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S113 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - reduce(21), // ";", reduce: LexTerm - reduce(21), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(21), // "|", reduce: LexTerm - reduce(21), // ".", reduce: LexTerm - reduce(21), // char_lit, reduce: LexTerm - nil, // "-" - reduce(21), // "~", reduce: LexTerm - reduce(21), // "(", reduce: LexTerm - nil, // ")" - reduce(21), // "[", reduce: LexTerm - nil, // "]" - reduce(21), // "{", reduce: LexTerm - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S114 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(13), // regDefId, reduce: LexAlt - nil, // ignoredTokId - reduce(13), // "|", reduce: LexAlt - reduce(13), // ".", reduce: LexAlt - reduce(13), // char_lit, reduce: LexAlt - nil, // "-" - reduce(13), // "~", reduce: LexAlt - reduce(13), // "(", reduce: LexAlt - nil, // ")" - reduce(13), // "[", reduce: LexAlt - nil, // "]" - reduce(13), // "{", reduce: LexAlt - reduce(13), // "}", reduce: LexAlt - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S115 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - shift(137), // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S116 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(17), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(17), // "|", reduce: LexTerm - reduce(17), // ".", reduce: LexTerm - reduce(17), // char_lit, reduce: LexTerm - nil, // "-" - reduce(17), // "~", reduce: LexTerm - reduce(17), // "(", reduce: LexTerm - nil, // ")" - reduce(17), // "[", reduce: LexTerm - nil, // "]" - reduce(17), // "{", reduce: LexTerm - reduce(17), // "}", reduce: LexTerm - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S117 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - shift(138), // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S118 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - shift(94), // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - shift(139), // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S119 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - shift(103), // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - shift(140), // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S120 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - shift(112), // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - shift(141), // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S121 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - reduce(30), // ";", reduce: Alternatives - nil, // regDefId - nil, // ignoredTokId - reduce(30), // "|", reduce: Alternatives - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S122 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - reduce(35), // ";", reduce: SyntaxBody - nil, // regDefId - nil, // ignoredTokId - reduce(35), // "|", reduce: SyntaxBody - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S123 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - shift(142), // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S124 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - shift(56), // regDefId - nil, // ignoredTokId - reduce(11), // "|", reduce: LexPattern - shift(57), // "." - shift(58), // char_lit - nil, // "-" - shift(59), // "~" - shift(60), // "(" - reduce(11), // ")", reduce: LexPattern - shift(61), // "[" - nil, // "]" - shift(62), // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S125 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(16), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(16), // "|", reduce: LexTerm - reduce(16), // ".", reduce: LexTerm - reduce(16), // char_lit, reduce: LexTerm - nil, // "-" - reduce(16), // "~", reduce: LexTerm - reduce(16), // "(", reduce: LexTerm - reduce(16), // ")", reduce: LexTerm - reduce(16), // "[", reduce: LexTerm - nil, // "]" - reduce(16), // "{", reduce: LexTerm - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S126 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - nil, // char_lit - shift(143), // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S127 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(22), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(22), // "|", reduce: LexTerm - reduce(22), // ".", reduce: LexTerm - reduce(22), // char_lit, reduce: LexTerm - nil, // "-" - reduce(22), // "~", reduce: LexTerm - reduce(22), // "(", reduce: LexTerm - reduce(22), // ")", reduce: LexTerm - reduce(22), // "[", reduce: LexTerm - nil, // "]" - reduce(22), // "{", reduce: LexTerm - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S128 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(20), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(20), // "|", reduce: LexTerm - reduce(20), // ".", reduce: LexTerm - reduce(20), // char_lit, reduce: LexTerm - nil, // "-" - reduce(20), // "~", reduce: LexTerm - reduce(20), // "(", reduce: LexTerm - reduce(20), // ")", reduce: LexTerm - reduce(20), // "[", reduce: LexTerm - nil, // "]" - reduce(20), // "{", reduce: LexTerm - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S129 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(21), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(21), // "|", reduce: LexTerm - reduce(21), // ".", reduce: LexTerm - reduce(21), // char_lit, reduce: LexTerm - nil, // "-" - reduce(21), // "~", reduce: LexTerm - reduce(21), // "(", reduce: LexTerm - reduce(21), // ")", reduce: LexTerm - reduce(21), // "[", reduce: LexTerm - nil, // "]" - reduce(21), // "{", reduce: LexTerm - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S130 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - shift(66), // regDefId - nil, // ignoredTokId - reduce(11), // "|", reduce: LexPattern - shift(67), // "." - shift(68), // char_lit - nil, // "-" - shift(69), // "~" - shift(70), // "(" - nil, // ")" - shift(71), // "[" - reduce(11), // "]", reduce: LexPattern - shift(72), // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S131 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(16), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(16), // "|", reduce: LexTerm - reduce(16), // ".", reduce: LexTerm - reduce(16), // char_lit, reduce: LexTerm - nil, // "-" - reduce(16), // "~", reduce: LexTerm - reduce(16), // "(", reduce: LexTerm - nil, // ")" - reduce(16), // "[", reduce: LexTerm - reduce(16), // "]", reduce: LexTerm - reduce(16), // "{", reduce: LexTerm - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S132 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - nil, // char_lit - shift(144), // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S133 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(22), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(22), // "|", reduce: LexTerm - reduce(22), // ".", reduce: LexTerm - reduce(22), // char_lit, reduce: LexTerm - nil, // "-" - reduce(22), // "~", reduce: LexTerm - reduce(22), // "(", reduce: LexTerm - nil, // ")" - reduce(22), // "[", reduce: LexTerm - reduce(22), // "]", reduce: LexTerm - reduce(22), // "{", reduce: LexTerm - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S134 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(20), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(20), // "|", reduce: LexTerm - reduce(20), // ".", reduce: LexTerm - reduce(20), // char_lit, reduce: LexTerm - nil, // "-" - reduce(20), // "~", reduce: LexTerm - reduce(20), // "(", reduce: LexTerm - nil, // ")" - reduce(20), // "[", reduce: LexTerm - reduce(20), // "]", reduce: LexTerm - reduce(20), // "{", reduce: LexTerm - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S135 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(21), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(21), // "|", reduce: LexTerm - reduce(21), // ".", reduce: LexTerm - reduce(21), // char_lit, reduce: LexTerm - nil, // "-" - reduce(21), // "~", reduce: LexTerm - reduce(21), // "(", reduce: LexTerm - nil, // ")" - reduce(21), // "[", reduce: LexTerm - reduce(21), // "]", reduce: LexTerm - reduce(21), // "{", reduce: LexTerm - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S136 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - shift(76), // regDefId - nil, // ignoredTokId - reduce(11), // "|", reduce: LexPattern - shift(77), // "." - shift(78), // char_lit - nil, // "-" - shift(79), // "~" - shift(80), // "(" - nil, // ")" - shift(81), // "[" - nil, // "]" - shift(82), // "{" - reduce(11), // "}", reduce: LexPattern - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S137 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(16), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(16), // "|", reduce: LexTerm - reduce(16), // ".", reduce: LexTerm - reduce(16), // char_lit, reduce: LexTerm - nil, // "-" - reduce(16), // "~", reduce: LexTerm - reduce(16), // "(", reduce: LexTerm - nil, // ")" - reduce(16), // "[", reduce: LexTerm - nil, // "]" - reduce(16), // "{", reduce: LexTerm - reduce(16), // "}", reduce: LexTerm - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S138 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - nil, // char_lit - shift(145), // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S139 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(22), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(22), // "|", reduce: LexTerm - reduce(22), // ".", reduce: LexTerm - reduce(22), // char_lit, reduce: LexTerm - nil, // "-" - reduce(22), // "~", reduce: LexTerm - reduce(22), // "(", reduce: LexTerm - nil, // ")" - reduce(22), // "[", reduce: LexTerm - nil, // "]" - reduce(22), // "{", reduce: LexTerm - reduce(22), // "}", reduce: LexTerm - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S140 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(20), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(20), // "|", reduce: LexTerm - reduce(20), // ".", reduce: LexTerm - reduce(20), // char_lit, reduce: LexTerm - nil, // "-" - reduce(20), // "~", reduce: LexTerm - reduce(20), // "(", reduce: LexTerm - nil, // ")" - reduce(20), // "[", reduce: LexTerm - nil, // "]" - reduce(20), // "{", reduce: LexTerm - reduce(20), // "}", reduce: LexTerm - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S141 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(21), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(21), // "|", reduce: LexTerm - reduce(21), // ".", reduce: LexTerm - reduce(21), // char_lit, reduce: LexTerm - nil, // "-" - reduce(21), // "~", reduce: LexTerm - reduce(21), // "(", reduce: LexTerm - nil, // ")" - reduce(21), // "[", reduce: LexTerm - nil, // "]" - reduce(21), // "{", reduce: LexTerm - reduce(21), // "}", reduce: LexTerm - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S142 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - shift(146), // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S143 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - shift(147), // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S144 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - shift(148), // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S145 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - shift(149), // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - nil, // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S146 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - reduce(18), // ";", reduce: LexTerm - reduce(18), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(18), // "|", reduce: LexTerm - reduce(18), // ".", reduce: LexTerm - reduce(18), // char_lit, reduce: LexTerm - nil, // "-" - reduce(18), // "~", reduce: LexTerm - reduce(18), // "(", reduce: LexTerm - nil, // ")" - reduce(18), // "[", reduce: LexTerm - nil, // "]" - reduce(18), // "{", reduce: LexTerm - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S147 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - shift(150), // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S148 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - shift(151), // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S149 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - nil, // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - shift(152), // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S150 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(18), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(18), // "|", reduce: LexTerm - reduce(18), // ".", reduce: LexTerm - reduce(18), // char_lit, reduce: LexTerm - nil, // "-" - reduce(18), // "~", reduce: LexTerm - reduce(18), // "(", reduce: LexTerm - reduce(18), // ")", reduce: LexTerm - reduce(18), // "[", reduce: LexTerm - nil, // "]" - reduce(18), // "{", reduce: LexTerm - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S151 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(18), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(18), // "|", reduce: LexTerm - reduce(18), // ".", reduce: LexTerm - reduce(18), // char_lit, reduce: LexTerm - nil, // "-" - reduce(18), // "~", reduce: LexTerm - reduce(18), // "(", reduce: LexTerm - nil, // ")" - reduce(18), // "[", reduce: LexTerm - reduce(18), // "]", reduce: LexTerm - reduce(18), // "{", reduce: LexTerm - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, - actionRow{ // S152 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - reduce(18), // regDefId, reduce: LexTerm - nil, // ignoredTokId - reduce(18), // "|", reduce: LexTerm - reduce(18), // ".", reduce: LexTerm - reduce(18), // char_lit, reduce: LexTerm - nil, // "-" - reduce(18), // "~", reduce: LexTerm - reduce(18), // "(", reduce: LexTerm - nil, // ")" - reduce(18), // "[", reduce: LexTerm - nil, // "]" - reduce(18), // "{", reduce: LexTerm - reduce(18), // "}", reduce: LexTerm - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" - }, - }, -} diff --git a/internal/frontend/reparsed/internal/parser/next/gototable.go b/internal/frontend/reparsed/internal/parser/next/gototable.go deleted file mode 100644 index 6d28aaa3..00000000 --- a/internal/frontend/reparsed/internal/parser/next/gototable.go +++ /dev/null @@ -1,3073 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package parser - -const numNTSymbols = 18 - -type ( - gotoTable [numStates]gotoRow - gotoRow [numNTSymbols]int -) - -var gotoTab = gotoTable{ - gotoRow{ // S0 - -1, // Π - 1, // Π - 2, // Π - 3, // Π - 4, // Π - 5, // Π - -1, // Π - -1, // Π - -1, // Π - 6, // Π - 7, // Π - 8, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S1 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S2 - -1, // Π - -1, // Π - -1, // Π - 14, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - 6, // Π - 7, // Π - 8, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S3 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S4 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - 15, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S5 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S6 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - 16, // Π - 8, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S7 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - 17, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S8 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S9 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S10 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S11 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S12 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S13 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S14 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S15 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S16 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - 17, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S17 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S18 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - 22, // Π - 23, // Π - 24, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S19 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - 32, // Π - 23, // Π - 24, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S20 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - 33, // Π - 23, // Π - 24, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S21 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - 34, // Π - 35, // Π - 36, // Π - 37, // Π - 38, // Π - 39, // Π - }, - gotoRow{ // S22 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S23 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - 49, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S24 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S25 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S26 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S27 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S28 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S29 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - 53, // Π - 54, // Π - 55, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S30 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - 63, // Π - 64, // Π - 65, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S31 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - 73, // Π - 74, // Π - 75, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S32 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S33 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S34 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S35 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S36 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - 87, // Π - }, - gotoRow{ // S37 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - 89, // Π - -1, // Π - -1, // Π - 39, // Π - }, - gotoRow{ // S38 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S39 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S40 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S41 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S42 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S43 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S44 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S45 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S46 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S47 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S48 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - 91, // Π - 24, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S49 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S50 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S51 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S52 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S53 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S54 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - 96, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S55 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S56 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S57 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S58 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S59 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S60 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - 100, // Π - 54, // Π - 55, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S61 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - 101, // Π - 64, // Π - 65, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S62 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - 102, // Π - 74, // Π - 75, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S63 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S64 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - 105, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S65 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S66 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S67 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S68 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S69 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S70 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - 109, // Π - 54, // Π - 55, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S71 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - 110, // Π - 64, // Π - 65, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S72 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - 111, // Π - 74, // Π - 75, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S73 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S74 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - 114, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S75 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S76 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S77 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S78 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S79 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S80 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - 118, // Π - 54, // Π - 55, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S81 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - 119, // Π - 64, // Π - 65, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S82 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - 120, // Π - 74, // Π - 75, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S83 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S84 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S85 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S86 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - 121, // Π - 36, // Π - 37, // Π - 38, // Π - 39, // Π - }, - gotoRow{ // S87 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S88 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S89 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - 87, // Π - }, - gotoRow{ // S90 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S91 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - 49, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S92 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S93 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S94 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - 124, // Π - 55, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S95 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S96 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S97 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S98 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S99 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S100 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S101 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S102 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S103 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - 130, // Π - 65, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S104 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S105 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S106 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S107 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S108 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S109 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S110 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S111 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S112 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - 136, // Π - 75, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S113 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S114 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S115 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S116 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S117 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S118 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S119 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S120 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S121 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S122 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S123 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S124 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - 96, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S125 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S126 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S127 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S128 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S129 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S130 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - 105, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S131 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S132 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S133 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S134 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S135 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S136 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - 114, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S137 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S138 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S139 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S140 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S141 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S142 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S143 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S144 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S145 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S146 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S147 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S148 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S149 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S150 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S151 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, - gotoRow{ // S152 - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - }, -} diff --git a/internal/frontend/reparsed/internal/parser/next/parser.go b/internal/frontend/reparsed/internal/parser/next/parser.go deleted file mode 100644 index 21440199..00000000 --- a/internal/frontend/reparsed/internal/parser/next/parser.go +++ /dev/null @@ -1,229 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package parser - -import ( - "fmt" - "strings" - - parseError "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/internal/errors/next" - token "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/internal/token/next" -) - -const ( - numProductions = 47 - numStates = 153 - numSymbols = 43 -) - -// Stack - -type stack struct { - state []int - attrib []Attrib -} - -const INITIAL_STACK_SIZE = 100 - -func newStack() *stack { - return &stack{ - state: make([]int, 0, INITIAL_STACK_SIZE), - attrib: make([]Attrib, 0, INITIAL_STACK_SIZE), - } -} - -func (s *stack) reset() { - s.state = s.state[:0] - s.attrib = s.attrib[:0] -} - -func (s *stack) push(state int, a Attrib) { - s.state = append(s.state, state) - s.attrib = append(s.attrib, a) -} - -func (s *stack) top() int { - return s.state[len(s.state)-1] -} - -func (s *stack) peek(pos int) int { - return s.state[pos] -} - -func (s *stack) topIndex() int { - return len(s.state) - 1 -} - -func (s *stack) popN(items int) []Attrib { - lo, hi := len(s.state)-items, len(s.state) - - attrib := s.attrib[lo:hi] - - s.state = s.state[:lo] - s.attrib = s.attrib[:lo] - - return attrib -} - -func (s *stack) String() string { - w := new(strings.Builder) - fmt.Fprintf(w, "stack:\n") - for i, st := range s.state { - fmt.Fprintf(w, "\t%d: %d , ", i, st) - if s.attrib[i] == nil { - fmt.Fprintf(w, "nil") - } else { - switch attr := s.attrib[i].(type) { - case *token.Token: - fmt.Fprintf(w, "%s", attr.Lit) - default: - fmt.Fprintf(w, "%v", attr) - } - } - fmt.Fprintf(w, "\n") - } - return w.String() -} - -// Parser - -type Parser struct { - stack *stack - nextToken *token.Token - pos int - UserContext interface{} -} - -type scannerPosition interface{} - -type Scanner interface { - Scan() (tok *token.Token) -} - -type ContextDependentScanner interface { - Scanner - SavePosition() scannerPosition - RestorePosition() scannerPosition -} - -func NewParser() *Parser { - p := &Parser{stack: newStack()} - p.Reset() - return p -} - -func (p *Parser) Reset() { - p.stack.reset() - p.stack.push(0, nil) -} - -func (p *Parser) Error(err error, scanner Scanner) (recovered bool, errorAttrib *parseError.Error) { - errorAttrib = &parseError.Error{ - Err: err, - ErrorToken: p.nextToken, - ErrorSymbols: p.popNonRecoveryStates(), - ExpectedTokens: make([]string, 0, 8), - } - for t, action := range actionTab[p.stack.top()].actions { - if action != nil { - errorAttrib.ExpectedTokens = append(errorAttrib.ExpectedTokens, token.TokMap.Id(token.Type(t))) - } - } - - if action := actionTab[p.stack.top()].actions[token.TokMap.Type("error")]; action != nil { - p.stack.push(int(action.(shift)), errorAttrib) // action can only be shift - } else { - return - } - - if action := actionTab[p.stack.top()].actions[p.nextToken.Type]; action != nil { - recovered = true - } - for !recovered && p.nextToken.Type != token.EOF { - p.nextToken = scanner.Scan() - if action := actionTab[p.stack.top()].actions[p.nextToken.Type]; action != nil { - recovered = true - } - } - - return -} - -func (p *Parser) popNonRecoveryStates() (removedAttribs []parseError.ErrorSymbol) { - if rs, ok := p.firstRecoveryState(); ok { - errorSymbols := p.stack.popN(p.stack.topIndex() - rs) - removedAttribs = make([]parseError.ErrorSymbol, len(errorSymbols)) - for i, e := range errorSymbols { - removedAttribs[i] = e - } - } else { - removedAttribs = []parseError.ErrorSymbol{} - } - return -} - -// recoveryState points to the highest state on the stack, which can recover -func (p *Parser) firstRecoveryState() (recoveryState int, canRecover bool) { - recoveryState, canRecover = p.stack.topIndex(), actionTab[p.stack.top()].canRecover - for recoveryState > 0 && !canRecover { - recoveryState-- - canRecover = actionTab[p.stack.peek(recoveryState)].canRecover - } - return -} - -func (p *Parser) newError(err error) error { - e := &parseError.Error{ - Err: err, - StackTop: p.stack.top(), - ErrorToken: p.nextToken, - } - actRow := actionTab[p.stack.top()] - for i, t := range actRow.actions { - if t != nil { - e.ExpectedTokens = append(e.ExpectedTokens, token.TokMap.Id(token.Type(i))) - } - } - return e -} - -func (p *Parser) parse(scanner Scanner) (res interface{}, err error) { - p.Reset() - p.nextToken = scanner.Scan() - for acc := false; !acc; { - action := actionTab[p.stack.top()].actions[p.nextToken.Type] - if action == nil { - if recovered, errAttrib := p.Error(nil, scanner); !recovered { - p.nextToken = errAttrib.ErrorToken - return nil, p.newError(nil) - } - if action = actionTab[p.stack.top()].actions[p.nextToken.Type]; action == nil { - panic("Error recovery led to invalid action") - } - } - - switch act := action.(type) { - case accept: - res = p.stack.popN(1)[0] - acc = true - case shift: - p.stack.push(int(act), p.nextToken) - p.nextToken = scanner.Scan() - case reduce: - prod := productionsTable[int(act)] - attrib, err := prod.ReduceFunc(p.stack.popN(prod.NumSymbols)) - if err != nil { - return nil, p.newError(err) - } else { - p.stack.push(gotoTab[p.stack.top()][prod.NTType], attrib) - } - default: - panic("unknown action: " + action.String()) - } - } - return res, nil -} - -func (p *Parser) Parse(scanner Scanner) (res interface{}, err error) { - return p.parse(scanner) -} diff --git a/internal/frontend/reparsed/internal/parser/next/productionstable.go b/internal/frontend/reparsed/internal/parser/next/productionstable.go deleted file mode 100644 index eec97f19..00000000 --- a/internal/frontend/reparsed/internal/parser/next/productionstable.go +++ /dev/null @@ -1,495 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package parser - -import "github.com/maxcalandrelli/gocc/internal/ast" - - - -type ( - //TODO: change type and variable names to be consistent with other tables - ProdTab [numProductions]ProdTabEntry - ProdTabEntry struct { - String string - Id string - NTType int - Index int - NumSymbols int - ReduceFunc func([]Attrib) (Attrib, error) - } - Attrib interface { - } -) - -var productionsTable = ProdTab{ - ProdTabEntry{ - String: `S' : Π << >>`, - Id: "S'", - NTType: 0, - Index: 0, - NumSymbols: 1, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return X[0], nil - }, - }, - ProdTabEntry{ - String: `Grammar : Π Π << ast.NewGrammar(X[0], X[1]) >>`, - Id: "Grammar", - NTType: 1, - Index: 1, - NumSymbols: 2, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return ast.NewGrammar(X[0], X[1]) - }, - }, - ProdTabEntry{ - String: `Grammar : Π << ast.NewGrammar(X[0], nil) >>`, - Id: "Grammar", - NTType: 1, - Index: 2, - NumSymbols: 1, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return ast.NewGrammar(X[0], nil) - }, - }, - ProdTabEntry{ - String: `Grammar : Π << ast.NewGrammar(nil, X[0]) >>`, - Id: "Grammar", - NTType: 1, - Index: 3, - NumSymbols: 1, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return ast.NewGrammar(nil, X[0]) - }, - }, - ProdTabEntry{ - String: `LexicalPart : Π << ast.NewLexPart(nil, nil, X[0]) >>`, - Id: "LexicalPart", - NTType: 2, - Index: 4, - NumSymbols: 1, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return ast.NewLexPart(nil, nil, X[0]) - }, - }, - ProdTabEntry{ - String: `LexProductions : Π << ast.NewLexProductions(X[0]) >>`, - Id: "LexProductions", - NTType: 4, - Index: 5, - NumSymbols: 1, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return ast.NewLexProductions(X[0]) - }, - }, - ProdTabEntry{ - String: `LexProductions : Π Π << ast.AppendLexProduction(X[0], X[1]) >>`, - Id: "LexProductions", - NTType: 4, - Index: 6, - NumSymbols: 2, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return ast.AppendLexProduction(X[0], X[1]) - }, - }, - ProdTabEntry{ - String: `LexProduction : tokId Λ<:> Π Λ<;> << ast.NewLexTokDef(X[0], X[2]) >>`, - Id: "LexProduction", - NTType: 5, - Index: 7, - NumSymbols: 4, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return ast.NewLexTokDef(X[0], X[2]) - }, - }, - ProdTabEntry{ - String: `LexProduction : regDefId Λ<:> Π Λ<;> << ast.NewLexRegDef(X[0], X[2]) >>`, - Id: "LexProduction", - NTType: 5, - Index: 8, - NumSymbols: 4, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return ast.NewLexRegDef(X[0], X[2]) - }, - }, - ProdTabEntry{ - String: `LexProduction : ignoredTokId Λ<:> Π Λ<;> << ast.NewLexIgnoredTokDef(X[0], X[2]) >>`, - Id: "LexProduction", - NTType: 5, - Index: 9, - NumSymbols: 4, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return ast.NewLexIgnoredTokDef(X[0], X[2]) - }, - }, - ProdTabEntry{ - String: `LexPattern : Π << ast.NewLexPattern(X[0]) >>`, - Id: "LexPattern", - NTType: 6, - Index: 10, - NumSymbols: 1, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return ast.NewLexPattern(X[0]) - }, - }, - ProdTabEntry{ - String: `LexPattern : Π Λ<|> Π << ast.AppendLexAlt(X[0], X[2]) >>`, - Id: "LexPattern", - NTType: 6, - Index: 11, - NumSymbols: 3, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return ast.AppendLexAlt(X[0], X[2]) - }, - }, - ProdTabEntry{ - String: `LexAlt : Π << ast.NewLexAlt(X[0]) >>`, - Id: "LexAlt", - NTType: 7, - Index: 12, - NumSymbols: 1, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return ast.NewLexAlt(X[0]) - }, - }, - ProdTabEntry{ - String: `LexAlt : Π Π << ast.AppendLexTerm(X[0], X[1]) >>`, - Id: "LexAlt", - NTType: 7, - Index: 13, - NumSymbols: 2, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return ast.AppendLexTerm(X[0], X[1]) - }, - }, - ProdTabEntry{ - String: `LexTerm : Λ<.> << ast.LexDOT, nil >>`, - Id: "LexTerm", - NTType: 8, - Index: 14, - NumSymbols: 1, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return ast.LexDOT, nil - }, - }, - ProdTabEntry{ - String: `LexTerm : char_lit << ast.NewLexCharLitExt(X[0],false) >>`, - Id: "LexTerm", - NTType: 8, - Index: 15, - NumSymbols: 1, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return ast.NewLexCharLitExt(X[0],false) - }, - }, - ProdTabEntry{ - String: `LexTerm : char_lit Λ<-> char_lit << ast.NewLexCharRangeExt(X[0], X[2],false) >>`, - Id: "LexTerm", - NTType: 8, - Index: 16, - NumSymbols: 3, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return ast.NewLexCharRangeExt(X[0], X[2],false) - }, - }, - ProdTabEntry{ - String: `LexTerm : Λ<~> char_lit << ast.NewLexCharLitExt(X[0], true) >>`, - Id: "LexTerm", - NTType: 8, - Index: 17, - NumSymbols: 2, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return ast.NewLexCharLitExt(X[0], true) - }, - }, - ProdTabEntry{ - String: `LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> << ast.NewLexCharRangeExt(X[2], X[4], true) >>`, - Id: "LexTerm", - NTType: 8, - Index: 18, - NumSymbols: 6, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return ast.NewLexCharRangeExt(X[2], X[4], true) - }, - }, - ProdTabEntry{ - String: `LexTerm : regDefId << ast.NewLexRegDefId(X[0]) >>`, - Id: "LexTerm", - NTType: 8, - Index: 19, - NumSymbols: 1, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return ast.NewLexRegDefId(X[0]) - }, - }, - ProdTabEntry{ - String: `LexTerm : Λ<[> Π Λ<]> << ast.NewLexOptPattern(X[1]) >>`, - Id: "LexTerm", - NTType: 8, - Index: 20, - NumSymbols: 3, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return ast.NewLexOptPattern(X[1]) - }, - }, - ProdTabEntry{ - String: `LexTerm : Λ<{> Π Λ<}> << ast.NewLexRepPattern(X[1]) >>`, - Id: "LexTerm", - NTType: 8, - Index: 21, - NumSymbols: 3, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return ast.NewLexRepPattern(X[1]) - }, - }, - ProdTabEntry{ - String: `LexTerm : Λ<(> Π Λ<)> << ast.NewLexGroupPattern(X[1]) >>`, - Id: "LexTerm", - NTType: 8, - Index: 22, - NumSymbols: 3, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return ast.NewLexGroupPattern(X[1]) - }, - }, - ProdTabEntry{ - String: `SyntaxPart : Π Π << ast.NewSyntaxPart(X[0], X[1]) >>`, - Id: "SyntaxPart", - NTType: 3, - Index: 23, - NumSymbols: 2, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return ast.NewSyntaxPart(X[0], X[1]) - }, - }, - ProdTabEntry{ - String: `SyntaxPart : Π << ast.NewSyntaxPart(nil, X[0]) >>`, - Id: "SyntaxPart", - NTType: 3, - Index: 24, - NumSymbols: 1, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return ast.NewSyntaxPart(nil, X[0]) - }, - }, - ProdTabEntry{ - String: `FileHeader : g_sdt_lit << ast.NewFileHeader(X[0]) >>`, - Id: "FileHeader", - NTType: 9, - Index: 25, - NumSymbols: 1, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return ast.NewFileHeader(X[0]) - }, - }, - ProdTabEntry{ - String: `SyntaxProdList : Π << ast.NewSyntaxProdList(X[0]) >>`, - Id: "SyntaxProdList", - NTType: 10, - Index: 26, - NumSymbols: 1, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return ast.NewSyntaxProdList(X[0]) - }, - }, - ProdTabEntry{ - String: `SyntaxProdList : Π Π << ast.AddSyntaxProds(X[0], X[1]) >>`, - Id: "SyntaxProdList", - NTType: 10, - Index: 27, - NumSymbols: 2, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return ast.AddSyntaxProds(X[0], X[1]) - }, - }, - ProdTabEntry{ - String: `SyntaxProduction : prodId Λ<:> Π Λ<;> << ast.NewSyntaxProd(X[0], X[2]) >>`, - Id: "SyntaxProduction", - NTType: 11, - Index: 28, - NumSymbols: 4, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return ast.NewSyntaxProd(X[0], X[2]) - }, - }, - ProdTabEntry{ - String: `Alternatives : Π << ast.NewSyntaxAlts(X[0]) >>`, - Id: "Alternatives", - NTType: 12, - Index: 29, - NumSymbols: 1, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return ast.NewSyntaxAlts(X[0]) - }, - }, - ProdTabEntry{ - String: `Alternatives : Π Λ<|> Π << ast.AddSyntaxAlt(X[0], X[2]) >>`, - Id: "Alternatives", - NTType: 12, - Index: 30, - NumSymbols: 3, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return ast.AddSyntaxAlt(X[0], X[2]) - }, - }, - ProdTabEntry{ - String: `SyntaxBody : Π << ast.NewSyntaxBodyGen(X[0], nil) >>`, - Id: "SyntaxBody", - NTType: 13, - Index: 31, - NumSymbols: 1, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return ast.NewSyntaxBodyGen(X[0], nil) - }, - }, - ProdTabEntry{ - String: `SyntaxBody : Π g_sdt_lit << ast.NewSyntaxBodyGen(X[0], X[1]) >>`, - Id: "SyntaxBody", - NTType: 13, - Index: 32, - NumSymbols: 2, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return ast.NewSyntaxBodyGen(X[0], X[1]) - }, - }, - ProdTabEntry{ - String: `SyntaxBody : Π << ast.NewErrorBodyGen(nil, nil) >>`, - Id: "SyntaxBody", - NTType: 13, - Index: 33, - NumSymbols: 1, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return ast.NewErrorBodyGen(nil, nil) - }, - }, - ProdTabEntry{ - String: `SyntaxBody : Π Π << ast.NewErrorBodyGen(X[1], nil) >>`, - Id: "SyntaxBody", - NTType: 13, - Index: 34, - NumSymbols: 2, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return ast.NewErrorBodyGen(X[1], nil) - }, - }, - ProdTabEntry{ - String: `SyntaxBody : Π Π g_sdt_lit << ast.NewErrorBodyGen(X[1], X[2]) >>`, - Id: "SyntaxBody", - NTType: 13, - Index: 35, - NumSymbols: 3, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return ast.NewErrorBodyGen(X[1], X[2]) - }, - }, - ProdTabEntry{ - String: `SyntaxBody : Π g_sdt_lit << ast.NewErrorBodyGen(nil, X[1]) >>`, - Id: "SyntaxBody", - NTType: 13, - Index: 36, - NumSymbols: 2, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return ast.NewErrorBodyGen(nil, X[1]) - }, - }, - ProdTabEntry{ - String: `SyntaxBody : Π << ast.NewEmptyBodyGen() >>`, - Id: "SyntaxBody", - NTType: 13, - Index: 37, - NumSymbols: 1, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return ast.NewEmptyBodyGen() - }, - }, - ProdTabEntry{ - String: `Symbols : Π << ast.NewSyntaxSymbols(X[0]) >>`, - Id: "Symbols", - NTType: 14, - Index: 38, - NumSymbols: 1, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return ast.NewSyntaxSymbols(X[0]) - }, - }, - ProdTabEntry{ - String: `Symbols : Π Π << ast.AddSyntaxSymbol(X[0], X[1]) >>`, - Id: "Symbols", - NTType: 14, - Index: 39, - NumSymbols: 2, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return ast.AddSyntaxSymbol(X[0], X[1]) - }, - }, - ProdTabEntry{ - String: `Symbol : prodId << ast.NewSyntaxProdId(X[0]) >>`, - Id: "Symbol", - NTType: 17, - Index: 40, - NumSymbols: 1, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return ast.NewSyntaxProdId(X[0]) - }, - }, - ProdTabEntry{ - String: `Symbol : tokId << ast.NewTokId(X[0]) >>`, - Id: "Symbol", - NTType: 17, - Index: 41, - NumSymbols: 1, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return ast.NewTokId(X[0]) - }, - }, - ProdTabEntry{ - String: `Symbol : string_lit << ast.NewStringLit(X[0]) >>`, - Id: "Symbol", - NTType: 17, - Index: 42, - NumSymbols: 1, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return ast.NewStringLit(X[0]) - }, - }, - ProdTabEntry{ - String: `ErrorSymbol : Λ << >>`, - Id: "ErrorSymbol", - NTType: 15, - Index: 43, - NumSymbols: 1, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return X[0], nil - }, - }, - ProdTabEntry{ - String: `ErrorSymbol : Λ<λ> << >>`, - Id: "ErrorSymbol", - NTType: 15, - Index: 44, - NumSymbols: 1, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return X[0], nil - }, - }, - ProdTabEntry{ - String: `EpsilonSymbol : Λ << >>`, - Id: "EpsilonSymbol", - NTType: 16, - Index: 45, - NumSymbols: 1, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return X[0], nil - }, - }, - ProdTabEntry{ - String: `EpsilonSymbol : Λ<ε> << >>`, - Id: "EpsilonSymbol", - NTType: 16, - Index: 46, - NumSymbols: 1, - ReduceFunc: func(X []Attrib) (Attrib, error) { - return X[0], nil - }, - }, -} diff --git a/internal/frontend/reparsed/internal/parser/parser.go b/internal/frontend/reparsed/internal/parser/parser.go index 39e5367a..746faa1e 100644 --- a/internal/frontend/reparsed/internal/parser/parser.go +++ b/internal/frontend/reparsed/internal/parser/parser.go @@ -95,7 +95,21 @@ type Parser struct { userContext interface{} } -type TokenStream = iface.TokenStream +type ( + TokenStream = iface.TokenStream + fakeCp struct{} + fakeCheckPointable struct{} +) + +func (f fakeCheckPointable) GetCheckPoint() iface.CheckPoint { + return fakeCp{} +} + +func (f fakeCheckPointable) GotoCheckPoint(iface.CheckPoint) {} + +func (f fakeCp) DistanceFrom(o iface.CheckPoint) int { + return 0 +} func NewParser() *Parser { return NewParserWithContext(nil) @@ -112,6 +126,15 @@ func (p *Parser) Reset() { p.stack.push(0, nil) } +func (p *Parser) SetContext(ctx interface{}) *Parser { + p.userContext = ctx + return p +} + +func (p Parser) GetContext() interface{} { + return p.userContext +} + func (p *Parser) Error(err error, scanner iface.Scanner) (recovered bool, errorAttrib *parseError.Error) { errorAttrib = &parseError.Error{ Err: err, @@ -125,7 +148,7 @@ func (p *Parser) Error(err error, scanner iface.Scanner) (recovered bool, errorA } } - if action := parserActions.table[p.stack.top()].actions[token.TokMap.Type("error")]; action != nil { + if action := parserActions.table[p.stack.top()].actions[token.TokMap.Type("λ")]; action != nil { p.stack.push(int(action.(shift)), errorAttrib) // action can only be shift } else { return @@ -202,7 +225,9 @@ func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, er if tokens == nil && (len(parserActions.table[p.stack.top()].cdActions) > 0 || longest) { return errNotRepositionable } - checkPoint = tokens.GetCheckPoint() + if longest { + checkPoint = tokens.GetCheckPoint() + } p.nextToken = scanner.Scan() if longest { afterPos = tokens.GetCheckPoint() @@ -210,31 +235,34 @@ func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, er return nil } p.Reset() - tokens, _ = scanner.(iface.CheckPointable) + if tokens, _ = scanner.(iface.CheckPointable); tokens == nil { + tokens = fakeCheckPointable{} + } + underlyingStream := TokenStream(nil) + if streamScanner, _ := scanner.(iface.StreamScanner); streamScanner != nil { + underlyingStream = streamScanner.GetStream() + } startCp := tokens.GetCheckPoint() if err := readNextToken(); err != nil { return nil, err, tokens.GetCheckPoint().DistanceFrom(startCp) } for acc := false; !acc; { action := parserActions.table[p.stack.top()].actions[p.nextToken.Type] - if action == nil { + if action == nil && underlyingStream != nil && len(parserActions.table[p.stack.top()].cdActions) > 0 { // // If no action, check if we have some context dependent parsing to try // - if streamScanner, _ := scanner.(iface.StreamScanner); streamScanner != nil { - underlyingStream := streamScanner.GetStream() - for _, cdAction := range parserActions.table[p.stack.top()].cdActions { - tokens.GotoCheckPoint(checkPoint) - cd_res, cd_err, cd_parsed := cdAction.tokenScanner(underlyingStream, p.userContext) - if cd_err == nil && len(cd_parsed) > 0 { - action = parserActions.table[p.stack.top()].actions[cdAction.tokenIndex] - if action != nil { - p.nextToken.Foreign = true - p.nextToken.ForeignAstNode = cd_res - p.nextToken.Lit = cd_parsed - p.nextToken.Type = token.Type(cdAction.tokenIndex) - break - } + for _, cdAction := range parserActions.table[p.stack.top()].cdActions { + tokens.GotoCheckPoint(checkPoint) + cd_res, cd_err, cd_parsed := cdAction.tokenScanner(underlyingStream, p.userContext) + if cd_err == nil && len(cd_parsed) > 0 { + action = parserActions.table[p.stack.top()].actions[cdAction.tokenIndex] + if action != nil { + p.nextToken.Foreign = true + p.nextToken.ForeignAstNode = cd_res + p.nextToken.Lit = cd_parsed + p.nextToken.Type = token.Type(cdAction.tokenIndex) + break } } } diff --git a/internal/frontend/reparsed/internal/token/next/token.go b/internal/frontend/reparsed/internal/token/next/token.go deleted file mode 100644 index f4cd2cba..00000000 --- a/internal/frontend/reparsed/internal/token/next/token.go +++ /dev/null @@ -1,131 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package token - -import ( - "fmt" -) - -type Token struct { - Type - Lit []byte - Pos - ForeingAstNode interface{} - ForeingAstError error -} - -type Type int - -const ( - INVALID Type = iota - EOF -) - -type Pos struct { - Offset int - Line int - Column int -} - -func (p Pos) String() string { - return fmt.Sprintf("Pos(offset=%d, line=%d, column=%d)", p.Offset, p.Line, p.Column) -} - -func (p Pos) StartingFrom(base Pos) Pos { - r := base - r.Offset += p.Offset - r.Line += p.Line - r.Column = p.Column - if p.Line > 0 && base.Line > 0 { - r.Line-- - } - if r.Column < 1 { - r.Column = 1 - } - return r -} - -type TokenMap struct { - typeMap []string - idMap map[string]Type -} - -func (m TokenMap) Id(tok Type) string { - if int(tok) < len(m.typeMap) { - return m.typeMap[tok] - } - return "unknown" -} - -func (m TokenMap) Type(tok string) Type { - if typ, exist := m.idMap[tok]; exist { - return typ - } - return INVALID -} - -func (m TokenMap) TokenString(tok *Token) string { - return fmt.Sprintf("%s(%d,<%s>)", m.Id(tok.Type), tok.Type, tok.Lit) -} - -func (m TokenMap) StringType(typ Type) string { - return fmt.Sprintf("%s(%d)", m.Id(typ), typ) -} - -var TokMap = TokenMap{ - typeMap: []string{ - "INVALID", - "Ω", - "tokId", - "Λ<:>", - "Λ<;>", - "regDefId", - "ignoredTokId", - "Λ<|>", - "Λ<.>", - "char_lit", - "Λ<->", - "Λ<~>", - "Λ<(>", - "Λ<)>", - "Λ<[>", - "Λ<]>", - "Λ<{>", - "Λ<}>", - "g_sdt_lit", - "prodId", - "string_lit", - "Λ", - "Λ<λ>", - "Λ", - "Λ<ε>", - }, - - idMap: map[string]Type{ - "INVALID": 0, - "Ω": 1, - "tokId": 2, - "Λ<:>": 3, - "Λ<;>": 4, - "regDefId": 5, - "ignoredTokId": 6, - "Λ<|>": 7, - "Λ<.>": 8, - "char_lit": 9, - "Λ<->": 10, - "Λ<~>": 11, - "Λ<(>": 12, - "Λ<)>": 13, - "Λ<[>": 14, - "Λ<]>": 15, - "Λ<{>": 16, - "Λ<}>": 17, - "g_sdt_lit": 18, - "prodId": 19, - "string_lit": 20, - "Λ": 21, - "Λ<λ>": 22, - "Λ": 23, - "Λ<ε>": 24, - }, -} diff --git a/internal/frontend/reparsed/internal/token/token.go b/internal/frontend/reparsed/internal/token/token.go index fe25a5e4..8ae4f88b 100644 --- a/internal/frontend/reparsed/internal/token/token.go +++ b/internal/frontend/reparsed/internal/token/token.go @@ -48,6 +48,7 @@ func (p Pos) StartingFrom(base Pos) Pos { type TokenMap struct { typeMap []string idMap map[string]Type + litMap map[string]Type } func (m TokenMap) Id(tok Type) string { @@ -130,4 +131,23 @@ var TokMap = TokenMap{ "Λ": 24, "Λ<ε>": 25, }, + + litMap: map[string]Type{ + "empty": 24, + "ε": 25, + ".": 8, + ")": 13, + "error": 22, + "λ": 23, + ";": 4, + "}": 17, + "~": 11, + "[": 14, + "]": 15, + "{": 16, + ":": 3, + "|": 7, + "-": 10, + "(": 12, + }, } diff --git a/internal/frontend/reparsed/main/main.go b/internal/frontend/reparsed/main/main.go index 5c6bb6ec..88410717 100644 --- a/internal/frontend/reparsed/main/main.go +++ b/internal/frontend/reparsed/main/main.go @@ -6,7 +6,7 @@ import ( "os" "strings" - reparsed "github.com/maxcalandrelli/gocc/internal/frontend/reparsed" + gocc2 "github.com/maxcalandrelli/gocc/internal/frontend/reparsed" ) func showResult(r interface{}, e error, l int) { @@ -23,11 +23,11 @@ var ( Longest bool ) -func parse(longest bool, lex *reparsed.Lexer) (res interface{}, err error, ptl int) { +func parse(longest bool, lex *gocc2.Lexer) (res interface{}, err error, ptl int) { if longest { - return reparsed.NewParser().ParseLongestPrefix(lex) + return gocc2.NewParser().ParseLongestPrefix(lex) } else { - return reparsed.NewParser().Parse(lex) + return gocc2.NewParser().Parse(lex) } return } @@ -38,16 +38,16 @@ func main() { flag.BoolVar(&Longest, "longest", false, "parse longest possible part") flag.Parse() if Text > "" { - showResult(parse(Longest, reparsed.NewLexerString(Text))) + showResult(parse(Longest, gocc2.NewLexerString(Text))) } if File > "" { - l, e := reparsed.NewLexerFile(File) + l, e := gocc2.NewLexerFile(File) if e != nil { panic(e) } showResult(parse(Longest, l)) } if str := strings.Join(flag.Args(), " "); str > "" { - showResult(parse(Longest, reparsed.NewLexerString(str))) + showResult(parse(Longest, gocc2.NewLexerString(str))) } } diff --git a/internal/frontend/reparsed/main/next/main.go b/internal/frontend/reparsed/main/next/main.go deleted file mode 100644 index ee2139ff..00000000 --- a/internal/frontend/reparsed/main/next/main.go +++ /dev/null @@ -1,40 +0,0 @@ -package main - -import ( - "flag" - "fmt" - "os" - "strings" - - reparsed "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/next" -) - -func showResult(r interface{}, e error) { - if e != nil { - fmt.Fprintf(os.Stderr, "parsing returned the following error: %s\n", e.Error()) - } else { - fmt.Printf("%#v\n", r) - } -} - -var ( - File string - Text string - Longest bool -) - -func main() { - flag.StringVar(&File, "file", "", "parse also text in file") - flag.StringVar(&Text, "text", "", "parse also text given with flag") - flag.BoolVar(&Longest, "longest", false, "parse longest possible part") - flag.Parse() - if Text > "" { - showResult(reparsed.ParseText(Text)) - } - if File > "" { - showResult(reparsed.ParseFile(File)) - } - if str := strings.Join(os.Args[1:], " "); str > "" { - showResult(reparsed.ParseText(str)) - } -} diff --git a/internal/frontend/reparsed/next/reparsed.go b/internal/frontend/reparsed/next/reparsed.go deleted file mode 100644 index 5ba25d24..00000000 --- a/internal/frontend/reparsed/next/reparsed.go +++ /dev/null @@ -1,51 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package reparsed - -import ( - "io" - - "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/internal/io/stream" - lexer "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/internal/lexer/next" - parser "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/internal/parser/next" - token "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/internal/token/next" -) - -type Token = token.Token -type WindowReader = stream.WindowReader - -func ParseFile(fpath string) (interface{}, error) { - if lexer, err := NewLexerFile(fpath); err == nil { - return NewParser().Parse(lexer) - } else { - return nil, err - } -} - -func ParseText(text string) (interface{}, error) { - return NewParser().Parse(NewLexer([]byte(text))) -} - -func NewLexer(src []byte) *lexer.Lexer { - return lexer.NewLexer(src) -} - -func NewLexerFile(fpath string) (*lexer.Lexer, error) { - return lexer.NewLexerFile(fpath) -} - -func NewParser() *parser.Parser { - return parser.NewParser() -} - -func NewWindowReaderFromBytes(src []byte) WindowReader { - return stream.NewWindowReaderFromBytes(src) -} - -func NewWindowReader(rdr io.Reader) WindowReader { - return stream.NewWindowReader(rdr) -} - -func NewLimitedWindowReader(rdr io.Reader, sizeMin, sizeMax int) WindowReader { - return stream.NewLimitedWindowReader(rdr, sizeMin, sizeMax) -} diff --git a/internal/frontend/reparsed/reparsed.go b/internal/frontend/reparsed/reparsed.go deleted file mode 100644 index 38e7b511..00000000 --- a/internal/frontend/reparsed/reparsed.go +++ /dev/null @@ -1,62 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package reparsed - -import ( - "io" - - "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/iface" - "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/internal/io/stream" - "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/internal/lexer" - "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/internal/parser" - "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/internal/token" -) - -type ( - Token = token.Token - Lexer = lexer.Lexer - Parser = parser.Parser - TokenStream = iface.TokenStream - WindowReader = stream.WindowReader - Scanner = iface.Scanner -) - -func ParseFile(fpath string) (interface{}, error, int) { - if lexer, err := NewLexerFile(fpath); err == nil { - return NewParser().Parse(lexer) - } else { - return nil, err, 0 - } -} - -func ParseText(text string) (interface{}, error, int) { - return NewParser().Parse(NewLexerBytes([]byte(text))) -} - -func NewLexerBytes(src []byte) *lexer.Lexer { - return lexer.NewLexerBytes(src) -} - -func NewLexerString(src string) *lexer.Lexer { - return lexer.NewLexerBytes([]byte(src)) -} - -func NewLexerFile(fpath string) (*lexer.Lexer, error) { - return lexer.NewLexerFile(fpath) -} - -func NewParser() *parser.Parser { - return parser.NewParser() -} - -func NewWindowReaderFromBytes(src []byte) WindowReader { - return stream.NewWindowReaderFromBytes(src) -} - -func NewWindowReader(rdr io.Reader) WindowReader { - return stream.NewWindowReader(rdr) -} - -func NewLimitedWindowReader(rdr io.Reader, sizeMin, sizeMax int) WindowReader { - return stream.NewLimitedWindowReader(rdr, sizeMin, sizeMax) -} diff --git a/internal/io/gen/golang/gen.go b/internal/io/gen/golang/gen.go index 188173fd..7cb75db3 100644 --- a/internal/io/gen/golang/gen.go +++ b/internal/io/gen/golang/gen.go @@ -9,7 +9,6 @@ import ( ) type data struct { - MyName string Pkg string Outdir string Subpath string diff --git a/internal/lexer/gen/golang/gen.go b/internal/lexer/gen/golang/gen.go index 7300869a..9ff76261 100644 --- a/internal/lexer/gen/golang/gen.go +++ b/internal/lexer/gen/golang/gen.go @@ -20,8 +20,8 @@ import ( "github.com/maxcalandrelli/gocc/internal/token" ) -func Gen(pkg, outDir string, header string, itemsets *items.ItemSets, tokMap *token.TokenMap, cfg config.Config, subpath string) { - genLexer(pkg, outDir, itemsets, cfg, subpath) - genTransitionTable(pkg, outDir, header, itemsets, subpath) - genActionTable(pkg, outDir, itemsets, tokMap, subpath) +func Gen(pkg, outDir string, header string, itemsets *items.ItemSets, tokMap *token.TokenMap, cfg config.Config, internal, iface string) { + genLexer(pkg, outDir, itemsets, cfg, internal, iface) + genTransitionTable(pkg, outDir, header, itemsets, internal) + genActionTable(pkg, outDir, itemsets, tokMap, internal) } diff --git a/internal/lexer/gen/golang/lexer.go b/internal/lexer/gen/golang/lexer.go index db6236ed..fbe5d50c 100644 --- a/internal/lexer/gen/golang/lexer.go +++ b/internal/lexer/gen/golang/lexer.go @@ -24,39 +24,41 @@ import ( "github.com/maxcalandrelli/gocc/internal/lexer/items" ) -func genLexer(pkg, outDir string, itemsets *items.ItemSets, cfg config.Config, subpath string) { +func genLexer(pkg, outDir string, itemsets *items.ItemSets, cfg config.Config, internal, iface string) { tmpl, err := template.New("lexer").Parse(lexerSrc[1:]) if err != nil { panic(err) } buf := new(bytes.Buffer) - err = tmpl.Execute(buf, getLexerData(pkg, outDir, itemsets, cfg, subpath)) + err = tmpl.Execute(buf, getLexerData(pkg, outDir, itemsets, cfg, internal, iface)) if err != nil { panic(err) } - io.WriteFile(path.Join(outDir, subpath, "lexer", "lexer.go"), buf.Bytes()) + io.WriteFile(path.Join(outDir, internal, "lexer", "lexer.go"), buf.Bytes()) } -func getLexerData(pkg, outDir string, itemsets *items.ItemSets, cfg config.Config, subpath string) *lexerData { +func getLexerData(pkg, outDir string, itemsets *items.ItemSets, cfg config.Config, internal, iface string) *lexerData { lexSymbols := itemsets.Symbols().List() return &lexerData{ - Debug: cfg.DebugLexer(), - PkgPath: pkg, - SubPath: subpath, - NumStates: itemsets.Size(), - NumSymbols: len(lexSymbols), - Symbols: lexSymbols, + Debug: cfg.DebugLexer(), + PkgPath: pkg, + InternalSubdir: internal, + IfaceSubdir: iface, + NumStates: itemsets.Size(), + NumSymbols: len(lexSymbols), + Symbols: lexSymbols, } } type lexerData struct { - Debug bool - PkgPath string - SubPath string - NumStates int - NumSymbols int - NextState []byte - Symbols []string + Debug bool + PkgPath string + InternalSubdir string + IfaceSubdir string + NumStates int + NumSymbols int + NextState []byte + Symbols []string } const lexerSrc string = ` @@ -70,10 +72,10 @@ import ( "bytes" "os" - {{if .Debug}} "{{.PkgPath}}/{{.SubPath}}/util" {{end}} - "{{.PkgPath}}/iface" - "{{.PkgPath}}/{{.SubPath}}/token" - "{{.PkgPath}}/{{.SubPath}}/io/stream" + {{if .Debug}} "{{.PkgPath}}/{{.InternalSubdir}}/util" {{end}} + "{{.PkgPath}}/{{.IfaceSubdir}}" + "{{.PkgPath}}/{{.InternalSubdir}}/token" + "{{.PkgPath}}/{{.InternalSubdir}}/io/stream" ) const ( @@ -99,6 +101,10 @@ func NewLexerBytes(src []byte) *Lexer { return lexer } +func NewLexerString(src string) *Lexer { + return NewLexerBytes([]byte(src)) +} + func NewLexerFile(fpath string) (*Lexer, error) { s, err := os.Open(fpath) if err != nil { @@ -128,11 +134,18 @@ func (l Lexer) GetStream() iface.TokenStream { type checkPoint int64 +func (c checkPoint) value () int64 { + return int64(c) +} + func (c checkPoint) DistanceFrom (o iface.CheckPoint) int { - return int (c - o.(checkPoint)) + return int (c.value() - o.(checkPoint).value()) } -func (l Lexer) GetCheckPoint() iface.CheckPoint { +func (l *Lexer) GetCheckPoint() iface.CheckPoint { + if l == nil { + return checkPoint(0) + } pos, _ := l.stream.Seek(0, io.SeekCurrent) return checkPoint(pos) } @@ -177,17 +190,17 @@ func (l *Lexer) Scan() (tok *token.Token) { {{- end}} state = nextState if state != -1 { - switch curr { - case '\n': - l.position.Pos.Line++ - l.position.Pos.Column = 1 - case '\r': - l.position.Pos.Column = 1 - case '\t': - l.position.Pos.Column += 4 - default: - l.position.Pos.Column++ - } + switch curr { + case '\n': + l.position.Pos.Line++ + l.position.Pos.Column = 1 + case '\r': + l.position.Pos.Column = 1 + case '\t': + l.position.Pos.Column += 4 + default: + l.position.Pos.Column++ + } switch { case ActTab[state].Accept != -1: tok.Type = ActTab[state].Accept @@ -197,8 +210,12 @@ func (l *Lexer) Scan() (tok *token.Token) { state = 0 tok.Lit = []byte{} } - } else if curr != INVALID_RUNE { - l.stream.UnreadRune() + } else if curr != INVALID_RUNE{ + if len(tok.Lit) == 0 { + tok.Lit = append(tok.Lit, string(curr)...) + } else { + l.stream.UnreadRune() + } } if err == io.EOF && len(tok.Lit)==0 { tok.Type = token.EOF diff --git a/internal/parser/gen/gen.go b/internal/parser/gen/gen.go index aec0822b..f1497d9c 100644 --- a/internal/parser/gen/gen.go +++ b/internal/parser/gen/gen.go @@ -27,13 +27,13 @@ import ( ) func Gen(pkg, outDir, header string, prods ast.SyntaxProdList, symbols *symbols.Symbols, - itemsets *items.ItemSets, tokMap *token.TokenMap, cfg config.Config, subpath string) (conflicts map[int]items.RowConflicts) { + itemsets *items.ItemSets, tokMap *token.TokenMap, cfg config.Config, internal, iface string) (conflicts map[int]items.RowConflicts) { - golang.GenAction(outDir, subpath) - conflicts = golang.GenActionTable(outDir, prods, itemsets, tokMap, subpath, header) - golang.GenErrors(pkg, outDir, subpath) - golang.GenGotoTable(outDir, itemsets, symbols, subpath) - golang.GenParser(pkg, outDir, prods, itemsets, symbols, cfg, subpath) - golang.GenProductionsTable(pkg, outDir, header, prods, symbols, itemsets, tokMap, subpath, cfg) + golang.GenAction(outDir, internal) + conflicts = golang.GenActionTable(outDir, prods, itemsets, tokMap, internal, header) + golang.GenErrors(pkg, outDir, internal) + golang.GenGotoTable(outDir, itemsets, symbols, internal) + golang.GenParser(pkg, outDir, prods, itemsets, symbols, cfg, internal, iface) + golang.GenProductionsTable(pkg, outDir, header, prods, symbols, itemsets, tokMap, internal, cfg) return } diff --git a/internal/parser/gen/golang/parser.go b/internal/parser/gen/golang/parser.go index 380889ac..630a4c44 100644 --- a/internal/parser/gen/golang/parser.go +++ b/internal/parser/gen/golang/parser.go @@ -28,43 +28,47 @@ import ( "github.com/maxcalandrelli/gocc/internal/parser/symbols" ) -func GenParser(pkg, outDir string, prods ast.SyntaxProdList, itemSets *items.ItemSets, symbols *symbols.Symbols, cfg config.Config, subpath string) { +func GenParser(pkg, outDir string, prods ast.SyntaxProdList, itemSets *items.ItemSets, symbols *symbols.Symbols, cfg config.Config, internal, iface string) { tmpl, err := template.New("parser").Parse(parserSrc[1:]) if err != nil { panic(err) } wr := new(bytes.Buffer) - if err := tmpl.Execute(wr, getParserData(pkg, subpath, prods, itemSets, symbols, cfg)); err != nil { + if err := tmpl.Execute(wr, getParserData(pkg, internal, iface, prods, itemSets, symbols, cfg)); err != nil { panic(err) } source, err := format.Source(wr.Bytes()) if err != nil { panic(fmt.Sprintf("%s in\n%s", err.Error(), wr.String())) } - io.WriteFile(path.Join(outDir, subpath, "parser", "parser.go"), source) + io.WriteFile(path.Join(outDir, internal, "parser", "parser.go"), source) } type parserData struct { Debug bool PkgPath string - SubPath string + InternalSubdir string + IfaceSubdir string Config config.Config NumProductions int NumStates int NumSymbols int CdTokList ast.SyntaxSymbols + ErrorTokenName string } -func getParserData(pkg, subpath string, prods ast.SyntaxProdList, itemSets *items.ItemSets, symbols *symbols.Symbols, cfg config.Config) *parserData { +func getParserData(pkg, internal, iface string, prods ast.SyntaxProdList, itemSets *items.ItemSets, symbols *symbols.Symbols, cfg config.Config) *parserData { return &parserData{ Debug: cfg.DebugParser(), PkgPath: pkg, - SubPath: subpath, + InternalSubdir: internal, + IfaceSubdir: iface, Config: cfg, NumProductions: len(prods), NumStates: itemSets.Size(), NumSymbols: symbols.NumSymbols(), CdTokList: symbols.ListContextDependentTokenSymbols(), + ErrorTokenName: config.INTERNAL_SYMBOL_ERROR, } } @@ -78,9 +82,9 @@ import ( "strings" "errors" - parseError "{{.PkgPath}}/{{.SubPath}}/errors" - "{{.PkgPath}}/{{.SubPath}}/token" - "{{.PkgPath}}/iface" + parseError "{{.PkgPath}}/{{.InternalSubdir}}/errors" + "{{.PkgPath}}/{{.InternalSubdir}}/token" + "{{.PkgPath}}/{{.IfaceSubdir}}" ) const ( @@ -166,7 +170,21 @@ type Parser struct { userContext interface{} } -type TokenStream = iface.TokenStream +type ( + TokenStream = iface.TokenStream + fakeCp struct{} + fakeCheckPointable struct{} +) + +func (f fakeCheckPointable) GetCheckPoint() iface.CheckPoint { + return fakeCp{} +} + +func (f fakeCheckPointable) GotoCheckPoint(iface.CheckPoint) {} + +func (f fakeCp) DistanceFrom(o iface.CheckPoint) int { + return 0 +} {{- range $c := .CdTokList }} {{ printf "func cdFunc_%s (Stream TokenStream, Context interface{}) (interface{}, error, []byte) {return %s}" $c.SymbolString $c.ContexDependentParseFunctionCall }} @@ -188,6 +206,15 @@ func (p *Parser) Reset() { p.stack.push(0, nil) } +func (p *Parser) SetContext (ctx interface{}) *Parser { + p.userContext = ctx + return p +} + +func (p Parser) GetContext () interface{} { + return p.userContext +} + func (p *Parser) Error(err error, scanner iface.Scanner) (recovered bool, errorAttrib *parseError.Error) { errorAttrib = &parseError.Error{ Err: err, @@ -201,7 +228,7 @@ func (p *Parser) Error(err error, scanner iface.Scanner) (recovered bool, errorA } } - if action := parserActions.table[p.stack.top()].actions[token.TokMap.Type("error")]; action != nil { + if action := parserActions.table[p.stack.top()].actions[token.TokMap.Type("{{.ErrorTokenName}}")]; action != nil { p.stack.push(int(action.(shift)), errorAttrib) // action can only be shift } else { return @@ -279,27 +306,37 @@ func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, er if tokens == nil && (len(parserActions.table[p.stack.top()].cdActions) > 0 || longest) { return errNotRepositionable } + {{- if eq (len .CdTokList) 0 }} + if longest { + checkPoint = tokens.GetCheckPoint() + } + {{- else }} checkPoint = tokens.GetCheckPoint() - p.nextToken = scanner.Scan() + {{- end }} + p.nextToken = scanner.Scan() if longest { afterPos = tokens.GetCheckPoint() } return nil } p.Reset() - tokens, _ = scanner.(iface.CheckPointable) + if tokens, _ = scanner.(iface.CheckPointable) ; tokens == nil { + tokens = fakeCheckPointable{} + } + underlyingStream := TokenStream(nil) + if streamScanner, _ := scanner.(iface.StreamScanner) ; streamScanner != nil { + underlyingStream = streamScanner.GetStream() + } startCp := tokens.GetCheckPoint() if err := readNextToken(); err != nil { return nil, err, tokens.GetCheckPoint().DistanceFrom(startCp) } for acc := false; !acc; { action := parserActions.table[p.stack.top()].actions[p.nextToken.Type] - if action == nil { + if action == nil && underlyingStream != nil && len(parserActions.table[p.stack.top()].cdActions) > 0 { // // If no action, check if we have some context dependent parsing to try // - if streamScanner, _ := scanner.(iface.StreamScanner) ; streamScanner != nil { - underlyingStream := streamScanner.GetStream() for _, cdAction := range parserActions.table[p.stack.top()].cdActions { tokens.GotoCheckPoint (checkPoint) cd_res, cd_err, cd_parsed := cdAction.tokenScanner(underlyingStream, p.userContext) @@ -308,13 +345,12 @@ func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, er if action != nil { p.nextToken.Foreign = true p.nextToken.ForeignAstNode = cd_res - p.nextToken.Lit = cd_parsed + p.nextToken.Lit = cd_parsed p.nextToken.Type = token.Type(cdAction.tokenIndex) break } } } - } } // // Still no action? If a longest possible parsing is requested in place @@ -330,9 +366,9 @@ func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, er // // ok, let's consume the token then // - {{- if .Debug }} - fmt.Printf("S%d unrecognized=<%#v> restoring checkpoint at %#v => %s\n", p.stack.top(), p.nextToken, afterPos, action) - {{- end }} + {{- if .Debug }} + fmt.Printf("S%d unrecognized=<%#v> restoring checkpoint at %#v => %s\n", p.stack.top(), p.nextToken, afterPos, action) + {{- end }} tokens.GotoCheckPoint(afterPos) } } diff --git a/internal/token/gen/gen.go b/internal/token/gen/gen.go index 686577d4..3234db00 100644 --- a/internal/token/gen/gen.go +++ b/internal/token/gen/gen.go @@ -15,10 +15,11 @@ package gen import ( + "github.com/maxcalandrelli/gocc/internal/config" "github.com/maxcalandrelli/gocc/internal/token" "github.com/maxcalandrelli/gocc/internal/token/gen/golang" ) -func Gen(pkg, outdir string, tokenMap *token.TokenMap, subpath string) { - golang.GenToken(pkg, outdir, tokenMap, subpath) +func Gen(pkg, outdir string, tokenMap *token.TokenMap, subpath string, cfg config.Config) { + golang.GenToken(pkg, outdir, tokenMap, subpath, cfg) } diff --git a/internal/token/gen/golang/token.go b/internal/token/gen/golang/token.go index 6e339997..ed0c254e 100644 --- a/internal/token/gen/golang/token.go +++ b/internal/token/gen/golang/token.go @@ -21,18 +21,19 @@ import ( "path" "text/template" + "github.com/maxcalandrelli/gocc/internal/config" "github.com/maxcalandrelli/gocc/internal/io" "github.com/maxcalandrelli/gocc/internal/token" ) -func GenToken(pkg, outdir string, tokMap *token.TokenMap, subpath string) { +func GenToken(pkg, outdir string, tokMap *token.TokenMap, subpath string, cfg config.Config) { tokenPath := path.Join(outdir, subpath, "token", "token.go") tmpl, err := template.New("token").Parse(TokenMapSrc[1:]) if err != nil { panic(err) } buf := new(bytes.Buffer) - err = tmpl.Execute(buf, TokenData{TypMap: makeTypeMap(tokMap), IdMap: makeIdMap(tokMap)}) + err = tmpl.Execute(buf, TokenData{TypMap: makeTypeMap(tokMap), IdMap: makeIdMap(tokMap), LitMap: makeLitMap(tokMap), NoLexer: cfg.NoLexer()}) // Use go/format to indent the idMap literal correctly. source, err := format.Source(buf.Bytes()) if err != nil { @@ -57,9 +58,19 @@ func makeTypeMap(tokMap *token.TokenMap) []string { return tm } +func makeLitMap(tokMap *token.TokenMap) []string { + tm := []string{} + for lit, i := range tokMap.LitMap { + tm = append(tm, fmt.Sprintf("\"%s\": %d", lit, i)) + } + return tm +} + type TokenData struct { - IdMap []string - TypMap []string + IdMap []string + TypMap []string + LitMap []string + NoLexer bool } const TokenMapSrc string = ` @@ -113,6 +124,7 @@ func (p Pos) StartingFrom(base Pos) Pos { type TokenMap struct { typeMap []string idMap map[string]Type + litMap map[string]Type } func (m TokenMap) Id(tok Type) string { @@ -126,6 +138,11 @@ func (m TokenMap) Type(tok string) Type { if typ, exist := m.idMap[tok]; exist { return typ } + {{- if .NoLexer }} + if typ, exist := m.litMap[tok]; exist { + return typ + } + {{- end }} return INVALID } @@ -150,5 +167,12 @@ var TokMap = TokenMap{ {{- end }} }, + + litMap: map[string]Type{ +{{- range .LitMap }} + {{printf "%s" .}}, +{{- end }} + + }, } ` diff --git a/internal/token/tokenmap.go b/internal/token/tokenmap.go index a6023900..0135fcb4 100644 --- a/internal/token/tokenmap.go +++ b/internal/token/tokenmap.go @@ -21,17 +21,23 @@ import ( type TokenMap struct { IdMap map[string]int TypeMap []ast.SyntaxSymbol + LitMap map[string]int } func NewTokenMap(symbols ast.SyntaxSymbols) *TokenMap { tm := &TokenMap{ IdMap: make(map[string]int), TypeMap: make([]ast.SyntaxSymbol, len(symbols)), + LitMap: make(map[string]int), } for i, sym := range symbols { tm.IdMap[sym.SymbolName()] = i tm.TypeMap[i] = sym + switch lit := sym.(type) { + case ast.SyntaxStringLit: + tm.LitMap[lit.SymbolString()] = i + } } return tm } diff --git a/internal/util/litconv.go b/internal/util/litconv.go index f75234d6..a278f84a 100644 --- a/internal/util/litconv.go +++ b/internal/util/litconv.go @@ -29,7 +29,7 @@ func LitToRune(lit []byte) rune { } r, size := utf8.DecodeRune(lit[1:]) if size != len(lit)-2 { - panic(fmt.Sprintf("Error decoding rune. Lit: %s, rune: %d, size%d\n", lit, r, size)) + panic(fmt.Sprintf("Error decoding rune. Lit: %s, rune: %d, size %d\n", lit, r, size)) } return r } diff --git a/main.go b/main.go index d5599dd9..5a0b369d 100644 --- a/main.go +++ b/main.go @@ -82,11 +82,12 @@ func main() { } if cfg.Verbose() { + fmt.Fprintf(os.Stderr, "gocc version %s\n", config.VERSION) cfg.PrintParams() } if cfg.Help() { - fmt.Fprintf(os.Stderr, "gocc version 1.1.0011\n") + fmt.Fprintf(os.Stderr, "gocc version %s\n", config.VERSION) flag.Usage() } @@ -103,8 +104,8 @@ func main() { } outdir_base := cfg.OutDir() - subpath := "internal" outdir_log := path.Join(outdir_base, "log") + outdir_iface := path.Join("iface") g := grammar.(*ast.Grammar) gSymbols := symbols.NewSymbols(g) @@ -123,10 +124,10 @@ func main() { } tokenMap = outToken.NewTokenMap(gSymbols.ListTerminals()) if !cfg.NoLexer() { - genLexer.Gen(cfg.Package(), outdir_base, g.LexPart.Header.SDTLit, lexSets, tokenMap, cfg, subpath) + genLexer.Gen(cfg.Package(), outdir_base, g.LexPart.Header.SDTLit, lexSets, tokenMap, cfg, cfg.InternalSubdir(), outdir_iface) } - - if g.SyntaxPart != nil { + hasSyntax := (g.SyntaxPart != nil) + if hasSyntax { firstSets := first.GetFirstSets(g, gSymbols) if cfg.Verbose() { io.WriteFileString(path.Join(outdir_log, "first.txt"), firstSets.String()) @@ -137,14 +138,14 @@ func main() { io.WriteFileString(path.Join(outdir_log, "LR1_sets.txt"), lr1Sets.String()) } - conflicts := genParser.Gen(cfg.Package(), outdir_base, g.SyntaxPart.Header.SDTLit, g.SyntaxPart.ProdList, gSymbols, lr1Sets, tokenMap, cfg, subpath) + conflicts := genParser.Gen(cfg.Package(), outdir_base, g.SyntaxPart.Header.SDTLit, g.SyntaxPart.ProdList, gSymbols, lr1Sets, tokenMap, cfg, cfg.InternalSubdir(), outdir_iface) handleConflicts(conflicts, lr1Sets.Size(), cfg, g.SyntaxPart.ProdList, outdir_log) } - genToken.Gen(cfg.Package(), outdir_base, tokenMap, subpath) - genUtil.Gen(outdir_base, subpath) - genBase.Gen(cfg.Package(), outdir_base, subpath, cfg) - genIo.Gen(cfg.Package(), outdir_base, subpath) + genToken.Gen(cfg.Package(), outdir_base, tokenMap, cfg.InternalSubdir(), cfg) + genUtil.Gen(outdir_base, cfg.InternalSubdir()) + genBase.Gen(cfg.Package(), outdir_base, cfg.InternalSubdir(), outdir_iface, cfg, hasSyntax) + genIo.Gen(cfg.Package(), outdir_base, cfg.InternalSubdir()) } func usage() { diff --git a/stock/main.go b/stock/main.go index 56405c80..7443f47c 100644 --- a/stock/main.go +++ b/stock/main.go @@ -55,11 +55,12 @@ func main() { } if cfg.Verbose() { + fmt.Fprintf(os.Stderr, "gocc (stock) version %s\n", config.VERSION) cfg.PrintParams() } if cfg.Help() { - fmt.Fprintf(os.Stderr, "gocc base version\n") + fmt.Fprintf(os.Stderr, "gocc (stock) version %s\n", config.VERSION) flag.Usage() } @@ -85,8 +86,8 @@ func main() { } outdir_base := cfg.OutDir() - subpath := "internal" outdir_log := path.Join(outdir_base, "log") + outdir_iface := path.Join("iface") g := grammar.(*ast.Grammar) gSymbols := symbols.NewSymbols(g) @@ -102,10 +103,11 @@ func main() { } tokenMap := outToken.NewTokenMap(gSymbols.ListTerminals()) if !cfg.NoLexer() { - genLexer.Gen(cfg.Package(), outdir_base, g.LexPart.Header.SDTLit, lexSets, tokenMap, cfg, subpath) + genLexer.Gen(cfg.Package(), outdir_base, g.LexPart.Header.SDTLit, lexSets, tokenMap, cfg, cfg.InternalSubdir(), outdir_iface) } - if g.SyntaxPart != nil { + hasSyntax := (g.SyntaxPart != nil) + if hasSyntax { firstSets := first.GetFirstSets(g, gSymbols) if cfg.Verbose() { io.WriteFileString(path.Join(outdir_log, "first.txt"), firstSets.String()) @@ -116,14 +118,14 @@ func main() { io.WriteFileString(path.Join(outdir_log, "LR1_sets.txt"), lr1Sets.String()) } - conflicts := genParser.Gen(cfg.Package(), outdir_base, g.SyntaxPart.Header.SDTLit, g.SyntaxPart.ProdList, gSymbols, lr1Sets, tokenMap, cfg, subpath) + conflicts := genParser.Gen(cfg.Package(), outdir_base, g.SyntaxPart.Header.SDTLit, g.SyntaxPart.ProdList, gSymbols, lr1Sets, tokenMap, cfg, cfg.InternalSubdir(), outdir_iface) handleConflicts(conflicts, lr1Sets.Size(), cfg, g.SyntaxPart.ProdList, outdir_log) } - genToken.Gen(cfg.Package(), outdir_base, tokenMap, subpath) - genUtil.Gen(outdir_base, subpath) - genBase.Gen(cfg.Package(), outdir_base, subpath, cfg) - genIo.Gen(cfg.Package(), outdir_base, subpath) + genToken.Gen(cfg.Package(), outdir_base, tokenMap, cfg.InternalSubdir(), cfg) + genUtil.Gen(outdir_base, cfg.InternalSubdir()) + genBase.Gen(cfg.Package(), outdir_base, cfg.InternalSubdir(), outdir_iface, cfg, hasSyntax) + genIo.Gen(cfg.Package(), outdir_base, cfg.InternalSubdir()) } func usage() { From d6d0437984814ec01e029ff25c817b9fb8b1aa6d Mon Sep 17 00:00:00 2001 From: Massimiliano Calandrelli Date: Sat, 12 Oct 2019 19:47:49 +0200 Subject: [PATCH 19/33] ... --- example/astx/ast.grammar/ast/grammar.go | 8 +- .../ast/internal/parser/actiontable.go | 2 +- .../ast.grammar/ast/internal/parser/parser.go | 4 +- example/bools/bools.grammar/bools/grammar.go | 8 +- .../bools/internal/parser/actiontable.go | 2 +- .../bools/internal/parser/parser.go | 4 +- .../bools/internal/token/token.go | 10 +- example/calc/calc.grammar/calc/grammar.go | 8 +- .../calc/internal/parser/actiontable.go | 2 +- .../calc/internal/parser/parser.go | 4 +- example/ctx/ast/ast.go | 12 +- example/ctx/ctx.bnf | 4 +- example/ctx/ctx.grammar/ctx/grammar.go | 8 +- .../ctx/internal/parser/actiontable.go | 31 +- .../ctx/internal/parser/gototable.go | 5 + .../ctx.grammar/ctx/internal/parser/parser.go | 18 +- .../ctx/internal/parser/productionstable.go | 6 +- .../ctx.grammar/ctx/internal/token/token.go | 10 +- example/ctx/ctx_test.go | 13 +- .../errorrecovery/er.grammar/er/grammar.go | 8 +- .../er/internal/parser/actiontable.go | 14 +- .../er.grammar/er/internal/parser/parser.go | 4 +- .../nolexer/internal/parser/actiontable.go | 2 +- .../nolexer/internal/parser/parser.go | 4 +- example/rr/rr.grammar/rr/grammar.go | 8 +- .../rr/internal/parser/actiontable.go | 2 +- .../rr.grammar/rr/internal/parser/parser.go | 4 +- example/sr/sr.grammar/sr/grammar.go | 8 +- .../sr/internal/parser/actiontable.go | 2 +- .../sr.grammar/sr/internal/parser/parser.go | 4 +- internal/ast/grammar.go | 2 +- internal/ast/reconcile.go | 11 + internal/ast/syntaxsubparser.go | 68 ++ internal/ast/syntaxsymbol.go | 1 + internal/base/gen/golang/base.go | 8 +- internal/config/config.go | 6 +- internal/frontend/reparsed/grammar.go | 8 +- .../reparsed/internal/lexer/acttab.go | 12 +- .../frontend/reparsed/internal/lexer/lexer.go | 2 +- .../reparsed/internal/parser/actiontable.go | 986 +++++++++++------- .../reparsed/internal/parser/gototable.go | 258 +++-- .../reparsed/internal/parser/parser.go | 10 +- .../internal/parser/productionstable.go | 28 +- .../frontend/reparsed/internal/token/token.go | 33 +- internal/frontend/reparsed/log/LR1_sets.txt | 950 ++++++++++------- internal/frontend/reparsed/log/first.txt | 4 + internal/frontend/reparsed/log/lexer_sets.txt | 4 +- internal/frontend/reparsed/log/terminals.txt | 1 + internal/parser/gen/golang/actiontable.go | 4 +- internal/parser/gen/golang/parser.go | 42 +- .../parser/gen/golang/productionstable.go | 3 +- internal/parser/symbols/symbols.go | 17 +- spec/gocc2.ebnf | 9 + spec/test.bnf | 18 +- 54 files changed, 1724 insertions(+), 980 deletions(-) create mode 100644 internal/ast/syntaxsubparser.go diff --git a/example/astx/ast.grammar/ast/grammar.go b/example/astx/ast.grammar/ast/grammar.go index 4bea5881..a7cba87e 100644 --- a/example/astx/ast.grammar/ast/grammar.go +++ b/example/astx/ast.grammar/ast/grammar.go @@ -38,7 +38,7 @@ func ParseFile(fpath string) (interface{}, error, int) { } } -func ParseText(text string, userData interface{}) (interface{}, error, int) { +func ParseText(text string) (interface{}, error, int) { return NewParser().Parse(NewLexerBytes([]byte(text))) } @@ -58,7 +58,7 @@ func ParseFileWithData(fpath string, userData interface{}) (interface{}, error, } } -func ParseStringWithData(text string, userData interface{}) (interface{}, error, int) { +func ParseTextWithData(text string, userData interface{}) (interface{}, error, int) { return NewParser().SetContext(userData).Parse(NewLexerBytes([]byte(text))) } @@ -78,7 +78,7 @@ func ParseFilePartial(fpath string) (interface{}, error, int) { } } -func ParseTextPartial(text string, userData interface{}) (interface{}, error, int) { +func ParseTextPartial(text string) (interface{}, error, int) { return NewParser().ParseLongestPrefix(NewLexerBytes([]byte(text))) } @@ -98,7 +98,7 @@ func ParseFileWithDataPartial(fpath string, userData interface{}) (interface{}, } } -func ParseStringWithDataPartial(text string, userData interface{}) (interface{}, error, int) { +func ParseTextWithDataPartial(text string, userData interface{}) (interface{}, error, int) { return NewParser().SetContext(userData).ParseLongestPrefix(NewLexerBytes([]byte(text))) } diff --git a/example/astx/ast.grammar/ast/internal/parser/actiontable.go b/example/astx/ast.grammar/ast/internal/parser/actiontable.go index 9c8071d3..ab559b37 100644 --- a/example/astx/ast.grammar/ast/internal/parser/actiontable.go +++ b/example/astx/ast.grammar/ast/internal/parser/actiontable.go @@ -4,7 +4,7 @@ package parser type ( actionTable [numStates]actionRow - cdFunc func(TokenStream, interface{}) (interface{}, error, []byte) + cdFunc func(TokenStream, interface{}) (interface{}, error, int) cdAction struct { tokenIndex int tokenScanner cdFunc diff --git a/example/astx/ast.grammar/ast/internal/parser/parser.go b/example/astx/ast.grammar/ast/internal/parser/parser.go index 964e4061..023d6593 100644 --- a/example/astx/ast.grammar/ast/internal/parser/parser.go +++ b/example/astx/ast.grammar/ast/internal/parser/parser.go @@ -255,12 +255,12 @@ func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, er for _, cdAction := range parserActions.table[p.stack.top()].cdActions { tokens.GotoCheckPoint(checkPoint) cd_res, cd_err, cd_parsed := cdAction.tokenScanner(underlyingStream, p.userContext) - if cd_err == nil && len(cd_parsed) > 0 { + if cd_err == nil && cd_parsed > 0 { action = parserActions.table[p.stack.top()].actions[cdAction.tokenIndex] if action != nil { p.nextToken.Foreign = true p.nextToken.ForeignAstNode = cd_res - p.nextToken.Lit = cd_parsed + p.nextToken.Lit = []byte{} p.nextToken.Type = token.Type(cdAction.tokenIndex) break } diff --git a/example/bools/bools.grammar/bools/grammar.go b/example/bools/bools.grammar/bools/grammar.go index 6ff0816f..835045ed 100644 --- a/example/bools/bools.grammar/bools/grammar.go +++ b/example/bools/bools.grammar/bools/grammar.go @@ -38,7 +38,7 @@ func ParseFile(fpath string) (interface{}, error, int) { } } -func ParseText(text string, userData interface{}) (interface{}, error, int) { +func ParseText(text string) (interface{}, error, int) { return NewParser().Parse(NewLexerBytes([]byte(text))) } @@ -58,7 +58,7 @@ func ParseFileWithData(fpath string, userData interface{}) (interface{}, error, } } -func ParseStringWithData(text string, userData interface{}) (interface{}, error, int) { +func ParseTextWithData(text string, userData interface{}) (interface{}, error, int) { return NewParser().SetContext(userData).Parse(NewLexerBytes([]byte(text))) } @@ -78,7 +78,7 @@ func ParseFilePartial(fpath string) (interface{}, error, int) { } } -func ParseTextPartial(text string, userData interface{}) (interface{}, error, int) { +func ParseTextPartial(text string) (interface{}, error, int) { return NewParser().ParseLongestPrefix(NewLexerBytes([]byte(text))) } @@ -98,7 +98,7 @@ func ParseFileWithDataPartial(fpath string, userData interface{}) (interface{}, } } -func ParseStringWithDataPartial(text string, userData interface{}) (interface{}, error, int) { +func ParseTextWithDataPartial(text string, userData interface{}) (interface{}, error, int) { return NewParser().SetContext(userData).ParseLongestPrefix(NewLexerBytes([]byte(text))) } diff --git a/example/bools/bools.grammar/bools/internal/parser/actiontable.go b/example/bools/bools.grammar/bools/internal/parser/actiontable.go index 2e06d3a0..0fb32df6 100644 --- a/example/bools/bools.grammar/bools/internal/parser/actiontable.go +++ b/example/bools/bools.grammar/bools/internal/parser/actiontable.go @@ -4,7 +4,7 @@ package parser type ( actionTable [numStates]actionRow - cdFunc func(TokenStream, interface{}) (interface{}, error, []byte) + cdFunc func(TokenStream, interface{}) (interface{}, error, int) cdAction struct { tokenIndex int tokenScanner cdFunc diff --git a/example/bools/bools.grammar/bools/internal/parser/parser.go b/example/bools/bools.grammar/bools/internal/parser/parser.go index 035102b0..ea029330 100644 --- a/example/bools/bools.grammar/bools/internal/parser/parser.go +++ b/example/bools/bools.grammar/bools/internal/parser/parser.go @@ -255,12 +255,12 @@ func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, er for _, cdAction := range parserActions.table[p.stack.top()].cdActions { tokens.GotoCheckPoint(checkPoint) cd_res, cd_err, cd_parsed := cdAction.tokenScanner(underlyingStream, p.userContext) - if cd_err == nil && len(cd_parsed) > 0 { + if cd_err == nil && cd_parsed > 0 { action = parserActions.table[p.stack.top()].actions[cdAction.tokenIndex] if action != nil { p.nextToken.Foreign = true p.nextToken.ForeignAstNode = cd_res - p.nextToken.Lit = cd_parsed + p.nextToken.Lit = []byte{} p.nextToken.Type = token.Type(cdAction.tokenIndex) break } diff --git a/example/bools/bools.grammar/bools/internal/token/token.go b/example/bools/bools.grammar/bools/internal/token/token.go index 5b07ee14..9b421b64 100644 --- a/example/bools/bools.grammar/bools/internal/token/token.go +++ b/example/bools/bools.grammar/bools/internal/token/token.go @@ -107,14 +107,14 @@ var TokMap = TokenMap{ }, litMap: map[string]Type{ - ")": 5, + "|": 3, + "(": 4, "false": 7, - "in": 12, - "true": 6, "<": 9, ">": 10, + "in": 12, "&": 2, - "|": 3, - "(": 4, + ")": 5, + "true": 6, }, } diff --git a/example/calc/calc.grammar/calc/grammar.go b/example/calc/calc.grammar/calc/grammar.go index d812f339..825170e1 100644 --- a/example/calc/calc.grammar/calc/grammar.go +++ b/example/calc/calc.grammar/calc/grammar.go @@ -38,7 +38,7 @@ func ParseFile(fpath string) (interface{}, error, int) { } } -func ParseText(text string, userData interface{}) (interface{}, error, int) { +func ParseText(text string) (interface{}, error, int) { return NewParser().Parse(NewLexerBytes([]byte(text))) } @@ -58,7 +58,7 @@ func ParseFileWithData(fpath string, userData interface{}) (interface{}, error, } } -func ParseStringWithData(text string, userData interface{}) (interface{}, error, int) { +func ParseTextWithData(text string, userData interface{}) (interface{}, error, int) { return NewParser().SetContext(userData).Parse(NewLexerBytes([]byte(text))) } @@ -78,7 +78,7 @@ func ParseFilePartial(fpath string) (interface{}, error, int) { } } -func ParseTextPartial(text string, userData interface{}) (interface{}, error, int) { +func ParseTextPartial(text string) (interface{}, error, int) { return NewParser().ParseLongestPrefix(NewLexerBytes([]byte(text))) } @@ -98,7 +98,7 @@ func ParseFileWithDataPartial(fpath string, userData interface{}) (interface{}, } } -func ParseStringWithDataPartial(text string, userData interface{}) (interface{}, error, int) { +func ParseTextWithDataPartial(text string, userData interface{}) (interface{}, error, int) { return NewParser().SetContext(userData).ParseLongestPrefix(NewLexerBytes([]byte(text))) } diff --git a/example/calc/calc.grammar/calc/internal/parser/actiontable.go b/example/calc/calc.grammar/calc/internal/parser/actiontable.go index 6c234a0c..a135aecf 100644 --- a/example/calc/calc.grammar/calc/internal/parser/actiontable.go +++ b/example/calc/calc.grammar/calc/internal/parser/actiontable.go @@ -4,7 +4,7 @@ package parser type ( actionTable [numStates]actionRow - cdFunc func(TokenStream, interface{}) (interface{}, error, []byte) + cdFunc func(TokenStream, interface{}) (interface{}, error, int) cdAction struct { tokenIndex int tokenScanner cdFunc diff --git a/example/calc/calc.grammar/calc/internal/parser/parser.go b/example/calc/calc.grammar/calc/internal/parser/parser.go index 33441494..a3b61d8b 100644 --- a/example/calc/calc.grammar/calc/internal/parser/parser.go +++ b/example/calc/calc.grammar/calc/internal/parser/parser.go @@ -255,12 +255,12 @@ func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, er for _, cdAction := range parserActions.table[p.stack.top()].cdActions { tokens.GotoCheckPoint(checkPoint) cd_res, cd_err, cd_parsed := cdAction.tokenScanner(underlyingStream, p.userContext) - if cd_err == nil && len(cd_parsed) > 0 { + if cd_err == nil && cd_parsed > 0 { action = parserActions.table[p.stack.top()].actions[cdAction.tokenIndex] if action != nil { p.nextToken.Foreign = true p.nextToken.ForeignAstNode = cd_res - p.nextToken.Lit = cd_parsed + p.nextToken.Lit = []byte{} p.nextToken.Type = token.Type(cdAction.tokenIndex) break } diff --git a/example/ctx/ast/ast.go b/example/ctx/ast/ast.go index 1e7cffa0..c0799a8b 100644 --- a/example/ctx/ast/ast.go +++ b/example/ctx/ast/ast.go @@ -3,7 +3,7 @@ package ast import ( "fmt" - "github.com/maxcalandrelli/gocc/example/calc/calc.grammar/calc" + "github.com/maxcalandrelli/gocc/example/ctx/ctx.grammar/ctx/iface" ) type ( @@ -20,10 +20,12 @@ func AppendStmt(stmtList, stmt interface{}) (StmtList, error) { } func NewStmt(stmtList interface{}) (Stmt, error) { - return Stmt(stmtList.(*token.Token).Lit), nil + return Stmt(stmtList.(*iface.Token).Lit), nil } -func Calc(verb interface{}) (Stmt, error) { - calc_parser.NewParser().Parse(calc.NewLexerString()) - return fmt.Sprintf("%s ") +func CalcResult(result interface{}) (Stmt, error) { + res := result.(int64) + rstr := fmt.Sprintf("%d", res) + fmt.Printf("result: %s\n", rstr) + return Stmt(rstr), nil } diff --git a/example/ctx/ctx.bnf b/example/ctx/ctx.bnf index 29abacc5..517f6a81 100644 --- a/example/ctx/ctx.bnf +++ b/example/ctx/ctx.bnf @@ -15,7 +15,6 @@ id : (_letter | '_') {_idchar} ; << import ( "github.com/maxcalandrelli/gocc/example/ctx/ast" - "github.com/maxcalandrelli/gocc/example/ctx/ast" ) >> @@ -28,6 +27,7 @@ Stmt : id << ast.NewStmt($0) >> | "calc" - << ast.Calc($0) >> + @ "github.com/maxcalandrelli/gocc/example/calc/calc.grammar/calc" + << ast.CalcResult($2) >> ; diff --git a/example/ctx/ctx.grammar/ctx/grammar.go b/example/ctx/ctx.grammar/ctx/grammar.go index f546ea17..449f634a 100644 --- a/example/ctx/ctx.grammar/ctx/grammar.go +++ b/example/ctx/ctx.grammar/ctx/grammar.go @@ -38,7 +38,7 @@ func ParseFile(fpath string) (interface{}, error, int) { } } -func ParseText(text string, userData interface{}) (interface{}, error, int) { +func ParseText(text string) (interface{}, error, int) { return NewParser().Parse(NewLexerBytes([]byte(text))) } @@ -58,7 +58,7 @@ func ParseFileWithData(fpath string, userData interface{}) (interface{}, error, } } -func ParseStringWithData(text string, userData interface{}) (interface{}, error, int) { +func ParseTextWithData(text string, userData interface{}) (interface{}, error, int) { return NewParser().SetContext(userData).Parse(NewLexerBytes([]byte(text))) } @@ -78,7 +78,7 @@ func ParseFilePartial(fpath string) (interface{}, error, int) { } } -func ParseTextPartial(text string, userData interface{}) (interface{}, error, int) { +func ParseTextPartial(text string) (interface{}, error, int) { return NewParser().ParseLongestPrefix(NewLexerBytes([]byte(text))) } @@ -98,7 +98,7 @@ func ParseFileWithDataPartial(fpath string, userData interface{}) (interface{}, } } -func ParseStringWithDataPartial(text string, userData interface{}) (interface{}, error, int) { +func ParseTextWithDataPartial(text string, userData interface{}) (interface{}, error, int) { return NewParser().SetContext(userData).ParseLongestPrefix(NewLexerBytes([]byte(text))) } diff --git a/example/ctx/ctx.grammar/ctx/internal/parser/actiontable.go b/example/ctx/ctx.grammar/ctx/internal/parser/actiontable.go index 19187713..b70dc5d6 100644 --- a/example/ctx/ctx.grammar/ctx/internal/parser/actiontable.go +++ b/example/ctx/ctx.grammar/ctx/internal/parser/actiontable.go @@ -4,7 +4,7 @@ package parser type ( actionTable [numStates]actionRow - cdFunc func(TokenStream, interface{}) (interface{}, error, []byte) + cdFunc func(TokenStream, interface{}) (interface{}, error, int) cdAction struct { tokenIndex int tokenScanner cdFunc @@ -28,6 +28,7 @@ var parserActions = actions{ nil, // Ω shift(3), // id shift(4), // "calc" + nil, // μ }, cdActions: []cdAction{}, }, @@ -38,6 +39,7 @@ var parserActions = actions{ accept(true), // Ω shift(3), // id shift(4), // "calc" + nil, // μ }, cdActions: []cdAction{}, }, @@ -48,6 +50,7 @@ var parserActions = actions{ reduce(1), // Ω, reduce: StmtList reduce(1), // id, reduce: StmtList reduce(1), // "calc", reduce: StmtList + nil, // μ }, cdActions: []cdAction{}, }, @@ -58,18 +61,22 @@ var parserActions = actions{ reduce(3), // Ω, reduce: Stmt reduce(3), // id, reduce: Stmt reduce(3), // "calc", reduce: Stmt + nil, // μ }, cdActions: []cdAction{}, }, actionRow{ // S4 canRecover: false, actions: [numSymbols]action{ - nil, // ά - reduce(4), // Ω, reduce: Stmt - reduce(4), // id, reduce: Stmt - reduce(4), // "calc", reduce: Stmt + nil, // ά + nil, // Ω + nil, // id + nil, // "calc" + shift(6), // μ + }, + cdActions: []cdAction{ + cdAction{tokenIndex: 4, tokenScanner: cdFunc_calc_0}, }, - cdActions: []cdAction{}, }, actionRow{ // S5 canRecover: false, @@ -78,6 +85,18 @@ var parserActions = actions{ reduce(2), // Ω, reduce: StmtList reduce(2), // id, reduce: StmtList reduce(2), // "calc", reduce: StmtList + nil, // μ + }, + cdActions: []cdAction{}, + }, + actionRow{ // S6 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(4), // Ω, reduce: Stmt + reduce(4), // id, reduce: Stmt + reduce(4), // "calc", reduce: Stmt + nil, // μ }, cdActions: []cdAction{}, }, diff --git a/example/ctx/ctx.grammar/ctx/internal/parser/gototable.go b/example/ctx/ctx.grammar/ctx/internal/parser/gototable.go index 443ec029..4feafaba 100644 --- a/example/ctx/ctx.grammar/ctx/internal/parser/gototable.go +++ b/example/ctx/ctx.grammar/ctx/internal/parser/gototable.go @@ -40,4 +40,9 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, + gotoRow{ // S6 + -1, // Π + -1, // Π + -1, // Π + }, } diff --git a/example/ctx/ctx.grammar/ctx/internal/parser/parser.go b/example/ctx/ctx.grammar/ctx/internal/parser/parser.go index 33db025a..69c4c852 100644 --- a/example/ctx/ctx.grammar/ctx/internal/parser/parser.go +++ b/example/ctx/ctx.grammar/ctx/internal/parser/parser.go @@ -10,12 +10,14 @@ import ( "github.com/maxcalandrelli/gocc/example/ctx/ctx.grammar/ctx/iface" parseError "github.com/maxcalandrelli/gocc/example/ctx/ctx.grammar/ctx/internal/errors" "github.com/maxcalandrelli/gocc/example/ctx/ctx.grammar/ctx/internal/token" + + calc "github.com/maxcalandrelli/gocc/example/calc/calc.grammar/calc" ) const ( numProductions = 5 - numStates = 6 - numSymbols = 7 + numStates = 7 + numSymbols = 8 ) // Stack @@ -111,6 +113,10 @@ func (f fakeCp) DistanceFrom(o iface.CheckPoint) int { return 0 } +func cdFunc_calc_0(Stream TokenStream, Context interface{}) (interface{}, error, int) { + return calc.ParseWithDataPartial(Stream, Context) +} + func NewParser() *Parser { return NewParserWithContext(nil) } @@ -225,9 +231,7 @@ func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, er if tokens == nil && (len(parserActions.table[p.stack.top()].cdActions) > 0 || longest) { return errNotRepositionable } - if longest { - checkPoint = tokens.GetCheckPoint() - } + checkPoint = tokens.GetCheckPoint() p.nextToken = scanner.Scan() if longest { afterPos = tokens.GetCheckPoint() @@ -255,12 +259,12 @@ func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, er for _, cdAction := range parserActions.table[p.stack.top()].cdActions { tokens.GotoCheckPoint(checkPoint) cd_res, cd_err, cd_parsed := cdAction.tokenScanner(underlyingStream, p.userContext) - if cd_err == nil && len(cd_parsed) > 0 { + if cd_err == nil && cd_parsed > 0 { action = parserActions.table[p.stack.top()].actions[cdAction.tokenIndex] if action != nil { p.nextToken.Foreign = true p.nextToken.ForeignAstNode = cd_res - p.nextToken.Lit = cd_parsed + p.nextToken.Lit = []byte{} p.nextToken.Type = token.Type(cdAction.tokenIndex) break } diff --git a/example/ctx/ctx.grammar/ctx/internal/parser/productionstable.go b/example/ctx/ctx.grammar/ctx/internal/parser/productionstable.go index 6b7ed847..96879dc5 100644 --- a/example/ctx/ctx.grammar/ctx/internal/parser/productionstable.go +++ b/example/ctx/ctx.grammar/ctx/internal/parser/productionstable.go @@ -63,13 +63,13 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `Stmt : Λ << ast.Calc(X[0]) >>`, + String: `Stmt : Λ μ << ast.CalcResult(X[2]) >>`, Id: "Stmt", NTType: 2, Index: 4, - NumSymbols: 1, + NumSymbols: 3, ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { - return ast.Calc(X[0]) + return ast.CalcResult(X[2]) }, }, } diff --git a/example/ctx/ctx.grammar/ctx/internal/token/token.go b/example/ctx/ctx.grammar/ctx/internal/token/token.go index 15be3f53..ba4af812 100644 --- a/example/ctx/ctx.grammar/ctx/internal/token/token.go +++ b/example/ctx/ctx.grammar/ctx/internal/token/token.go @@ -79,13 +79,15 @@ var TokMap = TokenMap{ "Ω", "id", "Λ", + "μ", }, idMap: map[string]Type{ - "INVALID": 0, - "Ω": 1, - "id": 2, - "Λ": 3, + "INVALID": 0, + "Ω": 1, + "id": 2, + "Λ": 3, + "μ": 4, }, litMap: map[string]Type{ diff --git a/example/ctx/ctx_test.go b/example/ctx/ctx_test.go index f7162b46..c13728f0 100644 --- a/example/ctx/ctx_test.go +++ b/example/ctx/ctx_test.go @@ -4,13 +4,12 @@ import ( "fmt" "testing" - "github.com/maxcalandrelli/gocc/example/astx/ast" - "github.com/maxcalandrelli/gocc/example/astx/lexer" - "github.com/maxcalandrelli/gocc/example/astx/parser" + "github.com/maxcalandrelli/gocc/example/ctx/ast" + "github.com/maxcalandrelli/gocc/example/ctx/ctx.grammar/ctx" ) func TestPass(t *testing.T) { - sml, err := test([]byte("a b c 12 * 6 + 4 d e f")) + sml, err := test([]byte("a b c calc 12 * 6 + 4 d e f")) if err != nil { t.Fatal(err.Error()) } @@ -28,9 +27,9 @@ func TestFail(t *testing.T) { func test(src []byte) (astree ast.StmtList, err error) { fmt.Printf("input: %s\n", src) - s := lexer.NewLexer(src) - p := parser.NewParser() - a, err := p.Parse(s) + s := ctx.NewLexerBytes(src) + p := ctx.NewParser() + a, err, _ := p.Parse(s) if err == nil { astree = a.(ast.StmtList) } diff --git a/example/errorrecovery/er.grammar/er/grammar.go b/example/errorrecovery/er.grammar/er/grammar.go index b565b6b2..dd94524d 100644 --- a/example/errorrecovery/er.grammar/er/grammar.go +++ b/example/errorrecovery/er.grammar/er/grammar.go @@ -38,7 +38,7 @@ func ParseFile(fpath string) (interface{}, error, int) { } } -func ParseText(text string, userData interface{}) (interface{}, error, int) { +func ParseText(text string) (interface{}, error, int) { return NewParser().Parse(NewLexerBytes([]byte(text))) } @@ -58,7 +58,7 @@ func ParseFileWithData(fpath string, userData interface{}) (interface{}, error, } } -func ParseStringWithData(text string, userData interface{}) (interface{}, error, int) { +func ParseTextWithData(text string, userData interface{}) (interface{}, error, int) { return NewParser().SetContext(userData).Parse(NewLexerBytes([]byte(text))) } @@ -78,7 +78,7 @@ func ParseFilePartial(fpath string) (interface{}, error, int) { } } -func ParseTextPartial(text string, userData interface{}) (interface{}, error, int) { +func ParseTextPartial(text string) (interface{}, error, int) { return NewParser().ParseLongestPrefix(NewLexerBytes([]byte(text))) } @@ -98,7 +98,7 @@ func ParseFileWithDataPartial(fpath string, userData interface{}) (interface{}, } } -func ParseStringWithDataPartial(text string, userData interface{}) (interface{}, error, int) { +func ParseTextWithDataPartial(text string, userData interface{}) (interface{}, error, int) { return NewParser().SetContext(userData).ParseLongestPrefix(NewLexerBytes([]byte(text))) } diff --git a/example/errorrecovery/er.grammar/er/internal/parser/actiontable.go b/example/errorrecovery/er.grammar/er/internal/parser/actiontable.go index b9defbbf..f8fbaeca 100644 --- a/example/errorrecovery/er.grammar/er/internal/parser/actiontable.go +++ b/example/errorrecovery/er.grammar/er/internal/parser/actiontable.go @@ -4,7 +4,7 @@ package parser type ( actionTable [numStates]actionRow - cdFunc func(TokenStream, interface{}) (interface{}, error, []byte) + cdFunc func(TokenStream, interface{}) (interface{}, error, int) cdAction struct { tokenIndex int tokenScanner cdFunc @@ -27,7 +27,7 @@ var parserActions = actions{ nil, // ά nil, // Ω shift(3), // id - shift(4), // error + shift(4), // λ }, cdActions: []cdAction{}, }, @@ -37,7 +37,7 @@ var parserActions = actions{ nil, // ά accept(true), // Ω shift(3), // id - shift(4), // error + shift(4), // λ }, cdActions: []cdAction{}, }, @@ -47,7 +47,7 @@ var parserActions = actions{ nil, // ά reduce(1), // Ω, reduce: StmtList reduce(1), // id, reduce: StmtList - reduce(1), // error, reduce: StmtList + reduce(1), // λ, reduce: StmtList }, cdActions: []cdAction{}, }, @@ -57,7 +57,7 @@ var parserActions = actions{ nil, // ά reduce(3), // Ω, reduce: Stmt reduce(3), // id, reduce: Stmt - reduce(3), // error, reduce: Stmt + reduce(3), // λ, reduce: Stmt }, cdActions: []cdAction{}, }, @@ -67,7 +67,7 @@ var parserActions = actions{ nil, // ά reduce(4), // Ω, reduce: Stmt reduce(4), // id, reduce: Stmt - reduce(4), // error, reduce: Stmt + reduce(4), // λ, reduce: Stmt }, cdActions: []cdAction{}, }, @@ -77,7 +77,7 @@ var parserActions = actions{ nil, // ά reduce(2), // Ω, reduce: StmtList reduce(2), // id, reduce: StmtList - reduce(2), // error, reduce: StmtList + reduce(2), // λ, reduce: StmtList }, cdActions: []cdAction{}, }, diff --git a/example/errorrecovery/er.grammar/er/internal/parser/parser.go b/example/errorrecovery/er.grammar/er/internal/parser/parser.go index 30ef15e3..05a892f9 100644 --- a/example/errorrecovery/er.grammar/er/internal/parser/parser.go +++ b/example/errorrecovery/er.grammar/er/internal/parser/parser.go @@ -255,12 +255,12 @@ func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, er for _, cdAction := range parserActions.table[p.stack.top()].cdActions { tokens.GotoCheckPoint(checkPoint) cd_res, cd_err, cd_parsed := cdAction.tokenScanner(underlyingStream, p.userContext) - if cd_err == nil && len(cd_parsed) > 0 { + if cd_err == nil && cd_parsed > 0 { action = parserActions.table[p.stack.top()].actions[cdAction.tokenIndex] if action != nil { p.nextToken.Foreign = true p.nextToken.ForeignAstNode = cd_res - p.nextToken.Lit = cd_parsed + p.nextToken.Lit = []byte{} p.nextToken.Type = token.Type(cdAction.tokenIndex) break } diff --git a/example/nolexer/nolexer.grammar/nolexer/internal/parser/actiontable.go b/example/nolexer/nolexer.grammar/nolexer/internal/parser/actiontable.go index eb8558e1..6fd93931 100644 --- a/example/nolexer/nolexer.grammar/nolexer/internal/parser/actiontable.go +++ b/example/nolexer/nolexer.grammar/nolexer/internal/parser/actiontable.go @@ -4,7 +4,7 @@ package parser type ( actionTable [numStates]actionRow - cdFunc func(TokenStream, interface{}) (interface{}, error, []byte) + cdFunc func(TokenStream, interface{}) (interface{}, error, int) cdAction struct { tokenIndex int tokenScanner cdFunc diff --git a/example/nolexer/nolexer.grammar/nolexer/internal/parser/parser.go b/example/nolexer/nolexer.grammar/nolexer/internal/parser/parser.go index 5c3f78fc..a8556a79 100644 --- a/example/nolexer/nolexer.grammar/nolexer/internal/parser/parser.go +++ b/example/nolexer/nolexer.grammar/nolexer/internal/parser/parser.go @@ -255,12 +255,12 @@ func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, er for _, cdAction := range parserActions.table[p.stack.top()].cdActions { tokens.GotoCheckPoint(checkPoint) cd_res, cd_err, cd_parsed := cdAction.tokenScanner(underlyingStream, p.userContext) - if cd_err == nil && len(cd_parsed) > 0 { + if cd_err == nil && cd_parsed > 0 { action = parserActions.table[p.stack.top()].actions[cdAction.tokenIndex] if action != nil { p.nextToken.Foreign = true p.nextToken.ForeignAstNode = cd_res - p.nextToken.Lit = cd_parsed + p.nextToken.Lit = []byte{} p.nextToken.Type = token.Type(cdAction.tokenIndex) break } diff --git a/example/rr/rr.grammar/rr/grammar.go b/example/rr/rr.grammar/rr/grammar.go index 3e147ce6..903c4f06 100644 --- a/example/rr/rr.grammar/rr/grammar.go +++ b/example/rr/rr.grammar/rr/grammar.go @@ -38,7 +38,7 @@ func ParseFile(fpath string) (interface{}, error, int) { } } -func ParseText(text string, userData interface{}) (interface{}, error, int) { +func ParseText(text string) (interface{}, error, int) { return NewParser().Parse(NewLexerBytes([]byte(text))) } @@ -58,7 +58,7 @@ func ParseFileWithData(fpath string, userData interface{}) (interface{}, error, } } -func ParseStringWithData(text string, userData interface{}) (interface{}, error, int) { +func ParseTextWithData(text string, userData interface{}) (interface{}, error, int) { return NewParser().SetContext(userData).Parse(NewLexerBytes([]byte(text))) } @@ -78,7 +78,7 @@ func ParseFilePartial(fpath string) (interface{}, error, int) { } } -func ParseTextPartial(text string, userData interface{}) (interface{}, error, int) { +func ParseTextPartial(text string) (interface{}, error, int) { return NewParser().ParseLongestPrefix(NewLexerBytes([]byte(text))) } @@ -98,7 +98,7 @@ func ParseFileWithDataPartial(fpath string, userData interface{}) (interface{}, } } -func ParseStringWithDataPartial(text string, userData interface{}) (interface{}, error, int) { +func ParseTextWithDataPartial(text string, userData interface{}) (interface{}, error, int) { return NewParser().SetContext(userData).ParseLongestPrefix(NewLexerBytes([]byte(text))) } diff --git a/example/rr/rr.grammar/rr/internal/parser/actiontable.go b/example/rr/rr.grammar/rr/internal/parser/actiontable.go index 06641ecc..a5b83df7 100644 --- a/example/rr/rr.grammar/rr/internal/parser/actiontable.go +++ b/example/rr/rr.grammar/rr/internal/parser/actiontable.go @@ -4,7 +4,7 @@ package parser type ( actionTable [numStates]actionRow - cdFunc func(TokenStream, interface{}) (interface{}, error, []byte) + cdFunc func(TokenStream, interface{}) (interface{}, error, int) cdAction struct { tokenIndex int tokenScanner cdFunc diff --git a/example/rr/rr.grammar/rr/internal/parser/parser.go b/example/rr/rr.grammar/rr/internal/parser/parser.go index 3f459423..839bdfb9 100644 --- a/example/rr/rr.grammar/rr/internal/parser/parser.go +++ b/example/rr/rr.grammar/rr/internal/parser/parser.go @@ -255,12 +255,12 @@ func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, er for _, cdAction := range parserActions.table[p.stack.top()].cdActions { tokens.GotoCheckPoint(checkPoint) cd_res, cd_err, cd_parsed := cdAction.tokenScanner(underlyingStream, p.userContext) - if cd_err == nil && len(cd_parsed) > 0 { + if cd_err == nil && cd_parsed > 0 { action = parserActions.table[p.stack.top()].actions[cdAction.tokenIndex] if action != nil { p.nextToken.Foreign = true p.nextToken.ForeignAstNode = cd_res - p.nextToken.Lit = cd_parsed + p.nextToken.Lit = []byte{} p.nextToken.Type = token.Type(cdAction.tokenIndex) break } diff --git a/example/sr/sr.grammar/sr/grammar.go b/example/sr/sr.grammar/sr/grammar.go index 1a9879da..f7158cc6 100644 --- a/example/sr/sr.grammar/sr/grammar.go +++ b/example/sr/sr.grammar/sr/grammar.go @@ -38,7 +38,7 @@ func ParseFile(fpath string) (interface{}, error, int) { } } -func ParseText(text string, userData interface{}) (interface{}, error, int) { +func ParseText(text string) (interface{}, error, int) { return NewParser().Parse(NewLexerBytes([]byte(text))) } @@ -58,7 +58,7 @@ func ParseFileWithData(fpath string, userData interface{}) (interface{}, error, } } -func ParseStringWithData(text string, userData interface{}) (interface{}, error, int) { +func ParseTextWithData(text string, userData interface{}) (interface{}, error, int) { return NewParser().SetContext(userData).Parse(NewLexerBytes([]byte(text))) } @@ -78,7 +78,7 @@ func ParseFilePartial(fpath string) (interface{}, error, int) { } } -func ParseTextPartial(text string, userData interface{}) (interface{}, error, int) { +func ParseTextPartial(text string) (interface{}, error, int) { return NewParser().ParseLongestPrefix(NewLexerBytes([]byte(text))) } @@ -98,7 +98,7 @@ func ParseFileWithDataPartial(fpath string, userData interface{}) (interface{}, } } -func ParseStringWithDataPartial(text string, userData interface{}) (interface{}, error, int) { +func ParseTextWithDataPartial(text string, userData interface{}) (interface{}, error, int) { return NewParser().SetContext(userData).ParseLongestPrefix(NewLexerBytes([]byte(text))) } diff --git a/example/sr/sr.grammar/sr/internal/parser/actiontable.go b/example/sr/sr.grammar/sr/internal/parser/actiontable.go index 1ff4a333..4a2a1d86 100644 --- a/example/sr/sr.grammar/sr/internal/parser/actiontable.go +++ b/example/sr/sr.grammar/sr/internal/parser/actiontable.go @@ -4,7 +4,7 @@ package parser type ( actionTable [numStates]actionRow - cdFunc func(TokenStream, interface{}) (interface{}, error, []byte) + cdFunc func(TokenStream, interface{}) (interface{}, error, int) cdAction struct { tokenIndex int tokenScanner cdFunc diff --git a/example/sr/sr.grammar/sr/internal/parser/parser.go b/example/sr/sr.grammar/sr/internal/parser/parser.go index 36380fa2..5b99121d 100644 --- a/example/sr/sr.grammar/sr/internal/parser/parser.go +++ b/example/sr/sr.grammar/sr/internal/parser/parser.go @@ -255,12 +255,12 @@ func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, er for _, cdAction := range parserActions.table[p.stack.top()].cdActions { tokens.GotoCheckPoint(checkPoint) cd_res, cd_err, cd_parsed := cdAction.tokenScanner(underlyingStream, p.userContext) - if cd_err == nil && len(cd_parsed) > 0 { + if cd_err == nil && cd_parsed > 0 { action = parserActions.table[p.stack.top()].actions[cdAction.tokenIndex] if action != nil { p.nextToken.Foreign = true p.nextToken.ForeignAstNode = cd_res - p.nextToken.Lit = cd_parsed + p.nextToken.Lit = []byte{} p.nextToken.Type = token.Type(cdAction.tokenIndex) break } diff --git a/internal/ast/grammar.go b/internal/ast/grammar.go index 4ecec95f..f38101de 100644 --- a/internal/ast/grammar.go +++ b/internal/ast/grammar.go @@ -78,7 +78,7 @@ func consistent(g *Grammar) (err error) { for s, in := range used { if _, ok := defs[s]; !ok { switch s.(type) { - case SyntaxEmpty, SyntaxError, SyntaxContextDependentTokId: + case SyntaxEmpty, SyntaxError, SyntaxContextDependentTokId, SyntaxSubParser: continue } if !s.IsTerminal() { diff --git a/internal/ast/reconcile.go b/internal/ast/reconcile.go index 1f511b08..d6bbf7f3 100644 --- a/internal/ast/reconcile.go +++ b/internal/ast/reconcile.go @@ -19,3 +19,14 @@ func getString(v interface{}) string { } return StringGetter(v) } + +func unquoteString(str string) (string, bool, rune) { + if len(str) > 1 { + r := str[0] + if r == '"' || r == '`' || r == '\'' { + str = str[1 : len(str)-1] + } + return str, true, rune(r) + } + return str, false, 0 +} diff --git a/internal/ast/syntaxsubparser.go b/internal/ast/syntaxsubparser.go new file mode 100644 index 00000000..2b1a32b1 --- /dev/null +++ b/internal/ast/syntaxsubparser.go @@ -0,0 +1,68 @@ +//Copyright 2013 Vastech SA (PTY) LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package ast + +import ( + "fmt" + "path" + + "github.com/maxcalandrelli/gocc/internal/config" +) + +type SyntaxSubParser struct { + string + StdSyntaxSymbol + Alias string + Import string +} + +func NewAliasedSubParser(_alias, _import interface{}) (SyntaxSubParser, error) { + return newSubParser(getString(_alias), getString(_import)) +} + +func NewSubParser(_import interface{}) (SyntaxSubParser, error) { + return newSubParser("", getString(_import)) +} + +func newSubParser(alias, imp string) (SyntaxSubParser, error) { + imp, _, _ = unquoteString(imp) + if alias == "" { + alias = path.Base(imp) + } else { + alias, _, _ = unquoteString(alias) + } + return SyntaxSubParser{ + fmt.Sprintf("%s_%d", alias, tokenIdCount), + StdSyntaxSymbol{}, + alias, + imp, + }, nil +} + +func (this SyntaxSubParser) SymbolString() string { + return this.string +} + +func (this SyntaxSubParser) String() string { + return fmt.Sprintf("%s<%s>", config.INTERNAL_SYMBOL_CDTOK, this.string) +} + +func (this SyntaxSubParser) SymbolName() string { + return fmt.Sprintf("%s<%s>", config.INTERNAL_SYMBOL_CDTOK, this.string) +} + +func (this SyntaxSubParser) IsTerminal() bool { + return true +} diff --git a/internal/ast/syntaxsymbol.go b/internal/ast/syntaxsymbol.go index 9aa00e63..a524dcaf 100644 --- a/internal/ast/syntaxsymbol.go +++ b/internal/ast/syntaxsymbol.go @@ -48,6 +48,7 @@ func (SyntaxTokId) gSymbol() {} func (SyntaxStringLit) gSymbol() {} func (InvalidSyntaxSymbol) gSymbol() {} func (SyntaxContextDependentTokId) gSymbol() {} +func (SyntaxSubParser) gSymbol() {} func (InvalidSyntaxSymbol) SymbolName() string { return config.INTERNAL_SYMBOL_INVALID diff --git a/internal/base/gen/golang/base.go b/internal/base/gen/golang/base.go index 4199eb48..a70ae173 100644 --- a/internal/base/gen/golang/base.go +++ b/internal/base/gen/golang/base.go @@ -163,7 +163,7 @@ func ParseFile(fpath string) (interface{}, error, int) { } } -func ParseText(text string, userData interface{}) (interface{}, error, int) { +func ParseText(text string) (interface{}, error, int) { return NewParser().Parse(NewLexerBytes([]byte(text))) } @@ -183,7 +183,7 @@ func ParseFileWithData(fpath string, userData interface{}) (interface{}, error, } } -func ParseStringWithData(text string, userData interface{}) (interface{}, error, int) { +func ParseTextWithData(text string, userData interface{}) (interface{}, error, int) { return NewParser().SetContext(userData).Parse(NewLexerBytes([]byte(text))) } @@ -204,7 +204,7 @@ func ParseFilePartial(fpath string) (interface{}, error, int) { } } -func ParseTextPartial(text string, userData interface{}) (interface{}, error, int) { +func ParseTextPartial(text string) (interface{}, error, int) { return NewParser().ParseLongestPrefix(NewLexerBytes([]byte(text))) } @@ -224,7 +224,7 @@ func ParseFileWithDataPartial(fpath string, userData interface{}) (interface{}, } } -func ParseStringWithDataPartial(text string, userData interface{}) (interface{}, error, int) { +func ParseTextWithDataPartial(text string, userData interface{}) (interface{}, error, int) { return NewParser().SetContext(userData).ParseLongestPrefix(NewLexerBytes([]byte(text))) } diff --git a/internal/config/config.go b/internal/config/config.go index e8bc238d..cb22e49d 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -27,7 +27,7 @@ import ( ) const ( - VERSION = "1.1.0035" + VERSION = "1.2.0001" INTERNAL_SYMBOL_EMPTY = "ε" INTERNAL_SYMBOL_ERROR = "λ" // (λάθος) @@ -36,8 +36,8 @@ const ( INTERNAL_SYMBOL_PROD = "Π" INTERNAL_SYMBOL_LIT = "Λ" INTERNAL_SYMBOL_CDTOK = "μ" - SYMBOL_EMPTY = "empty" - SYMBOL_ERROR = "error" + SYMBOL_EMPTY = "ε" + SYMBOL_ERROR = "λ" SYMBOL_INVALID = "ά" SYMBOL_EOF = "Ω" SYMBOL_CDTOK = "μ" diff --git a/internal/frontend/reparsed/grammar.go b/internal/frontend/reparsed/grammar.go index 7dd2c6f1..8876da3e 100644 --- a/internal/frontend/reparsed/grammar.go +++ b/internal/frontend/reparsed/grammar.go @@ -38,7 +38,7 @@ func ParseFile(fpath string) (interface{}, error, int) { } } -func ParseText(text string, userData interface{}) (interface{}, error, int) { +func ParseText(text string) (interface{}, error, int) { return NewParser().Parse(NewLexerBytes([]byte(text))) } @@ -58,7 +58,7 @@ func ParseFileWithData(fpath string, userData interface{}) (interface{}, error, } } -func ParseStringWithData(text string, userData interface{}) (interface{}, error, int) { +func ParseTextWithData(text string, userData interface{}) (interface{}, error, int) { return NewParser().SetContext(userData).Parse(NewLexerBytes([]byte(text))) } @@ -78,7 +78,7 @@ func ParseFilePartial(fpath string) (interface{}, error, int) { } } -func ParseTextPartial(text string, userData interface{}) (interface{}, error, int) { +func ParseTextPartial(text string) (interface{}, error, int) { return NewParser().ParseLongestPrefix(NewLexerBytes([]byte(text))) } @@ -98,7 +98,7 @@ func ParseFileWithDataPartial(fpath string, userData interface{}) (interface{}, } } -func ParseStringWithDataPartial(text string, userData interface{}) (interface{}, error, int) { +func ParseTextWithDataPartial(text string, userData interface{}) (interface{}, error, int) { return NewParser().SetContext(userData).ParseLongestPrefix(NewLexerBytes([]byte(text))) } diff --git a/internal/frontend/reparsed/internal/lexer/acttab.go b/internal/frontend/reparsed/internal/lexer/acttab.go index 0d270dd3..1dcea7b2 100644 --- a/internal/frontend/reparsed/internal/lexer/acttab.go +++ b/internal/frontend/reparsed/internal/lexer/acttab.go @@ -72,8 +72,8 @@ var ActTab = ActionTable{ Accept: 0, Ignore: "", }, - ActionRow{ // S13, - Accept: 0, + ActionRow{ // S13, Accept("Λ<@>") + Accept: 22, Ignore: "", }, ActionRow{ // S14, Accept("prodId") @@ -121,11 +121,11 @@ var ActTab = ActionTable{ Ignore: "", }, ActionRow{ // S25, Accept("Λ<ε>") - Accept: 25, + Accept: 26, Ignore: "", }, ActionRow{ // S26, Accept("Λ<λ>") - Accept: 23, + Accept: 24, Ignore: "", }, ActionRow{ // S27, Accept("ignoredTokId") @@ -405,11 +405,11 @@ var ActTab = ActionTable{ Ignore: "", }, ActionRow{ // S96, Accept("Λ") - Accept: 24, + Accept: 25, Ignore: "", }, ActionRow{ // S97, Accept("Λ") - Accept: 22, + Accept: 23, Ignore: "", }, ActionRow{ // S98, diff --git a/internal/frontend/reparsed/internal/lexer/lexer.go b/internal/frontend/reparsed/internal/lexer/lexer.go index 799492b6..ba02bf32 100644 --- a/internal/frontend/reparsed/internal/lexer/lexer.go +++ b/internal/frontend/reparsed/internal/lexer/lexer.go @@ -17,7 +17,7 @@ import ( const ( NoState = -1 NumStates = 114 - NumSymbols = 83 + NumSymbols = 84 INVALID_RUNE = rune(-1) ) diff --git a/internal/frontend/reparsed/internal/parser/actiontable.go b/internal/frontend/reparsed/internal/parser/actiontable.go index 239f10f5..ace546c6 100644 --- a/internal/frontend/reparsed/internal/parser/actiontable.go +++ b/internal/frontend/reparsed/internal/parser/actiontable.go @@ -4,7 +4,7 @@ package parser type ( actionTable [numStates]actionRow - cdFunc func(TokenStream, interface{}) (interface{}, error, []byte) + cdFunc func(TokenStream, interface{}) (interface{}, error, int) cdAction struct { tokenIndex int tokenScanner cdFunc @@ -46,6 +46,7 @@ var parserActions = actions{ shift(13), // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -78,6 +79,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -110,6 +112,7 @@ var parserActions = actions{ shift(13), // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -142,6 +145,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -174,6 +178,7 @@ var parserActions = actions{ reduce(4), // prodId, reduce: LexicalPart nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -206,6 +211,7 @@ var parserActions = actions{ reduce(5), // prodId, reduce: LexProductions nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -238,6 +244,7 @@ var parserActions = actions{ shift(13), // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -270,6 +277,7 @@ var parserActions = actions{ shift(13), // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -302,6 +310,7 @@ var parserActions = actions{ reduce(26), // prodId, reduce: SyntaxProdList nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -334,6 +343,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -366,6 +376,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -398,6 +409,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -430,6 +442,7 @@ var parserActions = actions{ reduce(25), // prodId, reduce: FileHeader nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -462,6 +475,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -494,6 +508,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -526,6 +541,7 @@ var parserActions = actions{ reduce(6), // prodId, reduce: LexProductions nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -558,6 +574,7 @@ var parserActions = actions{ shift(13), // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -590,6 +607,7 @@ var parserActions = actions{ reduce(27), // prodId, reduce: SyntaxProdList nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -622,6 +640,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -654,6 +673,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -686,6 +706,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -718,10 +739,11 @@ var parserActions = actions{ shift(41), // prodId shift(42), // string_lit nil, // g_ctxdep_lit - shift(43), // "error" - shift(44), // "λ" - shift(45), // "empty" - shift(46), // "ε" + shift(43), // "@" + shift(44), // "error" + shift(45), // "λ" + shift(46), // "empty" + shift(47), // "ε" }, cdActions: []cdAction{}, }, @@ -732,10 +754,10 @@ var parserActions = actions{ nil, // Ω nil, // tokId nil, // ":" - shift(47), // ";" + shift(48), // ";" nil, // regDefId nil, // ignoredTokId - shift(48), // "|" + shift(49), // "|" nil, // "." nil, // char_lit nil, // "-" @@ -750,6 +772,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -782,6 +805,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -814,6 +838,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -846,6 +871,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -878,6 +904,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -898,7 +925,7 @@ var parserActions = actions{ reduce(15), // "|", reduce: LexTerm reduce(15), // ".", reduce: LexTerm reduce(15), // char_lit, reduce: LexTerm - shift(50), // "-" + shift(51), // "-" reduce(15), // "~", reduce: LexTerm reduce(15), // "(", reduce: LexTerm nil, // ")" @@ -910,6 +937,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -929,10 +957,10 @@ var parserActions = actions{ nil, // ignoredTokId nil, // "|" nil, // "." - shift(51), // char_lit + shift(52), // char_lit nil, // "-" nil, // "~" - shift(52), // "(" + shift(53), // "(" nil, // ")" nil, // "[" nil, // "]" @@ -942,6 +970,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -957,23 +986,24 @@ var parserActions = actions{ nil, // tokId nil, // ":" nil, // ";" - shift(56), // regDefId + shift(57), // regDefId nil, // ignoredTokId nil, // "|" - shift(57), // "." - shift(58), // char_lit + shift(58), // "." + shift(59), // char_lit nil, // "-" - shift(59), // "~" - shift(60), // "(" + shift(60), // "~" + shift(61), // "(" nil, // ")" - shift(61), // "[" + shift(62), // "[" nil, // "]" - shift(62), // "{" + shift(63), // "{" nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -989,23 +1019,24 @@ var parserActions = actions{ nil, // tokId nil, // ":" nil, // ";" - shift(66), // regDefId + shift(67), // regDefId nil, // ignoredTokId nil, // "|" - shift(67), // "." - shift(68), // char_lit + shift(68), // "." + shift(69), // char_lit nil, // "-" - shift(69), // "~" - shift(70), // "(" + shift(70), // "~" + shift(71), // "(" nil, // ")" - shift(71), // "[" + shift(72), // "[" nil, // "]" - shift(72), // "{" + shift(73), // "{" nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -1021,23 +1052,24 @@ var parserActions = actions{ nil, // tokId nil, // ":" nil, // ";" - shift(76), // regDefId + shift(77), // regDefId nil, // ignoredTokId nil, // "|" - shift(77), // "." - shift(78), // char_lit + shift(78), // "." + shift(79), // char_lit nil, // "-" - shift(79), // "~" - shift(80), // "(" + shift(80), // "~" + shift(81), // "(" nil, // ")" - shift(81), // "[" + shift(82), // "[" nil, // "]" - shift(82), // "{" + shift(83), // "{" nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -1052,10 +1084,10 @@ var parserActions = actions{ nil, // Ω nil, // tokId nil, // ":" - shift(83), // ";" + shift(84), // ";" nil, // regDefId nil, // ignoredTokId - shift(48), // "|" + shift(49), // "|" nil, // "." nil, // char_lit nil, // "-" @@ -1070,6 +1102,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -1084,10 +1117,10 @@ var parserActions = actions{ nil, // Ω nil, // tokId nil, // ":" - shift(84), // ";" + shift(85), // ";" nil, // regDefId nil, // ignoredTokId - shift(48), // "|" + shift(49), // "|" nil, // "." nil, // char_lit nil, // "-" @@ -1102,6 +1135,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -1116,10 +1150,10 @@ var parserActions = actions{ nil, // Ω nil, // tokId nil, // ":" - shift(85), // ";" + shift(86), // ";" nil, // regDefId nil, // ignoredTokId - shift(86), // "|" + shift(87), // "|" nil, // "." nil, // char_lit nil, // "-" @@ -1134,6 +1168,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -1166,6 +1201,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -1194,10 +1230,11 @@ var parserActions = actions{ nil, // "]" nil, // "{" nil, // "}" - shift(88), // g_sdt_lit + shift(89), // g_sdt_lit shift(41), // prodId shift(42), // string_lit nil, // g_ctxdep_lit + shift(43), // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -1226,10 +1263,11 @@ var parserActions = actions{ nil, // "]" nil, // "{" nil, // "}" - shift(90), // g_sdt_lit + shift(91), // g_sdt_lit shift(41), // prodId shift(42), // string_lit nil, // g_ctxdep_lit + shift(43), // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -1262,6 +1300,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -1294,6 +1333,7 @@ var parserActions = actions{ reduce(38), // prodId, reduce: Symbols reduce(38), // string_lit, reduce: Symbols nil, // g_ctxdep_lit + reduce(38), // "@", reduce: Symbols nil, // "error" nil, // "λ" nil, // "empty" @@ -1325,7 +1365,8 @@ var parserActions = actions{ reduce(41), // g_sdt_lit, reduce: Symbol reduce(41), // prodId, reduce: Symbol reduce(41), // string_lit, reduce: Symbol - shift(91), // g_ctxdep_lit + shift(92), // g_ctxdep_lit + reduce(41), // "@", reduce: Symbol nil, // "error" nil, // "λ" nil, // "empty" @@ -1358,6 +1399,7 @@ var parserActions = actions{ reduce(40), // prodId, reduce: Symbol reduce(40), // string_lit, reduce: Symbol nil, // g_ctxdep_lit + reduce(40), // "@", reduce: Symbol nil, // "error" nil, // "λ" nil, // "empty" @@ -1390,6 +1432,7 @@ var parserActions = actions{ reduce(42), // prodId, reduce: Symbol reduce(42), // string_lit, reduce: Symbol nil, // g_ctxdep_lit + reduce(42), // "@", reduce: Symbol nil, // "error" nil, // "λ" nil, // "empty" @@ -1398,16 +1441,49 @@ var parserActions = actions{ cdActions: []cdAction{}, }, actionRow{ // S43 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + shift(93), // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + shift(94), // string_lit + nil, // g_ctxdep_lit + nil, // "@" + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S44 canRecover: false, actions: [numSymbols]action{ nil, // ά nil, // Ω - reduce(44), // tokId, reduce: ErrorSymbol + reduce(46), // tokId, reduce: ErrorSymbol nil, // ":" - reduce(44), // ";", reduce: ErrorSymbol + reduce(46), // ";", reduce: ErrorSymbol nil, // regDefId nil, // ignoredTokId - reduce(44), // "|", reduce: ErrorSymbol + reduce(46), // "|", reduce: ErrorSymbol nil, // "." nil, // char_lit nil, // "-" @@ -1418,10 +1494,11 @@ var parserActions = actions{ nil, // "]" nil, // "{" nil, // "}" - reduce(44), // g_sdt_lit, reduce: ErrorSymbol - reduce(44), // prodId, reduce: ErrorSymbol - reduce(44), // string_lit, reduce: ErrorSymbol + reduce(46), // g_sdt_lit, reduce: ErrorSymbol + reduce(46), // prodId, reduce: ErrorSymbol + reduce(46), // string_lit, reduce: ErrorSymbol nil, // g_ctxdep_lit + reduce(46), // "@", reduce: ErrorSymbol nil, // "error" nil, // "λ" nil, // "empty" @@ -1429,17 +1506,17 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S44 + actionRow{ // S45 canRecover: false, actions: [numSymbols]action{ nil, // ά nil, // Ω - reduce(45), // tokId, reduce: ErrorSymbol + reduce(47), // tokId, reduce: ErrorSymbol nil, // ":" - reduce(45), // ";", reduce: ErrorSymbol + reduce(47), // ";", reduce: ErrorSymbol nil, // regDefId nil, // ignoredTokId - reduce(45), // "|", reduce: ErrorSymbol + reduce(47), // "|", reduce: ErrorSymbol nil, // "." nil, // char_lit nil, // "-" @@ -1450,10 +1527,11 @@ var parserActions = actions{ nil, // "]" nil, // "{" nil, // "}" - reduce(45), // g_sdt_lit, reduce: ErrorSymbol - reduce(45), // prodId, reduce: ErrorSymbol - reduce(45), // string_lit, reduce: ErrorSymbol + reduce(47), // g_sdt_lit, reduce: ErrorSymbol + reduce(47), // prodId, reduce: ErrorSymbol + reduce(47), // string_lit, reduce: ErrorSymbol nil, // g_ctxdep_lit + reduce(47), // "@", reduce: ErrorSymbol nil, // "error" nil, // "λ" nil, // "empty" @@ -1461,17 +1539,17 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S45 + actionRow{ // S46 canRecover: false, actions: [numSymbols]action{ nil, // ά nil, // Ω nil, // tokId nil, // ":" - reduce(46), // ";", reduce: EpsilonSymbol + reduce(48), // ";", reduce: EpsilonSymbol nil, // regDefId nil, // ignoredTokId - reduce(46), // "|", reduce: EpsilonSymbol + reduce(48), // "|", reduce: EpsilonSymbol nil, // "." nil, // char_lit nil, // "-" @@ -1486,6 +1564,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -1493,17 +1572,17 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S46 + actionRow{ // S47 canRecover: false, actions: [numSymbols]action{ nil, // ά nil, // Ω nil, // tokId nil, // ":" - reduce(47), // ";", reduce: EpsilonSymbol + reduce(49), // ";", reduce: EpsilonSymbol nil, // regDefId nil, // ignoredTokId - reduce(47), // "|", reduce: EpsilonSymbol + reduce(49), // "|", reduce: EpsilonSymbol nil, // "." nil, // char_lit nil, // "-" @@ -1518,6 +1597,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -1525,7 +1605,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S47 + actionRow{ // S48 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -1550,6 +1630,7 @@ var parserActions = actions{ reduce(7), // prodId, reduce: LexProduction nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -1557,7 +1638,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S48 + actionRow{ // S49 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -1582,6 +1663,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -1589,7 +1671,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S49 + actionRow{ // S50 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -1614,6 +1696,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -1621,7 +1704,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S50 + actionRow{ // S51 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -1633,7 +1716,7 @@ var parserActions = actions{ nil, // ignoredTokId nil, // "|" nil, // "." - shift(93), // char_lit + shift(96), // char_lit nil, // "-" nil, // "~" nil, // "(" @@ -1646,6 +1729,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -1653,7 +1737,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S51 + actionRow{ // S52 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -1678,6 +1762,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -1685,7 +1770,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S52 + actionRow{ // S53 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -1697,7 +1782,7 @@ var parserActions = actions{ nil, // ignoredTokId nil, // "|" nil, // "." - shift(94), // char_lit + shift(97), // char_lit nil, // "-" nil, // "~" nil, // "(" @@ -1710,6 +1795,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -1717,7 +1803,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S53 + actionRow{ // S54 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -1727,13 +1813,13 @@ var parserActions = actions{ nil, // ";" nil, // regDefId nil, // ignoredTokId - shift(95), // "|" + shift(98), // "|" nil, // "." nil, // char_lit nil, // "-" nil, // "~" nil, // "(" - shift(96), // ")" + shift(99), // ")" nil, // "[" nil, // "]" nil, // "{" @@ -1742,6 +1828,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -1749,7 +1836,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S54 + actionRow{ // S55 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -1757,23 +1844,24 @@ var parserActions = actions{ nil, // tokId nil, // ":" nil, // ";" - shift(56), // regDefId + shift(57), // regDefId nil, // ignoredTokId reduce(10), // "|", reduce: LexPattern - shift(57), // "." - shift(58), // char_lit + shift(58), // "." + shift(59), // char_lit nil, // "-" - shift(59), // "~" - shift(60), // "(" + shift(60), // "~" + shift(61), // "(" reduce(10), // ")", reduce: LexPattern - shift(61), // "[" + shift(62), // "[" nil, // "]" - shift(62), // "{" + shift(63), // "{" nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -1781,7 +1869,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S55 + actionRow{ // S56 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -1806,6 +1894,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -1813,7 +1902,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S56 + actionRow{ // S57 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -1838,6 +1927,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -1845,7 +1935,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S57 + actionRow{ // S58 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -1870,6 +1960,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -1877,7 +1968,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S58 + actionRow{ // S59 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -1890,7 +1981,7 @@ var parserActions = actions{ reduce(15), // "|", reduce: LexTerm reduce(15), // ".", reduce: LexTerm reduce(15), // char_lit, reduce: LexTerm - shift(98), // "-" + shift(101), // "-" reduce(15), // "~", reduce: LexTerm reduce(15), // "(", reduce: LexTerm reduce(15), // ")", reduce: LexTerm @@ -1902,6 +1993,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -1909,7 +2001,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S59 + actionRow{ // S60 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -1921,10 +2013,10 @@ var parserActions = actions{ nil, // ignoredTokId nil, // "|" nil, // "." - shift(99), // char_lit + shift(102), // char_lit nil, // "-" nil, // "~" - shift(100), // "(" + shift(103), // "(" nil, // ")" nil, // "[" nil, // "]" @@ -1934,6 +2026,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -1941,7 +2034,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S60 + actionRow{ // S61 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -1949,23 +2042,24 @@ var parserActions = actions{ nil, // tokId nil, // ":" nil, // ";" - shift(56), // regDefId + shift(57), // regDefId nil, // ignoredTokId nil, // "|" - shift(57), // "." - shift(58), // char_lit + shift(58), // "." + shift(59), // char_lit nil, // "-" - shift(59), // "~" - shift(60), // "(" + shift(60), // "~" + shift(61), // "(" nil, // ")" - shift(61), // "[" + shift(62), // "[" nil, // "]" - shift(62), // "{" + shift(63), // "{" nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -1973,7 +2067,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S61 + actionRow{ // S62 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -1981,23 +2075,24 @@ var parserActions = actions{ nil, // tokId nil, // ":" nil, // ";" - shift(66), // regDefId + shift(67), // regDefId nil, // ignoredTokId nil, // "|" - shift(67), // "." - shift(68), // char_lit + shift(68), // "." + shift(69), // char_lit nil, // "-" - shift(69), // "~" - shift(70), // "(" + shift(70), // "~" + shift(71), // "(" nil, // ")" - shift(71), // "[" + shift(72), // "[" nil, // "]" - shift(72), // "{" + shift(73), // "{" nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -2005,7 +2100,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S62 + actionRow{ // S63 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -2013,23 +2108,24 @@ var parserActions = actions{ nil, // tokId nil, // ":" nil, // ";" - shift(76), // regDefId + shift(77), // regDefId nil, // ignoredTokId nil, // "|" - shift(77), // "." - shift(78), // char_lit + shift(78), // "." + shift(79), // char_lit nil, // "-" - shift(79), // "~" - shift(80), // "(" + shift(80), // "~" + shift(81), // "(" nil, // ")" - shift(81), // "[" + shift(82), // "[" nil, // "]" - shift(82), // "{" + shift(83), // "{" nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -2037,7 +2133,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S63 + actionRow{ // S64 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -2047,7 +2143,7 @@ var parserActions = actions{ nil, // ";" nil, // regDefId nil, // ignoredTokId - shift(104), // "|" + shift(107), // "|" nil, // "." nil, // char_lit nil, // "-" @@ -2055,13 +2151,14 @@ var parserActions = actions{ nil, // "(" nil, // ")" nil, // "[" - shift(105), // "]" + shift(108), // "]" nil, // "{" nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -2069,7 +2166,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S64 + actionRow{ // S65 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -2077,23 +2174,24 @@ var parserActions = actions{ nil, // tokId nil, // ":" nil, // ";" - shift(66), // regDefId + shift(67), // regDefId nil, // ignoredTokId reduce(10), // "|", reduce: LexPattern - shift(67), // "." - shift(68), // char_lit + shift(68), // "." + shift(69), // char_lit nil, // "-" - shift(69), // "~" - shift(70), // "(" + shift(70), // "~" + shift(71), // "(" nil, // ")" - shift(71), // "[" + shift(72), // "[" reduce(10), // "]", reduce: LexPattern - shift(72), // "{" + shift(73), // "{" nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -2101,7 +2199,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S65 + actionRow{ // S66 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -2126,6 +2224,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -2133,7 +2232,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S66 + actionRow{ // S67 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -2158,6 +2257,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -2165,7 +2265,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S67 + actionRow{ // S68 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -2190,6 +2290,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -2197,7 +2298,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S68 + actionRow{ // S69 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -2210,7 +2311,7 @@ var parserActions = actions{ reduce(15), // "|", reduce: LexTerm reduce(15), // ".", reduce: LexTerm reduce(15), // char_lit, reduce: LexTerm - shift(107), // "-" + shift(110), // "-" reduce(15), // "~", reduce: LexTerm reduce(15), // "(", reduce: LexTerm nil, // ")" @@ -2222,6 +2323,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -2229,7 +2331,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S69 + actionRow{ // S70 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -2241,10 +2343,10 @@ var parserActions = actions{ nil, // ignoredTokId nil, // "|" nil, // "." - shift(108), // char_lit + shift(111), // char_lit nil, // "-" nil, // "~" - shift(109), // "(" + shift(112), // "(" nil, // ")" nil, // "[" nil, // "]" @@ -2254,6 +2356,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -2261,7 +2364,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S70 + actionRow{ // S71 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -2269,23 +2372,24 @@ var parserActions = actions{ nil, // tokId nil, // ":" nil, // ";" - shift(56), // regDefId + shift(57), // regDefId nil, // ignoredTokId nil, // "|" - shift(57), // "." - shift(58), // char_lit + shift(58), // "." + shift(59), // char_lit nil, // "-" - shift(59), // "~" - shift(60), // "(" + shift(60), // "~" + shift(61), // "(" nil, // ")" - shift(61), // "[" + shift(62), // "[" nil, // "]" - shift(62), // "{" + shift(63), // "{" nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -2293,7 +2397,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S71 + actionRow{ // S72 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -2301,23 +2405,24 @@ var parserActions = actions{ nil, // tokId nil, // ":" nil, // ";" - shift(66), // regDefId + shift(67), // regDefId nil, // ignoredTokId nil, // "|" - shift(67), // "." - shift(68), // char_lit + shift(68), // "." + shift(69), // char_lit nil, // "-" - shift(69), // "~" - shift(70), // "(" + shift(70), // "~" + shift(71), // "(" nil, // ")" - shift(71), // "[" + shift(72), // "[" nil, // "]" - shift(72), // "{" + shift(73), // "{" nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -2325,7 +2430,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S72 + actionRow{ // S73 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -2333,23 +2438,24 @@ var parserActions = actions{ nil, // tokId nil, // ":" nil, // ";" - shift(76), // regDefId + shift(77), // regDefId nil, // ignoredTokId nil, // "|" - shift(77), // "." - shift(78), // char_lit + shift(78), // "." + shift(79), // char_lit nil, // "-" - shift(79), // "~" - shift(80), // "(" + shift(80), // "~" + shift(81), // "(" nil, // ")" - shift(81), // "[" + shift(82), // "[" nil, // "]" - shift(82), // "{" + shift(83), // "{" nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -2357,7 +2463,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S73 + actionRow{ // S74 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -2367,7 +2473,7 @@ var parserActions = actions{ nil, // ";" nil, // regDefId nil, // ignoredTokId - shift(113), // "|" + shift(116), // "|" nil, // "." nil, // char_lit nil, // "-" @@ -2377,11 +2483,12 @@ var parserActions = actions{ nil, // "[" nil, // "]" nil, // "{" - shift(114), // "}" + shift(117), // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -2389,7 +2496,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S74 + actionRow{ // S75 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -2397,23 +2504,24 @@ var parserActions = actions{ nil, // tokId nil, // ":" nil, // ";" - shift(76), // regDefId + shift(77), // regDefId nil, // ignoredTokId reduce(10), // "|", reduce: LexPattern - shift(77), // "." - shift(78), // char_lit + shift(78), // "." + shift(79), // char_lit nil, // "-" - shift(79), // "~" - shift(80), // "(" + shift(80), // "~" + shift(81), // "(" nil, // ")" - shift(81), // "[" + shift(82), // "[" nil, // "]" - shift(82), // "{" + shift(83), // "{" reduce(10), // "}", reduce: LexPattern nil, // g_sdt_lit nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -2421,7 +2529,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S75 + actionRow{ // S76 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -2446,6 +2554,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -2453,7 +2562,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S76 + actionRow{ // S77 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -2478,6 +2587,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -2485,7 +2595,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S77 + actionRow{ // S78 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -2510,6 +2620,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -2517,7 +2628,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S78 + actionRow{ // S79 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -2530,7 +2641,7 @@ var parserActions = actions{ reduce(15), // "|", reduce: LexTerm reduce(15), // ".", reduce: LexTerm reduce(15), // char_lit, reduce: LexTerm - shift(116), // "-" + shift(119), // "-" reduce(15), // "~", reduce: LexTerm reduce(15), // "(", reduce: LexTerm nil, // ")" @@ -2542,6 +2653,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -2549,7 +2661,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S79 + actionRow{ // S80 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -2561,10 +2673,10 @@ var parserActions = actions{ nil, // ignoredTokId nil, // "|" nil, // "." - shift(117), // char_lit + shift(120), // char_lit nil, // "-" nil, // "~" - shift(118), // "(" + shift(121), // "(" nil, // ")" nil, // "[" nil, // "]" @@ -2574,6 +2686,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -2581,7 +2694,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S80 + actionRow{ // S81 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -2589,23 +2702,24 @@ var parserActions = actions{ nil, // tokId nil, // ":" nil, // ";" - shift(56), // regDefId + shift(57), // regDefId nil, // ignoredTokId nil, // "|" - shift(57), // "." - shift(58), // char_lit + shift(58), // "." + shift(59), // char_lit nil, // "-" - shift(59), // "~" - shift(60), // "(" + shift(60), // "~" + shift(61), // "(" nil, // ")" - shift(61), // "[" + shift(62), // "[" nil, // "]" - shift(62), // "{" + shift(63), // "{" nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -2613,7 +2727,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S81 + actionRow{ // S82 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -2621,23 +2735,24 @@ var parserActions = actions{ nil, // tokId nil, // ":" nil, // ";" - shift(66), // regDefId + shift(67), // regDefId nil, // ignoredTokId nil, // "|" - shift(67), // "." - shift(68), // char_lit + shift(68), // "." + shift(69), // char_lit nil, // "-" - shift(69), // "~" - shift(70), // "(" + shift(70), // "~" + shift(71), // "(" nil, // ")" - shift(71), // "[" + shift(72), // "[" nil, // "]" - shift(72), // "{" + shift(73), // "{" nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -2645,7 +2760,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S82 + actionRow{ // S83 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -2653,23 +2768,24 @@ var parserActions = actions{ nil, // tokId nil, // ":" nil, // ";" - shift(76), // regDefId + shift(77), // regDefId nil, // ignoredTokId nil, // "|" - shift(77), // "." - shift(78), // char_lit + shift(78), // "." + shift(79), // char_lit nil, // "-" - shift(79), // "~" - shift(80), // "(" + shift(80), // "~" + shift(81), // "(" nil, // ")" - shift(81), // "[" + shift(82), // "[" nil, // "]" - shift(82), // "{" + shift(83), // "{" nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -2677,7 +2793,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S83 + actionRow{ // S84 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -2702,6 +2818,7 @@ var parserActions = actions{ reduce(8), // prodId, reduce: LexProduction nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -2709,7 +2826,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S84 + actionRow{ // S85 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -2734,6 +2851,7 @@ var parserActions = actions{ reduce(9), // prodId, reduce: LexProduction nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -2741,7 +2859,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S85 + actionRow{ // S86 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -2766,6 +2884,7 @@ var parserActions = actions{ reduce(28), // prodId, reduce: SyntaxProduction nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -2773,7 +2892,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S86 + actionRow{ // S87 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -2798,14 +2917,15 @@ var parserActions = actions{ shift(41), // prodId shift(42), // string_lit nil, // g_ctxdep_lit - shift(43), // "error" - shift(44), // "λ" - shift(45), // "empty" - shift(46), // "ε" + shift(43), // "@" + shift(44), // "error" + shift(45), // "λ" + shift(46), // "empty" + shift(47), // "ε" }, cdActions: []cdAction{}, }, - actionRow{ // S87 + actionRow{ // S88 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -2830,6 +2950,7 @@ var parserActions = actions{ reduce(39), // prodId, reduce: Symbols reduce(39), // string_lit, reduce: Symbols nil, // g_ctxdep_lit + reduce(39), // "@", reduce: Symbols nil, // "error" nil, // "λ" nil, // "empty" @@ -2837,7 +2958,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S88 + actionRow{ // S89 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -2862,6 +2983,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -2869,7 +2991,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S89 + actionRow{ // S90 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -2890,10 +3012,11 @@ var parserActions = actions{ nil, // "]" nil, // "{" nil, // "}" - shift(123), // g_sdt_lit + shift(126), // g_sdt_lit shift(41), // prodId shift(42), // string_lit nil, // g_ctxdep_lit + shift(43), // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -2901,7 +3024,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S90 + actionRow{ // S91 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -2926,6 +3049,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -2933,7 +3057,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S91 + actionRow{ // S92 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -2958,6 +3082,7 @@ var parserActions = actions{ reduce(43), // prodId, reduce: Symbol reduce(43), // string_lit, reduce: Symbol nil, // g_ctxdep_lit + reduce(43), // "@", reduce: Symbol nil, // "error" nil, // "λ" nil, // "empty" @@ -2965,7 +3090,73 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S92 + actionRow{ // S93 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + nil, // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + shift(127), // string_lit + nil, // g_ctxdep_lit + nil, // "@" + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S94 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + reduce(45), // tokId, reduce: Symbol + nil, // ":" + reduce(45), // ";", reduce: Symbol + nil, // regDefId + nil, // ignoredTokId + reduce(45), // "|", reduce: Symbol + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + reduce(45), // g_sdt_lit, reduce: Symbol + reduce(45), // prodId, reduce: Symbol + reduce(45), // string_lit, reduce: Symbol + nil, // g_ctxdep_lit + reduce(45), // "@", reduce: Symbol + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S95 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -2990,6 +3181,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -2997,7 +3189,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S93 + actionRow{ // S96 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3022,6 +3214,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -3029,7 +3222,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S94 + actionRow{ // S97 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3042,7 +3235,7 @@ var parserActions = actions{ nil, // "|" nil, // "." nil, // char_lit - shift(124), // "-" + shift(128), // "-" nil, // "~" nil, // "(" nil, // ")" @@ -3054,6 +3247,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -3061,7 +3255,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S95 + actionRow{ // S98 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3069,23 +3263,24 @@ var parserActions = actions{ nil, // tokId nil, // ":" nil, // ";" - shift(56), // regDefId + shift(57), // regDefId nil, // ignoredTokId nil, // "|" - shift(57), // "." - shift(58), // char_lit + shift(58), // "." + shift(59), // char_lit nil, // "-" - shift(59), // "~" - shift(60), // "(" + shift(60), // "~" + shift(61), // "(" nil, // ")" - shift(61), // "[" + shift(62), // "[" nil, // "]" - shift(62), // "{" + shift(63), // "{" nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -3093,7 +3288,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S96 + actionRow{ // S99 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3118,6 +3313,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -3125,7 +3321,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S97 + actionRow{ // S100 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3150,6 +3346,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -3157,7 +3354,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S98 + actionRow{ // S101 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3169,7 +3366,7 @@ var parserActions = actions{ nil, // ignoredTokId nil, // "|" nil, // "." - shift(126), // char_lit + shift(130), // char_lit nil, // "-" nil, // "~" nil, // "(" @@ -3182,6 +3379,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -3189,7 +3387,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S99 + actionRow{ // S102 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3214,6 +3412,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -3221,7 +3420,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S100 + actionRow{ // S103 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3233,7 +3432,7 @@ var parserActions = actions{ nil, // ignoredTokId nil, // "|" nil, // "." - shift(127), // char_lit + shift(131), // char_lit nil, // "-" nil, // "~" nil, // "(" @@ -3246,6 +3445,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -3253,7 +3453,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S101 + actionRow{ // S104 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3263,13 +3463,13 @@ var parserActions = actions{ nil, // ";" nil, // regDefId nil, // ignoredTokId - shift(95), // "|" + shift(98), // "|" nil, // "." nil, // char_lit nil, // "-" nil, // "~" nil, // "(" - shift(128), // ")" + shift(132), // ")" nil, // "[" nil, // "]" nil, // "{" @@ -3278,6 +3478,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -3285,7 +3486,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S102 + actionRow{ // S105 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3295,7 +3496,7 @@ var parserActions = actions{ nil, // ";" nil, // regDefId nil, // ignoredTokId - shift(104), // "|" + shift(107), // "|" nil, // "." nil, // char_lit nil, // "-" @@ -3303,13 +3504,14 @@ var parserActions = actions{ nil, // "(" nil, // ")" nil, // "[" - shift(129), // "]" + shift(133), // "]" nil, // "{" nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -3317,7 +3519,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S103 + actionRow{ // S106 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3327,7 +3529,7 @@ var parserActions = actions{ nil, // ";" nil, // regDefId nil, // ignoredTokId - shift(113), // "|" + shift(116), // "|" nil, // "." nil, // char_lit nil, // "-" @@ -3337,11 +3539,12 @@ var parserActions = actions{ nil, // "[" nil, // "]" nil, // "{" - shift(130), // "}" + shift(134), // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -3349,7 +3552,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S104 + actionRow{ // S107 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3357,23 +3560,24 @@ var parserActions = actions{ nil, // tokId nil, // ":" nil, // ";" - shift(66), // regDefId + shift(67), // regDefId nil, // ignoredTokId nil, // "|" - shift(67), // "." - shift(68), // char_lit + shift(68), // "." + shift(69), // char_lit nil, // "-" - shift(69), // "~" - shift(70), // "(" + shift(70), // "~" + shift(71), // "(" nil, // ")" - shift(71), // "[" + shift(72), // "[" nil, // "]" - shift(72), // "{" + shift(73), // "{" nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -3381,7 +3585,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S105 + actionRow{ // S108 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3406,6 +3610,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -3413,7 +3618,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S106 + actionRow{ // S109 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3438,6 +3643,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -3445,7 +3651,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S107 + actionRow{ // S110 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3457,7 +3663,7 @@ var parserActions = actions{ nil, // ignoredTokId nil, // "|" nil, // "." - shift(132), // char_lit + shift(136), // char_lit nil, // "-" nil, // "~" nil, // "(" @@ -3470,6 +3676,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -3477,7 +3684,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S108 + actionRow{ // S111 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3502,6 +3709,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -3509,7 +3717,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S109 + actionRow{ // S112 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3521,7 +3729,7 @@ var parserActions = actions{ nil, // ignoredTokId nil, // "|" nil, // "." - shift(133), // char_lit + shift(137), // char_lit nil, // "-" nil, // "~" nil, // "(" @@ -3534,6 +3742,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -3541,7 +3750,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S110 + actionRow{ // S113 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3551,13 +3760,13 @@ var parserActions = actions{ nil, // ";" nil, // regDefId nil, // ignoredTokId - shift(95), // "|" + shift(98), // "|" nil, // "." nil, // char_lit nil, // "-" nil, // "~" nil, // "(" - shift(134), // ")" + shift(138), // ")" nil, // "[" nil, // "]" nil, // "{" @@ -3566,6 +3775,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -3573,7 +3783,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S111 + actionRow{ // S114 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3583,7 +3793,7 @@ var parserActions = actions{ nil, // ";" nil, // regDefId nil, // ignoredTokId - shift(104), // "|" + shift(107), // "|" nil, // "." nil, // char_lit nil, // "-" @@ -3591,13 +3801,14 @@ var parserActions = actions{ nil, // "(" nil, // ")" nil, // "[" - shift(135), // "]" + shift(139), // "]" nil, // "{" nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -3605,7 +3816,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S112 + actionRow{ // S115 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3615,7 +3826,7 @@ var parserActions = actions{ nil, // ";" nil, // regDefId nil, // ignoredTokId - shift(113), // "|" + shift(116), // "|" nil, // "." nil, // char_lit nil, // "-" @@ -3625,11 +3836,12 @@ var parserActions = actions{ nil, // "[" nil, // "]" nil, // "{" - shift(136), // "}" + shift(140), // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -3637,7 +3849,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S113 + actionRow{ // S116 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3645,23 +3857,24 @@ var parserActions = actions{ nil, // tokId nil, // ":" nil, // ";" - shift(76), // regDefId + shift(77), // regDefId nil, // ignoredTokId nil, // "|" - shift(77), // "." - shift(78), // char_lit + shift(78), // "." + shift(79), // char_lit nil, // "-" - shift(79), // "~" - shift(80), // "(" + shift(80), // "~" + shift(81), // "(" nil, // ")" - shift(81), // "[" + shift(82), // "[" nil, // "]" - shift(82), // "{" + shift(83), // "{" nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -3669,7 +3882,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S114 + actionRow{ // S117 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3694,6 +3907,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -3701,7 +3915,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S115 + actionRow{ // S118 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3726,6 +3940,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -3733,7 +3948,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S116 + actionRow{ // S119 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3745,7 +3960,7 @@ var parserActions = actions{ nil, // ignoredTokId nil, // "|" nil, // "." - shift(138), // char_lit + shift(142), // char_lit nil, // "-" nil, // "~" nil, // "(" @@ -3758,6 +3973,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -3765,7 +3981,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S117 + actionRow{ // S120 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3790,6 +4006,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -3797,7 +4014,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S118 + actionRow{ // S121 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3809,7 +4026,7 @@ var parserActions = actions{ nil, // ignoredTokId nil, // "|" nil, // "." - shift(139), // char_lit + shift(143), // char_lit nil, // "-" nil, // "~" nil, // "(" @@ -3822,6 +4039,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -3829,7 +4047,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S119 + actionRow{ // S122 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3839,13 +4057,13 @@ var parserActions = actions{ nil, // ";" nil, // regDefId nil, // ignoredTokId - shift(95), // "|" + shift(98), // "|" nil, // "." nil, // char_lit nil, // "-" nil, // "~" nil, // "(" - shift(140), // ")" + shift(144), // ")" nil, // "[" nil, // "]" nil, // "{" @@ -3854,6 +4072,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -3861,7 +4080,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S120 + actionRow{ // S123 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3871,7 +4090,7 @@ var parserActions = actions{ nil, // ";" nil, // regDefId nil, // ignoredTokId - shift(104), // "|" + shift(107), // "|" nil, // "." nil, // char_lit nil, // "-" @@ -3879,13 +4098,14 @@ var parserActions = actions{ nil, // "(" nil, // ")" nil, // "[" - shift(141), // "]" + shift(145), // "]" nil, // "{" nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -3893,7 +4113,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S121 + actionRow{ // S124 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3903,7 +4123,7 @@ var parserActions = actions{ nil, // ";" nil, // regDefId nil, // ignoredTokId - shift(113), // "|" + shift(116), // "|" nil, // "." nil, // char_lit nil, // "-" @@ -3913,11 +4133,12 @@ var parserActions = actions{ nil, // "[" nil, // "]" nil, // "{" - shift(142), // "}" + shift(146), // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -3925,7 +4146,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S122 + actionRow{ // S125 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3950,6 +4171,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -3957,7 +4179,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S123 + actionRow{ // S126 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3982,6 +4204,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -3989,7 +4212,40 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S124 + actionRow{ // S127 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + reduce(44), // tokId, reduce: Symbol + nil, // ":" + reduce(44), // ";", reduce: Symbol + nil, // regDefId + nil, // ignoredTokId + reduce(44), // "|", reduce: Symbol + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + reduce(44), // g_sdt_lit, reduce: Symbol + reduce(44), // prodId, reduce: Symbol + reduce(44), // string_lit, reduce: Symbol + nil, // g_ctxdep_lit + reduce(44), // "@", reduce: Symbol + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S128 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -4001,7 +4257,7 @@ var parserActions = actions{ nil, // ignoredTokId nil, // "|" nil, // "." - shift(143), // char_lit + shift(147), // char_lit nil, // "-" nil, // "~" nil, // "(" @@ -4014,6 +4270,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -4021,7 +4278,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S125 + actionRow{ // S129 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -4029,23 +4286,24 @@ var parserActions = actions{ nil, // tokId nil, // ":" nil, // ";" - shift(56), // regDefId + shift(57), // regDefId nil, // ignoredTokId reduce(11), // "|", reduce: LexPattern - shift(57), // "." - shift(58), // char_lit + shift(58), // "." + shift(59), // char_lit nil, // "-" - shift(59), // "~" - shift(60), // "(" + shift(60), // "~" + shift(61), // "(" reduce(11), // ")", reduce: LexPattern - shift(61), // "[" + shift(62), // "[" nil, // "]" - shift(62), // "{" + shift(63), // "{" nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -4053,7 +4311,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S126 + actionRow{ // S130 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -4078,6 +4336,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -4085,7 +4344,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S127 + actionRow{ // S131 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -4098,7 +4357,7 @@ var parserActions = actions{ nil, // "|" nil, // "." nil, // char_lit - shift(144), // "-" + shift(148), // "-" nil, // "~" nil, // "(" nil, // ")" @@ -4110,6 +4369,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -4117,7 +4377,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S128 + actionRow{ // S132 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -4142,6 +4402,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -4149,7 +4410,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S129 + actionRow{ // S133 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -4174,6 +4435,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -4181,7 +4443,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S130 + actionRow{ // S134 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -4206,6 +4468,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -4213,7 +4476,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S131 + actionRow{ // S135 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -4221,23 +4484,24 @@ var parserActions = actions{ nil, // tokId nil, // ":" nil, // ";" - shift(66), // regDefId + shift(67), // regDefId nil, // ignoredTokId reduce(11), // "|", reduce: LexPattern - shift(67), // "." - shift(68), // char_lit + shift(68), // "." + shift(69), // char_lit nil, // "-" - shift(69), // "~" - shift(70), // "(" + shift(70), // "~" + shift(71), // "(" nil, // ")" - shift(71), // "[" + shift(72), // "[" reduce(11), // "]", reduce: LexPattern - shift(72), // "{" + shift(73), // "{" nil, // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -4245,7 +4509,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S132 + actionRow{ // S136 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -4270,6 +4534,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -4277,7 +4542,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S133 + actionRow{ // S137 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -4290,7 +4555,7 @@ var parserActions = actions{ nil, // "|" nil, // "." nil, // char_lit - shift(145), // "-" + shift(149), // "-" nil, // "~" nil, // "(" nil, // ")" @@ -4302,6 +4567,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -4309,7 +4575,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S134 + actionRow{ // S138 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -4334,6 +4600,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -4341,7 +4608,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S135 + actionRow{ // S139 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -4366,6 +4633,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -4373,7 +4641,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S136 + actionRow{ // S140 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -4398,6 +4666,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -4405,7 +4674,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S137 + actionRow{ // S141 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -4413,23 +4682,24 @@ var parserActions = actions{ nil, // tokId nil, // ":" nil, // ";" - shift(76), // regDefId + shift(77), // regDefId nil, // ignoredTokId reduce(11), // "|", reduce: LexPattern - shift(77), // "." - shift(78), // char_lit + shift(78), // "." + shift(79), // char_lit nil, // "-" - shift(79), // "~" - shift(80), // "(" + shift(80), // "~" + shift(81), // "(" nil, // ")" - shift(81), // "[" + shift(82), // "[" nil, // "]" - shift(82), // "{" + shift(83), // "{" reduce(11), // "}", reduce: LexPattern nil, // g_sdt_lit nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -4437,7 +4707,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S138 + actionRow{ // S142 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -4462,6 +4732,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -4469,7 +4740,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S139 + actionRow{ // S143 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -4482,7 +4753,7 @@ var parserActions = actions{ nil, // "|" nil, // "." nil, // char_lit - shift(146), // "-" + shift(150), // "-" nil, // "~" nil, // "(" nil, // ")" @@ -4494,6 +4765,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -4501,7 +4773,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S140 + actionRow{ // S144 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -4526,6 +4798,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -4533,7 +4806,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S141 + actionRow{ // S145 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -4558,6 +4831,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -4565,7 +4839,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S142 + actionRow{ // S146 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -4590,6 +4864,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -4597,7 +4872,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S143 + actionRow{ // S147 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -4613,7 +4888,7 @@ var parserActions = actions{ nil, // "-" nil, // "~" nil, // "(" - shift(147), // ")" + shift(151), // ")" nil, // "[" nil, // "]" nil, // "{" @@ -4622,6 +4897,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -4629,7 +4905,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S144 + actionRow{ // S148 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -4641,7 +4917,7 @@ var parserActions = actions{ nil, // ignoredTokId nil, // "|" nil, // "." - shift(148), // char_lit + shift(152), // char_lit nil, // "-" nil, // "~" nil, // "(" @@ -4654,6 +4930,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -4661,7 +4938,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S145 + actionRow{ // S149 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -4673,7 +4950,7 @@ var parserActions = actions{ nil, // ignoredTokId nil, // "|" nil, // "." - shift(149), // char_lit + shift(153), // char_lit nil, // "-" nil, // "~" nil, // "(" @@ -4686,6 +4963,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -4693,7 +4971,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S146 + actionRow{ // S150 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -4705,7 +4983,7 @@ var parserActions = actions{ nil, // ignoredTokId nil, // "|" nil, // "." - shift(150), // char_lit + shift(154), // char_lit nil, // "-" nil, // "~" nil, // "(" @@ -4718,6 +4996,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -4725,7 +5004,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S147 + actionRow{ // S151 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -4750,6 +5029,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -4757,7 +5037,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S148 + actionRow{ // S152 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -4773,7 +5053,7 @@ var parserActions = actions{ nil, // "-" nil, // "~" nil, // "(" - shift(151), // ")" + shift(155), // ")" nil, // "[" nil, // "]" nil, // "{" @@ -4782,6 +5062,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -4789,7 +5070,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S149 + actionRow{ // S153 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -4805,7 +5086,7 @@ var parserActions = actions{ nil, // "-" nil, // "~" nil, // "(" - shift(152), // ")" + shift(156), // ")" nil, // "[" nil, // "]" nil, // "{" @@ -4814,6 +5095,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -4821,7 +5103,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S150 + actionRow{ // S154 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -4837,7 +5119,7 @@ var parserActions = actions{ nil, // "-" nil, // "~" nil, // "(" - shift(153), // ")" + shift(157), // ")" nil, // "[" nil, // "]" nil, // "{" @@ -4846,6 +5128,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -4853,7 +5136,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S151 + actionRow{ // S155 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -4878,6 +5161,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -4885,7 +5169,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S152 + actionRow{ // S156 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -4910,6 +5194,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -4917,7 +5202,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S153 + actionRow{ // S157 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -4942,6 +5227,7 @@ var parserActions = actions{ nil, // prodId nil, // string_lit nil, // g_ctxdep_lit + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" diff --git a/internal/frontend/reparsed/internal/parser/gototable.go b/internal/frontend/reparsed/internal/parser/gototable.go index 862fb55c..bae50df7 100644 --- a/internal/frontend/reparsed/internal/parser/gototable.go +++ b/internal/frontend/reparsed/internal/parser/gototable.go @@ -479,7 +479,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 49, // Π + 50, // Π -1, // Π -1, // Π -1, // Π @@ -597,9 +597,9 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 53, // Π - 54, // Π - 55, // Π + 54, // Π + 55, // Π + 56, // Π -1, // Π -1, // Π -1, // Π @@ -617,9 +617,9 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 63, // Π - 64, // Π - 65, // Π + 64, // Π + 65, // Π + 66, // Π -1, // Π -1, // Π -1, // Π @@ -637,9 +637,9 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 73, // Π - 74, // Π - 75, // Π + 74, // Π + 75, // Π + 76, // Π -1, // Π -1, // Π -1, // Π @@ -748,7 +748,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 87, // Π + 88, // Π }, gotoRow{ // S37 -1, // Π @@ -765,7 +765,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 89, // Π + 90, // Π -1, // Π -1, // Π 39, // Π @@ -978,8 +978,8 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 92, // Π - 24, // Π + -1, // Π + -1, // Π -1, // Π -1, // Π -1, // Π @@ -998,8 +998,8 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - -1, // Π - -1, // Π + 95, // Π + 24, // Π -1, // Π -1, // Π -1, // Π @@ -1099,7 +1099,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 97, // Π + -1, // Π -1, // Π -1, // Π -1, // Π @@ -1119,7 +1119,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - -1, // Π + 100, // Π -1, // Π -1, // Π -1, // Π @@ -1217,9 +1217,9 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 101, // Π - 54, // Π - 55, // Π + -1, // Π + -1, // Π + -1, // Π -1, // Π -1, // Π -1, // Π @@ -1237,9 +1237,9 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 102, // Π - 64, // Π - 65, // Π + 104, // Π + 55, // Π + 56, // Π -1, // Π -1, // Π -1, // Π @@ -1257,9 +1257,9 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 103, // Π - 74, // Π - 75, // Π + 105, // Π + 65, // Π + 66, // Π -1, // Π -1, // Π -1, // Π @@ -1277,9 +1277,9 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - -1, // Π - -1, // Π - -1, // Π + 106, // Π + 75, // Π + 76, // Π -1, // Π -1, // Π -1, // Π @@ -1299,7 +1299,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 106, // Π + -1, // Π -1, // Π -1, // Π -1, // Π @@ -1319,7 +1319,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - -1, // Π + 109, // Π -1, // Π -1, // Π -1, // Π @@ -1417,9 +1417,9 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 110, // Π - 54, // Π - 55, // Π + -1, // Π + -1, // Π + -1, // Π -1, // Π -1, // Π -1, // Π @@ -1437,9 +1437,9 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 111, // Π - 64, // Π - 65, // Π + 113, // Π + 55, // Π + 56, // Π -1, // Π -1, // Π -1, // Π @@ -1457,9 +1457,9 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 112, // Π - 74, // Π - 75, // Π + 114, // Π + 65, // Π + 66, // Π -1, // Π -1, // Π -1, // Π @@ -1477,9 +1477,9 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - -1, // Π - -1, // Π - -1, // Π + 115, // Π + 75, // Π + 76, // Π -1, // Π -1, // Π -1, // Π @@ -1499,7 +1499,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 115, // Π + -1, // Π -1, // Π -1, // Π -1, // Π @@ -1519,7 +1519,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - -1, // Π + 118, // Π -1, // Π -1, // Π -1, // Π @@ -1617,9 +1617,9 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 119, // Π - 54, // Π - 55, // Π + -1, // Π + -1, // Π + -1, // Π -1, // Π -1, // Π -1, // Π @@ -1637,9 +1637,9 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 120, // Π - 64, // Π - 65, // Π + 122, // Π + 55, // Π + 56, // Π -1, // Π -1, // Π -1, // Π @@ -1657,9 +1657,9 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 121, // Π - 74, // Π - 75, // Π + 123, // Π + 65, // Π + 66, // Π -1, // Π -1, // Π -1, // Π @@ -1677,9 +1677,9 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - -1, // Π - -1, // Π - -1, // Π + 124, // Π + 75, // Π + 76, // Π -1, // Π -1, // Π -1, // Π @@ -1744,11 +1744,11 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 122, // Π - 36, // Π - 37, // Π - 38, // Π - 39, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S87 -1, // Π @@ -1764,11 +1764,11 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π - -1, // Π + 125, // Π + 36, // Π + 37, // Π + 38, // Π + 39, // Π }, gotoRow{ // S88 -1, // Π @@ -1808,7 +1808,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 87, // Π + -1, // Π }, gotoRow{ // S90 -1, // Π @@ -1828,7 +1828,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - -1, // Π + 88, // Π }, gotoRow{ // S91 -1, // Π @@ -1859,7 +1859,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 49, // Π + -1, // Π -1, // Π -1, // Π -1, // Π @@ -1918,8 +1918,8 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 125, // Π - 55, // Π + -1, // Π + 50, // Π -1, // Π -1, // Π -1, // Π @@ -1978,8 +1978,8 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - -1, // Π - -1, // Π + 129, // Π + 56, // Π -1, // Π -1, // Π -1, // Π @@ -2098,8 +2098,8 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 131, // Π - 65, // Π + -1, // Π + -1, // Π -1, // Π -1, // Π -1, // Π @@ -2158,8 +2158,8 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - -1, // Π - -1, // Π + 135, // Π + 66, // Π -1, // Π -1, // Π -1, // Π @@ -2278,8 +2278,8 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 137, // Π - 75, // Π + -1, // Π + -1, // Π -1, // Π -1, // Π -1, // Π @@ -2338,8 +2338,8 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - -1, // Π - -1, // Π + 141, // Π + 76, // Π -1, // Π -1, // Π -1, // Π @@ -2519,7 +2519,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 97, // Π + -1, // Π -1, // Π -1, // Π -1, // Π @@ -2599,7 +2599,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - -1, // Π + 100, // Π -1, // Π -1, // Π -1, // Π @@ -2639,7 +2639,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 106, // Π + -1, // Π -1, // Π -1, // Π -1, // Π @@ -2719,7 +2719,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - -1, // Π + 109, // Π -1, // Π -1, // Π -1, // Π @@ -2759,7 +2759,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 115, // Π + -1, // Π -1, // Π -1, // Π -1, // Π @@ -2839,7 +2839,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - -1, // Π + 118, // Π -1, // Π -1, // Π -1, // Π @@ -3090,4 +3090,84 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, + gotoRow{ // S154 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S155 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S156 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S157 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, } diff --git a/internal/frontend/reparsed/internal/parser/parser.go b/internal/frontend/reparsed/internal/parser/parser.go index 746faa1e..dc3832d2 100644 --- a/internal/frontend/reparsed/internal/parser/parser.go +++ b/internal/frontend/reparsed/internal/parser/parser.go @@ -13,9 +13,9 @@ import ( ) const ( - numProductions = 48 - numStates = 154 - numSymbols = 44 + numProductions = 50 + numStates = 158 + numSymbols = 45 ) // Stack @@ -255,12 +255,12 @@ func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, er for _, cdAction := range parserActions.table[p.stack.top()].cdActions { tokens.GotoCheckPoint(checkPoint) cd_res, cd_err, cd_parsed := cdAction.tokenScanner(underlyingStream, p.userContext) - if cd_err == nil && len(cd_parsed) > 0 { + if cd_err == nil && cd_parsed > 0 { action = parserActions.table[p.stack.top()].actions[cdAction.tokenIndex] if action != nil { p.nextToken.Foreign = true p.nextToken.ForeignAstNode = cd_res - p.nextToken.Lit = cd_parsed + p.nextToken.Lit = []byte{} p.nextToken.Type = token.Type(cdAction.tokenIndex) break } diff --git a/internal/frontend/reparsed/internal/parser/productionstable.go b/internal/frontend/reparsed/internal/parser/productionstable.go index a1baabc2..6bdf5418 100644 --- a/internal/frontend/reparsed/internal/parser/productionstable.go +++ b/internal/frontend/reparsed/internal/parser/productionstable.go @@ -460,11 +460,31 @@ var productionsTable = ProdTab{ return ast.NewContextDependentTokId(X[0], X[1]) }, }, + ProdTabEntry{ + String: `Symbol : Λ<@> tokId string_lit << ast.NewAliasedSubParser(X[1],X[2]) >>`, + Id: "Symbol", + NTType: 17, + Index: 44, + NumSymbols: 3, + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { + return ast.NewAliasedSubParser(X[1], X[2]) + }, + }, + ProdTabEntry{ + String: `Symbol : Λ<@> string_lit << ast.NewSubParser(X[1]) >>`, + Id: "Symbol", + NTType: 17, + Index: 45, + NumSymbols: 2, + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { + return ast.NewSubParser(X[1]) + }, + }, ProdTabEntry{ String: `ErrorSymbol : Λ << >>`, Id: "ErrorSymbol", NTType: 15, - Index: 44, + Index: 46, NumSymbols: 1, ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { return X[0], nil @@ -474,7 +494,7 @@ var productionsTable = ProdTab{ String: `ErrorSymbol : Λ<λ> << >>`, Id: "ErrorSymbol", NTType: 15, - Index: 45, + Index: 47, NumSymbols: 1, ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { return X[0], nil @@ -484,7 +504,7 @@ var productionsTable = ProdTab{ String: `EpsilonSymbol : Λ << >>`, Id: "EpsilonSymbol", NTType: 16, - Index: 46, + Index: 48, NumSymbols: 1, ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { return X[0], nil @@ -494,7 +514,7 @@ var productionsTable = ProdTab{ String: `EpsilonSymbol : Λ<ε> << >>`, Id: "EpsilonSymbol", NTType: 16, - Index: 47, + Index: 49, NumSymbols: 1, ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { return X[0], nil diff --git a/internal/frontend/reparsed/internal/token/token.go b/internal/frontend/reparsed/internal/token/token.go index 8ae4f88b..76cf5a61 100644 --- a/internal/frontend/reparsed/internal/token/token.go +++ b/internal/frontend/reparsed/internal/token/token.go @@ -97,6 +97,7 @@ var TokMap = TokenMap{ "prodId", "string_lit", "g_ctxdep_lit", + "Λ<@>", "Λ", "Λ<λ>", "Λ", @@ -126,28 +127,30 @@ var TokMap = TokenMap{ "prodId": 19, "string_lit": 20, "g_ctxdep_lit": 21, - "Λ": 22, - "Λ<λ>": 23, - "Λ": 24, - "Λ<ε>": 25, + "Λ<@>": 22, + "Λ": 23, + "Λ<λ>": 24, + "Λ": 25, + "Λ<ε>": 26, }, litMap: map[string]Type{ - "empty": 24, - "ε": 25, - ".": 8, - ")": 13, - "error": 22, - "λ": 23, - ";": 4, "}": 17, - "~": 11, - "[": 14, - "]": 15, - "{": 16, + "ε": 26, + "λ": 24, + "empty": 25, ":": 3, + ";": 4, "|": 7, "-": 10, + ")": 13, + "[": 14, + ".": 8, + "~": 11, + "]": 15, "(": 12, + "{": 16, + "@": 22, + "error": 23, }, } diff --git a/internal/frontend/reparsed/log/LR1_sets.txt b/internal/frontend/reparsed/log/LR1_sets.txt index 39ef77dc..382d4d28 100644 --- a/internal/frontend/reparsed/log/LR1_sets.txt +++ b/internal/frontend/reparsed/log/LR1_sets.txt @@ -655,9 +655,11 @@ S21{ Symbols : •Π Π «g_sdt_lit» ErrorSymbol : •Λ «";"» ErrorSymbol : •Λ<λ> «";"» + ErrorSymbol : •Λ «"@"» ErrorSymbol : •Λ «prodId» ErrorSymbol : •Λ «string_lit» ErrorSymbol : •Λ «tokId» + ErrorSymbol : •Λ<λ> «"@"» ErrorSymbol : •Λ<λ> «prodId» ErrorSymbol : •Λ<λ> «string_lit» ErrorSymbol : •Λ<λ> «tokId» @@ -676,9 +678,13 @@ S21{ Symbol : •tokId «";"» Symbol : •string_lit «";"» Symbol : •tokId g_ctxdep_lit «";"» + Symbol : •Λ<@> tokId string_lit «";"» + Symbol : •Λ<@> string_lit «";"» + Symbols : •Π «"@"» Symbols : •Π «prodId» Symbols : •Π «string_lit» Symbols : •Π «tokId» + Symbols : •Π Π «"@"» Symbols : •Π Π «prodId» Symbols : •Π Π «string_lit» Symbols : •Π Π «tokId» @@ -686,28 +692,44 @@ S21{ Symbol : •tokId «g_sdt_lit» Symbol : •string_lit «g_sdt_lit» Symbol : •tokId g_ctxdep_lit «g_sdt_lit» + Symbol : •Λ<@> tokId string_lit «g_sdt_lit» + Symbol : •Λ<@> string_lit «g_sdt_lit» Symbols : •Π «"|"» Symbols : •Π Π «"|"» ErrorSymbol : •Λ «"|"» ErrorSymbol : •Λ<λ> «"|"» EpsilonSymbol : •Λ «"|"» EpsilonSymbol : •Λ<ε> «"|"» + Symbol : •prodId «"@"» + Symbol : •tokId «"@"» + Symbol : •string_lit «"@"» + Symbol : •tokId g_ctxdep_lit «"@"» + Symbol : •Λ<@> tokId string_lit «"@"» + Symbol : •Λ<@> string_lit «"@"» Symbol : •prodId «prodId» Symbol : •tokId «prodId» Symbol : •string_lit «prodId» Symbol : •tokId g_ctxdep_lit «prodId» + Symbol : •Λ<@> tokId string_lit «prodId» + Symbol : •Λ<@> string_lit «prodId» Symbol : •prodId «string_lit» Symbol : •tokId «string_lit» Symbol : •string_lit «string_lit» Symbol : •tokId g_ctxdep_lit «string_lit» + Symbol : •Λ<@> tokId string_lit «string_lit» + Symbol : •Λ<@> string_lit «string_lit» Symbol : •prodId «tokId» Symbol : •tokId «tokId» Symbol : •string_lit «tokId» Symbol : •tokId g_ctxdep_lit «tokId» + Symbol : •Λ<@> tokId string_lit «tokId» + Symbol : •Λ<@> string_lit «tokId» Symbol : •prodId «"|"» Symbol : •tokId «"|"» Symbol : •string_lit «"|"» Symbol : •tokId g_ctxdep_lit «"|"» + Symbol : •Λ<@> tokId string_lit «"|"» + Symbol : •Λ<@> string_lit «"|"» } Transitions: Π -> 34 @@ -719,10 +741,11 @@ Transitions: tokId -> 40 prodId -> 41 string_lit -> 42 - Λ -> 43 - Λ<λ> -> 44 - Λ -> 45 - Λ<ε> -> 46 + Λ<@> -> 43 + Λ -> 44 + Λ<λ> -> 45 + Λ -> 46 + Λ<ε> -> 47 S22{ @@ -736,8 +759,8 @@ S22{ LexPattern : Π •Λ<|> Π «"|"» } Transitions: - Λ<;> -> 47 - Λ<|> -> 48 + Λ<;> -> 48 + Λ<|> -> 49 S23{ @@ -842,7 +865,7 @@ Transitions: Λ<(> -> 29 Λ<[> -> 30 Λ<{> -> 31 - Π -> 49 + Π -> 50 S24{ @@ -908,7 +931,7 @@ S27{ LexTerm : char_lit •Λ<-> char_lit «"|"» } Transitions: - Λ<-> -> 50 + Λ<-> -> 51 S28{ @@ -932,8 +955,8 @@ S28{ LexTerm : Λ<~> •Λ<(> char_lit Λ<-> char_lit Λ<)> «"|"» } Transitions: - char_lit -> 51 - Λ<(> -> 52 + char_lit -> 52 + Λ<(> -> 53 S29{ @@ -1051,16 +1074,16 @@ S29{ LexTerm : •Λ<(> Π Λ<)> «"|"» } Transitions: - Π -> 53 - Π -> 54 - Π -> 55 - regDefId -> 56 - Λ<.> -> 57 - char_lit -> 58 - Λ<~> -> 59 - Λ<(> -> 60 - Λ<[> -> 61 - Λ<{> -> 62 + Π -> 54 + Π -> 55 + Π -> 56 + regDefId -> 57 + Λ<.> -> 58 + char_lit -> 59 + Λ<~> -> 60 + Λ<(> -> 61 + Λ<[> -> 62 + Λ<{> -> 63 S30{ @@ -1178,16 +1201,16 @@ S30{ LexTerm : •Λ<(> Π Λ<)> «"|"» } Transitions: - Π -> 63 - Π -> 64 - Π -> 65 - regDefId -> 66 - Λ<.> -> 67 - char_lit -> 68 - Λ<~> -> 69 - Λ<(> -> 70 - Λ<[> -> 71 - Λ<{> -> 72 + Π -> 64 + Π -> 65 + Π -> 66 + regDefId -> 67 + Λ<.> -> 68 + char_lit -> 69 + Λ<~> -> 70 + Λ<(> -> 71 + Λ<[> -> 72 + Λ<{> -> 73 S31{ @@ -1305,16 +1328,16 @@ S31{ LexTerm : •Λ<(> Π Λ<)> «"|"» } Transitions: - Π -> 73 - Π -> 74 - Π -> 75 - regDefId -> 76 - Λ<.> -> 77 - char_lit -> 78 - Λ<~> -> 79 - Λ<(> -> 80 - Λ<[> -> 81 - Λ<{> -> 82 + Π -> 74 + Π -> 75 + Π -> 76 + regDefId -> 77 + Λ<.> -> 78 + char_lit -> 79 + Λ<~> -> 80 + Λ<(> -> 81 + Λ<[> -> 82 + Λ<{> -> 83 S32{ @@ -1328,8 +1351,8 @@ S32{ LexPattern : Π •Λ<|> Π «"|"» } Transitions: - Λ<|> -> 48 - Λ<;> -> 83 + Λ<|> -> 49 + Λ<;> -> 84 S33{ @@ -1343,8 +1366,8 @@ S33{ LexPattern : Π •Λ<|> Π «"|"» } Transitions: - Λ<|> -> 48 - Λ<;> -> 84 + Λ<|> -> 49 + Λ<;> -> 85 S34{ @@ -1354,8 +1377,8 @@ S34{ Alternatives : Π •Λ<|> Π «"|"» } Transitions: - Λ<;> -> 85 - Λ<|> -> 86 + Λ<;> -> 86 + Λ<|> -> 87 S35{ @@ -1372,6 +1395,7 @@ S36{ Symbols : Π •Π «g_sdt_lit» SyntaxBody : Π• «"|"» SyntaxBody : Π •g_sdt_lit «"|"» + Symbols : Π •Π «"@"» Symbols : Π •Π «prodId» Symbols : Π •Π «string_lit» Symbols : Π •Π «tokId» @@ -1380,33 +1404,52 @@ S36{ Symbol : •tokId «";"» Symbol : •string_lit «";"» Symbol : •tokId g_ctxdep_lit «";"» + Symbol : •Λ<@> tokId string_lit «";"» + Symbol : •Λ<@> string_lit «";"» Symbol : •prodId «g_sdt_lit» Symbol : •tokId «g_sdt_lit» Symbol : •string_lit «g_sdt_lit» Symbol : •tokId g_ctxdep_lit «g_sdt_lit» + Symbol : •Λ<@> tokId string_lit «g_sdt_lit» + Symbol : •Λ<@> string_lit «g_sdt_lit» + Symbol : •prodId «"@"» + Symbol : •tokId «"@"» + Symbol : •string_lit «"@"» + Symbol : •tokId g_ctxdep_lit «"@"» + Symbol : •Λ<@> tokId string_lit «"@"» + Symbol : •Λ<@> string_lit «"@"» Symbol : •prodId «prodId» Symbol : •tokId «prodId» Symbol : •string_lit «prodId» Symbol : •tokId g_ctxdep_lit «prodId» + Symbol : •Λ<@> tokId string_lit «prodId» + Symbol : •Λ<@> string_lit «prodId» Symbol : •prodId «string_lit» Symbol : •tokId «string_lit» Symbol : •string_lit «string_lit» Symbol : •tokId g_ctxdep_lit «string_lit» + Symbol : •Λ<@> tokId string_lit «string_lit» + Symbol : •Λ<@> string_lit «string_lit» Symbol : •prodId «tokId» Symbol : •tokId «tokId» Symbol : •string_lit «tokId» Symbol : •tokId g_ctxdep_lit «tokId» + Symbol : •Λ<@> tokId string_lit «tokId» + Symbol : •Λ<@> string_lit «tokId» Symbol : •prodId «"|"» Symbol : •tokId «"|"» Symbol : •string_lit «"|"» Symbol : •tokId g_ctxdep_lit «"|"» + Symbol : •Λ<@> tokId string_lit «"|"» + Symbol : •Λ<@> string_lit «"|"» } Transitions: tokId -> 40 prodId -> 41 string_lit -> 42 - Π -> 87 - g_sdt_lit -> 88 + Λ<@> -> 43 + Π -> 88 + g_sdt_lit -> 89 S37{ @@ -1428,9 +1471,13 @@ S37{ Symbol : •tokId «";"» Symbol : •string_lit «";"» Symbol : •tokId g_ctxdep_lit «";"» + Symbol : •Λ<@> tokId string_lit «";"» + Symbol : •Λ<@> string_lit «";"» + Symbols : •Π «"@"» Symbols : •Π «prodId» Symbols : •Π «string_lit» Symbols : •Π «tokId» + Symbols : •Π Π «"@"» Symbols : •Π Π «prodId» Symbols : •Π Π «string_lit» Symbols : •Π Π «tokId» @@ -1438,30 +1485,47 @@ S37{ Symbol : •tokId «g_sdt_lit» Symbol : •string_lit «g_sdt_lit» Symbol : •tokId g_ctxdep_lit «g_sdt_lit» + Symbol : •Λ<@> tokId string_lit «g_sdt_lit» + Symbol : •Λ<@> string_lit «g_sdt_lit» Symbol : •prodId «"|"» Symbol : •tokId «"|"» Symbol : •string_lit «"|"» Symbol : •tokId g_ctxdep_lit «"|"» + Symbol : •Λ<@> tokId string_lit «"|"» + Symbol : •Λ<@> string_lit «"|"» + Symbol : •prodId «"@"» + Symbol : •tokId «"@"» + Symbol : •string_lit «"@"» + Symbol : •tokId g_ctxdep_lit «"@"» + Symbol : •Λ<@> tokId string_lit «"@"» + Symbol : •Λ<@> string_lit «"@"» Symbol : •prodId «prodId» Symbol : •tokId «prodId» Symbol : •string_lit «prodId» Symbol : •tokId g_ctxdep_lit «prodId» + Symbol : •Λ<@> tokId string_lit «prodId» + Symbol : •Λ<@> string_lit «prodId» Symbol : •prodId «string_lit» Symbol : •tokId «string_lit» Symbol : •string_lit «string_lit» Symbol : •tokId g_ctxdep_lit «string_lit» + Symbol : •Λ<@> tokId string_lit «string_lit» + Symbol : •Λ<@> string_lit «string_lit» Symbol : •prodId «tokId» Symbol : •tokId «tokId» Symbol : •string_lit «tokId» Symbol : •tokId g_ctxdep_lit «tokId» + Symbol : •Λ<@> tokId string_lit «tokId» + Symbol : •Λ<@> string_lit «tokId» } Transitions: Π -> 39 tokId -> 40 prodId -> 41 string_lit -> 42 - Π -> 89 - g_sdt_lit -> 90 + Λ<@> -> 43 + Π -> 90 + g_sdt_lit -> 91 S38{ @@ -1474,6 +1538,7 @@ Transitions: S39{ Symbols : Π• «";"» Symbols : Π• «g_sdt_lit» + Symbols : Π• «"@"» Symbols : Π• «prodId» Symbols : Π• «string_lit» Symbols : Π• «tokId» @@ -1487,6 +1552,8 @@ S40{ Symbol : tokId •g_ctxdep_lit «";"» Symbol : tokId• «g_sdt_lit» Symbol : tokId •g_ctxdep_lit «g_sdt_lit» + Symbol : tokId• «"@"» + Symbol : tokId •g_ctxdep_lit «"@"» Symbol : tokId• «prodId» Symbol : tokId •g_ctxdep_lit «prodId» Symbol : tokId• «string_lit» @@ -1497,12 +1564,13 @@ S40{ Symbol : tokId •g_ctxdep_lit «"|"» } Transitions: - g_ctxdep_lit -> 91 + g_ctxdep_lit -> 92 S41{ Symbol : prodId• «";"» Symbol : prodId• «g_sdt_lit» + Symbol : prodId• «"@"» Symbol : prodId• «prodId» Symbol : prodId• «string_lit» Symbol : prodId• «tokId» @@ -1514,6 +1582,7 @@ Transitions: S42{ Symbol : string_lit• «";"» Symbol : string_lit• «g_sdt_lit» + Symbol : string_lit• «"@"» Symbol : string_lit• «prodId» Symbol : string_lit• «string_lit» Symbol : string_lit• «tokId» @@ -1523,7 +1592,29 @@ Transitions: S43{ + Symbol : Λ<@> •tokId string_lit «";"» + Symbol : Λ<@> •string_lit «";"» + Symbol : Λ<@> •tokId string_lit «g_sdt_lit» + Symbol : Λ<@> •string_lit «g_sdt_lit» + Symbol : Λ<@> •tokId string_lit «"@"» + Symbol : Λ<@> •string_lit «"@"» + Symbol : Λ<@> •tokId string_lit «prodId» + Symbol : Λ<@> •string_lit «prodId» + Symbol : Λ<@> •tokId string_lit «string_lit» + Symbol : Λ<@> •string_lit «string_lit» + Symbol : Λ<@> •tokId string_lit «tokId» + Symbol : Λ<@> •string_lit «tokId» + Symbol : Λ<@> •tokId string_lit «"|"» + Symbol : Λ<@> •string_lit «"|"» +} +Transitions: + tokId -> 93 + string_lit -> 94 + + +S44{ ErrorSymbol : Λ• «";"» + ErrorSymbol : Λ• «"@"» ErrorSymbol : Λ• «prodId» ErrorSymbol : Λ• «string_lit» ErrorSymbol : Λ• «tokId» @@ -1533,8 +1624,9 @@ S43{ Transitions: -S44{ +S45{ ErrorSymbol : Λ<λ>• «";"» + ErrorSymbol : Λ<λ>• «"@"» ErrorSymbol : Λ<λ>• «prodId» ErrorSymbol : Λ<λ>• «string_lit» ErrorSymbol : Λ<λ>• «tokId» @@ -1544,21 +1636,21 @@ S44{ Transitions: -S45{ +S46{ EpsilonSymbol : Λ• «";"» EpsilonSymbol : Λ• «"|"» } Transitions: -S46{ +S47{ EpsilonSymbol : Λ<ε>• «";"» EpsilonSymbol : Λ<ε>• «"|"» } Transitions: -S47{ +S48{ LexProduction : tokId Λ<:> Π Λ<;>• «g_sdt_lit» LexProduction : tokId Λ<:> Π Λ<;>• «prodId» LexProduction : tokId Λ<:> Π Λ<;>• «Ω» @@ -1569,7 +1661,7 @@ S47{ Transitions: -S48{ +S49{ LexPattern : Π Λ<|> •Π «";"» LexPattern : Π Λ<|> •Π «"|"» LexAlt : •Π «";"» @@ -1681,10 +1773,10 @@ Transitions: Λ<(> -> 29 Λ<[> -> 30 Λ<{> -> 31 - Π -> 92 + Π -> 95 -S49{ +S50{ LexAlt : Π Π• «";"» LexAlt : Π Π• «"("» LexAlt : Π Π• «"."» @@ -1698,7 +1790,7 @@ S49{ Transitions: -S50{ +S51{ LexTerm : char_lit Λ<-> •char_lit «";"» LexTerm : char_lit Λ<-> •char_lit «"("» LexTerm : char_lit Λ<-> •char_lit «"."» @@ -1710,10 +1802,10 @@ S50{ LexTerm : char_lit Λ<-> •char_lit «"|"» } Transitions: - char_lit -> 93 + char_lit -> 96 -S51{ +S52{ LexTerm : Λ<~> char_lit• «";"» LexTerm : Λ<~> char_lit• «"("» LexTerm : Λ<~> char_lit• «"."» @@ -1727,7 +1819,7 @@ S51{ Transitions: -S52{ +S53{ LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «";"» LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «"("» LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «"."» @@ -1739,10 +1831,10 @@ S52{ LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «"|"» } Transitions: - char_lit -> 94 + char_lit -> 97 -S53{ +S54{ LexTerm : Λ<(> Π •Λ<)> «";"» LexTerm : Λ<(> Π •Λ<)> «"("» LexTerm : Λ<(> Π •Λ<)> «"."» @@ -1756,11 +1848,11 @@ S53{ LexPattern : Π •Λ<|> Π «"|"» } Transitions: - Λ<|> -> 95 - Λ<)> -> 96 + Λ<|> -> 98 + Λ<)> -> 99 -S54{ +S55{ LexPattern : Π• «")"» LexAlt : Π •Π «")"» LexPattern : Π• «"|"» @@ -1855,17 +1947,17 @@ S54{ LexTerm : •Λ<(> Π Λ<)> «"|"» } Transitions: - regDefId -> 56 - Λ<.> -> 57 - char_lit -> 58 - Λ<~> -> 59 - Λ<(> -> 60 - Λ<[> -> 61 - Λ<{> -> 62 - Π -> 97 + regDefId -> 57 + Λ<.> -> 58 + char_lit -> 59 + Λ<~> -> 60 + Λ<(> -> 61 + Λ<[> -> 62 + Λ<{> -> 63 + Π -> 100 -S55{ +S56{ LexAlt : Π• «")"» LexAlt : Π• «"("» LexAlt : Π• «"."» @@ -1879,7 +1971,7 @@ S55{ Transitions: -S56{ +S57{ LexTerm : regDefId• «")"» LexTerm : regDefId• «"("» LexTerm : regDefId• «"."» @@ -1893,7 +1985,7 @@ S56{ Transitions: -S57{ +S58{ LexTerm : Λ<.>• «")"» LexTerm : Λ<.>• «"("» LexTerm : Λ<.>• «"."» @@ -1907,7 +1999,7 @@ S57{ Transitions: -S58{ +S59{ LexTerm : char_lit• «")"» LexTerm : char_lit •Λ<-> char_lit «")"» LexTerm : char_lit• «"("» @@ -1928,10 +2020,10 @@ S58{ LexTerm : char_lit •Λ<-> char_lit «"|"» } Transitions: - Λ<-> -> 98 + Λ<-> -> 101 -S59{ +S60{ LexTerm : Λ<~> •char_lit «")"» LexTerm : Λ<~> •Λ<(> char_lit Λ<-> char_lit Λ<)> «")"» LexTerm : Λ<~> •char_lit «"("» @@ -1952,11 +2044,11 @@ S59{ LexTerm : Λ<~> •Λ<(> char_lit Λ<-> char_lit Λ<)> «"|"» } Transitions: - char_lit -> 99 - Λ<(> -> 100 + char_lit -> 102 + Λ<(> -> 103 -S60{ +S61{ LexTerm : Λ<(> •Π Λ<)> «")"» LexTerm : Λ<(> •Π Λ<)> «"("» LexTerm : Λ<(> •Π Λ<)> «"."» @@ -2071,19 +2163,19 @@ S60{ LexTerm : •Λ<(> Π Λ<)> «"|"» } Transitions: - Π -> 54 - Π -> 55 - regDefId -> 56 - Λ<.> -> 57 - char_lit -> 58 - Λ<~> -> 59 - Λ<(> -> 60 - Λ<[> -> 61 - Λ<{> -> 62 - Π -> 101 + Π -> 55 + Π -> 56 + regDefId -> 57 + Λ<.> -> 58 + char_lit -> 59 + Λ<~> -> 60 + Λ<(> -> 61 + Λ<[> -> 62 + Λ<{> -> 63 + Π -> 104 -S61{ +S62{ LexTerm : Λ<[> •Π Λ<]> «")"» LexTerm : Λ<[> •Π Λ<]> «"("» LexTerm : Λ<[> •Π Λ<]> «"."» @@ -2198,19 +2290,19 @@ S61{ LexTerm : •Λ<(> Π Λ<)> «"|"» } Transitions: - Π -> 64 - Π -> 65 - regDefId -> 66 - Λ<.> -> 67 - char_lit -> 68 - Λ<~> -> 69 - Λ<(> -> 70 - Λ<[> -> 71 - Λ<{> -> 72 - Π -> 102 + Π -> 65 + Π -> 66 + regDefId -> 67 + Λ<.> -> 68 + char_lit -> 69 + Λ<~> -> 70 + Λ<(> -> 71 + Λ<[> -> 72 + Λ<{> -> 73 + Π -> 105 -S62{ +S63{ LexTerm : Λ<{> •Π Λ<}> «")"» LexTerm : Λ<{> •Π Λ<}> «"("» LexTerm : Λ<{> •Π Λ<}> «"."» @@ -2325,19 +2417,19 @@ S62{ LexTerm : •Λ<(> Π Λ<)> «"|"» } Transitions: - Π -> 74 - Π -> 75 - regDefId -> 76 - Λ<.> -> 77 - char_lit -> 78 - Λ<~> -> 79 - Λ<(> -> 80 - Λ<[> -> 81 - Λ<{> -> 82 - Π -> 103 + Π -> 75 + Π -> 76 + regDefId -> 77 + Λ<.> -> 78 + char_lit -> 79 + Λ<~> -> 80 + Λ<(> -> 81 + Λ<[> -> 82 + Λ<{> -> 83 + Π -> 106 -S63{ +S64{ LexTerm : Λ<[> Π •Λ<]> «";"» LexTerm : Λ<[> Π •Λ<]> «"("» LexTerm : Λ<[> Π •Λ<]> «"."» @@ -2351,11 +2443,11 @@ S63{ LexPattern : Π •Λ<|> Π «"|"» } Transitions: - Λ<|> -> 104 - Λ<]> -> 105 + Λ<|> -> 107 + Λ<]> -> 108 -S64{ +S65{ LexPattern : Π• «"]"» LexAlt : Π •Π «"]"» LexPattern : Π• «"|"» @@ -2450,17 +2542,17 @@ S64{ LexTerm : •Λ<(> Π Λ<)> «"|"» } Transitions: - regDefId -> 66 - Λ<.> -> 67 - char_lit -> 68 - Λ<~> -> 69 - Λ<(> -> 70 - Λ<[> -> 71 - Λ<{> -> 72 - Π -> 106 + regDefId -> 67 + Λ<.> -> 68 + char_lit -> 69 + Λ<~> -> 70 + Λ<(> -> 71 + Λ<[> -> 72 + Λ<{> -> 73 + Π -> 109 -S65{ +S66{ LexAlt : Π• «"]"» LexAlt : Π• «"("» LexAlt : Π• «"."» @@ -2474,7 +2566,7 @@ S65{ Transitions: -S66{ +S67{ LexTerm : regDefId• «"]"» LexTerm : regDefId• «"("» LexTerm : regDefId• «"."» @@ -2488,7 +2580,7 @@ S66{ Transitions: -S67{ +S68{ LexTerm : Λ<.>• «"]"» LexTerm : Λ<.>• «"("» LexTerm : Λ<.>• «"."» @@ -2502,7 +2594,7 @@ S67{ Transitions: -S68{ +S69{ LexTerm : char_lit• «"]"» LexTerm : char_lit •Λ<-> char_lit «"]"» LexTerm : char_lit• «"("» @@ -2523,10 +2615,10 @@ S68{ LexTerm : char_lit •Λ<-> char_lit «"|"» } Transitions: - Λ<-> -> 107 + Λ<-> -> 110 -S69{ +S70{ LexTerm : Λ<~> •char_lit «"]"» LexTerm : Λ<~> •Λ<(> char_lit Λ<-> char_lit Λ<)> «"]"» LexTerm : Λ<~> •char_lit «"("» @@ -2547,11 +2639,11 @@ S69{ LexTerm : Λ<~> •Λ<(> char_lit Λ<-> char_lit Λ<)> «"|"» } Transitions: - char_lit -> 108 - Λ<(> -> 109 + char_lit -> 111 + Λ<(> -> 112 -S70{ +S71{ LexTerm : Λ<(> •Π Λ<)> «"]"» LexTerm : Λ<(> •Π Λ<)> «"("» LexTerm : Λ<(> •Π Λ<)> «"."» @@ -2666,19 +2758,19 @@ S70{ LexTerm : •Λ<(> Π Λ<)> «"|"» } Transitions: - Π -> 54 - Π -> 55 - regDefId -> 56 - Λ<.> -> 57 - char_lit -> 58 - Λ<~> -> 59 - Λ<(> -> 60 - Λ<[> -> 61 - Λ<{> -> 62 - Π -> 110 + Π -> 55 + Π -> 56 + regDefId -> 57 + Λ<.> -> 58 + char_lit -> 59 + Λ<~> -> 60 + Λ<(> -> 61 + Λ<[> -> 62 + Λ<{> -> 63 + Π -> 113 -S71{ +S72{ LexTerm : Λ<[> •Π Λ<]> «"]"» LexTerm : Λ<[> •Π Λ<]> «"("» LexTerm : Λ<[> •Π Λ<]> «"."» @@ -2793,19 +2885,19 @@ S71{ LexTerm : •Λ<(> Π Λ<)> «"|"» } Transitions: - Π -> 64 - Π -> 65 - regDefId -> 66 - Λ<.> -> 67 - char_lit -> 68 - Λ<~> -> 69 - Λ<(> -> 70 - Λ<[> -> 71 - Λ<{> -> 72 - Π -> 111 + Π -> 65 + Π -> 66 + regDefId -> 67 + Λ<.> -> 68 + char_lit -> 69 + Λ<~> -> 70 + Λ<(> -> 71 + Λ<[> -> 72 + Λ<{> -> 73 + Π -> 114 -S72{ +S73{ LexTerm : Λ<{> •Π Λ<}> «"]"» LexTerm : Λ<{> •Π Λ<}> «"("» LexTerm : Λ<{> •Π Λ<}> «"."» @@ -2920,19 +3012,19 @@ S72{ LexTerm : •Λ<(> Π Λ<)> «"|"» } Transitions: - Π -> 74 - Π -> 75 - regDefId -> 76 - Λ<.> -> 77 - char_lit -> 78 - Λ<~> -> 79 - Λ<(> -> 80 - Λ<[> -> 81 - Λ<{> -> 82 - Π -> 112 + Π -> 75 + Π -> 76 + regDefId -> 77 + Λ<.> -> 78 + char_lit -> 79 + Λ<~> -> 80 + Λ<(> -> 81 + Λ<[> -> 82 + Λ<{> -> 83 + Π -> 115 -S73{ +S74{ LexTerm : Λ<{> Π •Λ<}> «";"» LexTerm : Λ<{> Π •Λ<}> «"("» LexTerm : Λ<{> Π •Λ<}> «"."» @@ -2946,11 +3038,11 @@ S73{ LexPattern : Π •Λ<|> Π «"|"» } Transitions: - Λ<|> -> 113 - Λ<}> -> 114 + Λ<|> -> 116 + Λ<}> -> 117 -S74{ +S75{ LexPattern : Π• «"}"» LexAlt : Π •Π «"}"» LexPattern : Π• «"|"» @@ -3045,17 +3137,17 @@ S74{ LexTerm : •Λ<(> Π Λ<)> «"|"» } Transitions: - regDefId -> 76 - Λ<.> -> 77 - char_lit -> 78 - Λ<~> -> 79 - Λ<(> -> 80 - Λ<[> -> 81 - Λ<{> -> 82 - Π -> 115 + regDefId -> 77 + Λ<.> -> 78 + char_lit -> 79 + Λ<~> -> 80 + Λ<(> -> 81 + Λ<[> -> 82 + Λ<{> -> 83 + Π -> 118 -S75{ +S76{ LexAlt : Π• «"}"» LexAlt : Π• «"("» LexAlt : Π• «"."» @@ -3069,7 +3161,7 @@ S75{ Transitions: -S76{ +S77{ LexTerm : regDefId• «"}"» LexTerm : regDefId• «"("» LexTerm : regDefId• «"."» @@ -3083,7 +3175,7 @@ S76{ Transitions: -S77{ +S78{ LexTerm : Λ<.>• «"}"» LexTerm : Λ<.>• «"("» LexTerm : Λ<.>• «"."» @@ -3097,7 +3189,7 @@ S77{ Transitions: -S78{ +S79{ LexTerm : char_lit• «"}"» LexTerm : char_lit •Λ<-> char_lit «"}"» LexTerm : char_lit• «"("» @@ -3118,10 +3210,10 @@ S78{ LexTerm : char_lit •Λ<-> char_lit «"|"» } Transitions: - Λ<-> -> 116 + Λ<-> -> 119 -S79{ +S80{ LexTerm : Λ<~> •char_lit «"}"» LexTerm : Λ<~> •Λ<(> char_lit Λ<-> char_lit Λ<)> «"}"» LexTerm : Λ<~> •char_lit «"("» @@ -3142,11 +3234,11 @@ S79{ LexTerm : Λ<~> •Λ<(> char_lit Λ<-> char_lit Λ<)> «"|"» } Transitions: - char_lit -> 117 - Λ<(> -> 118 + char_lit -> 120 + Λ<(> -> 121 -S80{ +S81{ LexTerm : Λ<(> •Π Λ<)> «"}"» LexTerm : Λ<(> •Π Λ<)> «"("» LexTerm : Λ<(> •Π Λ<)> «"."» @@ -3261,19 +3353,19 @@ S80{ LexTerm : •Λ<(> Π Λ<)> «"|"» } Transitions: - Π -> 54 - Π -> 55 - regDefId -> 56 - Λ<.> -> 57 - char_lit -> 58 - Λ<~> -> 59 - Λ<(> -> 60 - Λ<[> -> 61 - Λ<{> -> 62 - Π -> 119 + Π -> 55 + Π -> 56 + regDefId -> 57 + Λ<.> -> 58 + char_lit -> 59 + Λ<~> -> 60 + Λ<(> -> 61 + Λ<[> -> 62 + Λ<{> -> 63 + Π -> 122 -S81{ +S82{ LexTerm : Λ<[> •Π Λ<]> «"}"» LexTerm : Λ<[> •Π Λ<]> «"("» LexTerm : Λ<[> •Π Λ<]> «"."» @@ -3388,19 +3480,19 @@ S81{ LexTerm : •Λ<(> Π Λ<)> «"|"» } Transitions: - Π -> 64 - Π -> 65 - regDefId -> 66 - Λ<.> -> 67 - char_lit -> 68 - Λ<~> -> 69 - Λ<(> -> 70 - Λ<[> -> 71 - Λ<{> -> 72 - Π -> 120 + Π -> 65 + Π -> 66 + regDefId -> 67 + Λ<.> -> 68 + char_lit -> 69 + Λ<~> -> 70 + Λ<(> -> 71 + Λ<[> -> 72 + Λ<{> -> 73 + Π -> 123 -S82{ +S83{ LexTerm : Λ<{> •Π Λ<}> «"}"» LexTerm : Λ<{> •Π Λ<}> «"("» LexTerm : Λ<{> •Π Λ<}> «"."» @@ -3515,19 +3607,19 @@ S82{ LexTerm : •Λ<(> Π Λ<)> «"|"» } Transitions: - Π -> 74 - Π -> 75 - regDefId -> 76 - Λ<.> -> 77 - char_lit -> 78 - Λ<~> -> 79 - Λ<(> -> 80 - Λ<[> -> 81 - Λ<{> -> 82 - Π -> 121 + Π -> 75 + Π -> 76 + regDefId -> 77 + Λ<.> -> 78 + char_lit -> 79 + Λ<~> -> 80 + Λ<(> -> 81 + Λ<[> -> 82 + Λ<{> -> 83 + Π -> 124 -S83{ +S84{ LexProduction : regDefId Λ<:> Π Λ<;>• «g_sdt_lit» LexProduction : regDefId Λ<:> Π Λ<;>• «prodId» LexProduction : regDefId Λ<:> Π Λ<;>• «Ω» @@ -3538,7 +3630,7 @@ S83{ Transitions: -S84{ +S85{ LexProduction : ignoredTokId Λ<:> Π Λ<;>• «g_sdt_lit» LexProduction : ignoredTokId Λ<:> Π Λ<;>• «prodId» LexProduction : ignoredTokId Λ<:> Π Λ<;>• «Ω» @@ -3549,14 +3641,14 @@ S84{ Transitions: -S85{ +S86{ SyntaxProduction : prodId Λ<:> Π Λ<;>• «Ω» SyntaxProduction : prodId Λ<:> Π Λ<;>• «prodId» } Transitions: -S86{ +S87{ Alternatives : Π Λ<|> •Π «";"» Alternatives : Π Λ<|> •Π «"|"» SyntaxBody : •Π «";"» @@ -3579,9 +3671,11 @@ S86{ Symbols : •Π Π «g_sdt_lit» ErrorSymbol : •Λ «";"» ErrorSymbol : •Λ<λ> «";"» + ErrorSymbol : •Λ «"@"» ErrorSymbol : •Λ «prodId» ErrorSymbol : •Λ «string_lit» ErrorSymbol : •Λ «tokId» + ErrorSymbol : •Λ<λ> «"@"» ErrorSymbol : •Λ<λ> «prodId» ErrorSymbol : •Λ<λ> «string_lit» ErrorSymbol : •Λ<λ> «tokId» @@ -3599,9 +3693,13 @@ S86{ Symbol : •tokId «";"» Symbol : •string_lit «";"» Symbol : •tokId g_ctxdep_lit «";"» + Symbol : •Λ<@> tokId string_lit «";"» + Symbol : •Λ<@> string_lit «";"» + Symbols : •Π «"@"» Symbols : •Π «prodId» Symbols : •Π «string_lit» Symbols : •Π «tokId» + Symbols : •Π Π «"@"» Symbols : •Π Π «prodId» Symbols : •Π Π «string_lit» Symbols : •Π Π «tokId» @@ -3609,22 +3707,38 @@ S86{ Symbol : •tokId «g_sdt_lit» Symbol : •string_lit «g_sdt_lit» Symbol : •tokId g_ctxdep_lit «g_sdt_lit» + Symbol : •Λ<@> tokId string_lit «g_sdt_lit» + Symbol : •Λ<@> string_lit «g_sdt_lit» Symbol : •prodId «"|"» Symbol : •tokId «"|"» Symbol : •string_lit «"|"» Symbol : •tokId g_ctxdep_lit «"|"» + Symbol : •Λ<@> tokId string_lit «"|"» + Symbol : •Λ<@> string_lit «"|"» + Symbol : •prodId «"@"» + Symbol : •tokId «"@"» + Symbol : •string_lit «"@"» + Symbol : •tokId g_ctxdep_lit «"@"» + Symbol : •Λ<@> tokId string_lit «"@"» + Symbol : •Λ<@> string_lit «"@"» Symbol : •prodId «prodId» Symbol : •tokId «prodId» Symbol : •string_lit «prodId» Symbol : •tokId g_ctxdep_lit «prodId» + Symbol : •Λ<@> tokId string_lit «prodId» + Symbol : •Λ<@> string_lit «prodId» Symbol : •prodId «string_lit» Symbol : •tokId «string_lit» Symbol : •string_lit «string_lit» Symbol : •tokId g_ctxdep_lit «string_lit» + Symbol : •Λ<@> tokId string_lit «string_lit» + Symbol : •Λ<@> string_lit «string_lit» Symbol : •prodId «tokId» Symbol : •tokId «tokId» Symbol : •string_lit «tokId» Symbol : •tokId g_ctxdep_lit «tokId» + Symbol : •Λ<@> tokId string_lit «tokId» + Symbol : •Λ<@> string_lit «tokId» } Transitions: Π -> 36 @@ -3634,16 +3748,18 @@ Transitions: tokId -> 40 prodId -> 41 string_lit -> 42 - Λ -> 43 - Λ<λ> -> 44 - Λ -> 45 - Λ<ε> -> 46 - Π -> 122 + Λ<@> -> 43 + Λ -> 44 + Λ<λ> -> 45 + Λ -> 46 + Λ<ε> -> 47 + Π -> 125 -S87{ +S88{ Symbols : Π Π• «";"» Symbols : Π Π• «g_sdt_lit» + Symbols : Π Π• «"@"» Symbols : Π Π• «prodId» Symbols : Π Π• «string_lit» Symbols : Π Π• «tokId» @@ -3652,14 +3768,14 @@ S87{ Transitions: -S88{ +S89{ SyntaxBody : Π g_sdt_lit• «";"» SyntaxBody : Π g_sdt_lit• «"|"» } Transitions: -S89{ +S90{ SyntaxBody : Π Π• «";"» SyntaxBody : Π Π •g_sdt_lit «";"» SyntaxBody : Π Π• «"|"» @@ -3667,6 +3783,7 @@ S89{ Symbols : Π •Π «";"» Symbols : Π •Π «g_sdt_lit» Symbols : Π •Π «"|"» + Symbols : Π •Π «"@"» Symbols : Π •Π «prodId» Symbols : Π •Π «string_lit» Symbols : Π •Π «tokId» @@ -3674,45 +3791,65 @@ S89{ Symbol : •tokId «";"» Symbol : •string_lit «";"» Symbol : •tokId g_ctxdep_lit «";"» + Symbol : •Λ<@> tokId string_lit «";"» + Symbol : •Λ<@> string_lit «";"» Symbol : •prodId «g_sdt_lit» Symbol : •tokId «g_sdt_lit» Symbol : •string_lit «g_sdt_lit» Symbol : •tokId g_ctxdep_lit «g_sdt_lit» + Symbol : •Λ<@> tokId string_lit «g_sdt_lit» + Symbol : •Λ<@> string_lit «g_sdt_lit» Symbol : •prodId «"|"» Symbol : •tokId «"|"» Symbol : •string_lit «"|"» Symbol : •tokId g_ctxdep_lit «"|"» + Symbol : •Λ<@> tokId string_lit «"|"» + Symbol : •Λ<@> string_lit «"|"» + Symbol : •prodId «"@"» + Symbol : •tokId «"@"» + Symbol : •string_lit «"@"» + Symbol : •tokId g_ctxdep_lit «"@"» + Symbol : •Λ<@> tokId string_lit «"@"» + Symbol : •Λ<@> string_lit «"@"» Symbol : •prodId «prodId» Symbol : •tokId «prodId» Symbol : •string_lit «prodId» Symbol : •tokId g_ctxdep_lit «prodId» + Symbol : •Λ<@> tokId string_lit «prodId» + Symbol : •Λ<@> string_lit «prodId» Symbol : •prodId «string_lit» Symbol : •tokId «string_lit» Symbol : •string_lit «string_lit» Symbol : •tokId g_ctxdep_lit «string_lit» + Symbol : •Λ<@> tokId string_lit «string_lit» + Symbol : •Λ<@> string_lit «string_lit» Symbol : •prodId «tokId» Symbol : •tokId «tokId» Symbol : •string_lit «tokId» Symbol : •tokId g_ctxdep_lit «tokId» + Symbol : •Λ<@> tokId string_lit «tokId» + Symbol : •Λ<@> string_lit «tokId» } Transitions: tokId -> 40 prodId -> 41 string_lit -> 42 - Π -> 87 - g_sdt_lit -> 123 + Λ<@> -> 43 + Π -> 88 + g_sdt_lit -> 126 -S90{ +S91{ SyntaxBody : Π g_sdt_lit• «";"» SyntaxBody : Π g_sdt_lit• «"|"» } Transitions: -S91{ +S92{ Symbol : tokId g_ctxdep_lit• «";"» Symbol : tokId g_ctxdep_lit• «g_sdt_lit» + Symbol : tokId g_ctxdep_lit• «"@"» Symbol : tokId g_ctxdep_lit• «prodId» Symbol : tokId g_ctxdep_lit• «string_lit» Symbol : tokId g_ctxdep_lit• «tokId» @@ -3721,7 +3858,32 @@ S91{ Transitions: -S92{ +S93{ + Symbol : Λ<@> tokId •string_lit «";"» + Symbol : Λ<@> tokId •string_lit «g_sdt_lit» + Symbol : Λ<@> tokId •string_lit «"@"» + Symbol : Λ<@> tokId •string_lit «prodId» + Symbol : Λ<@> tokId •string_lit «string_lit» + Symbol : Λ<@> tokId •string_lit «tokId» + Symbol : Λ<@> tokId •string_lit «"|"» +} +Transitions: + string_lit -> 127 + + +S94{ + Symbol : Λ<@> string_lit• «";"» + Symbol : Λ<@> string_lit• «g_sdt_lit» + Symbol : Λ<@> string_lit• «"@"» + Symbol : Λ<@> string_lit• «prodId» + Symbol : Λ<@> string_lit• «string_lit» + Symbol : Λ<@> string_lit• «tokId» + Symbol : Λ<@> string_lit• «"|"» +} +Transitions: + + +S95{ LexPattern : Π Λ<|> Π• «";"» LexPattern : Π Λ<|> Π• «"|"» LexAlt : Π •Π «";"» @@ -3823,10 +3985,10 @@ Transitions: Λ<(> -> 29 Λ<[> -> 30 Λ<{> -> 31 - Π -> 49 + Π -> 50 -S93{ +S96{ LexTerm : char_lit Λ<-> char_lit• «";"» LexTerm : char_lit Λ<-> char_lit• «"("» LexTerm : char_lit Λ<-> char_lit• «"."» @@ -3840,7 +4002,7 @@ S93{ Transitions: -S94{ +S97{ LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «";"» LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «"("» LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «"."» @@ -3852,10 +4014,10 @@ S94{ LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «"|"» } Transitions: - Λ<-> -> 124 + Λ<-> -> 128 -S95{ +S98{ LexPattern : Π Λ<|> •Π «")"» LexPattern : Π Λ<|> •Π «"|"» LexAlt : •Π «")"» @@ -3959,18 +4121,18 @@ S95{ LexTerm : •Λ<(> Π Λ<)> «"~"» } Transitions: - Π -> 55 - regDefId -> 56 - Λ<.> -> 57 - char_lit -> 58 - Λ<~> -> 59 - Λ<(> -> 60 - Λ<[> -> 61 - Λ<{> -> 62 - Π -> 125 + Π -> 56 + regDefId -> 57 + Λ<.> -> 58 + char_lit -> 59 + Λ<~> -> 60 + Λ<(> -> 61 + Λ<[> -> 62 + Λ<{> -> 63 + Π -> 129 -S96{ +S99{ LexTerm : Λ<(> Π Λ<)>• «";"» LexTerm : Λ<(> Π Λ<)>• «"("» LexTerm : Λ<(> Π Λ<)>• «"."» @@ -3984,7 +4146,7 @@ S96{ Transitions: -S97{ +S100{ LexAlt : Π Π• «")"» LexAlt : Π Π• «"("» LexAlt : Π Π• «"."» @@ -3998,7 +4160,7 @@ S97{ Transitions: -S98{ +S101{ LexTerm : char_lit Λ<-> •char_lit «")"» LexTerm : char_lit Λ<-> •char_lit «"("» LexTerm : char_lit Λ<-> •char_lit «"."» @@ -4010,10 +4172,10 @@ S98{ LexTerm : char_lit Λ<-> •char_lit «"|"» } Transitions: - char_lit -> 126 + char_lit -> 130 -S99{ +S102{ LexTerm : Λ<~> char_lit• «")"» LexTerm : Λ<~> char_lit• «"("» LexTerm : Λ<~> char_lit• «"."» @@ -4027,7 +4189,7 @@ S99{ Transitions: -S100{ +S103{ LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «")"» LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «"("» LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «"."» @@ -4039,10 +4201,10 @@ S100{ LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «"|"» } Transitions: - char_lit -> 127 + char_lit -> 131 -S101{ +S104{ LexTerm : Λ<(> Π •Λ<)> «")"» LexTerm : Λ<(> Π •Λ<)> «"("» LexTerm : Λ<(> Π •Λ<)> «"."» @@ -4056,11 +4218,11 @@ S101{ LexPattern : Π •Λ<|> Π «"|"» } Transitions: - Λ<|> -> 95 - Λ<)> -> 128 + Λ<|> -> 98 + Λ<)> -> 132 -S102{ +S105{ LexTerm : Λ<[> Π •Λ<]> «")"» LexTerm : Λ<[> Π •Λ<]> «"("» LexTerm : Λ<[> Π •Λ<]> «"."» @@ -4074,11 +4236,11 @@ S102{ LexPattern : Π •Λ<|> Π «"|"» } Transitions: - Λ<|> -> 104 - Λ<]> -> 129 + Λ<|> -> 107 + Λ<]> -> 133 -S103{ +S106{ LexTerm : Λ<{> Π •Λ<}> «")"» LexTerm : Λ<{> Π •Λ<}> «"("» LexTerm : Λ<{> Π •Λ<}> «"."» @@ -4092,11 +4254,11 @@ S103{ LexPattern : Π •Λ<|> Π «"|"» } Transitions: - Λ<|> -> 113 - Λ<}> -> 130 + Λ<|> -> 116 + Λ<}> -> 134 -S104{ +S107{ LexPattern : Π Λ<|> •Π «"]"» LexPattern : Π Λ<|> •Π «"|"» LexAlt : •Π «"]"» @@ -4200,18 +4362,18 @@ S104{ LexTerm : •Λ<(> Π Λ<)> «"~"» } Transitions: - Π -> 65 - regDefId -> 66 - Λ<.> -> 67 - char_lit -> 68 - Λ<~> -> 69 - Λ<(> -> 70 - Λ<[> -> 71 - Λ<{> -> 72 - Π -> 131 + Π -> 66 + regDefId -> 67 + Λ<.> -> 68 + char_lit -> 69 + Λ<~> -> 70 + Λ<(> -> 71 + Λ<[> -> 72 + Λ<{> -> 73 + Π -> 135 -S105{ +S108{ LexTerm : Λ<[> Π Λ<]>• «";"» LexTerm : Λ<[> Π Λ<]>• «"("» LexTerm : Λ<[> Π Λ<]>• «"."» @@ -4225,7 +4387,7 @@ S105{ Transitions: -S106{ +S109{ LexAlt : Π Π• «"]"» LexAlt : Π Π• «"("» LexAlt : Π Π• «"."» @@ -4239,7 +4401,7 @@ S106{ Transitions: -S107{ +S110{ LexTerm : char_lit Λ<-> •char_lit «"]"» LexTerm : char_lit Λ<-> •char_lit «"("» LexTerm : char_lit Λ<-> •char_lit «"."» @@ -4251,10 +4413,10 @@ S107{ LexTerm : char_lit Λ<-> •char_lit «"|"» } Transitions: - char_lit -> 132 + char_lit -> 136 -S108{ +S111{ LexTerm : Λ<~> char_lit• «"]"» LexTerm : Λ<~> char_lit• «"("» LexTerm : Λ<~> char_lit• «"."» @@ -4268,7 +4430,7 @@ S108{ Transitions: -S109{ +S112{ LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «"]"» LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «"("» LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «"."» @@ -4280,10 +4442,10 @@ S109{ LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «"|"» } Transitions: - char_lit -> 133 + char_lit -> 137 -S110{ +S113{ LexTerm : Λ<(> Π •Λ<)> «"]"» LexTerm : Λ<(> Π •Λ<)> «"("» LexTerm : Λ<(> Π •Λ<)> «"."» @@ -4297,11 +4459,11 @@ S110{ LexPattern : Π •Λ<|> Π «"|"» } Transitions: - Λ<|> -> 95 - Λ<)> -> 134 + Λ<|> -> 98 + Λ<)> -> 138 -S111{ +S114{ LexTerm : Λ<[> Π •Λ<]> «"]"» LexTerm : Λ<[> Π •Λ<]> «"("» LexTerm : Λ<[> Π •Λ<]> «"."» @@ -4315,11 +4477,11 @@ S111{ LexPattern : Π •Λ<|> Π «"|"» } Transitions: - Λ<|> -> 104 - Λ<]> -> 135 + Λ<|> -> 107 + Λ<]> -> 139 -S112{ +S115{ LexTerm : Λ<{> Π •Λ<}> «"]"» LexTerm : Λ<{> Π •Λ<}> «"("» LexTerm : Λ<{> Π •Λ<}> «"."» @@ -4333,11 +4495,11 @@ S112{ LexPattern : Π •Λ<|> Π «"|"» } Transitions: - Λ<|> -> 113 - Λ<}> -> 136 + Λ<|> -> 116 + Λ<}> -> 140 -S113{ +S116{ LexPattern : Π Λ<|> •Π «"}"» LexPattern : Π Λ<|> •Π «"|"» LexAlt : •Π «"}"» @@ -4441,18 +4603,18 @@ S113{ LexTerm : •Λ<(> Π Λ<)> «"~"» } Transitions: - Π -> 75 - regDefId -> 76 - Λ<.> -> 77 - char_lit -> 78 - Λ<~> -> 79 - Λ<(> -> 80 - Λ<[> -> 81 - Λ<{> -> 82 - Π -> 137 + Π -> 76 + regDefId -> 77 + Λ<.> -> 78 + char_lit -> 79 + Λ<~> -> 80 + Λ<(> -> 81 + Λ<[> -> 82 + Λ<{> -> 83 + Π -> 141 -S114{ +S117{ LexTerm : Λ<{> Π Λ<}>• «";"» LexTerm : Λ<{> Π Λ<}>• «"("» LexTerm : Λ<{> Π Λ<}>• «"."» @@ -4466,7 +4628,7 @@ S114{ Transitions: -S115{ +S118{ LexAlt : Π Π• «"}"» LexAlt : Π Π• «"("» LexAlt : Π Π• «"."» @@ -4480,7 +4642,7 @@ S115{ Transitions: -S116{ +S119{ LexTerm : char_lit Λ<-> •char_lit «"}"» LexTerm : char_lit Λ<-> •char_lit «"("» LexTerm : char_lit Λ<-> •char_lit «"."» @@ -4492,10 +4654,10 @@ S116{ LexTerm : char_lit Λ<-> •char_lit «"|"» } Transitions: - char_lit -> 138 + char_lit -> 142 -S117{ +S120{ LexTerm : Λ<~> char_lit• «"}"» LexTerm : Λ<~> char_lit• «"("» LexTerm : Λ<~> char_lit• «"."» @@ -4509,7 +4671,7 @@ S117{ Transitions: -S118{ +S121{ LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «"}"» LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «"("» LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «"."» @@ -4521,10 +4683,10 @@ S118{ LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «"|"» } Transitions: - char_lit -> 139 + char_lit -> 143 -S119{ +S122{ LexTerm : Λ<(> Π •Λ<)> «"}"» LexTerm : Λ<(> Π •Λ<)> «"("» LexTerm : Λ<(> Π •Λ<)> «"."» @@ -4538,11 +4700,11 @@ S119{ LexPattern : Π •Λ<|> Π «"|"» } Transitions: - Λ<|> -> 95 - Λ<)> -> 140 + Λ<|> -> 98 + Λ<)> -> 144 -S120{ +S123{ LexTerm : Λ<[> Π •Λ<]> «"}"» LexTerm : Λ<[> Π •Λ<]> «"("» LexTerm : Λ<[> Π •Λ<]> «"."» @@ -4556,11 +4718,11 @@ S120{ LexPattern : Π •Λ<|> Π «"|"» } Transitions: - Λ<|> -> 104 - Λ<]> -> 141 + Λ<|> -> 107 + Λ<]> -> 145 -S121{ +S124{ LexTerm : Λ<{> Π •Λ<}> «"}"» LexTerm : Λ<{> Π •Λ<}> «"("» LexTerm : Λ<{> Π •Λ<}> «"."» @@ -4574,25 +4736,37 @@ S121{ LexPattern : Π •Λ<|> Π «"|"» } Transitions: - Λ<|> -> 113 - Λ<}> -> 142 + Λ<|> -> 116 + Λ<}> -> 146 -S122{ +S125{ Alternatives : Π Λ<|> Π• «";"» Alternatives : Π Λ<|> Π• «"|"» } Transitions: -S123{ +S126{ SyntaxBody : Π Π g_sdt_lit• «";"» SyntaxBody : Π Π g_sdt_lit• «"|"» } Transitions: -S124{ +S127{ + Symbol : Λ<@> tokId string_lit• «";"» + Symbol : Λ<@> tokId string_lit• «g_sdt_lit» + Symbol : Λ<@> tokId string_lit• «"@"» + Symbol : Λ<@> tokId string_lit• «prodId» + Symbol : Λ<@> tokId string_lit• «string_lit» + Symbol : Λ<@> tokId string_lit• «tokId» + Symbol : Λ<@> tokId string_lit• «"|"» +} +Transitions: + + +S128{ LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «";"» LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «"("» LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «"."» @@ -4604,10 +4778,10 @@ S124{ LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «"|"» } Transitions: - char_lit -> 143 + char_lit -> 147 -S125{ +S129{ LexPattern : Π Λ<|> Π• «")"» LexPattern : Π Λ<|> Π• «"|"» LexAlt : Π •Π «")"» @@ -4702,17 +4876,17 @@ S125{ LexTerm : •Λ<(> Π Λ<)> «"~"» } Transitions: - regDefId -> 56 - Λ<.> -> 57 - char_lit -> 58 - Λ<~> -> 59 - Λ<(> -> 60 - Λ<[> -> 61 - Λ<{> -> 62 - Π -> 97 + regDefId -> 57 + Λ<.> -> 58 + char_lit -> 59 + Λ<~> -> 60 + Λ<(> -> 61 + Λ<[> -> 62 + Λ<{> -> 63 + Π -> 100 -S126{ +S130{ LexTerm : char_lit Λ<-> char_lit• «")"» LexTerm : char_lit Λ<-> char_lit• «"("» LexTerm : char_lit Λ<-> char_lit• «"."» @@ -4726,7 +4900,7 @@ S126{ Transitions: -S127{ +S131{ LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «")"» LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «"("» LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «"."» @@ -4738,10 +4912,10 @@ S127{ LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «"|"» } Transitions: - Λ<-> -> 144 + Λ<-> -> 148 -S128{ +S132{ LexTerm : Λ<(> Π Λ<)>• «")"» LexTerm : Λ<(> Π Λ<)>• «"("» LexTerm : Λ<(> Π Λ<)>• «"."» @@ -4755,7 +4929,7 @@ S128{ Transitions: -S129{ +S133{ LexTerm : Λ<[> Π Λ<]>• «")"» LexTerm : Λ<[> Π Λ<]>• «"("» LexTerm : Λ<[> Π Λ<]>• «"."» @@ -4769,7 +4943,7 @@ S129{ Transitions: -S130{ +S134{ LexTerm : Λ<{> Π Λ<}>• «")"» LexTerm : Λ<{> Π Λ<}>• «"("» LexTerm : Λ<{> Π Λ<}>• «"."» @@ -4783,7 +4957,7 @@ S130{ Transitions: -S131{ +S135{ LexPattern : Π Λ<|> Π• «"]"» LexPattern : Π Λ<|> Π• «"|"» LexAlt : Π •Π «"]"» @@ -4878,17 +5052,17 @@ S131{ LexTerm : •Λ<(> Π Λ<)> «"~"» } Transitions: - regDefId -> 66 - Λ<.> -> 67 - char_lit -> 68 - Λ<~> -> 69 - Λ<(> -> 70 - Λ<[> -> 71 - Λ<{> -> 72 - Π -> 106 + regDefId -> 67 + Λ<.> -> 68 + char_lit -> 69 + Λ<~> -> 70 + Λ<(> -> 71 + Λ<[> -> 72 + Λ<{> -> 73 + Π -> 109 -S132{ +S136{ LexTerm : char_lit Λ<-> char_lit• «"]"» LexTerm : char_lit Λ<-> char_lit• «"("» LexTerm : char_lit Λ<-> char_lit• «"."» @@ -4902,7 +5076,7 @@ S132{ Transitions: -S133{ +S137{ LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «"]"» LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «"("» LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «"."» @@ -4914,10 +5088,10 @@ S133{ LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «"|"» } Transitions: - Λ<-> -> 145 + Λ<-> -> 149 -S134{ +S138{ LexTerm : Λ<(> Π Λ<)>• «"]"» LexTerm : Λ<(> Π Λ<)>• «"("» LexTerm : Λ<(> Π Λ<)>• «"."» @@ -4931,7 +5105,7 @@ S134{ Transitions: -S135{ +S139{ LexTerm : Λ<[> Π Λ<]>• «"]"» LexTerm : Λ<[> Π Λ<]>• «"("» LexTerm : Λ<[> Π Λ<]>• «"."» @@ -4945,7 +5119,7 @@ S135{ Transitions: -S136{ +S140{ LexTerm : Λ<{> Π Λ<}>• «"]"» LexTerm : Λ<{> Π Λ<}>• «"("» LexTerm : Λ<{> Π Λ<}>• «"."» @@ -4959,7 +5133,7 @@ S136{ Transitions: -S137{ +S141{ LexPattern : Π Λ<|> Π• «"}"» LexPattern : Π Λ<|> Π• «"|"» LexAlt : Π •Π «"}"» @@ -5054,17 +5228,17 @@ S137{ LexTerm : •Λ<(> Π Λ<)> «"~"» } Transitions: - regDefId -> 76 - Λ<.> -> 77 - char_lit -> 78 - Λ<~> -> 79 - Λ<(> -> 80 - Λ<[> -> 81 - Λ<{> -> 82 - Π -> 115 + regDefId -> 77 + Λ<.> -> 78 + char_lit -> 79 + Λ<~> -> 80 + Λ<(> -> 81 + Λ<[> -> 82 + Λ<{> -> 83 + Π -> 118 -S138{ +S142{ LexTerm : char_lit Λ<-> char_lit• «"}"» LexTerm : char_lit Λ<-> char_lit• «"("» LexTerm : char_lit Λ<-> char_lit• «"."» @@ -5078,7 +5252,7 @@ S138{ Transitions: -S139{ +S143{ LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «"}"» LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «"("» LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «"."» @@ -5090,10 +5264,10 @@ S139{ LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «"|"» } Transitions: - Λ<-> -> 146 + Λ<-> -> 150 -S140{ +S144{ LexTerm : Λ<(> Π Λ<)>• «"}"» LexTerm : Λ<(> Π Λ<)>• «"("» LexTerm : Λ<(> Π Λ<)>• «"."» @@ -5107,7 +5281,7 @@ S140{ Transitions: -S141{ +S145{ LexTerm : Λ<[> Π Λ<]>• «"}"» LexTerm : Λ<[> Π Λ<]>• «"("» LexTerm : Λ<[> Π Λ<]>• «"."» @@ -5121,7 +5295,7 @@ S141{ Transitions: -S142{ +S146{ LexTerm : Λ<{> Π Λ<}>• «"}"» LexTerm : Λ<{> Π Λ<}>• «"("» LexTerm : Λ<{> Π Λ<}>• «"."» @@ -5135,7 +5309,7 @@ S142{ Transitions: -S143{ +S147{ LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «";"» LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «"("» LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «"."» @@ -5147,10 +5321,10 @@ S143{ LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «"|"» } Transitions: - Λ<)> -> 147 + Λ<)> -> 151 -S144{ +S148{ LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «")"» LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «"("» LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «"."» @@ -5162,10 +5336,10 @@ S144{ LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «"|"» } Transitions: - char_lit -> 148 + char_lit -> 152 -S145{ +S149{ LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «"]"» LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «"("» LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «"."» @@ -5177,10 +5351,10 @@ S145{ LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «"|"» } Transitions: - char_lit -> 149 + char_lit -> 153 -S146{ +S150{ LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «"}"» LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «"("» LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «"."» @@ -5192,10 +5366,10 @@ S146{ LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «"|"» } Transitions: - char_lit -> 150 + char_lit -> 154 -S147{ +S151{ LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)>• «";"» LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)>• «"("» LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)>• «"."» @@ -5209,7 +5383,7 @@ S147{ Transitions: -S148{ +S152{ LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «")"» LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «"("» LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «"."» @@ -5221,10 +5395,10 @@ S148{ LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «"|"» } Transitions: - Λ<)> -> 151 + Λ<)> -> 155 -S149{ +S153{ LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «"]"» LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «"("» LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «"."» @@ -5236,10 +5410,10 @@ S149{ LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «"|"» } Transitions: - Λ<)> -> 152 + Λ<)> -> 156 -S150{ +S154{ LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «"}"» LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «"("» LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «"."» @@ -5251,10 +5425,10 @@ S150{ LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «"|"» } Transitions: - Λ<)> -> 153 + Λ<)> -> 157 -S151{ +S155{ LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)>• «")"» LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)>• «"("» LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)>• «"."» @@ -5268,7 +5442,7 @@ S151{ Transitions: -S152{ +S156{ LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)>• «"]"» LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)>• «"("» LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)>• «"."» @@ -5282,7 +5456,7 @@ S152{ Transitions: -S153{ +S157{ LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)>• «"}"» LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)>• «"("» LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)>• «"."» diff --git a/internal/frontend/reparsed/log/first.txt b/internal/frontend/reparsed/log/first.txt index 7cb6a40c..76304b0e 100644 --- a/internal/frontend/reparsed/log/first.txt +++ b/internal/frontend/reparsed/log/first.txt @@ -71,6 +71,7 @@ prodId string_lit tokId + Λ<@> Λ Λ Λ<ε> @@ -80,6 +81,7 @@ prodId string_lit tokId + Λ<@> Λ Λ Λ<ε> @@ -89,6 +91,7 @@ prodId string_lit tokId + Λ<@> } Π: { Λ @@ -102,4 +105,5 @@ prodId string_lit tokId + Λ<@> } diff --git a/internal/frontend/reparsed/log/lexer_sets.txt b/internal/frontend/reparsed/log/lexer_sets.txt index 78c8c14c..ef4f4ee0 100644 --- a/internal/frontend/reparsed/log/lexer_sets.txt +++ b/internal/frontend/reparsed/log/lexer_sets.txt @@ -28,6 +28,7 @@ S0{ Λ<.> : • '.' Λ<:> : • ':' Λ<;> : • ';' + Λ<@> : • '@' Λ<[> : • '[' Λ<]> : • ']' Λ : • 'e' 'm' 'p' 't' 'y' @@ -199,10 +200,11 @@ Symbols classes: {['<','<']} S13{ g_ctxdep_lit : '@' • '@' . {.} '@' '@' + Λ<@> : '@' • } Transitions: ['@','@'] -> S36 -Action: nil +Action: Accept("Λ<@>") Symbols classes: {['@','@']} S14{ diff --git a/internal/frontend/reparsed/log/terminals.txt b/internal/frontend/reparsed/log/terminals.txt index 2472b3c1..678d8010 100644 --- a/internal/frontend/reparsed/log/terminals.txt +++ b/internal/frontend/reparsed/log/terminals.txt @@ -20,6 +20,7 @@ g_sdt_lit prodId string_lit g_ctxdep_lit +"@" "error" "λ" "empty" diff --git a/internal/parser/gen/golang/actiontable.go b/internal/parser/gen/golang/actiontable.go index f59eacb1..9baeadf8 100644 --- a/internal/parser/gen/golang/actiontable.go +++ b/internal/parser/gen/golang/actiontable.go @@ -109,7 +109,7 @@ func getActionRowData(prods ast.SyntaxProdList, set *items.ItemSet, tokMap *toke case action.Shift: data.Actions[i] = fmt.Sprintf("shift(%d), // %s", int(act1), sym) switch s := sym.(type) { - case ast.SyntaxContextDependentTokId: + case ast.SyntaxContextDependentTokId, ast.SyntaxSubParser: data.CdActions = append(data.CdActions, cdActionFunc{ i, fmt.Sprintf("cdFunc_%s", s.SymbolString()), @@ -130,7 +130,7 @@ package parser type ( actionTable [numStates]actionRow - cdFunc func(TokenStream, interface{}) (interface{}, error, []byte) + cdFunc func(TokenStream, interface{}) (interface{}, error, int) cdAction struct { tokenIndex int tokenScanner cdFunc diff --git a/internal/parser/gen/golang/parser.go b/internal/parser/gen/golang/parser.go index 630a4c44..bc208a6f 100644 --- a/internal/parser/gen/golang/parser.go +++ b/internal/parser/gen/golang/parser.go @@ -54,11 +54,13 @@ type parserData struct { NumStates int NumSymbols int CdTokList ast.SyntaxSymbols + CdSubList ast.SyntaxSymbols + CdSubImports map[string]string ErrorTokenName string } func getParserData(pkg, internal, iface string, prods ast.SyntaxProdList, itemSets *items.ItemSets, symbols *symbols.Symbols, cfg config.Config) *parserData { - return &parserData{ + ret := &parserData{ Debug: cfg.DebugParser(), PkgPath: pkg, InternalSubdir: internal, @@ -68,8 +70,21 @@ func getParserData(pkg, internal, iface string, prods ast.SyntaxProdList, itemSe NumStates: itemSets.Size(), NumSymbols: symbols.NumSymbols(), CdTokList: symbols.ListContextDependentTokenSymbols(), + CdSubList: symbols.ListSubParserSymbols(), + CdSubImports: map[string]string{}, ErrorTokenName: config.INTERNAL_SYMBOL_ERROR, } + for _, sym := range ret.CdSubList { + sub := sym.(ast.SyntaxSubParser) + if imp, found := ret.CdSubImports[sub.Alias]; found { + if imp != sub.Import { + panic(fmt.Sprintf("alias %s cannot refer to %s, already used by %s", sub.Alias, sub.Import, imp)) + } + } else { + ret.CdSubImports[sub.Alias] = sub.Import + } + } + return ret } const parserSrc = ` @@ -85,6 +100,11 @@ import ( parseError "{{.PkgPath}}/{{.InternalSubdir}}/errors" "{{.PkgPath}}/{{.InternalSubdir}}/token" "{{.PkgPath}}/{{.IfaceSubdir}}" + + {{ range $alias, $import := .CdSubImports }} + {{$alias}} "{{$import}}" + {{end}} + ) const ( @@ -186,9 +206,17 @@ func (f fakeCp) DistanceFrom(o iface.CheckPoint) int { return 0 } -{{- range $c := .CdTokList }} -{{ printf "func cdFunc_%s (Stream TokenStream, Context interface{}) (interface{}, error, []byte) {return %s}" $c.SymbolString $c.ContexDependentParseFunctionCall }} -{{- end }} +{{ range $c := .CdTokList }} +func {{ printf "cdFunc_%s" $c.SymbolString }} (Stream TokenStream, Context interface{}) (interface{}, error, int) { + return {{ $c.ContexDependentParseFunctionCall }} +} +{{ end }} + +{{ range $c := .CdSubList }} +func {{ printf "cdFunc_%s" $c.SymbolString }} (Stream TokenStream, Context interface{}) (interface{}, error, int) { + return {{$c.Alias}}.ParseWithDataPartial(Stream, Context) +} +{{ end }} func NewParser() *Parser { @@ -306,7 +334,7 @@ func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, er if tokens == nil && (len(parserActions.table[p.stack.top()].cdActions) > 0 || longest) { return errNotRepositionable } - {{- if eq (len .CdTokList) 0 }} + {{- if and (eq (len .CdTokList) 0) (eq (len .CdSubList) 0) }} if longest { checkPoint = tokens.GetCheckPoint() } @@ -340,12 +368,12 @@ func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, er for _, cdAction := range parserActions.table[p.stack.top()].cdActions { tokens.GotoCheckPoint (checkPoint) cd_res, cd_err, cd_parsed := cdAction.tokenScanner(underlyingStream, p.userContext) - if cd_err == nil && len(cd_parsed) > 0 { + if cd_err == nil && cd_parsed > 0 { action = parserActions.table[p.stack.top()].actions[cdAction.tokenIndex] if action != nil { p.nextToken.Foreign = true p.nextToken.ForeignAstNode = cd_res - p.nextToken.Lit = cd_parsed + p.nextToken.Lit = []byte{} p.nextToken.Type = token.Type(cdAction.tokenIndex) break } diff --git a/internal/parser/gen/golang/productionstable.go b/internal/parser/gen/golang/productionstable.go index d9732cc1..517a740e 100644 --- a/internal/parser/gen/golang/productionstable.go +++ b/internal/parser/gen/golang/productionstable.go @@ -73,7 +73,8 @@ func getProdsTab(header string, prods ast.SyntaxProdList, symbols *symbols.Symbo } else { data.ProdTab[i].NumSymbols = len(prod.Body.Symbols) for _, s := range prod.Body.Symbols { - if _, cdTok := s.(ast.SyntaxContextDependentTokId); cdTok { + switch s.(type) { + case ast.SyntaxContextDependentTokId, ast.SyntaxSubParser: data.ProdTab[i].NumSymbols++ } } diff --git a/internal/parser/symbols/symbols.go b/internal/parser/symbols/symbols.go index 9ae8cb40..7b9ffd07 100644 --- a/internal/parser/symbols/symbols.go +++ b/internal/parser/symbols/symbols.go @@ -91,8 +91,21 @@ func (this *Symbols) listMatchingSymbols(match func(ast.SyntaxSymbol) bool) ast. func (this *Symbols) ListContextDependentTokenSymbols() ast.SyntaxSymbols { return this.listMatchingSymbols(func(s ast.SyntaxSymbol) bool { - _, r := s.(ast.SyntaxContextDependentTokId) - return r + switch s.(type) { + case ast.SyntaxContextDependentTokId: + return true + } + return false + }) +} + +func (this *Symbols) ListSubParserSymbols() ast.SyntaxSymbols { + return this.listMatchingSymbols(func(s ast.SyntaxSymbol) bool { + switch s.(type) { + case ast.SyntaxSubParser: + return true + } + return false }) } diff --git a/spec/gocc2.ebnf b/spec/gocc2.ebnf index 7167788a..6f9dd632 100644 --- a/spec/gocc2.ebnf +++ b/spec/gocc2.ebnf @@ -295,6 +295,15 @@ Symbol : tokId g_ctxdep_lit << ast.NewContextDependentTokId($0,$1) >> + | + "@" + tokId + string_lit + << ast.NewAliasedSubParser($1,$2) >> + | + "@" + string_lit + << ast.NewSubParser($1) >> ; ErrorSymbol : diff --git a/spec/test.bnf b/spec/test.bnf index 7fde29ea..ccf7a741 100644 --- a/spec/test.bnf +++ b/spec/test.bnf @@ -47,7 +47,7 @@ X: | altro @@ - func () (interface {}, error, [] byte) { + func () (interface {}, error, int) { count := 0 ret := []byte{} for { @@ -61,10 +61,10 @@ X: default: Stream.UnreadRune() fmt.Printf("count=%d rune=<%c> ret=<%s>\n", count, r, string(ret)) - return count, nil, ret + return count, nil, len(ret) } } - return nil, nil, []byte{} + return nil, nil, 0 }() @@ Test2 @@ -74,5 +74,17 @@ X: return "buongiorno", nil } () >> + | + "expr" + "(" + @ "github.com/maxcalandrelli/gocc/example/calc/calc.grammar/calc" + ")" + Test2 + << + func () (interface{}, error) { + fmt.Printf("EXPR A=%#v\nB=%#v\n", $2, $3) + return "expression", nil + } () + >> ; From 6e12e146fd19a76407e3a1253c822040d541629d Mon Sep 17 00:00:00 2001 From: Massimiliano Calandrelli Date: Sun, 13 Oct 2019 18:19:18 +0200 Subject: [PATCH 20/33] ... --- example/ctx/ctx_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example/ctx/ctx_test.go b/example/ctx/ctx_test.go index c13728f0..b47bbb85 100644 --- a/example/ctx/ctx_test.go +++ b/example/ctx/ctx_test.go @@ -17,7 +17,7 @@ func TestPass(t *testing.T) { } func TestFail(t *testing.T) { - _, err := test([]byte("a b 22c d e f")) + _, err := test([]byte("a b 22 c d e f")) if err == nil { t.Fatal("expected parse error") } else { From 297cddd2ba1a9820ae25b32bbd57977c54e98f23 Mon Sep 17 00:00:00 2001 From: Massimiliano Calandrelli Date: Mon, 14 Oct 2019 16:35:46 +0200 Subject: [PATCH 21/33] ... --- .../ast.grammar/ast/{grammar.go => ast.go} | 40 +- example/astx/ast.grammar/ast/iface/ast.go | 1 + .../ast.grammar/ast/internal/lexer/lexer.go | 8 +- .../ast/internal/parser/actiontable.go | 2 +- .../ast.grammar/ast/internal/parser/parser.go | 122 +-- .../ast.grammar/ast/internal/token/token.go | 3 +- example/astx/ast.grammar/ast/main/main.go | 13 +- example/astx/ast_test.go | 2 +- .../bools/{grammar.go => bools.go} | 40 +- .../bools/bools.grammar/bools/iface/bools.go | 1 + .../bools/internal/lexer/lexer.go | 8 +- .../bools/internal/parser/actiontable.go | 2 +- .../bools/internal/parser/parser.go | 122 +-- .../bools/internal/token/token.go | 7 +- .../bools/bools.grammar/bools/main/main.go | 13 +- example/bools/example_test.go | 2 +- example/calc/Makefile | 2 +- example/calc/calc.bnf | 12 +- .../calc.grammar/calc/{grammar.go => calc.go} | 40 +- example/calc/calc.grammar/calc/iface/calc.go | 1 + .../calc/internal/lexer/acttab.go | 22 +- .../calc.grammar/calc/internal/lexer/lexer.go | 12 +- .../calc/internal/lexer/transitiontable.go | 24 +- .../calc/internal/parser/actiontable.go | 708 ++++++++++++++++-- .../calc/internal/parser/gototable.go | 290 ++++++- .../calc/internal/parser/parser.go | 128 ++-- .../calc/internal/parser/productionstable.go | 54 +- .../calc.grammar/calc/internal/token/token.go | 23 +- example/calc/calc.grammar/calc/main/main.go | 13 +- example/calc/calc_test.go | 2 +- .../ctx.grammar/ctx/{grammar.go => ctx.go} | 40 +- example/ctx/ctx.grammar/ctx/iface/ctx.go | 1 + .../ctx.grammar/ctx/internal/lexer/lexer.go | 8 +- .../ctx/internal/parser/actiontable.go | 2 +- .../ctx.grammar/ctx/internal/parser/parser.go | 122 +-- .../ctx.grammar/ctx/internal/token/token.go | 3 +- example/ctx/ctx.grammar/ctx/main/main.go | 13 +- example/ctx/ctx_test.go | 2 +- .../er.grammar/er/{grammar.go => er.go} | 40 +- .../errorrecovery/er.grammar/er/iface/er.go | 1 + .../er.grammar/er/internal/lexer/lexer.go | 8 +- .../er/internal/parser/actiontable.go | 2 +- .../er.grammar/er/internal/parser/parser.go | 122 +-- .../er.grammar/er/internal/token/token.go | 3 +- .../errorrecovery/er.grammar/er/main/main.go | 13 +- example/errorrecovery/er_test.go | 2 +- example/mail/mail.grammar/mail/iface/mail.go | 1 + .../mail.grammar/mail/internal/lexer/lexer.go | 8 +- .../mail.grammar/mail/internal/token/token.go | 3 +- .../mail.grammar/mail/{grammar.go => mail.go} | 0 .../nolexer.grammar/nolexer/iface/nolexer.go | 1 + .../nolexer/internal/parser/actiontable.go | 2 +- .../nolexer/internal/parser/parser.go | 122 +-- .../nolexer/internal/token/token.go | 3 +- .../nolexer/{grammar.go => nolexer.go} | 0 example/nolexer/nolexer_test.go | 4 +- example/rr/rr.grammar/rr/iface/rr.go | 1 + .../rr/rr.grammar/rr/internal/lexer/lexer.go | 8 +- .../rr/internal/parser/actiontable.go | 2 +- .../rr.grammar/rr/internal/parser/parser.go | 122 +-- .../rr/rr.grammar/rr/internal/token/token.go | 3 +- example/rr/rr.grammar/rr/main/main.go | 13 +- .../rr/rr.grammar/rr/{grammar.go => rr.go} | 40 +- example/rr/rr_test.go | 3 +- example/sr/sr.grammar/sr/iface/sr.go | 1 + .../sr/sr.grammar/sr/internal/lexer/lexer.go | 8 +- .../sr/internal/parser/actiontable.go | 2 +- .../sr.grammar/sr/internal/parser/parser.go | 122 +-- .../sr/sr.grammar/sr/internal/token/token.go | 3 +- example/sr/sr.grammar/sr/main/main.go | 13 +- .../sr/sr.grammar/sr/{grammar.go => sr.go} | 40 +- example/sr/sr_test.go | 2 +- internal/ast/lexcharlit.go | 1 - internal/base/gen/golang/base.go | 58 +- internal/config/config.go | 2 +- .../reparsed/{grammar.go => gocc2.go} | 40 +- internal/frontend/reparsed/iface/gocc2.go | 1 + .../frontend/reparsed/internal/iface/gocc2.go | 33 - .../frontend/reparsed/internal/lexer/lexer.go | 8 +- .../reparsed/internal/parser/actiontable.go | 2 +- .../reparsed/internal/parser/parser.go | 123 +-- .../internal/parser/productionstable.go | 4 +- .../frontend/reparsed/internal/token/token.go | 21 +- internal/frontend/reparsed/main/main.go | 13 +- internal/lexer/gen/golang/lexer.go | 24 +- internal/parser/gen/golang/actiontable.go | 2 +- internal/parser/gen/golang/parser.go | 177 +++-- internal/token/gen/golang/token.go | 1 + main.go | 105 ++- spec/gocc2.ebnf | 2 +- spec/test.bnf | 41 +- 91 files changed, 2283 insertions(+), 1001 deletions(-) rename example/astx/ast.grammar/ast/{grammar.go => ast.go} (79%) rename example/bools/bools.grammar/bools/{grammar.go => bools.go} (79%) rename example/calc/calc.grammar/calc/{grammar.go => calc.go} (79%) rename example/ctx/ctx.grammar/ctx/{grammar.go => ctx.go} (79%) rename example/errorrecovery/er.grammar/er/{grammar.go => er.go} (79%) rename example/mail/mail.grammar/mail/{grammar.go => mail.go} (100%) rename example/nolexer/nolexer.grammar/nolexer/{grammar.go => nolexer.go} (100%) rename example/rr/rr.grammar/rr/{grammar.go => rr.go} (79%) rename example/sr/sr.grammar/sr/{grammar.go => sr.go} (79%) rename internal/frontend/reparsed/{grammar.go => gocc2.go} (79%) delete mode 100644 internal/frontend/reparsed/internal/iface/gocc2.go diff --git a/example/astx/ast.grammar/ast/grammar.go b/example/astx/ast.grammar/ast/ast.go similarity index 79% rename from example/astx/ast.grammar/ast/grammar.go rename to example/astx/ast.grammar/ast/ast.go index a7cba87e..a132b0f0 100644 --- a/example/astx/ast.grammar/ast/grammar.go +++ b/example/astx/ast.grammar/ast/ast.go @@ -30,82 +30,82 @@ func NewParser() *parser.Parser { return parser.NewParser() } -func ParseFile(fpath string) (interface{}, error, int) { +func ParseFile(fpath string) (interface{}, error) { if lexer, err := NewLexerFile(fpath); err == nil { return NewParser().Parse(lexer) } else { - return nil, err, 0 + return nil, err } } -func ParseText(text string) (interface{}, error, int) { +func ParseText(text string) (interface{}, error) { return NewParser().Parse(NewLexerBytes([]byte(text))) } -func Parse(stream io.Reader) (interface{}, error, int) { +func Parse(stream io.Reader) (interface{}, error) { lex, err := NewLexer(stream) if lex == nil { - return nil, err, 0 + return nil, err } return NewParser().Parse(lex) } -func ParseFileWithData(fpath string, userData interface{}) (interface{}, error, int) { +func ParseFileWithData(fpath string, userData interface{}) (interface{}, error) { if lexer, err := NewLexerFile(fpath); err == nil { return NewParser().SetContext(userData).Parse(lexer) } else { - return nil, err, 0 + return nil, err } } -func ParseTextWithData(text string, userData interface{}) (interface{}, error, int) { +func ParseTextWithData(text string, userData interface{}) (interface{}, error) { return NewParser().SetContext(userData).Parse(NewLexerBytes([]byte(text))) } -func ParseWithData(stream io.Reader, userData interface{}) (interface{}, error, int) { +func ParseWithData(stream io.Reader, userData interface{}) (interface{}, error) { lex, err := NewLexer(stream) if lex == nil { - return nil, err, 0 + return nil, err } return NewParser().SetContext(userData).Parse(lex) } -func ParseFilePartial(fpath string) (interface{}, error, int) { +func ParseFilePartial(fpath string) (interface{}, error, []byte) { if lexer, err := NewLexerFile(fpath); err == nil { return NewParser().ParseLongestPrefix(lexer) } else { - return nil, err, 0 + return nil, err, []byte{} } } -func ParseTextPartial(text string) (interface{}, error, int) { +func ParseTextPartial(text string) (interface{}, error, []byte) { return NewParser().ParseLongestPrefix(NewLexerBytes([]byte(text))) } -func ParsePartial(stream io.Reader) (interface{}, error, int) { +func ParsePartial(stream io.Reader) (interface{}, error, []byte) { lex, err := NewLexer(stream) if lex == nil { - return nil, err, 0 + return nil, err, []byte{} } return NewParser().ParseLongestPrefix(lex) } -func ParseFileWithDataPartial(fpath string, userData interface{}) (interface{}, error, int) { +func ParseFileWithDataPartial(fpath string, userData interface{}) (interface{}, error, []byte) { if lexer, err := NewLexerFile(fpath); err == nil { return NewParser().SetContext(userData).ParseLongestPrefix(lexer) } else { - return nil, err, 0 + return nil, err, []byte{} } } -func ParseTextWithDataPartial(text string, userData interface{}) (interface{}, error, int) { +func ParseTextWithDataPartial(text string, userData interface{}) (interface{}, error, []byte) { return NewParser().SetContext(userData).ParseLongestPrefix(NewLexerBytes([]byte(text))) } -func ParseWithDataPartial(stream io.Reader, userData interface{}) (interface{}, error, int) { +func ParseWithDataPartial(stream io.Reader, userData interface{}) (interface{}, error, []byte) { lex, err := NewLexer(stream) if lex == nil { - return nil, err, 0 + return nil, err, []byte{} } return NewParser().SetContext(userData).ParseLongestPrefix(lex) } diff --git a/example/astx/ast.grammar/ast/iface/ast.go b/example/astx/ast.grammar/ast/iface/ast.go index 60b0ba11..3113c756 100644 --- a/example/astx/ast.grammar/ast/iface/ast.go +++ b/example/astx/ast.grammar/ast/iface/ast.go @@ -25,6 +25,7 @@ type ( CheckPoint interface { DistanceFrom(CheckPoint) int + Advance(int) CheckPoint } CheckPointable interface { diff --git a/example/astx/ast.grammar/ast/internal/lexer/lexer.go b/example/astx/ast.grammar/ast/internal/lexer/lexer.go index be094234..5d39573b 100644 --- a/example/astx/ast.grammar/ast/internal/lexer/lexer.go +++ b/example/astx/ast.grammar/ast/internal/lexer/lexer.go @@ -78,6 +78,10 @@ func (c checkPoint) DistanceFrom (o iface.CheckPoint) int { return int (c.value() - o.(checkPoint).value()) } +func (c checkPoint) Advance (o int) iface.CheckPoint { + return checkPoint(c.value() + int64(o)) +} + func (l *Lexer) GetCheckPoint() iface.CheckPoint { if l == nil { return checkPoint(0) @@ -93,10 +97,10 @@ func (l Lexer) GotoCheckPoint(cp iface.CheckPoint) { func (l *Lexer) Scan() (tok *token.Token) { tok = new(token.Token) tok.Type = token.INVALID - tok.Lit = []byte{} start := l.position state := 0 for state != -1 { + savePos := l.position.Pos curr, size, err := l.stream.ReadRune() if size < 1 || err != nil { curr = INVALID_RUNE @@ -129,12 +133,14 @@ func (l *Lexer) Scan() (tok *token.Token) { start = l.position state = 0 tok.Lit = []byte{} + tok.IgnoredPrefix=append(tok.IgnoredPrefix,string(curr)...) } } else if curr != INVALID_RUNE{ if len(tok.Lit) == 0 { tok.Lit = append(tok.Lit, string(curr)...) } else { l.stream.UnreadRune() + l.position.Pos = savePos } } if err == io.EOF && len(tok.Lit)==0 { diff --git a/example/astx/ast.grammar/ast/internal/parser/actiontable.go b/example/astx/ast.grammar/ast/internal/parser/actiontable.go index ab559b37..9c8071d3 100644 --- a/example/astx/ast.grammar/ast/internal/parser/actiontable.go +++ b/example/astx/ast.grammar/ast/internal/parser/actiontable.go @@ -4,7 +4,7 @@ package parser type ( actionTable [numStates]actionRow - cdFunc func(TokenStream, interface{}) (interface{}, error, int) + cdFunc func(TokenStream, interface{}) (interface{}, error, []byte) cdAction struct { tokenIndex int tokenScanner cdFunc diff --git a/example/astx/ast.grammar/ast/internal/parser/parser.go b/example/astx/ast.grammar/ast/internal/parser/parser.go index 023d6593..609825ae 100644 --- a/example/astx/ast.grammar/ast/internal/parser/parser.go +++ b/example/astx/ast.grammar/ast/internal/parser/parser.go @@ -93,10 +93,23 @@ type Parser struct { stack *stack nextToken *token.Token userContext interface{} + + // + // Working data, should be method parameters/locals + // but putting them here simplifies a bit the code + // Useful only for longest prefix partial parsing + // + needsRepositioning bool + isNonDeterministic bool + tokens iface.CheckPointable + afterPos iface.CheckPoint + checkPoint iface.CheckPoint + underlyingStream iface.TokenStream } +type TokenStream = iface.TokenStream + type ( - TokenStream = iface.TokenStream fakeCp struct{} fakeCheckPointable struct{} ) @@ -105,12 +118,16 @@ func (f fakeCheckPointable) GetCheckPoint() iface.CheckPoint { return fakeCp{} } -func (f fakeCheckPointable) GotoCheckPoint(iface.CheckPoint) {} - func (f fakeCp) DistanceFrom(o iface.CheckPoint) int { return 0 } +func (f fakeCp) Advance(o int) iface.CheckPoint { + return fakeCp{} +} + +func (f fakeCheckPointable) GotoCheckPoint(iface.CheckPoint) {} + func NewParser() *Parser { return NewParserWithContext(nil) } @@ -205,62 +222,73 @@ func (p *Parser) newError(err error) error { return e } -func (p *Parser) Parse(scanner iface.Scanner) (res interface{}, err error, ptl int) { +func (p *Parser) prepareParsing(scanner iface.Scanner, longest bool) error { + p.Reset() + p.needsRepositioning = longest + p.isNonDeterministic = false + if p.needsRepositioning { + if streamScanner, _ := scanner.(iface.StreamScanner); streamScanner != nil { + p.underlyingStream = streamScanner.GetStream() + } + if p.tokens, _ = scanner.(iface.CheckPointable); p.tokens == nil || p.underlyingStream == nil { + return errNotRepositionable + } + } else { + if p.tokens, _ = scanner.(iface.CheckPointable); p.tokens == nil { + p.tokens = fakeCheckPointable{} + } + } + return nil +} + +func (p *Parser) Parse(scanner iface.Scanner) (res interface{}, err error) { + if err := p.prepareParsing(scanner, false); err != nil { + return nil, err + } return p.parse(scanner, false) } -func (p *Parser) ParseLongestPrefix(scanner iface.Scanner) (res interface{}, err error, ptl int) { - return p.parse(scanner, true) +func (p *Parser) ParseLongestPrefix(scanner iface.Scanner) (res interface{}, err error, parsed []byte) { + if err := p.prepareParsing(scanner, true); err != nil { + return nil, err, []byte{} + } + startPoint := p.tokens.GetCheckPoint() + res, err = p.parse(scanner, true) + if err == nil { + currPoint := p.tokens.GetCheckPoint() + p.tokens.GotoCheckPoint(startPoint) + parsed = make([]byte, currPoint.DistanceFrom(startPoint)) + p.underlyingStream.Read(parsed) + p.tokens.GotoCheckPoint(currPoint) + } + return } var errNotRepositionable = errors.New("scanner not repositionable") -func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, err error, ptl int) { - var ( - tokens iface.CheckPointable - afterPos iface.CheckPoint - checkPoint iface.CheckPoint - ) - readNextToken := func() error { - if tokens == nil && (len(parserActions.table[p.stack.top()].cdActions) > 0 || longest) { - return errNotRepositionable - } - if longest { - checkPoint = tokens.GetCheckPoint() - } +func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, err error) { + readNextToken := func() { + p.checkPoint = p.tokens.GetCheckPoint() p.nextToken = scanner.Scan() - if longest { - afterPos = tokens.GetCheckPoint() - } - return nil - } - p.Reset() - if tokens, _ = scanner.(iface.CheckPointable); tokens == nil { - tokens = fakeCheckPointable{} - } - underlyingStream := TokenStream(nil) - if streamScanner, _ := scanner.(iface.StreamScanner); streamScanner != nil { - underlyingStream = streamScanner.GetStream() - } - startCp := tokens.GetCheckPoint() - if err := readNextToken(); err != nil { - return nil, err, tokens.GetCheckPoint().DistanceFrom(startCp) + p.afterPos = p.tokens.GetCheckPoint() + return } + readNextToken() for acc := false; !acc; { action := parserActions.table[p.stack.top()].actions[p.nextToken.Type] - if action == nil && underlyingStream != nil && len(parserActions.table[p.stack.top()].cdActions) > 0 { + if action == nil && p.isNonDeterministic { // // If no action, check if we have some context dependent parsing to try // for _, cdAction := range parserActions.table[p.stack.top()].cdActions { - tokens.GotoCheckPoint(checkPoint) - cd_res, cd_err, cd_parsed := cdAction.tokenScanner(underlyingStream, p.userContext) - if cd_err == nil && cd_parsed > 0 { + p.tokens.GotoCheckPoint(p.checkPoint.Advance(len(p.nextToken.IgnoredPrefix))) + cd_res, cd_err, cd_parsed := cdAction.tokenScanner(p.underlyingStream, p.userContext) + if cd_err == nil && len(cd_parsed) > 0 { action = parserActions.table[p.stack.top()].actions[cdAction.tokenIndex] if action != nil { p.nextToken.Foreign = true p.nextToken.ForeignAstNode = cd_res - p.nextToken.Lit = []byte{} + p.nextToken.Lit = cd_parsed p.nextToken.Type = token.Type(cdAction.tokenIndex) break } @@ -275,13 +303,13 @@ func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, er // Dirty, dirty, dirty... but I found it as it is, and I prefer not to touch // if action == nil && longest { - tokens.GotoCheckPoint(checkPoint) + p.tokens.GotoCheckPoint(p.checkPoint) action = parserActions.table[p.stack.top()].actions[token.EOF] if action == nil { // // ok, let's consume the token then // - tokens.GotoCheckPoint(afterPos) + p.tokens.GotoCheckPoint(p.afterPos) } } @@ -291,7 +319,7 @@ func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, er if action == nil { if recovered, errAttrib := p.Error(nil, scanner); !recovered { p.nextToken = errAttrib.ErrorToken - return nil, p.newError(nil), tokens.GetCheckPoint().DistanceFrom(startCp) + return nil, p.newError(nil) } if action = parserActions.table[p.stack.top()].actions[p.nextToken.Type]; action == nil { panic("Error recovery led to invalid action") @@ -307,14 +335,12 @@ func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, er if p.nextToken.Foreign { p.stack.push(int(act), p.nextToken.ForeignAstNode) } - if err := readNextToken(); err != nil { - return nil, err, tokens.GetCheckPoint().DistanceFrom(startCp) - } + readNextToken() case reduce: prod := productionsTable[int(act)] attrib, err := prod.ReduceFunc(p.userContext, p.stack.popN(prod.NumSymbols)) if err != nil { - return nil, p.newError(err), tokens.GetCheckPoint().DistanceFrom(startCp) + return nil, p.newError(err) } else { p.stack.push(gotoTab[p.stack.top()][prod.NTType], attrib) } @@ -322,5 +348,5 @@ func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, er panic("unknown action: " + action.String()) } } - return res, nil, tokens.GetCheckPoint().DistanceFrom(startCp) + return res, nil } diff --git a/example/astx/ast.grammar/ast/internal/token/token.go b/example/astx/ast.grammar/ast/internal/token/token.go index 0a391a0b..6bbf99ec 100644 --- a/example/astx/ast.grammar/ast/internal/token/token.go +++ b/example/astx/ast.grammar/ast/internal/token/token.go @@ -8,7 +8,8 @@ import ( type Token struct { Type - Lit []byte + Lit []byte + IgnoredPrefix []byte Pos ForeignAstNode interface{} Foreign bool diff --git a/example/astx/ast.grammar/ast/main/main.go b/example/astx/ast.grammar/ast/main/main.go index 897b31a0..f8e22fc6 100644 --- a/example/astx/ast.grammar/ast/main/main.go +++ b/example/astx/ast.grammar/ast/main/main.go @@ -9,11 +9,15 @@ import ( ast "github.com/maxcalandrelli/gocc/example/astx/ast.grammar/ast" ) -func showResult(r interface{}, e error, l int) { +func showResult(r interface{}, e error, p []byte) { if e != nil { fmt.Fprintf(os.Stderr, "parsing returned the following error: %s\n", e.Error()) } else { - fmt.Printf("r=%#v, %d bytes\n", r, l) + if len(p) > 0 { + fmt.Printf("r=%#v, (%s)\n", r, string(p)) + } else { + fmt.Printf("r=%#v\n", r) + } } } @@ -23,11 +27,12 @@ var ( Longest bool ) -func parse(longest bool, lex *ast.Lexer) (res interface{}, err error, ptl int) { +func parse(longest bool, lex *ast.Lexer) (res interface{}, err error, parsed []byte) { if longest { return ast.NewParser().ParseLongestPrefix(lex) } else { - return ast.NewParser().Parse(lex) + res, err = ast.NewParser().Parse(lex) + parsed = []byte{} } return } diff --git a/example/astx/ast_test.go b/example/astx/ast_test.go index 9e6b1c4b..1f71c18b 100644 --- a/example/astx/ast_test.go +++ b/example/astx/ast_test.go @@ -29,7 +29,7 @@ func test(src []byte) (astree ast.StmtList, err error) { fmt.Printf("input: %s\n", src) s := grammar.NewLexerBytes(src) p := grammar.NewParser() - a, err, _ := p.Parse(s) + a, err := p.Parse(s) if err == nil { astree = a.(ast.StmtList) } diff --git a/example/bools/bools.grammar/bools/grammar.go b/example/bools/bools.grammar/bools/bools.go similarity index 79% rename from example/bools/bools.grammar/bools/grammar.go rename to example/bools/bools.grammar/bools/bools.go index 835045ed..8a84cb36 100644 --- a/example/bools/bools.grammar/bools/grammar.go +++ b/example/bools/bools.grammar/bools/bools.go @@ -30,82 +30,82 @@ func NewParser() *parser.Parser { return parser.NewParser() } -func ParseFile(fpath string) (interface{}, error, int) { +func ParseFile(fpath string) (interface{}, error) { if lexer, err := NewLexerFile(fpath); err == nil { return NewParser().Parse(lexer) } else { - return nil, err, 0 + return nil, err } } -func ParseText(text string) (interface{}, error, int) { +func ParseText(text string) (interface{}, error) { return NewParser().Parse(NewLexerBytes([]byte(text))) } -func Parse(stream io.Reader) (interface{}, error, int) { +func Parse(stream io.Reader) (interface{}, error) { lex, err := NewLexer(stream) if lex == nil { - return nil, err, 0 + return nil, err } return NewParser().Parse(lex) } -func ParseFileWithData(fpath string, userData interface{}) (interface{}, error, int) { +func ParseFileWithData(fpath string, userData interface{}) (interface{}, error) { if lexer, err := NewLexerFile(fpath); err == nil { return NewParser().SetContext(userData).Parse(lexer) } else { - return nil, err, 0 + return nil, err } } -func ParseTextWithData(text string, userData interface{}) (interface{}, error, int) { +func ParseTextWithData(text string, userData interface{}) (interface{}, error) { return NewParser().SetContext(userData).Parse(NewLexerBytes([]byte(text))) } -func ParseWithData(stream io.Reader, userData interface{}) (interface{}, error, int) { +func ParseWithData(stream io.Reader, userData interface{}) (interface{}, error) { lex, err := NewLexer(stream) if lex == nil { - return nil, err, 0 + return nil, err } return NewParser().SetContext(userData).Parse(lex) } -func ParseFilePartial(fpath string) (interface{}, error, int) { +func ParseFilePartial(fpath string) (interface{}, error, []byte) { if lexer, err := NewLexerFile(fpath); err == nil { return NewParser().ParseLongestPrefix(lexer) } else { - return nil, err, 0 + return nil, err, []byte{} } } -func ParseTextPartial(text string) (interface{}, error, int) { +func ParseTextPartial(text string) (interface{}, error, []byte) { return NewParser().ParseLongestPrefix(NewLexerBytes([]byte(text))) } -func ParsePartial(stream io.Reader) (interface{}, error, int) { +func ParsePartial(stream io.Reader) (interface{}, error, []byte) { lex, err := NewLexer(stream) if lex == nil { - return nil, err, 0 + return nil, err, []byte{} } return NewParser().ParseLongestPrefix(lex) } -func ParseFileWithDataPartial(fpath string, userData interface{}) (interface{}, error, int) { +func ParseFileWithDataPartial(fpath string, userData interface{}) (interface{}, error, []byte) { if lexer, err := NewLexerFile(fpath); err == nil { return NewParser().SetContext(userData).ParseLongestPrefix(lexer) } else { - return nil, err, 0 + return nil, err, []byte{} } } -func ParseTextWithDataPartial(text string, userData interface{}) (interface{}, error, int) { +func ParseTextWithDataPartial(text string, userData interface{}) (interface{}, error, []byte) { return NewParser().SetContext(userData).ParseLongestPrefix(NewLexerBytes([]byte(text))) } -func ParseWithDataPartial(stream io.Reader, userData interface{}) (interface{}, error, int) { +func ParseWithDataPartial(stream io.Reader, userData interface{}) (interface{}, error, []byte) { lex, err := NewLexer(stream) if lex == nil { - return nil, err, 0 + return nil, err, []byte{} } return NewParser().SetContext(userData).ParseLongestPrefix(lex) } diff --git a/example/bools/bools.grammar/bools/iface/bools.go b/example/bools/bools.grammar/bools/iface/bools.go index c73b05de..ded52d2b 100644 --- a/example/bools/bools.grammar/bools/iface/bools.go +++ b/example/bools/bools.grammar/bools/iface/bools.go @@ -25,6 +25,7 @@ type ( CheckPoint interface { DistanceFrom(CheckPoint) int + Advance(int) CheckPoint } CheckPointable interface { diff --git a/example/bools/bools.grammar/bools/internal/lexer/lexer.go b/example/bools/bools.grammar/bools/internal/lexer/lexer.go index 6fcc393f..e196f1e7 100644 --- a/example/bools/bools.grammar/bools/internal/lexer/lexer.go +++ b/example/bools/bools.grammar/bools/internal/lexer/lexer.go @@ -78,6 +78,10 @@ func (c checkPoint) DistanceFrom (o iface.CheckPoint) int { return int (c.value() - o.(checkPoint).value()) } +func (c checkPoint) Advance (o int) iface.CheckPoint { + return checkPoint(c.value() + int64(o)) +} + func (l *Lexer) GetCheckPoint() iface.CheckPoint { if l == nil { return checkPoint(0) @@ -93,10 +97,10 @@ func (l Lexer) GotoCheckPoint(cp iface.CheckPoint) { func (l *Lexer) Scan() (tok *token.Token) { tok = new(token.Token) tok.Type = token.INVALID - tok.Lit = []byte{} start := l.position state := 0 for state != -1 { + savePos := l.position.Pos curr, size, err := l.stream.ReadRune() if size < 1 || err != nil { curr = INVALID_RUNE @@ -129,12 +133,14 @@ func (l *Lexer) Scan() (tok *token.Token) { start = l.position state = 0 tok.Lit = []byte{} + tok.IgnoredPrefix=append(tok.IgnoredPrefix,string(curr)...) } } else if curr != INVALID_RUNE{ if len(tok.Lit) == 0 { tok.Lit = append(tok.Lit, string(curr)...) } else { l.stream.UnreadRune() + l.position.Pos = savePos } } if err == io.EOF && len(tok.Lit)==0 { diff --git a/example/bools/bools.grammar/bools/internal/parser/actiontable.go b/example/bools/bools.grammar/bools/internal/parser/actiontable.go index 0fb32df6..2e06d3a0 100644 --- a/example/bools/bools.grammar/bools/internal/parser/actiontable.go +++ b/example/bools/bools.grammar/bools/internal/parser/actiontable.go @@ -4,7 +4,7 @@ package parser type ( actionTable [numStates]actionRow - cdFunc func(TokenStream, interface{}) (interface{}, error, int) + cdFunc func(TokenStream, interface{}) (interface{}, error, []byte) cdAction struct { tokenIndex int tokenScanner cdFunc diff --git a/example/bools/bools.grammar/bools/internal/parser/parser.go b/example/bools/bools.grammar/bools/internal/parser/parser.go index ea029330..55f04cba 100644 --- a/example/bools/bools.grammar/bools/internal/parser/parser.go +++ b/example/bools/bools.grammar/bools/internal/parser/parser.go @@ -93,10 +93,23 @@ type Parser struct { stack *stack nextToken *token.Token userContext interface{} + + // + // Working data, should be method parameters/locals + // but putting them here simplifies a bit the code + // Useful only for longest prefix partial parsing + // + needsRepositioning bool + isNonDeterministic bool + tokens iface.CheckPointable + afterPos iface.CheckPoint + checkPoint iface.CheckPoint + underlyingStream iface.TokenStream } +type TokenStream = iface.TokenStream + type ( - TokenStream = iface.TokenStream fakeCp struct{} fakeCheckPointable struct{} ) @@ -105,12 +118,16 @@ func (f fakeCheckPointable) GetCheckPoint() iface.CheckPoint { return fakeCp{} } -func (f fakeCheckPointable) GotoCheckPoint(iface.CheckPoint) {} - func (f fakeCp) DistanceFrom(o iface.CheckPoint) int { return 0 } +func (f fakeCp) Advance(o int) iface.CheckPoint { + return fakeCp{} +} + +func (f fakeCheckPointable) GotoCheckPoint(iface.CheckPoint) {} + func NewParser() *Parser { return NewParserWithContext(nil) } @@ -205,62 +222,73 @@ func (p *Parser) newError(err error) error { return e } -func (p *Parser) Parse(scanner iface.Scanner) (res interface{}, err error, ptl int) { +func (p *Parser) prepareParsing(scanner iface.Scanner, longest bool) error { + p.Reset() + p.needsRepositioning = longest + p.isNonDeterministic = false + if p.needsRepositioning { + if streamScanner, _ := scanner.(iface.StreamScanner); streamScanner != nil { + p.underlyingStream = streamScanner.GetStream() + } + if p.tokens, _ = scanner.(iface.CheckPointable); p.tokens == nil || p.underlyingStream == nil { + return errNotRepositionable + } + } else { + if p.tokens, _ = scanner.(iface.CheckPointable); p.tokens == nil { + p.tokens = fakeCheckPointable{} + } + } + return nil +} + +func (p *Parser) Parse(scanner iface.Scanner) (res interface{}, err error) { + if err := p.prepareParsing(scanner, false); err != nil { + return nil, err + } return p.parse(scanner, false) } -func (p *Parser) ParseLongestPrefix(scanner iface.Scanner) (res interface{}, err error, ptl int) { - return p.parse(scanner, true) +func (p *Parser) ParseLongestPrefix(scanner iface.Scanner) (res interface{}, err error, parsed []byte) { + if err := p.prepareParsing(scanner, true); err != nil { + return nil, err, []byte{} + } + startPoint := p.tokens.GetCheckPoint() + res, err = p.parse(scanner, true) + if err == nil { + currPoint := p.tokens.GetCheckPoint() + p.tokens.GotoCheckPoint(startPoint) + parsed = make([]byte, currPoint.DistanceFrom(startPoint)) + p.underlyingStream.Read(parsed) + p.tokens.GotoCheckPoint(currPoint) + } + return } var errNotRepositionable = errors.New("scanner not repositionable") -func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, err error, ptl int) { - var ( - tokens iface.CheckPointable - afterPos iface.CheckPoint - checkPoint iface.CheckPoint - ) - readNextToken := func() error { - if tokens == nil && (len(parserActions.table[p.stack.top()].cdActions) > 0 || longest) { - return errNotRepositionable - } - if longest { - checkPoint = tokens.GetCheckPoint() - } +func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, err error) { + readNextToken := func() { + p.checkPoint = p.tokens.GetCheckPoint() p.nextToken = scanner.Scan() - if longest { - afterPos = tokens.GetCheckPoint() - } - return nil - } - p.Reset() - if tokens, _ = scanner.(iface.CheckPointable); tokens == nil { - tokens = fakeCheckPointable{} - } - underlyingStream := TokenStream(nil) - if streamScanner, _ := scanner.(iface.StreamScanner); streamScanner != nil { - underlyingStream = streamScanner.GetStream() - } - startCp := tokens.GetCheckPoint() - if err := readNextToken(); err != nil { - return nil, err, tokens.GetCheckPoint().DistanceFrom(startCp) + p.afterPos = p.tokens.GetCheckPoint() + return } + readNextToken() for acc := false; !acc; { action := parserActions.table[p.stack.top()].actions[p.nextToken.Type] - if action == nil && underlyingStream != nil && len(parserActions.table[p.stack.top()].cdActions) > 0 { + if action == nil && p.isNonDeterministic { // // If no action, check if we have some context dependent parsing to try // for _, cdAction := range parserActions.table[p.stack.top()].cdActions { - tokens.GotoCheckPoint(checkPoint) - cd_res, cd_err, cd_parsed := cdAction.tokenScanner(underlyingStream, p.userContext) - if cd_err == nil && cd_parsed > 0 { + p.tokens.GotoCheckPoint(p.checkPoint.Advance(len(p.nextToken.IgnoredPrefix))) + cd_res, cd_err, cd_parsed := cdAction.tokenScanner(p.underlyingStream, p.userContext) + if cd_err == nil && len(cd_parsed) > 0 { action = parserActions.table[p.stack.top()].actions[cdAction.tokenIndex] if action != nil { p.nextToken.Foreign = true p.nextToken.ForeignAstNode = cd_res - p.nextToken.Lit = []byte{} + p.nextToken.Lit = cd_parsed p.nextToken.Type = token.Type(cdAction.tokenIndex) break } @@ -275,13 +303,13 @@ func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, er // Dirty, dirty, dirty... but I found it as it is, and I prefer not to touch // if action == nil && longest { - tokens.GotoCheckPoint(checkPoint) + p.tokens.GotoCheckPoint(p.checkPoint) action = parserActions.table[p.stack.top()].actions[token.EOF] if action == nil { // // ok, let's consume the token then // - tokens.GotoCheckPoint(afterPos) + p.tokens.GotoCheckPoint(p.afterPos) } } @@ -291,7 +319,7 @@ func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, er if action == nil { if recovered, errAttrib := p.Error(nil, scanner); !recovered { p.nextToken = errAttrib.ErrorToken - return nil, p.newError(nil), tokens.GetCheckPoint().DistanceFrom(startCp) + return nil, p.newError(nil) } if action = parserActions.table[p.stack.top()].actions[p.nextToken.Type]; action == nil { panic("Error recovery led to invalid action") @@ -307,14 +335,12 @@ func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, er if p.nextToken.Foreign { p.stack.push(int(act), p.nextToken.ForeignAstNode) } - if err := readNextToken(); err != nil { - return nil, err, tokens.GetCheckPoint().DistanceFrom(startCp) - } + readNextToken() case reduce: prod := productionsTable[int(act)] attrib, err := prod.ReduceFunc(p.userContext, p.stack.popN(prod.NumSymbols)) if err != nil { - return nil, p.newError(err), tokens.GetCheckPoint().DistanceFrom(startCp) + return nil, p.newError(err) } else { p.stack.push(gotoTab[p.stack.top()][prod.NTType], attrib) } @@ -322,5 +348,5 @@ func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, er panic("unknown action: " + action.String()) } } - return res, nil, tokens.GetCheckPoint().DistanceFrom(startCp) + return res, nil } diff --git a/example/bools/bools.grammar/bools/internal/token/token.go b/example/bools/bools.grammar/bools/internal/token/token.go index 9b421b64..636102f0 100644 --- a/example/bools/bools.grammar/bools/internal/token/token.go +++ b/example/bools/bools.grammar/bools/internal/token/token.go @@ -8,7 +8,8 @@ import ( type Token struct { Type - Lit []byte + Lit []byte + IgnoredPrefix []byte Pos ForeignAstNode interface{} Foreign bool @@ -107,13 +108,13 @@ var TokMap = TokenMap{ }, litMap: map[string]Type{ - "|": 3, "(": 4, "false": 7, "<": 9, ">": 10, - "in": 12, "&": 2, + "|": 3, + "in": 12, ")": 5, "true": 6, }, diff --git a/example/bools/bools.grammar/bools/main/main.go b/example/bools/bools.grammar/bools/main/main.go index 62d09d69..acd02169 100644 --- a/example/bools/bools.grammar/bools/main/main.go +++ b/example/bools/bools.grammar/bools/main/main.go @@ -9,11 +9,15 @@ import ( bools "github.com/maxcalandrelli/gocc/example/bools/bools.grammar/bools" ) -func showResult(r interface{}, e error, l int) { +func showResult(r interface{}, e error, p []byte) { if e != nil { fmt.Fprintf(os.Stderr, "parsing returned the following error: %s\n", e.Error()) } else { - fmt.Printf("r=%#v, %d bytes\n", r, l) + if len(p) > 0 { + fmt.Printf("r=%#v, (%s)\n", r, string(p)) + } else { + fmt.Printf("r=%#v\n", r) + } } } @@ -23,11 +27,12 @@ var ( Longest bool ) -func parse(longest bool, lex *bools.Lexer) (res interface{}, err error, ptl int) { +func parse(longest bool, lex *bools.Lexer) (res interface{}, err error, parsed []byte) { if longest { return bools.NewParser().ParseLongestPrefix(lex) } else { - return bools.NewParser().Parse(lex) + res, err = bools.NewParser().Parse(lex) + parsed = []byte{} } return } diff --git a/example/bools/example_test.go b/example/bools/example_test.go index 3d7e79a5..7af78e8d 100644 --- a/example/bools/example_test.go +++ b/example/bools/example_test.go @@ -24,7 +24,7 @@ import ( func testEval(t *testing.T, exampleStr string, output bool) { lex := bools.NewLexerString(exampleStr) p := bools.NewParser() - st, err, _ := p.Parse(lex) + st, err := p.Parse(lex) if err != nil { panic(err) } diff --git a/example/calc/Makefile b/example/calc/Makefile index fbe8769e..9e88a6ad 100644 --- a/example/calc/Makefile +++ b/example/calc/Makefile @@ -1,2 +1,2 @@ regenerate: - gocc calc.bnf \ No newline at end of file + gocc -a calc.bnf \ No newline at end of file diff --git a/example/calc/calc.bnf b/example/calc/calc.bnf index 547ba4cd..3b46e981 100644 --- a/example/calc/calc.bnf +++ b/example/calc/calc.bnf @@ -8,7 +8,7 @@ int64 : '1'-'9' {_digit} ; /* Syntax part */ -<< +<< import( "github.com/maxcalandrelli/gocc/example/calc/calc.grammar/calc/internal/token" "github.com/maxcalandrelli/gocc/example/calc/calc.grammar/calc/internal/util" @@ -18,13 +18,17 @@ import( Calc : Expr; Expr : - Expr "+" Term << $0.(int64) + $2.(int64), nil >> - | Term + Term "+" Term << $0.(int64) + $2.(int64), nil >> + | Term "-" Term << $0.(int64) - $2.(int64), nil >> + | "-" Term << -$1.(int64), nil >> + | Term "*" Factor << $0.(int64) * $2.(int64), nil >> + | Term "/" Factor << $0.(int64) / $2.(int64), nil >> + | Term << $0.(int64), nil >> ; Term : Term "*" Factor << $0.(int64) * $2.(int64), nil >> - | Factor + | Factor ; Factor : diff --git a/example/calc/calc.grammar/calc/grammar.go b/example/calc/calc.grammar/calc/calc.go similarity index 79% rename from example/calc/calc.grammar/calc/grammar.go rename to example/calc/calc.grammar/calc/calc.go index 825170e1..1eb9671f 100644 --- a/example/calc/calc.grammar/calc/grammar.go +++ b/example/calc/calc.grammar/calc/calc.go @@ -30,82 +30,82 @@ func NewParser() *parser.Parser { return parser.NewParser() } -func ParseFile(fpath string) (interface{}, error, int) { +func ParseFile(fpath string) (interface{}, error) { if lexer, err := NewLexerFile(fpath); err == nil { return NewParser().Parse(lexer) } else { - return nil, err, 0 + return nil, err } } -func ParseText(text string) (interface{}, error, int) { +func ParseText(text string) (interface{}, error) { return NewParser().Parse(NewLexerBytes([]byte(text))) } -func Parse(stream io.Reader) (interface{}, error, int) { +func Parse(stream io.Reader) (interface{}, error) { lex, err := NewLexer(stream) if lex == nil { - return nil, err, 0 + return nil, err } return NewParser().Parse(lex) } -func ParseFileWithData(fpath string, userData interface{}) (interface{}, error, int) { +func ParseFileWithData(fpath string, userData interface{}) (interface{}, error) { if lexer, err := NewLexerFile(fpath); err == nil { return NewParser().SetContext(userData).Parse(lexer) } else { - return nil, err, 0 + return nil, err } } -func ParseTextWithData(text string, userData interface{}) (interface{}, error, int) { +func ParseTextWithData(text string, userData interface{}) (interface{}, error) { return NewParser().SetContext(userData).Parse(NewLexerBytes([]byte(text))) } -func ParseWithData(stream io.Reader, userData interface{}) (interface{}, error, int) { +func ParseWithData(stream io.Reader, userData interface{}) (interface{}, error) { lex, err := NewLexer(stream) if lex == nil { - return nil, err, 0 + return nil, err } return NewParser().SetContext(userData).Parse(lex) } -func ParseFilePartial(fpath string) (interface{}, error, int) { +func ParseFilePartial(fpath string) (interface{}, error, []byte) { if lexer, err := NewLexerFile(fpath); err == nil { return NewParser().ParseLongestPrefix(lexer) } else { - return nil, err, 0 + return nil, err, []byte{} } } -func ParseTextPartial(text string) (interface{}, error, int) { +func ParseTextPartial(text string) (interface{}, error, []byte) { return NewParser().ParseLongestPrefix(NewLexerBytes([]byte(text))) } -func ParsePartial(stream io.Reader) (interface{}, error, int) { +func ParsePartial(stream io.Reader) (interface{}, error, []byte) { lex, err := NewLexer(stream) if lex == nil { - return nil, err, 0 + return nil, err, []byte{} } return NewParser().ParseLongestPrefix(lex) } -func ParseFileWithDataPartial(fpath string, userData interface{}) (interface{}, error, int) { +func ParseFileWithDataPartial(fpath string, userData interface{}) (interface{}, error, []byte) { if lexer, err := NewLexerFile(fpath); err == nil { return NewParser().SetContext(userData).ParseLongestPrefix(lexer) } else { - return nil, err, 0 + return nil, err, []byte{} } } -func ParseTextWithDataPartial(text string, userData interface{}) (interface{}, error, int) { +func ParseTextWithDataPartial(text string, userData interface{}) (interface{}, error, []byte) { return NewParser().SetContext(userData).ParseLongestPrefix(NewLexerBytes([]byte(text))) } -func ParseWithDataPartial(stream io.Reader, userData interface{}) (interface{}, error, int) { +func ParseWithDataPartial(stream io.Reader, userData interface{}) (interface{}, error, []byte) { lex, err := NewLexer(stream) if lex == nil { - return nil, err, 0 + return nil, err, []byte{} } return NewParser().SetContext(userData).ParseLongestPrefix(lex) } diff --git a/example/calc/calc.grammar/calc/iface/calc.go b/example/calc/calc.grammar/calc/iface/calc.go index 6a75ee1a..60021543 100644 --- a/example/calc/calc.grammar/calc/iface/calc.go +++ b/example/calc/calc.grammar/calc/iface/calc.go @@ -25,6 +25,7 @@ type ( CheckPoint interface { DistanceFrom(CheckPoint) int + Advance(int) CheckPoint } CheckPointable interface { diff --git a/example/calc/calc.grammar/calc/internal/lexer/acttab.go b/example/calc/calc.grammar/calc/internal/lexer/acttab.go index cbd91e61..28f284a0 100644 --- a/example/calc/calc.grammar/calc/internal/lexer/acttab.go +++ b/example/calc/calc.grammar/calc/internal/lexer/acttab.go @@ -29,27 +29,35 @@ var ActTab = ActionTable{ Ignore: "!whitespace", }, ActionRow{ // S2, Accept("Λ<(>") - Accept: 4, + Accept: 6, Ignore: "", }, ActionRow{ // S3, Accept("Λ<)>") - Accept: 5, + Accept: 7, Ignore: "", }, ActionRow{ // S4, Accept("Λ<*>") - Accept: 3, + Accept: 4, Ignore: "", }, ActionRow{ // S5, Accept("Λ<+>") Accept: 2, Ignore: "", }, - ActionRow{ // S6, Accept("int64") - Accept: 6, + ActionRow{ // S6, Accept("Λ<->") + Accept: 3, Ignore: "", }, - ActionRow{ // S7, Accept("int64") - Accept: 6, + ActionRow{ // S7, Accept("Λ") + Accept: 5, + Ignore: "", + }, + ActionRow{ // S8, Accept("int64") + Accept: 8, + Ignore: "", + }, + ActionRow{ // S9, Accept("int64") + Accept: 8, Ignore: "", }, } diff --git a/example/calc/calc.grammar/calc/internal/lexer/lexer.go b/example/calc/calc.grammar/calc/internal/lexer/lexer.go index 681db6f0..6169b0d0 100644 --- a/example/calc/calc.grammar/calc/internal/lexer/lexer.go +++ b/example/calc/calc.grammar/calc/internal/lexer/lexer.go @@ -16,8 +16,8 @@ import ( const ( NoState = -1 - NumStates = 8 - NumSymbols = 11 + NumStates = 10 + NumSymbols = 13 INVALID_RUNE = rune(-1) ) @@ -78,6 +78,10 @@ func (c checkPoint) DistanceFrom (o iface.CheckPoint) int { return int (c.value() - o.(checkPoint).value()) } +func (c checkPoint) Advance (o int) iface.CheckPoint { + return checkPoint(c.value() + int64(o)) +} + func (l *Lexer) GetCheckPoint() iface.CheckPoint { if l == nil { return checkPoint(0) @@ -93,10 +97,10 @@ func (l Lexer) GotoCheckPoint(cp iface.CheckPoint) { func (l *Lexer) Scan() (tok *token.Token) { tok = new(token.Token) tok.Type = token.INVALID - tok.Lit = []byte{} start := l.position state := 0 for state != -1 { + savePos := l.position.Pos curr, size, err := l.stream.ReadRune() if size < 1 || err != nil { curr = INVALID_RUNE @@ -129,12 +133,14 @@ func (l *Lexer) Scan() (tok *token.Token) { start = l.position state = 0 tok.Lit = []byte{} + tok.IgnoredPrefix=append(tok.IgnoredPrefix,string(curr)...) } } else if curr != INVALID_RUNE{ if len(tok.Lit) == 0 { tok.Lit = append(tok.Lit, string(curr)...) } else { l.stream.UnreadRune() + l.position.Pos = savePos } } if err == io.EOF && len(tok.Lit)==0 { diff --git a/example/calc/calc.grammar/calc/internal/lexer/transitiontable.go b/example/calc/calc.grammar/calc/internal/lexer/transitiontable.go index 9edc0aec..6d5d2a50 100644 --- a/example/calc/calc.grammar/calc/internal/lexer/transitiontable.go +++ b/example/calc/calc.grammar/calc/internal/lexer/transitiontable.go @@ -29,8 +29,12 @@ var TransTab = TransitionTable{ return 4 case r == 43: // ['+','+'] return 5 - case 49 <= r && r <= 57: // ['1','9'] + case r == 45: // ['-','-'] return 6 + case r == 47: // ['/','/'] + return 7 + case 49 <= r && r <= 57: // ['1','9'] + return 8 } return NoState }, @@ -67,16 +71,28 @@ var TransTab = TransitionTable{ // S6 func(r rune) int { switch { - case 48 <= r && r <= 57: // ['0','9'] - return 7 } return NoState }, // S7 + func(r rune) int { + switch { + } + return NoState + }, + // S8 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 7 + return 9 + } + return NoState + }, + // S9 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 9 } return NoState }, diff --git a/example/calc/calc.grammar/calc/internal/parser/actiontable.go b/example/calc/calc.grammar/calc/internal/parser/actiontable.go index a135aecf..29361f5b 100644 --- a/example/calc/calc.grammar/calc/internal/parser/actiontable.go +++ b/example/calc/calc.grammar/calc/internal/parser/actiontable.go @@ -4,7 +4,7 @@ package parser type ( actionTable [numStates]actionRow - cdFunc func(TokenStream, interface{}) (interface{}, error, int) + cdFunc func(TokenStream, interface{}) (interface{}, error, []byte) cdAction struct { tokenIndex int tokenScanner cdFunc @@ -27,10 +27,12 @@ var parserActions = actions{ nil, // ά nil, // Ω nil, // "+" + shift(5), // "-" nil, // "*" - shift(5), // "(" + nil, // "/" + shift(6), // "(" nil, // ")" - shift(6), // int64 + shift(7), // int64 }, cdActions: []cdAction{}, }, @@ -40,7 +42,9 @@ var parserActions = actions{ nil, // ά accept(true), // Ω nil, // "+" + nil, // "-" nil, // "*" + nil, // "/" nil, // "(" nil, // ")" nil, // int64 @@ -52,8 +56,10 @@ var parserActions = actions{ actions: [numSymbols]action{ nil, // ά reduce(1), // Ω, reduce: Calc - shift(7), // "+" + nil, // "+" + nil, // "-" nil, // "*" + nil, // "/" nil, // "(" nil, // ")" nil, // int64 @@ -64,9 +70,11 @@ var parserActions = actions{ canRecover: false, actions: [numSymbols]action{ nil, // ά - reduce(3), // Ω, reduce: Expr - reduce(3), // "+", reduce: Expr - shift(8), // "*" + reduce(7), // Ω, reduce: Expr + shift(8), // "+" + shift(9), // "-" + shift(10), // "*" + shift(11), // "/" nil, // "(" nil, // ")" nil, // int64 @@ -77,9 +85,11 @@ var parserActions = actions{ canRecover: false, actions: [numSymbols]action{ nil, // ά - reduce(5), // Ω, reduce: Term - reduce(5), // "+", reduce: Term - reduce(5), // "*", reduce: Term + reduce(9), // Ω, reduce: Term + reduce(9), // "+", reduce: Term + reduce(9), // "-", reduce: Term + reduce(9), // "*", reduce: Term + reduce(9), // "/", reduce: Term nil, // "(" nil, // ")" nil, // int64 @@ -92,10 +102,12 @@ var parserActions = actions{ nil, // ά nil, // Ω nil, // "+" + nil, // "-" nil, // "*" - shift(12), // "(" + nil, // "/" + shift(14), // "(" nil, // ")" - shift(13), // int64 + shift(15), // int64 }, cdActions: []cdAction{}, }, @@ -103,222 +115,766 @@ var parserActions = actions{ canRecover: false, actions: [numSymbols]action{ nil, // ά - reduce(7), // Ω, reduce: Factor - reduce(7), // "+", reduce: Factor - reduce(7), // "*", reduce: Factor - nil, // "(" + nil, // Ω + nil, // "+" + shift(19), // "-" + nil, // "*" + nil, // "/" + shift(20), // "(" nil, // ")" - nil, // int64 + shift(21), // int64 }, cdActions: []cdAction{}, }, actionRow{ // S7 canRecover: false, actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // "+" - nil, // "*" - shift(5), // "(" - nil, // ")" - shift(6), // int64 + nil, // ά + reduce(11), // Ω, reduce: Factor + reduce(11), // "+", reduce: Factor + reduce(11), // "-", reduce: Factor + reduce(11), // "*", reduce: Factor + reduce(11), // "/", reduce: Factor + nil, // "(" + nil, // ")" + nil, // int64 }, cdActions: []cdAction{}, }, actionRow{ // S8 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // "+" + nil, // "-" + nil, // "*" + nil, // "/" + shift(14), // "(" + nil, // ")" + shift(15), // int64 + }, + cdActions: []cdAction{}, + }, + actionRow{ // S9 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // "+" + nil, // "-" + nil, // "*" + nil, // "/" + shift(14), // "(" + nil, // ")" + shift(15), // int64 + }, + cdActions: []cdAction{}, + }, + actionRow{ // S10 canRecover: false, actions: [numSymbols]action{ nil, // ά nil, // Ω nil, // "+" + nil, // "-" nil, // "*" - shift(5), // "(" + nil, // "/" + shift(6), // "(" nil, // ")" - shift(6), // int64 + shift(7), // int64 }, cdActions: []cdAction{}, }, - actionRow{ // S9 + actionRow{ // S11 canRecover: false, actions: [numSymbols]action{ nil, // ά nil, // Ω - shift(16), // "+" + nil, // "+" + nil, // "-" nil, // "*" + nil, // "/" + shift(26), // "(" + nil, // ")" + shift(27), // int64 + }, + cdActions: []cdAction{}, + }, + actionRow{ // S12 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(4), // Ω, reduce: Expr + nil, // "+" + nil, // "-" + shift(28), // "*" + nil, // "/" nil, // "(" - shift(17), // ")" + nil, // ")" nil, // int64 }, cdActions: []cdAction{}, }, - actionRow{ // S10 + actionRow{ // S13 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(9), // Ω, reduce: Term + nil, // "+" + nil, // "-" + reduce(9), // "*", reduce: Term + nil, // "/" + nil, // "(" + nil, // ")" + nil, // int64 + }, + cdActions: []cdAction{}, + }, + actionRow{ // S14 canRecover: false, actions: [numSymbols]action{ nil, // ά nil, // Ω - reduce(3), // "+", reduce: Expr - shift(18), // "*" + nil, // "+" + shift(19), // "-" + nil, // "*" + nil, // "/" + shift(20), // "(" + nil, // ")" + shift(21), // int64 + }, + cdActions: []cdAction{}, + }, + actionRow{ // S15 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(11), // Ω, reduce: Factor + nil, // "+" + nil, // "-" + reduce(11), // "*", reduce: Factor + nil, // "/" + nil, // "(" + nil, // ")" + nil, // int64 + }, + cdActions: []cdAction{}, + }, + actionRow{ // S16 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // "+" + nil, // "-" + nil, // "*" + nil, // "/" nil, // "(" - reduce(3), // ")", reduce: Expr + shift(30), // ")" nil, // int64 }, cdActions: []cdAction{}, }, - actionRow{ // S11 + actionRow{ // S17 canRecover: false, actions: [numSymbols]action{ nil, // ά nil, // Ω - reduce(5), // "+", reduce: Term - reduce(5), // "*", reduce: Term + shift(31), // "+" + shift(32), // "-" + shift(33), // "*" + shift(34), // "/" nil, // "(" - reduce(5), // ")", reduce: Term + reduce(7), // ")", reduce: Expr nil, // int64 }, cdActions: []cdAction{}, }, - actionRow{ // S12 + actionRow{ // S18 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + reduce(9), // "+", reduce: Term + reduce(9), // "-", reduce: Term + reduce(9), // "*", reduce: Term + reduce(9), // "/", reduce: Term + nil, // "(" + reduce(9), // ")", reduce: Term + nil, // int64 + }, + cdActions: []cdAction{}, + }, + actionRow{ // S19 canRecover: false, actions: [numSymbols]action{ nil, // ά nil, // Ω nil, // "+" + nil, // "-" nil, // "*" - shift(12), // "(" + nil, // "/" + shift(37), // "(" nil, // ")" - shift(13), // int64 + shift(38), // int64 }, cdActions: []cdAction{}, }, - actionRow{ // S13 + actionRow{ // S20 canRecover: false, actions: [numSymbols]action{ nil, // ά nil, // Ω - reduce(7), // "+", reduce: Factor - reduce(7), // "*", reduce: Factor + nil, // "+" + shift(19), // "-" + nil, // "*" + nil, // "/" + shift(20), // "(" + nil, // ")" + shift(21), // int64 + }, + cdActions: []cdAction{}, + }, + actionRow{ // S21 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + reduce(11), // "+", reduce: Factor + reduce(11), // "-", reduce: Factor + reduce(11), // "*", reduce: Factor + reduce(11), // "/", reduce: Factor + nil, // "(" + reduce(11), // ")", reduce: Factor + nil, // int64 + }, + cdActions: []cdAction{}, + }, + actionRow{ // S22 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(2), // Ω, reduce: Expr + nil, // "+" + nil, // "-" + shift(28), // "*" + nil, // "/" nil, // "(" - reduce(7), // ")", reduce: Factor + nil, // ")" nil, // int64 }, cdActions: []cdAction{}, }, - actionRow{ // S14 + actionRow{ // S23 canRecover: false, actions: [numSymbols]action{ nil, // ά - reduce(2), // Ω, reduce: Expr - reduce(2), // "+", reduce: Expr - shift(8), // "*" + reduce(3), // Ω, reduce: Expr + nil, // "+" + nil, // "-" + shift(28), // "*" + nil, // "/" nil, // "(" nil, // ")" nil, // int64 }, cdActions: []cdAction{}, }, - actionRow{ // S15 + actionRow{ // S24 canRecover: false, actions: [numSymbols]action{ nil, // ά - reduce(4), // Ω, reduce: Term - reduce(4), // "+", reduce: Term - reduce(4), // "*", reduce: Term + reduce(5), // Ω, reduce: Expr + reduce(8), // "+", reduce: Term + reduce(8), // "-", reduce: Term + reduce(8), // "*", reduce: Term + reduce(8), // "/", reduce: Term nil, // "(" nil, // ")" nil, // int64 }, cdActions: []cdAction{}, }, - actionRow{ // S16 + actionRow{ // S25 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(6), // Ω, reduce: Expr + nil, // "+" + nil, // "-" + nil, // "*" + nil, // "/" + nil, // "(" + nil, // ")" + nil, // int64 + }, + cdActions: []cdAction{}, + }, + actionRow{ // S26 canRecover: false, actions: [numSymbols]action{ nil, // ά nil, // Ω nil, // "+" + shift(19), // "-" nil, // "*" - shift(12), // "(" + nil, // "/" + shift(20), // "(" nil, // ")" - shift(13), // int64 + shift(21), // int64 }, cdActions: []cdAction{}, }, - actionRow{ // S17 + actionRow{ // S27 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(11), // Ω, reduce: Factor + nil, // "+" + nil, // "-" + nil, // "*" + nil, // "/" + nil, // "(" + nil, // ")" + nil, // int64 + }, + cdActions: []cdAction{}, + }, + actionRow{ // S28 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // "+" + nil, // "-" + nil, // "*" + nil, // "/" + shift(14), // "(" + nil, // ")" + shift(15), // int64 + }, + cdActions: []cdAction{}, + }, + actionRow{ // S29 canRecover: false, actions: [numSymbols]action{ nil, // ά - reduce(6), // Ω, reduce: Factor - reduce(6), // "+", reduce: Factor - reduce(6), // "*", reduce: Factor + nil, // Ω + nil, // "+" + nil, // "-" + nil, // "*" + nil, // "/" nil, // "(" + shift(42), // ")" + nil, // int64 + }, + cdActions: []cdAction{}, + }, + actionRow{ // S30 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(10), // Ω, reduce: Factor + reduce(10), // "+", reduce: Factor + reduce(10), // "-", reduce: Factor + reduce(10), // "*", reduce: Factor + reduce(10), // "/", reduce: Factor + nil, // "(" + nil, // ")" + nil, // int64 + }, + cdActions: []cdAction{}, + }, + actionRow{ // S31 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // "+" + nil, // "-" + nil, // "*" + nil, // "/" + shift(37), // "(" nil, // ")" + shift(38), // int64 + }, + cdActions: []cdAction{}, + }, + actionRow{ // S32 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // "+" + nil, // "-" + nil, // "*" + nil, // "/" + shift(37), // "(" + nil, // ")" + shift(38), // int64 + }, + cdActions: []cdAction{}, + }, + actionRow{ // S33 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // "+" + nil, // "-" + nil, // "*" + nil, // "/" + shift(20), // "(" + nil, // ")" + shift(21), // int64 + }, + cdActions: []cdAction{}, + }, + actionRow{ // S34 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // "+" + nil, // "-" + nil, // "*" + nil, // "/" + shift(47), // "(" + nil, // ")" + shift(48), // int64 + }, + cdActions: []cdAction{}, + }, + actionRow{ // S35 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // "+" + nil, // "-" + shift(49), // "*" + nil, // "/" + nil, // "(" + reduce(4), // ")", reduce: Expr nil, // int64 }, cdActions: []cdAction{}, }, - actionRow{ // S18 + actionRow{ // S36 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // "+" + nil, // "-" + reduce(9), // "*", reduce: Term + nil, // "/" + nil, // "(" + reduce(9), // ")", reduce: Term + nil, // int64 + }, + cdActions: []cdAction{}, + }, + actionRow{ // S37 canRecover: false, actions: [numSymbols]action{ nil, // ά nil, // Ω nil, // "+" + shift(19), // "-" nil, // "*" - shift(12), // "(" + nil, // "/" + shift(20), // "(" nil, // ")" - shift(13), // int64 + shift(21), // int64 }, cdActions: []cdAction{}, }, - actionRow{ // S19 + actionRow{ // S38 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // "+" + nil, // "-" + reduce(11), // "*", reduce: Factor + nil, // "/" + nil, // "(" + reduce(11), // ")", reduce: Factor + nil, // int64 + }, + cdActions: []cdAction{}, + }, + actionRow{ // S39 canRecover: false, actions: [numSymbols]action{ nil, // ά nil, // Ω - shift(16), // "+" + nil, // "+" + nil, // "-" nil, // "*" + nil, // "/" nil, // "(" - shift(22), // ")" + shift(51), // ")" nil, // int64 }, cdActions: []cdAction{}, }, - actionRow{ // S20 + actionRow{ // S40 canRecover: false, actions: [numSymbols]action{ nil, // ά nil, // Ω - reduce(2), // "+", reduce: Expr - shift(18), // "*" + nil, // "+" + nil, // "-" + nil, // "*" + nil, // "/" + nil, // "(" + shift(52), // ")" + nil, // int64 + }, + cdActions: []cdAction{}, + }, + actionRow{ // S41 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(8), // Ω, reduce: Term + nil, // "+" + nil, // "-" + reduce(8), // "*", reduce: Term + nil, // "/" + nil, // "(" + nil, // ")" + nil, // int64 + }, + cdActions: []cdAction{}, + }, + actionRow{ // S42 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(10), // Ω, reduce: Factor + nil, // "+" + nil, // "-" + reduce(10), // "*", reduce: Factor + nil, // "/" + nil, // "(" + nil, // ")" + nil, // int64 + }, + cdActions: []cdAction{}, + }, + actionRow{ // S43 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // "+" + nil, // "-" + shift(49), // "*" + nil, // "/" nil, // "(" reduce(2), // ")", reduce: Expr nil, // int64 }, cdActions: []cdAction{}, }, - actionRow{ // S21 + actionRow{ // S44 canRecover: false, actions: [numSymbols]action{ nil, // ά nil, // Ω - reduce(4), // "+", reduce: Term - reduce(4), // "*", reduce: Term + nil, // "+" + nil, // "-" + shift(49), // "*" + nil, // "/" nil, // "(" - reduce(4), // ")", reduce: Term + reduce(3), // ")", reduce: Expr nil, // int64 }, cdActions: []cdAction{}, }, - actionRow{ // S22 + actionRow{ // S45 canRecover: false, actions: [numSymbols]action{ nil, // ά nil, // Ω - reduce(6), // "+", reduce: Factor - reduce(6), // "*", reduce: Factor + reduce(8), // "+", reduce: Term + reduce(8), // "-", reduce: Term + reduce(8), // "*", reduce: Term + reduce(8), // "/", reduce: Term nil, // "(" - reduce(6), // ")", reduce: Factor + reduce(5), // ")", reduce: Expr nil, // int64 }, cdActions: []cdAction{}, }, + actionRow{ // S46 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // "+" + nil, // "-" + nil, // "*" + nil, // "/" + nil, // "(" + reduce(6), // ")", reduce: Expr + nil, // int64 + }, + cdActions: []cdAction{}, + }, + actionRow{ // S47 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // "+" + shift(19), // "-" + nil, // "*" + nil, // "/" + shift(20), // "(" + nil, // ")" + shift(21), // int64 + }, + cdActions: []cdAction{}, + }, + actionRow{ // S48 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // "+" + nil, // "-" + nil, // "*" + nil, // "/" + nil, // "(" + reduce(11), // ")", reduce: Factor + nil, // int64 + }, + cdActions: []cdAction{}, + }, + actionRow{ // S49 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // "+" + nil, // "-" + nil, // "*" + nil, // "/" + shift(37), // "(" + nil, // ")" + shift(38), // int64 + }, + cdActions: []cdAction{}, + }, + actionRow{ // S50 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // "+" + nil, // "-" + nil, // "*" + nil, // "/" + nil, // "(" + shift(55), // ")" + nil, // int64 + }, + cdActions: []cdAction{}, + }, + actionRow{ // S51 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + reduce(10), // "+", reduce: Factor + reduce(10), // "-", reduce: Factor + reduce(10), // "*", reduce: Factor + reduce(10), // "/", reduce: Factor + nil, // "(" + reduce(10), // ")", reduce: Factor + nil, // int64 + }, + cdActions: []cdAction{}, + }, + actionRow{ // S52 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(10), // Ω, reduce: Factor + nil, // "+" + nil, // "-" + nil, // "*" + nil, // "/" + nil, // "(" + nil, // ")" + nil, // int64 + }, + cdActions: []cdAction{}, + }, + actionRow{ // S53 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // "+" + nil, // "-" + nil, // "*" + nil, // "/" + nil, // "(" + shift(56), // ")" + nil, // int64 + }, + cdActions: []cdAction{}, + }, + actionRow{ // S54 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // "+" + nil, // "-" + reduce(8), // "*", reduce: Term + nil, // "/" + nil, // "(" + reduce(8), // ")", reduce: Term + nil, // int64 + }, + cdActions: []cdAction{}, + }, + actionRow{ // S55 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // "+" + nil, // "-" + reduce(10), // "*", reduce: Factor + nil, // "/" + nil, // "(" + reduce(10), // ")", reduce: Factor + nil, // int64 + }, + cdActions: []cdAction{}, + }, + actionRow{ // S56 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // "+" + nil, // "-" + nil, // "*" + nil, // "/" + nil, // "(" + reduce(10), // ")", reduce: Factor + nil, // int64 + }, + cdActions: []cdAction{}, + }, }, } diff --git a/example/calc/calc.grammar/calc/internal/parser/gototable.go b/example/calc/calc.grammar/calc/internal/parser/gototable.go index 518e496d..5987b86c 100644 --- a/example/calc/calc.grammar/calc/internal/parser/gototable.go +++ b/example/calc/calc.grammar/calc/internal/parser/gototable.go @@ -48,58 +48,58 @@ var gotoTab = gotoTable{ gotoRow{ // S5 -1, // Π -1, // Π - 9, // Π - 10, // Π - 11, // Π + -1, // Π + 12, // Π + 13, // Π }, gotoRow{ // S6 -1, // Π -1, // Π - -1, // Π - -1, // Π - -1, // Π + 16, // Π + 17, // Π + 18, // Π }, gotoRow{ // S7 -1, // Π -1, // Π -1, // Π - 14, // Π - 4, // Π + -1, // Π + -1, // Π }, gotoRow{ // S8 -1, // Π -1, // Π -1, // Π - -1, // Π - 15, // Π + 22, // Π + 13, // Π }, gotoRow{ // S9 -1, // Π -1, // Π -1, // Π - -1, // Π - -1, // Π + 23, // Π + 13, // Π }, gotoRow{ // S10 -1, // Π -1, // Π -1, // Π -1, // Π - -1, // Π + 24, // Π }, gotoRow{ // S11 -1, // Π -1, // Π -1, // Π -1, // Π - -1, // Π + 25, // Π }, gotoRow{ // S12 -1, // Π -1, // Π - 19, // Π - 10, // Π - 11, // Π + -1, // Π + -1, // Π + -1, // Π }, gotoRow{ // S13 -1, // Π @@ -111,9 +111,9 @@ var gotoTab = gotoTable{ gotoRow{ // S14 -1, // Π -1, // Π - -1, // Π - -1, // Π - -1, // Π + 29, // Π + 17, // Π + 18, // Π }, gotoRow{ // S15 -1, // Π @@ -126,8 +126,8 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 20, // Π - 11, // Π + -1, // Π + -1, // Π }, gotoRow{ // S17 -1, // Π @@ -141,30 +141,268 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 21, // Π + -1, // Π }, gotoRow{ // S19 + -1, // Π + -1, // Π + -1, // Π + 35, // Π + 36, // Π + }, + gotoRow{ // S20 + -1, // Π + -1, // Π + 39, // Π + 17, // Π + 18, // Π + }, + gotoRow{ // S21 -1, // Π -1, // Π -1, // Π -1, // Π -1, // Π }, - gotoRow{ // S20 + gotoRow{ // S22 -1, // Π -1, // Π -1, // Π -1, // Π -1, // Π }, - gotoRow{ // S21 + gotoRow{ // S23 -1, // Π -1, // Π -1, // Π -1, // Π -1, // Π }, - gotoRow{ // S22 + gotoRow{ // S24 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S25 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S26 + -1, // Π + -1, // Π + 40, // Π + 17, // Π + 18, // Π + }, + gotoRow{ // S27 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S28 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + 41, // Π + }, + gotoRow{ // S29 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S30 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S31 + -1, // Π + -1, // Π + -1, // Π + 43, // Π + 36, // Π + }, + gotoRow{ // S32 + -1, // Π + -1, // Π + -1, // Π + 44, // Π + 36, // Π + }, + gotoRow{ // S33 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + 45, // Π + }, + gotoRow{ // S34 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + 46, // Π + }, + gotoRow{ // S35 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S36 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S37 + -1, // Π + -1, // Π + 50, // Π + 17, // Π + 18, // Π + }, + gotoRow{ // S38 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S39 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S40 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S41 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S42 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S43 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S44 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S45 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S46 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S47 + -1, // Π + -1, // Π + 53, // Π + 17, // Π + 18, // Π + }, + gotoRow{ // S48 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S49 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + 54, // Π + }, + gotoRow{ // S50 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S51 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S52 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S53 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S54 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S55 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S56 -1, // Π -1, // Π -1, // Π diff --git a/example/calc/calc.grammar/calc/internal/parser/parser.go b/example/calc/calc.grammar/calc/internal/parser/parser.go index a3b61d8b..ee512b32 100644 --- a/example/calc/calc.grammar/calc/internal/parser/parser.go +++ b/example/calc/calc.grammar/calc/internal/parser/parser.go @@ -13,9 +13,9 @@ import ( ) const ( - numProductions = 8 - numStates = 23 - numSymbols = 12 + numProductions = 12 + numStates = 57 + numSymbols = 14 ) // Stack @@ -93,10 +93,23 @@ type Parser struct { stack *stack nextToken *token.Token userContext interface{} + + // + // Working data, should be method parameters/locals + // but putting them here simplifies a bit the code + // Useful only for longest prefix partial parsing + // + needsRepositioning bool + isNonDeterministic bool + tokens iface.CheckPointable + afterPos iface.CheckPoint + checkPoint iface.CheckPoint + underlyingStream iface.TokenStream } +type TokenStream = iface.TokenStream + type ( - TokenStream = iface.TokenStream fakeCp struct{} fakeCheckPointable struct{} ) @@ -105,12 +118,16 @@ func (f fakeCheckPointable) GetCheckPoint() iface.CheckPoint { return fakeCp{} } -func (f fakeCheckPointable) GotoCheckPoint(iface.CheckPoint) {} - func (f fakeCp) DistanceFrom(o iface.CheckPoint) int { return 0 } +func (f fakeCp) Advance(o int) iface.CheckPoint { + return fakeCp{} +} + +func (f fakeCheckPointable) GotoCheckPoint(iface.CheckPoint) {} + func NewParser() *Parser { return NewParserWithContext(nil) } @@ -205,62 +222,73 @@ func (p *Parser) newError(err error) error { return e } -func (p *Parser) Parse(scanner iface.Scanner) (res interface{}, err error, ptl int) { +func (p *Parser) prepareParsing(scanner iface.Scanner, longest bool) error { + p.Reset() + p.needsRepositioning = longest + p.isNonDeterministic = false + if p.needsRepositioning { + if streamScanner, _ := scanner.(iface.StreamScanner); streamScanner != nil { + p.underlyingStream = streamScanner.GetStream() + } + if p.tokens, _ = scanner.(iface.CheckPointable); p.tokens == nil || p.underlyingStream == nil { + return errNotRepositionable + } + } else { + if p.tokens, _ = scanner.(iface.CheckPointable); p.tokens == nil { + p.tokens = fakeCheckPointable{} + } + } + return nil +} + +func (p *Parser) Parse(scanner iface.Scanner) (res interface{}, err error) { + if err := p.prepareParsing(scanner, false); err != nil { + return nil, err + } return p.parse(scanner, false) } -func (p *Parser) ParseLongestPrefix(scanner iface.Scanner) (res interface{}, err error, ptl int) { - return p.parse(scanner, true) +func (p *Parser) ParseLongestPrefix(scanner iface.Scanner) (res interface{}, err error, parsed []byte) { + if err := p.prepareParsing(scanner, true); err != nil { + return nil, err, []byte{} + } + startPoint := p.tokens.GetCheckPoint() + res, err = p.parse(scanner, true) + if err == nil { + currPoint := p.tokens.GetCheckPoint() + p.tokens.GotoCheckPoint(startPoint) + parsed = make([]byte, currPoint.DistanceFrom(startPoint)) + p.underlyingStream.Read(parsed) + p.tokens.GotoCheckPoint(currPoint) + } + return } var errNotRepositionable = errors.New("scanner not repositionable") -func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, err error, ptl int) { - var ( - tokens iface.CheckPointable - afterPos iface.CheckPoint - checkPoint iface.CheckPoint - ) - readNextToken := func() error { - if tokens == nil && (len(parserActions.table[p.stack.top()].cdActions) > 0 || longest) { - return errNotRepositionable - } - if longest { - checkPoint = tokens.GetCheckPoint() - } +func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, err error) { + readNextToken := func() { + p.checkPoint = p.tokens.GetCheckPoint() p.nextToken = scanner.Scan() - if longest { - afterPos = tokens.GetCheckPoint() - } - return nil - } - p.Reset() - if tokens, _ = scanner.(iface.CheckPointable); tokens == nil { - tokens = fakeCheckPointable{} - } - underlyingStream := TokenStream(nil) - if streamScanner, _ := scanner.(iface.StreamScanner); streamScanner != nil { - underlyingStream = streamScanner.GetStream() - } - startCp := tokens.GetCheckPoint() - if err := readNextToken(); err != nil { - return nil, err, tokens.GetCheckPoint().DistanceFrom(startCp) + p.afterPos = p.tokens.GetCheckPoint() + return } + readNextToken() for acc := false; !acc; { action := parserActions.table[p.stack.top()].actions[p.nextToken.Type] - if action == nil && underlyingStream != nil && len(parserActions.table[p.stack.top()].cdActions) > 0 { + if action == nil && p.isNonDeterministic { // // If no action, check if we have some context dependent parsing to try // for _, cdAction := range parserActions.table[p.stack.top()].cdActions { - tokens.GotoCheckPoint(checkPoint) - cd_res, cd_err, cd_parsed := cdAction.tokenScanner(underlyingStream, p.userContext) - if cd_err == nil && cd_parsed > 0 { + p.tokens.GotoCheckPoint(p.checkPoint.Advance(len(p.nextToken.IgnoredPrefix))) + cd_res, cd_err, cd_parsed := cdAction.tokenScanner(p.underlyingStream, p.userContext) + if cd_err == nil && len(cd_parsed) > 0 { action = parserActions.table[p.stack.top()].actions[cdAction.tokenIndex] if action != nil { p.nextToken.Foreign = true p.nextToken.ForeignAstNode = cd_res - p.nextToken.Lit = []byte{} + p.nextToken.Lit = cd_parsed p.nextToken.Type = token.Type(cdAction.tokenIndex) break } @@ -275,13 +303,13 @@ func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, er // Dirty, dirty, dirty... but I found it as it is, and I prefer not to touch // if action == nil && longest { - tokens.GotoCheckPoint(checkPoint) + p.tokens.GotoCheckPoint(p.checkPoint) action = parserActions.table[p.stack.top()].actions[token.EOF] if action == nil { // // ok, let's consume the token then // - tokens.GotoCheckPoint(afterPos) + p.tokens.GotoCheckPoint(p.afterPos) } } @@ -291,7 +319,7 @@ func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, er if action == nil { if recovered, errAttrib := p.Error(nil, scanner); !recovered { p.nextToken = errAttrib.ErrorToken - return nil, p.newError(nil), tokens.GetCheckPoint().DistanceFrom(startCp) + return nil, p.newError(nil) } if action = parserActions.table[p.stack.top()].actions[p.nextToken.Type]; action == nil { panic("Error recovery led to invalid action") @@ -307,14 +335,12 @@ func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, er if p.nextToken.Foreign { p.stack.push(int(act), p.nextToken.ForeignAstNode) } - if err := readNextToken(); err != nil { - return nil, err, tokens.GetCheckPoint().DistanceFrom(startCp) - } + readNextToken() case reduce: prod := productionsTable[int(act)] attrib, err := prod.ReduceFunc(p.userContext, p.stack.popN(prod.NumSymbols)) if err != nil { - return nil, p.newError(err), tokens.GetCheckPoint().DistanceFrom(startCp) + return nil, p.newError(err) } else { p.stack.push(gotoTab[p.stack.top()][prod.NTType], attrib) } @@ -322,5 +348,5 @@ func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, er panic("unknown action: " + action.String()) } } - return res, nil, tokens.GetCheckPoint().DistanceFrom(startCp) + return res, nil } diff --git a/example/calc/calc.grammar/calc/internal/parser/productionstable.go b/example/calc/calc.grammar/calc/internal/parser/productionstable.go index 20f534a1..8ceaac98 100644 --- a/example/calc/calc.grammar/calc/internal/parser/productionstable.go +++ b/example/calc/calc.grammar/calc/internal/parser/productionstable.go @@ -44,7 +44,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `Expr : Π Λ<+> Π << X[0].(int64) + X[2].(int64), nil >>`, + String: `Expr : Π Λ<+> Π << X[0].(int64) + X[2].(int64), nil >>`, Id: "Expr", NTType: 2, Index: 2, @@ -54,20 +54,60 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `Expr : Π << >>`, + String: `Expr : Π Λ<-> Π << X[0].(int64) - X[2].(int64), nil >>`, Id: "Expr", NTType: 2, Index: 3, + NumSymbols: 3, + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { + return X[0].(int64) - X[2].(int64), nil + }, + }, + ProdTabEntry{ + String: `Expr : Λ<-> Π << -X[1].(int64), nil >>`, + Id: "Expr", + NTType: 2, + Index: 4, + NumSymbols: 2, + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { + return -X[1].(int64), nil + }, + }, + ProdTabEntry{ + String: `Expr : Π Λ<*> Π << X[0].(int64) * X[2].(int64), nil >>`, + Id: "Expr", + NTType: 2, + Index: 5, + NumSymbols: 3, + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { + return X[0].(int64) * X[2].(int64), nil + }, + }, + ProdTabEntry{ + String: `Expr : Π Λ Π << X[0].(int64) / X[2].(int64), nil >>`, + Id: "Expr", + NTType: 2, + Index: 6, + NumSymbols: 3, + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { + return X[0].(int64) / X[2].(int64), nil + }, + }, + ProdTabEntry{ + String: `Expr : Π << X[0].(int64), nil >>`, + Id: "Expr", + NTType: 2, + Index: 7, NumSymbols: 1, ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { - return X[0], nil + return X[0].(int64), nil }, }, ProdTabEntry{ String: `Term : Π Λ<*> Π << X[0].(int64) * X[2].(int64), nil >>`, Id: "Term", NTType: 3, - Index: 4, + Index: 8, NumSymbols: 3, ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { return X[0].(int64) * X[2].(int64), nil @@ -77,7 +117,7 @@ var productionsTable = ProdTab{ String: `Term : Π << >>`, Id: "Term", NTType: 3, - Index: 5, + Index: 9, NumSymbols: 1, ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { return X[0], nil @@ -87,7 +127,7 @@ var productionsTable = ProdTab{ String: `Factor : Λ<(> Π Λ<)> << X[1], nil >>`, Id: "Factor", NTType: 4, - Index: 6, + Index: 10, NumSymbols: 3, ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { return X[1], nil @@ -97,7 +137,7 @@ var productionsTable = ProdTab{ String: `Factor : int64 << util.IntValue(X[0].(*token.Token).Lit) >>`, Id: "Factor", NTType: 4, - Index: 7, + Index: 11, NumSymbols: 1, ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { return util.IntValue(X[0].(*token.Token).Lit) diff --git a/example/calc/calc.grammar/calc/internal/token/token.go b/example/calc/calc.grammar/calc/internal/token/token.go index de95ccf2..d9589291 100644 --- a/example/calc/calc.grammar/calc/internal/token/token.go +++ b/example/calc/calc.grammar/calc/internal/token/token.go @@ -8,7 +8,8 @@ import ( type Token struct { Type - Lit []byte + Lit []byte + IgnoredPrefix []byte Pos ForeignAstNode interface{} Foreign bool @@ -78,7 +79,9 @@ var TokMap = TokenMap{ "INVALID", "Ω", "Λ<+>", + "Λ<->", "Λ<*>", + "Λ", "Λ<(>", "Λ<)>", "int64", @@ -88,16 +91,20 @@ var TokMap = TokenMap{ "INVALID": 0, "Ω": 1, "Λ<+>": 2, - "Λ<*>": 3, - "Λ<(>": 4, - "Λ<)>": 5, - "int64": 6, + "Λ<->": 3, + "Λ<*>": 4, + "Λ": 5, + "Λ<(>": 6, + "Λ<)>": 7, + "int64": 8, }, litMap: map[string]Type{ "+": 2, - "*": 3, - "(": 4, - ")": 5, + "-": 3, + "*": 4, + "/": 5, + "(": 6, + ")": 7, }, } diff --git a/example/calc/calc.grammar/calc/main/main.go b/example/calc/calc.grammar/calc/main/main.go index b5befd80..bdd46e6c 100644 --- a/example/calc/calc.grammar/calc/main/main.go +++ b/example/calc/calc.grammar/calc/main/main.go @@ -9,11 +9,15 @@ import ( calc "github.com/maxcalandrelli/gocc/example/calc/calc.grammar/calc" ) -func showResult(r interface{}, e error, l int) { +func showResult(r interface{}, e error, p []byte) { if e != nil { fmt.Fprintf(os.Stderr, "parsing returned the following error: %s\n", e.Error()) } else { - fmt.Printf("r=%#v, %d bytes\n", r, l) + if len(p) > 0 { + fmt.Printf("r=%#v, (%s)\n", r, string(p)) + } else { + fmt.Printf("r=%#v\n", r) + } } } @@ -23,11 +27,12 @@ var ( Longest bool ) -func parse(longest bool, lex *calc.Lexer) (res interface{}, err error, ptl int) { +func parse(longest bool, lex *calc.Lexer) (res interface{}, err error, parsed []byte) { if longest { return calc.NewParser().ParseLongestPrefix(lex) } else { - return calc.NewParser().Parse(lex) + res, err = calc.NewParser().Parse(lex) + parsed = []byte{} } return } diff --git a/example/calc/calc_test.go b/example/calc/calc_test.go index a7239ec8..f917e938 100644 --- a/example/calc/calc_test.go +++ b/example/calc/calc_test.go @@ -21,7 +21,7 @@ func Test1(t *testing.T) { p := calc.NewParser() for _, ts := range testData { s := calc.NewLexerString(ts.src) - sum, err, _ := p.Parse(s) + sum, err := p.Parse(s) if err != nil { t.Error(err) } diff --git a/example/ctx/ctx.grammar/ctx/grammar.go b/example/ctx/ctx.grammar/ctx/ctx.go similarity index 79% rename from example/ctx/ctx.grammar/ctx/grammar.go rename to example/ctx/ctx.grammar/ctx/ctx.go index 449f634a..f42ab260 100644 --- a/example/ctx/ctx.grammar/ctx/grammar.go +++ b/example/ctx/ctx.grammar/ctx/ctx.go @@ -30,82 +30,82 @@ func NewParser() *parser.Parser { return parser.NewParser() } -func ParseFile(fpath string) (interface{}, error, int) { +func ParseFile(fpath string) (interface{}, error) { if lexer, err := NewLexerFile(fpath); err == nil { return NewParser().Parse(lexer) } else { - return nil, err, 0 + return nil, err } } -func ParseText(text string) (interface{}, error, int) { +func ParseText(text string) (interface{}, error) { return NewParser().Parse(NewLexerBytes([]byte(text))) } -func Parse(stream io.Reader) (interface{}, error, int) { +func Parse(stream io.Reader) (interface{}, error) { lex, err := NewLexer(stream) if lex == nil { - return nil, err, 0 + return nil, err } return NewParser().Parse(lex) } -func ParseFileWithData(fpath string, userData interface{}) (interface{}, error, int) { +func ParseFileWithData(fpath string, userData interface{}) (interface{}, error) { if lexer, err := NewLexerFile(fpath); err == nil { return NewParser().SetContext(userData).Parse(lexer) } else { - return nil, err, 0 + return nil, err } } -func ParseTextWithData(text string, userData interface{}) (interface{}, error, int) { +func ParseTextWithData(text string, userData interface{}) (interface{}, error) { return NewParser().SetContext(userData).Parse(NewLexerBytes([]byte(text))) } -func ParseWithData(stream io.Reader, userData interface{}) (interface{}, error, int) { +func ParseWithData(stream io.Reader, userData interface{}) (interface{}, error) { lex, err := NewLexer(stream) if lex == nil { - return nil, err, 0 + return nil, err } return NewParser().SetContext(userData).Parse(lex) } -func ParseFilePartial(fpath string) (interface{}, error, int) { +func ParseFilePartial(fpath string) (interface{}, error, []byte) { if lexer, err := NewLexerFile(fpath); err == nil { return NewParser().ParseLongestPrefix(lexer) } else { - return nil, err, 0 + return nil, err, []byte{} } } -func ParseTextPartial(text string) (interface{}, error, int) { +func ParseTextPartial(text string) (interface{}, error, []byte) { return NewParser().ParseLongestPrefix(NewLexerBytes([]byte(text))) } -func ParsePartial(stream io.Reader) (interface{}, error, int) { +func ParsePartial(stream io.Reader) (interface{}, error, []byte) { lex, err := NewLexer(stream) if lex == nil { - return nil, err, 0 + return nil, err, []byte{} } return NewParser().ParseLongestPrefix(lex) } -func ParseFileWithDataPartial(fpath string, userData interface{}) (interface{}, error, int) { +func ParseFileWithDataPartial(fpath string, userData interface{}) (interface{}, error, []byte) { if lexer, err := NewLexerFile(fpath); err == nil { return NewParser().SetContext(userData).ParseLongestPrefix(lexer) } else { - return nil, err, 0 + return nil, err, []byte{} } } -func ParseTextWithDataPartial(text string, userData interface{}) (interface{}, error, int) { +func ParseTextWithDataPartial(text string, userData interface{}) (interface{}, error, []byte) { return NewParser().SetContext(userData).ParseLongestPrefix(NewLexerBytes([]byte(text))) } -func ParseWithDataPartial(stream io.Reader, userData interface{}) (interface{}, error, int) { +func ParseWithDataPartial(stream io.Reader, userData interface{}) (interface{}, error, []byte) { lex, err := NewLexer(stream) if lex == nil { - return nil, err, 0 + return nil, err, []byte{} } return NewParser().SetContext(userData).ParseLongestPrefix(lex) } diff --git a/example/ctx/ctx.grammar/ctx/iface/ctx.go b/example/ctx/ctx.grammar/ctx/iface/ctx.go index beb2a6ea..ac85a34d 100644 --- a/example/ctx/ctx.grammar/ctx/iface/ctx.go +++ b/example/ctx/ctx.grammar/ctx/iface/ctx.go @@ -25,6 +25,7 @@ type ( CheckPoint interface { DistanceFrom(CheckPoint) int + Advance(int) CheckPoint } CheckPointable interface { diff --git a/example/ctx/ctx.grammar/ctx/internal/lexer/lexer.go b/example/ctx/ctx.grammar/ctx/internal/lexer/lexer.go index ebb63906..ceaabfd6 100644 --- a/example/ctx/ctx.grammar/ctx/internal/lexer/lexer.go +++ b/example/ctx/ctx.grammar/ctx/internal/lexer/lexer.go @@ -78,6 +78,10 @@ func (c checkPoint) DistanceFrom (o iface.CheckPoint) int { return int (c.value() - o.(checkPoint).value()) } +func (c checkPoint) Advance (o int) iface.CheckPoint { + return checkPoint(c.value() + int64(o)) +} + func (l *Lexer) GetCheckPoint() iface.CheckPoint { if l == nil { return checkPoint(0) @@ -93,10 +97,10 @@ func (l Lexer) GotoCheckPoint(cp iface.CheckPoint) { func (l *Lexer) Scan() (tok *token.Token) { tok = new(token.Token) tok.Type = token.INVALID - tok.Lit = []byte{} start := l.position state := 0 for state != -1 { + savePos := l.position.Pos curr, size, err := l.stream.ReadRune() if size < 1 || err != nil { curr = INVALID_RUNE @@ -129,12 +133,14 @@ func (l *Lexer) Scan() (tok *token.Token) { start = l.position state = 0 tok.Lit = []byte{} + tok.IgnoredPrefix=append(tok.IgnoredPrefix,string(curr)...) } } else if curr != INVALID_RUNE{ if len(tok.Lit) == 0 { tok.Lit = append(tok.Lit, string(curr)...) } else { l.stream.UnreadRune() + l.position.Pos = savePos } } if err == io.EOF && len(tok.Lit)==0 { diff --git a/example/ctx/ctx.grammar/ctx/internal/parser/actiontable.go b/example/ctx/ctx.grammar/ctx/internal/parser/actiontable.go index b70dc5d6..870d528a 100644 --- a/example/ctx/ctx.grammar/ctx/internal/parser/actiontable.go +++ b/example/ctx/ctx.grammar/ctx/internal/parser/actiontable.go @@ -4,7 +4,7 @@ package parser type ( actionTable [numStates]actionRow - cdFunc func(TokenStream, interface{}) (interface{}, error, int) + cdFunc func(TokenStream, interface{}) (interface{}, error, []byte) cdAction struct { tokenIndex int tokenScanner cdFunc diff --git a/example/ctx/ctx.grammar/ctx/internal/parser/parser.go b/example/ctx/ctx.grammar/ctx/internal/parser/parser.go index 69c4c852..ba329ba9 100644 --- a/example/ctx/ctx.grammar/ctx/internal/parser/parser.go +++ b/example/ctx/ctx.grammar/ctx/internal/parser/parser.go @@ -95,10 +95,23 @@ type Parser struct { stack *stack nextToken *token.Token userContext interface{} + + // + // Working data, should be method parameters/locals + // but putting them here simplifies a bit the code + // Useful only for longest prefix partial parsing + // + needsRepositioning bool + isNonDeterministic bool + tokens iface.CheckPointable + afterPos iface.CheckPoint + checkPoint iface.CheckPoint + underlyingStream iface.TokenStream } +type TokenStream = iface.TokenStream + type ( - TokenStream = iface.TokenStream fakeCp struct{} fakeCheckPointable struct{} ) @@ -107,13 +120,17 @@ func (f fakeCheckPointable) GetCheckPoint() iface.CheckPoint { return fakeCp{} } -func (f fakeCheckPointable) GotoCheckPoint(iface.CheckPoint) {} - func (f fakeCp) DistanceFrom(o iface.CheckPoint) int { return 0 } -func cdFunc_calc_0(Stream TokenStream, Context interface{}) (interface{}, error, int) { +func (f fakeCp) Advance(o int) iface.CheckPoint { + return fakeCp{} +} + +func (f fakeCheckPointable) GotoCheckPoint(iface.CheckPoint) {} + +func cdFunc_calc_0(Stream TokenStream, Context interface{}) (interface{}, error, []byte) { return calc.ParseWithDataPartial(Stream, Context) } @@ -211,60 +228,73 @@ func (p *Parser) newError(err error) error { return e } -func (p *Parser) Parse(scanner iface.Scanner) (res interface{}, err error, ptl int) { +func (p *Parser) prepareParsing(scanner iface.Scanner, longest bool) error { + p.Reset() + p.needsRepositioning = true + p.isNonDeterministic = true + if p.needsRepositioning { + if streamScanner, _ := scanner.(iface.StreamScanner); streamScanner != nil { + p.underlyingStream = streamScanner.GetStream() + } + if p.tokens, _ = scanner.(iface.CheckPointable); p.tokens == nil || p.underlyingStream == nil { + return errNotRepositionable + } + } else { + if p.tokens, _ = scanner.(iface.CheckPointable); p.tokens == nil { + p.tokens = fakeCheckPointable{} + } + } + return nil +} + +func (p *Parser) Parse(scanner iface.Scanner) (res interface{}, err error) { + if err := p.prepareParsing(scanner, false); err != nil { + return nil, err + } return p.parse(scanner, false) } -func (p *Parser) ParseLongestPrefix(scanner iface.Scanner) (res interface{}, err error, ptl int) { - return p.parse(scanner, true) +func (p *Parser) ParseLongestPrefix(scanner iface.Scanner) (res interface{}, err error, parsed []byte) { + if err := p.prepareParsing(scanner, true); err != nil { + return nil, err, []byte{} + } + startPoint := p.tokens.GetCheckPoint() + res, err = p.parse(scanner, true) + if err == nil { + currPoint := p.tokens.GetCheckPoint() + p.tokens.GotoCheckPoint(startPoint) + parsed = make([]byte, currPoint.DistanceFrom(startPoint)) + p.underlyingStream.Read(parsed) + p.tokens.GotoCheckPoint(currPoint) + } + return } var errNotRepositionable = errors.New("scanner not repositionable") -func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, err error, ptl int) { - var ( - tokens iface.CheckPointable - afterPos iface.CheckPoint - checkPoint iface.CheckPoint - ) - readNextToken := func() error { - if tokens == nil && (len(parserActions.table[p.stack.top()].cdActions) > 0 || longest) { - return errNotRepositionable - } - checkPoint = tokens.GetCheckPoint() +func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, err error) { + readNextToken := func() { + p.checkPoint = p.tokens.GetCheckPoint() p.nextToken = scanner.Scan() - if longest { - afterPos = tokens.GetCheckPoint() - } - return nil - } - p.Reset() - if tokens, _ = scanner.(iface.CheckPointable); tokens == nil { - tokens = fakeCheckPointable{} - } - underlyingStream := TokenStream(nil) - if streamScanner, _ := scanner.(iface.StreamScanner); streamScanner != nil { - underlyingStream = streamScanner.GetStream() - } - startCp := tokens.GetCheckPoint() - if err := readNextToken(); err != nil { - return nil, err, tokens.GetCheckPoint().DistanceFrom(startCp) + p.afterPos = p.tokens.GetCheckPoint() + return } + readNextToken() for acc := false; !acc; { action := parserActions.table[p.stack.top()].actions[p.nextToken.Type] - if action == nil && underlyingStream != nil && len(parserActions.table[p.stack.top()].cdActions) > 0 { + if action == nil && p.isNonDeterministic { // // If no action, check if we have some context dependent parsing to try // for _, cdAction := range parserActions.table[p.stack.top()].cdActions { - tokens.GotoCheckPoint(checkPoint) - cd_res, cd_err, cd_parsed := cdAction.tokenScanner(underlyingStream, p.userContext) - if cd_err == nil && cd_parsed > 0 { + p.tokens.GotoCheckPoint(p.checkPoint.Advance(len(p.nextToken.IgnoredPrefix))) + cd_res, cd_err, cd_parsed := cdAction.tokenScanner(p.underlyingStream, p.userContext) + if cd_err == nil && len(cd_parsed) > 0 { action = parserActions.table[p.stack.top()].actions[cdAction.tokenIndex] if action != nil { p.nextToken.Foreign = true p.nextToken.ForeignAstNode = cd_res - p.nextToken.Lit = []byte{} + p.nextToken.Lit = cd_parsed p.nextToken.Type = token.Type(cdAction.tokenIndex) break } @@ -279,13 +309,13 @@ func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, er // Dirty, dirty, dirty... but I found it as it is, and I prefer not to touch // if action == nil && longest { - tokens.GotoCheckPoint(checkPoint) + p.tokens.GotoCheckPoint(p.checkPoint) action = parserActions.table[p.stack.top()].actions[token.EOF] if action == nil { // // ok, let's consume the token then // - tokens.GotoCheckPoint(afterPos) + p.tokens.GotoCheckPoint(p.afterPos) } } @@ -295,7 +325,7 @@ func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, er if action == nil { if recovered, errAttrib := p.Error(nil, scanner); !recovered { p.nextToken = errAttrib.ErrorToken - return nil, p.newError(nil), tokens.GetCheckPoint().DistanceFrom(startCp) + return nil, p.newError(nil) } if action = parserActions.table[p.stack.top()].actions[p.nextToken.Type]; action == nil { panic("Error recovery led to invalid action") @@ -311,14 +341,12 @@ func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, er if p.nextToken.Foreign { p.stack.push(int(act), p.nextToken.ForeignAstNode) } - if err := readNextToken(); err != nil { - return nil, err, tokens.GetCheckPoint().DistanceFrom(startCp) - } + readNextToken() case reduce: prod := productionsTable[int(act)] attrib, err := prod.ReduceFunc(p.userContext, p.stack.popN(prod.NumSymbols)) if err != nil { - return nil, p.newError(err), tokens.GetCheckPoint().DistanceFrom(startCp) + return nil, p.newError(err) } else { p.stack.push(gotoTab[p.stack.top()][prod.NTType], attrib) } @@ -326,5 +354,5 @@ func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, er panic("unknown action: " + action.String()) } } - return res, nil, tokens.GetCheckPoint().DistanceFrom(startCp) + return res, nil } diff --git a/example/ctx/ctx.grammar/ctx/internal/token/token.go b/example/ctx/ctx.grammar/ctx/internal/token/token.go index ba4af812..5fbcf921 100644 --- a/example/ctx/ctx.grammar/ctx/internal/token/token.go +++ b/example/ctx/ctx.grammar/ctx/internal/token/token.go @@ -8,7 +8,8 @@ import ( type Token struct { Type - Lit []byte + Lit []byte + IgnoredPrefix []byte Pos ForeignAstNode interface{} Foreign bool diff --git a/example/ctx/ctx.grammar/ctx/main/main.go b/example/ctx/ctx.grammar/ctx/main/main.go index 5ba66677..2bd247b6 100644 --- a/example/ctx/ctx.grammar/ctx/main/main.go +++ b/example/ctx/ctx.grammar/ctx/main/main.go @@ -9,11 +9,15 @@ import ( ctx "github.com/maxcalandrelli/gocc/example/ctx/ctx.grammar/ctx" ) -func showResult(r interface{}, e error, l int) { +func showResult(r interface{}, e error, p []byte) { if e != nil { fmt.Fprintf(os.Stderr, "parsing returned the following error: %s\n", e.Error()) } else { - fmt.Printf("r=%#v, %d bytes\n", r, l) + if len(p) > 0 { + fmt.Printf("r=%#v, (%s)\n", r, string(p)) + } else { + fmt.Printf("r=%#v\n", r) + } } } @@ -23,11 +27,12 @@ var ( Longest bool ) -func parse(longest bool, lex *ctx.Lexer) (res interface{}, err error, ptl int) { +func parse(longest bool, lex *ctx.Lexer) (res interface{}, err error, parsed []byte) { if longest { return ctx.NewParser().ParseLongestPrefix(lex) } else { - return ctx.NewParser().Parse(lex) + res, err = ctx.NewParser().Parse(lex) + parsed = []byte{} } return } diff --git a/example/ctx/ctx_test.go b/example/ctx/ctx_test.go index b47bbb85..be88049a 100644 --- a/example/ctx/ctx_test.go +++ b/example/ctx/ctx_test.go @@ -29,7 +29,7 @@ func test(src []byte) (astree ast.StmtList, err error) { fmt.Printf("input: %s\n", src) s := ctx.NewLexerBytes(src) p := ctx.NewParser() - a, err, _ := p.Parse(s) + a, err := p.Parse(s) if err == nil { astree = a.(ast.StmtList) } diff --git a/example/errorrecovery/er.grammar/er/grammar.go b/example/errorrecovery/er.grammar/er/er.go similarity index 79% rename from example/errorrecovery/er.grammar/er/grammar.go rename to example/errorrecovery/er.grammar/er/er.go index dd94524d..ed2c0165 100644 --- a/example/errorrecovery/er.grammar/er/grammar.go +++ b/example/errorrecovery/er.grammar/er/er.go @@ -30,82 +30,82 @@ func NewParser() *parser.Parser { return parser.NewParser() } -func ParseFile(fpath string) (interface{}, error, int) { +func ParseFile(fpath string) (interface{}, error) { if lexer, err := NewLexerFile(fpath); err == nil { return NewParser().Parse(lexer) } else { - return nil, err, 0 + return nil, err } } -func ParseText(text string) (interface{}, error, int) { +func ParseText(text string) (interface{}, error) { return NewParser().Parse(NewLexerBytes([]byte(text))) } -func Parse(stream io.Reader) (interface{}, error, int) { +func Parse(stream io.Reader) (interface{}, error) { lex, err := NewLexer(stream) if lex == nil { - return nil, err, 0 + return nil, err } return NewParser().Parse(lex) } -func ParseFileWithData(fpath string, userData interface{}) (interface{}, error, int) { +func ParseFileWithData(fpath string, userData interface{}) (interface{}, error) { if lexer, err := NewLexerFile(fpath); err == nil { return NewParser().SetContext(userData).Parse(lexer) } else { - return nil, err, 0 + return nil, err } } -func ParseTextWithData(text string, userData interface{}) (interface{}, error, int) { +func ParseTextWithData(text string, userData interface{}) (interface{}, error) { return NewParser().SetContext(userData).Parse(NewLexerBytes([]byte(text))) } -func ParseWithData(stream io.Reader, userData interface{}) (interface{}, error, int) { +func ParseWithData(stream io.Reader, userData interface{}) (interface{}, error) { lex, err := NewLexer(stream) if lex == nil { - return nil, err, 0 + return nil, err } return NewParser().SetContext(userData).Parse(lex) } -func ParseFilePartial(fpath string) (interface{}, error, int) { +func ParseFilePartial(fpath string) (interface{}, error, []byte) { if lexer, err := NewLexerFile(fpath); err == nil { return NewParser().ParseLongestPrefix(lexer) } else { - return nil, err, 0 + return nil, err, []byte{} } } -func ParseTextPartial(text string) (interface{}, error, int) { +func ParseTextPartial(text string) (interface{}, error, []byte) { return NewParser().ParseLongestPrefix(NewLexerBytes([]byte(text))) } -func ParsePartial(stream io.Reader) (interface{}, error, int) { +func ParsePartial(stream io.Reader) (interface{}, error, []byte) { lex, err := NewLexer(stream) if lex == nil { - return nil, err, 0 + return nil, err, []byte{} } return NewParser().ParseLongestPrefix(lex) } -func ParseFileWithDataPartial(fpath string, userData interface{}) (interface{}, error, int) { +func ParseFileWithDataPartial(fpath string, userData interface{}) (interface{}, error, []byte) { if lexer, err := NewLexerFile(fpath); err == nil { return NewParser().SetContext(userData).ParseLongestPrefix(lexer) } else { - return nil, err, 0 + return nil, err, []byte{} } } -func ParseTextWithDataPartial(text string, userData interface{}) (interface{}, error, int) { +func ParseTextWithDataPartial(text string, userData interface{}) (interface{}, error, []byte) { return NewParser().SetContext(userData).ParseLongestPrefix(NewLexerBytes([]byte(text))) } -func ParseWithDataPartial(stream io.Reader, userData interface{}) (interface{}, error, int) { +func ParseWithDataPartial(stream io.Reader, userData interface{}) (interface{}, error, []byte) { lex, err := NewLexer(stream) if lex == nil { - return nil, err, 0 + return nil, err, []byte{} } return NewParser().SetContext(userData).ParseLongestPrefix(lex) } diff --git a/example/errorrecovery/er.grammar/er/iface/er.go b/example/errorrecovery/er.grammar/er/iface/er.go index e4181d34..7483136c 100644 --- a/example/errorrecovery/er.grammar/er/iface/er.go +++ b/example/errorrecovery/er.grammar/er/iface/er.go @@ -25,6 +25,7 @@ type ( CheckPoint interface { DistanceFrom(CheckPoint) int + Advance(int) CheckPoint } CheckPointable interface { diff --git a/example/errorrecovery/er.grammar/er/internal/lexer/lexer.go b/example/errorrecovery/er.grammar/er/internal/lexer/lexer.go index 347e3e25..16301c92 100644 --- a/example/errorrecovery/er.grammar/er/internal/lexer/lexer.go +++ b/example/errorrecovery/er.grammar/er/internal/lexer/lexer.go @@ -78,6 +78,10 @@ func (c checkPoint) DistanceFrom (o iface.CheckPoint) int { return int (c.value() - o.(checkPoint).value()) } +func (c checkPoint) Advance (o int) iface.CheckPoint { + return checkPoint(c.value() + int64(o)) +} + func (l *Lexer) GetCheckPoint() iface.CheckPoint { if l == nil { return checkPoint(0) @@ -93,10 +97,10 @@ func (l Lexer) GotoCheckPoint(cp iface.CheckPoint) { func (l *Lexer) Scan() (tok *token.Token) { tok = new(token.Token) tok.Type = token.INVALID - tok.Lit = []byte{} start := l.position state := 0 for state != -1 { + savePos := l.position.Pos curr, size, err := l.stream.ReadRune() if size < 1 || err != nil { curr = INVALID_RUNE @@ -129,12 +133,14 @@ func (l *Lexer) Scan() (tok *token.Token) { start = l.position state = 0 tok.Lit = []byte{} + tok.IgnoredPrefix=append(tok.IgnoredPrefix,string(curr)...) } } else if curr != INVALID_RUNE{ if len(tok.Lit) == 0 { tok.Lit = append(tok.Lit, string(curr)...) } else { l.stream.UnreadRune() + l.position.Pos = savePos } } if err == io.EOF && len(tok.Lit)==0 { diff --git a/example/errorrecovery/er.grammar/er/internal/parser/actiontable.go b/example/errorrecovery/er.grammar/er/internal/parser/actiontable.go index f8fbaeca..5575ca5e 100644 --- a/example/errorrecovery/er.grammar/er/internal/parser/actiontable.go +++ b/example/errorrecovery/er.grammar/er/internal/parser/actiontable.go @@ -4,7 +4,7 @@ package parser type ( actionTable [numStates]actionRow - cdFunc func(TokenStream, interface{}) (interface{}, error, int) + cdFunc func(TokenStream, interface{}) (interface{}, error, []byte) cdAction struct { tokenIndex int tokenScanner cdFunc diff --git a/example/errorrecovery/er.grammar/er/internal/parser/parser.go b/example/errorrecovery/er.grammar/er/internal/parser/parser.go index 05a892f9..6ea1b2f1 100644 --- a/example/errorrecovery/er.grammar/er/internal/parser/parser.go +++ b/example/errorrecovery/er.grammar/er/internal/parser/parser.go @@ -93,10 +93,23 @@ type Parser struct { stack *stack nextToken *token.Token userContext interface{} + + // + // Working data, should be method parameters/locals + // but putting them here simplifies a bit the code + // Useful only for longest prefix partial parsing + // + needsRepositioning bool + isNonDeterministic bool + tokens iface.CheckPointable + afterPos iface.CheckPoint + checkPoint iface.CheckPoint + underlyingStream iface.TokenStream } +type TokenStream = iface.TokenStream + type ( - TokenStream = iface.TokenStream fakeCp struct{} fakeCheckPointable struct{} ) @@ -105,12 +118,16 @@ func (f fakeCheckPointable) GetCheckPoint() iface.CheckPoint { return fakeCp{} } -func (f fakeCheckPointable) GotoCheckPoint(iface.CheckPoint) {} - func (f fakeCp) DistanceFrom(o iface.CheckPoint) int { return 0 } +func (f fakeCp) Advance(o int) iface.CheckPoint { + return fakeCp{} +} + +func (f fakeCheckPointable) GotoCheckPoint(iface.CheckPoint) {} + func NewParser() *Parser { return NewParserWithContext(nil) } @@ -205,62 +222,73 @@ func (p *Parser) newError(err error) error { return e } -func (p *Parser) Parse(scanner iface.Scanner) (res interface{}, err error, ptl int) { +func (p *Parser) prepareParsing(scanner iface.Scanner, longest bool) error { + p.Reset() + p.needsRepositioning = longest + p.isNonDeterministic = false + if p.needsRepositioning { + if streamScanner, _ := scanner.(iface.StreamScanner); streamScanner != nil { + p.underlyingStream = streamScanner.GetStream() + } + if p.tokens, _ = scanner.(iface.CheckPointable); p.tokens == nil || p.underlyingStream == nil { + return errNotRepositionable + } + } else { + if p.tokens, _ = scanner.(iface.CheckPointable); p.tokens == nil { + p.tokens = fakeCheckPointable{} + } + } + return nil +} + +func (p *Parser) Parse(scanner iface.Scanner) (res interface{}, err error) { + if err := p.prepareParsing(scanner, false); err != nil { + return nil, err + } return p.parse(scanner, false) } -func (p *Parser) ParseLongestPrefix(scanner iface.Scanner) (res interface{}, err error, ptl int) { - return p.parse(scanner, true) +func (p *Parser) ParseLongestPrefix(scanner iface.Scanner) (res interface{}, err error, parsed []byte) { + if err := p.prepareParsing(scanner, true); err != nil { + return nil, err, []byte{} + } + startPoint := p.tokens.GetCheckPoint() + res, err = p.parse(scanner, true) + if err == nil { + currPoint := p.tokens.GetCheckPoint() + p.tokens.GotoCheckPoint(startPoint) + parsed = make([]byte, currPoint.DistanceFrom(startPoint)) + p.underlyingStream.Read(parsed) + p.tokens.GotoCheckPoint(currPoint) + } + return } var errNotRepositionable = errors.New("scanner not repositionable") -func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, err error, ptl int) { - var ( - tokens iface.CheckPointable - afterPos iface.CheckPoint - checkPoint iface.CheckPoint - ) - readNextToken := func() error { - if tokens == nil && (len(parserActions.table[p.stack.top()].cdActions) > 0 || longest) { - return errNotRepositionable - } - if longest { - checkPoint = tokens.GetCheckPoint() - } +func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, err error) { + readNextToken := func() { + p.checkPoint = p.tokens.GetCheckPoint() p.nextToken = scanner.Scan() - if longest { - afterPos = tokens.GetCheckPoint() - } - return nil - } - p.Reset() - if tokens, _ = scanner.(iface.CheckPointable); tokens == nil { - tokens = fakeCheckPointable{} - } - underlyingStream := TokenStream(nil) - if streamScanner, _ := scanner.(iface.StreamScanner); streamScanner != nil { - underlyingStream = streamScanner.GetStream() - } - startCp := tokens.GetCheckPoint() - if err := readNextToken(); err != nil { - return nil, err, tokens.GetCheckPoint().DistanceFrom(startCp) + p.afterPos = p.tokens.GetCheckPoint() + return } + readNextToken() for acc := false; !acc; { action := parserActions.table[p.stack.top()].actions[p.nextToken.Type] - if action == nil && underlyingStream != nil && len(parserActions.table[p.stack.top()].cdActions) > 0 { + if action == nil && p.isNonDeterministic { // // If no action, check if we have some context dependent parsing to try // for _, cdAction := range parserActions.table[p.stack.top()].cdActions { - tokens.GotoCheckPoint(checkPoint) - cd_res, cd_err, cd_parsed := cdAction.tokenScanner(underlyingStream, p.userContext) - if cd_err == nil && cd_parsed > 0 { + p.tokens.GotoCheckPoint(p.checkPoint.Advance(len(p.nextToken.IgnoredPrefix))) + cd_res, cd_err, cd_parsed := cdAction.tokenScanner(p.underlyingStream, p.userContext) + if cd_err == nil && len(cd_parsed) > 0 { action = parserActions.table[p.stack.top()].actions[cdAction.tokenIndex] if action != nil { p.nextToken.Foreign = true p.nextToken.ForeignAstNode = cd_res - p.nextToken.Lit = []byte{} + p.nextToken.Lit = cd_parsed p.nextToken.Type = token.Type(cdAction.tokenIndex) break } @@ -275,13 +303,13 @@ func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, er // Dirty, dirty, dirty... but I found it as it is, and I prefer not to touch // if action == nil && longest { - tokens.GotoCheckPoint(checkPoint) + p.tokens.GotoCheckPoint(p.checkPoint) action = parserActions.table[p.stack.top()].actions[token.EOF] if action == nil { // // ok, let's consume the token then // - tokens.GotoCheckPoint(afterPos) + p.tokens.GotoCheckPoint(p.afterPos) } } @@ -291,7 +319,7 @@ func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, er if action == nil { if recovered, errAttrib := p.Error(nil, scanner); !recovered { p.nextToken = errAttrib.ErrorToken - return nil, p.newError(nil), tokens.GetCheckPoint().DistanceFrom(startCp) + return nil, p.newError(nil) } if action = parserActions.table[p.stack.top()].actions[p.nextToken.Type]; action == nil { panic("Error recovery led to invalid action") @@ -307,14 +335,12 @@ func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, er if p.nextToken.Foreign { p.stack.push(int(act), p.nextToken.ForeignAstNode) } - if err := readNextToken(); err != nil { - return nil, err, tokens.GetCheckPoint().DistanceFrom(startCp) - } + readNextToken() case reduce: prod := productionsTable[int(act)] attrib, err := prod.ReduceFunc(p.userContext, p.stack.popN(prod.NumSymbols)) if err != nil { - return nil, p.newError(err), tokens.GetCheckPoint().DistanceFrom(startCp) + return nil, p.newError(err) } else { p.stack.push(gotoTab[p.stack.top()][prod.NTType], attrib) } @@ -322,5 +348,5 @@ func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, er panic("unknown action: " + action.String()) } } - return res, nil, tokens.GetCheckPoint().DistanceFrom(startCp) + return res, nil } diff --git a/example/errorrecovery/er.grammar/er/internal/token/token.go b/example/errorrecovery/er.grammar/er/internal/token/token.go index f546b2a4..e045e520 100644 --- a/example/errorrecovery/er.grammar/er/internal/token/token.go +++ b/example/errorrecovery/er.grammar/er/internal/token/token.go @@ -8,7 +8,8 @@ import ( type Token struct { Type - Lit []byte + Lit []byte + IgnoredPrefix []byte Pos ForeignAstNode interface{} Foreign bool diff --git a/example/errorrecovery/er.grammar/er/main/main.go b/example/errorrecovery/er.grammar/er/main/main.go index 65c19181..74e84e4e 100644 --- a/example/errorrecovery/er.grammar/er/main/main.go +++ b/example/errorrecovery/er.grammar/er/main/main.go @@ -9,11 +9,15 @@ import ( er "github.com/maxcalandrelli/gocc/example/errorrecovery/er.grammar/er" ) -func showResult(r interface{}, e error, l int) { +func showResult(r interface{}, e error, p []byte) { if e != nil { fmt.Fprintf(os.Stderr, "parsing returned the following error: %s\n", e.Error()) } else { - fmt.Printf("r=%#v, %d bytes\n", r, l) + if len(p) > 0 { + fmt.Printf("r=%#v, (%s)\n", r, string(p)) + } else { + fmt.Printf("r=%#v\n", r) + } } } @@ -23,11 +27,12 @@ var ( Longest bool ) -func parse(longest bool, lex *er.Lexer) (res interface{}, err error, ptl int) { +func parse(longest bool, lex *er.Lexer) (res interface{}, err error, parsed []byte) { if longest { return er.NewParser().ParseLongestPrefix(lex) } else { - return er.NewParser().Parse(lex) + res, err = er.NewParser().Parse(lex) + parsed = []byte{} } return } diff --git a/example/errorrecovery/er_test.go b/example/errorrecovery/er_test.go index a789cefb..83fba0a9 100644 --- a/example/errorrecovery/er_test.go +++ b/example/errorrecovery/er_test.go @@ -29,7 +29,7 @@ func test(src []byte) (astree ast.StmtList, err error) { fmt.Printf("input: %s\n", src) s := er.NewLexerBytes(src) p := er.NewParser() - a, err, _ := p.Parse(s) + a, err := p.Parse(s) if err == nil { astree = a.(ast.StmtList) } diff --git a/example/mail/mail.grammar/mail/iface/mail.go b/example/mail/mail.grammar/mail/iface/mail.go index 7486e79c..dd683a33 100644 --- a/example/mail/mail.grammar/mail/iface/mail.go +++ b/example/mail/mail.grammar/mail/iface/mail.go @@ -22,6 +22,7 @@ type ( CheckPoint interface { DistanceFrom(CheckPoint) int + Advance(int) CheckPoint } CheckPointable interface { diff --git a/example/mail/mail.grammar/mail/internal/lexer/lexer.go b/example/mail/mail.grammar/mail/internal/lexer/lexer.go index 594bbb9f..941430cc 100644 --- a/example/mail/mail.grammar/mail/internal/lexer/lexer.go +++ b/example/mail/mail.grammar/mail/internal/lexer/lexer.go @@ -78,6 +78,10 @@ func (c checkPoint) DistanceFrom (o iface.CheckPoint) int { return int (c.value() - o.(checkPoint).value()) } +func (c checkPoint) Advance (o int) iface.CheckPoint { + return checkPoint(c.value() + int64(o)) +} + func (l *Lexer) GetCheckPoint() iface.CheckPoint { if l == nil { return checkPoint(0) @@ -93,10 +97,10 @@ func (l Lexer) GotoCheckPoint(cp iface.CheckPoint) { func (l *Lexer) Scan() (tok *token.Token) { tok = new(token.Token) tok.Type = token.INVALID - tok.Lit = []byte{} start := l.position state := 0 for state != -1 { + savePos := l.position.Pos curr, size, err := l.stream.ReadRune() if size < 1 || err != nil { curr = INVALID_RUNE @@ -129,12 +133,14 @@ func (l *Lexer) Scan() (tok *token.Token) { start = l.position state = 0 tok.Lit = []byte{} + tok.IgnoredPrefix=append(tok.IgnoredPrefix,string(curr)...) } } else if curr != INVALID_RUNE{ if len(tok.Lit) == 0 { tok.Lit = append(tok.Lit, string(curr)...) } else { l.stream.UnreadRune() + l.position.Pos = savePos } } if err == io.EOF && len(tok.Lit)==0 { diff --git a/example/mail/mail.grammar/mail/internal/token/token.go b/example/mail/mail.grammar/mail/internal/token/token.go index 3d696bdc..8f52bb03 100644 --- a/example/mail/mail.grammar/mail/internal/token/token.go +++ b/example/mail/mail.grammar/mail/internal/token/token.go @@ -8,7 +8,8 @@ import ( type Token struct { Type - Lit []byte + Lit []byte + IgnoredPrefix []byte Pos ForeignAstNode interface{} Foreign bool diff --git a/example/mail/mail.grammar/mail/grammar.go b/example/mail/mail.grammar/mail/mail.go similarity index 100% rename from example/mail/mail.grammar/mail/grammar.go rename to example/mail/mail.grammar/mail/mail.go diff --git a/example/nolexer/nolexer.grammar/nolexer/iface/nolexer.go b/example/nolexer/nolexer.grammar/nolexer/iface/nolexer.go index 3c417178..652f5536 100644 --- a/example/nolexer/nolexer.grammar/nolexer/iface/nolexer.go +++ b/example/nolexer/nolexer.grammar/nolexer/iface/nolexer.go @@ -25,6 +25,7 @@ type ( CheckPoint interface { DistanceFrom(CheckPoint) int + Advance(int) CheckPoint } CheckPointable interface { diff --git a/example/nolexer/nolexer.grammar/nolexer/internal/parser/actiontable.go b/example/nolexer/nolexer.grammar/nolexer/internal/parser/actiontable.go index 6fd93931..eb8558e1 100644 --- a/example/nolexer/nolexer.grammar/nolexer/internal/parser/actiontable.go +++ b/example/nolexer/nolexer.grammar/nolexer/internal/parser/actiontable.go @@ -4,7 +4,7 @@ package parser type ( actionTable [numStates]actionRow - cdFunc func(TokenStream, interface{}) (interface{}, error, int) + cdFunc func(TokenStream, interface{}) (interface{}, error, []byte) cdAction struct { tokenIndex int tokenScanner cdFunc diff --git a/example/nolexer/nolexer.grammar/nolexer/internal/parser/parser.go b/example/nolexer/nolexer.grammar/nolexer/internal/parser/parser.go index a8556a79..424e6647 100644 --- a/example/nolexer/nolexer.grammar/nolexer/internal/parser/parser.go +++ b/example/nolexer/nolexer.grammar/nolexer/internal/parser/parser.go @@ -93,10 +93,23 @@ type Parser struct { stack *stack nextToken *token.Token userContext interface{} + + // + // Working data, should be method parameters/locals + // but putting them here simplifies a bit the code + // Useful only for longest prefix partial parsing + // + needsRepositioning bool + isNonDeterministic bool + tokens iface.CheckPointable + afterPos iface.CheckPoint + checkPoint iface.CheckPoint + underlyingStream iface.TokenStream } +type TokenStream = iface.TokenStream + type ( - TokenStream = iface.TokenStream fakeCp struct{} fakeCheckPointable struct{} ) @@ -105,12 +118,16 @@ func (f fakeCheckPointable) GetCheckPoint() iface.CheckPoint { return fakeCp{} } -func (f fakeCheckPointable) GotoCheckPoint(iface.CheckPoint) {} - func (f fakeCp) DistanceFrom(o iface.CheckPoint) int { return 0 } +func (f fakeCp) Advance(o int) iface.CheckPoint { + return fakeCp{} +} + +func (f fakeCheckPointable) GotoCheckPoint(iface.CheckPoint) {} + func NewParser() *Parser { return NewParserWithContext(nil) } @@ -205,62 +222,73 @@ func (p *Parser) newError(err error) error { return e } -func (p *Parser) Parse(scanner iface.Scanner) (res interface{}, err error, ptl int) { +func (p *Parser) prepareParsing(scanner iface.Scanner, longest bool) error { + p.Reset() + p.needsRepositioning = longest + p.isNonDeterministic = false + if p.needsRepositioning { + if streamScanner, _ := scanner.(iface.StreamScanner); streamScanner != nil { + p.underlyingStream = streamScanner.GetStream() + } + if p.tokens, _ = scanner.(iface.CheckPointable); p.tokens == nil || p.underlyingStream == nil { + return errNotRepositionable + } + } else { + if p.tokens, _ = scanner.(iface.CheckPointable); p.tokens == nil { + p.tokens = fakeCheckPointable{} + } + } + return nil +} + +func (p *Parser) Parse(scanner iface.Scanner) (res interface{}, err error) { + if err := p.prepareParsing(scanner, false); err != nil { + return nil, err + } return p.parse(scanner, false) } -func (p *Parser) ParseLongestPrefix(scanner iface.Scanner) (res interface{}, err error, ptl int) { - return p.parse(scanner, true) +func (p *Parser) ParseLongestPrefix(scanner iface.Scanner) (res interface{}, err error, parsed []byte) { + if err := p.prepareParsing(scanner, true); err != nil { + return nil, err, []byte{} + } + startPoint := p.tokens.GetCheckPoint() + res, err = p.parse(scanner, true) + if err == nil { + currPoint := p.tokens.GetCheckPoint() + p.tokens.GotoCheckPoint(startPoint) + parsed = make([]byte, currPoint.DistanceFrom(startPoint)) + p.underlyingStream.Read(parsed) + p.tokens.GotoCheckPoint(currPoint) + } + return } var errNotRepositionable = errors.New("scanner not repositionable") -func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, err error, ptl int) { - var ( - tokens iface.CheckPointable - afterPos iface.CheckPoint - checkPoint iface.CheckPoint - ) - readNextToken := func() error { - if tokens == nil && (len(parserActions.table[p.stack.top()].cdActions) > 0 || longest) { - return errNotRepositionable - } - if longest { - checkPoint = tokens.GetCheckPoint() - } +func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, err error) { + readNextToken := func() { + p.checkPoint = p.tokens.GetCheckPoint() p.nextToken = scanner.Scan() - if longest { - afterPos = tokens.GetCheckPoint() - } - return nil - } - p.Reset() - if tokens, _ = scanner.(iface.CheckPointable); tokens == nil { - tokens = fakeCheckPointable{} - } - underlyingStream := TokenStream(nil) - if streamScanner, _ := scanner.(iface.StreamScanner); streamScanner != nil { - underlyingStream = streamScanner.GetStream() - } - startCp := tokens.GetCheckPoint() - if err := readNextToken(); err != nil { - return nil, err, tokens.GetCheckPoint().DistanceFrom(startCp) + p.afterPos = p.tokens.GetCheckPoint() + return } + readNextToken() for acc := false; !acc; { action := parserActions.table[p.stack.top()].actions[p.nextToken.Type] - if action == nil && underlyingStream != nil && len(parserActions.table[p.stack.top()].cdActions) > 0 { + if action == nil && p.isNonDeterministic { // // If no action, check if we have some context dependent parsing to try // for _, cdAction := range parserActions.table[p.stack.top()].cdActions { - tokens.GotoCheckPoint(checkPoint) - cd_res, cd_err, cd_parsed := cdAction.tokenScanner(underlyingStream, p.userContext) - if cd_err == nil && cd_parsed > 0 { + p.tokens.GotoCheckPoint(p.checkPoint.Advance(len(p.nextToken.IgnoredPrefix))) + cd_res, cd_err, cd_parsed := cdAction.tokenScanner(p.underlyingStream, p.userContext) + if cd_err == nil && len(cd_parsed) > 0 { action = parserActions.table[p.stack.top()].actions[cdAction.tokenIndex] if action != nil { p.nextToken.Foreign = true p.nextToken.ForeignAstNode = cd_res - p.nextToken.Lit = []byte{} + p.nextToken.Lit = cd_parsed p.nextToken.Type = token.Type(cdAction.tokenIndex) break } @@ -275,13 +303,13 @@ func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, er // Dirty, dirty, dirty... but I found it as it is, and I prefer not to touch // if action == nil && longest { - tokens.GotoCheckPoint(checkPoint) + p.tokens.GotoCheckPoint(p.checkPoint) action = parserActions.table[p.stack.top()].actions[token.EOF] if action == nil { // // ok, let's consume the token then // - tokens.GotoCheckPoint(afterPos) + p.tokens.GotoCheckPoint(p.afterPos) } } @@ -291,7 +319,7 @@ func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, er if action == nil { if recovered, errAttrib := p.Error(nil, scanner); !recovered { p.nextToken = errAttrib.ErrorToken - return nil, p.newError(nil), tokens.GetCheckPoint().DistanceFrom(startCp) + return nil, p.newError(nil) } if action = parserActions.table[p.stack.top()].actions[p.nextToken.Type]; action == nil { panic("Error recovery led to invalid action") @@ -307,14 +335,12 @@ func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, er if p.nextToken.Foreign { p.stack.push(int(act), p.nextToken.ForeignAstNode) } - if err := readNextToken(); err != nil { - return nil, err, tokens.GetCheckPoint().DistanceFrom(startCp) - } + readNextToken() case reduce: prod := productionsTable[int(act)] attrib, err := prod.ReduceFunc(p.userContext, p.stack.popN(prod.NumSymbols)) if err != nil { - return nil, p.newError(err), tokens.GetCheckPoint().DistanceFrom(startCp) + return nil, p.newError(err) } else { p.stack.push(gotoTab[p.stack.top()][prod.NTType], attrib) } @@ -322,5 +348,5 @@ func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, er panic("unknown action: " + action.String()) } } - return res, nil, tokens.GetCheckPoint().DistanceFrom(startCp) + return res, nil } diff --git a/example/nolexer/nolexer.grammar/nolexer/internal/token/token.go b/example/nolexer/nolexer.grammar/nolexer/internal/token/token.go index 8cb4f4e0..6bec1488 100644 --- a/example/nolexer/nolexer.grammar/nolexer/internal/token/token.go +++ b/example/nolexer/nolexer.grammar/nolexer/internal/token/token.go @@ -8,7 +8,8 @@ import ( type Token struct { Type - Lit []byte + Lit []byte + IgnoredPrefix []byte Pos ForeignAstNode interface{} Foreign bool diff --git a/example/nolexer/nolexer.grammar/nolexer/grammar.go b/example/nolexer/nolexer.grammar/nolexer/nolexer.go similarity index 100% rename from example/nolexer/nolexer.grammar/nolexer/grammar.go rename to example/nolexer/nolexer.grammar/nolexer/nolexer.go diff --git a/example/nolexer/nolexer_test.go b/example/nolexer/nolexer_test.go index 6c76e6da..92b4878f 100644 --- a/example/nolexer/nolexer_test.go +++ b/example/nolexer/nolexer_test.go @@ -10,7 +10,7 @@ import ( func Test1(t *testing.T) { S := scanner.NewString("hiya world") P := nolexer.NewParser() - if _, e, _ := P.Parse(S); e != nil { + if _, e := P.Parse(S); e != nil { t.Error(e.Error()) } } @@ -18,7 +18,7 @@ func Test1(t *testing.T) { func Test2(t *testing.T) { S := scanner.NewString("hello world") P := nolexer.NewParser() - if _, e, _ := P.Parse(S); e != nil { + if _, e := P.Parse(S); e != nil { t.Error(e.Error()) } } diff --git a/example/rr/rr.grammar/rr/iface/rr.go b/example/rr/rr.grammar/rr/iface/rr.go index 0827c63b..ca4569d1 100644 --- a/example/rr/rr.grammar/rr/iface/rr.go +++ b/example/rr/rr.grammar/rr/iface/rr.go @@ -25,6 +25,7 @@ type ( CheckPoint interface { DistanceFrom(CheckPoint) int + Advance(int) CheckPoint } CheckPointable interface { diff --git a/example/rr/rr.grammar/rr/internal/lexer/lexer.go b/example/rr/rr.grammar/rr/internal/lexer/lexer.go index 501c0fb2..521eb27e 100644 --- a/example/rr/rr.grammar/rr/internal/lexer/lexer.go +++ b/example/rr/rr.grammar/rr/internal/lexer/lexer.go @@ -78,6 +78,10 @@ func (c checkPoint) DistanceFrom (o iface.CheckPoint) int { return int (c.value() - o.(checkPoint).value()) } +func (c checkPoint) Advance (o int) iface.CheckPoint { + return checkPoint(c.value() + int64(o)) +} + func (l *Lexer) GetCheckPoint() iface.CheckPoint { if l == nil { return checkPoint(0) @@ -93,10 +97,10 @@ func (l Lexer) GotoCheckPoint(cp iface.CheckPoint) { func (l *Lexer) Scan() (tok *token.Token) { tok = new(token.Token) tok.Type = token.INVALID - tok.Lit = []byte{} start := l.position state := 0 for state != -1 { + savePos := l.position.Pos curr, size, err := l.stream.ReadRune() if size < 1 || err != nil { curr = INVALID_RUNE @@ -129,12 +133,14 @@ func (l *Lexer) Scan() (tok *token.Token) { start = l.position state = 0 tok.Lit = []byte{} + tok.IgnoredPrefix=append(tok.IgnoredPrefix,string(curr)...) } } else if curr != INVALID_RUNE{ if len(tok.Lit) == 0 { tok.Lit = append(tok.Lit, string(curr)...) } else { l.stream.UnreadRune() + l.position.Pos = savePos } } if err == io.EOF && len(tok.Lit)==0 { diff --git a/example/rr/rr.grammar/rr/internal/parser/actiontable.go b/example/rr/rr.grammar/rr/internal/parser/actiontable.go index a5b83df7..06641ecc 100644 --- a/example/rr/rr.grammar/rr/internal/parser/actiontable.go +++ b/example/rr/rr.grammar/rr/internal/parser/actiontable.go @@ -4,7 +4,7 @@ package parser type ( actionTable [numStates]actionRow - cdFunc func(TokenStream, interface{}) (interface{}, error, int) + cdFunc func(TokenStream, interface{}) (interface{}, error, []byte) cdAction struct { tokenIndex int tokenScanner cdFunc diff --git a/example/rr/rr.grammar/rr/internal/parser/parser.go b/example/rr/rr.grammar/rr/internal/parser/parser.go index 839bdfb9..dc8fabf5 100644 --- a/example/rr/rr.grammar/rr/internal/parser/parser.go +++ b/example/rr/rr.grammar/rr/internal/parser/parser.go @@ -93,10 +93,23 @@ type Parser struct { stack *stack nextToken *token.Token userContext interface{} + + // + // Working data, should be method parameters/locals + // but putting them here simplifies a bit the code + // Useful only for longest prefix partial parsing + // + needsRepositioning bool + isNonDeterministic bool + tokens iface.CheckPointable + afterPos iface.CheckPoint + checkPoint iface.CheckPoint + underlyingStream iface.TokenStream } +type TokenStream = iface.TokenStream + type ( - TokenStream = iface.TokenStream fakeCp struct{} fakeCheckPointable struct{} ) @@ -105,12 +118,16 @@ func (f fakeCheckPointable) GetCheckPoint() iface.CheckPoint { return fakeCp{} } -func (f fakeCheckPointable) GotoCheckPoint(iface.CheckPoint) {} - func (f fakeCp) DistanceFrom(o iface.CheckPoint) int { return 0 } +func (f fakeCp) Advance(o int) iface.CheckPoint { + return fakeCp{} +} + +func (f fakeCheckPointable) GotoCheckPoint(iface.CheckPoint) {} + func NewParser() *Parser { return NewParserWithContext(nil) } @@ -205,62 +222,73 @@ func (p *Parser) newError(err error) error { return e } -func (p *Parser) Parse(scanner iface.Scanner) (res interface{}, err error, ptl int) { +func (p *Parser) prepareParsing(scanner iface.Scanner, longest bool) error { + p.Reset() + p.needsRepositioning = longest + p.isNonDeterministic = false + if p.needsRepositioning { + if streamScanner, _ := scanner.(iface.StreamScanner); streamScanner != nil { + p.underlyingStream = streamScanner.GetStream() + } + if p.tokens, _ = scanner.(iface.CheckPointable); p.tokens == nil || p.underlyingStream == nil { + return errNotRepositionable + } + } else { + if p.tokens, _ = scanner.(iface.CheckPointable); p.tokens == nil { + p.tokens = fakeCheckPointable{} + } + } + return nil +} + +func (p *Parser) Parse(scanner iface.Scanner) (res interface{}, err error) { + if err := p.prepareParsing(scanner, false); err != nil { + return nil, err + } return p.parse(scanner, false) } -func (p *Parser) ParseLongestPrefix(scanner iface.Scanner) (res interface{}, err error, ptl int) { - return p.parse(scanner, true) +func (p *Parser) ParseLongestPrefix(scanner iface.Scanner) (res interface{}, err error, parsed []byte) { + if err := p.prepareParsing(scanner, true); err != nil { + return nil, err, []byte{} + } + startPoint := p.tokens.GetCheckPoint() + res, err = p.parse(scanner, true) + if err == nil { + currPoint := p.tokens.GetCheckPoint() + p.tokens.GotoCheckPoint(startPoint) + parsed = make([]byte, currPoint.DistanceFrom(startPoint)) + p.underlyingStream.Read(parsed) + p.tokens.GotoCheckPoint(currPoint) + } + return } var errNotRepositionable = errors.New("scanner not repositionable") -func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, err error, ptl int) { - var ( - tokens iface.CheckPointable - afterPos iface.CheckPoint - checkPoint iface.CheckPoint - ) - readNextToken := func() error { - if tokens == nil && (len(parserActions.table[p.stack.top()].cdActions) > 0 || longest) { - return errNotRepositionable - } - if longest { - checkPoint = tokens.GetCheckPoint() - } +func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, err error) { + readNextToken := func() { + p.checkPoint = p.tokens.GetCheckPoint() p.nextToken = scanner.Scan() - if longest { - afterPos = tokens.GetCheckPoint() - } - return nil - } - p.Reset() - if tokens, _ = scanner.(iface.CheckPointable); tokens == nil { - tokens = fakeCheckPointable{} - } - underlyingStream := TokenStream(nil) - if streamScanner, _ := scanner.(iface.StreamScanner); streamScanner != nil { - underlyingStream = streamScanner.GetStream() - } - startCp := tokens.GetCheckPoint() - if err := readNextToken(); err != nil { - return nil, err, tokens.GetCheckPoint().DistanceFrom(startCp) + p.afterPos = p.tokens.GetCheckPoint() + return } + readNextToken() for acc := false; !acc; { action := parserActions.table[p.stack.top()].actions[p.nextToken.Type] - if action == nil && underlyingStream != nil && len(parserActions.table[p.stack.top()].cdActions) > 0 { + if action == nil && p.isNonDeterministic { // // If no action, check if we have some context dependent parsing to try // for _, cdAction := range parserActions.table[p.stack.top()].cdActions { - tokens.GotoCheckPoint(checkPoint) - cd_res, cd_err, cd_parsed := cdAction.tokenScanner(underlyingStream, p.userContext) - if cd_err == nil && cd_parsed > 0 { + p.tokens.GotoCheckPoint(p.checkPoint.Advance(len(p.nextToken.IgnoredPrefix))) + cd_res, cd_err, cd_parsed := cdAction.tokenScanner(p.underlyingStream, p.userContext) + if cd_err == nil && len(cd_parsed) > 0 { action = parserActions.table[p.stack.top()].actions[cdAction.tokenIndex] if action != nil { p.nextToken.Foreign = true p.nextToken.ForeignAstNode = cd_res - p.nextToken.Lit = []byte{} + p.nextToken.Lit = cd_parsed p.nextToken.Type = token.Type(cdAction.tokenIndex) break } @@ -275,13 +303,13 @@ func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, er // Dirty, dirty, dirty... but I found it as it is, and I prefer not to touch // if action == nil && longest { - tokens.GotoCheckPoint(checkPoint) + p.tokens.GotoCheckPoint(p.checkPoint) action = parserActions.table[p.stack.top()].actions[token.EOF] if action == nil { // // ok, let's consume the token then // - tokens.GotoCheckPoint(afterPos) + p.tokens.GotoCheckPoint(p.afterPos) } } @@ -291,7 +319,7 @@ func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, er if action == nil { if recovered, errAttrib := p.Error(nil, scanner); !recovered { p.nextToken = errAttrib.ErrorToken - return nil, p.newError(nil), tokens.GetCheckPoint().DistanceFrom(startCp) + return nil, p.newError(nil) } if action = parserActions.table[p.stack.top()].actions[p.nextToken.Type]; action == nil { panic("Error recovery led to invalid action") @@ -307,14 +335,12 @@ func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, er if p.nextToken.Foreign { p.stack.push(int(act), p.nextToken.ForeignAstNode) } - if err := readNextToken(); err != nil { - return nil, err, tokens.GetCheckPoint().DistanceFrom(startCp) - } + readNextToken() case reduce: prod := productionsTable[int(act)] attrib, err := prod.ReduceFunc(p.userContext, p.stack.popN(prod.NumSymbols)) if err != nil { - return nil, p.newError(err), tokens.GetCheckPoint().DistanceFrom(startCp) + return nil, p.newError(err) } else { p.stack.push(gotoTab[p.stack.top()][prod.NTType], attrib) } @@ -322,5 +348,5 @@ func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, er panic("unknown action: " + action.String()) } } - return res, nil, tokens.GetCheckPoint().DistanceFrom(startCp) + return res, nil } diff --git a/example/rr/rr.grammar/rr/internal/token/token.go b/example/rr/rr.grammar/rr/internal/token/token.go index 872e0ea0..11d43771 100644 --- a/example/rr/rr.grammar/rr/internal/token/token.go +++ b/example/rr/rr.grammar/rr/internal/token/token.go @@ -8,7 +8,8 @@ import ( type Token struct { Type - Lit []byte + Lit []byte + IgnoredPrefix []byte Pos ForeignAstNode interface{} Foreign bool diff --git a/example/rr/rr.grammar/rr/main/main.go b/example/rr/rr.grammar/rr/main/main.go index 56a86a8a..b8810a6c 100644 --- a/example/rr/rr.grammar/rr/main/main.go +++ b/example/rr/rr.grammar/rr/main/main.go @@ -9,11 +9,15 @@ import ( rr "github.com/maxcalandrelli/gocc/example/rr/rr.grammar/rr" ) -func showResult(r interface{}, e error, l int) { +func showResult(r interface{}, e error, p []byte) { if e != nil { fmt.Fprintf(os.Stderr, "parsing returned the following error: %s\n", e.Error()) } else { - fmt.Printf("r=%#v, %d bytes\n", r, l) + if len(p) > 0 { + fmt.Printf("r=%#v, (%s)\n", r, string(p)) + } else { + fmt.Printf("r=%#v\n", r) + } } } @@ -23,11 +27,12 @@ var ( Longest bool ) -func parse(longest bool, lex *rr.Lexer) (res interface{}, err error, ptl int) { +func parse(longest bool, lex *rr.Lexer) (res interface{}, err error, parsed []byte) { if longest { return rr.NewParser().ParseLongestPrefix(lex) } else { - return rr.NewParser().Parse(lex) + res, err = rr.NewParser().Parse(lex) + parsed = []byte{} } return } diff --git a/example/rr/rr.grammar/rr/grammar.go b/example/rr/rr.grammar/rr/rr.go similarity index 79% rename from example/rr/rr.grammar/rr/grammar.go rename to example/rr/rr.grammar/rr/rr.go index 903c4f06..f4500d70 100644 --- a/example/rr/rr.grammar/rr/grammar.go +++ b/example/rr/rr.grammar/rr/rr.go @@ -30,82 +30,82 @@ func NewParser() *parser.Parser { return parser.NewParser() } -func ParseFile(fpath string) (interface{}, error, int) { +func ParseFile(fpath string) (interface{}, error) { if lexer, err := NewLexerFile(fpath); err == nil { return NewParser().Parse(lexer) } else { - return nil, err, 0 + return nil, err } } -func ParseText(text string) (interface{}, error, int) { +func ParseText(text string) (interface{}, error) { return NewParser().Parse(NewLexerBytes([]byte(text))) } -func Parse(stream io.Reader) (interface{}, error, int) { +func Parse(stream io.Reader) (interface{}, error) { lex, err := NewLexer(stream) if lex == nil { - return nil, err, 0 + return nil, err } return NewParser().Parse(lex) } -func ParseFileWithData(fpath string, userData interface{}) (interface{}, error, int) { +func ParseFileWithData(fpath string, userData interface{}) (interface{}, error) { if lexer, err := NewLexerFile(fpath); err == nil { return NewParser().SetContext(userData).Parse(lexer) } else { - return nil, err, 0 + return nil, err } } -func ParseTextWithData(text string, userData interface{}) (interface{}, error, int) { +func ParseTextWithData(text string, userData interface{}) (interface{}, error) { return NewParser().SetContext(userData).Parse(NewLexerBytes([]byte(text))) } -func ParseWithData(stream io.Reader, userData interface{}) (interface{}, error, int) { +func ParseWithData(stream io.Reader, userData interface{}) (interface{}, error) { lex, err := NewLexer(stream) if lex == nil { - return nil, err, 0 + return nil, err } return NewParser().SetContext(userData).Parse(lex) } -func ParseFilePartial(fpath string) (interface{}, error, int) { +func ParseFilePartial(fpath string) (interface{}, error, []byte) { if lexer, err := NewLexerFile(fpath); err == nil { return NewParser().ParseLongestPrefix(lexer) } else { - return nil, err, 0 + return nil, err, []byte{} } } -func ParseTextPartial(text string) (interface{}, error, int) { +func ParseTextPartial(text string) (interface{}, error, []byte) { return NewParser().ParseLongestPrefix(NewLexerBytes([]byte(text))) } -func ParsePartial(stream io.Reader) (interface{}, error, int) { +func ParsePartial(stream io.Reader) (interface{}, error, []byte) { lex, err := NewLexer(stream) if lex == nil { - return nil, err, 0 + return nil, err, []byte{} } return NewParser().ParseLongestPrefix(lex) } -func ParseFileWithDataPartial(fpath string, userData interface{}) (interface{}, error, int) { +func ParseFileWithDataPartial(fpath string, userData interface{}) (interface{}, error, []byte) { if lexer, err := NewLexerFile(fpath); err == nil { return NewParser().SetContext(userData).ParseLongestPrefix(lexer) } else { - return nil, err, 0 + return nil, err, []byte{} } } -func ParseTextWithDataPartial(text string, userData interface{}) (interface{}, error, int) { +func ParseTextWithDataPartial(text string, userData interface{}) (interface{}, error, []byte) { return NewParser().SetContext(userData).ParseLongestPrefix(NewLexerBytes([]byte(text))) } -func ParseWithDataPartial(stream io.Reader, userData interface{}) (interface{}, error, int) { +func ParseWithDataPartial(stream io.Reader, userData interface{}) (interface{}, error, []byte) { lex, err := NewLexer(stream) if lex == nil { - return nil, err, 0 + return nil, err, []byte{} } return NewParser().SetContext(userData).ParseLongestPrefix(lex) } diff --git a/example/rr/rr_test.go b/example/rr/rr_test.go index 5dab0761..906e4c74 100644 --- a/example/rr/rr_test.go +++ b/example/rr/rr_test.go @@ -17,13 +17,14 @@ package rr import ( "fmt" "testing" + "github.com/maxcalandrelli/gocc/example/rr/rr.grammar/rr" ) func parse(src string) (ast string, err error) { l := rr.NewLexerString(src) p := rr.NewParser() - res, err, _ := p.Parse(l) + res, err := p.Parse(l) if err == nil { ast = res.(string) } diff --git a/example/sr/sr.grammar/sr/iface/sr.go b/example/sr/sr.grammar/sr/iface/sr.go index 0b696f32..14cc67d5 100644 --- a/example/sr/sr.grammar/sr/iface/sr.go +++ b/example/sr/sr.grammar/sr/iface/sr.go @@ -25,6 +25,7 @@ type ( CheckPoint interface { DistanceFrom(CheckPoint) int + Advance(int) CheckPoint } CheckPointable interface { diff --git a/example/sr/sr.grammar/sr/internal/lexer/lexer.go b/example/sr/sr.grammar/sr/internal/lexer/lexer.go index 633983b8..d1175fe8 100644 --- a/example/sr/sr.grammar/sr/internal/lexer/lexer.go +++ b/example/sr/sr.grammar/sr/internal/lexer/lexer.go @@ -78,6 +78,10 @@ func (c checkPoint) DistanceFrom (o iface.CheckPoint) int { return int (c.value() - o.(checkPoint).value()) } +func (c checkPoint) Advance (o int) iface.CheckPoint { + return checkPoint(c.value() + int64(o)) +} + func (l *Lexer) GetCheckPoint() iface.CheckPoint { if l == nil { return checkPoint(0) @@ -93,10 +97,10 @@ func (l Lexer) GotoCheckPoint(cp iface.CheckPoint) { func (l *Lexer) Scan() (tok *token.Token) { tok = new(token.Token) tok.Type = token.INVALID - tok.Lit = []byte{} start := l.position state := 0 for state != -1 { + savePos := l.position.Pos curr, size, err := l.stream.ReadRune() if size < 1 || err != nil { curr = INVALID_RUNE @@ -129,12 +133,14 @@ func (l *Lexer) Scan() (tok *token.Token) { start = l.position state = 0 tok.Lit = []byte{} + tok.IgnoredPrefix=append(tok.IgnoredPrefix,string(curr)...) } } else if curr != INVALID_RUNE{ if len(tok.Lit) == 0 { tok.Lit = append(tok.Lit, string(curr)...) } else { l.stream.UnreadRune() + l.position.Pos = savePos } } if err == io.EOF && len(tok.Lit)==0 { diff --git a/example/sr/sr.grammar/sr/internal/parser/actiontable.go b/example/sr/sr.grammar/sr/internal/parser/actiontable.go index 4a2a1d86..1ff4a333 100644 --- a/example/sr/sr.grammar/sr/internal/parser/actiontable.go +++ b/example/sr/sr.grammar/sr/internal/parser/actiontable.go @@ -4,7 +4,7 @@ package parser type ( actionTable [numStates]actionRow - cdFunc func(TokenStream, interface{}) (interface{}, error, int) + cdFunc func(TokenStream, interface{}) (interface{}, error, []byte) cdAction struct { tokenIndex int tokenScanner cdFunc diff --git a/example/sr/sr.grammar/sr/internal/parser/parser.go b/example/sr/sr.grammar/sr/internal/parser/parser.go index 5b99121d..17895a52 100644 --- a/example/sr/sr.grammar/sr/internal/parser/parser.go +++ b/example/sr/sr.grammar/sr/internal/parser/parser.go @@ -93,10 +93,23 @@ type Parser struct { stack *stack nextToken *token.Token userContext interface{} + + // + // Working data, should be method parameters/locals + // but putting them here simplifies a bit the code + // Useful only for longest prefix partial parsing + // + needsRepositioning bool + isNonDeterministic bool + tokens iface.CheckPointable + afterPos iface.CheckPoint + checkPoint iface.CheckPoint + underlyingStream iface.TokenStream } +type TokenStream = iface.TokenStream + type ( - TokenStream = iface.TokenStream fakeCp struct{} fakeCheckPointable struct{} ) @@ -105,12 +118,16 @@ func (f fakeCheckPointable) GetCheckPoint() iface.CheckPoint { return fakeCp{} } -func (f fakeCheckPointable) GotoCheckPoint(iface.CheckPoint) {} - func (f fakeCp) DistanceFrom(o iface.CheckPoint) int { return 0 } +func (f fakeCp) Advance(o int) iface.CheckPoint { + return fakeCp{} +} + +func (f fakeCheckPointable) GotoCheckPoint(iface.CheckPoint) {} + func NewParser() *Parser { return NewParserWithContext(nil) } @@ -205,62 +222,73 @@ func (p *Parser) newError(err error) error { return e } -func (p *Parser) Parse(scanner iface.Scanner) (res interface{}, err error, ptl int) { +func (p *Parser) prepareParsing(scanner iface.Scanner, longest bool) error { + p.Reset() + p.needsRepositioning = longest + p.isNonDeterministic = false + if p.needsRepositioning { + if streamScanner, _ := scanner.(iface.StreamScanner); streamScanner != nil { + p.underlyingStream = streamScanner.GetStream() + } + if p.tokens, _ = scanner.(iface.CheckPointable); p.tokens == nil || p.underlyingStream == nil { + return errNotRepositionable + } + } else { + if p.tokens, _ = scanner.(iface.CheckPointable); p.tokens == nil { + p.tokens = fakeCheckPointable{} + } + } + return nil +} + +func (p *Parser) Parse(scanner iface.Scanner) (res interface{}, err error) { + if err := p.prepareParsing(scanner, false); err != nil { + return nil, err + } return p.parse(scanner, false) } -func (p *Parser) ParseLongestPrefix(scanner iface.Scanner) (res interface{}, err error, ptl int) { - return p.parse(scanner, true) +func (p *Parser) ParseLongestPrefix(scanner iface.Scanner) (res interface{}, err error, parsed []byte) { + if err := p.prepareParsing(scanner, true); err != nil { + return nil, err, []byte{} + } + startPoint := p.tokens.GetCheckPoint() + res, err = p.parse(scanner, true) + if err == nil { + currPoint := p.tokens.GetCheckPoint() + p.tokens.GotoCheckPoint(startPoint) + parsed = make([]byte, currPoint.DistanceFrom(startPoint)) + p.underlyingStream.Read(parsed) + p.tokens.GotoCheckPoint(currPoint) + } + return } var errNotRepositionable = errors.New("scanner not repositionable") -func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, err error, ptl int) { - var ( - tokens iface.CheckPointable - afterPos iface.CheckPoint - checkPoint iface.CheckPoint - ) - readNextToken := func() error { - if tokens == nil && (len(parserActions.table[p.stack.top()].cdActions) > 0 || longest) { - return errNotRepositionable - } - if longest { - checkPoint = tokens.GetCheckPoint() - } +func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, err error) { + readNextToken := func() { + p.checkPoint = p.tokens.GetCheckPoint() p.nextToken = scanner.Scan() - if longest { - afterPos = tokens.GetCheckPoint() - } - return nil - } - p.Reset() - if tokens, _ = scanner.(iface.CheckPointable); tokens == nil { - tokens = fakeCheckPointable{} - } - underlyingStream := TokenStream(nil) - if streamScanner, _ := scanner.(iface.StreamScanner); streamScanner != nil { - underlyingStream = streamScanner.GetStream() - } - startCp := tokens.GetCheckPoint() - if err := readNextToken(); err != nil { - return nil, err, tokens.GetCheckPoint().DistanceFrom(startCp) + p.afterPos = p.tokens.GetCheckPoint() + return } + readNextToken() for acc := false; !acc; { action := parserActions.table[p.stack.top()].actions[p.nextToken.Type] - if action == nil && underlyingStream != nil && len(parserActions.table[p.stack.top()].cdActions) > 0 { + if action == nil && p.isNonDeterministic { // // If no action, check if we have some context dependent parsing to try // for _, cdAction := range parserActions.table[p.stack.top()].cdActions { - tokens.GotoCheckPoint(checkPoint) - cd_res, cd_err, cd_parsed := cdAction.tokenScanner(underlyingStream, p.userContext) - if cd_err == nil && cd_parsed > 0 { + p.tokens.GotoCheckPoint(p.checkPoint.Advance(len(p.nextToken.IgnoredPrefix))) + cd_res, cd_err, cd_parsed := cdAction.tokenScanner(p.underlyingStream, p.userContext) + if cd_err == nil && len(cd_parsed) > 0 { action = parserActions.table[p.stack.top()].actions[cdAction.tokenIndex] if action != nil { p.nextToken.Foreign = true p.nextToken.ForeignAstNode = cd_res - p.nextToken.Lit = []byte{} + p.nextToken.Lit = cd_parsed p.nextToken.Type = token.Type(cdAction.tokenIndex) break } @@ -275,13 +303,13 @@ func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, er // Dirty, dirty, dirty... but I found it as it is, and I prefer not to touch // if action == nil && longest { - tokens.GotoCheckPoint(checkPoint) + p.tokens.GotoCheckPoint(p.checkPoint) action = parserActions.table[p.stack.top()].actions[token.EOF] if action == nil { // // ok, let's consume the token then // - tokens.GotoCheckPoint(afterPos) + p.tokens.GotoCheckPoint(p.afterPos) } } @@ -291,7 +319,7 @@ func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, er if action == nil { if recovered, errAttrib := p.Error(nil, scanner); !recovered { p.nextToken = errAttrib.ErrorToken - return nil, p.newError(nil), tokens.GetCheckPoint().DistanceFrom(startCp) + return nil, p.newError(nil) } if action = parserActions.table[p.stack.top()].actions[p.nextToken.Type]; action == nil { panic("Error recovery led to invalid action") @@ -307,14 +335,12 @@ func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, er if p.nextToken.Foreign { p.stack.push(int(act), p.nextToken.ForeignAstNode) } - if err := readNextToken(); err != nil { - return nil, err, tokens.GetCheckPoint().DistanceFrom(startCp) - } + readNextToken() case reduce: prod := productionsTable[int(act)] attrib, err := prod.ReduceFunc(p.userContext, p.stack.popN(prod.NumSymbols)) if err != nil { - return nil, p.newError(err), tokens.GetCheckPoint().DistanceFrom(startCp) + return nil, p.newError(err) } else { p.stack.push(gotoTab[p.stack.top()][prod.NTType], attrib) } @@ -322,5 +348,5 @@ func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, er panic("unknown action: " + action.String()) } } - return res, nil, tokens.GetCheckPoint().DistanceFrom(startCp) + return res, nil } diff --git a/example/sr/sr.grammar/sr/internal/token/token.go b/example/sr/sr.grammar/sr/internal/token/token.go index 340679f2..8268086c 100644 --- a/example/sr/sr.grammar/sr/internal/token/token.go +++ b/example/sr/sr.grammar/sr/internal/token/token.go @@ -8,7 +8,8 @@ import ( type Token struct { Type - Lit []byte + Lit []byte + IgnoredPrefix []byte Pos ForeignAstNode interface{} Foreign bool diff --git a/example/sr/sr.grammar/sr/main/main.go b/example/sr/sr.grammar/sr/main/main.go index 0bbf0676..80b8f1e4 100644 --- a/example/sr/sr.grammar/sr/main/main.go +++ b/example/sr/sr.grammar/sr/main/main.go @@ -9,11 +9,15 @@ import ( sr "github.com/maxcalandrelli/gocc/example/sr/sr.grammar/sr" ) -func showResult(r interface{}, e error, l int) { +func showResult(r interface{}, e error, p []byte) { if e != nil { fmt.Fprintf(os.Stderr, "parsing returned the following error: %s\n", e.Error()) } else { - fmt.Printf("r=%#v, %d bytes\n", r, l) + if len(p) > 0 { + fmt.Printf("r=%#v, (%s)\n", r, string(p)) + } else { + fmt.Printf("r=%#v\n", r) + } } } @@ -23,11 +27,12 @@ var ( Longest bool ) -func parse(longest bool, lex *sr.Lexer) (res interface{}, err error, ptl int) { +func parse(longest bool, lex *sr.Lexer) (res interface{}, err error, parsed []byte) { if longest { return sr.NewParser().ParseLongestPrefix(lex) } else { - return sr.NewParser().Parse(lex) + res, err = sr.NewParser().Parse(lex) + parsed = []byte{} } return } diff --git a/example/sr/sr.grammar/sr/grammar.go b/example/sr/sr.grammar/sr/sr.go similarity index 79% rename from example/sr/sr.grammar/sr/grammar.go rename to example/sr/sr.grammar/sr/sr.go index f7158cc6..225fd475 100644 --- a/example/sr/sr.grammar/sr/grammar.go +++ b/example/sr/sr.grammar/sr/sr.go @@ -30,82 +30,82 @@ func NewParser() *parser.Parser { return parser.NewParser() } -func ParseFile(fpath string) (interface{}, error, int) { +func ParseFile(fpath string) (interface{}, error) { if lexer, err := NewLexerFile(fpath); err == nil { return NewParser().Parse(lexer) } else { - return nil, err, 0 + return nil, err } } -func ParseText(text string) (interface{}, error, int) { +func ParseText(text string) (interface{}, error) { return NewParser().Parse(NewLexerBytes([]byte(text))) } -func Parse(stream io.Reader) (interface{}, error, int) { +func Parse(stream io.Reader) (interface{}, error) { lex, err := NewLexer(stream) if lex == nil { - return nil, err, 0 + return nil, err } return NewParser().Parse(lex) } -func ParseFileWithData(fpath string, userData interface{}) (interface{}, error, int) { +func ParseFileWithData(fpath string, userData interface{}) (interface{}, error) { if lexer, err := NewLexerFile(fpath); err == nil { return NewParser().SetContext(userData).Parse(lexer) } else { - return nil, err, 0 + return nil, err } } -func ParseTextWithData(text string, userData interface{}) (interface{}, error, int) { +func ParseTextWithData(text string, userData interface{}) (interface{}, error) { return NewParser().SetContext(userData).Parse(NewLexerBytes([]byte(text))) } -func ParseWithData(stream io.Reader, userData interface{}) (interface{}, error, int) { +func ParseWithData(stream io.Reader, userData interface{}) (interface{}, error) { lex, err := NewLexer(stream) if lex == nil { - return nil, err, 0 + return nil, err } return NewParser().SetContext(userData).Parse(lex) } -func ParseFilePartial(fpath string) (interface{}, error, int) { +func ParseFilePartial(fpath string) (interface{}, error, []byte) { if lexer, err := NewLexerFile(fpath); err == nil { return NewParser().ParseLongestPrefix(lexer) } else { - return nil, err, 0 + return nil, err, []byte{} } } -func ParseTextPartial(text string) (interface{}, error, int) { +func ParseTextPartial(text string) (interface{}, error, []byte) { return NewParser().ParseLongestPrefix(NewLexerBytes([]byte(text))) } -func ParsePartial(stream io.Reader) (interface{}, error, int) { +func ParsePartial(stream io.Reader) (interface{}, error, []byte) { lex, err := NewLexer(stream) if lex == nil { - return nil, err, 0 + return nil, err, []byte{} } return NewParser().ParseLongestPrefix(lex) } -func ParseFileWithDataPartial(fpath string, userData interface{}) (interface{}, error, int) { +func ParseFileWithDataPartial(fpath string, userData interface{}) (interface{}, error, []byte) { if lexer, err := NewLexerFile(fpath); err == nil { return NewParser().SetContext(userData).ParseLongestPrefix(lexer) } else { - return nil, err, 0 + return nil, err, []byte{} } } -func ParseTextWithDataPartial(text string, userData interface{}) (interface{}, error, int) { +func ParseTextWithDataPartial(text string, userData interface{}) (interface{}, error, []byte) { return NewParser().SetContext(userData).ParseLongestPrefix(NewLexerBytes([]byte(text))) } -func ParseWithDataPartial(stream io.Reader, userData interface{}) (interface{}, error, int) { +func ParseWithDataPartial(stream io.Reader, userData interface{}) (interface{}, error, []byte) { lex, err := NewLexer(stream) if lex == nil { - return nil, err, 0 + return nil, err, []byte{} } return NewParser().SetContext(userData).ParseLongestPrefix(lex) } diff --git a/example/sr/sr_test.go b/example/sr/sr_test.go index 118852db..98dea3ef 100644 --- a/example/sr/sr_test.go +++ b/example/sr/sr_test.go @@ -10,7 +10,7 @@ import ( func parse(src string) (stmt ast.Stmt, err error) { lex := sr.NewLexerString(src) p := sr.NewParser() - if res, err, _ := p.Parse(lex); err == nil { + if res, err := p.Parse(lex); err == nil { stmt = res.(ast.Stmt) } return diff --git a/internal/ast/lexcharlit.go b/internal/ast/lexcharlit.go index e6f332bd..b8282069 100644 --- a/internal/ast/lexcharlit.go +++ b/internal/ast/lexcharlit.go @@ -36,7 +36,6 @@ func NewLexCharLitExt(tok interface{}, negate bool) (*LexCharLit, error) { func newLexCharLit(tok interface{}, negate bool) *LexCharLit { c := new(LexCharLit) lit := []byte(getString(tok)) - c.Val = util.LitToRune(lit) c.Lit = lit c.s = util.RuneToString(c.Val) diff --git a/internal/base/gen/golang/base.go b/internal/base/gen/golang/base.go index a70ae173..0c884506 100644 --- a/internal/base/gen/golang/base.go +++ b/internal/base/gen/golang/base.go @@ -55,7 +55,7 @@ func Gen(pkg, outdir, internal, iface string, cfg config.Config, hasSyntax bool) } func genBase(d data) { - basePath := path.Join(d.Outdir, "grammar.go") + basePath := path.Join(d.Outdir, d.MyName+".go") tmpl, err := template.New(d.MyName).Parse(baseSrc[1:]) if err != nil { panic(err) @@ -155,83 +155,83 @@ func NewParser() *parser.Parser { {{- if not .Config.NoLexer }} -func ParseFile(fpath string) (interface{}, error, int) { +func ParseFile(fpath string) (interface{}, error) { if lexer, err := NewLexerFile(fpath); err == nil { return NewParser().Parse(lexer) } else { - return nil, err, 0 + return nil, err } } -func ParseText(text string) (interface{}, error, int) { +func ParseText(text string) (interface{}, error) { return NewParser().Parse(NewLexerBytes([]byte(text))) } -func Parse(stream io.Reader) (interface{}, error, int) { +func Parse(stream io.Reader) (interface{}, error) { lex, err := NewLexer(stream) if lex == nil { - return nil, err, 0 + return nil, err } return NewParser().Parse(lex) } -func ParseFileWithData(fpath string, userData interface{}) (interface{}, error, int) { +func ParseFileWithData(fpath string, userData interface{}) (interface{}, error) { if lexer, err := NewLexerFile(fpath); err == nil { return NewParser().SetContext(userData).Parse(lexer) } else { - return nil, err, 0 + return nil, err } } -func ParseTextWithData(text string, userData interface{}) (interface{}, error, int) { +func ParseTextWithData(text string, userData interface{}) (interface{}, error) { return NewParser().SetContext(userData).Parse(NewLexerBytes([]byte(text))) } -func ParseWithData(stream io.Reader, userData interface{}) (interface{}, error, int) { +func ParseWithData(stream io.Reader, userData interface{}) (interface{}, error) { lex, err := NewLexer(stream) if lex == nil { - return nil, err, 0 + return nil, err } return NewParser().SetContext(userData).Parse(lex) } -func ParseFilePartial(fpath string) (interface{}, error, int) { +func ParseFilePartial(fpath string) (interface{}, error, []byte) { if lexer, err := NewLexerFile(fpath); err == nil { return NewParser().ParseLongestPrefix(lexer) } else { - return nil, err, 0 + return nil, err, []byte{} } } -func ParseTextPartial(text string) (interface{}, error, int) { +func ParseTextPartial(text string) (interface{}, error, []byte) { return NewParser().ParseLongestPrefix(NewLexerBytes([]byte(text))) } -func ParsePartial(stream io.Reader) (interface{}, error, int) { +func ParsePartial(stream io.Reader) (interface{}, error, []byte) { lex, err := NewLexer(stream) if lex == nil { - return nil, err, 0 + return nil, err, []byte{} } return NewParser().ParseLongestPrefix(lex) } -func ParseFileWithDataPartial(fpath string, userData interface{}) (interface{}, error, int) { +func ParseFileWithDataPartial(fpath string, userData interface{}) (interface{}, error, []byte) { if lexer, err := NewLexerFile(fpath); err == nil { return NewParser().SetContext(userData).ParseLongestPrefix(lexer) } else { - return nil, err, 0 + return nil, err, []byte{} } } -func ParseTextWithDataPartial(text string, userData interface{}) (interface{}, error, int) { +func ParseTextWithDataPartial(text string, userData interface{}) (interface{}, error, []byte) { return NewParser().SetContext(userData).ParseLongestPrefix(NewLexerBytes([]byte(text))) } -func ParseWithDataPartial(stream io.Reader, userData interface{}) (interface{}, error, int) { +func ParseWithDataPartial(stream io.Reader, userData interface{}) (interface{}, error, []byte) { lex, err := NewLexer(stream) if lex == nil { - return nil, err, 0 + return nil, err, []byte{} } return NewParser().SetContext(userData).ParseLongestPrefix(lex) } @@ -291,11 +291,15 @@ import ( {{.MyName}} "{{.Pkg}}" ) -func showResult (r interface{}, e error, l int) { +func showResult (r interface{}, e error, p []byte) { if e != nil { fmt.Fprintf(os.Stderr, "parsing returned the following error: %s\n", e.Error()) } else { - fmt.Printf("r=%#v, %d bytes\n", r, l) + if len(p) > 0 { + fmt.Printf("r=%#v, (%s)\n", r, string(p)) + } else { + fmt.Printf("r=%#v\n", r) + } } } @@ -305,11 +309,12 @@ var ( Longest bool ) -func parse (longest bool, lex *{{.MyName}}.Lexer) (res interface{}, err error, ptl int) { +func parse (longest bool, lex *{{.MyName}}.Lexer) (res interface{}, err error, parsed []byte) { if longest { return {{.MyName}}.NewParser().ParseLongestPrefix(lex) } else { - return {{.MyName}}.NewParser().Parse(lex) + res, err = {{.MyName}}.NewParser().Parse(lex) + parsed = []byte{} } return } @@ -366,10 +371,11 @@ type ( CheckPoint interface { DistanceFrom(CheckPoint) int + Advance(int)CheckPoint } CheckPointable interface { - GetCheckPoint() CheckPoint + GetCheckPoint() CheckPoint GotoCheckPoint(CheckPoint) } diff --git a/internal/config/config.go b/internal/config/config.go index cb22e49d..0272989d 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -27,7 +27,7 @@ import ( ) const ( - VERSION = "1.2.0001" + VERSION = "1.2.0005" INTERNAL_SYMBOL_EMPTY = "ε" INTERNAL_SYMBOL_ERROR = "λ" // (λάθος) diff --git a/internal/frontend/reparsed/grammar.go b/internal/frontend/reparsed/gocc2.go similarity index 79% rename from internal/frontend/reparsed/grammar.go rename to internal/frontend/reparsed/gocc2.go index 8876da3e..9f2b32c7 100644 --- a/internal/frontend/reparsed/grammar.go +++ b/internal/frontend/reparsed/gocc2.go @@ -30,82 +30,82 @@ func NewParser() *parser.Parser { return parser.NewParser() } -func ParseFile(fpath string) (interface{}, error, int) { +func ParseFile(fpath string) (interface{}, error) { if lexer, err := NewLexerFile(fpath); err == nil { return NewParser().Parse(lexer) } else { - return nil, err, 0 + return nil, err } } -func ParseText(text string) (interface{}, error, int) { +func ParseText(text string) (interface{}, error) { return NewParser().Parse(NewLexerBytes([]byte(text))) } -func Parse(stream io.Reader) (interface{}, error, int) { +func Parse(stream io.Reader) (interface{}, error) { lex, err := NewLexer(stream) if lex == nil { - return nil, err, 0 + return nil, err } return NewParser().Parse(lex) } -func ParseFileWithData(fpath string, userData interface{}) (interface{}, error, int) { +func ParseFileWithData(fpath string, userData interface{}) (interface{}, error) { if lexer, err := NewLexerFile(fpath); err == nil { return NewParser().SetContext(userData).Parse(lexer) } else { - return nil, err, 0 + return nil, err } } -func ParseTextWithData(text string, userData interface{}) (interface{}, error, int) { +func ParseTextWithData(text string, userData interface{}) (interface{}, error) { return NewParser().SetContext(userData).Parse(NewLexerBytes([]byte(text))) } -func ParseWithData(stream io.Reader, userData interface{}) (interface{}, error, int) { +func ParseWithData(stream io.Reader, userData interface{}) (interface{}, error) { lex, err := NewLexer(stream) if lex == nil { - return nil, err, 0 + return nil, err } return NewParser().SetContext(userData).Parse(lex) } -func ParseFilePartial(fpath string) (interface{}, error, int) { +func ParseFilePartial(fpath string) (interface{}, error, []byte) { if lexer, err := NewLexerFile(fpath); err == nil { return NewParser().ParseLongestPrefix(lexer) } else { - return nil, err, 0 + return nil, err, []byte{} } } -func ParseTextPartial(text string) (interface{}, error, int) { +func ParseTextPartial(text string) (interface{}, error, []byte) { return NewParser().ParseLongestPrefix(NewLexerBytes([]byte(text))) } -func ParsePartial(stream io.Reader) (interface{}, error, int) { +func ParsePartial(stream io.Reader) (interface{}, error, []byte) { lex, err := NewLexer(stream) if lex == nil { - return nil, err, 0 + return nil, err, []byte{} } return NewParser().ParseLongestPrefix(lex) } -func ParseFileWithDataPartial(fpath string, userData interface{}) (interface{}, error, int) { +func ParseFileWithDataPartial(fpath string, userData interface{}) (interface{}, error, []byte) { if lexer, err := NewLexerFile(fpath); err == nil { return NewParser().SetContext(userData).ParseLongestPrefix(lexer) } else { - return nil, err, 0 + return nil, err, []byte{} } } -func ParseTextWithDataPartial(text string, userData interface{}) (interface{}, error, int) { +func ParseTextWithDataPartial(text string, userData interface{}) (interface{}, error, []byte) { return NewParser().SetContext(userData).ParseLongestPrefix(NewLexerBytes([]byte(text))) } -func ParseWithDataPartial(stream io.Reader, userData interface{}) (interface{}, error, int) { +func ParseWithDataPartial(stream io.Reader, userData interface{}) (interface{}, error, []byte) { lex, err := NewLexer(stream) if lex == nil { - return nil, err, 0 + return nil, err, []byte{} } return NewParser().SetContext(userData).ParseLongestPrefix(lex) } diff --git a/internal/frontend/reparsed/iface/gocc2.go b/internal/frontend/reparsed/iface/gocc2.go index c11ff9fd..0c599e5a 100644 --- a/internal/frontend/reparsed/iface/gocc2.go +++ b/internal/frontend/reparsed/iface/gocc2.go @@ -25,6 +25,7 @@ type ( CheckPoint interface { DistanceFrom(CheckPoint) int + Advance(int) CheckPoint } CheckPointable interface { diff --git a/internal/frontend/reparsed/internal/iface/gocc2.go b/internal/frontend/reparsed/internal/iface/gocc2.go deleted file mode 100644 index 9d14c50f..00000000 --- a/internal/frontend/reparsed/internal/iface/gocc2.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by gocc; DO NOT EDIT. - -package iface - -import ( - "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/internal/token" - "io" -) - -type ( - Scanner interface { - Scan() (tok *token.Token) - } - - StreamScanner interface { - GetStream() TokenStream - } - - CheckPoint interface { - DistanceFrom(CheckPoint) int - } - - CheckPointable interface { - GetCheckPoint() CheckPoint - GotoCheckPoint(CheckPoint) - } - - TokenStream interface { - io.Reader - io.RuneScanner - io.Seeker - } -) diff --git a/internal/frontend/reparsed/internal/lexer/lexer.go b/internal/frontend/reparsed/internal/lexer/lexer.go index ba02bf32..b7007712 100644 --- a/internal/frontend/reparsed/internal/lexer/lexer.go +++ b/internal/frontend/reparsed/internal/lexer/lexer.go @@ -78,6 +78,10 @@ func (c checkPoint) DistanceFrom (o iface.CheckPoint) int { return int (c.value() - o.(checkPoint).value()) } +func (c checkPoint) Advance (o int) iface.CheckPoint { + return checkPoint(c.value() + int64(o)) +} + func (l *Lexer) GetCheckPoint() iface.CheckPoint { if l == nil { return checkPoint(0) @@ -93,10 +97,10 @@ func (l Lexer) GotoCheckPoint(cp iface.CheckPoint) { func (l *Lexer) Scan() (tok *token.Token) { tok = new(token.Token) tok.Type = token.INVALID - tok.Lit = []byte{} start := l.position state := 0 for state != -1 { + savePos := l.position.Pos curr, size, err := l.stream.ReadRune() if size < 1 || err != nil { curr = INVALID_RUNE @@ -129,12 +133,14 @@ func (l *Lexer) Scan() (tok *token.Token) { start = l.position state = 0 tok.Lit = []byte{} + tok.IgnoredPrefix=append(tok.IgnoredPrefix,string(curr)...) } } else if curr != INVALID_RUNE{ if len(tok.Lit) == 0 { tok.Lit = append(tok.Lit, string(curr)...) } else { l.stream.UnreadRune() + l.position.Pos = savePos } } if err == io.EOF && len(tok.Lit)==0 { diff --git a/internal/frontend/reparsed/internal/parser/actiontable.go b/internal/frontend/reparsed/internal/parser/actiontable.go index ace546c6..429dd21a 100644 --- a/internal/frontend/reparsed/internal/parser/actiontable.go +++ b/internal/frontend/reparsed/internal/parser/actiontable.go @@ -4,7 +4,7 @@ package parser type ( actionTable [numStates]actionRow - cdFunc func(TokenStream, interface{}) (interface{}, error, int) + cdFunc func(TokenStream, interface{}) (interface{}, error, []byte) cdAction struct { tokenIndex int tokenScanner cdFunc diff --git a/internal/frontend/reparsed/internal/parser/parser.go b/internal/frontend/reparsed/internal/parser/parser.go index dc3832d2..c51b5399 100644 --- a/internal/frontend/reparsed/internal/parser/parser.go +++ b/internal/frontend/reparsed/internal/parser/parser.go @@ -93,10 +93,23 @@ type Parser struct { stack *stack nextToken *token.Token userContext interface{} + + // + // Working data, should be method parameters/locals + // but putting them here simplifies a bit the code + // Useful only for longest prefix partial parsing + // + needsRepositioning bool + isNonDeterministic bool + tokens iface.CheckPointable + afterPos iface.CheckPoint + checkPoint iface.CheckPoint + underlyingStream iface.TokenStream } +type TokenStream = iface.TokenStream + type ( - TokenStream = iface.TokenStream fakeCp struct{} fakeCheckPointable struct{} ) @@ -105,12 +118,16 @@ func (f fakeCheckPointable) GetCheckPoint() iface.CheckPoint { return fakeCp{} } -func (f fakeCheckPointable) GotoCheckPoint(iface.CheckPoint) {} - func (f fakeCp) DistanceFrom(o iface.CheckPoint) int { return 0 } +func (f fakeCp) Advance(o int) iface.CheckPoint { + return fakeCp{} +} + +func (f fakeCheckPointable) GotoCheckPoint(iface.CheckPoint) {} + func NewParser() *Parser { return NewParserWithContext(nil) } @@ -205,62 +222,74 @@ func (p *Parser) newError(err error) error { return e } -func (p *Parser) Parse(scanner iface.Scanner) (res interface{}, err error, ptl int) { +func (p *Parser) prepareParsing(scanner iface.Scanner, longest bool) error { + p.Reset() + p.needsRepositioning = longest + p.isNonDeterministic = false + if p.needsRepositioning { + if streamScanner, _ := scanner.(iface.StreamScanner); streamScanner != nil { + p.underlyingStream = streamScanner.GetStream() + } + if p.tokens, _ = scanner.(iface.CheckPointable); p.tokens == nil || p.underlyingStream == nil { + return errNotRepositionable + } + } else { + if p.tokens, _ = scanner.(iface.CheckPointable); p.tokens == nil { + p.tokens = fakeCheckPointable{} + } + } + return nil +} + +func (p *Parser) Parse(scanner iface.Scanner) (res interface{}, err error) { + if err := p.prepareParsing(scanner, false); err != nil { + return nil, err + } return p.parse(scanner, false) } -func (p *Parser) ParseLongestPrefix(scanner iface.Scanner) (res interface{}, err error, ptl int) { - return p.parse(scanner, true) +func (p *Parser) ParseLongestPrefix(scanner iface.Scanner) (res interface{}, err error, parsed []byte) { + if err := p.prepareParsing(scanner, true); err != nil { + return nil, err, []byte{} + } + startPoint := p.tokens.GetCheckPoint() + res, err = p.parse(scanner, true) + if err == nil { + currPoint := p.tokens.GetCheckPoint() + p.tokens.GotoCheckPoint(startPoint) + parsed = make([]byte, currPoint.DistanceFrom(startPoint)) + p.underlyingStream.Read(parsed) + p.tokens.GotoCheckPoint(currPoint) + } + return } var errNotRepositionable = errors.New("scanner not repositionable") -func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, err error, ptl int) { - var ( - tokens iface.CheckPointable - afterPos iface.CheckPoint - checkPoint iface.CheckPoint - ) - readNextToken := func() error { - if tokens == nil && (len(parserActions.table[p.stack.top()].cdActions) > 0 || longest) { - return errNotRepositionable - } - if longest { - checkPoint = tokens.GetCheckPoint() - } +func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, err error) { + readNextToken := func() { + p.checkPoint = p.tokens.GetCheckPoint() p.nextToken = scanner.Scan() - if longest { - afterPos = tokens.GetCheckPoint() - } - return nil - } - p.Reset() - if tokens, _ = scanner.(iface.CheckPointable); tokens == nil { - tokens = fakeCheckPointable{} - } - underlyingStream := TokenStream(nil) - if streamScanner, _ := scanner.(iface.StreamScanner); streamScanner != nil { - underlyingStream = streamScanner.GetStream() - } - startCp := tokens.GetCheckPoint() - if err := readNextToken(); err != nil { - return nil, err, tokens.GetCheckPoint().DistanceFrom(startCp) + p.afterPos = p.tokens.GetCheckPoint() + return } + readNextToken() for acc := false; !acc; { action := parserActions.table[p.stack.top()].actions[p.nextToken.Type] - if action == nil && underlyingStream != nil && len(parserActions.table[p.stack.top()].cdActions) > 0 { + if action == nil && p.isNonDeterministic { // // If no action, check if we have some context dependent parsing to try // + p.checkPoint = p.checkPoint.Advance(len(p.nextToken.IgnoredPrefix)) for _, cdAction := range parserActions.table[p.stack.top()].cdActions { - tokens.GotoCheckPoint(checkPoint) - cd_res, cd_err, cd_parsed := cdAction.tokenScanner(underlyingStream, p.userContext) - if cd_err == nil && cd_parsed > 0 { + p.tokens.GotoCheckPoint(p.checkPoint) + cd_res, cd_err, cd_parsed := cdAction.tokenScanner(p.underlyingStream, p.userContext) + if cd_err == nil && len(cd_parsed) > 0 { action = parserActions.table[p.stack.top()].actions[cdAction.tokenIndex] if action != nil { p.nextToken.Foreign = true p.nextToken.ForeignAstNode = cd_res - p.nextToken.Lit = []byte{} + p.nextToken.Lit = cd_parsed p.nextToken.Type = token.Type(cdAction.tokenIndex) break } @@ -275,13 +304,13 @@ func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, er // Dirty, dirty, dirty... but I found it as it is, and I prefer not to touch // if action == nil && longest { - tokens.GotoCheckPoint(checkPoint) + p.tokens.GotoCheckPoint(p.checkPoint) action = parserActions.table[p.stack.top()].actions[token.EOF] if action == nil { // // ok, let's consume the token then // - tokens.GotoCheckPoint(afterPos) + p.tokens.GotoCheckPoint(p.afterPos) } } @@ -291,7 +320,7 @@ func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, er if action == nil { if recovered, errAttrib := p.Error(nil, scanner); !recovered { p.nextToken = errAttrib.ErrorToken - return nil, p.newError(nil), tokens.GetCheckPoint().DistanceFrom(startCp) + return nil, p.newError(nil) } if action = parserActions.table[p.stack.top()].actions[p.nextToken.Type]; action == nil { panic("Error recovery led to invalid action") @@ -307,14 +336,12 @@ func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, er if p.nextToken.Foreign { p.stack.push(int(act), p.nextToken.ForeignAstNode) } - if err := readNextToken(); err != nil { - return nil, err, tokens.GetCheckPoint().DistanceFrom(startCp) - } + readNextToken() case reduce: prod := productionsTable[int(act)] attrib, err := prod.ReduceFunc(p.userContext, p.stack.popN(prod.NumSymbols)) if err != nil { - return nil, p.newError(err), tokens.GetCheckPoint().DistanceFrom(startCp) + return nil, p.newError(err) } else { p.stack.push(gotoTab[p.stack.top()][prod.NTType], attrib) } @@ -322,5 +349,5 @@ func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, er panic("unknown action: " + action.String()) } } - return res, nil, tokens.GetCheckPoint().DistanceFrom(startCp) + return res, nil } diff --git a/internal/frontend/reparsed/internal/parser/productionstable.go b/internal/frontend/reparsed/internal/parser/productionstable.go index 6bdf5418..79ba57d5 100644 --- a/internal/frontend/reparsed/internal/parser/productionstable.go +++ b/internal/frontend/reparsed/internal/parser/productionstable.go @@ -191,13 +191,13 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `LexTerm : Λ<~> char_lit << ast.NewLexCharLitExt(X[0], true) >>`, + String: `LexTerm : Λ<~> char_lit << ast.NewLexCharLitExt(X[1], true) >>`, Id: "LexTerm", NTType: 8, Index: 17, NumSymbols: 2, ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { - return ast.NewLexCharLitExt(X[0], true) + return ast.NewLexCharLitExt(X[1], true) }, }, ProdTabEntry{ diff --git a/internal/frontend/reparsed/internal/token/token.go b/internal/frontend/reparsed/internal/token/token.go index 76cf5a61..48f6c9f7 100644 --- a/internal/frontend/reparsed/internal/token/token.go +++ b/internal/frontend/reparsed/internal/token/token.go @@ -8,7 +8,8 @@ import ( type Token struct { Type - Lit []byte + Lit []byte + IgnoredPrefix []byte Pos ForeignAstNode interface{} Foreign bool @@ -135,22 +136,22 @@ var TokMap = TokenMap{ }, litMap: map[string]Type{ - "}": 17, - "ε": 26, - "λ": 24, + ".": 8, + "~": 11, + "(": 12, "empty": 25, - ":": 3, - ";": 4, "|": 7, + ";": 4, + "{": 16, + ":": 3, "-": 10, ")": 13, "[": 14, - ".": 8, - "~": 11, "]": 15, - "(": 12, - "{": 16, + "}": 17, "@": 22, "error": 23, + "λ": 24, + "ε": 26, }, } diff --git a/internal/frontend/reparsed/main/main.go b/internal/frontend/reparsed/main/main.go index 88410717..45fda21f 100644 --- a/internal/frontend/reparsed/main/main.go +++ b/internal/frontend/reparsed/main/main.go @@ -9,11 +9,15 @@ import ( gocc2 "github.com/maxcalandrelli/gocc/internal/frontend/reparsed" ) -func showResult(r interface{}, e error, l int) { +func showResult(r interface{}, e error, p []byte) { if e != nil { fmt.Fprintf(os.Stderr, "parsing returned the following error: %s\n", e.Error()) } else { - fmt.Printf("r=%#v, %d bytes\n", r, l) + if len(p) > 0 { + fmt.Printf("r=%#v, (%s)\n", r, string(p)) + } else { + fmt.Printf("r=%#v\n", r) + } } } @@ -23,11 +27,12 @@ var ( Longest bool ) -func parse(longest bool, lex *gocc2.Lexer) (res interface{}, err error, ptl int) { +func parse(longest bool, lex *gocc2.Lexer) (res interface{}, err error, parsed []byte) { if longest { return gocc2.NewParser().ParseLongestPrefix(lex) } else { - return gocc2.NewParser().Parse(lex) + res, err = gocc2.NewParser().Parse(lex) + parsed = []byte{} } return } diff --git a/internal/lexer/gen/golang/lexer.go b/internal/lexer/gen/golang/lexer.go index fbe5d50c..0347ad74 100644 --- a/internal/lexer/gen/golang/lexer.go +++ b/internal/lexer/gen/golang/lexer.go @@ -47,6 +47,7 @@ func getLexerData(pkg, outDir string, itemsets *items.ItemSets, cfg config.Confi NumStates: itemsets.Size(), NumSymbols: len(lexSymbols), Symbols: lexSymbols, + MyName: cfg.ProjectName(), } } @@ -59,6 +60,7 @@ type lexerData struct { NumSymbols int NextState []byte Symbols []string + MyName string } const lexerSrc string = ` @@ -142,6 +144,10 @@ func (c checkPoint) DistanceFrom (o iface.CheckPoint) int { return int (c.value() - o.(checkPoint).value()) } +func (c checkPoint) Advance (o int) iface.CheckPoint { + return checkPoint(c.value() + int64(o)) +} + func (l *Lexer) GetCheckPoint() iface.CheckPoint { if l == nil { return checkPoint(0) @@ -156,23 +162,23 @@ func (l Lexer) GotoCheckPoint(cp iface.CheckPoint) { func (l *Lexer) Scan() (tok *token.Token) { {{- if .Debug}} - fmt.Printf("Lexer.Scan() pos=%d\n", l.position.Pos.Offset) + fmt.Printf("{{.MyName}}:lexer:Lexer.Scan() pos=%d\n", l.position.Pos.Offset) {{- end}} tok = new(token.Token) tok.Type = token.INVALID - tok.Lit = []byte{} start := l.position state := 0 for state != -1 { {{- if .Debug}} - fmt.Printf("\tpos=%d, line=%d, col=%d, state=%d\n", l.position.Pos.Offset, l.position.Pos.Line, l.position.Pos.Column, state) + fmt.Printf("{{.MyName}}:lexer: pos=%d, line=%d, col=%d, state=%d\n", l.position.Pos.Offset, l.position.Pos.Line, l.position.Pos.Column, state) {{- end}} + savePos := l.position.Pos curr, size, err := l.stream.ReadRune() if size < 1 || err != nil { curr = INVALID_RUNE } {{- if .Debug}} - fmt.Printf("\trune=<%c> size=%d err=%v\n", curr, size, err) + fmt.Printf("{{.MyName}}:lexer: rune=<%c> size=%d err=%v\n", curr, size, err) {{- end}} if size > 0 { l.position.Pos.Offset += size @@ -182,10 +188,10 @@ func (l *Lexer) Scan() (tok *token.Token) { nextState = TransTab[state](curr) } {{- if .Debug}} - fmt.Printf("\tS%d, : tok=%s, rune == %s(%x), next state == %d\n", state, token.TokMap.Id(tok.Type), util.RuneToString(curr), curr, nextState) - fmt.Printf("\t\tpos=%d, size=%d, start=%d\n", l.position.Pos.Offset, size, start.Pos.Offset) + fmt.Printf("{{.MyName}}:lexer:S%d, : tok=%s, rune == %s(%x), next state == %d\n", state, token.TokMap.Id(tok.Type), util.RuneToString(curr), curr, nextState) + fmt.Printf("{{.MyName}}:lexer: pos=%d, size=%d, start=%d\n", l.position.Pos.Offset, size, start.Pos.Offset) if nextState != -1 { - fmt.Printf("\t\taction:%s\n", ActTab[nextState].String()) + fmt.Printf("{{.MyName}}:lexer: action:%s\n", ActTab[nextState].String()) } {{- end}} state = nextState @@ -209,12 +215,14 @@ func (l *Lexer) Scan() (tok *token.Token) { start = l.position state = 0 tok.Lit = []byte{} + tok.IgnoredPrefix=append(tok.IgnoredPrefix,string(curr)...) } } else if curr != INVALID_RUNE{ if len(tok.Lit) == 0 { tok.Lit = append(tok.Lit, string(curr)...) } else { l.stream.UnreadRune() + l.position.Pos = savePos } } if err == io.EOF && len(tok.Lit)==0 { @@ -225,7 +233,7 @@ func (l *Lexer) Scan() (tok *token.Token) { } tok.Pos = start.Pos {{- if .Debug}} - fmt.Printf("Token at %s: %s \"%s\"\n", tok.String(), token.TokMap.Id(tok.Type), tok.Lit) + fmt.Printf("{{.MyName}}:lexer:Token at %s: %s \"%s\"\n", tok.String(), token.TokMap.Id(tok.Type), tok.Lit) {{- end}} return } diff --git a/internal/parser/gen/golang/actiontable.go b/internal/parser/gen/golang/actiontable.go index 9baeadf8..6f933092 100644 --- a/internal/parser/gen/golang/actiontable.go +++ b/internal/parser/gen/golang/actiontable.go @@ -130,7 +130,7 @@ package parser type ( actionTable [numStates]actionRow - cdFunc func(TokenStream, interface{}) (interface{}, error, int) + cdFunc func(TokenStream, interface{}) (interface{}, error, []byte) cdAction struct { tokenIndex int tokenScanner cdFunc diff --git a/internal/parser/gen/golang/parser.go b/internal/parser/gen/golang/parser.go index bc208a6f..0bcafe74 100644 --- a/internal/parser/gen/golang/parser.go +++ b/internal/parser/gen/golang/parser.go @@ -57,6 +57,7 @@ type parserData struct { CdSubList ast.SyntaxSymbols CdSubImports map[string]string ErrorTokenName string + MyName string } func getParserData(pkg, internal, iface string, prods ast.SyntaxProdList, itemSets *items.ItemSets, symbols *symbols.Symbols, cfg config.Config) *parserData { @@ -73,6 +74,7 @@ func getParserData(pkg, internal, iface string, prods ast.SyntaxProdList, itemSe CdSubList: symbols.ListSubParserSymbols(), CdSubImports: map[string]string{}, ErrorTokenName: config.INTERNAL_SYMBOL_ERROR, + MyName: cfg.ProjectName(), } for _, sym := range ret.CdSubList { sub := sym.(ast.SyntaxSubParser) @@ -188,10 +190,23 @@ type Parser struct { stack *stack nextToken *token.Token userContext interface{} + + // + // Working data, should be method parameters/locals + // but putting them here simplifies a bit the code + // Useful only for longest prefix partial parsing + // + needsRepositioning bool + isNonDeterministic bool + tokens iface.CheckPointable + afterPos iface.CheckPoint + checkPoint iface.CheckPoint + underlyingStream iface.TokenStream } +type TokenStream = iface.TokenStream + type ( - TokenStream = iface.TokenStream fakeCp struct{} fakeCheckPointable struct{} ) @@ -200,20 +215,24 @@ func (f fakeCheckPointable) GetCheckPoint() iface.CheckPoint { return fakeCp{} } -func (f fakeCheckPointable) GotoCheckPoint(iface.CheckPoint) {} - func (f fakeCp) DistanceFrom(o iface.CheckPoint) int { return 0 } +func (f fakeCp) Advance (o int) iface.CheckPoint { + return fakeCp{} +} + +func (f fakeCheckPointable) GotoCheckPoint(iface.CheckPoint) {} + {{ range $c := .CdTokList }} -func {{ printf "cdFunc_%s" $c.SymbolString }} (Stream TokenStream, Context interface{}) (interface{}, error, int) { +func {{ printf "cdFunc_%s" $c.SymbolString }} (Stream TokenStream, Context interface{}) (interface{}, error, []byte) { return {{ $c.ContexDependentParseFunctionCall }} } {{ end }} {{ range $c := .CdSubList }} -func {{ printf "cdFunc_%s" $c.SymbolString }} (Stream TokenStream, Context interface{}) (interface{}, error, int) { +func {{ printf "cdFunc_%s" $c.SymbolString }} (Stream TokenStream, Context interface{}) (interface{}, error, []byte) { return {{$c.Alias}}.ParseWithDataPartial(Stream, Context) } {{ end }} @@ -313,72 +332,94 @@ func (p *Parser) newError(err error) error { return e } -func (p *Parser) Parse(scanner iface.Scanner) (res interface{}, err error, ptl int) { +func (p *Parser) prepareParsing(scanner iface.Scanner, longest bool) error { + p.Reset() + {{- if and (eq (len .CdTokList) 0) (eq (len .CdSubList) 0) }} + p.needsRepositioning = longest + p.isNonDeterministic = false + {{- else }} + p.needsRepositioning = true + p.isNonDeterministic = true + {{- end }} + if p.needsRepositioning { + if streamScanner, _ := scanner.(iface.StreamScanner) ; streamScanner != nil { + p.underlyingStream = streamScanner.GetStream() + } + if p.tokens, _ = scanner.(iface.CheckPointable) ; p.tokens == nil || p.underlyingStream == nil { + return errNotRepositionable + } + } else { + if p.tokens, _ = scanner.(iface.CheckPointable) ; p.tokens == nil { + p.tokens = fakeCheckPointable{} + } + } + return nil +} + +func (p *Parser) Parse(scanner iface.Scanner) (res interface{}, err error) { + if err := p.prepareParsing (scanner, false); err != nil { + return nil, err + } return p.parse(scanner, false) } -func (p *Parser) ParseLongestPrefix(scanner iface.Scanner) (res interface{}, err error, ptl int) { - return p.parse(scanner, true) +func (p *Parser) ParseLongestPrefix(scanner iface.Scanner) (res interface{}, err error, parsed []byte) { + if err := p.prepareParsing (scanner, true); err != nil { + return nil, err, []byte{} + } + startPoint := p.tokens.GetCheckPoint() + res, err = p.parse(scanner, true) + if err == nil { + currPoint := p.tokens.GetCheckPoint() + p.tokens.GotoCheckPoint(startPoint) + parsed = make([]byte, currPoint.DistanceFrom(startPoint)) + p.underlyingStream.Read(parsed) + p.tokens.GotoCheckPoint(currPoint) + } + return } var errNotRepositionable = errors.New("scanner not repositionable") -func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, err error, ptl int) { - var ( - tokens iface.CheckPointable - afterPos iface.CheckPoint - checkPoint iface.CheckPoint - ) - readNextToken := func () error { - if tokens == nil && (len(parserActions.table[p.stack.top()].cdActions) > 0 || longest) { - return errNotRepositionable - } - {{- if and (eq (len .CdTokList) 0) (eq (len .CdSubList) 0) }} - if longest { - checkPoint = tokens.GetCheckPoint() - } - {{- else }} - checkPoint = tokens.GetCheckPoint() - {{- end }} - p.nextToken = scanner.Scan() - if longest { - afterPos = tokens.GetCheckPoint() - } - return nil - } - p.Reset() - if tokens, _ = scanner.(iface.CheckPointable) ; tokens == nil { - tokens = fakeCheckPointable{} - } - underlyingStream := TokenStream(nil) - if streamScanner, _ := scanner.(iface.StreamScanner) ; streamScanner != nil { - underlyingStream = streamScanner.GetStream() - } - startCp := tokens.GetCheckPoint() - if err := readNextToken(); err != nil { - return nil, err, tokens.GetCheckPoint().DistanceFrom(startCp) +func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, err error) { + readNextToken := func () { + p.checkPoint = p.tokens.GetCheckPoint() + p.nextToken = scanner.Scan() + p.afterPos = p.tokens.GetCheckPoint() + return } + readNextToken() for acc := false; !acc; { action := parserActions.table[p.stack.top()].actions[p.nextToken.Type] - if action == nil && underlyingStream != nil && len(parserActions.table[p.stack.top()].cdActions) > 0 { + if action == nil && p.isNonDeterministic { // // If no action, check if we have some context dependent parsing to try // - for _, cdAction := range parserActions.table[p.stack.top()].cdActions { - tokens.GotoCheckPoint (checkPoint) - cd_res, cd_err, cd_parsed := cdAction.tokenScanner(underlyingStream, p.userContext) - if cd_err == nil && cd_parsed > 0 { - action = parserActions.table[p.stack.top()].actions[cdAction.tokenIndex] - if action != nil { - p.nextToken.Foreign = true - p.nextToken.ForeignAstNode = cd_res - p.nextToken.Lit = []byte{} - p.nextToken.Type = token.Type(cdAction.tokenIndex) - break - } - } - } + p.checkPoint = p.checkPoint.Advance(len(p.nextToken.IgnoredPrefix)) + {{- if .Debug }} + fmt.Printf("{{.MyName}}:parser:S%d advanced %d bytes because of prefix <%s> of token <%s>\n", p.stack.top(), len(p.nextToken.IgnoredPrefix), string(p.nextToken.IgnoredPrefix), string(p.nextToken.Lit)) + {{- end }} + for _, cdAction := range parserActions.table[p.stack.top()].cdActions { + {{- if .Debug }} + fmt.Printf("{{.MyName}}:parser:S%d trying=<%#v> \n", p.stack.top(), cdAction) + {{- end }} + p.tokens.GotoCheckPoint(p.checkPoint) + cd_res, cd_err, cd_parsed := cdAction.tokenScanner(p.underlyingStream, p.userContext) + if cd_err == nil && len(cd_parsed) > 0 { + action = parserActions.table[p.stack.top()].actions[cdAction.tokenIndex] + if action != nil { + p.nextToken.Foreign = true + p.nextToken.ForeignAstNode = cd_res + p.nextToken.Lit = cd_parsed + p.nextToken.Type = token.Type(cdAction.tokenIndex) + {{- if .Debug }} + fmt.Printf("{{.MyName}}:parser:S%d got pseudo token=<%s> \n", p.stack.top(), string(p.nextToken.Lit)) + {{- end }} + break + } + } + } } // // Still no action? If a longest possible parsing is requested in place @@ -388,16 +429,16 @@ func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, er // Dirty, dirty, dirty... but I found it as it is, and I prefer not to touch // if action == nil && longest { - tokens.GotoCheckPoint(checkPoint) + p.tokens.GotoCheckPoint(p.checkPoint) action = parserActions.table[p.stack.top()].actions[token.EOF] if action == nil { // // ok, let's consume the token then // - {{- if .Debug }} - fmt.Printf("S%d unrecognized=<%#v> restoring checkpoint at %#v => %s\n", p.stack.top(), p.nextToken, afterPos, action) - {{- end }} - tokens.GotoCheckPoint(afterPos) + {{- if .Debug }} + fmt.Printf("{{.MyName}}:parser:S%d unrecognized=<%#v> restoring checkpoint at %#v => %s\n", p.stack.top(), p.nextToken, p.afterPos, action) + {{- end }} + p.tokens.GotoCheckPoint(p.afterPos) } } @@ -407,14 +448,14 @@ func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, er if action == nil { if recovered, errAttrib := p.Error(nil, scanner); !recovered { p.nextToken = errAttrib.ErrorToken - return nil, p.newError(nil), tokens.GetCheckPoint().DistanceFrom(startCp) + return nil, p.newError(nil) } if action = parserActions.table[p.stack.top()].actions[p.nextToken.Type]; action == nil { panic("Error recovery led to invalid action") } } {{- if .Debug }} - fmt.Printf("S%d %s %s\n", p.stack.top(), token.TokMap.TokenString(p.nextToken), action) + fmt.Printf("{{.MyName}}:parser:S%d %s %s\n", p.stack.top(), token.TokMap.TokenString(p.nextToken), action) {{- end }} switch act := action.(type) { @@ -426,14 +467,12 @@ func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, er if p.nextToken.Foreign { p.stack.push(int(act), p.nextToken.ForeignAstNode) } - if err := readNextToken(); err != nil { - return nil, err, tokens.GetCheckPoint().DistanceFrom(startCp) - } + readNextToken() case reduce: prod := productionsTable[int(act)] attrib, err := prod.ReduceFunc(p.userContext, p.stack.popN(prod.NumSymbols)) if err != nil { - return nil, p.newError(err), tokens.GetCheckPoint().DistanceFrom(startCp) + return nil, p.newError(err) } else { p.stack.push(gotoTab[p.stack.top()][prod.NTType], attrib) } @@ -441,6 +480,6 @@ func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, er panic("unknown action: " + action.String()) } } - return res, nil, tokens.GetCheckPoint().DistanceFrom(startCp) + return res, nil } ` diff --git a/internal/token/gen/golang/token.go b/internal/token/gen/golang/token.go index ed0c254e..3b7bfa67 100644 --- a/internal/token/gen/golang/token.go +++ b/internal/token/gen/golang/token.go @@ -85,6 +85,7 @@ import ( type Token struct { Type Lit []byte + IgnoredPrefix []byte Pos ForeignAstNode interface{} Foreign bool diff --git a/main.go b/main.go index 5a0b369d..7bc3f3c1 100644 --- a/main.go +++ b/main.go @@ -22,26 +22,89 @@ /* Modified by: Massimiliano Calandrelli - Changes: - changed all go files using import from - https://github.com/goccmack/gocc - to import from - https://github.com/maxcalandrelli/gocc - use original gocc (https://github.com/goccmack/gocc) to reproduce - the initial (handwritten?) parser - added file internal/ast/sdthlp.go - changed file spec/gocc.bnf - add negative char and char ranges to lexer - changed file internal/lexer/items/disjunctrangeset.go - changed file internal/ast/lexcharlit.go - changed file internal/ast/lexcharrange.go - added support for a simple form of context-sensitive parsing by - providing the ability to store/restore scanner position and invoke - a different lexer/parser pair while scanning - changed template for token generation in internal/lexer/gen/token.go - changed template for lexer generation in internal/lexer/gen/lexer.go - changed template for parser generation in internal/lexer/gen/parse.go - changed template for parser generation in internal/lexer/gen/productionstable.go + Changes summary: + + 2019-10-14 + Many changes, many new features. Streamed parsing, longest prefix parsing, nondeterministic subparsing. + + - changed all go files using import from + https://github.com/goccmack/gocc + to import from + https://github.com/maxcalandrelli/gocc + + - eliminated ambiguity between literals and labels of lexical or syntaxical productions; "error" can now + be specified as a literal, and a synonm name is "λ", while a synonim for "empty" is "ε" + + - used original gocc (https://github.com/goccmack/gocc) to reproduce the initial (handwritten?) parser + + - changed defaults for output directory + + - changed output directory structure + + - added the ability to specify negative char and char ranges to lexer, as in: + + all_but_star : . | ~'*' ; + hexdigit : '0'-'F' | ~(':'-'@') ; + + - added a user defined context to parsing for simpler cases, where an AST is not required. the context is + available as an implicit variable with name "Context" in SDT snippets. a variable named "Stream" contains + the underlying lexer stream + + - added the ability to parse only the longest possible prefix of data, returning the consumed bytes + + subTree, err, parsed := myParser.ParseLongestPrefix(myScanner) + + - added support for a simple form of context-sensitive (non deterministic) parsing by invoking a different + lexer/parser pair while scanning + + - compact form, using a gocc generated parser for longest prefix sub-parsing: + + NumericValue: + integer + | + @ "github.com/maxcalandrelli/gocc/example/calc/calc.grammar/calc" + << + $1, nil + >> + + in compact form, an import alias can be specified (without changes in stack usage)to avoid naming conflicts; + the following example is totally equivalent to the former: + + NumericValue: + integer + | + @ calculator "github.com/maxcalandrelli/gocc/example/calc/calc.grammar/calc" + << + $1, nil + >> + + - full form, like in the following example, where also the use of "Stream" is shown: + + SlashesOrKeyword: + "no-slashes" + << "no slashes", nil >> + | + somethingelse + @@ + func () (interface {}, error, []byte) { + slashes := []byte{} + for r, _, _ := Stream.ReadRune(); r == '/' || r == '\\' || r == '\u2215' || r == '\u29f5'; r, _, _ = Stream.ReadRune() { + slashes = append(slashes, string(r)...) + } + Stream.UnreadRune() + return len(string(slashes)), nil, slashes + }() + @@ + OtherProduction + << + append(append([]interface{}{},$1),$2.([]interface{})...), nil + >> + + either form of non deterministic parsing pushes two values on the stack: + - the pseudo-token built by taking as literal the longest prefix that the sub-parser rcognized + - the corresponding AST returned by the sun-parser + + */ @@ -97,7 +160,7 @@ func main() { grammar interface{} ) ast.StringGetter = func(v interface{}) string { return string(v.(*altfe.Token).Lit) } - grammar, err, _ = altfe.ParseFile(cfg.SourceFile()) + grammar, err = altfe.ParseFile(cfg.SourceFile()) if err != nil { fmt.Printf("Parse error: %s\n", err) os.Exit(1) diff --git a/spec/gocc2.ebnf b/spec/gocc2.ebnf index 6f9dd632..d8085b3e 100644 --- a/spec/gocc2.ebnf +++ b/spec/gocc2.ebnf @@ -185,7 +185,7 @@ LexTerm : << ast.NewLexCharRangeExt($0, $2,false) >> | "~" char_lit - << ast.NewLexCharLitExt($0, true) >> + << ast.NewLexCharLitExt($1, true) >> | "~" "(" char_lit "-" char_lit ")" << ast.NewLexCharRangeExt($2, $4, true) >> diff --git a/spec/test.bnf b/spec/test.bnf index ccf7a741..4f58cdcb 100644 --- a/spec/test.bnf +++ b/spec/test.bnf @@ -8,14 +8,13 @@ _lowcase : 'a'-'z' ; _id_char : _upcase | _lowcase | '_' | _digit ; _upcase : 'A'-'Z' ; _digit : '0'-'9' ; - +_all_but_star : . | ~'*' ; !space : ' ' | '\t' ; hexdigit : '0'-'F' | ~(':'-'@') ; << import( - "fmt" ) >> @@ -30,7 +29,7 @@ Test1: Test2 : Test3 | Test1; Test3 : -"not" "empty" << fmt.Printf("very well\n") >> +"not" "empty" << []interface{}{"very well"}, nil >> | T | @@ -47,44 +46,24 @@ X: | altro @@ - func () (interface {}, error, int) { - count := 0 - ret := []byte{} - for { - r, _, _ := Stream.ReadRune() - switch r { - case ' ', '\t': - ret = append(ret, string(r)...) - case '/': - ret = append(ret, string(r)...) - count++ - default: - Stream.UnreadRune() - fmt.Printf("count=%d rune=<%c> ret=<%s>\n", count, r, string(ret)) - return count, nil, len(ret) - } + func () (interface {}, error, []byte) { + slashes := []byte{} + for r, _, _ := Stream.ReadRune(); r == '/' || r == '\\' || r == '\u2215' || r == '\u29f5'; r, _, _ = Stream.ReadRune() { + slashes = append(slashes, string(r)...) } - return nil, nil, 0 + Stream.UnreadRune() + return len(string(slashes)), nil, slashes }() @@ Test2 << - func () (interface{}, error) { - fmt.Printf("$0=%#v\n$1=%#v\n", $0, $1) - return "buongiorno", nil - } () + append(append([]interface{}{},$1),$2.([]interface{})...), nil >> | - "expr" - "(" @ "github.com/maxcalandrelli/gocc/example/calc/calc.grammar/calc" - ")" Test2 << - func () (interface{}, error) { - fmt.Printf("EXPR A=%#v\nB=%#v\n", $2, $3) - return "expression", nil - } () + append(append([]interface{}{},$1),$2.([]interface{})...), nil >> ; From 7d0f0cc85177a4b0c9d1d04834f8165ba28b608f Mon Sep 17 00:00:00 2001 From: Massimiliano Calandrelli Date: Mon, 14 Oct 2019 17:09:13 +0200 Subject: [PATCH 22/33] ... --- internal/config/config.go | 2 +- .../frontend/reparsed/internal/token/token.go | 12 +++---- internal/token/gen/golang/token.go | 36 ++++++------------- internal/token/tokenmap.go | 6 ++-- main.go | 2 +- 5 files changed, 21 insertions(+), 37 deletions(-) diff --git a/internal/config/config.go b/internal/config/config.go index 0272989d..76eed2ba 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -27,7 +27,7 @@ import ( ) const ( - VERSION = "1.2.0005" + VERSION = "1.2.0009" INTERNAL_SYMBOL_EMPTY = "ε" INTERNAL_SYMBOL_ERROR = "λ" // (λάθος) diff --git a/internal/frontend/reparsed/internal/token/token.go b/internal/frontend/reparsed/internal/token/token.go index 48f6c9f7..e0d8b555 100644 --- a/internal/frontend/reparsed/internal/token/token.go +++ b/internal/frontend/reparsed/internal/token/token.go @@ -136,22 +136,22 @@ var TokMap = TokenMap{ }, litMap: map[string]Type{ + ":": 3, + ";": 4, + "|": 7, ".": 8, + "-": 10, "~": 11, "(": 12, - "empty": 25, - "|": 7, - ";": 4, - "{": 16, - ":": 3, - "-": 10, ")": 13, "[": 14, "]": 15, + "{": 16, "}": 17, "@": 22, "error": 23, "λ": 24, + "empty": 25, "ε": 26, }, } diff --git a/internal/token/gen/golang/token.go b/internal/token/gen/golang/token.go index 3b7bfa67..626521e7 100644 --- a/internal/token/gen/golang/token.go +++ b/internal/token/gen/golang/token.go @@ -33,8 +33,16 @@ func GenToken(pkg, outdir string, tokMap *token.TokenMap, subpath string, cfg co panic(err) } buf := new(bytes.Buffer) - err = tmpl.Execute(buf, TokenData{TypMap: makeTypeMap(tokMap), IdMap: makeIdMap(tokMap), LitMap: makeLitMap(tokMap), NoLexer: cfg.NoLexer()}) - // Use go/format to indent the idMap literal correctly. + data := TokenData{TypMap: make([]string, len(tokMap.TypeMap)), IdMap: make([]string, len(tokMap.TypeMap)), LitMap: []string{}, NoLexer: cfg.NoLexer()} + for i, sym := range tokMap.TypeMap { + data.IdMap[i] = fmt.Sprintf("\"%s\": %d", sym.SymbolName(), i) + data.TypMap[i] = fmt.Sprintf("\"%s\"", sym.SymbolName()) + if lit, found := tokMap.LitMap[i]; found { + data.LitMap = append(data.LitMap, fmt.Sprintf("\"%s\": %d", lit, i)) + } + } + err = tmpl.Execute(buf, data) + //err = tmpl.Execute(buf, TokenData{TypMap: makeTypeMap(tokMap), IdMap: makeIdMap(tokMap), LitMap: makeLitMap(tokMap), NoLexer: cfg.NoLexer()}) source, err := format.Source(buf.Bytes()) if err != nil { panic(fmt.Sprintf("%s in \n%s", err.Error(), buf.String())) @@ -42,30 +50,6 @@ func GenToken(pkg, outdir string, tokMap *token.TokenMap, subpath string, cfg co io.WriteFile(tokenPath, source) } -func makeIdMap(tokMap *token.TokenMap) []string { - tm := make([]string, len(tokMap.TypeMap)) - for i, sym := range tokMap.TypeMap { - tm[i] = fmt.Sprintf("\"%s\": %d", sym.SymbolName(), i) - } - return tm -} - -func makeTypeMap(tokMap *token.TokenMap) []string { - tm := make([]string, len(tokMap.TypeMap)) - for i, sym := range tokMap.TypeMap { - tm[i] = fmt.Sprintf("\"%s\"", sym.SymbolName()) - } - return tm -} - -func makeLitMap(tokMap *token.TokenMap) []string { - tm := []string{} - for lit, i := range tokMap.LitMap { - tm = append(tm, fmt.Sprintf("\"%s\": %d", lit, i)) - } - return tm -} - type TokenData struct { IdMap []string TypMap []string diff --git a/internal/token/tokenmap.go b/internal/token/tokenmap.go index 0135fcb4..eae09bee 100644 --- a/internal/token/tokenmap.go +++ b/internal/token/tokenmap.go @@ -21,14 +21,14 @@ import ( type TokenMap struct { IdMap map[string]int TypeMap []ast.SyntaxSymbol - LitMap map[string]int + LitMap map[int]string } func NewTokenMap(symbols ast.SyntaxSymbols) *TokenMap { tm := &TokenMap{ IdMap: make(map[string]int), TypeMap: make([]ast.SyntaxSymbol, len(symbols)), - LitMap: make(map[string]int), + LitMap: make(map[int]string), } for i, sym := range symbols { @@ -36,7 +36,7 @@ func NewTokenMap(symbols ast.SyntaxSymbols) *TokenMap { tm.TypeMap[i] = sym switch lit := sym.(type) { case ast.SyntaxStringLit: - tm.LitMap[lit.SymbolString()] = i + tm.LitMap[i] = lit.SymbolString() } } return tm diff --git a/main.go b/main.go index 7bc3f3c1..d30826b6 100644 --- a/main.go +++ b/main.go @@ -1,5 +1,5 @@ // -//go:generate go run stock/main.go -a -v -o internal/fe2 spec/gocc2.ebnf +//go:generate go run stock/main.go -a -v -o internal/frontend/reparsed spec/gocc2.ebnf // //Copyright 2013 Vastech SA (PTY) LTD From 2df0b2879f3fe6fb263bb6b136ce30f83775b7f5 Mon Sep 17 00:00:00 2001 From: Massimiliano Calandrelli Date: Mon, 14 Oct 2019 20:11:36 +0200 Subject: [PATCH 23/33] ... --- internal/ast/reconcile.go | 83 +++++++++++++ internal/ast/sdthlp.go | 32 +---- internal/ast/syntaxsymbols.go | 1 + .../internal/parser/productionstable.go | 109 +++++++++++------- .../parser/gen/golang/productionstable.go | 58 ++++++++-- main.go | 8 +- spec/test.bnf | 25 +++- 7 files changed, 230 insertions(+), 86 deletions(-) diff --git a/internal/ast/reconcile.go b/internal/ast/reconcile.go index d6bbf7f3..86141a90 100644 --- a/internal/ast/reconcile.go +++ b/internal/ast/reconcile.go @@ -30,3 +30,86 @@ func unquoteString(str string) (string, bool, rune) { } return str, false, 0 } + +/* +func unescapeString(str string) string { + res := "" + for s := 0; s < len(str); { + if str[s] == '\\' { + res = res + string(escapeCharVal(lit)) + s++ + } + r, size := utf8.DecodeRune(lit[1:]) + } + if size != len(lit)-2 { + panic(fmt.Sprintf("Error decoding rune. Lit: %s, rune: %d, size %d\n", lit, r, size)) + } + return r +} + +func escapeCharVal(lit []byte) (rune, int) { + var i, base, max uint32 + offset := 0 + switch lit[offset] { + case 'a': + return '\a' + case 'b': + return '\b' + case 'f': + return '\f' + case 'n': + return '\n' + case 'r': + return '\r' + case 't': + return '\t' + case 'v': + return '\v' + case '\\': + return '\\' + case '\'': + return '\'' + case '0', '1', '2', '3', '4', '5', '6', '7': + i, base, max = 3, 8, 255 + case 'x': + i, base, max = 2, 16, 255 + offset++ + case 'u': + i, base, max = 4, 16, unicode.MaxRune + offset++ + case 'U': + i, base, max = 8, 16, unicode.MaxRune + offset++ + default: + panic(fmt.Sprintf("Error decoding character literal: %s\n", lit)) + } + + var x uint32 + for ; i > 0 && offset < len(lit)-1; i-- { + ch, size := utf8.DecodeRune(lit[offset:]) + offset += size + d := uint32(digitVal(ch)) + if d >= base { + panic(fmt.Sprintf("charVal(%s): illegal character (%c) in escape sequence. size=%d, offset=%d", lit, ch, size, offset)) + } + x = x*base + d + } + if x > max || 0xD800 <= x && x < 0xE000 { + panic(fmt.Sprintf("Error decoding escape char value. Lit:%s, offset:%d, escape sequence is invalid Unicode code point\n", lit, offset)) + } + + return rune(x) +} + +func digitVal(ch rune) int { + switch { + case '0' <= ch && ch <= '9': + return int(ch) - '0' + case 'a' <= ch && ch <= 'f': + return int(ch) - 'a' + 10 + case 'A' <= ch && ch <= 'F': + return int(ch) - 'A' + 10 + } + return 16 // larger than any legal digit val +} +*/ diff --git a/internal/ast/sdthlp.go b/internal/ast/sdthlp.go index be8102f8..fc4e4ea0 100644 --- a/internal/ast/sdthlp.go +++ b/internal/ast/sdthlp.go @@ -6,34 +6,12 @@ package ast import ( "regexp" - "strings" +) + +var ( + sdtAstSubst = regexp.MustCompile("(?ms)<<(?:\\s|\\n|\\r)*(.+?)(?:\\s|\\n|\\r)*>>") ) func SDTVal(sdt string) string { - rex, err := regexp.Compile("\\$[0-9]+") - if err != nil { - panic(err) - } - idx := rex.FindAllStringIndex(sdt, -1) - res := "" - if len(idx) <= 0 { - res = sdt - } else { - for i, loc := range idx { - if loc[0] > 0 { - if i > 0 { - res += sdt[idx[i-1][1]:loc[0]] - } else { - res += sdt[0:loc[0]] - } - } - res += "X[" - res += sdt[loc[0]+1 : loc[1]] - res += "]" - } - if idx[len(idx)-1][1] < len(sdt) { - res += sdt[idx[len(idx)-1][1]:] - } - } - return strings.TrimSpace(res[2 : len(res)-2]) + return sdtAstSubst.ReplaceAllString(sdt, "$1") } diff --git a/internal/ast/syntaxsymbols.go b/internal/ast/syntaxsymbols.go index 0f92a747..c7307517 100644 --- a/internal/ast/syntaxsymbols.go +++ b/internal/ast/syntaxsymbols.go @@ -50,6 +50,7 @@ func NewSyntaxSymbolsFromToken(tok interface{}) (SyntaxSymbols, error) { return SyntaxSymbols{ErrorSymbol}, nil } sym, err := NewStringLit(tok) + fmt.Printf("LITERAL:<%q>\n", sym) return SyntaxSymbols{sym}, err } diff --git a/internal/frontend/reparsed/internal/parser/productionstable.go b/internal/frontend/reparsed/internal/parser/productionstable.go index 79ba57d5..8840a963 100644 --- a/internal/frontend/reparsed/internal/parser/productionstable.go +++ b/internal/frontend/reparsed/internal/parser/productionstable.go @@ -4,6 +4,31 @@ package parser import "github.com/maxcalandrelli/gocc/internal/ast" +import ( + "fmt" + "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/internal/token" +) + +func getString(X Attrib) string { + switch X.(type) { + case *token.Token: + return string(X.(*token.Token).Lit) + case string: + return X.(string) + } + return fmt.Sprintf("%q", X) +} + +func getUnquotedString(X Attrib) string { + ret := getString(X) + if len(ret) > 1 { + if (ret[0] == '\'' || ret[0] == '"') && ret[len(ret)-1] == ret[0] { + ret = ret[1 : len(ret)-1] + } + } + return ret +} + type ( //TODO: change type and variable names to be consistent with other tables ProdTab [numProductions]ProdTabEntry @@ -31,7 +56,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `Grammar : Π Π << ast.NewGrammar(X[0], X[1]) >>`, + String: `Grammar : Π Π << ast.NewGrammar($0, $1) >>`, Id: "Grammar", NTType: 1, Index: 1, @@ -41,7 +66,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `Grammar : Π << ast.NewGrammar(X[0], nil) >>`, + String: `Grammar : Π << ast.NewGrammar($0, nil) >>`, Id: "Grammar", NTType: 1, Index: 2, @@ -51,7 +76,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `Grammar : Π << ast.NewGrammar(nil, X[0]) >>`, + String: `Grammar : Π << ast.NewGrammar(nil, $0) >>`, Id: "Grammar", NTType: 1, Index: 3, @@ -61,7 +86,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `LexicalPart : Π << ast.NewLexPart(nil, nil, X[0]) >>`, + String: `LexicalPart : Π << ast.NewLexPart(nil, nil, $0) >>`, Id: "LexicalPart", NTType: 2, Index: 4, @@ -71,7 +96,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `LexProductions : Π << ast.NewLexProductions(X[0]) >>`, + String: `LexProductions : Π << ast.NewLexProductions($0) >>`, Id: "LexProductions", NTType: 4, Index: 5, @@ -81,7 +106,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `LexProductions : Π Π << ast.AppendLexProduction(X[0], X[1]) >>`, + String: `LexProductions : Π Π << ast.AppendLexProduction($0, $1) >>`, Id: "LexProductions", NTType: 4, Index: 6, @@ -91,7 +116,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `LexProduction : tokId Λ<:> Π Λ<;> << ast.NewLexTokDef(X[0], X[2]) >>`, + String: `LexProduction : tokId Λ<:> Π Λ<;> << ast.NewLexTokDef($0, $2) >>`, Id: "LexProduction", NTType: 5, Index: 7, @@ -101,7 +126,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `LexProduction : regDefId Λ<:> Π Λ<;> << ast.NewLexRegDef(X[0], X[2]) >>`, + String: `LexProduction : regDefId Λ<:> Π Λ<;> << ast.NewLexRegDef($0, $2) >>`, Id: "LexProduction", NTType: 5, Index: 8, @@ -111,7 +136,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `LexProduction : ignoredTokId Λ<:> Π Λ<;> << ast.NewLexIgnoredTokDef(X[0], X[2]) >>`, + String: `LexProduction : ignoredTokId Λ<:> Π Λ<;> << ast.NewLexIgnoredTokDef($0, $2) >>`, Id: "LexProduction", NTType: 5, Index: 9, @@ -121,7 +146,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `LexPattern : Π << ast.NewLexPattern(X[0]) >>`, + String: `LexPattern : Π << ast.NewLexPattern($0) >>`, Id: "LexPattern", NTType: 6, Index: 10, @@ -131,7 +156,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `LexPattern : Π Λ<|> Π << ast.AppendLexAlt(X[0], X[2]) >>`, + String: `LexPattern : Π Λ<|> Π << ast.AppendLexAlt($0, $2) >>`, Id: "LexPattern", NTType: 6, Index: 11, @@ -141,7 +166,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `LexAlt : Π << ast.NewLexAlt(X[0]) >>`, + String: `LexAlt : Π << ast.NewLexAlt($0) >>`, Id: "LexAlt", NTType: 7, Index: 12, @@ -151,7 +176,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `LexAlt : Π Π << ast.AppendLexTerm(X[0], X[1]) >>`, + String: `LexAlt : Π Π << ast.AppendLexTerm($0, $1) >>`, Id: "LexAlt", NTType: 7, Index: 13, @@ -171,7 +196,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `LexTerm : char_lit << ast.NewLexCharLitExt(X[0],false) >>`, + String: `LexTerm : char_lit << ast.NewLexCharLitExt($0,false) >>`, Id: "LexTerm", NTType: 8, Index: 15, @@ -181,7 +206,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `LexTerm : char_lit Λ<-> char_lit << ast.NewLexCharRangeExt(X[0], X[2],false) >>`, + String: `LexTerm : char_lit Λ<-> char_lit << ast.NewLexCharRangeExt($0, $2,false) >>`, Id: "LexTerm", NTType: 8, Index: 16, @@ -191,7 +216,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `LexTerm : Λ<~> char_lit << ast.NewLexCharLitExt(X[1], true) >>`, + String: `LexTerm : Λ<~> char_lit << ast.NewLexCharLitExt($1, true) >>`, Id: "LexTerm", NTType: 8, Index: 17, @@ -201,7 +226,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> << ast.NewLexCharRangeExt(X[2], X[4], true) >>`, + String: `LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)> << ast.NewLexCharRangeExt($2, $4, true) >>`, Id: "LexTerm", NTType: 8, Index: 18, @@ -211,7 +236,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `LexTerm : regDefId << ast.NewLexRegDefId(X[0]) >>`, + String: `LexTerm : regDefId << ast.NewLexRegDefId($0) >>`, Id: "LexTerm", NTType: 8, Index: 19, @@ -221,7 +246,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `LexTerm : Λ<[> Π Λ<]> << ast.NewLexOptPattern(X[1]) >>`, + String: `LexTerm : Λ<[> Π Λ<]> << ast.NewLexOptPattern($1) >>`, Id: "LexTerm", NTType: 8, Index: 20, @@ -231,7 +256,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `LexTerm : Λ<{> Π Λ<}> << ast.NewLexRepPattern(X[1]) >>`, + String: `LexTerm : Λ<{> Π Λ<}> << ast.NewLexRepPattern($1) >>`, Id: "LexTerm", NTType: 8, Index: 21, @@ -241,7 +266,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `LexTerm : Λ<(> Π Λ<)> << ast.NewLexGroupPattern(X[1]) >>`, + String: `LexTerm : Λ<(> Π Λ<)> << ast.NewLexGroupPattern($1) >>`, Id: "LexTerm", NTType: 8, Index: 22, @@ -251,7 +276,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `SyntaxPart : Π Π << ast.NewSyntaxPart(X[0], X[1]) >>`, + String: `SyntaxPart : Π Π << ast.NewSyntaxPart($0, $1) >>`, Id: "SyntaxPart", NTType: 3, Index: 23, @@ -261,7 +286,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `SyntaxPart : Π << ast.NewSyntaxPart(nil, X[0]) >>`, + String: `SyntaxPart : Π << ast.NewSyntaxPart(nil, $0) >>`, Id: "SyntaxPart", NTType: 3, Index: 24, @@ -271,7 +296,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `FileHeader : g_sdt_lit << ast.NewFileHeader(X[0]) >>`, + String: `FileHeader : g_sdt_lit << ast.NewFileHeader($0) >>`, Id: "FileHeader", NTType: 9, Index: 25, @@ -281,7 +306,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `SyntaxProdList : Π << ast.NewSyntaxProdList(X[0]) >>`, + String: `SyntaxProdList : Π << ast.NewSyntaxProdList($0) >>`, Id: "SyntaxProdList", NTType: 10, Index: 26, @@ -291,7 +316,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `SyntaxProdList : Π Π << ast.AddSyntaxProds(X[0], X[1]) >>`, + String: `SyntaxProdList : Π Π << ast.AddSyntaxProds($0, $1) >>`, Id: "SyntaxProdList", NTType: 10, Index: 27, @@ -301,7 +326,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `SyntaxProduction : prodId Λ<:> Π Λ<;> << ast.NewSyntaxProd(X[0], X[2]) >>`, + String: `SyntaxProduction : prodId Λ<:> Π Λ<;> << ast.NewSyntaxProd($0, $2) >>`, Id: "SyntaxProduction", NTType: 11, Index: 28, @@ -311,7 +336,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `Alternatives : Π << ast.NewSyntaxAlts(X[0]) >>`, + String: `Alternatives : Π << ast.NewSyntaxAlts($0) >>`, Id: "Alternatives", NTType: 12, Index: 29, @@ -321,7 +346,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `Alternatives : Π Λ<|> Π << ast.AddSyntaxAlt(X[0], X[2]) >>`, + String: `Alternatives : Π Λ<|> Π << ast.AddSyntaxAlt($0, $2) >>`, Id: "Alternatives", NTType: 12, Index: 30, @@ -331,7 +356,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `SyntaxBody : Π << ast.NewSyntaxBodyGen(X[0], nil) >>`, + String: `SyntaxBody : Π << ast.NewSyntaxBodyGen($0, nil) >>`, Id: "SyntaxBody", NTType: 13, Index: 31, @@ -341,7 +366,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `SyntaxBody : Π g_sdt_lit << ast.NewSyntaxBodyGen(X[0], X[1]) >>`, + String: `SyntaxBody : Π g_sdt_lit << ast.NewSyntaxBodyGen($0, $1) >>`, Id: "SyntaxBody", NTType: 13, Index: 32, @@ -361,7 +386,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `SyntaxBody : Π Π << ast.NewErrorBodyGen(X[1], nil) >>`, + String: `SyntaxBody : Π Π << ast.NewErrorBodyGen($1, nil) >>`, Id: "SyntaxBody", NTType: 13, Index: 34, @@ -371,7 +396,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `SyntaxBody : Π Π g_sdt_lit << ast.NewErrorBodyGen(X[1], X[2]) >>`, + String: `SyntaxBody : Π Π g_sdt_lit << ast.NewErrorBodyGen($1, $2) >>`, Id: "SyntaxBody", NTType: 13, Index: 35, @@ -381,7 +406,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `SyntaxBody : Π g_sdt_lit << ast.NewErrorBodyGen(nil, X[1]) >>`, + String: `SyntaxBody : Π g_sdt_lit << ast.NewErrorBodyGen(nil, $1) >>`, Id: "SyntaxBody", NTType: 13, Index: 36, @@ -401,7 +426,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `Symbols : Π << ast.NewSyntaxSymbols(X[0]) >>`, + String: `Symbols : Π << ast.NewSyntaxSymbols($0) >>`, Id: "Symbols", NTType: 14, Index: 38, @@ -411,7 +436,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `Symbols : Π Π << ast.AddSyntaxSymbol(X[0], X[1]) >>`, + String: `Symbols : Π Π << ast.AddSyntaxSymbol($0, $1) >>`, Id: "Symbols", NTType: 14, Index: 39, @@ -421,7 +446,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `Symbol : prodId << ast.NewSyntaxProdId(X[0]) >>`, + String: `Symbol : prodId << ast.NewSyntaxProdId($0) >>`, Id: "Symbol", NTType: 17, Index: 40, @@ -431,7 +456,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `Symbol : tokId << ast.NewTokId(X[0]) >>`, + String: `Symbol : tokId << ast.NewTokId($0) >>`, Id: "Symbol", NTType: 17, Index: 41, @@ -441,7 +466,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `Symbol : string_lit << ast.NewStringLit(X[0]) >>`, + String: `Symbol : string_lit << ast.NewStringLit($0) >>`, Id: "Symbol", NTType: 17, Index: 42, @@ -451,7 +476,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `Symbol : tokId g_ctxdep_lit << ast.NewContextDependentTokId(X[0],X[1]) >>`, + String: `Symbol : tokId g_ctxdep_lit << ast.NewContextDependentTokId($0,$1) >>`, Id: "Symbol", NTType: 17, Index: 43, @@ -461,7 +486,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `Symbol : Λ<@> tokId string_lit << ast.NewAliasedSubParser(X[1],X[2]) >>`, + String: `Symbol : Λ<@> tokId string_lit << ast.NewAliasedSubParser($1,$2) >>`, Id: "Symbol", NTType: 17, Index: 44, @@ -471,7 +496,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `Symbol : Λ<@> string_lit << ast.NewSubParser(X[1]) >>`, + String: `Symbol : Λ<@> string_lit << ast.NewSubParser($1) >>`, Id: "Symbol", NTType: 17, Index: 45, diff --git a/internal/parser/gen/golang/productionstable.go b/internal/parser/gen/golang/productionstable.go index 517a740e..55ec492b 100644 --- a/internal/parser/gen/golang/productionstable.go +++ b/internal/parser/gen/golang/productionstable.go @@ -19,6 +19,7 @@ import ( "fmt" "go/format" "path" + "regexp" "text/template" "github.com/maxcalandrelli/gocc/internal/config" @@ -31,9 +32,9 @@ import ( ) func GenProductionsTable(pkg, outDir, header string, prods ast.SyntaxProdList, symbols *symbols.Symbols, - itemsets *items.ItemSets, tokMap *token.TokenMap, subpath string, cfg config.Config) { + itemsets *items.ItemSets, tokMap *token.TokenMap, internal string, cfg config.Config) { - fname := path.Join(outDir, subpath, "parser", "productionstable.go") + fname := path.Join(outDir, internal, "parser", "productionstable.go") tmpl, err := template.New("parser productions table").Parse(prodsTabSrc[1:]) if err != nil { panic(err) @@ -42,7 +43,7 @@ func GenProductionsTable(pkg, outDir, header string, prods ast.SyntaxProdList, s pTab := getProdsTab(header, prods, symbols, itemsets, tokMap) pTab.Pkg = pkg pTab.Outdir = outDir - pTab.Subpath = subpath + pTab.InternalDir = internal pTab.Config = cfg if err := tmpl.Execute(wr, pTab); err != nil { @@ -81,7 +82,7 @@ func getProdsTab(header string, prods ast.SyntaxProdList, symbols *symbols.Symbo } switch { case len(prod.Body.SDT) > 0: - data.ProdTab[i].ReduceFunc = fmt.Sprintf("return %s", prod.Body.SDT) + data.ProdTab[i].ReduceFunc = fmt.Sprintf("return %s", replaceSDTvars(prod.Body.SDT)) case isEmpty: // Empty production with no semantic action. data.ProdTab[i].ReduceFunc = "return nil, nil" @@ -93,13 +94,28 @@ func getProdsTab(header string, prods ast.SyntaxProdList, symbols *symbols.Symbo return data } +var ( + sdtReplacerBase = regexp.MustCompile("\\$([0-9]+)") + sdtReplacerGetStr = regexp.MustCompile("\\$s([0-9]+)") + sdtReplacerGetUnq = regexp.MustCompile("\\$u([0-9]+)") +) + +func replaceSDTvars(sdt string) string { + ret := sdt + ret = sdtReplacerBase.ReplaceAllString(ret, fmt.Sprintf("X[${1}]")) + ret = sdtReplacerGetStr.ReplaceAllString(ret, fmt.Sprintf("getString(X[${1}])")) + ret = sdtReplacerGetUnq.ReplaceAllString(ret, fmt.Sprintf("getUnquotedString(X[${1}])")) + //fmt.Printf("SDT:%s\n", ret) + return ret +} + type prodsTabData struct { - Header string - ProdTab []prodTabEntry - Pkg string - Outdir string - Subpath string - Config config.Config + Header string + ProdTab []prodTabEntry + Pkg string + Outdir string + InternalDir string + Config config.Config } type prodTabEntry struct { @@ -119,6 +135,28 @@ package parser {{.Header}} +import ( + "fmt" + "{{.Config.Package}}/{{.InternalDir}}/token" +) + +func getString(X Attrib) string { + switch X.(type) { + case *token.Token: return string(X.(*token.Token).Lit) + case string: return X.(string) + } + return fmt.Sprintf("%q", X) +} + +func getUnquotedString(X Attrib) string { + ret := getString(X) + if len(ret)>1 { + if (ret[0] == '\'' || ret[0] == '"') && ret[len(ret)-1]==ret[0] { + ret = ret[1:len(ret)-1] + } + } + return ret +} type ( //TODO: change type and variable names to be consistent with other tables diff --git a/main.go b/main.go index d30826b6..a3305eb5 100644 --- a/main.go +++ b/main.go @@ -50,6 +50,13 @@ available as an implicit variable with name "Context" in SDT snippets. a variable named "Stream" contains the underlying lexer stream + - added shorthand substitutions for SDT placeholders: + - $s converts $ to string directly if it is a token in the target grammar; if it is some other object + (i.e. an AST branch returned by a reduce operation), it is converted to a string with a .(string) conversion + and, in case of failure, with a "%q" format string + - $u does the same; additionally, if the resulting string is enclosed in single o double quotes, it is + unwrapped an the quotes are discarded + - added the ability to parse only the longest possible prefix of data, returning the consumed bytes subTree, err, parsed := myParser.ParseLongestPrefix(myScanner) @@ -181,7 +188,6 @@ func main() { gSymbols.Add(g.LexPart.TokenIds()...) g.LexPart.UpdateStringLitTokens(gSymbols.ListStringLitSymbols()) lexSets := lexItems.GetItemSets(g.LexPart) - if cfg.Verbose() { io.WriteFileString(path.Join(outdir_log, "lexer_sets.txt"), lexSets.String()) } diff --git a/spec/test.bnf b/spec/test.bnf index 4f58cdcb..ca932ff1 100644 --- a/spec/test.bnf +++ b/spec/test.bnf @@ -12,9 +12,12 @@ _all_but_star : . | ~'*' ; !space : ' ' | '\t' ; hexdigit : '0'-'F' | ~(':'-'@') ; +qhexdigit : '"' ('0'-'F' | ~(':'-'@')) '"' ; +//quote: '"' ; << import( + "fmt" ) >> @@ -32,18 +35,19 @@ Test3 : "not" "empty" << []interface{}{"very well"}, nil >> | T -| -hexdigit ; T : "a" | "X" | ProdX | "λ1" | X; ProdX : "empty" | "ε" | "λ" | empty | ε ; -X: - "!" - | "hexdigit" +Quoted : + qhexdigit | + "\"" hexdigit "\"" +; + +X: altro @@ func () (interface {}, error, []byte) { @@ -63,7 +67,16 @@ X: @ "github.com/maxcalandrelli/gocc/example/calc/calc.grammar/calc" Test2 << - append(append([]interface{}{},$1),$2.([]interface{})...), nil + func () interface{} { + fmt.Printf("computed: %s=%d\n", $s0, $1) + return append(append([]interface{}{},$1),$2.([]interface{})...) + }() , nil + >> + | + Quoted + Test2 + << + append([]interface{}{fmt.Sprintf("string: %s", $u0)},$1), nil >> ; From 8b48cf2959ee5788e1f4d8f270a92f1049ddbee1 Mon Sep 17 00:00:00 2001 From: Massimiliano Calandrelli Date: Tue, 15 Oct 2019 18:14:38 +0200 Subject: [PATCH 24/33] ... --- spec/test.bnf => example/test.ebnf | 1 - example/test2.ebnf | 6 + example/test3.ebnf | 6 + internal/ast/reconcile.go | 94 ---------- internal/ast/syntaxsubparser.go | 5 +- internal/base/gen/golang/base.go | 175 +++++++++++++++++- internal/config/config.go | 18 +- internal/frontend/reparsed/iface/gocc2.go | 13 ++ .../internal/lexer/transitiontable.go | 123 ++++++++---- .../internal/parser/productionstable.go | 6 +- .../reparsed/main/{main.go => gocc2.go} | 0 internal/frontend/reparsed/util.go | 139 ++++++++++++++ internal/lexer/gen/golang/transtab.go | 2 +- internal/lexer/items/itemset.go | 4 +- internal/lexer/items/itemsets.go | 20 +- internal/util/gen/gen.go | 6 +- internal/util/gen/golang/litconv.go | 4 +- internal/util/gen/golang/rune.go | 4 +- internal/util/rune.go | 100 ++++++++++ main.go | 3 + spec/gocc2.ebnf | 7 +- 21 files changed, 576 insertions(+), 160 deletions(-) rename spec/test.bnf => example/test.ebnf (99%) create mode 100644 example/test2.ebnf create mode 100644 example/test3.ebnf rename internal/frontend/reparsed/main/{main.go => gocc2.go} (100%) create mode 100644 internal/frontend/reparsed/util.go diff --git a/spec/test.bnf b/example/test.ebnf similarity index 99% rename from spec/test.bnf rename to example/test.ebnf index ca932ff1..ca705e1d 100644 --- a/spec/test.bnf +++ b/example/test.ebnf @@ -17,7 +17,6 @@ qhexdigit : '"' ('0'-'F' | ~(':'-'@')) '"' ; << import( - "fmt" ) >> diff --git a/example/test2.ebnf b/example/test2.ebnf new file mode 100644 index 00000000..cd77c144 --- /dev/null +++ b/example/test2.ebnf @@ -0,0 +1,6 @@ +_blockComment : '/' '*' { . } '*' '/' ; +g_sdt_lit : '<' '<' . { . } '>' '>' ; +t : 'a' . 'b'; + + +Grammar : blockComment | g_sdt_lit ; diff --git a/example/test3.ebnf b/example/test3.ebnf new file mode 100644 index 00000000..a7b969db --- /dev/null +++ b/example/test3.ebnf @@ -0,0 +1,6 @@ +_blockComment : '/' '*' { . } '*' '/' ; +_g_sdt_lit : '<' '<' . { . } '.' '>' ; + +g_sdt_lit: _g_sdt_lit ; + +Grammar : blockComment | g_sdt_lit ; diff --git a/internal/ast/reconcile.go b/internal/ast/reconcile.go index 86141a90..1f511b08 100644 --- a/internal/ast/reconcile.go +++ b/internal/ast/reconcile.go @@ -19,97 +19,3 @@ func getString(v interface{}) string { } return StringGetter(v) } - -func unquoteString(str string) (string, bool, rune) { - if len(str) > 1 { - r := str[0] - if r == '"' || r == '`' || r == '\'' { - str = str[1 : len(str)-1] - } - return str, true, rune(r) - } - return str, false, 0 -} - -/* -func unescapeString(str string) string { - res := "" - for s := 0; s < len(str); { - if str[s] == '\\' { - res = res + string(escapeCharVal(lit)) - s++ - } - r, size := utf8.DecodeRune(lit[1:]) - } - if size != len(lit)-2 { - panic(fmt.Sprintf("Error decoding rune. Lit: %s, rune: %d, size %d\n", lit, r, size)) - } - return r -} - -func escapeCharVal(lit []byte) (rune, int) { - var i, base, max uint32 - offset := 0 - switch lit[offset] { - case 'a': - return '\a' - case 'b': - return '\b' - case 'f': - return '\f' - case 'n': - return '\n' - case 'r': - return '\r' - case 't': - return '\t' - case 'v': - return '\v' - case '\\': - return '\\' - case '\'': - return '\'' - case '0', '1', '2', '3', '4', '5', '6', '7': - i, base, max = 3, 8, 255 - case 'x': - i, base, max = 2, 16, 255 - offset++ - case 'u': - i, base, max = 4, 16, unicode.MaxRune - offset++ - case 'U': - i, base, max = 8, 16, unicode.MaxRune - offset++ - default: - panic(fmt.Sprintf("Error decoding character literal: %s\n", lit)) - } - - var x uint32 - for ; i > 0 && offset < len(lit)-1; i-- { - ch, size := utf8.DecodeRune(lit[offset:]) - offset += size - d := uint32(digitVal(ch)) - if d >= base { - panic(fmt.Sprintf("charVal(%s): illegal character (%c) in escape sequence. size=%d, offset=%d", lit, ch, size, offset)) - } - x = x*base + d - } - if x > max || 0xD800 <= x && x < 0xE000 { - panic(fmt.Sprintf("Error decoding escape char value. Lit:%s, offset:%d, escape sequence is invalid Unicode code point\n", lit, offset)) - } - - return rune(x) -} - -func digitVal(ch rune) int { - switch { - case '0' <= ch && ch <= '9': - return int(ch) - '0' - case 'a' <= ch && ch <= 'f': - return int(ch) - 'a' + 10 - case 'A' <= ch && ch <= 'F': - return int(ch) - 'A' + 10 - } - return 16 // larger than any legal digit val -} -*/ diff --git a/internal/ast/syntaxsubparser.go b/internal/ast/syntaxsubparser.go index 2b1a32b1..0c44907a 100644 --- a/internal/ast/syntaxsubparser.go +++ b/internal/ast/syntaxsubparser.go @@ -19,6 +19,7 @@ import ( "path" "github.com/maxcalandrelli/gocc/internal/config" + "github.com/maxcalandrelli/gocc/internal/util" ) type SyntaxSubParser struct { @@ -37,11 +38,11 @@ func NewSubParser(_import interface{}) (SyntaxSubParser, error) { } func newSubParser(alias, imp string) (SyntaxSubParser, error) { - imp, _, _ = unquoteString(imp) + imp, _, _ = util.EscapedString(imp).Unquote() if alias == "" { alias = path.Base(imp) } else { - alias, _, _ = unquoteString(alias) + alias, _, _ = util.EscapedString(alias).Unquote() } return SyntaxSubParser{ fmt.Sprintf("%s_%d", alias, tokenIdCount), diff --git a/internal/base/gen/golang/base.go b/internal/base/gen/golang/base.go index 0c884506..0dc0a4e8 100644 --- a/internal/base/gen/golang/base.go +++ b/internal/base/gen/golang/base.go @@ -51,6 +51,7 @@ func Gen(pkg, outdir, internal, iface string, cfg config.Config, hasSyntax bool) genMain(d) } genBase(d) + genUtil(d) genIface(d) } @@ -69,8 +70,23 @@ func genBase(d data) { io.WriteFile(basePath, source) } +func genUtil(d data) { + basePath := path.Join(d.Outdir, "util.go") + tmpl, err := template.New(d.MyName).Parse(stringUtilSrc[1:]) + if err != nil { + panic(err) + } + buf := new(bytes.Buffer) + err = tmpl.Execute(buf, d) + source, err := format.Source(buf.Bytes()) + if err != nil { + panic(err) + } + io.WriteFile(basePath, source) +} + func genMain(d data) { - basePath := path.Join(d.Outdir, "main", "main.go") + basePath := path.Join(d.Outdir, "main", d.MyName+".go") tmpl, err := template.New(d.MyName).Parse(mainSrc[1:]) if err != nil { panic(err) @@ -350,6 +366,7 @@ import ( {{- if .HasSyntax}} "{{.Pkg}}/{{.InternalSubdir}}/errors" {{- end}} + "{{.Pkg}}/{{.InternalSubdir}}/io/stream" ) type ( @@ -384,6 +401,7 @@ type ( io.RuneScanner io.Seeker } + ) @@ -396,5 +414,160 @@ func GetTokenMap() TokenMap { return token.TokMap } +func NewWindowReaderFromBytes(src []byte) stream.WindowReader { + return stream.NewWindowReaderFromBytes(src) +} + +func NewWindowReader(rdr io.Reader) stream.WindowReader { + return stream.NewWindowReader(rdr) +} + +func NewLimitedWindowReader(rdr io.Reader, sizeMin, sizeMax int) stream.WindowReader { + return stream.NewLimitedWindowReader(rdr, sizeMin, sizeMax) +} + + +` + +const stringUtilSrc string = ` +// Code generated by gocc; DO NOT EDIT. + +package {{.MyName}} + +import ( + "fmt" + "unicode" + "unicode/utf8" +) + +func RuneToString(r rune) string { + if r >= 0x20 && r < 0x7f { + return fmt.Sprintf("'%c'", r) + } + switch r { + case 0x07: + return "'\\a'" + case 0x08: + return "'\\b'" + case 0x0C: + return "'\\f'" + case 0x0A: + return "'\\n'" + case 0x0D: + return "'\\r'" + case 0x09: + return "'\\t'" + case 0x0b: + return "'\\v'" + case 0x5c: + return "'\\\\\\'" + case 0x27: + return "'\\''" + case 0x22: + return "'\\\"'" + } + if r < 0x10000 { + return fmt.Sprintf("\\u%04x", r) + } + return fmt.Sprintf("\\U%08x", r) +} + +type EscapedString string + +func (str EscapedString) Unquote() (unquoted string, wasQuoted bool, quoteType rune) { + if len(str) > 1 { + r := str[0] + if (r == '"' || r == '\x60' || r == '\'') && r == str[len(str)-1] { + str = str[1 : len(str)-1] + } + return string(str), true, rune(r) + } + return string(str), false, 0 +} + +func (str EscapedString) Unescape() string { + var ( + res string + r rune + size int + ) + for s := 0; s < len(str); s += size { + if str[s] == '\\' { + r, size = str[s+1:].EscapedFirstCharValue() + size++ + } else { + r, size = utf8.DecodeRuneInString(string(str)[s:]) + } + res += string(r) + } + return res +} + +func (str EscapedString) EscapedFirstCharValue() (rune, int) { + var i, base, max uint32 + offset := 0 + switch str[offset] { + case 'a': + return '\a', 1 + case 'b': + return '\b', 1 + case 'f': + return '\f', 1 + case 'n': + return '\n', 1 + case 'r': + return '\r', 1 + case 't': + return '\t', 1 + case 'v': + return '\v', 1 + case '\\': + return '\\', 1 + case '\'': + return '\'', 1 + case '0', '1', '2', '3', '4', '5', '6', '7': + i, base, max = 3, 8, 255 + case 'x': + i, base, max = 2, 16, 255 + offset++ + case 'u': + i, base, max = 4, 16, unicode.MaxRune + offset++ + case 'U': + i, base, max = 8, 32, unicode.MaxRune + offset++ + default: + panic(fmt.Sprintf("Error decoding character literal: %s\n", str)) + } + + var x uint32 + for ; i > 0 && offset < len(str)-1; i-- { + ch, size := utf8.DecodeRuneInString(string(str)[offset:]) + offset += size + d := uint32(EscapedString(ch).HexDigitValue()) + if d >= base { + panic(fmt.Sprintf("charVal(%s): illegal character (%c) in escape sequence. size=%d, offset=%d", str, str[offset], size, offset)) + } + x = x*base + d + } + if x > max || 0xD800 <= x && x < 0xE000 { + panic(fmt.Sprintf("Error decoding escape char value. Lit:%s, offset:%d, escape sequence is invalid Unicode code point\n", str, offset)) + } + + return rune(x), offset +} + +func (str EscapedString) HexDigitValue() int { + ch := str[0] + switch { + case '0' <= ch && ch <= '9': + return int(ch) - '0' + case 'a' <= ch && ch <= 'f': + return int(ch) - 'a' + 10 + case 'A' <= ch && ch <= 'F': + return int(ch) - 'A' + 10 + } + return 16 // larger than any legal digit val +} ` diff --git a/internal/config/config.go b/internal/config/config.go index 76eed2ba..2d8b6080 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -27,7 +27,7 @@ import ( ) const ( - VERSION = "1.2.0009" + VERSION = "1.3.0001" INTERNAL_SYMBOL_EMPTY = "ε" INTERNAL_SYMBOL_ERROR = "λ" // (λάθος) @@ -195,7 +195,7 @@ func (this *ConfigRecord) getFlags() error { this.help = flag.Bool("h", false, "help") this.noLexer = flag.Bool("no_lexer", false, "do not generate a lexer") flag.StringVar(&this.outDir, "o", path.Join(this.workingDir, "@f.grammar", "@f"), "output directory format (@f='name' if input file is 'name.bnf')") - flag.StringVar(&this.pkg, "p", defaultPackage(this.outDir), "package") + flag.StringVar(&this.pkg, "p", "", "package, empty defaults to "+defaultPackage(this.outDir)) flag.StringVar(&this.internal, "internal", "internal", "internal subdir name") this.allowUnreachable = flag.Bool("u", false, "allow unreachable productions") this.verbose = flag.Bool("v", false, "verbose") @@ -210,12 +210,19 @@ func (this *ConfigRecord) getFlags() error { this.srcFile = flag.Arg(0) this.outDir = getOutDir(this.outDir, this.workingDir, this.srcFile) - if this.outDir != this.workingDir { + if this.pkg == "" { this.pkg = defaultPackage(this.outDir) } + this.pkg = actualize(this.pkg, this.srcFile) return nil } +func actualize(pattern, src string) string { + _, fname := path.Split(src) + fname = fname[:len(fname)-len(path.Ext(fname))] + return regexp.MustCompile("@f").ReplaceAllString(pattern, fname) +} + func getOutDir(outDirSpec, wd, src string) string { pattern := func() string { if strings.HasPrefix(outDirSpec, wd) { @@ -226,10 +233,7 @@ func getOutDir(outDirSpec, wd, src string) string { } return path.Join(wd, outDirSpec) }() - _, fname := path.Split(src) - fname = fname[:len(fname)-len(path.Ext(fname))] - res := regexp.MustCompile("@f").ReplaceAllString(pattern, fname) - return res + return actualize(pattern, src) } func defaultPackage(wd string) string { diff --git a/internal/frontend/reparsed/iface/gocc2.go b/internal/frontend/reparsed/iface/gocc2.go index 0c599e5a..c1dc98f3 100644 --- a/internal/frontend/reparsed/iface/gocc2.go +++ b/internal/frontend/reparsed/iface/gocc2.go @@ -4,6 +4,7 @@ package iface import ( "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/internal/errors" + "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/internal/io/stream" "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/internal/token" "io" ) @@ -48,3 +49,15 @@ const ( func GetTokenMap() TokenMap { return token.TokMap } + +func NewWindowReaderFromBytes(src []byte) stream.WindowReader { + return stream.NewWindowReaderFromBytes(src) +} + +func NewWindowReader(rdr io.Reader) stream.WindowReader { + return stream.NewWindowReader(rdr) +} + +func NewLimitedWindowReader(rdr io.Reader, sizeMin, sizeMax int) stream.WindowReader { + return stream.NewLimitedWindowReader(rdr, sizeMin, sizeMax) +} diff --git a/internal/frontend/reparsed/internal/lexer/transitiontable.go b/internal/frontend/reparsed/internal/lexer/transitiontable.go index 4a03759a..d3a6dd33 100644 --- a/internal/frontend/reparsed/internal/lexer/transitiontable.go +++ b/internal/frontend/reparsed/internal/lexer/transitiontable.go @@ -344,8 +344,9 @@ var TransTab = TransitionTable{ return 56 case r == 120: // ['x','x'] return 60 + default: + return 30 } - return NoState }, // S30 func(r rune) int { @@ -389,8 +390,9 @@ var TransTab = TransitionTable{ return 61 case r == 120: // ['x','x'] return 65 + default: + return 32 } - return NoState }, // S32 func(r rune) int { @@ -714,8 +716,9 @@ var TransTab = TransitionTable{ switch { case 48 <= r && r <= 55: // ['0','7'] return 73 + default: + return 30 } - return NoState }, // S58 func(r rune) int { @@ -726,8 +729,9 @@ var TransTab = TransitionTable{ return 74 case 97 <= r && r <= 102: // ['a','f'] return 74 + default: + return 30 } - return NoState }, // S59 func(r rune) int { @@ -738,8 +742,9 @@ var TransTab = TransitionTable{ return 75 case 97 <= r && r <= 102: // ['a','f'] return 75 + default: + return 30 } - return NoState }, // S60 func(r rune) int { @@ -750,24 +755,27 @@ var TransTab = TransitionTable{ return 76 case 97 <= r && r <= 102: // ['a','f'] return 76 + default: + return 30 } - return NoState }, // S61 func(r rune) int { switch { case r == 39: // [''','''] return 66 + default: + return 32 } - return NoState }, // S62 func(r rune) int { switch { case 48 <= r && r <= 55: // ['0','7'] return 77 + default: + return 32 } - return NoState }, // S63 func(r rune) int { @@ -778,8 +786,9 @@ var TransTab = TransitionTable{ return 78 case 97 <= r && r <= 102: // ['a','f'] return 78 + default: + return 32 } - return NoState }, // S64 func(r rune) int { @@ -790,8 +799,9 @@ var TransTab = TransitionTable{ return 79 case 97 <= r && r <= 102: // ['a','f'] return 79 + default: + return 32 } - return NoState }, // S65 func(r rune) int { @@ -802,8 +812,9 @@ var TransTab = TransitionTable{ return 80 case 97 <= r && r <= 102: // ['a','f'] return 80 + default: + return 32 } - return NoState }, // S66 func(r rune) int { @@ -887,8 +898,9 @@ var TransTab = TransitionTable{ switch { case 48 <= r && r <= 55: // ['0','7'] return 86 + default: + return 30 } - return NoState }, // S74 func(r rune) int { @@ -899,8 +911,9 @@ var TransTab = TransitionTable{ return 87 case 97 <= r && r <= 102: // ['a','f'] return 87 + default: + return 30 } - return NoState }, // S75 func(r rune) int { @@ -911,8 +924,9 @@ var TransTab = TransitionTable{ return 88 case 97 <= r && r <= 102: // ['a','f'] return 88 + default: + return 30 } - return NoState }, // S76 func(r rune) int { @@ -923,16 +937,18 @@ var TransTab = TransitionTable{ return 89 case 97 <= r && r <= 102: // ['a','f'] return 89 + default: + return 30 } - return NoState }, // S77 func(r rune) int { switch { case 48 <= r && r <= 55: // ['0','7'] return 90 + default: + return 32 } - return NoState }, // S78 func(r rune) int { @@ -943,8 +959,9 @@ var TransTab = TransitionTable{ return 91 case 97 <= r && r <= 102: // ['a','f'] return 91 + default: + return 32 } - return NoState }, // S79 func(r rune) int { @@ -955,8 +972,9 @@ var TransTab = TransitionTable{ return 92 case 97 <= r && r <= 102: // ['a','f'] return 92 + default: + return 32 } - return NoState }, // S80 func(r rune) int { @@ -967,8 +985,9 @@ var TransTab = TransitionTable{ return 93 case 97 <= r && r <= 102: // ['a','f'] return 93 + default: + return 32 } - return NoState }, // S81 func(r rune) int { @@ -981,16 +1000,18 @@ var TransTab = TransitionTable{ switch { case r == 62: // ['>','>'] return 94 + default: + return 69 } - return NoState }, // S83 func(r rune) int { switch { case r == 64: // ['@','@'] return 95 + default: + return 70 } - return NoState }, // S84 func(r rune) int { @@ -1048,8 +1069,9 @@ var TransTab = TransitionTable{ return 98 case 97 <= r && r <= 102: // ['a','f'] return 98 + default: + return 30 } - return NoState }, // S88 func(r rune) int { @@ -1060,8 +1082,9 @@ var TransTab = TransitionTable{ return 99 case 97 <= r && r <= 102: // ['a','f'] return 99 + default: + return 30 } - return NoState }, // S89 func(r rune) int { @@ -1079,8 +1102,9 @@ var TransTab = TransitionTable{ switch { case r == 39: // [''','''] return 66 + default: + return 32 } - return NoState }, // S91 func(r rune) int { @@ -1091,8 +1115,9 @@ var TransTab = TransitionTable{ return 100 case 97 <= r && r <= 102: // ['a','f'] return 100 + default: + return 32 } - return NoState }, // S92 func(r rune) int { @@ -1103,16 +1128,18 @@ var TransTab = TransitionTable{ return 101 case 97 <= r && r <= 102: // ['a','f'] return 101 + default: + return 32 } - return NoState }, // S93 func(r rune) int { switch { case r == 39: // [''','''] return 66 + default: + return 32 } - return NoState }, // S94 func(r rune) int { @@ -1163,8 +1190,9 @@ var TransTab = TransitionTable{ return 102 case 97 <= r && r <= 102: // ['a','f'] return 102 + default: + return 30 } - return NoState }, // S99 func(r rune) int { @@ -1175,8 +1203,9 @@ var TransTab = TransitionTable{ return 103 case 97 <= r && r <= 102: // ['a','f'] return 103 + default: + return 30 } - return NoState }, // S100 func(r rune) int { @@ -1187,8 +1216,9 @@ var TransTab = TransitionTable{ return 104 case 97 <= r && r <= 102: // ['a','f'] return 104 + default: + return 32 } - return NoState }, // S101 func(r rune) int { @@ -1199,8 +1229,9 @@ var TransTab = TransitionTable{ return 105 case 97 <= r && r <= 102: // ['a','f'] return 105 + default: + return 32 } - return NoState }, // S102 func(r rune) int { @@ -1211,8 +1242,9 @@ var TransTab = TransitionTable{ return 106 case 97 <= r && r <= 102: // ['a','f'] return 106 + default: + return 30 } - return NoState }, // S103 func(r rune) int { @@ -1234,16 +1266,18 @@ var TransTab = TransitionTable{ return 107 case 97 <= r && r <= 102: // ['a','f'] return 107 + default: + return 32 } - return NoState }, // S105 func(r rune) int { switch { case r == 39: // [''','''] return 66 + default: + return 32 } - return NoState }, // S106 func(r rune) int { @@ -1254,8 +1288,9 @@ var TransTab = TransitionTable{ return 108 case 97 <= r && r <= 102: // ['a','f'] return 108 + default: + return 30 } - return NoState }, // S107 func(r rune) int { @@ -1266,8 +1301,9 @@ var TransTab = TransitionTable{ return 109 case 97 <= r && r <= 102: // ['a','f'] return 109 + default: + return 32 } - return NoState }, // S108 func(r rune) int { @@ -1278,8 +1314,9 @@ var TransTab = TransitionTable{ return 110 case 97 <= r && r <= 102: // ['a','f'] return 110 + default: + return 30 } - return NoState }, // S109 func(r rune) int { @@ -1290,8 +1327,9 @@ var TransTab = TransitionTable{ return 111 case 97 <= r && r <= 102: // ['a','f'] return 111 + default: + return 32 } - return NoState }, // S110 func(r rune) int { @@ -1302,8 +1340,9 @@ var TransTab = TransitionTable{ return 112 case 97 <= r && r <= 102: // ['a','f'] return 112 + default: + return 30 } - return NoState }, // S111 func(r rune) int { @@ -1314,8 +1353,9 @@ var TransTab = TransitionTable{ return 113 case 97 <= r && r <= 102: // ['a','f'] return 113 + default: + return 32 } - return NoState }, // S112 func(r rune) int { @@ -1333,7 +1373,8 @@ var TransTab = TransitionTable{ switch { case r == 39: // [''','''] return 66 + default: + return 32 } - return NoState }, } diff --git a/internal/frontend/reparsed/internal/parser/productionstable.go b/internal/frontend/reparsed/internal/parser/productionstable.go index 8840a963..175fde61 100644 --- a/internal/frontend/reparsed/internal/parser/productionstable.go +++ b/internal/frontend/reparsed/internal/parser/productionstable.go @@ -2,7 +2,11 @@ package parser -import "github.com/maxcalandrelli/gocc/internal/ast" +import ( + "github.com/maxcalandrelli/gocc/internal/ast" +) + +// now a > b should work... import ( "fmt" diff --git a/internal/frontend/reparsed/main/main.go b/internal/frontend/reparsed/main/gocc2.go similarity index 100% rename from internal/frontend/reparsed/main/main.go rename to internal/frontend/reparsed/main/gocc2.go diff --git a/internal/frontend/reparsed/util.go b/internal/frontend/reparsed/util.go new file mode 100644 index 00000000..6c5e0529 --- /dev/null +++ b/internal/frontend/reparsed/util.go @@ -0,0 +1,139 @@ +// Code generated by gocc; DO NOT EDIT. + +package gocc2 + +import ( + "fmt" + "unicode" + "unicode/utf8" +) + +func RuneToString(r rune) string { + if r >= 0x20 && r < 0x7f { + return fmt.Sprintf("'%c'", r) + } + switch r { + case 0x07: + return "'\\a'" + case 0x08: + return "'\\b'" + case 0x0C: + return "'\\f'" + case 0x0A: + return "'\\n'" + case 0x0D: + return "'\\r'" + case 0x09: + return "'\\t'" + case 0x0b: + return "'\\v'" + case 0x5c: + return "'\\\\\\'" + case 0x27: + return "'\\''" + case 0x22: + return "'\\\"'" + } + if r < 0x10000 { + return fmt.Sprintf("\\u%04x", r) + } + return fmt.Sprintf("\\U%08x", r) +} + +type EscapedString string + +func (str EscapedString) Unquote() (unquoted string, wasQuoted bool, quoteType rune) { + if len(str) > 1 { + r := str[0] + if (r == '"' || r == '\x60' || r == '\'') && r == str[len(str)-1] { + str = str[1 : len(str)-1] + } + return string(str), true, rune(r) + } + return string(str), false, 0 +} + +func (str EscapedString) Unescape() string { + var ( + res string + r rune + size int + ) + for s := 0; s < len(str); s += size { + if str[s] == '\\' { + r, size = str[s+1:].EscapedFirstCharValue() + size++ + } else { + r, size = utf8.DecodeRuneInString(string(str)[s:]) + } + res += string(r) + } + return res +} + +func (str EscapedString) EscapedFirstCharValue() (rune, int) { + var i, base, max uint32 + offset := 0 + switch str[offset] { + case 'a': + return '\a', 1 + case 'b': + return '\b', 1 + case 'f': + return '\f', 1 + case 'n': + return '\n', 1 + case 'r': + return '\r', 1 + case 't': + return '\t', 1 + case 'v': + return '\v', 1 + case '\\': + return '\\', 1 + case '\'': + return '\'', 1 + case '0', '1', '2', '3', '4', '5', '6', '7': + i, base, max = 3, 8, 255 + case 'x': + i, base, max = 2, 16, 255 + offset++ + case 'u': + i, base, max = 4, 16, unicode.MaxRune + offset++ + case 'U': + i, base, max = 8, 32, unicode.MaxRune + offset++ + default: + panic(fmt.Sprintf("Error decoding character literal: %s\n", str)) + } + + var x uint32 + for ; i > 0 && offset < len(str)-1; i-- { + ch, size := utf8.DecodeRuneInString(string(str)[offset:]) + offset += size + d := uint32(EscapedString(ch).HexDigitValue()) + if d >= base { + panic(fmt.Sprintf("charVal(%s): illegal character (%c) in escape sequence. size=%d, offset=%d", str, str[offset], size, offset)) + } + x = x*base + d + } + if x > max || 0xD800 <= x && x < 0xE000 { + panic(fmt.Sprintf("Error decoding escape char value. Lit:%s, offset:%d, escape sequence is invalid Unicode code point\n", str, offset)) + } + + return rune(x), offset +} + +func (str EscapedString) HexDigitValue() int { + ch := str[0] + switch { + case '0' <= ch && ch <= '9': + return int(ch) - '0' + case 'a' <= ch && ch <= 'f': + return int(ch) - 'a' + 10 + case 'A' <= ch && ch <= 'F': + return int(ch) - 'A' + 10 + } + return 16 // larger than any legal digit val +} diff --git a/internal/lexer/gen/golang/transtab.go b/internal/lexer/gen/golang/transtab.go index e7db24ef..bc8d02d7 100644 --- a/internal/lexer/gen/golang/transtab.go +++ b/internal/lexer/gen/golang/transtab.go @@ -54,7 +54,7 @@ type transitionTableData struct { func getTransitionTableData(itemsets *items.ItemSets) []transitionTableRowData { data := make([]transitionTableRowData, itemsets.Size()) for setNo, set := range itemsets.List() { - if set.SymbolClasses.MatchAny { + if set.SymbolClasses.MatchAny || set.DotTransition >= 0 { data[setNo].MatchAny = true data[setNo].MatchAnyState = set.DotTransition } else { diff --git a/internal/lexer/items/itemset.go b/internal/lexer/items/itemset.go index 551a2819..d448b88d 100644 --- a/internal/lexer/items/itemset.go +++ b/internal/lexer/items/itemset.go @@ -118,8 +118,6 @@ func (this *ItemSet) getSymbolClasses() { addNow = !chars.Negate case *ast.LexCharRange: addNow = !chars.Negate - default: - addNow = true } if addNow { this.SymbolClasses.AddLexTNode(item.ExpectedSymbol()) @@ -128,7 +126,7 @@ func (this *ItemSet) getSymbolClasses() { } for _, item := range this.Items { if !item.Reduce() { - addNow := false + addNow := true switch chars := item.ExpectedSymbol().(type) { case *ast.LexCharLit: addNow = chars.Negate diff --git a/internal/lexer/items/itemsets.go b/internal/lexer/items/itemsets.go index 7c293cef..9ed1e317 100644 --- a/internal/lexer/items/itemsets.go +++ b/internal/lexer/items/itemsets.go @@ -56,7 +56,6 @@ func (this *ItemSets) Closure() *ItemSets { if items := this.sets[i].Next(rng); len(items) != 0 { setNo, nextState := this.Add(items), this.sets[i].Transitions[symI] if nextState != -1 && nextState != setNo { - panic(fmt.Sprintf("Next set conflict in (S%d, %s) -> %d. Existing setNo: %d", i, rng, setNo, nextState)) } this.sets[i].Transitions[symI] = setNo } @@ -75,9 +74,28 @@ func (this *ItemSets) Closure() *ItemSets { this.sets[i].DotTransition = setNo } } + for i := 0; i < len(this.sets); i++ { + this.propagateDots(i) + } return this } +/* + this will allow to parse a '>' in a SDT construct, just to name a case... +*/ + +func (this *ItemSets) propagateDots(start int) { + //fmt.Printf(" --- start=%d #transitions=%d\n", start, len(this.sets[start].Transitions)) + if this.sets[start].DotTransition > -1 { + for _, tr := range this.sets[start].Transitions { + //fmt.Printf(" --- start=%d t=%d t.dot=%d\n", start, tr, this.sets[tr].DotTransition) + if tr > start && this.sets[tr].DotTransition < 0 && len(this.sets[tr].Transitions) > 0 { + this.sets[tr].DotTransition = this.sets[start].DotTransition + } + } + } +} + func (this *ItemSets) Contain(items ItemList) (yes bool, index int) { for i, thisSet := range this.sets { if thisSet.Equal(items) { diff --git a/internal/util/gen/gen.go b/internal/util/gen/gen.go index 241dab8d..ec84d764 100644 --- a/internal/util/gen/gen.go +++ b/internal/util/gen/gen.go @@ -4,7 +4,7 @@ import ( "github.com/maxcalandrelli/gocc/internal/util/gen/golang" ) -func Gen(outDir, subpath string) { - golang.GenRune(outDir, subpath) - golang.GenLitConv(outDir, subpath) +func Gen(outDir, internal string) { + golang.GenRune(outDir, internal) + golang.GenLitConv(outDir, internal) } diff --git a/internal/util/gen/golang/litconv.go b/internal/util/gen/golang/litconv.go index 9e641adb..f19c11c1 100644 --- a/internal/util/gen/golang/litconv.go +++ b/internal/util/gen/golang/litconv.go @@ -6,8 +6,8 @@ import ( "github.com/maxcalandrelli/gocc/internal/io" ) -func GenLitConv(outDir, subpath string) { - io.WriteFileString(path.Join(outDir, subpath, "util", "litconv.go"), litConvSrc[1:]) +func GenLitConv(outDir, internal string) { + io.WriteFileString(path.Join(outDir, internal, "util", "litconv.go"), litConvSrc[1:]) } const litConvSrc = ` diff --git a/internal/util/gen/golang/rune.go b/internal/util/gen/golang/rune.go index 09c3c519..05d695ae 100644 --- a/internal/util/gen/golang/rune.go +++ b/internal/util/gen/golang/rune.go @@ -6,8 +6,8 @@ import ( "github.com/maxcalandrelli/gocc/internal/io" ) -func GenRune(outDir, subpath string) { - io.WriteFileString(path.Join(outDir, subpath, "util", "rune.go"), runeSrc[1:]) +func GenRune(outDir, internal string) { + io.WriteFileString(path.Join(outDir, internal, "util", "rune.go"), runeSrc[1:]) } var runeSrc = ` diff --git a/internal/util/rune.go b/internal/util/rune.go index 8b72af53..2a914679 100644 --- a/internal/util/rune.go +++ b/internal/util/rune.go @@ -16,6 +16,8 @@ package util import ( "fmt" + "unicode" + "unicode/utf8" ) func RuneToString(r rune) string { @@ -49,3 +51,101 @@ func RuneToString(r rune) string { } return fmt.Sprintf("\\U%08x", r) } + +type EscapedString string + +func (str EscapedString) Unquote() (unquoted string, wasQuoted bool, quoteType rune) { + if len(str) > 1 { + r := str[0] + if (r == '"' || r == '\x60' || r == '\'') && r == str[len(str)-1] { + str = str[1 : len(str)-1] + } + return string(str), true, rune(r) + } + return string(str), false, 0 +} + +func (str EscapedString) Unescape() string { + var ( + res string + r rune + size int + ) + for s := 0; s < len(str); s += size { + if str[s] == '\\' { + r, size = str[s+1:].EscapedFirstCharValue() + size++ + } else { + r, size = utf8.DecodeRuneInString(string(str)[s:]) + } + res += string(r) + } + return res +} + +func (str EscapedString) EscapedFirstCharValue() (rune, int) { + var i, base, max uint32 + offset := 0 + switch str[offset] { + case '\'', '"': + return rune(str[offset]), 1 + case 'a': + return '\a', 1 + case 'b': + return '\b', 1 + case 'f': + return '\f', 1 + case 'n': + return '\n', 1 + case 'r': + return '\r', 1 + case 't': + return '\t', 1 + case 'v': + return '\v', 1 + case '\\': + return '\\', 1 + case '0', '1', '2', '3', '4', '5', '6', '7': + i, base, max = 3, 8, 255 + case 'x': + i, base, max = 2, 16, 255 + offset++ + case 'u': + i, base, max = 4, 16, unicode.MaxRune + offset++ + case 'U': + i, base, max = 8, 32, unicode.MaxRune + offset++ + default: + panic(fmt.Sprintf("Error decoding character literal: %s\n", str[offset:])) + } + + var x uint32 + for ; i > 0 && offset < len(str)-1; i-- { + ch, size := utf8.DecodeRuneInString(string(str)[offset:]) + offset += size + d := uint32(EscapedString(ch).HexDigitValue()) + if d >= base { + panic(fmt.Sprintf("charVal(%s): illegal character (%c) in escape sequence. size=%d, offset=%d", str, str[offset], size, offset)) + } + x = x*base + d + } + if x > max || 0xD800 <= x && x < 0xE000 { + panic(fmt.Sprintf("Error decoding escape char value. Lit:%s, offset:%d, escape sequence is invalid Unicode code point\n", str, offset)) + } + + return rune(x), offset +} + +func (str EscapedString) HexDigitValue() int { + ch := str[0] + switch { + case '0' <= ch && ch <= '9': + return int(ch) - '0' + case 'a' <= ch && ch <= 'f': + return int(ch) - 'a' + 10 + case 'A' <= ch && ch <= 'F': + return int(ch) - 'A' + 10 + } + return 16 // larger than any legal digit val +} diff --git a/main.go b/main.go index a3305eb5..aadb83e4 100644 --- a/main.go +++ b/main.go @@ -32,6 +32,9 @@ to import from https://github.com/maxcalandrelli/gocc + - fixed a state machine generation bug (hopefully), that prevented a RE like '<' '<' . { . } '>' '>' + to recognize a string like "<< a > b >>" + - eliminated ambiguity between literals and labels of lexical or syntaxical productions; "error" can now be specified as a literal, and a synonm name is "λ", while a synonim for "empty" is "ε" diff --git a/spec/gocc2.ebnf b/spec/gocc2.ebnf index d8085b3e..36c1eb04 100644 --- a/spec/gocc2.ebnf +++ b/spec/gocc2.ebnf @@ -107,7 +107,12 @@ string_lit /*** Syntactic items ***/ -<< import "github.com/maxcalandrelli/gocc/internal/ast" >> +<< + import ( + "github.com/maxcalandrelli/gocc/internal/ast" + ) + // now a > b should work... + >> Grammar : LexicalPart From 98dd11d2bb14f49b2cc7f4f9faf1d1dac89ddda1 Mon Sep 17 00:00:00 2001 From: Massimiliano Calandrelli Date: Tue, 15 Oct 2019 22:40:01 +0200 Subject: [PATCH 25/33] ... --- main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.go b/main.go index aadb83e4..eb21d3d9 100644 --- a/main.go +++ b/main.go @@ -36,7 +36,7 @@ to recognize a string like "<< a > b >>" - eliminated ambiguity between literals and labels of lexical or syntaxical productions; "error" can now - be specified as a literal, and a synonm name is "λ", while a synonim for "empty" is "ε" + be specified as a literal, and a synonym is "λ", while a synonim for "empty" is "ε" - used original gocc (https://github.com/goccmack/gocc) to reproduce the initial (handwritten?) parser From 6627b4a97966835fc525b132fcca6053349b3ade Mon Sep 17 00:00:00 2001 From: Massimiliano Calandrelli Date: Tue, 15 Oct 2019 22:46:28 +0200 Subject: [PATCH 26/33] ... --- internal/parser/gen/golang/productionstable.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/parser/gen/golang/productionstable.go b/internal/parser/gen/golang/productionstable.go index 55ec492b..030ebabc 100644 --- a/internal/parser/gen/golang/productionstable.go +++ b/internal/parser/gen/golang/productionstable.go @@ -105,7 +105,7 @@ func replaceSDTvars(sdt string) string { ret = sdtReplacerBase.ReplaceAllString(ret, fmt.Sprintf("X[${1}]")) ret = sdtReplacerGetStr.ReplaceAllString(ret, fmt.Sprintf("getString(X[${1}])")) ret = sdtReplacerGetUnq.ReplaceAllString(ret, fmt.Sprintf("getUnquotedString(X[${1}])")) - //fmt.Printf("SDT:%s\n", ret) + // TODO: reorder this as: stringize, unquote, unescape, uppercase, lowercase, etc. return ret } From 30b949286fd5c6bcc5ba33d9e36ed0cd36d1c150 Mon Sep 17 00:00:00 2001 From: Massimiliano Calandrelli Date: Wed, 16 Oct 2019 14:07:22 +0200 Subject: [PATCH 27/33] ... --- example/ctx/ast/ast.go | 14 +- example/ctx/ctx.bnf | 6 +- example/ctx/ctx.grammar/ctx/iface/ctx.go | 13 ++ .../ctx.grammar/ctx/internal/parser/parser.go | 3 +- .../ctx/internal/parser/productionstable.go | 48 +++- .../ctx/ctx.grammar/ctx/internal/util/rune.go | 101 ++++++++ example/ctx/ctx.grammar/ctx/log/LR1_sets.txt | 81 +++++++ example/ctx/ctx.grammar/ctx/log/first.txt | 12 + .../ctx/ctx.grammar/ctx/log/lexer_sets.txt | 216 ++++++++++++++++++ example/ctx/ctx.grammar/ctx/log/terminals.txt | 5 + .../ctx.grammar/ctx/main/{main.go => ctx.go} | 0 example/ctx/ctx.grammar/ctx/util.go | 25 ++ example/ctx/log | 130 +++++++++++ internal/base/gen/golang/base.go | 138 ++--------- .../internal/parser/productionstable.go | 25 +- .../frontend/reparsed/internal/util/rune.go | 101 ++++++++ internal/frontend/reparsed/util.go | 134 +---------- .../parser/gen/golang/productionstable.go | 64 ++++-- internal/util/gen/golang/rune.go | 101 ++++++++ internal/util/rune.go | 5 +- main.go | 37 ++- 21 files changed, 950 insertions(+), 309 deletions(-) create mode 100644 example/ctx/ctx.grammar/ctx/log/LR1_sets.txt create mode 100644 example/ctx/ctx.grammar/ctx/log/first.txt create mode 100644 example/ctx/ctx.grammar/ctx/log/lexer_sets.txt create mode 100644 example/ctx/ctx.grammar/ctx/log/terminals.txt rename example/ctx/ctx.grammar/ctx/main/{main.go => ctx.go} (100%) create mode 100644 example/ctx/ctx.grammar/ctx/util.go create mode 100644 example/ctx/log diff --git a/example/ctx/ast/ast.go b/example/ctx/ast/ast.go index c0799a8b..3236cfd4 100644 --- a/example/ctx/ast/ast.go +++ b/example/ctx/ast/ast.go @@ -2,8 +2,6 @@ package ast import ( "fmt" - - "github.com/maxcalandrelli/gocc/example/ctx/ctx.grammar/ctx/iface" ) type ( @@ -11,16 +9,16 @@ type ( Stmt string ) -func NewStmtList(stmt interface{}) (StmtList, error) { - return StmtList{stmt.(Stmt)}, nil +func NewStmtList(stmt string) (StmtList, error) { + return StmtList{Stmt(stmt)}, nil } -func AppendStmt(stmtList, stmt interface{}) (StmtList, error) { - return append(stmtList.(StmtList), stmt.(Stmt)), nil +func AppendStmt(stmtList StmtList, stmt string) (StmtList, error) { + return append(stmtList, Stmt(stmt)), nil } -func NewStmt(stmtList interface{}) (Stmt, error) { - return Stmt(stmtList.(*iface.Token).Lit), nil +func NewStmt(stmt string) (Stmt, error) { + return Stmt(stmt), nil } func CalcResult(result interface{}) (Stmt, error) { diff --git a/example/ctx/ctx.bnf b/example/ctx/ctx.bnf index 517f6a81..3e53e190 100644 --- a/example/ctx/ctx.bnf +++ b/example/ctx/ctx.bnf @@ -19,12 +19,12 @@ id : (_letter | '_') {_idchar} ; >> StmtList : - Stmt << ast.NewStmtList($0) >> - | StmtList Stmt << ast.AppendStmt($0, $1) >> + Stmt << ast.NewStmtList($0:s) >> + | StmtList Stmt << ast.AppendStmt($0.(ast.StmtList), $1:s) >> ; Stmt : - id << ast.NewStmt($0) >> + id << ast.NewStmt($0:U) >> | "calc" @ "github.com/maxcalandrelli/gocc/example/calc/calc.grammar/calc" diff --git a/example/ctx/ctx.grammar/ctx/iface/ctx.go b/example/ctx/ctx.grammar/ctx/iface/ctx.go index ac85a34d..989e80a1 100644 --- a/example/ctx/ctx.grammar/ctx/iface/ctx.go +++ b/example/ctx/ctx.grammar/ctx/iface/ctx.go @@ -4,6 +4,7 @@ package iface import ( "github.com/maxcalandrelli/gocc/example/ctx/ctx.grammar/ctx/internal/errors" + "github.com/maxcalandrelli/gocc/example/ctx/ctx.grammar/ctx/internal/io/stream" "github.com/maxcalandrelli/gocc/example/ctx/ctx.grammar/ctx/internal/token" "io" ) @@ -48,3 +49,15 @@ const ( func GetTokenMap() TokenMap { return token.TokMap } + +func NewWindowReaderFromBytes(src []byte) stream.WindowReader { + return stream.NewWindowReaderFromBytes(src) +} + +func NewWindowReader(rdr io.Reader) stream.WindowReader { + return stream.NewWindowReader(rdr) +} + +func NewLimitedWindowReader(rdr io.Reader, sizeMin, sizeMax int) stream.WindowReader { + return stream.NewLimitedWindowReader(rdr, sizeMin, sizeMax) +} diff --git a/example/ctx/ctx.grammar/ctx/internal/parser/parser.go b/example/ctx/ctx.grammar/ctx/internal/parser/parser.go index ba329ba9..638e23b3 100644 --- a/example/ctx/ctx.grammar/ctx/internal/parser/parser.go +++ b/example/ctx/ctx.grammar/ctx/internal/parser/parser.go @@ -286,8 +286,9 @@ func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, er // // If no action, check if we have some context dependent parsing to try // + p.checkPoint = p.checkPoint.Advance(len(p.nextToken.IgnoredPrefix)) for _, cdAction := range parserActions.table[p.stack.top()].cdActions { - p.tokens.GotoCheckPoint(p.checkPoint.Advance(len(p.nextToken.IgnoredPrefix))) + p.tokens.GotoCheckPoint(p.checkPoint) cd_res, cd_err, cd_parsed := cdAction.tokenScanner(p.underlyingStream, p.userContext) if cd_err == nil && len(cd_parsed) > 0 { action = parserActions.table[p.stack.top()].actions[cdAction.tokenIndex] diff --git a/example/ctx/ctx.grammar/ctx/internal/parser/productionstable.go b/example/ctx/ctx.grammar/ctx/internal/parser/productionstable.go index 96879dc5..5f297b98 100644 --- a/example/ctx/ctx.grammar/ctx/internal/parser/productionstable.go +++ b/example/ctx/ctx.grammar/ctx/internal/parser/productionstable.go @@ -6,6 +6,40 @@ import ( "github.com/maxcalandrelli/gocc/example/ctx/ast" ) +import ( + "fmt" + "github.com/maxcalandrelli/gocc/example/ctx/ctx.grammar/ctx/internal/token" + "github.com/maxcalandrelli/gocc/example/ctx/ctx.grammar/ctx/internal/util" + "strings" +) + +func getString(X Attrib) string { + switch X.(type) { + case *token.Token: + return string(X.(*token.Token).Lit) + case string: + return X.(string) + } + return fmt.Sprintf("%q", X) +} + +func unescape(s string) string { + return util.EscapedString(s).Unescape() +} + +func unquote(s string) string { + r, _, _ := util.EscapedString(s).Unquote() + return r +} + +func lc(s string) string { + return strings.ToLower(s) +} + +func uc(s string) string { + return strings.ToUpper(s) +} + type ( //TODO: change type and variable names to be consistent with other tables ProdTab [numProductions]ProdTabEntry @@ -33,37 +67,37 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `StmtList : Π << ast.NewStmtList(X[0]) >>`, + String: `StmtList : Π << ast.NewStmtList($0:s) >>`, Id: "StmtList", NTType: 1, Index: 1, NumSymbols: 1, ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { - return ast.NewStmtList(X[0]) + return ast.NewStmtList(getString(X[0])) }, }, ProdTabEntry{ - String: `StmtList : Π Π << ast.AppendStmt(X[0], X[1]) >>`, + String: `StmtList : Π Π << ast.AppendStmt($0.(ast.StmtList), $1:s) >>`, Id: "StmtList", NTType: 1, Index: 2, NumSymbols: 2, ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { - return ast.AppendStmt(X[0], X[1]) + return ast.AppendStmt(X[0].(ast.StmtList), getString(X[1])) }, }, ProdTabEntry{ - String: `Stmt : id << ast.NewStmt(X[0]) >>`, + String: `Stmt : id << ast.NewStmt($0:U) >>`, Id: "Stmt", NTType: 2, Index: 3, NumSymbols: 1, ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { - return ast.NewStmt(X[0]) + return ast.NewStmt(uc(getString(X[0]))) }, }, ProdTabEntry{ - String: `Stmt : Λ μ << ast.CalcResult(X[2]) >>`, + String: `Stmt : Λ μ << ast.CalcResult($2) >>`, Id: "Stmt", NTType: 2, Index: 4, diff --git a/example/ctx/ctx.grammar/ctx/internal/util/rune.go b/example/ctx/ctx.grammar/ctx/internal/util/rune.go index bd8523a4..86fb8395 100644 --- a/example/ctx/ctx.grammar/ctx/internal/util/rune.go +++ b/example/ctx/ctx.grammar/ctx/internal/util/rune.go @@ -1,9 +1,12 @@ // Code generated by gocc; DO NOT EDIT. + package util import ( "fmt" + "unicode" + "unicode/utf8" ) func RuneToString(r rune) string { @@ -37,3 +40,101 @@ func RuneToString(r rune) string { } return fmt.Sprintf("\\U%08x", r) } + +type EscapedString string + +func (str EscapedString) Unquote() (unquoted string, wasQuoted bool, quoteType rune) { + if len(str) > 1 { + r := str[0] + if (r == '"' || r == '\x60' || r == '\'') && r == str[len(str)-1] { + str = str[1 : len(str)-1] + } + return string(str), true, rune(r) + } + return string(str), false, 0 +} + +func (str EscapedString) Unescape() string { + var ( + res string + r rune + size int + ) + for s := 0; s < len(str); s += size { + if str[s] == '\\' { + r, size = str[s+1:].EscapedFirstCharValue() + size++ + } else { + r, size = utf8.DecodeRuneInString(string(str)[s:]) + } + res += string(r) + } + return res +} + +func (str EscapedString) EscapedFirstCharValue() (rune, int) { + var i, base, max uint32 + offset := 0 + switch str[offset] { + case '\'', '"': + return rune(str[offset]), 1 + case 'a': + return '\a', 1 + case 'b': + return '\b', 1 + case 'f': + return '\f', 1 + case 'n': + return '\n', 1 + case 'r': + return '\r', 1 + case 't': + return '\t', 1 + case 'v': + return '\v', 1 + case '\\': + return '\\', 1 + case '0', '1', '2', '3', '4', '5', '6', '7': + i, base, max = 3, 8, 255 + case 'x': + i, base, max = 2, 16, 255 + offset++ + case 'u': + i, base, max = 4, 16, unicode.MaxRune + offset++ + case 'U': + i, base, max = 8, 32, unicode.MaxRune + offset++ + default: + panic(fmt.Sprintf("Error decoding character literal: %s\n", str[offset:])) + } + + var x uint32 + for ; i > 0 && offset < len(str)-1; i-- { + ch, size := utf8.DecodeRuneInString(string(str)[offset:]) + offset += size + d := uint32(HexDigitValue(ch)) + if d >= base { + panic(fmt.Sprintf("charVal(%s): illegal character (%c) in escape sequence. size=%d, offset=%d", str, str[offset], size, offset)) + } + x = x*base + d + } + if x > max || 0xD800 <= x && x < 0xE000 { + panic(fmt.Sprintf("Error decoding escape char value. Lit:%s, offset:%d, escape sequence is invalid Unicode code point\n", str, offset)) + } + + return rune(x), offset +} + +func HexDigitValue(ch rune) int { + switch { + case '0' <= ch && ch <= '9': + return int(ch) - '0' + case 'a' <= ch && ch <= 'f': + return int(ch) - 'a' + 10 + case 'A' <= ch && ch <= 'F': + return int(ch) - 'A' + 10 + } + return 16 // larger than any legal digit val +} + diff --git a/example/ctx/ctx.grammar/ctx/log/LR1_sets.txt b/example/ctx/ctx.grammar/ctx/log/LR1_sets.txt new file mode 100644 index 00000000..ab10c28e --- /dev/null +++ b/example/ctx/ctx.grammar/ctx/log/LR1_sets.txt @@ -0,0 +1,81 @@ +S0{ + S' : •Π «Ω» + StmtList : •Π «Ω» + StmtList : •Π Π «Ω» + Stmt : •id «Ω» + Stmt : •Λ μ «Ω» + StmtList : •Π «"calc"» + StmtList : •Π «id» + StmtList : •Π Π «"calc"» + StmtList : •Π Π «id» + Stmt : •id «"calc"» + Stmt : •Λ μ «"calc"» + Stmt : •id «id» + Stmt : •Λ μ «id» +} +Transitions: + Π -> 1 + Π -> 2 + id -> 3 + Λ -> 4 + + +S1{ + S' : Π• «Ω» + StmtList : Π •Π «Ω» + StmtList : Π •Π «"calc"» + StmtList : Π •Π «id» + Stmt : •id «Ω» + Stmt : •Λ μ «Ω» + Stmt : •id «"calc"» + Stmt : •Λ μ «"calc"» + Stmt : •id «id» + Stmt : •Λ μ «id» +} +Transitions: + id -> 3 + Λ -> 4 + Π -> 5 + + +S2{ + StmtList : Π• «Ω» + StmtList : Π• «"calc"» + StmtList : Π• «id» +} +Transitions: + + +S3{ + Stmt : id• «Ω» + Stmt : id• «"calc"» + Stmt : id• «id» +} +Transitions: + + +S4{ + Stmt : Λ •μ «Ω» + Stmt : Λ •μ «"calc"» + Stmt : Λ •μ «id» +} +Transitions: + μ -> 6 + + +S5{ + StmtList : Π Π• «Ω» + StmtList : Π Π• «"calc"» + StmtList : Π Π• «id» +} +Transitions: + + +S6{ + Stmt : Λ μ• «Ω» + Stmt : Λ μ• «"calc"» + Stmt : Λ μ• «id» +} +Transitions: + + diff --git a/example/ctx/ctx.grammar/ctx/log/first.txt b/example/ctx/ctx.grammar/ctx/log/first.txt new file mode 100644 index 00000000..9e2ecb61 --- /dev/null +++ b/example/ctx/ctx.grammar/ctx/log/first.txt @@ -0,0 +1,12 @@ +Π: { + id + Λ +} +Π: { + id + Λ +} +Π: { + id + Λ +} diff --git a/example/ctx/ctx.grammar/ctx/log/lexer_sets.txt b/example/ctx/ctx.grammar/ctx/log/lexer_sets.txt new file mode 100644 index 00000000..8637890e --- /dev/null +++ b/example/ctx/ctx.grammar/ctx/log/lexer_sets.txt @@ -0,0 +1,216 @@ +Item sets: +S0{ + !whitespace : ' ' | '\t' | '\n' | • '\r' + !whitespace : ' ' | '\t' | • '\n' | '\r' + !whitespace : ' ' | • '\t' | '\n' | '\r' + !whitespace : • ' ' | '\t' | '\n' | '\r' + _letter : 'a'-'z' | • 'A'-'Z' + _letter : • 'a'-'z' | 'A'-'Z' + id : (_letter | • '_') {_idchar} + id : (• _letter | '_') {_idchar} + Λ : • 'c' 'a' 'l' 'c' +} +Transitions: + ['\t','\t'] -> S1 + ['\n','\n'] -> S1 + ['\r','\r'] -> S1 + [' ',' '] -> S1 + ['A','Z'] -> S2 + ['_','_'] -> S3 + ['a','b'] -> S2 + ['c','c'] -> S4 + ['d','z'] -> S2 +Action: nil +Symbols classes: {['\t','\t'], ['\n','\n'], ['\r','\r'], [' ',' '], ['A','Z'], ['_','_'], ['a','b'], ['c','c'], ['d','z']} + +S1{ + !whitespace : (' ' | '\t' | '\n' | '\r') • +} +Transitions: +Action: Ignore("!whitespace") +Symbols classes: {} + +S2{ + _digit : • '0'-'9' + _idchar : _letter | _digit | • '_' + _idchar : _letter | • _digit | '_' + _idchar : • _letter | _digit | '_' + _letter : 'a'-'z' | • 'A'-'Z' + _letter : ( 'a'-'z' | 'A'-'Z') • + _letter : • 'a'-'z' | 'A'-'Z' + id : (_letter | '_') {_idchar} • + id : (_letter | '_') {• _idchar} +} +Transitions: + ['0','9'] -> S5 + ['A','Z'] -> S6 + ['_','_'] -> S7 + ['a','z'] -> S6 +Action: Accept("id") +Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} + +S3{ + _digit : • '0'-'9' + _idchar : _letter | _digit | • '_' + _idchar : _letter | • _digit | '_' + _idchar : • _letter | _digit | '_' + _letter : 'a'-'z' | • 'A'-'Z' + _letter : • 'a'-'z' | 'A'-'Z' + id : (_letter | '_') {_idchar} • + id : (_letter | '_') {• _idchar} +} +Transitions: + ['0','9'] -> S5 + ['A','Z'] -> S6 + ['_','_'] -> S7 + ['a','z'] -> S6 +Action: Accept("id") +Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} + +S4{ + _digit : • '0'-'9' + _idchar : _letter | _digit | • '_' + _idchar : _letter | • _digit | '_' + _idchar : • _letter | _digit | '_' + _letter : 'a'-'z' | • 'A'-'Z' + _letter : ( 'a'-'z' | 'A'-'Z') • + _letter : • 'a'-'z' | 'A'-'Z' + id : (_letter | '_') {_idchar} • + id : (_letter | '_') {• _idchar} + Λ : 'c' • 'a' 'l' 'c' +} +Transitions: + ['0','9'] -> S5 + ['A','Z'] -> S6 + ['_','_'] -> S7 + ['a','a'] -> S8 + ['b','z'] -> S6 +Action: Accept("id") +Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','a'], ['b','z']} + +S5{ + _digit : '0'-'9' • + _digit : • '0'-'9' + _idchar : (_letter | _digit | '_') • + _idchar : _letter | _digit | • '_' + _idchar : _letter | • _digit | '_' + _idchar : • _letter | _digit | '_' + _letter : 'a'-'z' | • 'A'-'Z' + _letter : • 'a'-'z' | 'A'-'Z' + id : (_letter | '_') {_idchar} • + id : (_letter | '_') {• _idchar} +} +Transitions: + ['0','9'] -> S5 + ['A','Z'] -> S6 + ['_','_'] -> S7 + ['a','z'] -> S6 +Action: Accept("id") +Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} + +S6{ + _digit : • '0'-'9' + _idchar : (_letter | _digit | '_') • + _idchar : _letter | _digit | • '_' + _idchar : _letter | • _digit | '_' + _idchar : • _letter | _digit | '_' + _letter : 'a'-'z' | • 'A'-'Z' + _letter : ( 'a'-'z' | 'A'-'Z') • + _letter : • 'a'-'z' | 'A'-'Z' + id : (_letter | '_') {_idchar} • + id : (_letter | '_') {• _idchar} +} +Transitions: + ['0','9'] -> S5 + ['A','Z'] -> S6 + ['_','_'] -> S7 + ['a','z'] -> S6 +Action: Accept("id") +Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} + +S7{ + _digit : • '0'-'9' + _idchar : (_letter | _digit | '_') • + _idchar : _letter | _digit | • '_' + _idchar : _letter | • _digit | '_' + _idchar : • _letter | _digit | '_' + _letter : 'a'-'z' | • 'A'-'Z' + _letter : • 'a'-'z' | 'A'-'Z' + id : (_letter | '_') {_idchar} • + id : (_letter | '_') {• _idchar} +} +Transitions: + ['0','9'] -> S5 + ['A','Z'] -> S6 + ['_','_'] -> S7 + ['a','z'] -> S6 +Action: Accept("id") +Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} + +S8{ + _digit : • '0'-'9' + _idchar : (_letter | _digit | '_') • + _idchar : _letter | _digit | • '_' + _idchar : _letter | • _digit | '_' + _idchar : • _letter | _digit | '_' + _letter : 'a'-'z' | • 'A'-'Z' + _letter : ( 'a'-'z' | 'A'-'Z') • + _letter : • 'a'-'z' | 'A'-'Z' + id : (_letter | '_') {_idchar} • + id : (_letter | '_') {• _idchar} + Λ : 'c' 'a' • 'l' 'c' +} +Transitions: + ['0','9'] -> S5 + ['A','Z'] -> S6 + ['_','_'] -> S7 + ['a','k'] -> S6 + ['l','l'] -> S9 + ['m','z'] -> S6 +Action: Accept("id") +Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','k'], ['l','l'], ['m','z']} + +S9{ + _digit : • '0'-'9' + _idchar : (_letter | _digit | '_') • + _idchar : _letter | _digit | • '_' + _idchar : _letter | • _digit | '_' + _idchar : • _letter | _digit | '_' + _letter : 'a'-'z' | • 'A'-'Z' + _letter : ( 'a'-'z' | 'A'-'Z') • + _letter : • 'a'-'z' | 'A'-'Z' + id : (_letter | '_') {_idchar} • + id : (_letter | '_') {• _idchar} + Λ : 'c' 'a' 'l' • 'c' +} +Transitions: + ['0','9'] -> S5 + ['A','Z'] -> S6 + ['_','_'] -> S7 + ['a','b'] -> S6 + ['c','c'] -> S10 + ['d','z'] -> S6 +Action: Accept("id") +Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','b'], ['c','c'], ['d','z']} + +S10{ + _digit : • '0'-'9' + _idchar : (_letter | _digit | '_') • + _idchar : _letter | _digit | • '_' + _idchar : _letter | • _digit | '_' + _idchar : • _letter | _digit | '_' + _letter : 'a'-'z' | • 'A'-'Z' + _letter : ( 'a'-'z' | 'A'-'Z') • + _letter : • 'a'-'z' | 'A'-'Z' + id : (_letter | '_') {_idchar} • + id : (_letter | '_') {• _idchar} + Λ : 'c' 'a' 'l' 'c' • +} +Transitions: + ['0','9'] -> S5 + ['A','Z'] -> S6 + ['_','_'] -> S7 + ['a','z'] -> S6 +Action: Accept("Λ") +Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} + diff --git a/example/ctx/ctx.grammar/ctx/log/terminals.txt b/example/ctx/ctx.grammar/ctx/log/terminals.txt new file mode 100644 index 00000000..cf81f3c5 --- /dev/null +++ b/example/ctx/ctx.grammar/ctx/log/terminals.txt @@ -0,0 +1,5 @@ +ά +id +"calc" +μ diff --git a/example/ctx/ctx.grammar/ctx/main/main.go b/example/ctx/ctx.grammar/ctx/main/ctx.go similarity index 100% rename from example/ctx/ctx.grammar/ctx/main/main.go rename to example/ctx/ctx.grammar/ctx/main/ctx.go diff --git a/example/ctx/ctx.grammar/ctx/util.go b/example/ctx/ctx.grammar/ctx/util.go new file mode 100644 index 00000000..037604ba --- /dev/null +++ b/example/ctx/ctx.grammar/ctx/util.go @@ -0,0 +1,25 @@ +// Code generated by gocc; DO NOT EDIT. + +package ctx + +import ( + "github.com/maxcalandrelli/gocc/example/ctx/ctx.grammar/ctx/internal/util" +) + +type EscapedString = util.EscapedString + +func RuneToString(r rune) string { + return util.RuneToString(r) +} + +func HexDigitValue(ch rune) int { + return util.HexDigitValue(ch) +} + +func IntValue(lit []byte) (int64, error) { + return util.IntValue(lit) +} + +func UintValue(lit []byte) (uint64, error) { + return util.UintValue(lit) +} diff --git a/example/ctx/log b/example/ctx/log new file mode 100644 index 00000000..8d72285c --- /dev/null +++ b/example/ctx/log @@ -0,0 +1,130 @@ +gocc ctx.bnf +sdt: +SDT: <$0> => +sdt: +SDT: <$0> => +SDT: <$1> => +sdt: +SDT: <$0> => +sdt: +SDT: <$2> => +panic: 75:31: missing ',' in argument list (and 2 more errors) in +// Code generated by gocc; DO NOT EDIT. + +package parser + +import ( + "github.com/maxcalandrelli/gocc/example/ctx/ast" + ) + +import ( + "fmt" + "strings" + "github.com/maxcalandrelli/gocc/example/ctx/ctx.grammar/ctx/internal/token" + "github.com/maxcalandrelli/gocc/example/ctx/ctx.grammar/ctx/internal/util" +) + +func getString(X Attrib) string { + switch X.(type) { + case *token.Token: return string(X.(*token.Token).Lit) + case string: return X.(string) + } + return fmt.Sprintf("%q", X) +} + +func unescape(s string) string { + return util.EscapedString(s).Unescape() +} + +func unquote(s string) string { + r, _, _ := util.EscapedString(s).Unquote() + return r +} + +func lc(s string) string { + return strings.ToLower(s) +} + +func uc(s string) string { + return strings.ToUpper(s) +} + + +type ( + //TODO: change type and variable names to be consistent with other tables + ProdTab [numProductions]ProdTabEntry + ProdTabEntry struct { + String string + Id string + NTType int + Index int + NumSymbols int + ReduceFunc func(interface{}, []Attrib) (Attrib, error) + } + Attrib interface { + } +) + +var productionsTable = ProdTab{ + ProdTabEntry{ + String: `S' : Π << >>`, + Id: "S'", + NTType: 0, + Index: 0, + NumSymbols: 1, + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { + return X[0], nil + }, + }, + ProdTabEntry{ + String: `StmtList : Π << ast.NewStmtList($0:s) >>`, + Id: "StmtList", + NTType: 1, + Index: 1, + NumSymbols: 1, + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { + return ast.NewStmtList(X[0]:s) + }, + }, + ProdTabEntry{ + String: `StmtList : Π Π << ast.AppendStmt($0, $1:s) >>`, + Id: "StmtList", + NTType: 1, + Index: 2, + NumSymbols: 2, + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { + return ast.AppendStmt(X[0], X[1]:s) + }, + }, + ProdTabEntry{ + String: `Stmt : id << ast.NewStmt($0:s) >>`, + Id: "Stmt", + NTType: 2, + Index: 3, + NumSymbols: 1, + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { + return ast.NewStmt(X[0]:s) + }, + }, + ProdTabEntry{ + String: `Stmt : Λ μ << ast.CalcResult($2) >>`, + Id: "Stmt", + NTType: 2, + Index: 4, + NumSymbols: 3, + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { + return ast.CalcResult(X[2]) + }, + }, +} + + +goroutine 1 [running]: +github.com/maxcalandrelli/gocc/internal/parser/gen/golang.GenProductionsTable(0xc000016440, 0x3a, 0xc000022230, 0x4b, 0xc000016500, 0x3e, 0xc000077410, 0x5, 0x6, 0xc00009c3c0, ...) + /home/max/go/src/github.com/maxcalandrelli/gocc/internal/parser/gen/golang/productionstable.go:54 +0x67f +github.com/maxcalandrelli/gocc/internal/parser/gen.Gen(0xc000016440, 0x3a, 0xc000022230, 0x4b, 0xc000016500, 0x3e, 0xc000077410, 0x5, 0x6, 0xc00009c3c0, ...) + /home/max/go/src/github.com/maxcalandrelli/gocc/internal/parser/gen/gen.go:37 +0x346 +main.main() + /home/max/go/src/github.com/maxcalandrelli/gocc/main.go:230 +0x92b +Makefile:2: recipe for target 'regenerate' failed +make: *** [regenerate] Error 2 diff --git a/internal/base/gen/golang/base.go b/internal/base/gen/golang/base.go index 0dc0a4e8..4d70c18c 100644 --- a/internal/base/gen/golang/base.go +++ b/internal/base/gen/golang/base.go @@ -435,139 +435,27 @@ const stringUtilSrc string = ` package {{.MyName}} import ( - "fmt" - "unicode" - "unicode/utf8" + "{{.Pkg}}/{{.InternalSubdir}}/util" ) +type EscapedString = util.EscapedString + func RuneToString(r rune) string { - if r >= 0x20 && r < 0x7f { - return fmt.Sprintf("'%c'", r) - } - switch r { - case 0x07: - return "'\\a'" - case 0x08: - return "'\\b'" - case 0x0C: - return "'\\f'" - case 0x0A: - return "'\\n'" - case 0x0D: - return "'\\r'" - case 0x09: - return "'\\t'" - case 0x0b: - return "'\\v'" - case 0x5c: - return "'\\\\\\'" - case 0x27: - return "'\\''" - case 0x22: - return "'\\\"'" - } - if r < 0x10000 { - return fmt.Sprintf("\\u%04x", r) - } - return fmt.Sprintf("\\U%08x", r) + return util.RuneToString(r) } -type EscapedString string - -func (str EscapedString) Unquote() (unquoted string, wasQuoted bool, quoteType rune) { - if len(str) > 1 { - r := str[0] - if (r == '"' || r == '\x60' || r == '\'') && r == str[len(str)-1] { - str = str[1 : len(str)-1] - } - return string(str), true, rune(r) - } - return string(str), false, 0 -} - -func (str EscapedString) Unescape() string { - var ( - res string - r rune - size int - ) - for s := 0; s < len(str); s += size { - if str[s] == '\\' { - r, size = str[s+1:].EscapedFirstCharValue() - size++ - } else { - r, size = utf8.DecodeRuneInString(string(str)[s:]) - } - res += string(r) - } - return res -} - -func (str EscapedString) EscapedFirstCharValue() (rune, int) { - var i, base, max uint32 - offset := 0 - switch str[offset] { - case 'a': - return '\a', 1 - case 'b': - return '\b', 1 - case 'f': - return '\f', 1 - case 'n': - return '\n', 1 - case 'r': - return '\r', 1 - case 't': - return '\t', 1 - case 'v': - return '\v', 1 - case '\\': - return '\\', 1 - case '\'': - return '\'', 1 - case '0', '1', '2', '3', '4', '5', '6', '7': - i, base, max = 3, 8, 255 - case 'x': - i, base, max = 2, 16, 255 - offset++ - case 'u': - i, base, max = 4, 16, unicode.MaxRune - offset++ - case 'U': - i, base, max = 8, 32, unicode.MaxRune - offset++ - default: - panic(fmt.Sprintf("Error decoding character literal: %s\n", str)) - } - - var x uint32 - for ; i > 0 && offset < len(str)-1; i-- { - ch, size := utf8.DecodeRuneInString(string(str)[offset:]) - offset += size - d := uint32(EscapedString(ch).HexDigitValue()) - if d >= base { - panic(fmt.Sprintf("charVal(%s): illegal character (%c) in escape sequence. size=%d, offset=%d", str, str[offset], size, offset)) - } - x = x*base + d - } - if x > max || 0xD800 <= x && x < 0xE000 { - panic(fmt.Sprintf("Error decoding escape char value. Lit:%s, offset:%d, escape sequence is invalid Unicode code point\n", str, offset)) - } +func HexDigitValue(ch rune) int { + return util.HexDigitValue(ch) +} - return rune(x), offset +func IntValue(lit []byte) (int64, error) { + return util.IntValue(lit) } -func (str EscapedString) HexDigitValue() int { - ch := str[0] - switch { - case '0' <= ch && ch <= '9': - return int(ch) - '0' - case 'a' <= ch && ch <= 'f': - return int(ch) - 'a' + 10 - case 'A' <= ch && ch <= 'F': - return int(ch) - 'A' + 10 - } - return 16 // larger than any legal digit val +func UintValue(lit []byte) (uint64, error) { + return util.UintValue(lit) } + + ` diff --git a/internal/frontend/reparsed/internal/parser/productionstable.go b/internal/frontend/reparsed/internal/parser/productionstable.go index 175fde61..457f0307 100644 --- a/internal/frontend/reparsed/internal/parser/productionstable.go +++ b/internal/frontend/reparsed/internal/parser/productionstable.go @@ -11,6 +11,8 @@ import ( import ( "fmt" "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/internal/token" + "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/internal/util" + "strings" ) func getString(X Attrib) string { @@ -23,14 +25,21 @@ func getString(X Attrib) string { return fmt.Sprintf("%q", X) } -func getUnquotedString(X Attrib) string { - ret := getString(X) - if len(ret) > 1 { - if (ret[0] == '\'' || ret[0] == '"') && ret[len(ret)-1] == ret[0] { - ret = ret[1 : len(ret)-1] - } - } - return ret +func unescape(s string) string { + return util.EscapedString(s).Unescape() +} + +func unquote(s string) string { + r, _, _ := util.EscapedString(s).Unquote() + return r +} + +func lc(s string) string { + return strings.ToLower(s) +} + +func uc(s string) string { + return strings.ToUpper(s) } type ( diff --git a/internal/frontend/reparsed/internal/util/rune.go b/internal/frontend/reparsed/internal/util/rune.go index bd8523a4..86fb8395 100644 --- a/internal/frontend/reparsed/internal/util/rune.go +++ b/internal/frontend/reparsed/internal/util/rune.go @@ -1,9 +1,12 @@ // Code generated by gocc; DO NOT EDIT. + package util import ( "fmt" + "unicode" + "unicode/utf8" ) func RuneToString(r rune) string { @@ -37,3 +40,101 @@ func RuneToString(r rune) string { } return fmt.Sprintf("\\U%08x", r) } + +type EscapedString string + +func (str EscapedString) Unquote() (unquoted string, wasQuoted bool, quoteType rune) { + if len(str) > 1 { + r := str[0] + if (r == '"' || r == '\x60' || r == '\'') && r == str[len(str)-1] { + str = str[1 : len(str)-1] + } + return string(str), true, rune(r) + } + return string(str), false, 0 +} + +func (str EscapedString) Unescape() string { + var ( + res string + r rune + size int + ) + for s := 0; s < len(str); s += size { + if str[s] == '\\' { + r, size = str[s+1:].EscapedFirstCharValue() + size++ + } else { + r, size = utf8.DecodeRuneInString(string(str)[s:]) + } + res += string(r) + } + return res +} + +func (str EscapedString) EscapedFirstCharValue() (rune, int) { + var i, base, max uint32 + offset := 0 + switch str[offset] { + case '\'', '"': + return rune(str[offset]), 1 + case 'a': + return '\a', 1 + case 'b': + return '\b', 1 + case 'f': + return '\f', 1 + case 'n': + return '\n', 1 + case 'r': + return '\r', 1 + case 't': + return '\t', 1 + case 'v': + return '\v', 1 + case '\\': + return '\\', 1 + case '0', '1', '2', '3', '4', '5', '6', '7': + i, base, max = 3, 8, 255 + case 'x': + i, base, max = 2, 16, 255 + offset++ + case 'u': + i, base, max = 4, 16, unicode.MaxRune + offset++ + case 'U': + i, base, max = 8, 32, unicode.MaxRune + offset++ + default: + panic(fmt.Sprintf("Error decoding character literal: %s\n", str[offset:])) + } + + var x uint32 + for ; i > 0 && offset < len(str)-1; i-- { + ch, size := utf8.DecodeRuneInString(string(str)[offset:]) + offset += size + d := uint32(HexDigitValue(ch)) + if d >= base { + panic(fmt.Sprintf("charVal(%s): illegal character (%c) in escape sequence. size=%d, offset=%d", str, str[offset], size, offset)) + } + x = x*base + d + } + if x > max || 0xD800 <= x && x < 0xE000 { + panic(fmt.Sprintf("Error decoding escape char value. Lit:%s, offset:%d, escape sequence is invalid Unicode code point\n", str, offset)) + } + + return rune(x), offset +} + +func HexDigitValue(ch rune) int { + switch { + case '0' <= ch && ch <= '9': + return int(ch) - '0' + case 'a' <= ch && ch <= 'f': + return int(ch) - 'a' + 10 + case 'A' <= ch && ch <= 'F': + return int(ch) - 'A' + 10 + } + return 16 // larger than any legal digit val +} + diff --git a/internal/frontend/reparsed/util.go b/internal/frontend/reparsed/util.go index 6c5e0529..4d97adb8 100644 --- a/internal/frontend/reparsed/util.go +++ b/internal/frontend/reparsed/util.go @@ -3,137 +3,23 @@ package gocc2 import ( - "fmt" - "unicode" - "unicode/utf8" + "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/internal/util" ) -func RuneToString(r rune) string { - if r >= 0x20 && r < 0x7f { - return fmt.Sprintf("'%c'", r) - } - switch r { - case 0x07: - return "'\\a'" - case 0x08: - return "'\\b'" - case 0x0C: - return "'\\f'" - case 0x0A: - return "'\\n'" - case 0x0D: - return "'\\r'" - case 0x09: - return "'\\t'" - case 0x0b: - return "'\\v'" - case 0x5c: - return "'\\\\\\'" - case 0x27: - return "'\\''" - case 0x22: - return "'\\\"'" - } - if r < 0x10000 { - return fmt.Sprintf("\\u%04x", r) - } - return fmt.Sprintf("\\U%08x", r) -} - -type EscapedString string +type EscapedString = util.EscapedString -func (str EscapedString) Unquote() (unquoted string, wasQuoted bool, quoteType rune) { - if len(str) > 1 { - r := str[0] - if (r == '"' || r == '\x60' || r == '\'') && r == str[len(str)-1] { - str = str[1 : len(str)-1] - } - return string(str), true, rune(r) - } - return string(str), false, 0 +func RuneToString(r rune) string { + return util.RuneToString(r) } -func (str EscapedString) Unescape() string { - var ( - res string - r rune - size int - ) - for s := 0; s < len(str); s += size { - if str[s] == '\\' { - r, size = str[s+1:].EscapedFirstCharValue() - size++ - } else { - r, size = utf8.DecodeRuneInString(string(str)[s:]) - } - res += string(r) - } - return res +func HexDigitValue(ch rune) int { + return util.HexDigitValue(ch) } -func (str EscapedString) EscapedFirstCharValue() (rune, int) { - var i, base, max uint32 - offset := 0 - switch str[offset] { - case 'a': - return '\a', 1 - case 'b': - return '\b', 1 - case 'f': - return '\f', 1 - case 'n': - return '\n', 1 - case 'r': - return '\r', 1 - case 't': - return '\t', 1 - case 'v': - return '\v', 1 - case '\\': - return '\\', 1 - case '\'': - return '\'', 1 - case '0', '1', '2', '3', '4', '5', '6', '7': - i, base, max = 3, 8, 255 - case 'x': - i, base, max = 2, 16, 255 - offset++ - case 'u': - i, base, max = 4, 16, unicode.MaxRune - offset++ - case 'U': - i, base, max = 8, 32, unicode.MaxRune - offset++ - default: - panic(fmt.Sprintf("Error decoding character literal: %s\n", str)) - } - - var x uint32 - for ; i > 0 && offset < len(str)-1; i-- { - ch, size := utf8.DecodeRuneInString(string(str)[offset:]) - offset += size - d := uint32(EscapedString(ch).HexDigitValue()) - if d >= base { - panic(fmt.Sprintf("charVal(%s): illegal character (%c) in escape sequence. size=%d, offset=%d", str, str[offset], size, offset)) - } - x = x*base + d - } - if x > max || 0xD800 <= x && x < 0xE000 { - panic(fmt.Sprintf("Error decoding escape char value. Lit:%s, offset:%d, escape sequence is invalid Unicode code point\n", str, offset)) - } - - return rune(x), offset +func IntValue(lit []byte) (int64, error) { + return util.IntValue(lit) } -func (str EscapedString) HexDigitValue() int { - ch := str[0] - switch { - case '0' <= ch && ch <= '9': - return int(ch) - '0' - case 'a' <= ch && ch <= 'f': - return int(ch) - 'a' + 10 - case 'A' <= ch && ch <= 'F': - return int(ch) - 'A' + 10 - } - return 16 // larger than any legal digit val +func UintValue(lit []byte) (uint64, error) { + return util.UintValue(lit) } diff --git a/internal/parser/gen/golang/productionstable.go b/internal/parser/gen/golang/productionstable.go index 030ebabc..1157dfcc 100644 --- a/internal/parser/gen/golang/productionstable.go +++ b/internal/parser/gen/golang/productionstable.go @@ -22,9 +22,8 @@ import ( "regexp" "text/template" - "github.com/maxcalandrelli/gocc/internal/config" - "github.com/maxcalandrelli/gocc/internal/ast" + "github.com/maxcalandrelli/gocc/internal/config" "github.com/maxcalandrelli/gocc/internal/io" "github.com/maxcalandrelli/gocc/internal/parser/lr1/items" "github.com/maxcalandrelli/gocc/internal/parser/symbols" @@ -52,7 +51,7 @@ func GenProductionsTable(pkg, outDir, header string, prods ast.SyntaxProdList, s source, err := format.Source(wr.Bytes()) if err != nil { - panic(err) + panic(fmt.Sprintf("%s in\n%s", err.Error(), wr.String())) } io.WriteFile(fname, source) } @@ -82,7 +81,7 @@ func getProdsTab(header string, prods ast.SyntaxProdList, symbols *symbols.Symbo } switch { case len(prod.Body.SDT) > 0: - data.ProdTab[i].ReduceFunc = fmt.Sprintf("return %s", replaceSDTvars(prod.Body.SDT)) + data.ProdTab[i].ReduceFunc = fmt.Sprintf("return %s", sdtReplacer.ReplaceAllStringFunc(prod.Body.SDT, sdtReplacerFunc)) case isEmpty: // Empty production with no semantic action. data.ProdTab[i].ReduceFunc = "return nil, nil" @@ -95,18 +94,28 @@ func getProdsTab(header string, prods ast.SyntaxProdList, symbols *symbols.Symbo } var ( - sdtReplacerBase = regexp.MustCompile("\\$([0-9]+)") - sdtReplacerGetStr = regexp.MustCompile("\\$s([0-9]+)") - sdtReplacerGetUnq = regexp.MustCompile("\\$u([0-9]+)") + sdtReplacer = regexp.MustCompile("\\$[0-9]+(:[sqeUl]+)?") + sdtReplacerSplit = regexp.MustCompile("^\\$([0-9]+)(?::([sqeUl]+))?$") ) -func replaceSDTvars(sdt string) string { - ret := sdt - ret = sdtReplacerBase.ReplaceAllString(ret, fmt.Sprintf("X[${1}]")) - ret = sdtReplacerGetStr.ReplaceAllString(ret, fmt.Sprintf("getString(X[${1}])")) - ret = sdtReplacerGetUnq.ReplaceAllString(ret, fmt.Sprintf("getUnquotedString(X[${1}])")) - // TODO: reorder this as: stringize, unquote, unescape, uppercase, lowercase, etc. - return ret +func sdtReplacerFunc(match string) string { + result, funcs := func(s []string) (string, string) { return fmt.Sprintf("X[%s]", s[0]), s[1] }(sdtReplacerSplit.FindStringSubmatch(match)[1:]) + if funcs > "" { + result = fmt.Sprintf("getString(%s)", result) + } + for _, op := range funcs { + switch op { + case 'q': + result = fmt.Sprintf("unquote(%s)", result) + case 'U': + result = fmt.Sprintf("uc(%s)", result) + case 'e': + result = fmt.Sprintf("unescape(%s)", result) + case 'l': + result = fmt.Sprintf("lc(%s)", result) + } + } + return result } type prodsTabData struct { @@ -134,10 +143,11 @@ package parser {{.Header}} - import ( "fmt" + "strings" "{{.Config.Package}}/{{.InternalDir}}/token" + "{{.Config.Package}}/{{.InternalDir}}/util" ) func getString(X Attrib) string { @@ -148,16 +158,24 @@ func getString(X Attrib) string { return fmt.Sprintf("%q", X) } -func getUnquotedString(X Attrib) string { - ret := getString(X) - if len(ret)>1 { - if (ret[0] == '\'' || ret[0] == '"') && ret[len(ret)-1]==ret[0] { - ret = ret[1:len(ret)-1] - } - } - return ret +func unescape(s string) string { + return util.EscapedString(s).Unescape() +} + +func unquote(s string) string { + r, _, _ := util.EscapedString(s).Unquote() + return r +} + +func lc(s string) string { + return strings.ToLower(s) +} + +func uc(s string) string { + return strings.ToUpper(s) } + type ( //TODO: change type and variable names to be consistent with other tables ProdTab [numProductions]ProdTabEntry diff --git a/internal/util/gen/golang/rune.go b/internal/util/gen/golang/rune.go index 05d695ae..af80903b 100644 --- a/internal/util/gen/golang/rune.go +++ b/internal/util/gen/golang/rune.go @@ -13,10 +13,13 @@ func GenRune(outDir, internal string) { var runeSrc = ` // Code generated by gocc; DO NOT EDIT. + package util import ( "fmt" + "unicode" + "unicode/utf8" ) func RuneToString(r rune) string { @@ -50,4 +53,102 @@ func RuneToString(r rune) string { } return fmt.Sprintf("\\U%08x", r) } + +type EscapedString string + +func (str EscapedString) Unquote() (unquoted string, wasQuoted bool, quoteType rune) { + if len(str) > 1 { + r := str[0] + if (r == '"' || r == '\x60' || r == '\'') && r == str[len(str)-1] { + str = str[1 : len(str)-1] + } + return string(str), true, rune(r) + } + return string(str), false, 0 +} + +func (str EscapedString) Unescape() string { + var ( + res string + r rune + size int + ) + for s := 0; s < len(str); s += size { + if str[s] == '\\' { + r, size = str[s+1:].EscapedFirstCharValue() + size++ + } else { + r, size = utf8.DecodeRuneInString(string(str)[s:]) + } + res += string(r) + } + return res +} + +func (str EscapedString) EscapedFirstCharValue() (rune, int) { + var i, base, max uint32 + offset := 0 + switch str[offset] { + case '\'', '"': + return rune(str[offset]), 1 + case 'a': + return '\a', 1 + case 'b': + return '\b', 1 + case 'f': + return '\f', 1 + case 'n': + return '\n', 1 + case 'r': + return '\r', 1 + case 't': + return '\t', 1 + case 'v': + return '\v', 1 + case '\\': + return '\\', 1 + case '0', '1', '2', '3', '4', '5', '6', '7': + i, base, max = 3, 8, 255 + case 'x': + i, base, max = 2, 16, 255 + offset++ + case 'u': + i, base, max = 4, 16, unicode.MaxRune + offset++ + case 'U': + i, base, max = 8, 32, unicode.MaxRune + offset++ + default: + panic(fmt.Sprintf("Error decoding character literal: %s\n", str[offset:])) + } + + var x uint32 + for ; i > 0 && offset < len(str)-1; i-- { + ch, size := utf8.DecodeRuneInString(string(str)[offset:]) + offset += size + d := uint32(HexDigitValue(ch)) + if d >= base { + panic(fmt.Sprintf("charVal(%s): illegal character (%c) in escape sequence. size=%d, offset=%d", str, str[offset], size, offset)) + } + x = x*base + d + } + if x > max || 0xD800 <= x && x < 0xE000 { + panic(fmt.Sprintf("Error decoding escape char value. Lit:%s, offset:%d, escape sequence is invalid Unicode code point\n", str, offset)) + } + + return rune(x), offset +} + +func HexDigitValue(ch rune) int { + switch { + case '0' <= ch && ch <= '9': + return int(ch) - '0' + case 'a' <= ch && ch <= 'f': + return int(ch) - 'a' + 10 + case 'A' <= ch && ch <= 'F': + return int(ch) - 'A' + 10 + } + return 16 // larger than any legal digit val +} + ` diff --git a/internal/util/rune.go b/internal/util/rune.go index 2a914679..bc7e52b3 100644 --- a/internal/util/rune.go +++ b/internal/util/rune.go @@ -124,7 +124,7 @@ func (str EscapedString) EscapedFirstCharValue() (rune, int) { for ; i > 0 && offset < len(str)-1; i-- { ch, size := utf8.DecodeRuneInString(string(str)[offset:]) offset += size - d := uint32(EscapedString(ch).HexDigitValue()) + d := uint32(HexDigitValue(ch)) if d >= base { panic(fmt.Sprintf("charVal(%s): illegal character (%c) in escape sequence. size=%d, offset=%d", str, str[offset], size, offset)) } @@ -137,8 +137,7 @@ func (str EscapedString) EscapedFirstCharValue() (rune, int) { return rune(x), offset } -func (str EscapedString) HexDigitValue() int { - ch := str[0] +func HexDigitValue(ch rune) int { switch { case '0' <= ch && ch <= '9': return int(ch) - '0' diff --git a/main.go b/main.go index eb21d3d9..3d105e49 100644 --- a/main.go +++ b/main.go @@ -33,7 +33,8 @@ https://github.com/maxcalandrelli/gocc - fixed a state machine generation bug (hopefully), that prevented a RE like '<' '<' . { . } '>' '>' - to recognize a string like "<< a > b >>" + to recognize a string like "<< a > b >>" (this is done in ItemSets.propagateDots and in the generated + lexer/transitiontable.go) - eliminated ambiguity between literals and labels of lexical or syntaxical productions; "error" can now be specified as a literal, and a synonym is "λ", while a synonim for "empty" is "ε" @@ -53,12 +54,34 @@ available as an implicit variable with name "Context" in SDT snippets. a variable named "Stream" contains the underlying lexer stream - - added shorthand substitutions for SDT placeholders: - - $s converts $ to string directly if it is a token in the target grammar; if it is some other object - (i.e. an AST branch returned by a reduce operation), it is converted to a string with a .(string) conversion - and, in case of failure, with a "%q" format string - - $u does the same; additionally, if the resulting string is enclosed in single o double quotes, it is - unwrapped an the quotes are discarded + - added functions shorthand substitutions for SDT placeholders $, with the format + + $: + + the operations in are applied to the token/ast; ops is a string where every character stays for an unary + function of a string, identified by one of the following: + - s: converts $ to string directly if it is a token in the target grammar; if it is some other object + (i.e. an AST branch returned by a reduce operation), it is converted to a string with a .(string) conversion + and, in case of failure, with a "%q" format string + - q: if the resulting string is enclosed in single o double quotes, it is unwrapped an the quotes are + discarded + - e: unescape the string, replacing control sequences with their corresponding represented values + - U: uppercase conversion + - l: lowercase conversion + for example, if the literal in the token in a terminal symbol in third position in a syntactical production is + <"'value of PI (\u03c0): \"3.14159\"'"> (angular braces used in this text to quote the values), like in: + + ProdX: HeaderPart OptionalPart quoted_string Trailerpart << ast.PrepareWhatever(...) >> ; + + then we will get the following results for quoted_string ($2): + + $2 *token.Token object whose Lit field has the string value <"'value of PI (\u03c0): \"3.14159\"'"> + $2s <"'value of PI (\u03c0): \"3.14159\"'"> + $2e <"'value of PI (π): "3.14159"'"> + $2eq <'value of PI (π): "3.14159"'> + $2eqq + $2eqU + $2eqUq - added the ability to parse only the longest possible prefix of data, returning the consumed bytes From a703e1c1242977c656801c1be9c25363e24cb93e Mon Sep 17 00:00:00 2001 From: Massimiliano Calandrelli Date: Sat, 19 Oct 2019 09:58:48 +0200 Subject: [PATCH 28/33] ... --- example/ctx/ctx.bnf | 32 +- .../ctx.grammar/ctx/internal/lexer/acttab.go | 16 +- .../ctx.grammar/ctx/internal/lexer/lexer.go | 4 +- .../ctx/internal/lexer/transitiontable.go | 112 ++---- .../ctx/internal/parser/actiontable.go | 47 +-- .../ctx/internal/parser/gototable.go | 5 - .../ctx.grammar/ctx/internal/parser/parser.go | 4 +- .../ctx/internal/parser/productionstable.go | 12 +- .../ctx.grammar/ctx/internal/token/token.go | 8 +- .../ctx/ctx.grammar/ctx/internal/util/rune.go | 2 +- example/ctx/ctx.grammar/ctx/log/LR1_sets.txt | 47 +-- example/ctx/ctx.grammar/ctx/log/first.txt | 6 +- .../ctx/ctx.grammar/ctx/log/lexer_sets.txt | 233 ++++-------- example/ctx/ctx.grammar/ctx/log/terminals.txt | 1 - example/ctx/ctx1.bnf | 45 +++ example/ctx/ctx1.grammar/ctx1/ctx1.go | 131 +++++++ example/ctx/ctx1.grammar/ctx1/iface/ctx1.go | 63 +++ .../ctx1/internal/errors/errors.go | 56 +++ .../io/stream/internal/stream_impl.go | 275 ++++++++++++++ .../io/stream/internal/stream_public.go | 101 +++++ .../ctx1/internal/io/stream/stream.go | 39 ++ .../ctx1/internal/lexer/acttab.go | 59 +++ .../ctx1.grammar/ctx1/internal/lexer/lexer.go | 174 +++++++++ .../ctx1/internal/lexer/transitiontable.go | 117 ++++++ .../ctx1/internal/parser/action.go | 51 +++ .../ctx1/internal/parser/actiontable.go | 89 +++++ .../ctx1/internal/parser/gototable.go | 43 +++ .../ctx1/internal/parser/parser.go | 359 ++++++++++++++++++ .../ctx1/internal/parser/productionstable.go | 109 ++++++ .../ctx1.grammar/ctx1/internal/token/token.go | 93 +++++ .../ctx1/internal/util/litconv.go | 108 ++++++ .../ctx1.grammar/ctx1/internal/util/rune.go | 140 +++++++ .../ctx/ctx1.grammar/ctx1/log/LR1_sets.txt | 72 ++++ example/ctx/ctx1.grammar/ctx1/log/first.txt | 12 + .../ctx/ctx1.grammar/ctx1/log/lexer_sets.txt | 128 +++++++ .../ctx/ctx1.grammar/ctx1/log/terminals.txt | 4 + example/ctx/ctx1.grammar/ctx1/main/ctx1.go | 58 +++ example/ctx/ctx1.grammar/ctx1/util.go | 25 ++ example/ctx/ctx_test.go | 42 +- .../frontend/reparsed/internal/util/rune.go | 2 +- internal/frontend/reparsed/log/lexer_sets.txt | 16 - internal/lexer/items/item.go | 7 +- internal/lexer/items/itemlist.go | 3 + internal/lexer/items/itemset.go | 57 ++- internal/lexer/items/itemsets.go | 6 + .../parser/gen/golang/productionstable.go | 4 +- internal/util/gen/golang/rune.go | 2 +- internal/util/rune.go | 2 +- main.go | 2 +- 49 files changed, 2603 insertions(+), 420 deletions(-) create mode 100644 example/ctx/ctx1.bnf create mode 100644 example/ctx/ctx1.grammar/ctx1/ctx1.go create mode 100644 example/ctx/ctx1.grammar/ctx1/iface/ctx1.go create mode 100644 example/ctx/ctx1.grammar/ctx1/internal/errors/errors.go create mode 100644 example/ctx/ctx1.grammar/ctx1/internal/io/stream/internal/stream_impl.go create mode 100644 example/ctx/ctx1.grammar/ctx1/internal/io/stream/internal/stream_public.go create mode 100644 example/ctx/ctx1.grammar/ctx1/internal/io/stream/stream.go create mode 100644 example/ctx/ctx1.grammar/ctx1/internal/lexer/acttab.go create mode 100644 example/ctx/ctx1.grammar/ctx1/internal/lexer/lexer.go create mode 100644 example/ctx/ctx1.grammar/ctx1/internal/lexer/transitiontable.go create mode 100644 example/ctx/ctx1.grammar/ctx1/internal/parser/action.go create mode 100644 example/ctx/ctx1.grammar/ctx1/internal/parser/actiontable.go create mode 100644 example/ctx/ctx1.grammar/ctx1/internal/parser/gototable.go create mode 100644 example/ctx/ctx1.grammar/ctx1/internal/parser/parser.go create mode 100644 example/ctx/ctx1.grammar/ctx1/internal/parser/productionstable.go create mode 100644 example/ctx/ctx1.grammar/ctx1/internal/token/token.go create mode 100644 example/ctx/ctx1.grammar/ctx1/internal/util/litconv.go create mode 100644 example/ctx/ctx1.grammar/ctx1/internal/util/rune.go create mode 100644 example/ctx/ctx1.grammar/ctx1/log/LR1_sets.txt create mode 100644 example/ctx/ctx1.grammar/ctx1/log/first.txt create mode 100644 example/ctx/ctx1.grammar/ctx1/log/lexer_sets.txt create mode 100644 example/ctx/ctx1.grammar/ctx1/log/terminals.txt create mode 100644 example/ctx/ctx1.grammar/ctx1/main/ctx1.go create mode 100644 example/ctx/ctx1.grammar/ctx1/util.go diff --git a/example/ctx/ctx.bnf b/example/ctx/ctx.bnf index 3e53e190..558ee6da 100644 --- a/example/ctx/ctx.bnf +++ b/example/ctx/ctx.bnf @@ -1,12 +1,25 @@ /* Lexical elements */ -_letter : 'a'-'z' | 'A'-'Z' ; - _digit : '0'-'9' ; - -_idchar : _letter | _digit | '_' ; - -id : (_letter | '_') {_idchar} ; +_letter : 'a'-'z' | 'A'-'Z' | ( '\\' 'u' _hex { _hex } ) ; +_hex : _digit | ( 'a'-'f' ) | ('A' - 'F') ; +_idchar : _letter | _digit | '_'; + +_x0 : 'α' ; +_x1 : 'β' _digit { _digit } ; +_x : 'α' | ( 'β' _digit { _digit } ); +_test : _x { _x | 'γ' } ; + +//id : (_letter | '_') {_idchar} ; + +id: +/* + (_letter | '_') {_idchar} + ('a'-'z' | 'A'-'Z' | ( '\\' 'u' _hex { _hex } ) | '_') + { ('a'-'z' | 'A'-'Z' | ( '\\' 'u' _hex { _hex } ) | '_') | _digit } +*/ + _x { _x0 | _x1 | 'γ' } +; !whitespace : ' ' | '\t' | '\n' | '\r' ; @@ -19,14 +32,13 @@ id : (_letter | '_') {_idchar} ; >> StmtList : - Stmt << ast.NewStmtList($0:s) >> - | StmtList Stmt << ast.AppendStmt($0.(ast.StmtList), $1:s) >> + Stmt << ast.NewStmtList($0s) >> + | StmtList Stmt << ast.AppendStmt($0.(ast.StmtList), $1s) >> ; Stmt : - id << ast.NewStmt($0:U) >> + id << ast.NewStmt($0e) >> | - "calc" @ "github.com/maxcalandrelli/gocc/example/calc/calc.grammar/calc" << ast.CalcResult($2) >> diff --git a/example/ctx/ctx.grammar/ctx/internal/lexer/acttab.go b/example/ctx/ctx.grammar/ctx/internal/lexer/acttab.go index 7b07780a..7bc5fe8f 100644 --- a/example/ctx/ctx.grammar/ctx/internal/lexer/acttab.go +++ b/example/ctx/ctx.grammar/ctx/internal/lexer/acttab.go @@ -32,16 +32,16 @@ var ActTab = ActionTable{ Accept: 2, Ignore: "", }, - ActionRow{ // S3, Accept("id") - Accept: 2, + ActionRow{ // S3, + Accept: 0, Ignore: "", }, ActionRow{ // S4, Accept("id") Accept: 2, Ignore: "", }, - ActionRow{ // S5, Accept("id") - Accept: 2, + ActionRow{ // S5, + Accept: 0, Ignore: "", }, ActionRow{ // S6, Accept("id") @@ -56,12 +56,4 @@ var ActTab = ActionTable{ Accept: 2, Ignore: "", }, - ActionRow{ // S9, Accept("id") - Accept: 2, - Ignore: "", - }, - ActionRow{ // S10, Accept("Λ") - Accept: 3, - Ignore: "", - }, } diff --git a/example/ctx/ctx.grammar/ctx/internal/lexer/lexer.go b/example/ctx/ctx.grammar/ctx/internal/lexer/lexer.go index ceaabfd6..e8549abc 100644 --- a/example/ctx/ctx.grammar/ctx/internal/lexer/lexer.go +++ b/example/ctx/ctx.grammar/ctx/internal/lexer/lexer.go @@ -16,8 +16,8 @@ import ( const ( NoState = -1 - NumStates = 11 - NumSymbols = 14 + NumStates = 9 + NumSymbols = 19 INVALID_RUNE = rune(-1) ) diff --git a/example/ctx/ctx.grammar/ctx/internal/lexer/transitiontable.go b/example/ctx/ctx.grammar/ctx/internal/lexer/transitiontable.go index ae790a2c..ed1b1d58 100644 --- a/example/ctx/ctx.grammar/ctx/internal/lexer/transitiontable.go +++ b/example/ctx/ctx.grammar/ctx/internal/lexer/transitiontable.go @@ -21,16 +21,10 @@ var TransTab = TransitionTable{ return 1 case r == 32: // [' ',' '] return 1 - case 65 <= r && r <= 90: // ['A','Z'] + case r == 945: // [\u03b1,\u03b1] return 2 - case r == 95: // ['_','_'] + case r == 946: // [\u03b2,\u03b2] return 3 - case 97 <= r && r <= 98: // ['a','b'] - return 2 - case r == 99: // ['c','c'] - return 4 - case 100 <= r && r <= 122: // ['d','z'] - return 2 } return NoState }, @@ -43,13 +37,11 @@ var TransTab = TransitionTable{ // S2 func(r rune) int { switch { - case 48 <= r && r <= 57: // ['0','9'] + case r == 945: // [\u03b1,\u03b1] + return 4 + case r == 946: // [\u03b2,\u03b2] return 5 - case 65 <= r && r <= 90: // ['A','Z'] - return 6 - case r == 95: // ['_','_'] - return 7 - case 97 <= r && r <= 122: // ['a','z'] + case r == 947: // [\u03b3,\u03b3] return 6 } return NoState @@ -58,28 +50,18 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 5 - case 65 <= r && r <= 90: // ['A','Z'] - return 6 - case r == 95: // ['_','_'] return 7 - case 97 <= r && r <= 122: // ['a','z'] - return 6 } return NoState }, // S4 func(r rune) int { switch { - case 48 <= r && r <= 57: // ['0','9'] + case r == 945: // [\u03b1,\u03b1] + return 4 + case r == 946: // [\u03b2,\u03b2] return 5 - case 65 <= r && r <= 90: // ['A','Z'] - return 6 - case r == 95: // ['_','_'] - return 7 - case r == 97: // ['a','a'] - return 8 - case 98 <= r && r <= 122: // ['b','z'] + case r == 947: // [\u03b3,\u03b3] return 6 } return NoState @@ -88,26 +70,18 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 5 - case 65 <= r && r <= 90: // ['A','Z'] - return 6 - case r == 95: // ['_','_'] - return 7 - case 97 <= r && r <= 122: // ['a','z'] - return 6 + return 8 } return NoState }, // S6 func(r rune) int { switch { - case 48 <= r && r <= 57: // ['0','9'] + case r == 945: // [\u03b1,\u03b1] + return 4 + case r == 946: // [\u03b2,\u03b2] return 5 - case 65 <= r && r <= 90: // ['A','Z'] - return 6 - case r == 95: // ['_','_'] - return 7 - case 97 <= r && r <= 122: // ['a','z'] + case r == 947: // [\u03b3,\u03b3] return 6 } return NoState @@ -116,62 +90,24 @@ var TransTab = TransitionTable{ func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 5 - case 65 <= r && r <= 90: // ['A','Z'] - return 6 - case r == 95: // ['_','_'] return 7 - case 97 <= r && r <= 122: // ['a','z'] - return 6 - } - return NoState - }, - // S8 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] - return 5 - case 65 <= r && r <= 90: // ['A','Z'] - return 6 - case r == 95: // ['_','_'] - return 7 - case 97 <= r && r <= 107: // ['a','k'] - return 6 - case r == 108: // ['l','l'] - return 9 - case 109 <= r && r <= 122: // ['m','z'] - return 6 - } - return NoState - }, - // S9 - func(r rune) int { - switch { - case 48 <= r && r <= 57: // ['0','9'] + case r == 945: // [\u03b1,\u03b1] + return 4 + case r == 946: // [\u03b2,\u03b2] return 5 - case 65 <= r && r <= 90: // ['A','Z'] - return 6 - case r == 95: // ['_','_'] - return 7 - case 97 <= r && r <= 98: // ['a','b'] - return 6 - case r == 99: // ['c','c'] - return 10 - case 100 <= r && r <= 122: // ['d','z'] + case r == 947: // [\u03b3,\u03b3] return 6 } return NoState }, - // S10 + // S8 func(r rune) int { switch { case 48 <= r && r <= 57: // ['0','9'] - return 5 - case 65 <= r && r <= 90: // ['A','Z'] - return 6 - case r == 95: // ['_','_'] - return 7 - case 97 <= r && r <= 122: // ['a','z'] + return 8 + case r == 945: // [\u03b1,\u03b1] + return 4 + case r == 947: // [\u03b3,\u03b3] return 6 } return NoState diff --git a/example/ctx/ctx.grammar/ctx/internal/parser/actiontable.go b/example/ctx/ctx.grammar/ctx/internal/parser/actiontable.go index 870d528a..c3f71e31 100644 --- a/example/ctx/ctx.grammar/ctx/internal/parser/actiontable.go +++ b/example/ctx/ctx.grammar/ctx/internal/parser/actiontable.go @@ -27,10 +27,11 @@ var parserActions = actions{ nil, // ά nil, // Ω shift(3), // id - shift(4), // "calc" - nil, // μ + shift(4), // μ + }, + cdActions: []cdAction{ + cdAction{tokenIndex: 3, tokenScanner: cdFunc_calc_0}, }, - cdActions: []cdAction{}, }, actionRow{ // S1 canRecover: false, @@ -38,10 +39,11 @@ var parserActions = actions{ nil, // ά accept(true), // Ω shift(3), // id - shift(4), // "calc" - nil, // μ + shift(4), // μ + }, + cdActions: []cdAction{ + cdAction{tokenIndex: 3, tokenScanner: cdFunc_calc_0}, }, - cdActions: []cdAction{}, }, actionRow{ // S2 canRecover: false, @@ -49,8 +51,7 @@ var parserActions = actions{ nil, // ά reduce(1), // Ω, reduce: StmtList reduce(1), // id, reduce: StmtList - reduce(1), // "calc", reduce: StmtList - nil, // μ + reduce(1), // μ, reduce: StmtList }, cdActions: []cdAction{}, }, @@ -60,23 +61,19 @@ var parserActions = actions{ nil, // ά reduce(3), // Ω, reduce: Stmt reduce(3), // id, reduce: Stmt - reduce(3), // "calc", reduce: Stmt - nil, // μ + reduce(3), // μ, reduce: Stmt }, cdActions: []cdAction{}, }, actionRow{ // S4 canRecover: false, actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // id - nil, // "calc" - shift(6), // μ - }, - cdActions: []cdAction{ - cdAction{tokenIndex: 4, tokenScanner: cdFunc_calc_0}, + nil, // ά + reduce(4), // Ω, reduce: Stmt + reduce(4), // id, reduce: Stmt + reduce(4), // μ, reduce: Stmt }, + cdActions: []cdAction{}, }, actionRow{ // S5 canRecover: false, @@ -84,19 +81,7 @@ var parserActions = actions{ nil, // ά reduce(2), // Ω, reduce: StmtList reduce(2), // id, reduce: StmtList - reduce(2), // "calc", reduce: StmtList - nil, // μ - }, - cdActions: []cdAction{}, - }, - actionRow{ // S6 - canRecover: false, - actions: [numSymbols]action{ - nil, // ά - reduce(4), // Ω, reduce: Stmt - reduce(4), // id, reduce: Stmt - reduce(4), // "calc", reduce: Stmt - nil, // μ + reduce(2), // μ, reduce: StmtList }, cdActions: []cdAction{}, }, diff --git a/example/ctx/ctx.grammar/ctx/internal/parser/gototable.go b/example/ctx/ctx.grammar/ctx/internal/parser/gototable.go index 4feafaba..443ec029 100644 --- a/example/ctx/ctx.grammar/ctx/internal/parser/gototable.go +++ b/example/ctx/ctx.grammar/ctx/internal/parser/gototable.go @@ -40,9 +40,4 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, - gotoRow{ // S6 - -1, // Π - -1, // Π - -1, // Π - }, } diff --git a/example/ctx/ctx.grammar/ctx/internal/parser/parser.go b/example/ctx/ctx.grammar/ctx/internal/parser/parser.go index 638e23b3..0cc07fd2 100644 --- a/example/ctx/ctx.grammar/ctx/internal/parser/parser.go +++ b/example/ctx/ctx.grammar/ctx/internal/parser/parser.go @@ -16,8 +16,8 @@ import ( const ( numProductions = 5 - numStates = 7 - numSymbols = 8 + numStates = 6 + numSymbols = 7 ) // Stack diff --git a/example/ctx/ctx.grammar/ctx/internal/parser/productionstable.go b/example/ctx/ctx.grammar/ctx/internal/parser/productionstable.go index 5f297b98..7c637d26 100644 --- a/example/ctx/ctx.grammar/ctx/internal/parser/productionstable.go +++ b/example/ctx/ctx.grammar/ctx/internal/parser/productionstable.go @@ -67,7 +67,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `StmtList : Π << ast.NewStmtList($0:s) >>`, + String: `StmtList : Π << ast.NewStmtList($0s) >>`, Id: "StmtList", NTType: 1, Index: 1, @@ -77,7 +77,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `StmtList : Π Π << ast.AppendStmt($0.(ast.StmtList), $1:s) >>`, + String: `StmtList : Π Π << ast.AppendStmt($0.(ast.StmtList), $1s) >>`, Id: "StmtList", NTType: 1, Index: 2, @@ -87,21 +87,21 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `Stmt : id << ast.NewStmt($0:U) >>`, + String: `Stmt : id << ast.NewStmt($0e) >>`, Id: "Stmt", NTType: 2, Index: 3, NumSymbols: 1, ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { - return ast.NewStmt(uc(getString(X[0]))) + return ast.NewStmt(unescape(getString(X[0]))) }, }, ProdTabEntry{ - String: `Stmt : Λ μ << ast.CalcResult($2) >>`, + String: `Stmt : μ << ast.CalcResult($2) >>`, Id: "Stmt", NTType: 2, Index: 4, - NumSymbols: 3, + NumSymbols: 2, ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { return ast.CalcResult(X[2]) }, diff --git a/example/ctx/ctx.grammar/ctx/internal/token/token.go b/example/ctx/ctx.grammar/ctx/internal/token/token.go index 5fbcf921..90eeb929 100644 --- a/example/ctx/ctx.grammar/ctx/internal/token/token.go +++ b/example/ctx/ctx.grammar/ctx/internal/token/token.go @@ -79,7 +79,6 @@ var TokMap = TokenMap{ "INVALID", "Ω", "id", - "Λ", "μ", }, @@ -87,11 +86,8 @@ var TokMap = TokenMap{ "INVALID": 0, "Ω": 1, "id": 2, - "Λ": 3, - "μ": 4, + "μ": 3, }, - litMap: map[string]Type{ - "calc": 3, - }, + litMap: map[string]Type{}, } diff --git a/example/ctx/ctx.grammar/ctx/internal/util/rune.go b/example/ctx/ctx.grammar/ctx/internal/util/rune.go index 86fb8395..788edfde 100644 --- a/example/ctx/ctx.grammar/ctx/internal/util/rune.go +++ b/example/ctx/ctx.grammar/ctx/internal/util/rune.go @@ -110,7 +110,7 @@ func (str EscapedString) EscapedFirstCharValue() (rune, int) { } var x uint32 - for ; i > 0 && offset < len(str)-1; i-- { + for ; i > 0 && offset < len(str); i-- { ch, size := utf8.DecodeRuneInString(string(str)[offset:]) offset += size d := uint32(HexDigitValue(ch)) diff --git a/example/ctx/ctx.grammar/ctx/log/LR1_sets.txt b/example/ctx/ctx.grammar/ctx/log/LR1_sets.txt index ab10c28e..b1d9f119 100644 --- a/example/ctx/ctx.grammar/ctx/log/LR1_sets.txt +++ b/example/ctx/ctx.grammar/ctx/log/LR1_sets.txt @@ -3,44 +3,44 @@ S0{ StmtList : •Π «Ω» StmtList : •Π Π «Ω» Stmt : •id «Ω» - Stmt : •Λ μ «Ω» - StmtList : •Π «"calc"» + Stmt : •μ «Ω» + StmtList : •Π «μ» StmtList : •Π «id» - StmtList : •Π Π «"calc"» + StmtList : •Π Π «μ» StmtList : •Π Π «id» - Stmt : •id «"calc"» - Stmt : •Λ μ «"calc"» + Stmt : •id «μ» + Stmt : •μ «μ» Stmt : •id «id» - Stmt : •Λ μ «id» + Stmt : •μ «id» } Transitions: Π -> 1 Π -> 2 id -> 3 - Λ -> 4 + μ -> 4 S1{ S' : Π• «Ω» StmtList : Π •Π «Ω» - StmtList : Π •Π «"calc"» + StmtList : Π •Π «μ» StmtList : Π •Π «id» Stmt : •id «Ω» - Stmt : •Λ μ «Ω» - Stmt : •id «"calc"» - Stmt : •Λ μ «"calc"» + Stmt : •μ «Ω» + Stmt : •id «μ» + Stmt : •μ «μ» Stmt : •id «id» - Stmt : •Λ μ «id» + Stmt : •μ «id» } Transitions: id -> 3 - Λ -> 4 + μ -> 4 Π -> 5 S2{ StmtList : Π• «Ω» - StmtList : Π• «"calc"» + StmtList : Π• «μ» StmtList : Π• «id» } Transitions: @@ -48,34 +48,25 @@ Transitions: S3{ Stmt : id• «Ω» - Stmt : id• «"calc"» + Stmt : id• «μ» Stmt : id• «id» } Transitions: S4{ - Stmt : Λ •μ «Ω» - Stmt : Λ •μ «"calc"» - Stmt : Λ •μ «id» + Stmt : μ• «Ω» + Stmt : μ• «μ» + Stmt : μ• «id» } Transitions: - μ -> 6 S5{ StmtList : Π Π• «Ω» - StmtList : Π Π• «"calc"» + StmtList : Π Π• «μ» StmtList : Π Π• «id» } Transitions: -S6{ - Stmt : Λ μ• «Ω» - Stmt : Λ μ• «"calc"» - Stmt : Λ μ• «id» -} -Transitions: - - diff --git a/example/ctx/ctx.grammar/ctx/log/first.txt b/example/ctx/ctx.grammar/ctx/log/first.txt index 9e2ecb61..e7b13952 100644 --- a/example/ctx/ctx.grammar/ctx/log/first.txt +++ b/example/ctx/ctx.grammar/ctx/log/first.txt @@ -1,12 +1,12 @@ Π: { id - Λ + μ } Π: { id - Λ + μ } Π: { id - Λ + μ } diff --git a/example/ctx/ctx.grammar/ctx/log/lexer_sets.txt b/example/ctx/ctx.grammar/ctx/log/lexer_sets.txt index 8637890e..47526066 100644 --- a/example/ctx/ctx.grammar/ctx/log/lexer_sets.txt +++ b/example/ctx/ctx.grammar/ctx/log/lexer_sets.txt @@ -4,24 +4,19 @@ S0{ !whitespace : ' ' | '\t' | • '\n' | '\r' !whitespace : ' ' | • '\t' | '\n' | '\r' !whitespace : • ' ' | '\t' | '\n' | '\r' - _letter : 'a'-'z' | • 'A'-'Z' - _letter : • 'a'-'z' | 'A'-'Z' - id : (_letter | • '_') {_idchar} - id : (• _letter | '_') {_idchar} - Λ : • 'c' 'a' 'l' 'c' + _x : \u03b1 | (• \u03b2 _digit {_digit}) + _x : • \u03b1 | (\u03b2 _digit {_digit}) + id : • _x {_x0 | _x1 | \u03b3} } Transitions: ['\t','\t'] -> S1 ['\n','\n'] -> S1 ['\r','\r'] -> S1 [' ',' '] -> S1 - ['A','Z'] -> S2 - ['_','_'] -> S3 - ['a','b'] -> S2 - ['c','c'] -> S4 - ['d','z'] -> S2 + [\u03b1,\u03b1] -> S2 + [\u03b2,\u03b2] -> S3 Action: nil -Symbols classes: {['\t','\t'], ['\n','\n'], ['\r','\r'], [' ',' '], ['A','Z'], ['_','_'], ['a','b'], ['c','c'], ['d','z']} +Symbols classes: {['\t','\t'], ['\n','\n'], ['\r','\r'], [' ',' '], [\u03b1,\u03b1], [\u03b2,\u03b2]} S1{ !whitespace : (' ' | '\t' | '\n' | '\r') • @@ -31,186 +26,108 @@ Action: Ignore("!whitespace") Symbols classes: {} S2{ - _digit : • '0'-'9' - _idchar : _letter | _digit | • '_' - _idchar : _letter | • _digit | '_' - _idchar : • _letter | _digit | '_' - _letter : 'a'-'z' | • 'A'-'Z' - _letter : ( 'a'-'z' | 'A'-'Z') • - _letter : • 'a'-'z' | 'A'-'Z' - id : (_letter | '_') {_idchar} • - id : (_letter | '_') {• _idchar} + _x : (\u03b1 | (\u03b2 _digit {_digit})) • + _x0 : • \u03b1 + _x1 : • \u03b2 _digit {_digit} + id : _x {_x0 | _x1 | \u03b3} • + id : _x {_x0 | _x1 | • \u03b3} + id : _x {_x0 | • _x1 | \u03b3} + id : _x {• _x0 | _x1 | \u03b3} } Transitions: - ['0','9'] -> S5 - ['A','Z'] -> S6 - ['_','_'] -> S7 - ['a','z'] -> S6 + [\u03b1,\u03b1] -> S4 + [\u03b2,\u03b2] -> S5 + [\u03b3,\u03b3] -> S6 Action: Accept("id") -Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} +Symbols classes: {[\u03b1,\u03b1], [\u03b2,\u03b2], [\u03b3,\u03b3]} S3{ _digit : • '0'-'9' - _idchar : _letter | _digit | • '_' - _idchar : _letter | • _digit | '_' - _idchar : • _letter | _digit | '_' - _letter : 'a'-'z' | • 'A'-'Z' - _letter : • 'a'-'z' | 'A'-'Z' - id : (_letter | '_') {_idchar} • - id : (_letter | '_') {• _idchar} + _x : \u03b1 | (\u03b2 • _digit {_digit}) + id : • _x {_x0 | _x1 | \u03b3} } Transitions: - ['0','9'] -> S5 - ['A','Z'] -> S6 - ['_','_'] -> S7 - ['a','z'] -> S6 -Action: Accept("id") -Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} + ['0','9'] -> S7 +Action: nil +Symbols classes: {['0','9']} S4{ - _digit : • '0'-'9' - _idchar : _letter | _digit | • '_' - _idchar : _letter | • _digit | '_' - _idchar : • _letter | _digit | '_' - _letter : 'a'-'z' | • 'A'-'Z' - _letter : ( 'a'-'z' | 'A'-'Z') • - _letter : • 'a'-'z' | 'A'-'Z' - id : (_letter | '_') {_idchar} • - id : (_letter | '_') {• _idchar} - Λ : 'c' • 'a' 'l' 'c' + _x0 : \u03b1 • + _x0 : • \u03b1 + _x1 : • \u03b2 _digit {_digit} + id : _x {_x0 | _x1 | \u03b3} • + id : _x {_x0 | _x1 | • \u03b3} + id : _x {_x0 | • _x1 | \u03b3} + id : _x {• _x0 | _x1 | \u03b3} } Transitions: - ['0','9'] -> S5 - ['A','Z'] -> S6 - ['_','_'] -> S7 - ['a','a'] -> S8 - ['b','z'] -> S6 + [\u03b1,\u03b1] -> S4 + [\u03b2,\u03b2] -> S5 + [\u03b3,\u03b3] -> S6 Action: Accept("id") -Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','a'], ['b','z']} +Symbols classes: {[\u03b1,\u03b1], [\u03b2,\u03b2], [\u03b3,\u03b3]} S5{ - _digit : '0'-'9' • _digit : • '0'-'9' - _idchar : (_letter | _digit | '_') • - _idchar : _letter | _digit | • '_' - _idchar : _letter | • _digit | '_' - _idchar : • _letter | _digit | '_' - _letter : 'a'-'z' | • 'A'-'Z' - _letter : • 'a'-'z' | 'A'-'Z' - id : (_letter | '_') {_idchar} • - id : (_letter | '_') {• _idchar} + _x1 : \u03b2 • _digit {_digit} + id : _x {_x0 | • _x1 | \u03b3} } Transitions: - ['0','9'] -> S5 - ['A','Z'] -> S6 - ['_','_'] -> S7 - ['a','z'] -> S6 -Action: Accept("id") -Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} + ['0','9'] -> S8 +Action: nil +Symbols classes: {['0','9']} S6{ - _digit : • '0'-'9' - _idchar : (_letter | _digit | '_') • - _idchar : _letter | _digit | • '_' - _idchar : _letter | • _digit | '_' - _idchar : • _letter | _digit | '_' - _letter : 'a'-'z' | • 'A'-'Z' - _letter : ( 'a'-'z' | 'A'-'Z') • - _letter : • 'a'-'z' | 'A'-'Z' - id : (_letter | '_') {_idchar} • - id : (_letter | '_') {• _idchar} + _x0 : • \u03b1 + _x1 : • \u03b2 _digit {_digit} + id : _x {_x0 | _x1 | \u03b3} • + id : _x {_x0 | _x1 | • \u03b3} + id : _x {_x0 | • _x1 | \u03b3} + id : _x {• _x0 | _x1 | \u03b3} } Transitions: - ['0','9'] -> S5 - ['A','Z'] -> S6 - ['_','_'] -> S7 - ['a','z'] -> S6 + [\u03b1,\u03b1] -> S4 + [\u03b2,\u03b2] -> S5 + [\u03b3,\u03b3] -> S6 Action: Accept("id") -Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} +Symbols classes: {[\u03b1,\u03b1], [\u03b2,\u03b2], [\u03b3,\u03b3]} S7{ + _digit : '0'-'9' • _digit : • '0'-'9' - _idchar : (_letter | _digit | '_') • - _idchar : _letter | _digit | • '_' - _idchar : _letter | • _digit | '_' - _idchar : • _letter | _digit | '_' - _letter : 'a'-'z' | • 'A'-'Z' - _letter : • 'a'-'z' | 'A'-'Z' - id : (_letter | '_') {_idchar} • - id : (_letter | '_') {• _idchar} + _x : (\u03b1 | (\u03b2 _digit {_digit})) • + _x : \u03b1 | (\u03b2 _digit {• _digit}) + _x0 : • \u03b1 + _x1 : • \u03b2 _digit {_digit} + id : _x {_x0 | _x1 | \u03b3} • + id : _x {_x0 | _x1 | • \u03b3} + id : _x {_x0 | • _x1 | \u03b3} + id : _x {• _x0 | _x1 | \u03b3} + id : • _x {_x0 | _x1 | \u03b3} } Transitions: - ['0','9'] -> S5 - ['A','Z'] -> S6 - ['_','_'] -> S7 - ['a','z'] -> S6 + ['0','9'] -> S7 + [\u03b1,\u03b1] -> S4 + [\u03b2,\u03b2] -> S5 + [\u03b3,\u03b3] -> S6 Action: Accept("id") -Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} +Symbols classes: {['0','9'], [\u03b1,\u03b1], [\u03b2,\u03b2], [\u03b3,\u03b3]} S8{ + _digit : '0'-'9' • _digit : • '0'-'9' - _idchar : (_letter | _digit | '_') • - _idchar : _letter | _digit | • '_' - _idchar : _letter | • _digit | '_' - _idchar : • _letter | _digit | '_' - _letter : 'a'-'z' | • 'A'-'Z' - _letter : ( 'a'-'z' | 'A'-'Z') • - _letter : • 'a'-'z' | 'A'-'Z' - id : (_letter | '_') {_idchar} • - id : (_letter | '_') {• _idchar} - Λ : 'c' 'a' • 'l' 'c' -} -Transitions: - ['0','9'] -> S5 - ['A','Z'] -> S6 - ['_','_'] -> S7 - ['a','k'] -> S6 - ['l','l'] -> S9 - ['m','z'] -> S6 -Action: Accept("id") -Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','k'], ['l','l'], ['m','z']} - -S9{ - _digit : • '0'-'9' - _idchar : (_letter | _digit | '_') • - _idchar : _letter | _digit | • '_' - _idchar : _letter | • _digit | '_' - _idchar : • _letter | _digit | '_' - _letter : 'a'-'z' | • 'A'-'Z' - _letter : ( 'a'-'z' | 'A'-'Z') • - _letter : • 'a'-'z' | 'A'-'Z' - id : (_letter | '_') {_idchar} • - id : (_letter | '_') {• _idchar} - Λ : 'c' 'a' 'l' • 'c' + _x0 : • \u03b1 + _x1 : \u03b2 _digit {_digit} • + _x1 : \u03b2 _digit {• _digit} + id : _x {_x0 | _x1 | \u03b3} • + id : _x {_x0 | _x1 | • \u03b3} + id : _x {_x0 | • _x1 | \u03b3} + id : _x {• _x0 | _x1 | \u03b3} } Transitions: - ['0','9'] -> S5 - ['A','Z'] -> S6 - ['_','_'] -> S7 - ['a','b'] -> S6 - ['c','c'] -> S10 - ['d','z'] -> S6 + ['0','9'] -> S8 + [\u03b1,\u03b1] -> S4 + [\u03b3,\u03b3] -> S6 Action: Accept("id") -Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','b'], ['c','c'], ['d','z']} - -S10{ - _digit : • '0'-'9' - _idchar : (_letter | _digit | '_') • - _idchar : _letter | _digit | • '_' - _idchar : _letter | • _digit | '_' - _idchar : • _letter | _digit | '_' - _letter : 'a'-'z' | • 'A'-'Z' - _letter : ( 'a'-'z' | 'A'-'Z') • - _letter : • 'a'-'z' | 'A'-'Z' - id : (_letter | '_') {_idchar} • - id : (_letter | '_') {• _idchar} - Λ : 'c' 'a' 'l' 'c' • -} -Transitions: - ['0','9'] -> S5 - ['A','Z'] -> S6 - ['_','_'] -> S7 - ['a','z'] -> S6 -Action: Accept("Λ") -Symbols classes: {['0','9'], ['A','Z'], ['_','_'], ['a','z']} +Symbols classes: {['0','9'], [\u03b1,\u03b1], [\u03b3,\u03b3]} diff --git a/example/ctx/ctx.grammar/ctx/log/terminals.txt b/example/ctx/ctx.grammar/ctx/log/terminals.txt index cf81f3c5..bc6b9081 100644 --- a/example/ctx/ctx.grammar/ctx/log/terminals.txt +++ b/example/ctx/ctx.grammar/ctx/log/terminals.txt @@ -1,5 +1,4 @@ ά Ω id -"calc" μ diff --git a/example/ctx/ctx1.bnf b/example/ctx/ctx1.bnf new file mode 100644 index 00000000..b6a354ed --- /dev/null +++ b/example/ctx/ctx1.bnf @@ -0,0 +1,45 @@ +/* Lexical elements */ + +_digit : '0'-'9' ; +_letter : 'a'-'z' | 'A'-'Z' | ( '\\' 'u' _hex { _hex } ) ; +_hex : _digit | ( 'a'-'f' ) | ('A' - 'F') ; +_idchar : _letter | _digit | '_'; + +_x0 : 'α' ; +_x1 : 'β' _digit { _digit } ; +_x : 'α' | ( 'β' _digit { _digit } ); +_test : _x { _x | 'γ' } ; + +//id : (_letter | '_') {_idchar} ; + +id: +/* + (_letter | '_') {_idchar} + ('a'-'z' | 'A'-'Z' | ( '\\' 'u' _hex { _hex } ) | '_') + { ('a'-'z' | 'A'-'Z' | ( '\\' 'u' _hex { _hex } ) | '_') | _digit } +*/ + _x { _x0 | ( 'β' _digit { _digit } ) | 'γ' } +; + +!whitespace : ' ' | '\t' | '\n' | '\r' ; + +/* Syntax elements */ + +<< + import ( + "github.com/maxcalandrelli/gocc/example/ctx/ast" + ) +>> + +StmtList : + Stmt << ast.NewStmtList($0s) >> + | StmtList Stmt << ast.AppendStmt($0.(ast.StmtList), $1s) >> +; + +Stmt : + id << ast.NewStmt($0e) >> + | + @ "github.com/maxcalandrelli/gocc/example/calc/calc.grammar/calc" + << ast.CalcResult($2) >> + +; diff --git a/example/ctx/ctx1.grammar/ctx1/ctx1.go b/example/ctx/ctx1.grammar/ctx1/ctx1.go new file mode 100644 index 00000000..3d02c074 --- /dev/null +++ b/example/ctx/ctx1.grammar/ctx1/ctx1.go @@ -0,0 +1,131 @@ +// Code generated by gocc; DO NOT EDIT. + +package ctx1 + +import ( + "io" + + "github.com/maxcalandrelli/gocc/example/ctx/ctx1.grammar/ctx1/internal/errors" + "github.com/maxcalandrelli/gocc/example/ctx/ctx1.grammar/ctx1/internal/lexer" + "github.com/maxcalandrelli/gocc/example/ctx/ctx1.grammar/ctx1/internal/parser" + "github.com/maxcalandrelli/gocc/example/ctx/ctx1.grammar/ctx1/internal/token" +) + +const ( + INVALID = token.INVALID + EOF = token.EOF +) + +type ( + Token = token.Token + TokenMap = token.TokenMap + Pos = token.Pos + ErrorSymbol = errors.ErrorSymbol + Error = errors.Error + Lexer = lexer.Lexer + Parser = parser.Parser +) + +func NewParser() *parser.Parser { + return parser.NewParser() +} + +func ParseFile(fpath string) (interface{}, error) { + if lexer, err := NewLexerFile(fpath); err == nil { + return NewParser().Parse(lexer) + } else { + return nil, err + } +} + +func ParseText(text string) (interface{}, error) { + return NewParser().Parse(NewLexerBytes([]byte(text))) +} + +func Parse(stream io.Reader) (interface{}, error) { + lex, err := NewLexer(stream) + if lex == nil { + return nil, err + } + return NewParser().Parse(lex) +} + +func ParseFileWithData(fpath string, userData interface{}) (interface{}, error) { + if lexer, err := NewLexerFile(fpath); err == nil { + return NewParser().SetContext(userData).Parse(lexer) + } else { + return nil, err + } +} + +func ParseTextWithData(text string, userData interface{}) (interface{}, error) { + return NewParser().SetContext(userData).Parse(NewLexerBytes([]byte(text))) +} + +func ParseWithData(stream io.Reader, userData interface{}) (interface{}, error) { + lex, err := NewLexer(stream) + if lex == nil { + return nil, err + } + return NewParser().SetContext(userData).Parse(lex) +} + +func ParseFilePartial(fpath string) (interface{}, error, []byte) { + if lexer, err := NewLexerFile(fpath); err == nil { + return NewParser().ParseLongestPrefix(lexer) + } else { + return nil, err, []byte{} + } +} + +func ParseTextPartial(text string) (interface{}, error, []byte) { + return NewParser().ParseLongestPrefix(NewLexerBytes([]byte(text))) +} + +func ParsePartial(stream io.Reader) (interface{}, error, []byte) { + lex, err := NewLexer(stream) + if lex == nil { + return nil, err, []byte{} + } + return NewParser().ParseLongestPrefix(lex) +} + +func ParseFileWithDataPartial(fpath string, userData interface{}) (interface{}, error, []byte) { + if lexer, err := NewLexerFile(fpath); err == nil { + return NewParser().SetContext(userData).ParseLongestPrefix(lexer) + } else { + return nil, err, []byte{} + } +} + +func ParseTextWithDataPartial(text string, userData interface{}) (interface{}, error, []byte) { + return NewParser().SetContext(userData).ParseLongestPrefix(NewLexerBytes([]byte(text))) +} + +func ParseWithDataPartial(stream io.Reader, userData interface{}) (interface{}, error, []byte) { + lex, err := NewLexer(stream) + if lex == nil { + return nil, err, []byte{} + } + return NewParser().SetContext(userData).ParseLongestPrefix(lex) +} + +func NewLexerBytes(src []byte) *lexer.Lexer { + return lexer.NewLexerBytes(src) +} + +func NewLexerString(src string) *lexer.Lexer { + return lexer.NewLexerBytes([]byte(src)) +} + +func NewLexerFile(fpath string) (*lexer.Lexer, error) { + return lexer.NewLexerFile(fpath) +} + +func NewLexer(reader io.Reader) (*lexer.Lexer, error) { + return lexer.NewLexer(reader) +} + +func GetTokenMap() TokenMap { + return token.TokMap +} diff --git a/example/ctx/ctx1.grammar/ctx1/iface/ctx1.go b/example/ctx/ctx1.grammar/ctx1/iface/ctx1.go new file mode 100644 index 00000000..a64bdf9f --- /dev/null +++ b/example/ctx/ctx1.grammar/ctx1/iface/ctx1.go @@ -0,0 +1,63 @@ +// Code generated by gocc; DO NOT EDIT. + +package iface + +import ( + "github.com/maxcalandrelli/gocc/example/ctx/ctx1.grammar/ctx1/internal/errors" + "github.com/maxcalandrelli/gocc/example/ctx/ctx1.grammar/ctx1/internal/io/stream" + "github.com/maxcalandrelli/gocc/example/ctx/ctx1.grammar/ctx1/internal/token" + "io" +) + +type ( + Token = token.Token + TokenMap = token.TokenMap + Pos = token.Pos + ErrorSymbol = errors.ErrorSymbol + Error = errors.Error + + Scanner interface { + Scan() (tok *Token) + } + + StreamScanner interface { + GetStream() TokenStream + } + + CheckPoint interface { + DistanceFrom(CheckPoint) int + Advance(int) CheckPoint + } + + CheckPointable interface { + GetCheckPoint() CheckPoint + GotoCheckPoint(CheckPoint) + } + + TokenStream interface { + io.Reader + io.RuneScanner + io.Seeker + } +) + +const ( + INVALID = token.INVALID + EOF = token.EOF +) + +func GetTokenMap() TokenMap { + return token.TokMap +} + +func NewWindowReaderFromBytes(src []byte) stream.WindowReader { + return stream.NewWindowReaderFromBytes(src) +} + +func NewWindowReader(rdr io.Reader) stream.WindowReader { + return stream.NewWindowReader(rdr) +} + +func NewLimitedWindowReader(rdr io.Reader, sizeMin, sizeMax int) stream.WindowReader { + return stream.NewLimitedWindowReader(rdr, sizeMin, sizeMax) +} diff --git a/example/ctx/ctx1.grammar/ctx1/internal/errors/errors.go b/example/ctx/ctx1.grammar/ctx1/internal/errors/errors.go new file mode 100644 index 00000000..5e554168 --- /dev/null +++ b/example/ctx/ctx1.grammar/ctx1/internal/errors/errors.go @@ -0,0 +1,56 @@ +// Code generated by gocc; DO NOT EDIT. + +package errors + +import ( + "fmt" + "strings" + + "github.com/maxcalandrelli/gocc/example/ctx/ctx1.grammar/ctx1/internal/token" +) + +type ErrorSymbol interface { +} + +type Error struct { + Err error + ErrorToken *token.Token + ErrorSymbols []ErrorSymbol + ExpectedTokens []string + StackTop int +} + +func (e *Error) String() string { + w := new(strings.Builder) + fmt.Fprintf(w, "Error") + if e.Err != nil { + fmt.Fprintf(w, " %s\n", e.Err) + } else { + fmt.Fprintf(w, "\n") + } + fmt.Fprintf(w, "Token: type=%d, lit=%s\n", e.ErrorToken.Type, e.ErrorToken.Lit) + fmt.Fprintf(w, "Pos: offset=%d, line=%d, column=%d\n", e.ErrorToken.Pos.Offset, e.ErrorToken.Pos.Line, e.ErrorToken.Pos.Column) + fmt.Fprintf(w, "Expected one of: ") + for _, sym := range e.ExpectedTokens { + fmt.Fprintf(w, "%s ", sym) + } + fmt.Fprintf(w, "ErrorSymbol:\n") + for _, sym := range e.ErrorSymbols { + fmt.Fprintf(w, "%v\n", sym) + } + return w.String() +} + +func (e *Error) Error() string { + w := new(strings.Builder) + fmt.Fprintf(w, "Error in S%d: %s, %s", e.StackTop, token.TokMap.TokenString(e.ErrorToken), e.ErrorToken.Pos.String()) + if e.Err != nil { + fmt.Fprintf(w, ": %+v", e.Err) + } else { + fmt.Fprintf(w, ", expected one of: ") + for _, expected := range e.ExpectedTokens { + fmt.Fprintf(w, "%s ", expected) + } + } + return w.String() +} diff --git a/example/ctx/ctx1.grammar/ctx1/internal/io/stream/internal/stream_impl.go b/example/ctx/ctx1.grammar/ctx1/internal/io/stream/internal/stream_impl.go new file mode 100644 index 00000000..358aa160 --- /dev/null +++ b/example/ctx/ctx1.grammar/ctx1/internal/io/stream/internal/stream_impl.go @@ -0,0 +1,275 @@ +package internal + +import ( + "io" + "sync" + "unicode/utf8" +) + +type ( + impl_WindowReader struct { + bufferBlockSize int + maxBufferSize int + buffers [][]byte + available int + absbase int64 + position int + eof bool + rdr io.Reader + lock *sync.Mutex + } +) + +func (s *impl_WindowReader) lockReader() { + if s.lock != nil { + s.lock.Lock() + } +} + +func (s *impl_WindowReader) unlockReader() { + if s.lock != nil { + s.lock.Unlock() + } +} + +func (s *impl_WindowReader) seek(offset int64, whence int) (offs int64, err error) { + switch whence { + case io.SeekStart: + return s.seek(offset-s.ReadPosition(), io.SeekCurrent) + case io.SeekCurrent: + switch { + case offset == 0: + return s.ReadPosition(), nil + case offset < 0: + if -offset > int64(s.maxBackOffset()) { + err = io.ErrShortBuffer + } else { + s.advanceGet(int(offset)) + } + case offset > 0: + for offset > 0 && !s.eof { + available := s.Buffered() + if offset <= int64(available) { + s.advanceGet(int(offset)) + break + } + if available > 0 { + s.advanceGet(available) + offset -= int64(available) + } + read, _ := s.fetchBytes(int(offset)) + s.advanceGet(read) + offset -= int64(read) + } + if s.eof { + err = io.EOF + } + } + case io.SeekEnd: + for !s.eof { + s.seek(int64(s.MaxCap()), io.SeekCurrent) + } + s.seek(int64(s.Buffered()), io.SeekCurrent) + } + if s.eof && err == nil && s.Buffered() > 0 { + s.eof = false + } + return s.ReadPosition(), err +} + +func (s impl_WindowReader) maxBackOffset() int { + r := s.position + if s.absbase > 0 { + r = s.Cap() - s.Buffered() + } + return r +} + +func (s impl_WindowReader) bufferIndex(pos int) int { + if pos < 0 { + panic("negative position") + } + return pos / s.bufferBlockSize +} + +func (s impl_WindowReader) bufferBytes(pos int) []byte { + return s.buffers[s.bufferIndex(pos)] +} + +func (s impl_WindowReader) bufferByteRange(pos int, length int) []byte { + p := s.bufferOffset(pos) + return s.bufferBytes(pos)[p : p+length] +} + +func (s impl_WindowReader) bufferOffset(pos int) int { + return pos % s.bufferBlockSize +} + +func (s *impl_WindowReader) advanceGet(n int) { + sz := s.Cap() + switch { + case n < 0: + if -n > s.maxBackOffset() { + panic("underflow") + } + s.position += n + if s.position < 0 { + s.position += sz + s.absbase -= int64(sz) + } + case n > 0: + if n > s.Buffered() { + panic("overflow") + } + s.position += n + if s.position >= sz { + s.position -= sz + s.absbase += int64(sz) + } + } + s.available -= n +} + +func (s *impl_WindowReader) copy(to []byte, length int) { + for offs, cp := 0, 0; length > 0; length -= cp { + s.position %= s.MaxCap() + p := s.bufferOffset(s.position) + b := s.bufferBytes(s.position) + r := s.bufferBlockSize - p + if length <= r { + cp = copy(to[offs:], b[p:p+length]) + } else { + cp = copy(to[offs:], b[p:]) + } + s.advanceGet(cp) + offs += cp + } +} + +func (s *impl_WindowReader) fetchBytes(n int) (read int, err error) { + if s.rdr == nil { + s.eof = true + return 0, io.EOF + } + for n > 0 && s.Buffered() < s.MaxCap() && err == nil { + readNow := n + putpos := s.position + s.available + r := s.bufferBlockSize - s.bufferOffset(putpos) + if readNow > r { + readNow = r + } + for s.bufferIndex(putpos) >= len(s.buffers) && s.Cap() < s.MaxCap() { + s.buffers = append(s.buffers, make([]byte, s.bufferBlockSize)) + } + putpos %= s.MaxCap() + offs := s.bufferOffset(putpos) + if r, err = s.rdr.Read(s.bufferBytes(putpos)[offs : offs+readNow]); r > 0 { + s.available += r + read += r + n -= r + } + } + if n > 0 && err == nil { + err = io.ErrShortBuffer + } + return +} + +func (s *impl_WindowReader) read(p []byte) (read int, err error) { + if s.eof { + return 0, io.EOF + } + for read < len(p) && err == nil { + available := s.Buffered() + if len(p)-read <= available { + s.copy(p[read:], len(p)-read) + read = len(p) + } else { + if available == 0 { + available, err = s.fetchBytes(len(p) - read) + } + s.copy(p[read:], available) + read += available + switch err { + case io.ErrShortBuffer: + err = nil + case io.EOF: + s.eof = true + } + } + } + return +} + +func (s impl_WindowReader) peekByte() (byte, error) { + if s.Buffered() < 1 { + return 0, io.ErrShortBuffer + } + return s.bufferBytes(s.position)[s.bufferOffset(s.position)], nil +} + +func (s *impl_WindowReader) unreadByte() error { + _, e := s.seek(-1, io.SeekCurrent) + return e +} + +func (s *impl_WindowReader) readRune() (r rune, size int, err error) { + for i := 1; err == nil && i <= 4; i++ { + if s.Buffered() < i { + if _, err = s.fetchBytes(i); err != nil { + return + } + } + t := s.bufferByteRange(s.position, i) + if r, size = utf8.DecodeRune(t); r != utf8.RuneError { + s.advanceGet(size) + return + } + } + return utf8.RuneError, 0, err +} + +func (s *impl_WindowReader) unreadRune() (err error) { + tmps := *s + tmpb := []byte{} + for { + if _, err = tmps.seek(-1, io.SeekCurrent); err == nil { + b, _ := tmps.peekByte() + tmpb = append([]byte{b}, tmpb...) + switch len(tmpb) { + case 1: + if (tmpb[0] & 0xC0) == 0x80 { + continue + } + _, err = s.seek(-int64(len(tmpb)), io.SeekCurrent) + return + case 2: + if (tmpb[0] & 0xC0) == 0x80 { + continue + } + if (tmpb[0] & 0xE0) != 0xC0 { + break + } + _, err = s.seek(-int64(len(tmpb)), io.SeekCurrent) + return + case 3: + if (tmpb[0] & 0xC0) == 0x80 { + continue + } + if (tmpb[0] & 0xF0) != 0xE0 { + break + } + _, err = s.seek(-int64(len(tmpb)), io.SeekCurrent) + return + case 4: + if (tmpb[0] & 0xF8) != 0xF0 { + break + } + _, err = s.seek(-int64(len(tmpb)), io.SeekCurrent) + return + } + } + } + _, err = s.seek(-1, io.SeekCurrent) + return +} diff --git a/example/ctx/ctx1.grammar/ctx1/internal/io/stream/internal/stream_public.go b/example/ctx/ctx1.grammar/ctx1/internal/io/stream/internal/stream_public.go new file mode 100644 index 00000000..20ed7b5e --- /dev/null +++ b/example/ctx/ctx1.grammar/ctx1/internal/io/stream/internal/stream_public.go @@ -0,0 +1,101 @@ +package internal + +import ( + "io" +) + +func NewWindowReader(buf []byte, underlyingReader io.Reader, blksize, smax int, InfoPrefixRoundUp bool) *impl_WindowReader { + if blksize < 0 || smax < blksize { + panic("illegal buffer size") + } + r := &impl_WindowReader{rdr: underlyingReader} + r.bufferBlockSize = blksize + if underlyingReader != nil { + if blksize <= 0 { + r.bufferBlockSize = 1 << 10 + } else if InfoPrefixRoundUp { + for r.bufferBlockSize = 1; blksize > 0; r.bufferBlockSize = r.bufferBlockSize << 1 { + blksize = blksize >> 1 + } + } + if smax > 0 { + r.maxBufferSize = ((smax-1)/r.bufferBlockSize + 1) * r.bufferBlockSize + } + r.buffers = [][]byte{} + } else { + r.buffers = [][]byte{buf} + r.available = len(buf) + r.bufferBlockSize = r.available + r.maxBufferSize = r.available + } + return r +} + +func (s impl_WindowReader) Cap() int { + return len(s.buffers) * s.bufferBlockSize +} + +func (s impl_WindowReader) BlockSize() int { + return s.bufferBlockSize +} + +func (s impl_WindowReader) MaxCap() int { + if s.maxBufferSize > 0 { + return s.maxBufferSize + } + return 1 << 31 +} + +func (s impl_WindowReader) MaxUnreadSize() int { + return s.maxBackOffset() +} + +func (s impl_WindowReader) Buffered() int { + return s.available +} + +func (s impl_WindowReader) ReadPosition() int64 { + return s.absbase + int64(s.position) +} + +func (s *impl_WindowReader) Read(p []byte) (read int, err error) { + s.lockReader() + defer func() { s.unlockReader() }() + return s.read(p) +} + +func (s *impl_WindowReader) Seek(offset int64, whence int) (offs int64, err error) { + s.lockReader() + defer func() { s.unlockReader() }() + return s.seek(offset, whence) +} + +func (s *impl_WindowReader) ReadByte() (byte, error) { + b := []byte{0} + _, err := s.Read(b) + return b[0], err +} + +func (s *impl_WindowReader) PeekByte() (byte, error) { + s.lockReader() + defer func() { s.unlockReader() }() + return s.peekByte() +} + +func (s *impl_WindowReader) UnreadByte() error { + s.lockReader() + defer func() { s.unlockReader() }() + return s.unreadByte() +} + +func (s *impl_WindowReader) ReadRune() (r rune, size int, err error) { + s.lockReader() + defer func() { s.unlockReader() }() + return s.readRune() +} + +func (s *impl_WindowReader) UnreadRune() (err error) { + s.lockReader() + defer func() { s.unlockReader() }() + return s.unreadRune() +} diff --git a/example/ctx/ctx1.grammar/ctx1/internal/io/stream/stream.go b/example/ctx/ctx1.grammar/ctx1/internal/io/stream/stream.go new file mode 100644 index 00000000..59cfe77d --- /dev/null +++ b/example/ctx/ctx1.grammar/ctx1/internal/io/stream/stream.go @@ -0,0 +1,39 @@ +package stream + +import ( + internal "github.com/maxcalandrelli/gocc/example/ctx/ctx1.grammar/ctx1/internal/io/stream/internal" + "io" +) + +type ( + WindowReader interface { + BlockSize() int + Buffered() int + Cap() int + MaxCap() int + Read([]byte) (int, error) + ReadByte() (byte, error) + ReadPosition() int64 + ReadRune() (rune, int, error) + Seek(int64, int) (int64, error) + UnreadByte() error + UnreadRune() error + MaxUnreadSize() int + } +) + +var ( + InfoPrefixRoundUp = false +) + +func NewWindowReaderFromBytes(src []byte) WindowReader { + return internal.NewWindowReader(src, nil, 0, 0, InfoPrefixRoundUp) +} + +func NewWindowReader(rdr io.Reader) WindowReader { + return internal.NewWindowReader(nil, rdr, 0, 0, false) +} + +func NewLimitedWindowReader(rdr io.Reader, sizeMin, sizeMax int) WindowReader { + return internal.NewWindowReader(nil, rdr, sizeMin, sizeMax, InfoPrefixRoundUp) +} diff --git a/example/ctx/ctx1.grammar/ctx1/internal/lexer/acttab.go b/example/ctx/ctx1.grammar/ctx1/internal/lexer/acttab.go new file mode 100644 index 00000000..a6be1878 --- /dev/null +++ b/example/ctx/ctx1.grammar/ctx1/internal/lexer/acttab.go @@ -0,0 +1,59 @@ +// Code generated by gocc; DO NOT EDIT. + +package lexer + +import ( + "fmt" + + "github.com/maxcalandrelli/gocc/example/ctx/ctx1.grammar/ctx1/internal/token" +) + +type ActionTable [NumStates]ActionRow + +type ActionRow struct { + Accept token.Type + Ignore string +} + +func (a ActionRow) String() string { + return fmt.Sprintf("Accept=%d, Ignore=%s", a.Accept, a.Ignore) +} + +var ActTab = ActionTable{ + ActionRow{ // S0, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S1, Ignore("!whitespace") + Accept: -1, + Ignore: "!whitespace", + }, + ActionRow{ // S2, Accept("id") + Accept: 2, + Ignore: "", + }, + ActionRow{ // S3, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S4, Accept("id") + Accept: 2, + Ignore: "", + }, + ActionRow{ // S5, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S6, Accept("id") + Accept: 2, + Ignore: "", + }, + ActionRow{ // S7, Accept("id") + Accept: 2, + Ignore: "", + }, + ActionRow{ // S8, Accept("id") + Accept: 2, + Ignore: "", + }, +} diff --git a/example/ctx/ctx1.grammar/ctx1/internal/lexer/lexer.go b/example/ctx/ctx1.grammar/ctx1/internal/lexer/lexer.go new file mode 100644 index 00000000..3d40a8fb --- /dev/null +++ b/example/ctx/ctx1.grammar/ctx1/internal/lexer/lexer.go @@ -0,0 +1,174 @@ +// Code generated by gocc; DO NOT EDIT. + +package lexer + +import ( + + "io" + "bytes" + "os" + + + "github.com/maxcalandrelli/gocc/example/ctx/ctx1.grammar/ctx1/iface" + "github.com/maxcalandrelli/gocc/example/ctx/ctx1.grammar/ctx1/internal/token" + "github.com/maxcalandrelli/gocc/example/ctx/ctx1.grammar/ctx1/internal/io/stream" +) + +const ( + NoState = -1 + NumStates = 9 + NumSymbols = 20 + INVALID_RUNE = rune(-1) +) + +type position struct { + token.Pos +} + +type Lexer struct { + position + stream iface.TokenStream + eof bool +} + +func NewLexerBytes(src []byte) *Lexer { + lexer := &Lexer{stream: bytes.NewReader(src)} + lexer.reset() + return lexer +} + +func NewLexerString(src string) *Lexer { + return NewLexerBytes([]byte(src)) +} + +func NewLexerFile(fpath string) (*Lexer, error) { + s, err := os.Open(fpath) + if err != nil { + return nil, err + } + lexer := &Lexer{stream: stream.NewWindowReader(s)} + lexer.reset() + return lexer, nil +} + +func NewLexer(reader io.Reader) (*Lexer, error) { + lexer := &Lexer{} + lexer.reset() + if lexer.stream, _ = reader.(iface.TokenStream); lexer.stream == nil { + lexer.stream = stream.NewWindowReader(reader) + } + return lexer, nil +} + +func (l *Lexer) reset () { + l.position.Reset() +} + +func (l Lexer) GetStream() iface.TokenStream { + return l.stream +} + +type checkPoint int64 + +func (c checkPoint) value () int64 { + return int64(c) +} + +func (c checkPoint) DistanceFrom (o iface.CheckPoint) int { + return int (c.value() - o.(checkPoint).value()) +} + +func (c checkPoint) Advance (o int) iface.CheckPoint { + return checkPoint(c.value() + int64(o)) +} + +func (l *Lexer) GetCheckPoint() iface.CheckPoint { + if l == nil { + return checkPoint(0) + } + pos, _ := l.stream.Seek(0, io.SeekCurrent) + return checkPoint(pos) +} + +func (l Lexer) GotoCheckPoint(cp iface.CheckPoint) { + l.stream.Seek(int64(cp.(checkPoint)), io.SeekStart) +} + +func (l *Lexer) Scan() (tok *token.Token) { + tok = new(token.Token) + tok.Type = token.INVALID + start := l.position + state := 0 + for state != -1 { + savePos := l.position.Pos + curr, size, err := l.stream.ReadRune() + if size < 1 || err != nil { + curr = INVALID_RUNE + } + if size > 0 { + l.position.Pos.Offset += size + } + nextState := -1 + if curr != INVALID_RUNE { + nextState = TransTab[state](curr) + } + state = nextState + if state != -1 { + switch curr { + case '\n': + l.position.Pos.Line++ + l.position.Pos.Column = 1 + case '\r': + l.position.Pos.Column = 1 + case '\t': + l.position.Pos.Column += 4 + default: + l.position.Pos.Column++ + } + switch { + case ActTab[state].Accept != -1: + tok.Type = ActTab[state].Accept + tok.Lit = append(tok.Lit, string(curr)...) + case ActTab[state].Ignore != "": + start = l.position + state = 0 + tok.Lit = []byte{} + tok.IgnoredPrefix=append(tok.IgnoredPrefix,string(curr)...) + } + } else if curr != INVALID_RUNE{ + if len(tok.Lit) == 0 { + tok.Lit = append(tok.Lit, string(curr)...) + } else { + l.stream.UnreadRune() + l.position.Pos = savePos + } + } + if err == io.EOF && len(tok.Lit)==0 { + tok.Type = token.EOF + tok.Pos = start.Pos + return + } + } + tok.Pos = start.Pos + return +} + +func (l *Lexer) Reset() { + l.position.Reset() +} + +func (l Lexer) CurrentPosition() position { + return l.position +} + +func (p *position) Reset() { + p.Offset = 0 + p.Line = 1 + p.Column = 1 +} + +func (p position) StartingFrom(base position) position { + r := p + r.Pos = p.Pos.StartingFrom(base.Pos) + return r +} diff --git a/example/ctx/ctx1.grammar/ctx1/internal/lexer/transitiontable.go b/example/ctx/ctx1.grammar/ctx1/internal/lexer/transitiontable.go new file mode 100644 index 00000000..dc68141f --- /dev/null +++ b/example/ctx/ctx1.grammar/ctx1/internal/lexer/transitiontable.go @@ -0,0 +1,117 @@ +// Code generated by gocc; DO NOT EDIT. + +package lexer + +/* +Let s be the current state +Let r be the current input rune +transitionTable[s](r) returns the next state. +*/ +type TransitionTable [NumStates]func(rune) int + +var TransTab = TransitionTable{ + // S0 + func(r rune) int { + switch { + case r == 9: // ['\t','\t'] + return 1 + case r == 10: // ['\n','\n'] + return 1 + case r == 13: // ['\r','\r'] + return 1 + case r == 32: // [' ',' '] + return 1 + case r == 945: // [\u03b1,\u03b1] + return 2 + case r == 946: // [\u03b2,\u03b2] + return 3 + } + return NoState + }, + // S1 + func(r rune) int { + switch { + } + return NoState + }, + // S2 + func(r rune) int { + switch { + case r == 945: // [\u03b1,\u03b1] + return 4 + case r == 946: // [\u03b2,\u03b2] + return 5 + case r == 947: // [\u03b3,\u03b3] + return 6 + } + return NoState + }, + // S3 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 7 + } + return NoState + }, + // S4 + func(r rune) int { + switch { + case r == 945: // [\u03b1,\u03b1] + return 4 + case r == 946: // [\u03b2,\u03b2] + return 5 + case r == 947: // [\u03b3,\u03b3] + return 6 + } + return NoState + }, + // S5 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 8 + } + return NoState + }, + // S6 + func(r rune) int { + switch { + case r == 945: // [\u03b1,\u03b1] + return 4 + case r == 946: // [\u03b2,\u03b2] + return 5 + case r == 947: // [\u03b3,\u03b3] + return 6 + } + return NoState + }, + // S7 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 7 + case r == 945: // [\u03b1,\u03b1] + return 4 + case r == 946: // [\u03b2,\u03b2] + return 5 + case r == 947: // [\u03b3,\u03b3] + return 6 + } + return NoState + }, + // S8 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 8 + case r == 945: // [\u03b1,\u03b1] + return 4 + case r == 946: // [\u03b2,\u03b2] + return 5 + case r == 947: // [\u03b3,\u03b3] + return 6 + } + return NoState + }, +} diff --git a/example/ctx/ctx1.grammar/ctx1/internal/parser/action.go b/example/ctx/ctx1.grammar/ctx1/internal/parser/action.go new file mode 100644 index 00000000..54bc55e9 --- /dev/null +++ b/example/ctx/ctx1.grammar/ctx1/internal/parser/action.go @@ -0,0 +1,51 @@ +// Code generated by gocc; DO NOT EDIT. + +package parser + +import ( + "fmt" +) + +type action interface { + act() + String() string +} + +type ( + accept bool + shift int // value is next state index + reduce int // value is production index +) + +func (this accept) act() {} +func (this shift) act() {} +func (this reduce) act() {} + +func (this accept) Equal(that action) bool { + if _, ok := that.(accept); ok { + return true + } + return false +} + +func (this reduce) Equal(that action) bool { + that1, ok := that.(reduce) + if !ok { + return false + } + return this == that1 +} + +func (this shift) Equal(that action) bool { + that1, ok := that.(shift) + if !ok { + return false + } + return this == that1 +} + +func (this accept) String() string { return "accept(0)" } +func (this shift) String() string { return fmt.Sprintf("shift:%d", this) } +func (this reduce) String() string { + return fmt.Sprintf("reduce:%d(%s)", this, productionsTable[this].String) +} diff --git a/example/ctx/ctx1.grammar/ctx1/internal/parser/actiontable.go b/example/ctx/ctx1.grammar/ctx1/internal/parser/actiontable.go new file mode 100644 index 00000000..c3f71e31 --- /dev/null +++ b/example/ctx/ctx1.grammar/ctx1/internal/parser/actiontable.go @@ -0,0 +1,89 @@ +// Code generated by gocc; DO NOT EDIT. + +package parser + +type ( + actionTable [numStates]actionRow + cdFunc func(TokenStream, interface{}) (interface{}, error, []byte) + cdAction struct { + tokenIndex int + tokenScanner cdFunc + } + actionRow struct { + canRecover bool + actions [numSymbols]action + cdActions []cdAction + } + actions struct { + table actionTable + } +) + +var parserActions = actions{ + table: actionTable{ + actionRow{ // S0 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + shift(3), // id + shift(4), // μ + }, + cdActions: []cdAction{ + cdAction{tokenIndex: 3, tokenScanner: cdFunc_calc_0}, + }, + }, + actionRow{ // S1 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + accept(true), // Ω + shift(3), // id + shift(4), // μ + }, + cdActions: []cdAction{ + cdAction{tokenIndex: 3, tokenScanner: cdFunc_calc_0}, + }, + }, + actionRow{ // S2 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(1), // Ω, reduce: StmtList + reduce(1), // id, reduce: StmtList + reduce(1), // μ, reduce: StmtList + }, + cdActions: []cdAction{}, + }, + actionRow{ // S3 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(3), // Ω, reduce: Stmt + reduce(3), // id, reduce: Stmt + reduce(3), // μ, reduce: Stmt + }, + cdActions: []cdAction{}, + }, + actionRow{ // S4 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(4), // Ω, reduce: Stmt + reduce(4), // id, reduce: Stmt + reduce(4), // μ, reduce: Stmt + }, + cdActions: []cdAction{}, + }, + actionRow{ // S5 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(2), // Ω, reduce: StmtList + reduce(2), // id, reduce: StmtList + reduce(2), // μ, reduce: StmtList + }, + cdActions: []cdAction{}, + }, + }, +} diff --git a/example/ctx/ctx1.grammar/ctx1/internal/parser/gototable.go b/example/ctx/ctx1.grammar/ctx1/internal/parser/gototable.go new file mode 100644 index 00000000..443ec029 --- /dev/null +++ b/example/ctx/ctx1.grammar/ctx1/internal/parser/gototable.go @@ -0,0 +1,43 @@ +// Code generated by gocc; DO NOT EDIT. + +package parser + +const numNTSymbols = 3 + +type ( + gotoTable [numStates]gotoRow + gotoRow [numNTSymbols]int +) + +var gotoTab = gotoTable{ + gotoRow{ // S0 + -1, // Π + 1, // Π + 2, // Π + }, + gotoRow{ // S1 + -1, // Π + -1, // Π + 5, // Π + }, + gotoRow{ // S2 + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S3 + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S4 + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S5 + -1, // Π + -1, // Π + -1, // Π + }, +} diff --git a/example/ctx/ctx1.grammar/ctx1/internal/parser/parser.go b/example/ctx/ctx1.grammar/ctx1/internal/parser/parser.go new file mode 100644 index 00000000..5a677a80 --- /dev/null +++ b/example/ctx/ctx1.grammar/ctx1/internal/parser/parser.go @@ -0,0 +1,359 @@ +// Code generated by gocc; DO NOT EDIT. + +package parser + +import ( + "errors" + "fmt" + "strings" + + "github.com/maxcalandrelli/gocc/example/ctx/ctx1.grammar/ctx1/iface" + parseError "github.com/maxcalandrelli/gocc/example/ctx/ctx1.grammar/ctx1/internal/errors" + "github.com/maxcalandrelli/gocc/example/ctx/ctx1.grammar/ctx1/internal/token" + + calc "github.com/maxcalandrelli/gocc/example/calc/calc.grammar/calc" +) + +const ( + numProductions = 5 + numStates = 6 + numSymbols = 7 +) + +// Stack + +type stack struct { + state []int + attrib []Attrib +} + +const INITIAL_STACK_SIZE = 100 + +func newStack() *stack { + return &stack{ + state: make([]int, 0, INITIAL_STACK_SIZE), + attrib: make([]Attrib, 0, INITIAL_STACK_SIZE), + } +} + +func (s *stack) reset() { + s.state = s.state[:0] + s.attrib = s.attrib[:0] +} + +func (s *stack) push(state int, a Attrib) { + s.state = append(s.state, state) + s.attrib = append(s.attrib, a) +} + +func (s *stack) top() int { + return s.state[len(s.state)-1] +} + +func (s *stack) peek(pos int) int { + return s.state[pos] +} + +func (s *stack) topIndex() int { + return len(s.state) - 1 +} + +func (s *stack) popN(items int) []Attrib { + lo, hi := len(s.state)-items, len(s.state) + + attrib := s.attrib[lo:hi] + + s.state = s.state[:lo] + s.attrib = s.attrib[:lo] + + return attrib +} + +func (s *stack) String() string { + w := new(strings.Builder) + fmt.Fprintf(w, "stack:\n") + for i, st := range s.state { + fmt.Fprintf(w, "\t%d: %d , ", i, st) + if s.attrib[i] == nil { + fmt.Fprintf(w, "nil") + } else { + switch attr := s.attrib[i].(type) { + case *token.Token: + fmt.Fprintf(w, "%s", attr.Lit) + default: + fmt.Fprintf(w, "%v", attr) + } + } + fmt.Fprintf(w, "\n") + } + return w.String() +} + +// Parser + +type Parser struct { + stack *stack + nextToken *token.Token + userContext interface{} + + // + // Working data, should be method parameters/locals + // but putting them here simplifies a bit the code + // Useful only for longest prefix partial parsing + // + needsRepositioning bool + isNonDeterministic bool + tokens iface.CheckPointable + afterPos iface.CheckPoint + checkPoint iface.CheckPoint + underlyingStream iface.TokenStream +} + +type TokenStream = iface.TokenStream + +type ( + fakeCp struct{} + fakeCheckPointable struct{} +) + +func (f fakeCheckPointable) GetCheckPoint() iface.CheckPoint { + return fakeCp{} +} + +func (f fakeCp) DistanceFrom(o iface.CheckPoint) int { + return 0 +} + +func (f fakeCp) Advance(o int) iface.CheckPoint { + return fakeCp{} +} + +func (f fakeCheckPointable) GotoCheckPoint(iface.CheckPoint) {} + +func cdFunc_calc_0(Stream TokenStream, Context interface{}) (interface{}, error, []byte) { + return calc.ParseWithDataPartial(Stream, Context) +} + +func NewParser() *Parser { + return NewParserWithContext(nil) +} + +func NewParserWithContext(u interface{}) *Parser { + p := &Parser{stack: newStack(), userContext: u} + p.Reset() + return p +} + +func (p *Parser) Reset() { + p.stack.reset() + p.stack.push(0, nil) +} + +func (p *Parser) SetContext(ctx interface{}) *Parser { + p.userContext = ctx + return p +} + +func (p Parser) GetContext() interface{} { + return p.userContext +} + +func (p *Parser) Error(err error, scanner iface.Scanner) (recovered bool, errorAttrib *parseError.Error) { + errorAttrib = &parseError.Error{ + Err: err, + ErrorToken: p.nextToken, + ErrorSymbols: p.popNonRecoveryStates(), + ExpectedTokens: make([]string, 0, 8), + } + for t, action := range parserActions.table[p.stack.top()].actions { + if action != nil { + errorAttrib.ExpectedTokens = append(errorAttrib.ExpectedTokens, token.TokMap.Id(token.Type(t))) + } + } + + if action := parserActions.table[p.stack.top()].actions[token.TokMap.Type("λ")]; action != nil { + p.stack.push(int(action.(shift)), errorAttrib) // action can only be shift + } else { + return + } + + if action := parserActions.table[p.stack.top()].actions[p.nextToken.Type]; action != nil { + recovered = true + } + for !recovered && p.nextToken.Type != token.EOF { + p.nextToken = scanner.Scan() + if action := parserActions.table[p.stack.top()].actions[p.nextToken.Type]; action != nil { + recovered = true + } + } + + return +} + +func (p *Parser) popNonRecoveryStates() (removedAttribs []parseError.ErrorSymbol) { + if rs, ok := p.firstRecoveryState(); ok { + errorSymbols := p.stack.popN(p.stack.topIndex() - rs) + removedAttribs = make([]parseError.ErrorSymbol, len(errorSymbols)) + for i, e := range errorSymbols { + removedAttribs[i] = e + } + } else { + removedAttribs = []parseError.ErrorSymbol{} + } + return +} + +// recoveryState points to the highest state on the stack, which can recover +func (p *Parser) firstRecoveryState() (recoveryState int, canRecover bool) { + recoveryState, canRecover = p.stack.topIndex(), parserActions.table[p.stack.top()].canRecover + for recoveryState > 0 && !canRecover { + recoveryState-- + canRecover = parserActions.table[p.stack.peek(recoveryState)].canRecover + } + return +} + +func (p *Parser) newError(err error) error { + e := &parseError.Error{ + Err: err, + StackTop: p.stack.top(), + ErrorToken: p.nextToken, + } + actRow := parserActions.table[p.stack.top()] + for i, t := range actRow.actions { + if t != nil { + e.ExpectedTokens = append(e.ExpectedTokens, token.TokMap.Id(token.Type(i))) + } + } + return e +} + +func (p *Parser) prepareParsing(scanner iface.Scanner, longest bool) error { + p.Reset() + p.needsRepositioning = true + p.isNonDeterministic = true + if p.needsRepositioning { + if streamScanner, _ := scanner.(iface.StreamScanner); streamScanner != nil { + p.underlyingStream = streamScanner.GetStream() + } + if p.tokens, _ = scanner.(iface.CheckPointable); p.tokens == nil || p.underlyingStream == nil { + return errNotRepositionable + } + } else { + if p.tokens, _ = scanner.(iface.CheckPointable); p.tokens == nil { + p.tokens = fakeCheckPointable{} + } + } + return nil +} + +func (p *Parser) Parse(scanner iface.Scanner) (res interface{}, err error) { + if err := p.prepareParsing(scanner, false); err != nil { + return nil, err + } + return p.parse(scanner, false) +} + +func (p *Parser) ParseLongestPrefix(scanner iface.Scanner) (res interface{}, err error, parsed []byte) { + if err := p.prepareParsing(scanner, true); err != nil { + return nil, err, []byte{} + } + startPoint := p.tokens.GetCheckPoint() + res, err = p.parse(scanner, true) + if err == nil { + currPoint := p.tokens.GetCheckPoint() + p.tokens.GotoCheckPoint(startPoint) + parsed = make([]byte, currPoint.DistanceFrom(startPoint)) + p.underlyingStream.Read(parsed) + p.tokens.GotoCheckPoint(currPoint) + } + return +} + +var errNotRepositionable = errors.New("scanner not repositionable") + +func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, err error) { + readNextToken := func() { + p.checkPoint = p.tokens.GetCheckPoint() + p.nextToken = scanner.Scan() + p.afterPos = p.tokens.GetCheckPoint() + return + } + readNextToken() + for acc := false; !acc; { + action := parserActions.table[p.stack.top()].actions[p.nextToken.Type] + if action == nil && p.isNonDeterministic { + // + // If no action, check if we have some context dependent parsing to try + // + p.checkPoint = p.checkPoint.Advance(len(p.nextToken.IgnoredPrefix)) + for _, cdAction := range parserActions.table[p.stack.top()].cdActions { + p.tokens.GotoCheckPoint(p.checkPoint) + cd_res, cd_err, cd_parsed := cdAction.tokenScanner(p.underlyingStream, p.userContext) + if cd_err == nil && len(cd_parsed) > 0 { + action = parserActions.table[p.stack.top()].actions[cdAction.tokenIndex] + if action != nil { + p.nextToken.Foreign = true + p.nextToken.ForeignAstNode = cd_res + p.nextToken.Lit = cd_parsed + p.nextToken.Type = token.Type(cdAction.tokenIndex) + break + } + } + } + } + // + // Still no action? If a longest possible parsing is requested in place + // of a full text, we should try to check if an EOF here would have led + // to a successful parsing instead + // Rember that token.EOF is 1, that is the index of SyntaxEof into symbol table + // Dirty, dirty, dirty... but I found it as it is, and I prefer not to touch + // + if action == nil && longest { + p.tokens.GotoCheckPoint(p.checkPoint) + action = parserActions.table[p.stack.top()].actions[token.EOF] + if action == nil { + // + // ok, let's consume the token then + // + p.tokens.GotoCheckPoint(p.afterPos) + } + } + + // + // Well, no action is no action after all... + // + if action == nil { + if recovered, errAttrib := p.Error(nil, scanner); !recovered { + p.nextToken = errAttrib.ErrorToken + return nil, p.newError(nil) + } + if action = parserActions.table[p.stack.top()].actions[p.nextToken.Type]; action == nil { + panic("Error recovery led to invalid action") + } + } + + switch act := action.(type) { + case accept: + res = p.stack.popN(1)[0] + acc = true + case shift: + p.stack.push(int(act), p.nextToken) + if p.nextToken.Foreign { + p.stack.push(int(act), p.nextToken.ForeignAstNode) + } + readNextToken() + case reduce: + prod := productionsTable[int(act)] + attrib, err := prod.ReduceFunc(p.userContext, p.stack.popN(prod.NumSymbols)) + if err != nil { + return nil, p.newError(err) + } else { + p.stack.push(gotoTab[p.stack.top()][prod.NTType], attrib) + } + default: + panic("unknown action: " + action.String()) + } + } + return res, nil +} diff --git a/example/ctx/ctx1.grammar/ctx1/internal/parser/productionstable.go b/example/ctx/ctx1.grammar/ctx1/internal/parser/productionstable.go new file mode 100644 index 00000000..4426615e --- /dev/null +++ b/example/ctx/ctx1.grammar/ctx1/internal/parser/productionstable.go @@ -0,0 +1,109 @@ +// Code generated by gocc; DO NOT EDIT. + +package parser + +import ( + "github.com/maxcalandrelli/gocc/example/ctx/ast" +) + +import ( + "fmt" + "github.com/maxcalandrelli/gocc/example/ctx/ctx1.grammar/ctx1/internal/token" + "github.com/maxcalandrelli/gocc/example/ctx/ctx1.grammar/ctx1/internal/util" + "strings" +) + +func getString(X Attrib) string { + switch X.(type) { + case *token.Token: + return string(X.(*token.Token).Lit) + case string: + return X.(string) + } + return fmt.Sprintf("%q", X) +} + +func unescape(s string) string { + return util.EscapedString(s).Unescape() +} + +func unquote(s string) string { + r, _, _ := util.EscapedString(s).Unquote() + return r +} + +func lc(s string) string { + return strings.ToLower(s) +} + +func uc(s string) string { + return strings.ToUpper(s) +} + +type ( + //TODO: change type and variable names to be consistent with other tables + ProdTab [numProductions]ProdTabEntry + ProdTabEntry struct { + String string + Id string + NTType int + Index int + NumSymbols int + ReduceFunc func(interface{}, []Attrib) (Attrib, error) + } + Attrib interface { + } +) + +var productionsTable = ProdTab{ + ProdTabEntry{ + String: `S' : Π << >>`, + Id: "S'", + NTType: 0, + Index: 0, + NumSymbols: 1, + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { + return X[0], nil + }, + }, + ProdTabEntry{ + String: `StmtList : Π << ast.NewStmtList($0s) >>`, + Id: "StmtList", + NTType: 1, + Index: 1, + NumSymbols: 1, + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { + return ast.NewStmtList(getString(X[0])) + }, + }, + ProdTabEntry{ + String: `StmtList : Π Π << ast.AppendStmt($0.(ast.StmtList), $1s) >>`, + Id: "StmtList", + NTType: 1, + Index: 2, + NumSymbols: 2, + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { + return ast.AppendStmt(X[0].(ast.StmtList), getString(X[1])) + }, + }, + ProdTabEntry{ + String: `Stmt : id << ast.NewStmt($0e) >>`, + Id: "Stmt", + NTType: 2, + Index: 3, + NumSymbols: 1, + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { + return ast.NewStmt(unescape(getString(X[0]))) + }, + }, + ProdTabEntry{ + String: `Stmt : μ << ast.CalcResult($2) >>`, + Id: "Stmt", + NTType: 2, + Index: 4, + NumSymbols: 2, + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { + return ast.CalcResult(X[2]) + }, + }, +} diff --git a/example/ctx/ctx1.grammar/ctx1/internal/token/token.go b/example/ctx/ctx1.grammar/ctx1/internal/token/token.go new file mode 100644 index 00000000..90eeb929 --- /dev/null +++ b/example/ctx/ctx1.grammar/ctx1/internal/token/token.go @@ -0,0 +1,93 @@ +// Code generated by gocc; DO NOT EDIT. + +package token + +import ( + "fmt" +) + +type Token struct { + Type + Lit []byte + IgnoredPrefix []byte + Pos + ForeignAstNode interface{} + Foreign bool +} + +type Type int + +const ( + INVALID Type = iota + EOF +) + +type Pos struct { + Offset int + Line int + Column int +} + +func (p Pos) String() string { + return fmt.Sprintf("Pos(offset=%d, line=%d, column=%d)", p.Offset, p.Line, p.Column) +} + +func (p Pos) StartingFrom(base Pos) Pos { + r := base + r.Offset += p.Offset + r.Line += p.Line + r.Column = p.Column + if p.Line > 0 && base.Line > 0 { + r.Line-- + } + if r.Column < 1 { + r.Column = 1 + } + return r +} + +type TokenMap struct { + typeMap []string + idMap map[string]Type + litMap map[string]Type +} + +func (m TokenMap) Id(tok Type) string { + if int(tok) < len(m.typeMap) { + return m.typeMap[tok] + } + return "unknown" +} + +func (m TokenMap) Type(tok string) Type { + if typ, exist := m.idMap[tok]; exist { + return typ + } + return INVALID +} + +func (m TokenMap) TokenString(tok *Token) string { + return fmt.Sprintf("%s(%d,<%s>)", m.Id(tok.Type), tok.Type, tok.Lit) +} + +func (m TokenMap) StringType(typ Type) string { + return fmt.Sprintf("%s(%d)", m.Id(typ), typ) +} + +var TokMap = TokenMap{ + typeMap: []string{ + "INVALID", + "Ω", + "id", + "μ", + }, + + idMap: map[string]Type{ + "INVALID": 0, + "Ω": 1, + "id": 2, + "μ": 3, + }, + + litMap: map[string]Type{}, +} diff --git a/example/ctx/ctx1.grammar/ctx1/internal/util/litconv.go b/example/ctx/ctx1.grammar/ctx1/internal/util/litconv.go new file mode 100644 index 00000000..1aeb6166 --- /dev/null +++ b/example/ctx/ctx1.grammar/ctx1/internal/util/litconv.go @@ -0,0 +1,108 @@ +// Code generated by gocc; DO NOT EDIT. + +package util + +import ( + "fmt" + "strconv" + "unicode" + "unicode/utf8" +) + +/* Interface */ + +/* +Convert the literal value of a scanned token to rune +*/ +func RuneValue(lit []byte) rune { + if lit[1] == '\\' { + return escapeCharVal(lit) + } + r, size := utf8.DecodeRune(lit[1:]) + if size != len(lit)-2 { + panic(fmt.Sprintf("Error decoding rune. Lit: %s, rune: %d, size%d\n", lit, r, size)) + } + return r +} + +/* +Convert the literal value of a scanned token to int64 +*/ +func IntValue(lit []byte) (int64, error) { + return strconv.ParseInt(string(lit), 10, 64) +} + +/* +Convert the literal value of a scanned token to uint64 +*/ +func UintValue(lit []byte) (uint64, error) { + return strconv.ParseUint(string(lit), 10, 64) +} + +/* Util */ + +func escapeCharVal(lit []byte) rune { + var i, base, max uint32 + offset := 2 + switch lit[offset] { + case 'a': + return '\a' + case 'b': + return '\b' + case 'f': + return '\f' + case 'n': + return '\n' + case 'r': + return '\r' + case 't': + return '\t' + case 'v': + return '\v' + case '\\': + return '\\' + case '\'': + return '\'' + case '0', '1', '2', '3', '4', '5', '6', '7': + i, base, max = 3, 8, 255 + case 'x': + i, base, max = 2, 16, 255 + offset++ + case 'u': + i, base, max = 4, 16, unicode.MaxRune + offset++ + case 'U': + i, base, max = 8, 16, unicode.MaxRune + offset++ + default: + panic(fmt.Sprintf("Error decoding character literal: %s\n", lit)) + } + + var x uint32 + for ; i > 0 && offset < len(lit)-1; i-- { + ch, size := utf8.DecodeRune(lit[offset:]) + offset += size + d := uint32(digitVal(ch)) + if d >= base { + panic(fmt.Sprintf("charVal(%s): illegal character (%c) in escape sequence. size=%d, offset=%d", lit, ch, size, offset)) + } + x = x*base + d + } + if x > max || 0xD800 <= x && x < 0xE000 { + panic(fmt.Sprintf("Error decoding escape char value. Lit:%s, offset:%d, escape sequence is invalid Unicode code point\n", lit, offset)) + } + + return rune(x) +} + +func digitVal(ch rune) int { + switch { + case '0' <= ch && ch <= '9': + return int(ch) - '0' + case 'a' <= ch && ch <= 'f': + return int(ch) - 'a' + 10 + case 'A' <= ch && ch <= 'F': + return int(ch) - 'A' + 10 + } + return 16 // larger than any legal digit val +} diff --git a/example/ctx/ctx1.grammar/ctx1/internal/util/rune.go b/example/ctx/ctx1.grammar/ctx1/internal/util/rune.go new file mode 100644 index 00000000..788edfde --- /dev/null +++ b/example/ctx/ctx1.grammar/ctx1/internal/util/rune.go @@ -0,0 +1,140 @@ +// Code generated by gocc; DO NOT EDIT. + + +package util + +import ( + "fmt" + "unicode" + "unicode/utf8" +) + +func RuneToString(r rune) string { + if r >= 0x20 && r < 0x7f { + return fmt.Sprintf("'%c'", r) + } + switch r { + case 0x07: + return "'\\a'" + case 0x08: + return "'\\b'" + case 0x0C: + return "'\\f'" + case 0x0A: + return "'\\n'" + case 0x0D: + return "'\\r'" + case 0x09: + return "'\\t'" + case 0x0b: + return "'\\v'" + case 0x5c: + return "'\\\\\\'" + case 0x27: + return "'\\''" + case 0x22: + return "'\\\"'" + } + if r < 0x10000 { + return fmt.Sprintf("\\u%04x", r) + } + return fmt.Sprintf("\\U%08x", r) +} + +type EscapedString string + +func (str EscapedString) Unquote() (unquoted string, wasQuoted bool, quoteType rune) { + if len(str) > 1 { + r := str[0] + if (r == '"' || r == '\x60' || r == '\'') && r == str[len(str)-1] { + str = str[1 : len(str)-1] + } + return string(str), true, rune(r) + } + return string(str), false, 0 +} + +func (str EscapedString) Unescape() string { + var ( + res string + r rune + size int + ) + for s := 0; s < len(str); s += size { + if str[s] == '\\' { + r, size = str[s+1:].EscapedFirstCharValue() + size++ + } else { + r, size = utf8.DecodeRuneInString(string(str)[s:]) + } + res += string(r) + } + return res +} + +func (str EscapedString) EscapedFirstCharValue() (rune, int) { + var i, base, max uint32 + offset := 0 + switch str[offset] { + case '\'', '"': + return rune(str[offset]), 1 + case 'a': + return '\a', 1 + case 'b': + return '\b', 1 + case 'f': + return '\f', 1 + case 'n': + return '\n', 1 + case 'r': + return '\r', 1 + case 't': + return '\t', 1 + case 'v': + return '\v', 1 + case '\\': + return '\\', 1 + case '0', '1', '2', '3', '4', '5', '6', '7': + i, base, max = 3, 8, 255 + case 'x': + i, base, max = 2, 16, 255 + offset++ + case 'u': + i, base, max = 4, 16, unicode.MaxRune + offset++ + case 'U': + i, base, max = 8, 32, unicode.MaxRune + offset++ + default: + panic(fmt.Sprintf("Error decoding character literal: %s\n", str[offset:])) + } + + var x uint32 + for ; i > 0 && offset < len(str); i-- { + ch, size := utf8.DecodeRuneInString(string(str)[offset:]) + offset += size + d := uint32(HexDigitValue(ch)) + if d >= base { + panic(fmt.Sprintf("charVal(%s): illegal character (%c) in escape sequence. size=%d, offset=%d", str, str[offset], size, offset)) + } + x = x*base + d + } + if x > max || 0xD800 <= x && x < 0xE000 { + panic(fmt.Sprintf("Error decoding escape char value. Lit:%s, offset:%d, escape sequence is invalid Unicode code point\n", str, offset)) + } + + return rune(x), offset +} + +func HexDigitValue(ch rune) int { + switch { + case '0' <= ch && ch <= '9': + return int(ch) - '0' + case 'a' <= ch && ch <= 'f': + return int(ch) - 'a' + 10 + case 'A' <= ch && ch <= 'F': + return int(ch) - 'A' + 10 + } + return 16 // larger than any legal digit val +} + diff --git a/example/ctx/ctx1.grammar/ctx1/log/LR1_sets.txt b/example/ctx/ctx1.grammar/ctx1/log/LR1_sets.txt new file mode 100644 index 00000000..b1d9f119 --- /dev/null +++ b/example/ctx/ctx1.grammar/ctx1/log/LR1_sets.txt @@ -0,0 +1,72 @@ +S0{ + S' : •Π «Ω» + StmtList : •Π «Ω» + StmtList : •Π Π «Ω» + Stmt : •id «Ω» + Stmt : •μ «Ω» + StmtList : •Π «μ» + StmtList : •Π «id» + StmtList : •Π Π «μ» + StmtList : •Π Π «id» + Stmt : •id «μ» + Stmt : •μ «μ» + Stmt : •id «id» + Stmt : •μ «id» +} +Transitions: + Π -> 1 + Π -> 2 + id -> 3 + μ -> 4 + + +S1{ + S' : Π• «Ω» + StmtList : Π •Π «Ω» + StmtList : Π •Π «μ» + StmtList : Π •Π «id» + Stmt : •id «Ω» + Stmt : •μ «Ω» + Stmt : •id «μ» + Stmt : •μ «μ» + Stmt : •id «id» + Stmt : •μ «id» +} +Transitions: + id -> 3 + μ -> 4 + Π -> 5 + + +S2{ + StmtList : Π• «Ω» + StmtList : Π• «μ» + StmtList : Π• «id» +} +Transitions: + + +S3{ + Stmt : id• «Ω» + Stmt : id• «μ» + Stmt : id• «id» +} +Transitions: + + +S4{ + Stmt : μ• «Ω» + Stmt : μ• «μ» + Stmt : μ• «id» +} +Transitions: + + +S5{ + StmtList : Π Π• «Ω» + StmtList : Π Π• «μ» + StmtList : Π Π• «id» +} +Transitions: + + diff --git a/example/ctx/ctx1.grammar/ctx1/log/first.txt b/example/ctx/ctx1.grammar/ctx1/log/first.txt new file mode 100644 index 00000000..e7b13952 --- /dev/null +++ b/example/ctx/ctx1.grammar/ctx1/log/first.txt @@ -0,0 +1,12 @@ +Π: { + id + μ +} +Π: { + id + μ +} +Π: { + id + μ +} diff --git a/example/ctx/ctx1.grammar/ctx1/log/lexer_sets.txt b/example/ctx/ctx1.grammar/ctx1/log/lexer_sets.txt new file mode 100644 index 00000000..1e59feec --- /dev/null +++ b/example/ctx/ctx1.grammar/ctx1/log/lexer_sets.txt @@ -0,0 +1,128 @@ +Item sets: +S0{ + !whitespace : ' ' | '\t' | '\n' | • '\r' + !whitespace : ' ' | '\t' | • '\n' | '\r' + !whitespace : ' ' | • '\t' | '\n' | '\r' + !whitespace : • ' ' | '\t' | '\n' | '\r' + _x : \u03b1 | (• \u03b2 _digit {_digit}) + _x : • \u03b1 | (\u03b2 _digit {_digit}) + id : • _x {_x0 | (\u03b2 _digit {_digit}) | \u03b3} +} +Transitions: + ['\t','\t'] -> S1 + ['\n','\n'] -> S1 + ['\r','\r'] -> S1 + [' ',' '] -> S1 + [\u03b1,\u03b1] -> S2 + [\u03b2,\u03b2] -> S3 +Action: nil +Symbols classes: {['\t','\t'], ['\n','\n'], ['\r','\r'], [' ',' '], [\u03b1,\u03b1], [\u03b2,\u03b2]} + +S1{ + !whitespace : (' ' | '\t' | '\n' | '\r') • +} +Transitions: +Action: Ignore("!whitespace") +Symbols classes: {} + +S2{ + _x : (\u03b1 | (\u03b2 _digit {_digit})) • + _x0 : • \u03b1 + id : _x {_x0 | (\u03b2 _digit {_digit}) | \u03b3} • + id : _x {_x0 | (\u03b2 _digit {_digit}) | • \u03b3} + id : _x {_x0 | (• \u03b2 _digit {_digit}) | \u03b3} + id : _x {• _x0 | (\u03b2 _digit {_digit}) | \u03b3} +} +Transitions: + [\u03b1,\u03b1] -> S4 + [\u03b2,\u03b2] -> S5 + [\u03b3,\u03b3] -> S6 +Action: Accept("id") +Symbols classes: {[\u03b1,\u03b1], [\u03b2,\u03b2], [\u03b3,\u03b3]} + +S3{ + _digit : • '0'-'9' + _x : \u03b1 | (\u03b2 • _digit {_digit}) + id : • _x {_x0 | (\u03b2 _digit {_digit}) | \u03b3} +} +Transitions: + ['0','9'] -> S7 +Action: nil +Symbols classes: {['0','9']} + +S4{ + _x0 : \u03b1 • + _x0 : • \u03b1 + id : _x {_x0 | (\u03b2 _digit {_digit}) | \u03b3} • + id : _x {_x0 | (\u03b2 _digit {_digit}) | • \u03b3} + id : _x {_x0 | (• \u03b2 _digit {_digit}) | \u03b3} + id : _x {• _x0 | (\u03b2 _digit {_digit}) | \u03b3} +} +Transitions: + [\u03b1,\u03b1] -> S4 + [\u03b2,\u03b2] -> S5 + [\u03b3,\u03b3] -> S6 +Action: Accept("id") +Symbols classes: {[\u03b1,\u03b1], [\u03b2,\u03b2], [\u03b3,\u03b3]} + +S5{ + _digit : • '0'-'9' + id : _x {_x0 | (\u03b2 • _digit {_digit}) | \u03b3} +} +Transitions: + ['0','9'] -> S8 +Action: nil +Symbols classes: {['0','9']} + +S6{ + _x0 : • \u03b1 + id : _x {_x0 | (\u03b2 _digit {_digit}) | \u03b3} • + id : _x {_x0 | (\u03b2 _digit {_digit}) | • \u03b3} + id : _x {_x0 | (• \u03b2 _digit {_digit}) | \u03b3} + id : _x {• _x0 | (\u03b2 _digit {_digit}) | \u03b3} +} +Transitions: + [\u03b1,\u03b1] -> S4 + [\u03b2,\u03b2] -> S5 + [\u03b3,\u03b3] -> S6 +Action: Accept("id") +Symbols classes: {[\u03b1,\u03b1], [\u03b2,\u03b2], [\u03b3,\u03b3]} + +S7{ + _digit : '0'-'9' • + _digit : • '0'-'9' + _x : (\u03b1 | (\u03b2 _digit {_digit})) • + _x : \u03b1 | (\u03b2 _digit {• _digit}) + _x0 : • \u03b1 + id : _x {_x0 | (\u03b2 _digit {_digit}) | \u03b3} • + id : _x {_x0 | (\u03b2 _digit {_digit}) | • \u03b3} + id : _x {_x0 | (• \u03b2 _digit {_digit}) | \u03b3} + id : _x {• _x0 | (\u03b2 _digit {_digit}) | \u03b3} + id : • _x {_x0 | (\u03b2 _digit {_digit}) | \u03b3} +} +Transitions: + ['0','9'] -> S7 + [\u03b1,\u03b1] -> S4 + [\u03b2,\u03b2] -> S5 + [\u03b3,\u03b3] -> S6 +Action: Accept("id") +Symbols classes: {['0','9'], [\u03b1,\u03b1], [\u03b2,\u03b2], [\u03b3,\u03b3]} + +S8{ + _digit : '0'-'9' • + _digit : • '0'-'9' + _x0 : • \u03b1 + id : _x {_x0 | (\u03b2 _digit {_digit}) | \u03b3} • + id : _x {_x0 | (\u03b2 _digit {_digit}) | • \u03b3} + id : _x {_x0 | (\u03b2 _digit {• _digit}) | \u03b3} + id : _x {_x0 | (• \u03b2 _digit {_digit}) | \u03b3} + id : _x {• _x0 | (\u03b2 _digit {_digit}) | \u03b3} +} +Transitions: + ['0','9'] -> S8 + [\u03b1,\u03b1] -> S4 + [\u03b2,\u03b2] -> S5 + [\u03b3,\u03b3] -> S6 +Action: Accept("id") +Symbols classes: {['0','9'], [\u03b1,\u03b1], [\u03b2,\u03b2], [\u03b3,\u03b3]} + diff --git a/example/ctx/ctx1.grammar/ctx1/log/terminals.txt b/example/ctx/ctx1.grammar/ctx1/log/terminals.txt new file mode 100644 index 00000000..bc6b9081 --- /dev/null +++ b/example/ctx/ctx1.grammar/ctx1/log/terminals.txt @@ -0,0 +1,4 @@ +ά +id +μ diff --git a/example/ctx/ctx1.grammar/ctx1/main/ctx1.go b/example/ctx/ctx1.grammar/ctx1/main/ctx1.go new file mode 100644 index 00000000..82792675 --- /dev/null +++ b/example/ctx/ctx1.grammar/ctx1/main/ctx1.go @@ -0,0 +1,58 @@ +package main + +import ( + "flag" + "fmt" + "os" + "strings" + + ctx1 "github.com/maxcalandrelli/gocc/example/ctx/ctx1.grammar/ctx1" +) + +func showResult(r interface{}, e error, p []byte) { + if e != nil { + fmt.Fprintf(os.Stderr, "parsing returned the following error: %s\n", e.Error()) + } else { + if len(p) > 0 { + fmt.Printf("r=%#v, (%s)\n", r, string(p)) + } else { + fmt.Printf("r=%#v\n", r) + } + } +} + +var ( + File string + Text string + Longest bool +) + +func parse(longest bool, lex *ctx1.Lexer) (res interface{}, err error, parsed []byte) { + if longest { + return ctx1.NewParser().ParseLongestPrefix(lex) + } else { + res, err = ctx1.NewParser().Parse(lex) + parsed = []byte{} + } + return +} + +func main() { + flag.StringVar(&File, "file", "", "parse also text in file") + flag.StringVar(&Text, "text", "", "parse also text given with flag") + flag.BoolVar(&Longest, "longest", false, "parse longest possible part") + flag.Parse() + if Text > "" { + showResult(parse(Longest, ctx1.NewLexerString(Text))) + } + if File > "" { + l, e := ctx1.NewLexerFile(File) + if e != nil { + panic(e) + } + showResult(parse(Longest, l)) + } + if str := strings.Join(flag.Args(), " "); str > "" { + showResult(parse(Longest, ctx1.NewLexerString(str))) + } +} diff --git a/example/ctx/ctx1.grammar/ctx1/util.go b/example/ctx/ctx1.grammar/ctx1/util.go new file mode 100644 index 00000000..638246b9 --- /dev/null +++ b/example/ctx/ctx1.grammar/ctx1/util.go @@ -0,0 +1,25 @@ +// Code generated by gocc; DO NOT EDIT. + +package ctx1 + +import ( + "github.com/maxcalandrelli/gocc/example/ctx/ctx1.grammar/ctx1/internal/util" +) + +type EscapedString = util.EscapedString + +func RuneToString(r rune) string { + return util.RuneToString(r) +} + +func HexDigitValue(ch rune) int { + return util.HexDigitValue(ch) +} + +func IntValue(lit []byte) (int64, error) { + return util.IntValue(lit) +} + +func UintValue(lit []byte) (uint64, error) { + return util.UintValue(lit) +} diff --git a/example/ctx/ctx_test.go b/example/ctx/ctx_test.go index be88049a..87cecf17 100644 --- a/example/ctx/ctx_test.go +++ b/example/ctx/ctx_test.go @@ -6,32 +6,46 @@ import ( "github.com/maxcalandrelli/gocc/example/ctx/ast" "github.com/maxcalandrelli/gocc/example/ctx/ctx.grammar/ctx" + "github.com/maxcalandrelli/gocc/example/ctx/ctx1.grammar/ctx1" ) func TestPass(t *testing.T) { - sml, err := test([]byte("a b c calc 12 * 6 + 4 d e f")) - if err != nil { - t.Fatal(err.Error()) + //sml, err := test("\\u0022AA\\u0022 other a b c calc 12 * 6 + 4 \\u03b3k\\u03b5 d e \\u03b3_\\u03b5 \\u03b3\\u03b5 f") + sml0, sml1, err0, err1 := test("β1α αβ1α β11β1β11 αβ33 αβ0β9 ") + if err0 != nil { + t.Fatal(err0.Error()) } - fmt.Printf("output: %s\n", sml) + if err1 != nil { + t.Fatal(err1.Error()) + } + fmt.Printf("output0: %s\n", sml0) + fmt.Printf("output1: %s\n", sml1) } func TestFail(t *testing.T) { - _, err := test([]byte("a b 22 c d e f")) - if err == nil { - t.Fatal("expected parse error") + _, _, err0, err1 := test("a b 22 c d e f") + if err0 == nil { + t.Fatal("expected parse error (0)") + } else { + fmt.Printf("Parsing failed as expected (0): %v\n", err0) + } + if err1 == nil { + t.Fatal("expected parse error (1)") } else { - fmt.Printf("Parsing failed as expected: %v\n", err) + fmt.Printf("Parsing failed as expected (1): %v\n", err0) } } -func test(src []byte) (astree ast.StmtList, err error) { +func test(src string) (astree0, astree1 ast.StmtList, err0, err1 error) { + var a0, a1 interface{} + a0, err0 = ctx.ParseText(src) + a1, err1 = ctx1.ParseText(src) fmt.Printf("input: %s\n", src) - s := ctx.NewLexerBytes(src) - p := ctx.NewParser() - a, err := p.Parse(s) - if err == nil { - astree = a.(ast.StmtList) + if err0 == nil { + astree0 = a0.(ast.StmtList) + } + if err1 == nil { + astree1 = a1.(ast.StmtList) } return } diff --git a/internal/frontend/reparsed/internal/util/rune.go b/internal/frontend/reparsed/internal/util/rune.go index 86fb8395..788edfde 100644 --- a/internal/frontend/reparsed/internal/util/rune.go +++ b/internal/frontend/reparsed/internal/util/rune.go @@ -110,7 +110,7 @@ func (str EscapedString) EscapedFirstCharValue() (rune, int) { } var x uint32 - for ; i > 0 && offset < len(str)-1; i-- { + for ; i > 0 && offset < len(str); i-- { ch, size := utf8.DecodeRuneInString(string(str)[offset:]) offset += size d := uint32(HexDigitValue(ch)) diff --git a/internal/frontend/reparsed/log/lexer_sets.txt b/internal/frontend/reparsed/log/lexer_sets.txt index ef4f4ee0..94502a6f 100644 --- a/internal/frontend/reparsed/log/lexer_sets.txt +++ b/internal/frontend/reparsed/log/lexer_sets.txt @@ -111,7 +111,6 @@ S3{ Transitions: ['"','"'] -> S28 ['\','\'] -> S29 -. -> S30 Action: nil Symbols classes: {['"','"'], ['\','\']} @@ -132,7 +131,6 @@ S4{ } Transitions: ['\','\'] -> S31 -. -> S32 Action: nil Symbols classes: {['\','\']} @@ -267,7 +265,6 @@ S18{ } Transitions: ['`','`'] -> S45 -. -> S18 Action: nil Symbols classes: {['`','`']} @@ -457,7 +454,6 @@ S30{ Transitions: ['"','"'] -> S28 ['\','\'] -> S29 -. -> S30 Action: nil Symbols classes: {['"','"'], ['\','\']} @@ -520,7 +516,6 @@ S33{ } Transitions: ['*','*'] -> S67 -. -> S33 Action: nil Symbols classes: {['*','*']} @@ -531,7 +526,6 @@ S34{ } Transitions: ['\n','\n'] -> S68 -. -> S34 Action: nil Symbols classes: {['\n','\n']} @@ -539,7 +533,6 @@ S35{ g_sdt_lit : '<' '<' • . {.} '>' '>' } Transitions: -. -> S69 Action: nil Symbols classes: {} @@ -547,7 +540,6 @@ S36{ g_ctxdep_lit : '@' '@' • . {.} '@' '@' } Transitions: -. -> S70 Action: nil Symbols classes: {} @@ -981,7 +973,6 @@ S56{ Transitions: ['"','"'] -> S28 ['\','\'] -> S29 -. -> S30 Action: nil Symbols classes: {['"','"'], ['\','\']} @@ -1130,7 +1121,6 @@ S67{ Transitions: ['*','*'] -> S67 ['/','/'] -> S81 -. -> S33 Action: nil Symbols classes: {['*','*'], ['/','/']} @@ -1148,7 +1138,6 @@ S69{ } Transitions: ['>','>'] -> S82 -. -> S69 Action: nil Symbols classes: {['>','>']} @@ -1158,7 +1147,6 @@ S70{ } Transitions: ['@','@'] -> S83 -. -> S70 Action: nil Symbols classes: {['@','@']} @@ -1437,7 +1425,6 @@ S86{ Transitions: ['"','"'] -> S28 ['\','\'] -> S29 -. -> S30 Action: nil Symbols classes: {['"','"'], ['\','\']} @@ -1498,7 +1485,6 @@ S89{ Transitions: ['"','"'] -> S28 ['\','\'] -> S29 -. -> S30 Action: nil Symbols classes: {['"','"'], ['\','\']} @@ -1724,7 +1710,6 @@ S103{ Transitions: ['"','"'] -> S28 ['\','\'] -> S29 -. -> S30 Action: nil Symbols classes: {['"','"'], ['\','\']} @@ -1877,7 +1862,6 @@ S112{ Transitions: ['"','"'] -> S28 ['\','\'] -> S29 -. -> S30 Action: nil Symbols classes: {['"','"'], ['\','\']} diff --git a/internal/lexer/items/item.go b/internal/lexer/items/item.go index 02dfc5cb..5dc18b3d 100644 --- a/internal/lexer/items/item.go +++ b/internal/lexer/items/item.go @@ -115,6 +115,10 @@ func (this *Item) Emoves() (items []*Item) { nt, pos := item.pos.top() + fmt.Printf("*** Item: %q\n ** emoves:\n", item) + for _, e := range items { + fmt.Printf(" %q\n", e) + } switch node := nt.(type) { case *ast.LexPattern: newItems.Push(item.eMovesLexPattern(node, pos)...) @@ -134,7 +138,6 @@ func (this *Item) Emoves() (items []*Item) { panic(fmt.Sprintf("Unexpected type in items.Emoves(): %T", nt)) } } - return } @@ -305,7 +308,7 @@ func (this *Item) Move(rng CharRange) []*Item { movedItem.getHashKey() items := movedItem.Emoves() - + fmt.Printf(" <%q>:move(%q):%q\n", this, rng, items) return items } diff --git a/internal/lexer/items/itemlist.go b/internal/lexer/items/itemlist.go index bde121e4..040e19ba 100644 --- a/internal/lexer/items/itemlist.go +++ b/internal/lexer/items/itemlist.go @@ -61,7 +61,10 @@ func (this ItemList) AddNoDuplicate(items ...*Item) ItemList { newList := this for _, item := range items { if !newList.Contain(item) { + //fmt.Printf(" AddNoDuplicate: adding <%q>\n", item) newList = append(newList, item) + } else { + //fmt.Printf(" AddNoDuplicate: discarding <%q>\n", item) } } return newList diff --git a/internal/lexer/items/itemset.go b/internal/lexer/items/itemset.go index d448b88d..6846cadd 100644 --- a/internal/lexer/items/itemset.go +++ b/internal/lexer/items/itemset.go @@ -46,7 +46,7 @@ func NewItemSet(setNo int, lexPart *ast.LexPart, symbols *symbols.Symbols, items Symbols: symbols, DotTransition: -1, } - set.getSymbolClasses() + set.getSymbolClasses(lexPart, symbols) set.newTransitions() return set } @@ -108,36 +108,35 @@ func (this *ItemSet) Empty() bool { return len(this.Items) == 0 } -func (this *ItemSet) getSymbolClasses() { +func (this *ItemSet) getSymbolClasses(lexPart *ast.LexPart, symbols *symbols.Symbols) { this.SymbolClasses = NewDisjunctRangeSet() for _, item := range this.Items { if !item.Reduce() { - addNow := false - switch chars := item.ExpectedSymbol().(type) { - case *ast.LexCharLit: - addNow = !chars.Negate - case *ast.LexCharRange: - addNow = !chars.Negate - } - if addNow { - this.SymbolClasses.AddLexTNode(item.ExpectedSymbol()) - } + this.addToSymbolClasses(lexPart, symbols, item.ExpectedSymbol(), false) } } for _, item := range this.Items { if !item.Reduce() { - addNow := true - switch chars := item.ExpectedSymbol().(type) { - case *ast.LexCharLit: - addNow = chars.Negate - case *ast.LexCharRange: - addNow = chars.Negate - } - if addNow { - this.SymbolClasses.AddLexTNode(item.ExpectedSymbol()) - } + this.addToSymbolClasses(lexPart, symbols, item.ExpectedSymbol(), true) } } + +} + +func (this *ItemSet) addToSymbolClasses(lexPart *ast.LexPart, symbols *symbols.Symbols, node ast.LexNode, negated bool) { + addNow := !negated + tNode := ast.LexTNode(nil) + switch n := node.(type) { + case *ast.LexCharLit: + addNow = (negated == n.Negate) + tNode = node.(ast.LexTNode) + case *ast.LexCharRange: + addNow = (negated == n.Negate) + tNode = node.(ast.LexTNode) + } + if addNow && tNode != nil { + this.SymbolClasses.AddLexTNode(tNode) + } } func (this *ItemSet) newTransitions() { @@ -155,7 +154,7 @@ func (this *ItemSet) newTransitions() { See algorithm: set.Next() in package doc */ func (this *ItemSet) Next(rng CharRange) ItemList { - // fmt.Printf("S%d%s\n", this.setNo, this) + fmt.Printf("S%d rng=%q\n", this.setNo, rng) nextItems := NewItemList(16) for _, item := range this.Items { nextItems = nextItems.AddNoDuplicate(item.Move(rng)...) @@ -186,18 +185,18 @@ func (this *ItemSet) dependentsClosure(items ItemList) ItemList { if len(items) == 0 { return items } - // fmt.Printf("dependentsClosure S%d, %s\n", this.setNo, items) + fmt.Printf("dependentsClosure S%d, %s\n", this.setNo, items) for i := 0; i < len(items); i++ { for _, thisItem := range this.Items { if expSym := thisItem.ExpectedSymbol(); expSym != nil && expSym.String() == items[i].Id { if items[i].Reduce() { - // mv := thisItem.MoveRegDefId(items[i].Id) - // for _, mvi := range mv { - // fmt.Printf("\t%s\n", mvi) - // } + mv := thisItem.MoveRegDefId(items[i].Id) + for _, mvi := range mv { + fmt.Printf(" ====> %s\n", mvi) + } items = items.AddNoDuplicate(thisItem.MoveRegDefId(items[i].Id)...) } else { - // fmt.Printf("\t%s\n", thisItem) + fmt.Printf(" ==> %s\n", thisItem) items = items.AddNoDuplicate(thisItem) } } diff --git a/internal/lexer/items/itemsets.go b/internal/lexer/items/itemsets.go index 9ed1e317..3e9c8e9f 100644 --- a/internal/lexer/items/itemsets.go +++ b/internal/lexer/items/itemsets.go @@ -52,10 +52,16 @@ func (this *ItemSets) Add(items ItemList) (setNo int) { func (this *ItemSets) Closure() *ItemSets { for i := 0; i < len(this.sets); i++ { + fmt.Printf("S%d/%d\n", i, len(this.sets)) for symI, rng := range this.sets[i].SymbolClasses.List() { + fmt.Printf(" rng: %q\n", rng) if items := this.sets[i].Next(rng); len(items) != 0 { + for _ix, _it := range items { + fmt.Printf(" #%d: <%q>\n", _ix, _it) + } setNo, nextState := this.Add(items), this.sets[i].Transitions[symI] if nextState != -1 && nextState != setNo { + panic(fmt.Sprintf("Next set conflict in (S%d, %s) -> %d. Existing setNo: %d", i, rng, setNo, nextState)) } this.sets[i].Transitions[symI] = setNo } diff --git a/internal/parser/gen/golang/productionstable.go b/internal/parser/gen/golang/productionstable.go index 1157dfcc..d27e3a13 100644 --- a/internal/parser/gen/golang/productionstable.go +++ b/internal/parser/gen/golang/productionstable.go @@ -94,8 +94,8 @@ func getProdsTab(header string, prods ast.SyntaxProdList, symbols *symbols.Symbo } var ( - sdtReplacer = regexp.MustCompile("\\$[0-9]+(:[sqeUl]+)?") - sdtReplacerSplit = regexp.MustCompile("^\\$([0-9]+)(?::([sqeUl]+))?$") + sdtReplacer = regexp.MustCompile("\\$[0-9]+[sqeUl]*") + sdtReplacerSplit = regexp.MustCompile("^\\$([0-9]+)([sqeUl]*)$") ) func sdtReplacerFunc(match string) string { diff --git a/internal/util/gen/golang/rune.go b/internal/util/gen/golang/rune.go index af80903b..80811c39 100644 --- a/internal/util/gen/golang/rune.go +++ b/internal/util/gen/golang/rune.go @@ -123,7 +123,7 @@ func (str EscapedString) EscapedFirstCharValue() (rune, int) { } var x uint32 - for ; i > 0 && offset < len(str)-1; i-- { + for ; i > 0 && offset < len(str); i-- { ch, size := utf8.DecodeRuneInString(string(str)[offset:]) offset += size d := uint32(HexDigitValue(ch)) diff --git a/internal/util/rune.go b/internal/util/rune.go index bc7e52b3..c3b56654 100644 --- a/internal/util/rune.go +++ b/internal/util/rune.go @@ -121,7 +121,7 @@ func (str EscapedString) EscapedFirstCharValue() (rune, int) { } var x uint32 - for ; i > 0 && offset < len(str)-1; i-- { + for ; i > 0 && offset < len(str); i-- { ch, size := utf8.DecodeRuneInString(string(str)[offset:]) offset += size d := uint32(HexDigitValue(ch)) diff --git a/main.go b/main.go index 3d105e49..473929f7 100644 --- a/main.go +++ b/main.go @@ -56,7 +56,7 @@ - added functions shorthand substitutions for SDT placeholders $, with the format - $: + $[] the operations in are applied to the token/ast; ops is a string where every character stays for an unary function of a string, identified by one of the following: From 47d5deb446a23ab56fa5908574f0b5176071d61a Mon Sep 17 00:00:00 2001 From: Massimiliano Calandrelli Date: Mon, 21 Oct 2019 09:15:51 +0200 Subject: [PATCH 29/33] ... --- example/ctx/Makefile | 3 ++- example/ctx/ctx_test.go | 4 ++-- internal/lexer/items/disjunctrangeset.go | 6 ------ internal/lexer/items/item.go | 8 +++++--- internal/lexer/items/itemlist.go | 2 -- internal/lexer/items/itemset.go | 10 ++++++---- internal/lexer/items/itemsets.go | 9 ++++----- 7 files changed, 19 insertions(+), 23 deletions(-) diff --git a/example/ctx/Makefile b/example/ctx/Makefile index 1006c07e..5f52dd73 100644 --- a/example/ctx/Makefile +++ b/example/ctx/Makefile @@ -1,2 +1,3 @@ regenerate: - gocc ctx.bnf + gocc -a -v ctx.bnf >ctx0.log 2>&1 + gocc -a -v ctx1.bnf >ctx1.log 2>&1 diff --git a/example/ctx/ctx_test.go b/example/ctx/ctx_test.go index 87cecf17..67f629a4 100644 --- a/example/ctx/ctx_test.go +++ b/example/ctx/ctx_test.go @@ -13,10 +13,10 @@ func TestPass(t *testing.T) { //sml, err := test("\\u0022AA\\u0022 other a b c calc 12 * 6 + 4 \\u03b3k\\u03b5 d e \\u03b3_\\u03b5 \\u03b3\\u03b5 f") sml0, sml1, err0, err1 := test("β1α αβ1α β11β1β11 αβ33 αβ0β9 ") if err0 != nil { - t.Fatal(err0.Error()) + t.Error(err0.Error()) } if err1 != nil { - t.Fatal(err1.Error()) + t.Error(err1.Error()) } fmt.Printf("output0: %s\n", sml0) fmt.Printf("output1: %s\n", sml1) diff --git a/internal/lexer/items/disjunctrangeset.go b/internal/lexer/items/disjunctrangeset.go index cb3a970b..6e6125dd 100644 --- a/internal/lexer/items/disjunctrangeset.go +++ b/internal/lexer/items/disjunctrangeset.go @@ -38,13 +38,9 @@ func (this *DisjunctRangeSet) AddLexTNode(sym ast.LexTNode) { switch s := sym.(type) { case *ast.LexCharRange: if s.Negate { - //fmt.Printf("Set is: %q, will remove '%c'-'%c'\n", this, s.From.Val, s.To.Val) this.SubtractRange(s.From.Val, s.To.Val) - //fmt.Printf("Set now: %q\n", this) } else { - //fmt.Printf("Set is: %q, will add '%c'-'%c'\n", this, s.From.Val, s.To.Val) this.AddRange(s.From.Val, s.To.Val) - //fmt.Printf("Set now: %q\n", this) } case *ast.LexCharLit: if s.Negate { @@ -143,7 +139,6 @@ func (this *DisjunctRangeSet) AddRange(from, to rune) { func (this *DisjunctRangeSet) subtractRange(index int, from, to rune) int { if index < len(this.set) { - //fmt.Printf("subtracting <%c-%c> at index %d<%c-%c>\n", from, to, index, this.set[index].From, this.set[index].To) rng := this.set[index] if to >= from && to >= rng.From { if from > rng.To || to < rng.From { @@ -158,7 +153,6 @@ func (this *DisjunctRangeSet) subtractRange(index int, from, to rune) int { // // from >= rng.to && to <= rng.to // - //fmt.Printf("actually deleting range <%c-%c> at index %d<%c-%c>\n", from, to, index, this.set[index].From, this.set[index].To) switch { case from == rng.From && to == rng.To: copy(this.set[index:], this.set[index+1:]) diff --git a/internal/lexer/items/item.go b/internal/lexer/items/item.go index 5dc18b3d..d4d8a67e 100644 --- a/internal/lexer/items/item.go +++ b/internal/lexer/items/item.go @@ -104,6 +104,7 @@ For a general description of dotted items (items) and ℇ-moves of items, see: T : x(...|y•|...)z => T : x(...|y|...)•z */ func (this *Item) Emoves() (items []*Item) { + trace(-1, "%s\n", this.Id) newItems := util.NewStack(8).Push(this) for newItems.Len() > 0 { item := newItems.Pop().(*Item) @@ -115,9 +116,9 @@ func (this *Item) Emoves() (items []*Item) { nt, pos := item.pos.top() - fmt.Printf("*** Item: %q\n ** emoves:\n", item) + dbg(-1, "*** Item: %q\n ** emoves:\n", item) for _, e := range items { - fmt.Printf(" %q\n", e) + dbg(-1, " %q\n", e) } switch node := nt.(type) { case *ast.LexPattern: @@ -308,7 +309,7 @@ func (this *Item) Move(rng CharRange) []*Item { movedItem.getHashKey() items := movedItem.Emoves() - fmt.Printf(" <%q>:move(%q):%q\n", this, rng, items) + dbg(-1, " <%q>:move(%q):%q\n", this, rng, items) return items } @@ -329,6 +330,7 @@ func (this *Item) MoveRegDefId(id string) []*Item { movedItem := this.Clone() movedItem.pos.inc() movedItem.getHashKey() + trace(-1, " * moved item:\n%s\nwas:\n%s)\n", util.EscapedString(movedItem.pos.String()).Unescape(), util.EscapedString(this.pos.String()).Unescape()) items := movedItem.Emoves() return items } diff --git a/internal/lexer/items/itemlist.go b/internal/lexer/items/itemlist.go index 040e19ba..d16dafda 100644 --- a/internal/lexer/items/itemlist.go +++ b/internal/lexer/items/itemlist.go @@ -61,10 +61,8 @@ func (this ItemList) AddNoDuplicate(items ...*Item) ItemList { newList := this for _, item := range items { if !newList.Contain(item) { - //fmt.Printf(" AddNoDuplicate: adding <%q>\n", item) newList = append(newList, item) } else { - //fmt.Printf(" AddNoDuplicate: discarding <%q>\n", item) } } return newList diff --git a/internal/lexer/items/itemset.go b/internal/lexer/items/itemset.go index 6846cadd..0785a929 100644 --- a/internal/lexer/items/itemset.go +++ b/internal/lexer/items/itemset.go @@ -18,6 +18,8 @@ import ( "fmt" "strings" + "github.com/maxcalandrelli/gocc/internal/util" + "github.com/maxcalandrelli/gocc/internal/ast" "github.com/maxcalandrelli/gocc/internal/lexer/symbols" ) @@ -154,7 +156,7 @@ func (this *ItemSet) newTransitions() { See algorithm: set.Next() in package doc */ func (this *ItemSet) Next(rng CharRange) ItemList { - fmt.Printf("S%d rng=%q\n", this.setNo, rng) + trace(this.setNo, "rng=%q\n", rng) nextItems := NewItemList(16) for _, item := range this.Items { nextItems = nextItems.AddNoDuplicate(item.Move(rng)...) @@ -185,18 +187,18 @@ func (this *ItemSet) dependentsClosure(items ItemList) ItemList { if len(items) == 0 { return items } - fmt.Printf("dependentsClosure S%d, %s\n", this.setNo, items) + trace(this.setNo, "dependentsClosure S%d\n actual: %s\n items: %s\n", this.setNo, util.EscapedString(this.String()).Unescape(), util.EscapedString(fmt.Sprintf("%q", items)).Unescape()) for i := 0; i < len(items); i++ { for _, thisItem := range this.Items { if expSym := thisItem.ExpectedSymbol(); expSym != nil && expSym.String() == items[i].Id { if items[i].Reduce() { mv := thisItem.MoveRegDefId(items[i].Id) for _, mvi := range mv { - fmt.Printf(" ====> %s\n", mvi) + dbg(this.setNo, " ====> %s\n", mvi) } items = items.AddNoDuplicate(thisItem.MoveRegDefId(items[i].Id)...) } else { - fmt.Printf(" ==> %s\n", thisItem) + dbg(this.setNo, " ==> %s\n", thisItem) items = items.AddNoDuplicate(thisItem) } } diff --git a/internal/lexer/items/itemsets.go b/internal/lexer/items/itemsets.go index 3e9c8e9f..2506f203 100644 --- a/internal/lexer/items/itemsets.go +++ b/internal/lexer/items/itemsets.go @@ -51,13 +51,14 @@ func (this *ItemSets) Add(items ItemList) (setNo int) { } func (this *ItemSets) Closure() *ItemSets { + trace(-1, "") for i := 0; i < len(this.sets); i++ { - fmt.Printf("S%d/%d\n", i, len(this.sets)) + dbg(-1, "S%d/%d\n", i, len(this.sets)) for symI, rng := range this.sets[i].SymbolClasses.List() { - fmt.Printf(" rng: %q\n", rng) + dbg(i, " rng: %q\n", rng) if items := this.sets[i].Next(rng); len(items) != 0 { for _ix, _it := range items { - fmt.Printf(" #%d: <%q>\n", _ix, _it) + dbg(i, " #%d: <%q>\n", _ix, _it) } setNo, nextState := this.Add(items), this.sets[i].Transitions[symI] if nextState != -1 && nextState != setNo { @@ -91,10 +92,8 @@ func (this *ItemSets) Closure() *ItemSets { */ func (this *ItemSets) propagateDots(start int) { - //fmt.Printf(" --- start=%d #transitions=%d\n", start, len(this.sets[start].Transitions)) if this.sets[start].DotTransition > -1 { for _, tr := range this.sets[start].Transitions { - //fmt.Printf(" --- start=%d t=%d t.dot=%d\n", start, tr, this.sets[tr].DotTransition) if tr > start && this.sets[tr].DotTransition < 0 && len(this.sets[tr].Transitions) > 0 { this.sets[tr].DotTransition = this.sets[start].DotTransition } From 6fca449f0e0d11a714a527ec597f6abefe989f5a Mon Sep 17 00:00:00 2001 From: Massimiliano Calandrelli Date: Mon, 21 Oct 2019 09:17:10 +0200 Subject: [PATCH 30/33] ... --- example/ctx/ctx0.log | 2458 ++++++++++++++++++++++++++++++++++ example/ctx/ctx1.log | 2485 +++++++++++++++++++++++++++++++++++ internal/lexer/items/dbg.go | 32 + 3 files changed, 4975 insertions(+) create mode 100644 example/ctx/ctx0.log create mode 100644 example/ctx/ctx1.log create mode 100644 internal/lexer/items/dbg.go diff --git a/example/ctx/ctx0.log b/example/ctx/ctx0.log new file mode 100644 index 00000000..53655b8e --- /dev/null +++ b/example/ctx/ctx0.log @@ -0,0 +1,2458 @@ +gocc version 1.3.0001 +-a = true +-debug_lexer = false +-debug_parser = false +-h = false +-no_lexer = false +-o = /home/max/go/src/github.com/maxcalandrelli/gocc/example/ctx/ctx.grammar/ctx +-p = github.com/maxcalandrelli/gocc/example/ctx/ctx.grammar/ctx +-u = false +-v = true +-internal = internal +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.ItemsSet0 in itemset.go:62 +items.GetItemSets in itemsets.go:39 +id +*** Item: "id : _x {_x0 | _x1 | \\u03b3}" + ** emoves: +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.ItemsSet0 in itemset.go:62 +items.GetItemSets in itemsets.go:39 +!whitespace +*** Item: "!whitespace : ' ' | '\\t' | '\\n' | '\\r'" + ** emoves: +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.ItemList.Closure in itemlist.go:80 +items.NewItemSet in itemset.go:46 +items.(*ItemSets).Add in itemsets.go:49 +items.GetItemSets in itemsets.go:39 +_x +*** Item: "_x : \\u03b1 | (\\u03b2 _digit {_digit})" + ** emoves: +*** Item: "_x : \\u03b1 | • (\\u03b2 _digit {_digit})" + ** emoves: +*** Item: "_x : \\u03b1 | (\\u03b2 _digit {_digit})" + ** emoves: +------------------------------------------- +items.(*ItemSets).Closure in itemsets.go:54 +items.GetItemSets in itemsets.go:41 +S0/1 +S0: rng: "['\\t','\\t']" +------------------------------------------- +items.(*ItemSet).Next in itemset.go:159 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S0:rng="['\\t','\\t']" +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).Move in item.go:311 +items.(*ItemSet).Next in itemset.go:162 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +!whitespace +*** Item: "!whitespace : ' ' | '\\t' | '\\n' | '\\r'" + ** emoves: + <"!whitespace : ' ' | • '\\t' | '\\n' | '\\r'">:move("['\\t','\\t']"):["!whitespace : (' ' | '\\t' | '\\n' | '\\r') •"] +------------------------------------------- +items.(*ItemSet).dependentsClosure in itemset.go:190 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S0:dependentsClosure S0 + actual: { + id : • _x {_x0 | _x1 | γ} + !whitespace : ' ' | ' ' | ' +' | • ' ' + !whitespace : ' ' | ' ' | • ' +' | ' ' + !whitespace : ' ' | • ' ' | ' +' | ' ' + !whitespace : • ' ' | ' ' | ' +' | ' ' + _x : α | (• β _digit {_digit}) + _x : • α | (β _digit {_digit}) +} +Transitions: + [' ',' '] -> S-1 + [' +',' +'] -> S-1 + [' ',' '] -> S-1 + [' ',' '] -> S-1 + [α,α] -> S-1 + [β,β] -> S-1 +Symbols classes: {[' ',' '], [' +',' +'], [' ',' '], [' ',' '], [α,α], [β,β]} + + items: ["!whitespace : (' ' | '\t' | '\n' | '\r') •"] +S0: #0: <"!whitespace : (' ' | '\\t' | '\\n' | '\\r') •"> +S0: rng: "['\\n','\\n']" +------------------------------------------- +items.(*ItemSet).Next in itemset.go:159 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S0:rng="['\\n','\\n']" +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).Move in item.go:311 +items.(*ItemSet).Next in itemset.go:162 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +!whitespace +*** Item: "!whitespace : ' ' | '\\t' | '\\n' | '\\r'" + ** emoves: + <"!whitespace : ' ' | '\\t' | • '\\n' | '\\r'">:move("['\\n','\\n']"):["!whitespace : (' ' | '\\t' | '\\n' | '\\r') •"] +------------------------------------------- +items.(*ItemSet).dependentsClosure in itemset.go:190 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S0:dependentsClosure S0 + actual: { + id : • _x {_x0 | _x1 | γ} + !whitespace : ' ' | ' ' | ' +' | • ' ' + !whitespace : ' ' | ' ' | • ' +' | ' ' + !whitespace : ' ' | • ' ' | ' +' | ' ' + !whitespace : • ' ' | ' ' | ' +' | ' ' + _x : α | (• β _digit {_digit}) + _x : • α | (β _digit {_digit}) +} +Transitions: + [' ',' '] -> S1 + [' +',' +'] -> S-1 + [' ',' '] -> S-1 + [' ',' '] -> S-1 + [α,α] -> S-1 + [β,β] -> S-1 +Symbols classes: {[' ',' '], [' +',' +'], [' ',' '], [' ',' '], [α,α], [β,β]} + + items: ["!whitespace : (' ' | '\t' | '\n' | '\r') •"] +S0: #0: <"!whitespace : (' ' | '\\t' | '\\n' | '\\r') •"> +S0: rng: "['\\r','\\r']" +------------------------------------------- +items.(*ItemSet).Next in itemset.go:159 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S0:rng="['\\r','\\r']" +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).Move in item.go:311 +items.(*ItemSet).Next in itemset.go:162 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +!whitespace +*** Item: "!whitespace : ' ' | '\\t' | '\\n' | '\\r'" + ** emoves: + <"!whitespace : ' ' | '\\t' | '\\n' | • '\\r'">:move("['\\r','\\r']"):["!whitespace : (' ' | '\\t' | '\\n' | '\\r') •"] +------------------------------------------- +items.(*ItemSet).dependentsClosure in itemset.go:190 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S0:dependentsClosure S0 + actual: { + id : • _x {_x0 | _x1 | γ} + !whitespace : ' ' | ' ' | ' +' | • ' ' + !whitespace : ' ' | ' ' | • ' +' | ' ' + !whitespace : ' ' | • ' ' | ' +' | ' ' + !whitespace : • ' ' | ' ' | ' +' | ' ' + _x : α | (• β _digit {_digit}) + _x : • α | (β _digit {_digit}) +} +Transitions: + [' ',' '] -> S1 + [' +',' +'] -> S1 + [' ',' '] -> S-1 + [' ',' '] -> S-1 + [α,α] -> S-1 + [β,β] -> S-1 +Symbols classes: {[' ',' '], [' +',' +'], [' ',' '], [' ',' '], [α,α], [β,β]} + + items: ["!whitespace : (' ' | '\t' | '\n' | '\r') •"] +S0: #0: <"!whitespace : (' ' | '\\t' | '\\n' | '\\r') •"> +S0: rng: "[' ',' ']" +------------------------------------------- +items.(*ItemSet).Next in itemset.go:159 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S0:rng="[' ',' ']" +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).Move in item.go:311 +items.(*ItemSet).Next in itemset.go:162 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +!whitespace +*** Item: "!whitespace : ' ' | '\\t' | '\\n' | '\\r'" + ** emoves: + <"!whitespace : • ' ' | '\\t' | '\\n' | '\\r'">:move("[' ',' ']"):["!whitespace : (' ' | '\\t' | '\\n' | '\\r') •"] +------------------------------------------- +items.(*ItemSet).dependentsClosure in itemset.go:190 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S0:dependentsClosure S0 + actual: { + id : • _x {_x0 | _x1 | γ} + !whitespace : ' ' | ' ' | ' +' | • ' ' + !whitespace : ' ' | ' ' | • ' +' | ' ' + !whitespace : ' ' | • ' ' | ' +' | ' ' + !whitespace : • ' ' | ' ' | ' +' | ' ' + _x : α | (• β _digit {_digit}) + _x : • α | (β _digit {_digit}) +} +Transitions: + [' ',' '] -> S1 + [' +',' +'] -> S1 + [' ',' '] -> S1 + [' ',' '] -> S-1 + [α,α] -> S-1 + [β,β] -> S-1 +Symbols classes: {[' ',' '], [' +',' +'], [' ',' '], [' ',' '], [α,α], [β,β]} + + items: ["!whitespace : (' ' | '\t' | '\n' | '\r') •"] +S0: #0: <"!whitespace : (' ' | '\\t' | '\\n' | '\\r') •"> +S0: rng: "[\\u03b1,\\u03b1]" +------------------------------------------- +items.(*ItemSet).Next in itemset.go:159 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S0:rng="[\\u03b1,\\u03b1]" +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).Move in item.go:311 +items.(*ItemSet).Next in itemset.go:162 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_x +*** Item: "_x : \\u03b1 | (\\u03b2 _digit {_digit})" + ** emoves: + <"_x : • \\u03b1 | (\\u03b2 _digit {_digit})">:move("[\\u03b1,\\u03b1]"):["_x : (\\u03b1 | (\\u03b2 _digit {_digit})) •"] +------------------------------------------- +items.(*ItemSet).dependentsClosure in itemset.go:190 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S0:dependentsClosure S0 + actual: { + id : • _x {_x0 | _x1 | γ} + !whitespace : ' ' | ' ' | ' +' | • ' ' + !whitespace : ' ' | ' ' | • ' +' | ' ' + !whitespace : ' ' | • ' ' | ' +' | ' ' + !whitespace : • ' ' | ' ' | ' +' | ' ' + _x : α | (• β _digit {_digit}) + _x : • α | (β _digit {_digit}) +} +Transitions: + [' ',' '] -> S1 + [' +',' +'] -> S1 + [' ',' '] -> S1 + [' ',' '] -> S1 + [α,α] -> S-1 + [β,β] -> S-1 +Symbols classes: {[' ',' '], [' +',' +'], [' ',' '], [' ',' '], [α,α], [β,β]} + + items: ["_x : (\u03b1 | (\u03b2 _digit {_digit})) •"] +------------------------------------------- +items.(*Item).MoveRegDefId in item.go:333 +items.(*ItemSet).dependentsClosure in itemset.go:195 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 + * moved item: + *ast.LexPattern:_x {_x0 | _x1 | γ}; pos 0 + *ast.LexAlt:_x {_x0 | _x1 | γ}; pos 1 + +was: + *ast.LexPattern:_x {_x0 | _x1 | γ}; pos 0 + *ast.LexAlt:_x {_x0 | _x1 | γ}; pos 0 +) +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).MoveRegDefId in item.go:334 +items.(*ItemSet).dependentsClosure in itemset.go:195 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +id +*** Item: "id : _x • {_x0 | _x1 | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | _x1 | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | _x1 | \\u03b3}" + ** emoves: +S0: ====> id : _x {_x0 | _x1 | \u03b3} • +S0: ====> id : _x {_x0 | _x1 | • \u03b3} +S0: ====> id : _x {_x0 | • _x1 | \u03b3} +S0: ====> id : _x {• _x0 | _x1 | \u03b3} +------------------------------------------- +items.(*Item).MoveRegDefId in item.go:333 +items.(*ItemSet).dependentsClosure in itemset.go:199 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 + * moved item: + *ast.LexPattern:_x {_x0 | _x1 | γ}; pos 0 + *ast.LexAlt:_x {_x0 | _x1 | γ}; pos 1 + +was: + *ast.LexPattern:_x {_x0 | _x1 | γ}; pos 0 + *ast.LexAlt:_x {_x0 | _x1 | γ}; pos 0 +) +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).MoveRegDefId in item.go:334 +items.(*ItemSet).dependentsClosure in itemset.go:199 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +id +*** Item: "id : _x • {_x0 | _x1 | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | _x1 | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | _x1 | \\u03b3}" + ** emoves: +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.ItemList.Closure in itemlist.go:80 +items.(*ItemSet).Next in itemset.go:165 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_x1 +*** Item: "_x1 : \\u03b2 _digit {_digit}" + ** emoves: +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.ItemList.Closure in itemlist.go:80 +items.(*ItemSet).Next in itemset.go:165 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_x0 +*** Item: "_x0 : \\u03b1" + ** emoves: +S0: #0: <"_x : (\\u03b1 | (\\u03b2 _digit {_digit})) •"> +S0: #1: <"id : _x {_x0 | _x1 | \\u03b3} •"> +S0: #2: <"id : _x {_x0 | _x1 | • \\u03b3}"> +S0: #3: <"id : _x {_x0 | • _x1 | \\u03b3}"> +S0: #4: <"id : _x {• _x0 | _x1 | \\u03b3}"> +S0: #5: <"_x1 : • \\u03b2 _digit {_digit}"> +S0: #6: <"_x0 : • \\u03b1"> +S0: rng: "[\\u03b2,\\u03b2]" +------------------------------------------- +items.(*ItemSet).Next in itemset.go:159 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S0:rng="[\\u03b2,\\u03b2]" +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).Move in item.go:311 +items.(*ItemSet).Next in itemset.go:162 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_x + <"_x : \\u03b1 | (• \\u03b2 _digit {_digit})">:move("[\\u03b2,\\u03b2]"):["_x : \\u03b1 | (\\u03b2 • _digit {_digit})"] +------------------------------------------- +items.(*ItemSet).dependentsClosure in itemset.go:190 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S0:dependentsClosure S0 + actual: { + id : • _x {_x0 | _x1 | γ} + !whitespace : ' ' | ' ' | ' +' | • ' ' + !whitespace : ' ' | ' ' | • ' +' | ' ' + !whitespace : ' ' | • ' ' | ' +' | ' ' + !whitespace : • ' ' | ' ' | ' +' | ' ' + _x : α | (• β _digit {_digit}) + _x : • α | (β _digit {_digit}) +} +Transitions: + [' ',' '] -> S1 + [' +',' +'] -> S1 + [' ',' '] -> S1 + [' ',' '] -> S1 + [α,α] -> S2 + [β,β] -> S-1 +Symbols classes: {[' ',' '], [' +',' +'], [' ',' '], [' ',' '], [α,α], [β,β]} + + items: ["_x : \u03b1 | (\u03b2 • _digit {_digit})"] +S0: ==> id : • _x {_x0 | _x1 | \u03b3} +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.ItemList.Closure in itemlist.go:80 +items.(*ItemSet).Next in itemset.go:165 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_digit +*** Item: "_digit : '0'-'9'" + ** emoves: +S0: #0: <"_x : \\u03b1 | (\\u03b2 • _digit {_digit})"> +S0: #1: <"id : • _x {_x0 | _x1 | \\u03b3}"> +S0: #2: <"_digit : • '0'-'9'"> +S1/4 +S2/4 +S2: rng: "[\\u03b1,\\u03b1]" +------------------------------------------- +items.(*ItemSet).Next in itemset.go:159 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S2:rng="[\\u03b1,\\u03b1]" +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).Move in item.go:311 +items.(*ItemSet).Next in itemset.go:162 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_x0 +*** Item: "_x0 : \\u03b1" + ** emoves: + <"_x0 : • \\u03b1">:move("[\\u03b1,\\u03b1]"):["_x0 : \\u03b1 •"] +------------------------------------------- +items.(*ItemSet).dependentsClosure in itemset.go:190 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S2:dependentsClosure S2 + actual: { + _x : (α | (β _digit {_digit})) • + id : _x {_x0 | _x1 | γ} • + id : _x {_x0 | _x1 | • γ} + id : _x {_x0 | • _x1 | γ} + id : _x {• _x0 | _x1 | γ} + _x1 : • β _digit {_digit} + _x0 : • α +} +Transitions: + [α,α] -> S-1 + [β,β] -> S-1 + [γ,γ] -> S-1 +Symbols classes: {[α,α], [β,β], [γ,γ]} + + items: ["_x0 : \u03b1 •"] +------------------------------------------- +items.(*Item).MoveRegDefId in item.go:333 +items.(*ItemSet).dependentsClosure in itemset.go:195 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 + * moved item: + *ast.LexPattern:_x {_x0 | _x1 | γ}; pos 0 + *ast.LexAlt:_x {_x0 | _x1 | γ}; pos 1 + *ast.LexRepPattern:{_x0 | _x1 | γ}; pos 0 + *ast.LexAlt:_x0; pos 1 + +was: + *ast.LexPattern:_x {_x0 | _x1 | γ}; pos 0 + *ast.LexAlt:_x {_x0 | _x1 | γ}; pos 1 + *ast.LexRepPattern:{_x0 | _x1 | γ}; pos 0 + *ast.LexAlt:_x0; pos 0 +) +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).MoveRegDefId in item.go:334 +items.(*ItemSet).dependentsClosure in itemset.go:195 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +id +*** Item: "id : _x {_x0 | _x1 | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | _x1 | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | _x1 | \\u03b3}" + ** emoves: +S2: ====> id : _x {_x0 | _x1 | \u03b3} • +S2: ====> id : _x {_x0 | _x1 | • \u03b3} +S2: ====> id : _x {_x0 | • _x1 | \u03b3} +S2: ====> id : _x {• _x0 | _x1 | \u03b3} +------------------------------------------- +items.(*Item).MoveRegDefId in item.go:333 +items.(*ItemSet).dependentsClosure in itemset.go:199 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 + * moved item: + *ast.LexPattern:_x {_x0 | _x1 | γ}; pos 0 + *ast.LexAlt:_x {_x0 | _x1 | γ}; pos 1 + *ast.LexRepPattern:{_x0 | _x1 | γ}; pos 0 + *ast.LexAlt:_x0; pos 1 + +was: + *ast.LexPattern:_x {_x0 | _x1 | γ}; pos 0 + *ast.LexAlt:_x {_x0 | _x1 | γ}; pos 1 + *ast.LexRepPattern:{_x0 | _x1 | γ}; pos 0 + *ast.LexAlt:_x0; pos 0 +) +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).MoveRegDefId in item.go:334 +items.(*ItemSet).dependentsClosure in itemset.go:199 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +id +*** Item: "id : _x {_x0 | _x1 | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | _x1 | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | _x1 | \\u03b3}" + ** emoves: +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.ItemList.Closure in itemlist.go:80 +items.(*ItemSet).Next in itemset.go:165 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_x1 +*** Item: "_x1 : \\u03b2 _digit {_digit}" + ** emoves: +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.ItemList.Closure in itemlist.go:80 +items.(*ItemSet).Next in itemset.go:165 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_x0 +*** Item: "_x0 : \\u03b1" + ** emoves: +S2: #0: <"_x0 : \\u03b1 •"> +S2: #1: <"id : _x {_x0 | _x1 | \\u03b3} •"> +S2: #2: <"id : _x {_x0 | _x1 | • \\u03b3}"> +S2: #3: <"id : _x {_x0 | • _x1 | \\u03b3}"> +S2: #4: <"id : _x {• _x0 | _x1 | \\u03b3}"> +S2: #5: <"_x1 : • \\u03b2 _digit {_digit}"> +S2: #6: <"_x0 : • \\u03b1"> +S2: rng: "[\\u03b2,\\u03b2]" +------------------------------------------- +items.(*ItemSet).Next in itemset.go:159 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S2:rng="[\\u03b2,\\u03b2]" +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).Move in item.go:311 +items.(*ItemSet).Next in itemset.go:162 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_x1 + <"_x1 : • \\u03b2 _digit {_digit}">:move("[\\u03b2,\\u03b2]"):["_x1 : \\u03b2 • _digit {_digit}"] +------------------------------------------- +items.(*ItemSet).dependentsClosure in itemset.go:190 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S2:dependentsClosure S2 + actual: { + _x : (α | (β _digit {_digit})) • + id : _x {_x0 | _x1 | γ} • + id : _x {_x0 | _x1 | • γ} + id : _x {_x0 | • _x1 | γ} + id : _x {• _x0 | _x1 | γ} + _x1 : • β _digit {_digit} + _x0 : • α +} +Transitions: + [α,α] -> S4 + [β,β] -> S-1 + [γ,γ] -> S-1 +Symbols classes: {[α,α], [β,β], [γ,γ]} + + items: ["_x1 : \u03b2 • _digit {_digit}"] +S2: ==> id : _x {_x0 | • _x1 | \u03b3} +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.ItemList.Closure in itemlist.go:80 +items.(*ItemSet).Next in itemset.go:165 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_digit +*** Item: "_digit : '0'-'9'" + ** emoves: +S2: #0: <"_x1 : \\u03b2 • _digit {_digit}"> +S2: #1: <"id : _x {_x0 | • _x1 | \\u03b3}"> +S2: #2: <"_digit : • '0'-'9'"> +S2: rng: "[\\u03b3,\\u03b3]" +------------------------------------------- +items.(*ItemSet).Next in itemset.go:159 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S2:rng="[\\u03b3,\\u03b3]" +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).Move in item.go:311 +items.(*ItemSet).Next in itemset.go:162 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +id +*** Item: "id : _x {_x0 | _x1 | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | _x1 | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | _x1 | \\u03b3}" + ** emoves: + <"id : _x {_x0 | _x1 | • \\u03b3}">:move("[\\u03b3,\\u03b3]"):["id : _x {_x0 | _x1 | \\u03b3} •" "id : _x {_x0 | _x1 | • \\u03b3}" "id : _x {_x0 | • _x1 | \\u03b3}" "id : _x {• _x0 | _x1 | \\u03b3}"] +------------------------------------------- +items.(*ItemSet).dependentsClosure in itemset.go:190 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S2:dependentsClosure S2 + actual: { + _x : (α | (β _digit {_digit})) • + id : _x {_x0 | _x1 | γ} • + id : _x {_x0 | _x1 | • γ} + id : _x {_x0 | • _x1 | γ} + id : _x {• _x0 | _x1 | γ} + _x1 : • β _digit {_digit} + _x0 : • α +} +Transitions: + [α,α] -> S4 + [β,β] -> S5 + [γ,γ] -> S-1 +Symbols classes: {[α,α], [β,β], [γ,γ]} + + items: ["id : _x {_x0 | _x1 | \u03b3} •" "id : _x {_x0 | _x1 | • \u03b3}" "id : _x {_x0 | • _x1 | \u03b3}" "id : _x {• _x0 | _x1 | \u03b3}"] +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.ItemList.Closure in itemlist.go:80 +items.(*ItemSet).Next in itemset.go:165 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_x1 +*** Item: "_x1 : \\u03b2 _digit {_digit}" + ** emoves: +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.ItemList.Closure in itemlist.go:80 +items.(*ItemSet).Next in itemset.go:165 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_x0 +*** Item: "_x0 : \\u03b1" + ** emoves: +S2: #0: <"id : _x {_x0 | _x1 | \\u03b3} •"> +S2: #1: <"id : _x {_x0 | _x1 | • \\u03b3}"> +S2: #2: <"id : _x {_x0 | • _x1 | \\u03b3}"> +S2: #3: <"id : _x {• _x0 | _x1 | \\u03b3}"> +S2: #4: <"_x1 : • \\u03b2 _digit {_digit}"> +S2: #5: <"_x0 : • \\u03b1"> +S3/7 +S3: rng: "['0','9']" +------------------------------------------- +items.(*ItemSet).Next in itemset.go:159 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S3:rng="['0','9']" +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).Move in item.go:311 +items.(*ItemSet).Next in itemset.go:162 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_digit +*** Item: "_digit : '0'-'9'" + ** emoves: + <"_digit : • '0'-'9'">:move("['0','9']"):["_digit : '0'-'9' •"] +------------------------------------------- +items.(*ItemSet).dependentsClosure in itemset.go:190 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S3:dependentsClosure S3 + actual: { + _x : α | (β • _digit {_digit}) + id : • _x {_x0 | _x1 | γ} + _digit : • '0'-'9' +} +Transitions: + ['0','9'] -> S-1 +Symbols classes: {['0','9']} + + items: ["_digit : '0'-'9' •"] +------------------------------------------- +items.(*Item).MoveRegDefId in item.go:333 +items.(*ItemSet).dependentsClosure in itemset.go:195 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 + * moved item: + *ast.LexPattern:α | (β _digit {_digit}); pos 1 + *ast.LexAlt:(β _digit {_digit}); pos 0 + *ast.LexGroupPattern:(β _digit {_digit}); pos 0 + *ast.LexAlt:β _digit {_digit}; pos 2 + +was: + *ast.LexPattern:α | (β _digit {_digit}); pos 1 + *ast.LexAlt:(β _digit {_digit}); pos 0 + *ast.LexGroupPattern:(β _digit {_digit}); pos 0 + *ast.LexAlt:β _digit {_digit}; pos 1 +) +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).MoveRegDefId in item.go:334 +items.(*ItemSet).dependentsClosure in itemset.go:195 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_x +*** Item: "_x : \\u03b1 | (\\u03b2 _digit • {_digit})" + ** emoves: +*** Item: "_x : \\u03b1 | (\\u03b2 _digit {_digit})" + ** emoves: +*** Item: "_x : \\u03b1 | (\\u03b2 _digit {_digit})" + ** emoves: +*** Item: "_x : \\u03b1 | (\\u03b2 _digit {_digit})" + ** emoves: +*** Item: "_x : \\u03b1 | (\\u03b2 _digit {_digit})" + ** emoves: +S3: ====> _x : (\u03b1 | (\u03b2 _digit {_digit})) • +S3: ====> _x : \u03b1 | (\u03b2 _digit {• _digit}) +------------------------------------------- +items.(*Item).MoveRegDefId in item.go:333 +items.(*ItemSet).dependentsClosure in itemset.go:199 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 + * moved item: + *ast.LexPattern:α | (β _digit {_digit}); pos 1 + *ast.LexAlt:(β _digit {_digit}); pos 0 + *ast.LexGroupPattern:(β _digit {_digit}); pos 0 + *ast.LexAlt:β _digit {_digit}; pos 2 + +was: + *ast.LexPattern:α | (β _digit {_digit}); pos 1 + *ast.LexAlt:(β _digit {_digit}); pos 0 + *ast.LexGroupPattern:(β _digit {_digit}); pos 0 + *ast.LexAlt:β _digit {_digit}; pos 1 +) +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).MoveRegDefId in item.go:334 +items.(*ItemSet).dependentsClosure in itemset.go:199 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_x +*** Item: "_x : \\u03b1 | (\\u03b2 _digit • {_digit})" + ** emoves: +*** Item: "_x : \\u03b1 | (\\u03b2 _digit {_digit})" + ** emoves: +*** Item: "_x : \\u03b1 | (\\u03b2 _digit {_digit})" + ** emoves: +*** Item: "_x : \\u03b1 | (\\u03b2 _digit {_digit})" + ** emoves: +*** Item: "_x : \\u03b1 | (\\u03b2 _digit {_digit})" + ** emoves: +------------------------------------------- +items.(*Item).MoveRegDefId in item.go:333 +items.(*ItemSet).dependentsClosure in itemset.go:195 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 + * moved item: + *ast.LexPattern:_x {_x0 | _x1 | γ}; pos 0 + *ast.LexAlt:_x {_x0 | _x1 | γ}; pos 1 + +was: + *ast.LexPattern:_x {_x0 | _x1 | γ}; pos 0 + *ast.LexAlt:_x {_x0 | _x1 | γ}; pos 0 +) +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).MoveRegDefId in item.go:334 +items.(*ItemSet).dependentsClosure in itemset.go:195 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +id +*** Item: "id : _x • {_x0 | _x1 | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | _x1 | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | _x1 | \\u03b3}" + ** emoves: +S3: ====> id : _x {_x0 | _x1 | \u03b3} • +S3: ====> id : _x {_x0 | _x1 | • \u03b3} +S3: ====> id : _x {_x0 | • _x1 | \u03b3} +S3: ====> id : _x {• _x0 | _x1 | \u03b3} +------------------------------------------- +items.(*Item).MoveRegDefId in item.go:333 +items.(*ItemSet).dependentsClosure in itemset.go:199 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 + * moved item: + *ast.LexPattern:_x {_x0 | _x1 | γ}; pos 0 + *ast.LexAlt:_x {_x0 | _x1 | γ}; pos 1 + +was: + *ast.LexPattern:_x {_x0 | _x1 | γ}; pos 0 + *ast.LexAlt:_x {_x0 | _x1 | γ}; pos 0 +) +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).MoveRegDefId in item.go:334 +items.(*ItemSet).dependentsClosure in itemset.go:199 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +id +*** Item: "id : _x • {_x0 | _x1 | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | _x1 | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | _x1 | \\u03b3}" + ** emoves: +S3: ==> id : • _x {_x0 | _x1 | \u03b3} +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.ItemList.Closure in itemlist.go:80 +items.(*ItemSet).Next in itemset.go:165 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_digit +*** Item: "_digit : '0'-'9'" + ** emoves: +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.ItemList.Closure in itemlist.go:80 +items.(*ItemSet).Next in itemset.go:165 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_x1 +*** Item: "_x1 : \\u03b2 _digit {_digit}" + ** emoves: +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.ItemList.Closure in itemlist.go:80 +items.(*ItemSet).Next in itemset.go:165 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_x0 +*** Item: "_x0 : \\u03b1" + ** emoves: +S3: #0: <"_digit : '0'-'9' •"> +S3: #1: <"_x : (\\u03b1 | (\\u03b2 _digit {_digit})) •"> +S3: #2: <"_x : \\u03b1 | (\\u03b2 _digit {• _digit})"> +S3: #3: <"id : _x {_x0 | _x1 | \\u03b3} •"> +S3: #4: <"id : _x {_x0 | _x1 | • \\u03b3}"> +S3: #5: <"id : _x {_x0 | • _x1 | \\u03b3}"> +S3: #6: <"id : _x {• _x0 | _x1 | \\u03b3}"> +S3: #7: <"id : • _x {_x0 | _x1 | \\u03b3}"> +S3: #8: <"_digit : • '0'-'9'"> +S3: #9: <"_x1 : • \\u03b2 _digit {_digit}"> +S3: #10: <"_x0 : • \\u03b1"> +S4/8 +S4: rng: "[\\u03b1,\\u03b1]" +------------------------------------------- +items.(*ItemSet).Next in itemset.go:159 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S4:rng="[\\u03b1,\\u03b1]" +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).Move in item.go:311 +items.(*ItemSet).Next in itemset.go:162 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_x0 +*** Item: "_x0 : \\u03b1" + ** emoves: + <"_x0 : • \\u03b1">:move("[\\u03b1,\\u03b1]"):["_x0 : \\u03b1 •"] +------------------------------------------- +items.(*ItemSet).dependentsClosure in itemset.go:190 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S4:dependentsClosure S4 + actual: { + _x0 : α • + id : _x {_x0 | _x1 | γ} • + id : _x {_x0 | _x1 | • γ} + id : _x {_x0 | • _x1 | γ} + id : _x {• _x0 | _x1 | γ} + _x1 : • β _digit {_digit} + _x0 : • α +} +Transitions: + [α,α] -> S-1 + [β,β] -> S-1 + [γ,γ] -> S-1 +Symbols classes: {[α,α], [β,β], [γ,γ]} + + items: ["_x0 : \u03b1 •"] +------------------------------------------- +items.(*Item).MoveRegDefId in item.go:333 +items.(*ItemSet).dependentsClosure in itemset.go:195 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 + * moved item: + *ast.LexPattern:_x {_x0 | _x1 | γ}; pos 0 + *ast.LexAlt:_x {_x0 | _x1 | γ}; pos 1 + *ast.LexRepPattern:{_x0 | _x1 | γ}; pos 0 + *ast.LexAlt:_x0; pos 1 + +was: + *ast.LexPattern:_x {_x0 | _x1 | γ}; pos 0 + *ast.LexAlt:_x {_x0 | _x1 | γ}; pos 1 + *ast.LexRepPattern:{_x0 | _x1 | γ}; pos 0 + *ast.LexAlt:_x0; pos 0 +) +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).MoveRegDefId in item.go:334 +items.(*ItemSet).dependentsClosure in itemset.go:195 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +id +*** Item: "id : _x {_x0 | _x1 | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | _x1 | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | _x1 | \\u03b3}" + ** emoves: +S4: ====> id : _x {_x0 | _x1 | \u03b3} • +S4: ====> id : _x {_x0 | _x1 | • \u03b3} +S4: ====> id : _x {_x0 | • _x1 | \u03b3} +S4: ====> id : _x {• _x0 | _x1 | \u03b3} +------------------------------------------- +items.(*Item).MoveRegDefId in item.go:333 +items.(*ItemSet).dependentsClosure in itemset.go:199 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 + * moved item: + *ast.LexPattern:_x {_x0 | _x1 | γ}; pos 0 + *ast.LexAlt:_x {_x0 | _x1 | γ}; pos 1 + *ast.LexRepPattern:{_x0 | _x1 | γ}; pos 0 + *ast.LexAlt:_x0; pos 1 + +was: + *ast.LexPattern:_x {_x0 | _x1 | γ}; pos 0 + *ast.LexAlt:_x {_x0 | _x1 | γ}; pos 1 + *ast.LexRepPattern:{_x0 | _x1 | γ}; pos 0 + *ast.LexAlt:_x0; pos 0 +) +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).MoveRegDefId in item.go:334 +items.(*ItemSet).dependentsClosure in itemset.go:199 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +id +*** Item: "id : _x {_x0 | _x1 | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | _x1 | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | _x1 | \\u03b3}" + ** emoves: +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.ItemList.Closure in itemlist.go:80 +items.(*ItemSet).Next in itemset.go:165 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_x1 +*** Item: "_x1 : \\u03b2 _digit {_digit}" + ** emoves: +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.ItemList.Closure in itemlist.go:80 +items.(*ItemSet).Next in itemset.go:165 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_x0 +*** Item: "_x0 : \\u03b1" + ** emoves: +S4: #0: <"_x0 : \\u03b1 •"> +S4: #1: <"id : _x {_x0 | _x1 | \\u03b3} •"> +S4: #2: <"id : _x {_x0 | _x1 | • \\u03b3}"> +S4: #3: <"id : _x {_x0 | • _x1 | \\u03b3}"> +S4: #4: <"id : _x {• _x0 | _x1 | \\u03b3}"> +S4: #5: <"_x1 : • \\u03b2 _digit {_digit}"> +S4: #6: <"_x0 : • \\u03b1"> +S4: rng: "[\\u03b2,\\u03b2]" +------------------------------------------- +items.(*ItemSet).Next in itemset.go:159 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S4:rng="[\\u03b2,\\u03b2]" +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).Move in item.go:311 +items.(*ItemSet).Next in itemset.go:162 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_x1 + <"_x1 : • \\u03b2 _digit {_digit}">:move("[\\u03b2,\\u03b2]"):["_x1 : \\u03b2 • _digit {_digit}"] +------------------------------------------- +items.(*ItemSet).dependentsClosure in itemset.go:190 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S4:dependentsClosure S4 + actual: { + _x0 : α • + id : _x {_x0 | _x1 | γ} • + id : _x {_x0 | _x1 | • γ} + id : _x {_x0 | • _x1 | γ} + id : _x {• _x0 | _x1 | γ} + _x1 : • β _digit {_digit} + _x0 : • α +} +Transitions: + [α,α] -> S4 + [β,β] -> S-1 + [γ,γ] -> S-1 +Symbols classes: {[α,α], [β,β], [γ,γ]} + + items: ["_x1 : \u03b2 • _digit {_digit}"] +S4: ==> id : _x {_x0 | • _x1 | \u03b3} +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.ItemList.Closure in itemlist.go:80 +items.(*ItemSet).Next in itemset.go:165 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_digit +*** Item: "_digit : '0'-'9'" + ** emoves: +S4: #0: <"_x1 : \\u03b2 • _digit {_digit}"> +S4: #1: <"id : _x {_x0 | • _x1 | \\u03b3}"> +S4: #2: <"_digit : • '0'-'9'"> +S4: rng: "[\\u03b3,\\u03b3]" +------------------------------------------- +items.(*ItemSet).Next in itemset.go:159 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S4:rng="[\\u03b3,\\u03b3]" +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).Move in item.go:311 +items.(*ItemSet).Next in itemset.go:162 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +id +*** Item: "id : _x {_x0 | _x1 | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | _x1 | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | _x1 | \\u03b3}" + ** emoves: + <"id : _x {_x0 | _x1 | • \\u03b3}">:move("[\\u03b3,\\u03b3]"):["id : _x {_x0 | _x1 | \\u03b3} •" "id : _x {_x0 | _x1 | • \\u03b3}" "id : _x {_x0 | • _x1 | \\u03b3}" "id : _x {• _x0 | _x1 | \\u03b3}"] +------------------------------------------- +items.(*ItemSet).dependentsClosure in itemset.go:190 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S4:dependentsClosure S4 + actual: { + _x0 : α • + id : _x {_x0 | _x1 | γ} • + id : _x {_x0 | _x1 | • γ} + id : _x {_x0 | • _x1 | γ} + id : _x {• _x0 | _x1 | γ} + _x1 : • β _digit {_digit} + _x0 : • α +} +Transitions: + [α,α] -> S4 + [β,β] -> S5 + [γ,γ] -> S-1 +Symbols classes: {[α,α], [β,β], [γ,γ]} + + items: ["id : _x {_x0 | _x1 | \u03b3} •" "id : _x {_x0 | _x1 | • \u03b3}" "id : _x {_x0 | • _x1 | \u03b3}" "id : _x {• _x0 | _x1 | \u03b3}"] +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.ItemList.Closure in itemlist.go:80 +items.(*ItemSet).Next in itemset.go:165 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_x1 +*** Item: "_x1 : \\u03b2 _digit {_digit}" + ** emoves: +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.ItemList.Closure in itemlist.go:80 +items.(*ItemSet).Next in itemset.go:165 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_x0 +*** Item: "_x0 : \\u03b1" + ** emoves: +S4: #0: <"id : _x {_x0 | _x1 | \\u03b3} •"> +S4: #1: <"id : _x {_x0 | _x1 | • \\u03b3}"> +S4: #2: <"id : _x {_x0 | • _x1 | \\u03b3}"> +S4: #3: <"id : _x {• _x0 | _x1 | \\u03b3}"> +S4: #4: <"_x1 : • \\u03b2 _digit {_digit}"> +S4: #5: <"_x0 : • \\u03b1"> +S5/8 +S5: rng: "['0','9']" +------------------------------------------- +items.(*ItemSet).Next in itemset.go:159 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S5:rng="['0','9']" +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).Move in item.go:311 +items.(*ItemSet).Next in itemset.go:162 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_digit +*** Item: "_digit : '0'-'9'" + ** emoves: + <"_digit : • '0'-'9'">:move("['0','9']"):["_digit : '0'-'9' •"] +------------------------------------------- +items.(*ItemSet).dependentsClosure in itemset.go:190 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S5:dependentsClosure S5 + actual: { + _x1 : β • _digit {_digit} + id : _x {_x0 | • _x1 | γ} + _digit : • '0'-'9' +} +Transitions: + ['0','9'] -> S-1 +Symbols classes: {['0','9']} + + items: ["_digit : '0'-'9' •"] +------------------------------------------- +items.(*Item).MoveRegDefId in item.go:333 +items.(*ItemSet).dependentsClosure in itemset.go:195 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 + * moved item: + *ast.LexPattern:β _digit {_digit}; pos 0 + *ast.LexAlt:β _digit {_digit}; pos 2 + +was: + *ast.LexPattern:β _digit {_digit}; pos 0 + *ast.LexAlt:β _digit {_digit}; pos 1 +) +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).MoveRegDefId in item.go:334 +items.(*ItemSet).dependentsClosure in itemset.go:195 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_x1 +*** Item: "_x1 : \\u03b2 _digit • {_digit}" + ** emoves: +*** Item: "_x1 : \\u03b2 _digit {_digit}" + ** emoves: +*** Item: "_x1 : \\u03b2 _digit {_digit}" + ** emoves: +S5: ====> _x1 : \u03b2 _digit {_digit} • +S5: ====> _x1 : \u03b2 _digit {• _digit} +------------------------------------------- +items.(*Item).MoveRegDefId in item.go:333 +items.(*ItemSet).dependentsClosure in itemset.go:199 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 + * moved item: + *ast.LexPattern:β _digit {_digit}; pos 0 + *ast.LexAlt:β _digit {_digit}; pos 2 + +was: + *ast.LexPattern:β _digit {_digit}; pos 0 + *ast.LexAlt:β _digit {_digit}; pos 1 +) +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).MoveRegDefId in item.go:334 +items.(*ItemSet).dependentsClosure in itemset.go:199 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_x1 +*** Item: "_x1 : \\u03b2 _digit • {_digit}" + ** emoves: +*** Item: "_x1 : \\u03b2 _digit {_digit}" + ** emoves: +*** Item: "_x1 : \\u03b2 _digit {_digit}" + ** emoves: +------------------------------------------- +items.(*Item).MoveRegDefId in item.go:333 +items.(*ItemSet).dependentsClosure in itemset.go:195 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 + * moved item: + *ast.LexPattern:_x {_x0 | _x1 | γ}; pos 0 + *ast.LexAlt:_x {_x0 | _x1 | γ}; pos 1 + *ast.LexRepPattern:{_x0 | _x1 | γ}; pos 1 + *ast.LexAlt:_x1; pos 1 + +was: + *ast.LexPattern:_x {_x0 | _x1 | γ}; pos 0 + *ast.LexAlt:_x {_x0 | _x1 | γ}; pos 1 + *ast.LexRepPattern:{_x0 | _x1 | γ}; pos 1 + *ast.LexAlt:_x1; pos 0 +) +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).MoveRegDefId in item.go:334 +items.(*ItemSet).dependentsClosure in itemset.go:195 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +id +*** Item: "id : _x {_x0 | _x1 | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | _x1 | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | _x1 | \\u03b3}" + ** emoves: +S5: ====> id : _x {_x0 | _x1 | \u03b3} • +S5: ====> id : _x {_x0 | _x1 | • \u03b3} +S5: ====> id : _x {_x0 | • _x1 | \u03b3} +S5: ====> id : _x {• _x0 | _x1 | \u03b3} +------------------------------------------- +items.(*Item).MoveRegDefId in item.go:333 +items.(*ItemSet).dependentsClosure in itemset.go:199 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 + * moved item: + *ast.LexPattern:_x {_x0 | _x1 | γ}; pos 0 + *ast.LexAlt:_x {_x0 | _x1 | γ}; pos 1 + *ast.LexRepPattern:{_x0 | _x1 | γ}; pos 1 + *ast.LexAlt:_x1; pos 1 + +was: + *ast.LexPattern:_x {_x0 | _x1 | γ}; pos 0 + *ast.LexAlt:_x {_x0 | _x1 | γ}; pos 1 + *ast.LexRepPattern:{_x0 | _x1 | γ}; pos 1 + *ast.LexAlt:_x1; pos 0 +) +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).MoveRegDefId in item.go:334 +items.(*ItemSet).dependentsClosure in itemset.go:199 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +id +*** Item: "id : _x {_x0 | _x1 | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | _x1 | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | _x1 | \\u03b3}" + ** emoves: +S5: ==> id : _x {_x0 | • _x1 | \u03b3} +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.ItemList.Closure in itemlist.go:80 +items.(*ItemSet).Next in itemset.go:165 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_digit +*** Item: "_digit : '0'-'9'" + ** emoves: +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.ItemList.Closure in itemlist.go:80 +items.(*ItemSet).Next in itemset.go:165 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_x0 +*** Item: "_x0 : \\u03b1" + ** emoves: +S5: #0: <"_digit : '0'-'9' •"> +S5: #1: <"_x1 : \\u03b2 _digit {_digit} •"> +S5: #2: <"_x1 : \\u03b2 _digit {• _digit}"> +S5: #3: <"id : _x {_x0 | _x1 | \\u03b3} •"> +S5: #4: <"id : _x {_x0 | _x1 | • \\u03b3}"> +S5: #5: <"id : _x {_x0 | • _x1 | \\u03b3}"> +S5: #6: <"id : _x {• _x0 | _x1 | \\u03b3}"> +S5: #7: <"_digit : • '0'-'9'"> +S5: #8: <"_x0 : • \\u03b1"> +S6/9 +S6: rng: "[\\u03b1,\\u03b1]" +------------------------------------------- +items.(*ItemSet).Next in itemset.go:159 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S6:rng="[\\u03b1,\\u03b1]" +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).Move in item.go:311 +items.(*ItemSet).Next in itemset.go:162 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_x0 +*** Item: "_x0 : \\u03b1" + ** emoves: + <"_x0 : • \\u03b1">:move("[\\u03b1,\\u03b1]"):["_x0 : \\u03b1 •"] +------------------------------------------- +items.(*ItemSet).dependentsClosure in itemset.go:190 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S6:dependentsClosure S6 + actual: { + id : _x {_x0 | _x1 | γ} • + id : _x {_x0 | _x1 | • γ} + id : _x {_x0 | • _x1 | γ} + id : _x {• _x0 | _x1 | γ} + _x1 : • β _digit {_digit} + _x0 : • α +} +Transitions: + [α,α] -> S-1 + [β,β] -> S-1 + [γ,γ] -> S-1 +Symbols classes: {[α,α], [β,β], [γ,γ]} + + items: ["_x0 : \u03b1 •"] +------------------------------------------- +items.(*Item).MoveRegDefId in item.go:333 +items.(*ItemSet).dependentsClosure in itemset.go:195 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 + * moved item: + *ast.LexPattern:_x {_x0 | _x1 | γ}; pos 0 + *ast.LexAlt:_x {_x0 | _x1 | γ}; pos 1 + *ast.LexRepPattern:{_x0 | _x1 | γ}; pos 0 + *ast.LexAlt:_x0; pos 1 + +was: + *ast.LexPattern:_x {_x0 | _x1 | γ}; pos 0 + *ast.LexAlt:_x {_x0 | _x1 | γ}; pos 1 + *ast.LexRepPattern:{_x0 | _x1 | γ}; pos 0 + *ast.LexAlt:_x0; pos 0 +) +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).MoveRegDefId in item.go:334 +items.(*ItemSet).dependentsClosure in itemset.go:195 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +id +*** Item: "id : _x {_x0 | _x1 | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | _x1 | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | _x1 | \\u03b3}" + ** emoves: +S6: ====> id : _x {_x0 | _x1 | \u03b3} • +S6: ====> id : _x {_x0 | _x1 | • \u03b3} +S6: ====> id : _x {_x0 | • _x1 | \u03b3} +S6: ====> id : _x {• _x0 | _x1 | \u03b3} +------------------------------------------- +items.(*Item).MoveRegDefId in item.go:333 +items.(*ItemSet).dependentsClosure in itemset.go:199 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 + * moved item: + *ast.LexPattern:_x {_x0 | _x1 | γ}; pos 0 + *ast.LexAlt:_x {_x0 | _x1 | γ}; pos 1 + *ast.LexRepPattern:{_x0 | _x1 | γ}; pos 0 + *ast.LexAlt:_x0; pos 1 + +was: + *ast.LexPattern:_x {_x0 | _x1 | γ}; pos 0 + *ast.LexAlt:_x {_x0 | _x1 | γ}; pos 1 + *ast.LexRepPattern:{_x0 | _x1 | γ}; pos 0 + *ast.LexAlt:_x0; pos 0 +) +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).MoveRegDefId in item.go:334 +items.(*ItemSet).dependentsClosure in itemset.go:199 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +id +*** Item: "id : _x {_x0 | _x1 | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | _x1 | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | _x1 | \\u03b3}" + ** emoves: +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.ItemList.Closure in itemlist.go:80 +items.(*ItemSet).Next in itemset.go:165 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_x1 +*** Item: "_x1 : \\u03b2 _digit {_digit}" + ** emoves: +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.ItemList.Closure in itemlist.go:80 +items.(*ItemSet).Next in itemset.go:165 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_x0 +*** Item: "_x0 : \\u03b1" + ** emoves: +S6: #0: <"_x0 : \\u03b1 •"> +S6: #1: <"id : _x {_x0 | _x1 | \\u03b3} •"> +S6: #2: <"id : _x {_x0 | _x1 | • \\u03b3}"> +S6: #3: <"id : _x {_x0 | • _x1 | \\u03b3}"> +S6: #4: <"id : _x {• _x0 | _x1 | \\u03b3}"> +S6: #5: <"_x1 : • \\u03b2 _digit {_digit}"> +S6: #6: <"_x0 : • \\u03b1"> +S6: rng: "[\\u03b2,\\u03b2]" +------------------------------------------- +items.(*ItemSet).Next in itemset.go:159 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S6:rng="[\\u03b2,\\u03b2]" +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).Move in item.go:311 +items.(*ItemSet).Next in itemset.go:162 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_x1 + <"_x1 : • \\u03b2 _digit {_digit}">:move("[\\u03b2,\\u03b2]"):["_x1 : \\u03b2 • _digit {_digit}"] +------------------------------------------- +items.(*ItemSet).dependentsClosure in itemset.go:190 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S6:dependentsClosure S6 + actual: { + id : _x {_x0 | _x1 | γ} • + id : _x {_x0 | _x1 | • γ} + id : _x {_x0 | • _x1 | γ} + id : _x {• _x0 | _x1 | γ} + _x1 : • β _digit {_digit} + _x0 : • α +} +Transitions: + [α,α] -> S4 + [β,β] -> S-1 + [γ,γ] -> S-1 +Symbols classes: {[α,α], [β,β], [γ,γ]} + + items: ["_x1 : \u03b2 • _digit {_digit}"] +S6: ==> id : _x {_x0 | • _x1 | \u03b3} +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.ItemList.Closure in itemlist.go:80 +items.(*ItemSet).Next in itemset.go:165 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_digit +*** Item: "_digit : '0'-'9'" + ** emoves: +S6: #0: <"_x1 : \\u03b2 • _digit {_digit}"> +S6: #1: <"id : _x {_x0 | • _x1 | \\u03b3}"> +S6: #2: <"_digit : • '0'-'9'"> +S6: rng: "[\\u03b3,\\u03b3]" +------------------------------------------- +items.(*ItemSet).Next in itemset.go:159 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S6:rng="[\\u03b3,\\u03b3]" +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).Move in item.go:311 +items.(*ItemSet).Next in itemset.go:162 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +id +*** Item: "id : _x {_x0 | _x1 | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | _x1 | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | _x1 | \\u03b3}" + ** emoves: + <"id : _x {_x0 | _x1 | • \\u03b3}">:move("[\\u03b3,\\u03b3]"):["id : _x {_x0 | _x1 | \\u03b3} •" "id : _x {_x0 | _x1 | • \\u03b3}" "id : _x {_x0 | • _x1 | \\u03b3}" "id : _x {• _x0 | _x1 | \\u03b3}"] +------------------------------------------- +items.(*ItemSet).dependentsClosure in itemset.go:190 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S6:dependentsClosure S6 + actual: { + id : _x {_x0 | _x1 | γ} • + id : _x {_x0 | _x1 | • γ} + id : _x {_x0 | • _x1 | γ} + id : _x {• _x0 | _x1 | γ} + _x1 : • β _digit {_digit} + _x0 : • α +} +Transitions: + [α,α] -> S4 + [β,β] -> S5 + [γ,γ] -> S-1 +Symbols classes: {[α,α], [β,β], [γ,γ]} + + items: ["id : _x {_x0 | _x1 | \u03b3} •" "id : _x {_x0 | _x1 | • \u03b3}" "id : _x {_x0 | • _x1 | \u03b3}" "id : _x {• _x0 | _x1 | \u03b3}"] +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.ItemList.Closure in itemlist.go:80 +items.(*ItemSet).Next in itemset.go:165 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_x1 +*** Item: "_x1 : \\u03b2 _digit {_digit}" + ** emoves: +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.ItemList.Closure in itemlist.go:80 +items.(*ItemSet).Next in itemset.go:165 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_x0 +*** Item: "_x0 : \\u03b1" + ** emoves: +S6: #0: <"id : _x {_x0 | _x1 | \\u03b3} •"> +S6: #1: <"id : _x {_x0 | _x1 | • \\u03b3}"> +S6: #2: <"id : _x {_x0 | • _x1 | \\u03b3}"> +S6: #3: <"id : _x {• _x0 | _x1 | \\u03b3}"> +S6: #4: <"_x1 : • \\u03b2 _digit {_digit}"> +S6: #5: <"_x0 : • \\u03b1"> +S7/9 +S7: rng: "['0','9']" +------------------------------------------- +items.(*ItemSet).Next in itemset.go:159 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S7:rng="['0','9']" +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).Move in item.go:311 +items.(*ItemSet).Next in itemset.go:162 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_digit +*** Item: "_digit : '0'-'9'" + ** emoves: + <"_digit : • '0'-'9'">:move("['0','9']"):["_digit : '0'-'9' •"] +------------------------------------------- +items.(*ItemSet).dependentsClosure in itemset.go:190 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S7:dependentsClosure S7 + actual: { + _digit : '0'-'9' • + _x : (α | (β _digit {_digit})) • + _x : α | (β _digit {• _digit}) + id : _x {_x0 | _x1 | γ} • + id : _x {_x0 | _x1 | • γ} + id : _x {_x0 | • _x1 | γ} + id : _x {• _x0 | _x1 | γ} + id : • _x {_x0 | _x1 | γ} + _digit : • '0'-'9' + _x1 : • β _digit {_digit} + _x0 : • α +} +Transitions: + ['0','9'] -> S-1 + [α,α] -> S-1 + [β,β] -> S-1 + [γ,γ] -> S-1 +Symbols classes: {['0','9'], [α,α], [β,β], [γ,γ]} + + items: ["_digit : '0'-'9' •"] +------------------------------------------- +items.(*Item).MoveRegDefId in item.go:333 +items.(*ItemSet).dependentsClosure in itemset.go:195 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 + * moved item: + *ast.LexPattern:α | (β _digit {_digit}); pos 1 + *ast.LexAlt:(β _digit {_digit}); pos 0 + *ast.LexGroupPattern:(β _digit {_digit}); pos 0 + *ast.LexAlt:β _digit {_digit}; pos 2 + *ast.LexRepPattern:{_digit}; pos 0 + *ast.LexAlt:_digit; pos 1 + +was: + *ast.LexPattern:α | (β _digit {_digit}); pos 1 + *ast.LexAlt:(β _digit {_digit}); pos 0 + *ast.LexGroupPattern:(β _digit {_digit}); pos 0 + *ast.LexAlt:β _digit {_digit}; pos 2 + *ast.LexRepPattern:{_digit}; pos 0 + *ast.LexAlt:_digit; pos 0 +) +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).MoveRegDefId in item.go:334 +items.(*ItemSet).dependentsClosure in itemset.go:195 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_x +*** Item: "_x : \\u03b1 | (\\u03b2 _digit {_digit})" + ** emoves: +*** Item: "_x : \\u03b1 | (\\u03b2 _digit {_digit})" + ** emoves: +*** Item: "_x : \\u03b1 | (\\u03b2 _digit {_digit})" + ** emoves: +*** Item: "_x : \\u03b1 | (\\u03b2 _digit {_digit})" + ** emoves: +*** Item: "_x : \\u03b1 | (\\u03b2 _digit {_digit})" + ** emoves: +S7: ====> _x : (\u03b1 | (\u03b2 _digit {_digit})) • +S7: ====> _x : \u03b1 | (\u03b2 _digit {• _digit}) +------------------------------------------- +items.(*Item).MoveRegDefId in item.go:333 +items.(*ItemSet).dependentsClosure in itemset.go:199 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 + * moved item: + *ast.LexPattern:α | (β _digit {_digit}); pos 1 + *ast.LexAlt:(β _digit {_digit}); pos 0 + *ast.LexGroupPattern:(β _digit {_digit}); pos 0 + *ast.LexAlt:β _digit {_digit}; pos 2 + *ast.LexRepPattern:{_digit}; pos 0 + *ast.LexAlt:_digit; pos 1 + +was: + *ast.LexPattern:α | (β _digit {_digit}); pos 1 + *ast.LexAlt:(β _digit {_digit}); pos 0 + *ast.LexGroupPattern:(β _digit {_digit}); pos 0 + *ast.LexAlt:β _digit {_digit}; pos 2 + *ast.LexRepPattern:{_digit}; pos 0 + *ast.LexAlt:_digit; pos 0 +) +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).MoveRegDefId in item.go:334 +items.(*ItemSet).dependentsClosure in itemset.go:199 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_x +*** Item: "_x : \\u03b1 | (\\u03b2 _digit {_digit})" + ** emoves: +*** Item: "_x : \\u03b1 | (\\u03b2 _digit {_digit})" + ** emoves: +*** Item: "_x : \\u03b1 | (\\u03b2 _digit {_digit})" + ** emoves: +*** Item: "_x : \\u03b1 | (\\u03b2 _digit {_digit})" + ** emoves: +*** Item: "_x : \\u03b1 | (\\u03b2 _digit {_digit})" + ** emoves: +------------------------------------------- +items.(*Item).MoveRegDefId in item.go:333 +items.(*ItemSet).dependentsClosure in itemset.go:195 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 + * moved item: + *ast.LexPattern:_x {_x0 | _x1 | γ}; pos 0 + *ast.LexAlt:_x {_x0 | _x1 | γ}; pos 1 + +was: + *ast.LexPattern:_x {_x0 | _x1 | γ}; pos 0 + *ast.LexAlt:_x {_x0 | _x1 | γ}; pos 0 +) +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).MoveRegDefId in item.go:334 +items.(*ItemSet).dependentsClosure in itemset.go:195 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +id +*** Item: "id : _x • {_x0 | _x1 | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | _x1 | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | _x1 | \\u03b3}" + ** emoves: +S7: ====> id : _x {_x0 | _x1 | \u03b3} • +S7: ====> id : _x {_x0 | _x1 | • \u03b3} +S7: ====> id : _x {_x0 | • _x1 | \u03b3} +S7: ====> id : _x {• _x0 | _x1 | \u03b3} +------------------------------------------- +items.(*Item).MoveRegDefId in item.go:333 +items.(*ItemSet).dependentsClosure in itemset.go:199 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 + * moved item: + *ast.LexPattern:_x {_x0 | _x1 | γ}; pos 0 + *ast.LexAlt:_x {_x0 | _x1 | γ}; pos 1 + +was: + *ast.LexPattern:_x {_x0 | _x1 | γ}; pos 0 + *ast.LexAlt:_x {_x0 | _x1 | γ}; pos 0 +) +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).MoveRegDefId in item.go:334 +items.(*ItemSet).dependentsClosure in itemset.go:199 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +id +*** Item: "id : _x • {_x0 | _x1 | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | _x1 | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | _x1 | \\u03b3}" + ** emoves: +S7: ==> id : • _x {_x0 | _x1 | \u03b3} +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.ItemList.Closure in itemlist.go:80 +items.(*ItemSet).Next in itemset.go:165 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_digit +*** Item: "_digit : '0'-'9'" + ** emoves: +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.ItemList.Closure in itemlist.go:80 +items.(*ItemSet).Next in itemset.go:165 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_x1 +*** Item: "_x1 : \\u03b2 _digit {_digit}" + ** emoves: +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.ItemList.Closure in itemlist.go:80 +items.(*ItemSet).Next in itemset.go:165 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_x0 +*** Item: "_x0 : \\u03b1" + ** emoves: +S7: #0: <"_digit : '0'-'9' •"> +S7: #1: <"_x : (\\u03b1 | (\\u03b2 _digit {_digit})) •"> +S7: #2: <"_x : \\u03b1 | (\\u03b2 _digit {• _digit})"> +S7: #3: <"id : _x {_x0 | _x1 | \\u03b3} •"> +S7: #4: <"id : _x {_x0 | _x1 | • \\u03b3}"> +S7: #5: <"id : _x {_x0 | • _x1 | \\u03b3}"> +S7: #6: <"id : _x {• _x0 | _x1 | \\u03b3}"> +S7: #7: <"id : • _x {_x0 | _x1 | \\u03b3}"> +S7: #8: <"_digit : • '0'-'9'"> +S7: #9: <"_x1 : • \\u03b2 _digit {_digit}"> +S7: #10: <"_x0 : • \\u03b1"> +S7: rng: "[\\u03b1,\\u03b1]" +------------------------------------------- +items.(*ItemSet).Next in itemset.go:159 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S7:rng="[\\u03b1,\\u03b1]" +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).Move in item.go:311 +items.(*ItemSet).Next in itemset.go:162 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_x0 +*** Item: "_x0 : \\u03b1" + ** emoves: + <"_x0 : • \\u03b1">:move("[\\u03b1,\\u03b1]"):["_x0 : \\u03b1 •"] +------------------------------------------- +items.(*ItemSet).dependentsClosure in itemset.go:190 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S7:dependentsClosure S7 + actual: { + _digit : '0'-'9' • + _x : (α | (β _digit {_digit})) • + _x : α | (β _digit {• _digit}) + id : _x {_x0 | _x1 | γ} • + id : _x {_x0 | _x1 | • γ} + id : _x {_x0 | • _x1 | γ} + id : _x {• _x0 | _x1 | γ} + id : • _x {_x0 | _x1 | γ} + _digit : • '0'-'9' + _x1 : • β _digit {_digit} + _x0 : • α +} +Transitions: + ['0','9'] -> S7 + [α,α] -> S-1 + [β,β] -> S-1 + [γ,γ] -> S-1 +Symbols classes: {['0','9'], [α,α], [β,β], [γ,γ]} + + items: ["_x0 : \u03b1 •"] +------------------------------------------- +items.(*Item).MoveRegDefId in item.go:333 +items.(*ItemSet).dependentsClosure in itemset.go:195 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 + * moved item: + *ast.LexPattern:_x {_x0 | _x1 | γ}; pos 0 + *ast.LexAlt:_x {_x0 | _x1 | γ}; pos 1 + *ast.LexRepPattern:{_x0 | _x1 | γ}; pos 0 + *ast.LexAlt:_x0; pos 1 + +was: + *ast.LexPattern:_x {_x0 | _x1 | γ}; pos 0 + *ast.LexAlt:_x {_x0 | _x1 | γ}; pos 1 + *ast.LexRepPattern:{_x0 | _x1 | γ}; pos 0 + *ast.LexAlt:_x0; pos 0 +) +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).MoveRegDefId in item.go:334 +items.(*ItemSet).dependentsClosure in itemset.go:195 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +id +*** Item: "id : _x {_x0 | _x1 | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | _x1 | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | _x1 | \\u03b3}" + ** emoves: +S7: ====> id : _x {_x0 | _x1 | \u03b3} • +S7: ====> id : _x {_x0 | _x1 | • \u03b3} +S7: ====> id : _x {_x0 | • _x1 | \u03b3} +S7: ====> id : _x {• _x0 | _x1 | \u03b3} +------------------------------------------- +items.(*Item).MoveRegDefId in item.go:333 +items.(*ItemSet).dependentsClosure in itemset.go:199 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 + * moved item: + *ast.LexPattern:_x {_x0 | _x1 | γ}; pos 0 + *ast.LexAlt:_x {_x0 | _x1 | γ}; pos 1 + *ast.LexRepPattern:{_x0 | _x1 | γ}; pos 0 + *ast.LexAlt:_x0; pos 1 + +was: + *ast.LexPattern:_x {_x0 | _x1 | γ}; pos 0 + *ast.LexAlt:_x {_x0 | _x1 | γ}; pos 1 + *ast.LexRepPattern:{_x0 | _x1 | γ}; pos 0 + *ast.LexAlt:_x0; pos 0 +) +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).MoveRegDefId in item.go:334 +items.(*ItemSet).dependentsClosure in itemset.go:199 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +id +*** Item: "id : _x {_x0 | _x1 | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | _x1 | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | _x1 | \\u03b3}" + ** emoves: +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.ItemList.Closure in itemlist.go:80 +items.(*ItemSet).Next in itemset.go:165 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_x1 +*** Item: "_x1 : \\u03b2 _digit {_digit}" + ** emoves: +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.ItemList.Closure in itemlist.go:80 +items.(*ItemSet).Next in itemset.go:165 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_x0 +*** Item: "_x0 : \\u03b1" + ** emoves: +S7: #0: <"_x0 : \\u03b1 •"> +S7: #1: <"id : _x {_x0 | _x1 | \\u03b3} •"> +S7: #2: <"id : _x {_x0 | _x1 | • \\u03b3}"> +S7: #3: <"id : _x {_x0 | • _x1 | \\u03b3}"> +S7: #4: <"id : _x {• _x0 | _x1 | \\u03b3}"> +S7: #5: <"_x1 : • \\u03b2 _digit {_digit}"> +S7: #6: <"_x0 : • \\u03b1"> +S7: rng: "[\\u03b2,\\u03b2]" +------------------------------------------- +items.(*ItemSet).Next in itemset.go:159 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S7:rng="[\\u03b2,\\u03b2]" +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).Move in item.go:311 +items.(*ItemSet).Next in itemset.go:162 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_x1 + <"_x1 : • \\u03b2 _digit {_digit}">:move("[\\u03b2,\\u03b2]"):["_x1 : \\u03b2 • _digit {_digit}"] +------------------------------------------- +items.(*ItemSet).dependentsClosure in itemset.go:190 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S7:dependentsClosure S7 + actual: { + _digit : '0'-'9' • + _x : (α | (β _digit {_digit})) • + _x : α | (β _digit {• _digit}) + id : _x {_x0 | _x1 | γ} • + id : _x {_x0 | _x1 | • γ} + id : _x {_x0 | • _x1 | γ} + id : _x {• _x0 | _x1 | γ} + id : • _x {_x0 | _x1 | γ} + _digit : • '0'-'9' + _x1 : • β _digit {_digit} + _x0 : • α +} +Transitions: + ['0','9'] -> S7 + [α,α] -> S4 + [β,β] -> S-1 + [γ,γ] -> S-1 +Symbols classes: {['0','9'], [α,α], [β,β], [γ,γ]} + + items: ["_x1 : \u03b2 • _digit {_digit}"] +S7: ==> id : _x {_x0 | • _x1 | \u03b3} +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.ItemList.Closure in itemlist.go:80 +items.(*ItemSet).Next in itemset.go:165 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_digit +*** Item: "_digit : '0'-'9'" + ** emoves: +S7: #0: <"_x1 : \\u03b2 • _digit {_digit}"> +S7: #1: <"id : _x {_x0 | • _x1 | \\u03b3}"> +S7: #2: <"_digit : • '0'-'9'"> +S7: rng: "[\\u03b3,\\u03b3]" +------------------------------------------- +items.(*ItemSet).Next in itemset.go:159 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S7:rng="[\\u03b3,\\u03b3]" +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).Move in item.go:311 +items.(*ItemSet).Next in itemset.go:162 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +id +*** Item: "id : _x {_x0 | _x1 | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | _x1 | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | _x1 | \\u03b3}" + ** emoves: + <"id : _x {_x0 | _x1 | • \\u03b3}">:move("[\\u03b3,\\u03b3]"):["id : _x {_x0 | _x1 | \\u03b3} •" "id : _x {_x0 | _x1 | • \\u03b3}" "id : _x {_x0 | • _x1 | \\u03b3}" "id : _x {• _x0 | _x1 | \\u03b3}"] +------------------------------------------- +items.(*ItemSet).dependentsClosure in itemset.go:190 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S7:dependentsClosure S7 + actual: { + _digit : '0'-'9' • + _x : (α | (β _digit {_digit})) • + _x : α | (β _digit {• _digit}) + id : _x {_x0 | _x1 | γ} • + id : _x {_x0 | _x1 | • γ} + id : _x {_x0 | • _x1 | γ} + id : _x {• _x0 | _x1 | γ} + id : • _x {_x0 | _x1 | γ} + _digit : • '0'-'9' + _x1 : • β _digit {_digit} + _x0 : • α +} +Transitions: + ['0','9'] -> S7 + [α,α] -> S4 + [β,β] -> S5 + [γ,γ] -> S-1 +Symbols classes: {['0','9'], [α,α], [β,β], [γ,γ]} + + items: ["id : _x {_x0 | _x1 | \u03b3} •" "id : _x {_x0 | _x1 | • \u03b3}" "id : _x {_x0 | • _x1 | \u03b3}" "id : _x {• _x0 | _x1 | \u03b3}"] +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.ItemList.Closure in itemlist.go:80 +items.(*ItemSet).Next in itemset.go:165 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_x1 +*** Item: "_x1 : \\u03b2 _digit {_digit}" + ** emoves: +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.ItemList.Closure in itemlist.go:80 +items.(*ItemSet).Next in itemset.go:165 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_x0 +*** Item: "_x0 : \\u03b1" + ** emoves: +S7: #0: <"id : _x {_x0 | _x1 | \\u03b3} •"> +S7: #1: <"id : _x {_x0 | _x1 | • \\u03b3}"> +S7: #2: <"id : _x {_x0 | • _x1 | \\u03b3}"> +S7: #3: <"id : _x {• _x0 | _x1 | \\u03b3}"> +S7: #4: <"_x1 : • \\u03b2 _digit {_digit}"> +S7: #5: <"_x0 : • \\u03b1"> +S8/9 +S8: rng: "['0','9']" +------------------------------------------- +items.(*ItemSet).Next in itemset.go:159 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S8:rng="['0','9']" +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).Move in item.go:311 +items.(*ItemSet).Next in itemset.go:162 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_digit +*** Item: "_digit : '0'-'9'" + ** emoves: + <"_digit : • '0'-'9'">:move("['0','9']"):["_digit : '0'-'9' •"] +------------------------------------------- +items.(*ItemSet).dependentsClosure in itemset.go:190 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S8:dependentsClosure S8 + actual: { + _digit : '0'-'9' • + _x1 : β _digit {_digit} • + _x1 : β _digit {• _digit} + id : _x {_x0 | _x1 | γ} • + id : _x {_x0 | _x1 | • γ} + id : _x {_x0 | • _x1 | γ} + id : _x {• _x0 | _x1 | γ} + _digit : • '0'-'9' + _x0 : • α +} +Transitions: + ['0','9'] -> S-1 + [α,α] -> S-1 + [γ,γ] -> S-1 +Symbols classes: {['0','9'], [α,α], [γ,γ]} + + items: ["_digit : '0'-'9' •"] +------------------------------------------- +items.(*Item).MoveRegDefId in item.go:333 +items.(*ItemSet).dependentsClosure in itemset.go:195 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 + * moved item: + *ast.LexPattern:β _digit {_digit}; pos 0 + *ast.LexAlt:β _digit {_digit}; pos 2 + *ast.LexRepPattern:{_digit}; pos 0 + *ast.LexAlt:_digit; pos 1 + +was: + *ast.LexPattern:β _digit {_digit}; pos 0 + *ast.LexAlt:β _digit {_digit}; pos 2 + *ast.LexRepPattern:{_digit}; pos 0 + *ast.LexAlt:_digit; pos 0 +) +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).MoveRegDefId in item.go:334 +items.(*ItemSet).dependentsClosure in itemset.go:195 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_x1 +*** Item: "_x1 : \\u03b2 _digit {_digit}" + ** emoves: +*** Item: "_x1 : \\u03b2 _digit {_digit}" + ** emoves: +*** Item: "_x1 : \\u03b2 _digit {_digit}" + ** emoves: +S8: ====> _x1 : \u03b2 _digit {_digit} • +S8: ====> _x1 : \u03b2 _digit {• _digit} +------------------------------------------- +items.(*Item).MoveRegDefId in item.go:333 +items.(*ItemSet).dependentsClosure in itemset.go:199 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 + * moved item: + *ast.LexPattern:β _digit {_digit}; pos 0 + *ast.LexAlt:β _digit {_digit}; pos 2 + *ast.LexRepPattern:{_digit}; pos 0 + *ast.LexAlt:_digit; pos 1 + +was: + *ast.LexPattern:β _digit {_digit}; pos 0 + *ast.LexAlt:β _digit {_digit}; pos 2 + *ast.LexRepPattern:{_digit}; pos 0 + *ast.LexAlt:_digit; pos 0 +) +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).MoveRegDefId in item.go:334 +items.(*ItemSet).dependentsClosure in itemset.go:199 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_x1 +*** Item: "_x1 : \\u03b2 _digit {_digit}" + ** emoves: +*** Item: "_x1 : \\u03b2 _digit {_digit}" + ** emoves: +*** Item: "_x1 : \\u03b2 _digit {_digit}" + ** emoves: +------------------------------------------- +items.(*Item).MoveRegDefId in item.go:333 +items.(*ItemSet).dependentsClosure in itemset.go:195 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 + * moved item: + *ast.LexPattern:_x {_x0 | _x1 | γ}; pos 0 + *ast.LexAlt:_x {_x0 | _x1 | γ}; pos 1 + *ast.LexRepPattern:{_x0 | _x1 | γ}; pos 1 + *ast.LexAlt:_x1; pos 1 + +was: + *ast.LexPattern:_x {_x0 | _x1 | γ}; pos 0 + *ast.LexAlt:_x {_x0 | _x1 | γ}; pos 1 + *ast.LexRepPattern:{_x0 | _x1 | γ}; pos 1 + *ast.LexAlt:_x1; pos 0 +) +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).MoveRegDefId in item.go:334 +items.(*ItemSet).dependentsClosure in itemset.go:195 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +id +*** Item: "id : _x {_x0 | _x1 | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | _x1 | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | _x1 | \\u03b3}" + ** emoves: +S8: ====> id : _x {_x0 | _x1 | \u03b3} • +S8: ====> id : _x {_x0 | _x1 | • \u03b3} +S8: ====> id : _x {_x0 | • _x1 | \u03b3} +S8: ====> id : _x {• _x0 | _x1 | \u03b3} +------------------------------------------- +items.(*Item).MoveRegDefId in item.go:333 +items.(*ItemSet).dependentsClosure in itemset.go:199 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 + * moved item: + *ast.LexPattern:_x {_x0 | _x1 | γ}; pos 0 + *ast.LexAlt:_x {_x0 | _x1 | γ}; pos 1 + *ast.LexRepPattern:{_x0 | _x1 | γ}; pos 1 + *ast.LexAlt:_x1; pos 1 + +was: + *ast.LexPattern:_x {_x0 | _x1 | γ}; pos 0 + *ast.LexAlt:_x {_x0 | _x1 | γ}; pos 1 + *ast.LexRepPattern:{_x0 | _x1 | γ}; pos 1 + *ast.LexAlt:_x1; pos 0 +) +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).MoveRegDefId in item.go:334 +items.(*ItemSet).dependentsClosure in itemset.go:199 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +id +*** Item: "id : _x {_x0 | _x1 | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | _x1 | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | _x1 | \\u03b3}" + ** emoves: +S8: ==> id : _x {_x0 | • _x1 | \u03b3} +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.ItemList.Closure in itemlist.go:80 +items.(*ItemSet).Next in itemset.go:165 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_digit +*** Item: "_digit : '0'-'9'" + ** emoves: +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.ItemList.Closure in itemlist.go:80 +items.(*ItemSet).Next in itemset.go:165 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_x0 +*** Item: "_x0 : \\u03b1" + ** emoves: +S8: #0: <"_digit : '0'-'9' •"> +S8: #1: <"_x1 : \\u03b2 _digit {_digit} •"> +S8: #2: <"_x1 : \\u03b2 _digit {• _digit}"> +S8: #3: <"id : _x {_x0 | _x1 | \\u03b3} •"> +S8: #4: <"id : _x {_x0 | _x1 | • \\u03b3}"> +S8: #5: <"id : _x {_x0 | • _x1 | \\u03b3}"> +S8: #6: <"id : _x {• _x0 | _x1 | \\u03b3}"> +S8: #7: <"_digit : • '0'-'9'"> +S8: #8: <"_x0 : • \\u03b1"> +S8: rng: "[\\u03b1,\\u03b1]" +------------------------------------------- +items.(*ItemSet).Next in itemset.go:159 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S8:rng="[\\u03b1,\\u03b1]" +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).Move in item.go:311 +items.(*ItemSet).Next in itemset.go:162 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_x0 +*** Item: "_x0 : \\u03b1" + ** emoves: + <"_x0 : • \\u03b1">:move("[\\u03b1,\\u03b1]"):["_x0 : \\u03b1 •"] +------------------------------------------- +items.(*ItemSet).dependentsClosure in itemset.go:190 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S8:dependentsClosure S8 + actual: { + _digit : '0'-'9' • + _x1 : β _digit {_digit} • + _x1 : β _digit {• _digit} + id : _x {_x0 | _x1 | γ} • + id : _x {_x0 | _x1 | • γ} + id : _x {_x0 | • _x1 | γ} + id : _x {• _x0 | _x1 | γ} + _digit : • '0'-'9' + _x0 : • α +} +Transitions: + ['0','9'] -> S8 + [α,α] -> S-1 + [γ,γ] -> S-1 +Symbols classes: {['0','9'], [α,α], [γ,γ]} + + items: ["_x0 : \u03b1 •"] +------------------------------------------- +items.(*Item).MoveRegDefId in item.go:333 +items.(*ItemSet).dependentsClosure in itemset.go:195 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 + * moved item: + *ast.LexPattern:_x {_x0 | _x1 | γ}; pos 0 + *ast.LexAlt:_x {_x0 | _x1 | γ}; pos 1 + *ast.LexRepPattern:{_x0 | _x1 | γ}; pos 0 + *ast.LexAlt:_x0; pos 1 + +was: + *ast.LexPattern:_x {_x0 | _x1 | γ}; pos 0 + *ast.LexAlt:_x {_x0 | _x1 | γ}; pos 1 + *ast.LexRepPattern:{_x0 | _x1 | γ}; pos 0 + *ast.LexAlt:_x0; pos 0 +) +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).MoveRegDefId in item.go:334 +items.(*ItemSet).dependentsClosure in itemset.go:195 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +id +*** Item: "id : _x {_x0 | _x1 | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | _x1 | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | _x1 | \\u03b3}" + ** emoves: +S8: ====> id : _x {_x0 | _x1 | \u03b3} • +S8: ====> id : _x {_x0 | _x1 | • \u03b3} +S8: ====> id : _x {_x0 | • _x1 | \u03b3} +S8: ====> id : _x {• _x0 | _x1 | \u03b3} +------------------------------------------- +items.(*Item).MoveRegDefId in item.go:333 +items.(*ItemSet).dependentsClosure in itemset.go:199 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 + * moved item: + *ast.LexPattern:_x {_x0 | _x1 | γ}; pos 0 + *ast.LexAlt:_x {_x0 | _x1 | γ}; pos 1 + *ast.LexRepPattern:{_x0 | _x1 | γ}; pos 0 + *ast.LexAlt:_x0; pos 1 + +was: + *ast.LexPattern:_x {_x0 | _x1 | γ}; pos 0 + *ast.LexAlt:_x {_x0 | _x1 | γ}; pos 1 + *ast.LexRepPattern:{_x0 | _x1 | γ}; pos 0 + *ast.LexAlt:_x0; pos 0 +) +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).MoveRegDefId in item.go:334 +items.(*ItemSet).dependentsClosure in itemset.go:199 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +id +*** Item: "id : _x {_x0 | _x1 | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | _x1 | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | _x1 | \\u03b3}" + ** emoves: +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.ItemList.Closure in itemlist.go:80 +items.(*ItemSet).Next in itemset.go:165 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_x1 +*** Item: "_x1 : \\u03b2 _digit {_digit}" + ** emoves: +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.ItemList.Closure in itemlist.go:80 +items.(*ItemSet).Next in itemset.go:165 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_x0 +*** Item: "_x0 : \\u03b1" + ** emoves: +S8: #0: <"_x0 : \\u03b1 •"> +S8: #1: <"id : _x {_x0 | _x1 | \\u03b3} •"> +S8: #2: <"id : _x {_x0 | _x1 | • \\u03b3}"> +S8: #3: <"id : _x {_x0 | • _x1 | \\u03b3}"> +S8: #4: <"id : _x {• _x0 | _x1 | \\u03b3}"> +S8: #5: <"_x1 : • \\u03b2 _digit {_digit}"> +S8: #6: <"_x0 : • \\u03b1"> +S8: rng: "[\\u03b3,\\u03b3]" +------------------------------------------- +items.(*ItemSet).Next in itemset.go:159 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S8:rng="[\\u03b3,\\u03b3]" +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).Move in item.go:311 +items.(*ItemSet).Next in itemset.go:162 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +id +*** Item: "id : _x {_x0 | _x1 | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | _x1 | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | _x1 | \\u03b3}" + ** emoves: + <"id : _x {_x0 | _x1 | • \\u03b3}">:move("[\\u03b3,\\u03b3]"):["id : _x {_x0 | _x1 | \\u03b3} •" "id : _x {_x0 | _x1 | • \\u03b3}" "id : _x {_x0 | • _x1 | \\u03b3}" "id : _x {• _x0 | _x1 | \\u03b3}"] +------------------------------------------- +items.(*ItemSet).dependentsClosure in itemset.go:190 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S8:dependentsClosure S8 + actual: { + _digit : '0'-'9' • + _x1 : β _digit {_digit} • + _x1 : β _digit {• _digit} + id : _x {_x0 | _x1 | γ} • + id : _x {_x0 | _x1 | • γ} + id : _x {_x0 | • _x1 | γ} + id : _x {• _x0 | _x1 | γ} + _digit : • '0'-'9' + _x0 : • α +} +Transitions: + ['0','9'] -> S8 + [α,α] -> S4 + [γ,γ] -> S-1 +Symbols classes: {['0','9'], [α,α], [γ,γ]} + + items: ["id : _x {_x0 | _x1 | \u03b3} •" "id : _x {_x0 | _x1 | • \u03b3}" "id : _x {_x0 | • _x1 | \u03b3}" "id : _x {• _x0 | _x1 | \u03b3}"] +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.ItemList.Closure in itemlist.go:80 +items.(*ItemSet).Next in itemset.go:165 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_x1 +*** Item: "_x1 : \\u03b2 _digit {_digit}" + ** emoves: +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.ItemList.Closure in itemlist.go:80 +items.(*ItemSet).Next in itemset.go:165 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_x0 +*** Item: "_x0 : \\u03b1" + ** emoves: +S8: #0: <"id : _x {_x0 | _x1 | \\u03b3} •"> +S8: #1: <"id : _x {_x0 | _x1 | • \\u03b3}"> +S8: #2: <"id : _x {_x0 | • _x1 | \\u03b3}"> +S8: #3: <"id : _x {• _x0 | _x1 | \\u03b3}"> +S8: #4: <"_x1 : • \\u03b2 _digit {_digit}"> +S8: #5: <"_x0 : • \\u03b1"> diff --git a/example/ctx/ctx1.log b/example/ctx/ctx1.log new file mode 100644 index 00000000..29ece9bf --- /dev/null +++ b/example/ctx/ctx1.log @@ -0,0 +1,2485 @@ +gocc version 1.3.0001 +-a = true +-debug_lexer = false +-debug_parser = false +-h = false +-no_lexer = false +-o = /home/max/go/src/github.com/maxcalandrelli/gocc/example/ctx/ctx1.grammar/ctx1 +-p = github.com/maxcalandrelli/gocc/example/ctx/ctx1.grammar/ctx1 +-u = false +-v = true +-internal = internal +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.ItemsSet0 in itemset.go:62 +items.GetItemSets in itemsets.go:39 +id +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.ItemsSet0 in itemset.go:62 +items.GetItemSets in itemsets.go:39 +!whitespace +*** Item: "!whitespace : ' ' | '\\t' | '\\n' | '\\r'" + ** emoves: +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.ItemList.Closure in itemlist.go:80 +items.NewItemSet in itemset.go:46 +items.(*ItemSets).Add in itemsets.go:49 +items.GetItemSets in itemsets.go:39 +_x +*** Item: "_x : \\u03b1 | (\\u03b2 _digit {_digit})" + ** emoves: +*** Item: "_x : \\u03b1 | • (\\u03b2 _digit {_digit})" + ** emoves: +*** Item: "_x : \\u03b1 | (\\u03b2 _digit {_digit})" + ** emoves: +------------------------------------------- +items.(*ItemSets).Closure in itemsets.go:54 +items.GetItemSets in itemsets.go:41 +S0/1 +S0: rng: "['\\t','\\t']" +------------------------------------------- +items.(*ItemSet).Next in itemset.go:159 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S0:rng="['\\t','\\t']" +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).Move in item.go:311 +items.(*ItemSet).Next in itemset.go:162 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +!whitespace +*** Item: "!whitespace : ' ' | '\\t' | '\\n' | '\\r'" + ** emoves: + <"!whitespace : ' ' | • '\\t' | '\\n' | '\\r'">:move("['\\t','\\t']"):["!whitespace : (' ' | '\\t' | '\\n' | '\\r') •"] +------------------------------------------- +items.(*ItemSet).dependentsClosure in itemset.go:190 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S0:dependentsClosure S0 + actual: { + id : • _x {_x0 | (β _digit {_digit}) | γ} + !whitespace : ' ' | ' ' | ' +' | • ' ' + !whitespace : ' ' | ' ' | • ' +' | ' ' + !whitespace : ' ' | • ' ' | ' +' | ' ' + !whitespace : • ' ' | ' ' | ' +' | ' ' + _x : α | (• β _digit {_digit}) + _x : • α | (β _digit {_digit}) +} +Transitions: + [' ',' '] -> S-1 + [' +',' +'] -> S-1 + [' ',' '] -> S-1 + [' ',' '] -> S-1 + [α,α] -> S-1 + [β,β] -> S-1 +Symbols classes: {[' ',' '], [' +',' +'], [' ',' '], [' ',' '], [α,α], [β,β]} + + items: ["!whitespace : (' ' | '\t' | '\n' | '\r') •"] +S0: #0: <"!whitespace : (' ' | '\\t' | '\\n' | '\\r') •"> +S0: rng: "['\\n','\\n']" +------------------------------------------- +items.(*ItemSet).Next in itemset.go:159 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S0:rng="['\\n','\\n']" +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).Move in item.go:311 +items.(*ItemSet).Next in itemset.go:162 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +!whitespace +*** Item: "!whitespace : ' ' | '\\t' | '\\n' | '\\r'" + ** emoves: + <"!whitespace : ' ' | '\\t' | • '\\n' | '\\r'">:move("['\\n','\\n']"):["!whitespace : (' ' | '\\t' | '\\n' | '\\r') •"] +------------------------------------------- +items.(*ItemSet).dependentsClosure in itemset.go:190 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S0:dependentsClosure S0 + actual: { + id : • _x {_x0 | (β _digit {_digit}) | γ} + !whitespace : ' ' | ' ' | ' +' | • ' ' + !whitespace : ' ' | ' ' | • ' +' | ' ' + !whitespace : ' ' | • ' ' | ' +' | ' ' + !whitespace : • ' ' | ' ' | ' +' | ' ' + _x : α | (• β _digit {_digit}) + _x : • α | (β _digit {_digit}) +} +Transitions: + [' ',' '] -> S1 + [' +',' +'] -> S-1 + [' ',' '] -> S-1 + [' ',' '] -> S-1 + [α,α] -> S-1 + [β,β] -> S-1 +Symbols classes: {[' ',' '], [' +',' +'], [' ',' '], [' ',' '], [α,α], [β,β]} + + items: ["!whitespace : (' ' | '\t' | '\n' | '\r') •"] +S0: #0: <"!whitespace : (' ' | '\\t' | '\\n' | '\\r') •"> +S0: rng: "['\\r','\\r']" +------------------------------------------- +items.(*ItemSet).Next in itemset.go:159 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S0:rng="['\\r','\\r']" +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).Move in item.go:311 +items.(*ItemSet).Next in itemset.go:162 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +!whitespace +*** Item: "!whitespace : ' ' | '\\t' | '\\n' | '\\r'" + ** emoves: + <"!whitespace : ' ' | '\\t' | '\\n' | • '\\r'">:move("['\\r','\\r']"):["!whitespace : (' ' | '\\t' | '\\n' | '\\r') •"] +------------------------------------------- +items.(*ItemSet).dependentsClosure in itemset.go:190 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S0:dependentsClosure S0 + actual: { + id : • _x {_x0 | (β _digit {_digit}) | γ} + !whitespace : ' ' | ' ' | ' +' | • ' ' + !whitespace : ' ' | ' ' | • ' +' | ' ' + !whitespace : ' ' | • ' ' | ' +' | ' ' + !whitespace : • ' ' | ' ' | ' +' | ' ' + _x : α | (• β _digit {_digit}) + _x : • α | (β _digit {_digit}) +} +Transitions: + [' ',' '] -> S1 + [' +',' +'] -> S1 + [' ',' '] -> S-1 + [' ',' '] -> S-1 + [α,α] -> S-1 + [β,β] -> S-1 +Symbols classes: {[' ',' '], [' +',' +'], [' ',' '], [' ',' '], [α,α], [β,β]} + + items: ["!whitespace : (' ' | '\t' | '\n' | '\r') •"] +S0: #0: <"!whitespace : (' ' | '\\t' | '\\n' | '\\r') •"> +S0: rng: "[' ',' ']" +------------------------------------------- +items.(*ItemSet).Next in itemset.go:159 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S0:rng="[' ',' ']" +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).Move in item.go:311 +items.(*ItemSet).Next in itemset.go:162 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +!whitespace +*** Item: "!whitespace : ' ' | '\\t' | '\\n' | '\\r'" + ** emoves: + <"!whitespace : • ' ' | '\\t' | '\\n' | '\\r'">:move("[' ',' ']"):["!whitespace : (' ' | '\\t' | '\\n' | '\\r') •"] +------------------------------------------- +items.(*ItemSet).dependentsClosure in itemset.go:190 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S0:dependentsClosure S0 + actual: { + id : • _x {_x0 | (β _digit {_digit}) | γ} + !whitespace : ' ' | ' ' | ' +' | • ' ' + !whitespace : ' ' | ' ' | • ' +' | ' ' + !whitespace : ' ' | • ' ' | ' +' | ' ' + !whitespace : • ' ' | ' ' | ' +' | ' ' + _x : α | (• β _digit {_digit}) + _x : • α | (β _digit {_digit}) +} +Transitions: + [' ',' '] -> S1 + [' +',' +'] -> S1 + [' ',' '] -> S1 + [' ',' '] -> S-1 + [α,α] -> S-1 + [β,β] -> S-1 +Symbols classes: {[' ',' '], [' +',' +'], [' ',' '], [' ',' '], [α,α], [β,β]} + + items: ["!whitespace : (' ' | '\t' | '\n' | '\r') •"] +S0: #0: <"!whitespace : (' ' | '\\t' | '\\n' | '\\r') •"> +S0: rng: "[\\u03b1,\\u03b1]" +------------------------------------------- +items.(*ItemSet).Next in itemset.go:159 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S0:rng="[\\u03b1,\\u03b1]" +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).Move in item.go:311 +items.(*ItemSet).Next in itemset.go:162 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_x +*** Item: "_x : \\u03b1 | (\\u03b2 _digit {_digit})" + ** emoves: + <"_x : • \\u03b1 | (\\u03b2 _digit {_digit})">:move("[\\u03b1,\\u03b1]"):["_x : (\\u03b1 | (\\u03b2 _digit {_digit})) •"] +------------------------------------------- +items.(*ItemSet).dependentsClosure in itemset.go:190 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S0:dependentsClosure S0 + actual: { + id : • _x {_x0 | (β _digit {_digit}) | γ} + !whitespace : ' ' | ' ' | ' +' | • ' ' + !whitespace : ' ' | ' ' | • ' +' | ' ' + !whitespace : ' ' | • ' ' | ' +' | ' ' + !whitespace : • ' ' | ' ' | ' +' | ' ' + _x : α | (• β _digit {_digit}) + _x : • α | (β _digit {_digit}) +} +Transitions: + [' ',' '] -> S1 + [' +',' +'] -> S1 + [' ',' '] -> S1 + [' ',' '] -> S1 + [α,α] -> S-1 + [β,β] -> S-1 +Symbols classes: {[' ',' '], [' +',' +'], [' ',' '], [' ',' '], [α,α], [β,β]} + + items: ["_x : (\u03b1 | (\u03b2 _digit {_digit})) •"] +------------------------------------------- +items.(*Item).MoveRegDefId in item.go:333 +items.(*ItemSet).dependentsClosure in itemset.go:195 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 + * moved item: + *ast.LexPattern:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 + *ast.LexAlt:_x {_x0 | (β _digit {_digit}) | γ}; pos 1 + +was: + *ast.LexPattern:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 + *ast.LexAlt:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 +) +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).MoveRegDefId in item.go:334 +items.(*ItemSet).dependentsClosure in itemset.go:195 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +id +*** Item: "id : _x • {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | • (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" +S0: ====> id : _x {_x0 | (\u03b2 _digit {_digit}) | \u03b3} • +S0: ====> id : _x {_x0 | (\u03b2 _digit {_digit}) | • \u03b3} +S0: ====> id : _x {_x0 | (• \u03b2 _digit {_digit}) | \u03b3} +S0: ====> id : _x {• _x0 | (\u03b2 _digit {_digit}) | \u03b3} +------------------------------------------- +items.(*Item).MoveRegDefId in item.go:333 +items.(*ItemSet).dependentsClosure in itemset.go:199 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 + * moved item: + *ast.LexPattern:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 + *ast.LexAlt:_x {_x0 | (β _digit {_digit}) | γ}; pos 1 + +was: + *ast.LexPattern:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 + *ast.LexAlt:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 +) +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).MoveRegDefId in item.go:334 +items.(*ItemSet).dependentsClosure in itemset.go:199 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +id +*** Item: "id : _x • {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | • (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.ItemList.Closure in itemlist.go:80 +items.(*ItemSet).Next in itemset.go:165 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_x0 +*** Item: "_x0 : \\u03b1" + ** emoves: +S0: #0: <"_x : (\\u03b1 | (\\u03b2 _digit {_digit})) •"> +S0: #1: <"id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •"> +S0: #2: <"id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}"> +S0: #3: <"id : _x {_x0 | (• \\u03b2 _digit {_digit}) | \\u03b3}"> +S0: #4: <"id : _x {• _x0 | (\\u03b2 _digit {_digit}) | \\u03b3}"> +S0: #5: <"_x0 : • \\u03b1"> +S0: rng: "[\\u03b2,\\u03b2]" +------------------------------------------- +items.(*ItemSet).Next in itemset.go:159 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S0:rng="[\\u03b2,\\u03b2]" +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).Move in item.go:311 +items.(*ItemSet).Next in itemset.go:162 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_x + <"_x : \\u03b1 | (• \\u03b2 _digit {_digit})">:move("[\\u03b2,\\u03b2]"):["_x : \\u03b1 | (\\u03b2 • _digit {_digit})"] +------------------------------------------- +items.(*ItemSet).dependentsClosure in itemset.go:190 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S0:dependentsClosure S0 + actual: { + id : • _x {_x0 | (β _digit {_digit}) | γ} + !whitespace : ' ' | ' ' | ' +' | • ' ' + !whitespace : ' ' | ' ' | • ' +' | ' ' + !whitespace : ' ' | • ' ' | ' +' | ' ' + !whitespace : • ' ' | ' ' | ' +' | ' ' + _x : α | (• β _digit {_digit}) + _x : • α | (β _digit {_digit}) +} +Transitions: + [' ',' '] -> S1 + [' +',' +'] -> S1 + [' ',' '] -> S1 + [' ',' '] -> S1 + [α,α] -> S2 + [β,β] -> S-1 +Symbols classes: {[' ',' '], [' +',' +'], [' ',' '], [' ',' '], [α,α], [β,β]} + + items: ["_x : \u03b1 | (\u03b2 • _digit {_digit})"] +S0: ==> id : • _x {_x0 | (\u03b2 _digit {_digit}) | \u03b3} +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.ItemList.Closure in itemlist.go:80 +items.(*ItemSet).Next in itemset.go:165 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_digit +*** Item: "_digit : '0'-'9'" + ** emoves: +S0: #0: <"_x : \\u03b1 | (\\u03b2 • _digit {_digit})"> +S0: #1: <"id : • _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}"> +S0: #2: <"_digit : • '0'-'9'"> +S1/4 +S2/4 +S2: rng: "[\\u03b1,\\u03b1]" +------------------------------------------- +items.(*ItemSet).Next in itemset.go:159 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S2:rng="[\\u03b1,\\u03b1]" +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).Move in item.go:311 +items.(*ItemSet).Next in itemset.go:162 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_x0 +*** Item: "_x0 : \\u03b1" + ** emoves: + <"_x0 : • \\u03b1">:move("[\\u03b1,\\u03b1]"):["_x0 : \\u03b1 •"] +------------------------------------------- +items.(*ItemSet).dependentsClosure in itemset.go:190 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S2:dependentsClosure S2 + actual: { + _x : (α | (β _digit {_digit})) • + id : _x {_x0 | (β _digit {_digit}) | γ} • + id : _x {_x0 | (β _digit {_digit}) | • γ} + id : _x {_x0 | (• β _digit {_digit}) | γ} + id : _x {• _x0 | (β _digit {_digit}) | γ} + _x0 : • α +} +Transitions: + [α,α] -> S-1 + [β,β] -> S-1 + [γ,γ] -> S-1 +Symbols classes: {[α,α], [β,β], [γ,γ]} + + items: ["_x0 : \u03b1 •"] +------------------------------------------- +items.(*Item).MoveRegDefId in item.go:333 +items.(*ItemSet).dependentsClosure in itemset.go:195 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 + * moved item: + *ast.LexPattern:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 + *ast.LexAlt:_x {_x0 | (β _digit {_digit}) | γ}; pos 1 + *ast.LexRepPattern:{_x0 | (β _digit {_digit}) | γ}; pos 0 + *ast.LexAlt:_x0; pos 1 + +was: + *ast.LexPattern:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 + *ast.LexAlt:_x {_x0 | (β _digit {_digit}) | γ}; pos 1 + *ast.LexRepPattern:{_x0 | (β _digit {_digit}) | γ}; pos 0 + *ast.LexAlt:_x0; pos 0 +) +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).MoveRegDefId in item.go:334 +items.(*ItemSet).dependentsClosure in itemset.go:195 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +id +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | • (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" +S2: ====> id : _x {_x0 | (\u03b2 _digit {_digit}) | \u03b3} • +S2: ====> id : _x {_x0 | (\u03b2 _digit {_digit}) | • \u03b3} +S2: ====> id : _x {_x0 | (• \u03b2 _digit {_digit}) | \u03b3} +S2: ====> id : _x {• _x0 | (\u03b2 _digit {_digit}) | \u03b3} +------------------------------------------- +items.(*Item).MoveRegDefId in item.go:333 +items.(*ItemSet).dependentsClosure in itemset.go:199 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 + * moved item: + *ast.LexPattern:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 + *ast.LexAlt:_x {_x0 | (β _digit {_digit}) | γ}; pos 1 + *ast.LexRepPattern:{_x0 | (β _digit {_digit}) | γ}; pos 0 + *ast.LexAlt:_x0; pos 1 + +was: + *ast.LexPattern:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 + *ast.LexAlt:_x {_x0 | (β _digit {_digit}) | γ}; pos 1 + *ast.LexRepPattern:{_x0 | (β _digit {_digit}) | γ}; pos 0 + *ast.LexAlt:_x0; pos 0 +) +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).MoveRegDefId in item.go:334 +items.(*ItemSet).dependentsClosure in itemset.go:199 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +id +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | • (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.ItemList.Closure in itemlist.go:80 +items.(*ItemSet).Next in itemset.go:165 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_x0 +*** Item: "_x0 : \\u03b1" + ** emoves: +S2: #0: <"_x0 : \\u03b1 •"> +S2: #1: <"id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •"> +S2: #2: <"id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}"> +S2: #3: <"id : _x {_x0 | (• \\u03b2 _digit {_digit}) | \\u03b3}"> +S2: #4: <"id : _x {• _x0 | (\\u03b2 _digit {_digit}) | \\u03b3}"> +S2: #5: <"_x0 : • \\u03b1"> +S2: rng: "[\\u03b2,\\u03b2]" +------------------------------------------- +items.(*ItemSet).Next in itemset.go:159 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S2:rng="[\\u03b2,\\u03b2]" +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).Move in item.go:311 +items.(*ItemSet).Next in itemset.go:162 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +id + <"id : _x {_x0 | (• \\u03b2 _digit {_digit}) | \\u03b3}">:move("[\\u03b2,\\u03b2]"):["id : _x {_x0 | (\\u03b2 • _digit {_digit}) | \\u03b3}"] +------------------------------------------- +items.(*ItemSet).dependentsClosure in itemset.go:190 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S2:dependentsClosure S2 + actual: { + _x : (α | (β _digit {_digit})) • + id : _x {_x0 | (β _digit {_digit}) | γ} • + id : _x {_x0 | (β _digit {_digit}) | • γ} + id : _x {_x0 | (• β _digit {_digit}) | γ} + id : _x {• _x0 | (β _digit {_digit}) | γ} + _x0 : • α +} +Transitions: + [α,α] -> S4 + [β,β] -> S-1 + [γ,γ] -> S-1 +Symbols classes: {[α,α], [β,β], [γ,γ]} + + items: ["id : _x {_x0 | (\u03b2 • _digit {_digit}) | \u03b3}"] +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.ItemList.Closure in itemlist.go:80 +items.(*ItemSet).Next in itemset.go:165 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_digit +*** Item: "_digit : '0'-'9'" + ** emoves: +S2: #0: <"id : _x {_x0 | (\\u03b2 • _digit {_digit}) | \\u03b3}"> +S2: #1: <"_digit : • '0'-'9'"> +S2: rng: "[\\u03b3,\\u03b3]" +------------------------------------------- +items.(*ItemSet).Next in itemset.go:159 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S2:rng="[\\u03b3,\\u03b3]" +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).Move in item.go:311 +items.(*ItemSet).Next in itemset.go:162 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +id +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | • (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" + <"id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}">:move("[\\u03b3,\\u03b3]"):["id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" "id : _x {_x0 | (• \\u03b2 _digit {_digit}) | \\u03b3}" "id : _x {• _x0 | (\\u03b2 _digit {_digit}) | \\u03b3}"] +------------------------------------------- +items.(*ItemSet).dependentsClosure in itemset.go:190 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S2:dependentsClosure S2 + actual: { + _x : (α | (β _digit {_digit})) • + id : _x {_x0 | (β _digit {_digit}) | γ} • + id : _x {_x0 | (β _digit {_digit}) | • γ} + id : _x {_x0 | (• β _digit {_digit}) | γ} + id : _x {• _x0 | (β _digit {_digit}) | γ} + _x0 : • α +} +Transitions: + [α,α] -> S4 + [β,β] -> S5 + [γ,γ] -> S-1 +Symbols classes: {[α,α], [β,β], [γ,γ]} + + items: ["id : _x {_x0 | (\u03b2 _digit {_digit}) | \u03b3} •" "id : _x {_x0 | (\u03b2 _digit {_digit}) | • \u03b3}" "id : _x {_x0 | (• \u03b2 _digit {_digit}) | \u03b3}" "id : _x {• _x0 | (\u03b2 _digit {_digit}) | \u03b3}"] +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.ItemList.Closure in itemlist.go:80 +items.(*ItemSet).Next in itemset.go:165 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_x0 +*** Item: "_x0 : \\u03b1" + ** emoves: +S2: #0: <"id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •"> +S2: #1: <"id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}"> +S2: #2: <"id : _x {_x0 | (• \\u03b2 _digit {_digit}) | \\u03b3}"> +S2: #3: <"id : _x {• _x0 | (\\u03b2 _digit {_digit}) | \\u03b3}"> +S2: #4: <"_x0 : • \\u03b1"> +S3/7 +S3: rng: "['0','9']" +------------------------------------------- +items.(*ItemSet).Next in itemset.go:159 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S3:rng="['0','9']" +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).Move in item.go:311 +items.(*ItemSet).Next in itemset.go:162 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_digit +*** Item: "_digit : '0'-'9'" + ** emoves: + <"_digit : • '0'-'9'">:move("['0','9']"):["_digit : '0'-'9' •"] +------------------------------------------- +items.(*ItemSet).dependentsClosure in itemset.go:190 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S3:dependentsClosure S3 + actual: { + _x : α | (β • _digit {_digit}) + id : • _x {_x0 | (β _digit {_digit}) | γ} + _digit : • '0'-'9' +} +Transitions: + ['0','9'] -> S-1 +Symbols classes: {['0','9']} + + items: ["_digit : '0'-'9' •"] +------------------------------------------- +items.(*Item).MoveRegDefId in item.go:333 +items.(*ItemSet).dependentsClosure in itemset.go:195 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 + * moved item: + *ast.LexPattern:α | (β _digit {_digit}); pos 1 + *ast.LexAlt:(β _digit {_digit}); pos 0 + *ast.LexGroupPattern:(β _digit {_digit}); pos 0 + *ast.LexAlt:β _digit {_digit}; pos 2 + +was: + *ast.LexPattern:α | (β _digit {_digit}); pos 1 + *ast.LexAlt:(β _digit {_digit}); pos 0 + *ast.LexGroupPattern:(β _digit {_digit}); pos 0 + *ast.LexAlt:β _digit {_digit}; pos 1 +) +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).MoveRegDefId in item.go:334 +items.(*ItemSet).dependentsClosure in itemset.go:195 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_x +*** Item: "_x : \\u03b1 | (\\u03b2 _digit • {_digit})" + ** emoves: +*** Item: "_x : \\u03b1 | (\\u03b2 _digit {_digit})" + ** emoves: +*** Item: "_x : \\u03b1 | (\\u03b2 _digit {_digit})" + ** emoves: +*** Item: "_x : \\u03b1 | (\\u03b2 _digit {_digit})" + ** emoves: +*** Item: "_x : \\u03b1 | (\\u03b2 _digit {_digit})" + ** emoves: +S3: ====> _x : (\u03b1 | (\u03b2 _digit {_digit})) • +S3: ====> _x : \u03b1 | (\u03b2 _digit {• _digit}) +------------------------------------------- +items.(*Item).MoveRegDefId in item.go:333 +items.(*ItemSet).dependentsClosure in itemset.go:199 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 + * moved item: + *ast.LexPattern:α | (β _digit {_digit}); pos 1 + *ast.LexAlt:(β _digit {_digit}); pos 0 + *ast.LexGroupPattern:(β _digit {_digit}); pos 0 + *ast.LexAlt:β _digit {_digit}; pos 2 + +was: + *ast.LexPattern:α | (β _digit {_digit}); pos 1 + *ast.LexAlt:(β _digit {_digit}); pos 0 + *ast.LexGroupPattern:(β _digit {_digit}); pos 0 + *ast.LexAlt:β _digit {_digit}; pos 1 +) +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).MoveRegDefId in item.go:334 +items.(*ItemSet).dependentsClosure in itemset.go:199 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_x +*** Item: "_x : \\u03b1 | (\\u03b2 _digit • {_digit})" + ** emoves: +*** Item: "_x : \\u03b1 | (\\u03b2 _digit {_digit})" + ** emoves: +*** Item: "_x : \\u03b1 | (\\u03b2 _digit {_digit})" + ** emoves: +*** Item: "_x : \\u03b1 | (\\u03b2 _digit {_digit})" + ** emoves: +*** Item: "_x : \\u03b1 | (\\u03b2 _digit {_digit})" + ** emoves: +------------------------------------------- +items.(*Item).MoveRegDefId in item.go:333 +items.(*ItemSet).dependentsClosure in itemset.go:195 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 + * moved item: + *ast.LexPattern:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 + *ast.LexAlt:_x {_x0 | (β _digit {_digit}) | γ}; pos 1 + +was: + *ast.LexPattern:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 + *ast.LexAlt:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 +) +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).MoveRegDefId in item.go:334 +items.(*ItemSet).dependentsClosure in itemset.go:195 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +id +*** Item: "id : _x • {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | • (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" +S3: ====> id : _x {_x0 | (\u03b2 _digit {_digit}) | \u03b3} • +S3: ====> id : _x {_x0 | (\u03b2 _digit {_digit}) | • \u03b3} +S3: ====> id : _x {_x0 | (• \u03b2 _digit {_digit}) | \u03b3} +S3: ====> id : _x {• _x0 | (\u03b2 _digit {_digit}) | \u03b3} +------------------------------------------- +items.(*Item).MoveRegDefId in item.go:333 +items.(*ItemSet).dependentsClosure in itemset.go:199 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 + * moved item: + *ast.LexPattern:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 + *ast.LexAlt:_x {_x0 | (β _digit {_digit}) | γ}; pos 1 + +was: + *ast.LexPattern:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 + *ast.LexAlt:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 +) +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).MoveRegDefId in item.go:334 +items.(*ItemSet).dependentsClosure in itemset.go:199 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +id +*** Item: "id : _x • {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | • (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" +S3: ==> id : • _x {_x0 | (\u03b2 _digit {_digit}) | \u03b3} +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.ItemList.Closure in itemlist.go:80 +items.(*ItemSet).Next in itemset.go:165 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_digit +*** Item: "_digit : '0'-'9'" + ** emoves: +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.ItemList.Closure in itemlist.go:80 +items.(*ItemSet).Next in itemset.go:165 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_x0 +*** Item: "_x0 : \\u03b1" + ** emoves: +S3: #0: <"_digit : '0'-'9' •"> +S3: #1: <"_x : (\\u03b1 | (\\u03b2 _digit {_digit})) •"> +S3: #2: <"_x : \\u03b1 | (\\u03b2 _digit {• _digit})"> +S3: #3: <"id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •"> +S3: #4: <"id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}"> +S3: #5: <"id : _x {_x0 | (• \\u03b2 _digit {_digit}) | \\u03b3}"> +S3: #6: <"id : _x {• _x0 | (\\u03b2 _digit {_digit}) | \\u03b3}"> +S3: #7: <"id : • _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}"> +S3: #8: <"_digit : • '0'-'9'"> +S3: #9: <"_x0 : • \\u03b1"> +S4/8 +S4: rng: "[\\u03b1,\\u03b1]" +------------------------------------------- +items.(*ItemSet).Next in itemset.go:159 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S4:rng="[\\u03b1,\\u03b1]" +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).Move in item.go:311 +items.(*ItemSet).Next in itemset.go:162 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_x0 +*** Item: "_x0 : \\u03b1" + ** emoves: + <"_x0 : • \\u03b1">:move("[\\u03b1,\\u03b1]"):["_x0 : \\u03b1 •"] +------------------------------------------- +items.(*ItemSet).dependentsClosure in itemset.go:190 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S4:dependentsClosure S4 + actual: { + _x0 : α • + id : _x {_x0 | (β _digit {_digit}) | γ} • + id : _x {_x0 | (β _digit {_digit}) | • γ} + id : _x {_x0 | (• β _digit {_digit}) | γ} + id : _x {• _x0 | (β _digit {_digit}) | γ} + _x0 : • α +} +Transitions: + [α,α] -> S-1 + [β,β] -> S-1 + [γ,γ] -> S-1 +Symbols classes: {[α,α], [β,β], [γ,γ]} + + items: ["_x0 : \u03b1 •"] +------------------------------------------- +items.(*Item).MoveRegDefId in item.go:333 +items.(*ItemSet).dependentsClosure in itemset.go:195 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 + * moved item: + *ast.LexPattern:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 + *ast.LexAlt:_x {_x0 | (β _digit {_digit}) | γ}; pos 1 + *ast.LexRepPattern:{_x0 | (β _digit {_digit}) | γ}; pos 0 + *ast.LexAlt:_x0; pos 1 + +was: + *ast.LexPattern:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 + *ast.LexAlt:_x {_x0 | (β _digit {_digit}) | γ}; pos 1 + *ast.LexRepPattern:{_x0 | (β _digit {_digit}) | γ}; pos 0 + *ast.LexAlt:_x0; pos 0 +) +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).MoveRegDefId in item.go:334 +items.(*ItemSet).dependentsClosure in itemset.go:195 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +id +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | • (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" +S4: ====> id : _x {_x0 | (\u03b2 _digit {_digit}) | \u03b3} • +S4: ====> id : _x {_x0 | (\u03b2 _digit {_digit}) | • \u03b3} +S4: ====> id : _x {_x0 | (• \u03b2 _digit {_digit}) | \u03b3} +S4: ====> id : _x {• _x0 | (\u03b2 _digit {_digit}) | \u03b3} +------------------------------------------- +items.(*Item).MoveRegDefId in item.go:333 +items.(*ItemSet).dependentsClosure in itemset.go:199 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 + * moved item: + *ast.LexPattern:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 + *ast.LexAlt:_x {_x0 | (β _digit {_digit}) | γ}; pos 1 + *ast.LexRepPattern:{_x0 | (β _digit {_digit}) | γ}; pos 0 + *ast.LexAlt:_x0; pos 1 + +was: + *ast.LexPattern:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 + *ast.LexAlt:_x {_x0 | (β _digit {_digit}) | γ}; pos 1 + *ast.LexRepPattern:{_x0 | (β _digit {_digit}) | γ}; pos 0 + *ast.LexAlt:_x0; pos 0 +) +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).MoveRegDefId in item.go:334 +items.(*ItemSet).dependentsClosure in itemset.go:199 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +id +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | • (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.ItemList.Closure in itemlist.go:80 +items.(*ItemSet).Next in itemset.go:165 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_x0 +*** Item: "_x0 : \\u03b1" + ** emoves: +S4: #0: <"_x0 : \\u03b1 •"> +S4: #1: <"id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •"> +S4: #2: <"id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}"> +S4: #3: <"id : _x {_x0 | (• \\u03b2 _digit {_digit}) | \\u03b3}"> +S4: #4: <"id : _x {• _x0 | (\\u03b2 _digit {_digit}) | \\u03b3}"> +S4: #5: <"_x0 : • \\u03b1"> +S4: rng: "[\\u03b2,\\u03b2]" +------------------------------------------- +items.(*ItemSet).Next in itemset.go:159 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S4:rng="[\\u03b2,\\u03b2]" +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).Move in item.go:311 +items.(*ItemSet).Next in itemset.go:162 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +id + <"id : _x {_x0 | (• \\u03b2 _digit {_digit}) | \\u03b3}">:move("[\\u03b2,\\u03b2]"):["id : _x {_x0 | (\\u03b2 • _digit {_digit}) | \\u03b3}"] +------------------------------------------- +items.(*ItemSet).dependentsClosure in itemset.go:190 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S4:dependentsClosure S4 + actual: { + _x0 : α • + id : _x {_x0 | (β _digit {_digit}) | γ} • + id : _x {_x0 | (β _digit {_digit}) | • γ} + id : _x {_x0 | (• β _digit {_digit}) | γ} + id : _x {• _x0 | (β _digit {_digit}) | γ} + _x0 : • α +} +Transitions: + [α,α] -> S4 + [β,β] -> S-1 + [γ,γ] -> S-1 +Symbols classes: {[α,α], [β,β], [γ,γ]} + + items: ["id : _x {_x0 | (\u03b2 • _digit {_digit}) | \u03b3}"] +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.ItemList.Closure in itemlist.go:80 +items.(*ItemSet).Next in itemset.go:165 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_digit +*** Item: "_digit : '0'-'9'" + ** emoves: +S4: #0: <"id : _x {_x0 | (\\u03b2 • _digit {_digit}) | \\u03b3}"> +S4: #1: <"_digit : • '0'-'9'"> +S4: rng: "[\\u03b3,\\u03b3]" +------------------------------------------- +items.(*ItemSet).Next in itemset.go:159 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S4:rng="[\\u03b3,\\u03b3]" +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).Move in item.go:311 +items.(*ItemSet).Next in itemset.go:162 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +id +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | • (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" + <"id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}">:move("[\\u03b3,\\u03b3]"):["id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" "id : _x {_x0 | (• \\u03b2 _digit {_digit}) | \\u03b3}" "id : _x {• _x0 | (\\u03b2 _digit {_digit}) | \\u03b3}"] +------------------------------------------- +items.(*ItemSet).dependentsClosure in itemset.go:190 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S4:dependentsClosure S4 + actual: { + _x0 : α • + id : _x {_x0 | (β _digit {_digit}) | γ} • + id : _x {_x0 | (β _digit {_digit}) | • γ} + id : _x {_x0 | (• β _digit {_digit}) | γ} + id : _x {• _x0 | (β _digit {_digit}) | γ} + _x0 : • α +} +Transitions: + [α,α] -> S4 + [β,β] -> S5 + [γ,γ] -> S-1 +Symbols classes: {[α,α], [β,β], [γ,γ]} + + items: ["id : _x {_x0 | (\u03b2 _digit {_digit}) | \u03b3} •" "id : _x {_x0 | (\u03b2 _digit {_digit}) | • \u03b3}" "id : _x {_x0 | (• \u03b2 _digit {_digit}) | \u03b3}" "id : _x {• _x0 | (\u03b2 _digit {_digit}) | \u03b3}"] +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.ItemList.Closure in itemlist.go:80 +items.(*ItemSet).Next in itemset.go:165 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_x0 +*** Item: "_x0 : \\u03b1" + ** emoves: +S4: #0: <"id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •"> +S4: #1: <"id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}"> +S4: #2: <"id : _x {_x0 | (• \\u03b2 _digit {_digit}) | \\u03b3}"> +S4: #3: <"id : _x {• _x0 | (\\u03b2 _digit {_digit}) | \\u03b3}"> +S4: #4: <"_x0 : • \\u03b1"> +S5/8 +S5: rng: "['0','9']" +------------------------------------------- +items.(*ItemSet).Next in itemset.go:159 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S5:rng="['0','9']" +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).Move in item.go:311 +items.(*ItemSet).Next in itemset.go:162 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_digit +*** Item: "_digit : '0'-'9'" + ** emoves: + <"_digit : • '0'-'9'">:move("['0','9']"):["_digit : '0'-'9' •"] +------------------------------------------- +items.(*ItemSet).dependentsClosure in itemset.go:190 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S5:dependentsClosure S5 + actual: { + id : _x {_x0 | (β • _digit {_digit}) | γ} + _digit : • '0'-'9' +} +Transitions: + ['0','9'] -> S-1 +Symbols classes: {['0','9']} + + items: ["_digit : '0'-'9' •"] +------------------------------------------- +items.(*Item).MoveRegDefId in item.go:333 +items.(*ItemSet).dependentsClosure in itemset.go:195 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 + * moved item: + *ast.LexPattern:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 + *ast.LexAlt:_x {_x0 | (β _digit {_digit}) | γ}; pos 1 + *ast.LexRepPattern:{_x0 | (β _digit {_digit}) | γ}; pos 1 + *ast.LexAlt:(β _digit {_digit}); pos 0 + *ast.LexGroupPattern:(β _digit {_digit}); pos 0 + *ast.LexAlt:β _digit {_digit}; pos 2 + +was: + *ast.LexPattern:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 + *ast.LexAlt:_x {_x0 | (β _digit {_digit}) | γ}; pos 1 + *ast.LexRepPattern:{_x0 | (β _digit {_digit}) | γ}; pos 1 + *ast.LexAlt:(β _digit {_digit}); pos 0 + *ast.LexGroupPattern:(β _digit {_digit}); pos 0 + *ast.LexAlt:β _digit {_digit}; pos 1 +) +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).MoveRegDefId in item.go:334 +items.(*ItemSet).dependentsClosure in itemset.go:195 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +id +*** Item: "id : _x {_x0 | (\\u03b2 _digit • {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | • (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" +S5: ====> id : _x {_x0 | (\u03b2 _digit {_digit}) | \u03b3} • +S5: ====> id : _x {_x0 | (\u03b2 _digit {_digit}) | • \u03b3} +S5: ====> id : _x {_x0 | (• \u03b2 _digit {_digit}) | \u03b3} +S5: ====> id : _x {• _x0 | (\u03b2 _digit {_digit}) | \u03b3} +S5: ====> id : _x {_x0 | (\u03b2 _digit {• _digit}) | \u03b3} +------------------------------------------- +items.(*Item).MoveRegDefId in item.go:333 +items.(*ItemSet).dependentsClosure in itemset.go:199 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 + * moved item: + *ast.LexPattern:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 + *ast.LexAlt:_x {_x0 | (β _digit {_digit}) | γ}; pos 1 + *ast.LexRepPattern:{_x0 | (β _digit {_digit}) | γ}; pos 1 + *ast.LexAlt:(β _digit {_digit}); pos 0 + *ast.LexGroupPattern:(β _digit {_digit}); pos 0 + *ast.LexAlt:β _digit {_digit}; pos 2 + +was: + *ast.LexPattern:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 + *ast.LexAlt:_x {_x0 | (β _digit {_digit}) | γ}; pos 1 + *ast.LexRepPattern:{_x0 | (β _digit {_digit}) | γ}; pos 1 + *ast.LexAlt:(β _digit {_digit}); pos 0 + *ast.LexGroupPattern:(β _digit {_digit}); pos 0 + *ast.LexAlt:β _digit {_digit}; pos 1 +) +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).MoveRegDefId in item.go:334 +items.(*ItemSet).dependentsClosure in itemset.go:199 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +id +*** Item: "id : _x {_x0 | (\\u03b2 _digit • {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | • (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.ItemList.Closure in itemlist.go:80 +items.(*ItemSet).Next in itemset.go:165 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_x0 +*** Item: "_x0 : \\u03b1" + ** emoves: +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.ItemList.Closure in itemlist.go:80 +items.(*ItemSet).Next in itemset.go:165 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_digit +*** Item: "_digit : '0'-'9'" + ** emoves: +S5: #0: <"_digit : '0'-'9' •"> +S5: #1: <"id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •"> +S5: #2: <"id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}"> +S5: #3: <"id : _x {_x0 | (• \\u03b2 _digit {_digit}) | \\u03b3}"> +S5: #4: <"id : _x {• _x0 | (\\u03b2 _digit {_digit}) | \\u03b3}"> +S5: #5: <"id : _x {_x0 | (\\u03b2 _digit {• _digit}) | \\u03b3}"> +S5: #6: <"_x0 : • \\u03b1"> +S5: #7: <"_digit : • '0'-'9'"> +S6/9 +S6: rng: "[\\u03b1,\\u03b1]" +------------------------------------------- +items.(*ItemSet).Next in itemset.go:159 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S6:rng="[\\u03b1,\\u03b1]" +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).Move in item.go:311 +items.(*ItemSet).Next in itemset.go:162 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_x0 +*** Item: "_x0 : \\u03b1" + ** emoves: + <"_x0 : • \\u03b1">:move("[\\u03b1,\\u03b1]"):["_x0 : \\u03b1 •"] +------------------------------------------- +items.(*ItemSet).dependentsClosure in itemset.go:190 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S6:dependentsClosure S6 + actual: { + id : _x {_x0 | (β _digit {_digit}) | γ} • + id : _x {_x0 | (β _digit {_digit}) | • γ} + id : _x {_x0 | (• β _digit {_digit}) | γ} + id : _x {• _x0 | (β _digit {_digit}) | γ} + _x0 : • α +} +Transitions: + [α,α] -> S-1 + [β,β] -> S-1 + [γ,γ] -> S-1 +Symbols classes: {[α,α], [β,β], [γ,γ]} + + items: ["_x0 : \u03b1 •"] +------------------------------------------- +items.(*Item).MoveRegDefId in item.go:333 +items.(*ItemSet).dependentsClosure in itemset.go:195 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 + * moved item: + *ast.LexPattern:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 + *ast.LexAlt:_x {_x0 | (β _digit {_digit}) | γ}; pos 1 + *ast.LexRepPattern:{_x0 | (β _digit {_digit}) | γ}; pos 0 + *ast.LexAlt:_x0; pos 1 + +was: + *ast.LexPattern:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 + *ast.LexAlt:_x {_x0 | (β _digit {_digit}) | γ}; pos 1 + *ast.LexRepPattern:{_x0 | (β _digit {_digit}) | γ}; pos 0 + *ast.LexAlt:_x0; pos 0 +) +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).MoveRegDefId in item.go:334 +items.(*ItemSet).dependentsClosure in itemset.go:195 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +id +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | • (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" +S6: ====> id : _x {_x0 | (\u03b2 _digit {_digit}) | \u03b3} • +S6: ====> id : _x {_x0 | (\u03b2 _digit {_digit}) | • \u03b3} +S6: ====> id : _x {_x0 | (• \u03b2 _digit {_digit}) | \u03b3} +S6: ====> id : _x {• _x0 | (\u03b2 _digit {_digit}) | \u03b3} +------------------------------------------- +items.(*Item).MoveRegDefId in item.go:333 +items.(*ItemSet).dependentsClosure in itemset.go:199 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 + * moved item: + *ast.LexPattern:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 + *ast.LexAlt:_x {_x0 | (β _digit {_digit}) | γ}; pos 1 + *ast.LexRepPattern:{_x0 | (β _digit {_digit}) | γ}; pos 0 + *ast.LexAlt:_x0; pos 1 + +was: + *ast.LexPattern:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 + *ast.LexAlt:_x {_x0 | (β _digit {_digit}) | γ}; pos 1 + *ast.LexRepPattern:{_x0 | (β _digit {_digit}) | γ}; pos 0 + *ast.LexAlt:_x0; pos 0 +) +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).MoveRegDefId in item.go:334 +items.(*ItemSet).dependentsClosure in itemset.go:199 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +id +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | • (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.ItemList.Closure in itemlist.go:80 +items.(*ItemSet).Next in itemset.go:165 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_x0 +*** Item: "_x0 : \\u03b1" + ** emoves: +S6: #0: <"_x0 : \\u03b1 •"> +S6: #1: <"id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •"> +S6: #2: <"id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}"> +S6: #3: <"id : _x {_x0 | (• \\u03b2 _digit {_digit}) | \\u03b3}"> +S6: #4: <"id : _x {• _x0 | (\\u03b2 _digit {_digit}) | \\u03b3}"> +S6: #5: <"_x0 : • \\u03b1"> +S6: rng: "[\\u03b2,\\u03b2]" +------------------------------------------- +items.(*ItemSet).Next in itemset.go:159 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S6:rng="[\\u03b2,\\u03b2]" +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).Move in item.go:311 +items.(*ItemSet).Next in itemset.go:162 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +id + <"id : _x {_x0 | (• \\u03b2 _digit {_digit}) | \\u03b3}">:move("[\\u03b2,\\u03b2]"):["id : _x {_x0 | (\\u03b2 • _digit {_digit}) | \\u03b3}"] +------------------------------------------- +items.(*ItemSet).dependentsClosure in itemset.go:190 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S6:dependentsClosure S6 + actual: { + id : _x {_x0 | (β _digit {_digit}) | γ} • + id : _x {_x0 | (β _digit {_digit}) | • γ} + id : _x {_x0 | (• β _digit {_digit}) | γ} + id : _x {• _x0 | (β _digit {_digit}) | γ} + _x0 : • α +} +Transitions: + [α,α] -> S4 + [β,β] -> S-1 + [γ,γ] -> S-1 +Symbols classes: {[α,α], [β,β], [γ,γ]} + + items: ["id : _x {_x0 | (\u03b2 • _digit {_digit}) | \u03b3}"] +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.ItemList.Closure in itemlist.go:80 +items.(*ItemSet).Next in itemset.go:165 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_digit +*** Item: "_digit : '0'-'9'" + ** emoves: +S6: #0: <"id : _x {_x0 | (\\u03b2 • _digit {_digit}) | \\u03b3}"> +S6: #1: <"_digit : • '0'-'9'"> +S6: rng: "[\\u03b3,\\u03b3]" +------------------------------------------- +items.(*ItemSet).Next in itemset.go:159 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S6:rng="[\\u03b3,\\u03b3]" +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).Move in item.go:311 +items.(*ItemSet).Next in itemset.go:162 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +id +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | • (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" + <"id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}">:move("[\\u03b3,\\u03b3]"):["id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" "id : _x {_x0 | (• \\u03b2 _digit {_digit}) | \\u03b3}" "id : _x {• _x0 | (\\u03b2 _digit {_digit}) | \\u03b3}"] +------------------------------------------- +items.(*ItemSet).dependentsClosure in itemset.go:190 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S6:dependentsClosure S6 + actual: { + id : _x {_x0 | (β _digit {_digit}) | γ} • + id : _x {_x0 | (β _digit {_digit}) | • γ} + id : _x {_x0 | (• β _digit {_digit}) | γ} + id : _x {• _x0 | (β _digit {_digit}) | γ} + _x0 : • α +} +Transitions: + [α,α] -> S4 + [β,β] -> S5 + [γ,γ] -> S-1 +Symbols classes: {[α,α], [β,β], [γ,γ]} + + items: ["id : _x {_x0 | (\u03b2 _digit {_digit}) | \u03b3} •" "id : _x {_x0 | (\u03b2 _digit {_digit}) | • \u03b3}" "id : _x {_x0 | (• \u03b2 _digit {_digit}) | \u03b3}" "id : _x {• _x0 | (\u03b2 _digit {_digit}) | \u03b3}"] +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.ItemList.Closure in itemlist.go:80 +items.(*ItemSet).Next in itemset.go:165 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_x0 +*** Item: "_x0 : \\u03b1" + ** emoves: +S6: #0: <"id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •"> +S6: #1: <"id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}"> +S6: #2: <"id : _x {_x0 | (• \\u03b2 _digit {_digit}) | \\u03b3}"> +S6: #3: <"id : _x {• _x0 | (\\u03b2 _digit {_digit}) | \\u03b3}"> +S6: #4: <"_x0 : • \\u03b1"> +S7/9 +S7: rng: "['0','9']" +------------------------------------------- +items.(*ItemSet).Next in itemset.go:159 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S7:rng="['0','9']" +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).Move in item.go:311 +items.(*ItemSet).Next in itemset.go:162 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_digit +*** Item: "_digit : '0'-'9'" + ** emoves: + <"_digit : • '0'-'9'">:move("['0','9']"):["_digit : '0'-'9' •"] +------------------------------------------- +items.(*ItemSet).dependentsClosure in itemset.go:190 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S7:dependentsClosure S7 + actual: { + _digit : '0'-'9' • + _x : (α | (β _digit {_digit})) • + _x : α | (β _digit {• _digit}) + id : _x {_x0 | (β _digit {_digit}) | γ} • + id : _x {_x0 | (β _digit {_digit}) | • γ} + id : _x {_x0 | (• β _digit {_digit}) | γ} + id : _x {• _x0 | (β _digit {_digit}) | γ} + id : • _x {_x0 | (β _digit {_digit}) | γ} + _digit : • '0'-'9' + _x0 : • α +} +Transitions: + ['0','9'] -> S-1 + [α,α] -> S-1 + [β,β] -> S-1 + [γ,γ] -> S-1 +Symbols classes: {['0','9'], [α,α], [β,β], [γ,γ]} + + items: ["_digit : '0'-'9' •"] +------------------------------------------- +items.(*Item).MoveRegDefId in item.go:333 +items.(*ItemSet).dependentsClosure in itemset.go:195 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 + * moved item: + *ast.LexPattern:α | (β _digit {_digit}); pos 1 + *ast.LexAlt:(β _digit {_digit}); pos 0 + *ast.LexGroupPattern:(β _digit {_digit}); pos 0 + *ast.LexAlt:β _digit {_digit}; pos 2 + *ast.LexRepPattern:{_digit}; pos 0 + *ast.LexAlt:_digit; pos 1 + +was: + *ast.LexPattern:α | (β _digit {_digit}); pos 1 + *ast.LexAlt:(β _digit {_digit}); pos 0 + *ast.LexGroupPattern:(β _digit {_digit}); pos 0 + *ast.LexAlt:β _digit {_digit}; pos 2 + *ast.LexRepPattern:{_digit}; pos 0 + *ast.LexAlt:_digit; pos 0 +) +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).MoveRegDefId in item.go:334 +items.(*ItemSet).dependentsClosure in itemset.go:195 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_x +*** Item: "_x : \\u03b1 | (\\u03b2 _digit {_digit})" + ** emoves: +*** Item: "_x : \\u03b1 | (\\u03b2 _digit {_digit})" + ** emoves: +*** Item: "_x : \\u03b1 | (\\u03b2 _digit {_digit})" + ** emoves: +*** Item: "_x : \\u03b1 | (\\u03b2 _digit {_digit})" + ** emoves: +*** Item: "_x : \\u03b1 | (\\u03b2 _digit {_digit})" + ** emoves: +S7: ====> _x : (\u03b1 | (\u03b2 _digit {_digit})) • +S7: ====> _x : \u03b1 | (\u03b2 _digit {• _digit}) +------------------------------------------- +items.(*Item).MoveRegDefId in item.go:333 +items.(*ItemSet).dependentsClosure in itemset.go:199 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 + * moved item: + *ast.LexPattern:α | (β _digit {_digit}); pos 1 + *ast.LexAlt:(β _digit {_digit}); pos 0 + *ast.LexGroupPattern:(β _digit {_digit}); pos 0 + *ast.LexAlt:β _digit {_digit}; pos 2 + *ast.LexRepPattern:{_digit}; pos 0 + *ast.LexAlt:_digit; pos 1 + +was: + *ast.LexPattern:α | (β _digit {_digit}); pos 1 + *ast.LexAlt:(β _digit {_digit}); pos 0 + *ast.LexGroupPattern:(β _digit {_digit}); pos 0 + *ast.LexAlt:β _digit {_digit}; pos 2 + *ast.LexRepPattern:{_digit}; pos 0 + *ast.LexAlt:_digit; pos 0 +) +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).MoveRegDefId in item.go:334 +items.(*ItemSet).dependentsClosure in itemset.go:199 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_x +*** Item: "_x : \\u03b1 | (\\u03b2 _digit {_digit})" + ** emoves: +*** Item: "_x : \\u03b1 | (\\u03b2 _digit {_digit})" + ** emoves: +*** Item: "_x : \\u03b1 | (\\u03b2 _digit {_digit})" + ** emoves: +*** Item: "_x : \\u03b1 | (\\u03b2 _digit {_digit})" + ** emoves: +*** Item: "_x : \\u03b1 | (\\u03b2 _digit {_digit})" + ** emoves: +------------------------------------------- +items.(*Item).MoveRegDefId in item.go:333 +items.(*ItemSet).dependentsClosure in itemset.go:195 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 + * moved item: + *ast.LexPattern:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 + *ast.LexAlt:_x {_x0 | (β _digit {_digit}) | γ}; pos 1 + +was: + *ast.LexPattern:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 + *ast.LexAlt:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 +) +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).MoveRegDefId in item.go:334 +items.(*ItemSet).dependentsClosure in itemset.go:195 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +id +*** Item: "id : _x • {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | • (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" +S7: ====> id : _x {_x0 | (\u03b2 _digit {_digit}) | \u03b3} • +S7: ====> id : _x {_x0 | (\u03b2 _digit {_digit}) | • \u03b3} +S7: ====> id : _x {_x0 | (• \u03b2 _digit {_digit}) | \u03b3} +S7: ====> id : _x {• _x0 | (\u03b2 _digit {_digit}) | \u03b3} +------------------------------------------- +items.(*Item).MoveRegDefId in item.go:333 +items.(*ItemSet).dependentsClosure in itemset.go:199 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 + * moved item: + *ast.LexPattern:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 + *ast.LexAlt:_x {_x0 | (β _digit {_digit}) | γ}; pos 1 + +was: + *ast.LexPattern:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 + *ast.LexAlt:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 +) +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).MoveRegDefId in item.go:334 +items.(*ItemSet).dependentsClosure in itemset.go:199 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +id +*** Item: "id : _x • {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | • (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" +S7: ==> id : • _x {_x0 | (\u03b2 _digit {_digit}) | \u03b3} +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.ItemList.Closure in itemlist.go:80 +items.(*ItemSet).Next in itemset.go:165 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_digit +*** Item: "_digit : '0'-'9'" + ** emoves: +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.ItemList.Closure in itemlist.go:80 +items.(*ItemSet).Next in itemset.go:165 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_x0 +*** Item: "_x0 : \\u03b1" + ** emoves: +S7: #0: <"_digit : '0'-'9' •"> +S7: #1: <"_x : (\\u03b1 | (\\u03b2 _digit {_digit})) •"> +S7: #2: <"_x : \\u03b1 | (\\u03b2 _digit {• _digit})"> +S7: #3: <"id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •"> +S7: #4: <"id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}"> +S7: #5: <"id : _x {_x0 | (• \\u03b2 _digit {_digit}) | \\u03b3}"> +S7: #6: <"id : _x {• _x0 | (\\u03b2 _digit {_digit}) | \\u03b3}"> +S7: #7: <"id : • _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}"> +S7: #8: <"_digit : • '0'-'9'"> +S7: #9: <"_x0 : • \\u03b1"> +S7: rng: "[\\u03b1,\\u03b1]" +------------------------------------------- +items.(*ItemSet).Next in itemset.go:159 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S7:rng="[\\u03b1,\\u03b1]" +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).Move in item.go:311 +items.(*ItemSet).Next in itemset.go:162 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_x0 +*** Item: "_x0 : \\u03b1" + ** emoves: + <"_x0 : • \\u03b1">:move("[\\u03b1,\\u03b1]"):["_x0 : \\u03b1 •"] +------------------------------------------- +items.(*ItemSet).dependentsClosure in itemset.go:190 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S7:dependentsClosure S7 + actual: { + _digit : '0'-'9' • + _x : (α | (β _digit {_digit})) • + _x : α | (β _digit {• _digit}) + id : _x {_x0 | (β _digit {_digit}) | γ} • + id : _x {_x0 | (β _digit {_digit}) | • γ} + id : _x {_x0 | (• β _digit {_digit}) | γ} + id : _x {• _x0 | (β _digit {_digit}) | γ} + id : • _x {_x0 | (β _digit {_digit}) | γ} + _digit : • '0'-'9' + _x0 : • α +} +Transitions: + ['0','9'] -> S7 + [α,α] -> S-1 + [β,β] -> S-1 + [γ,γ] -> S-1 +Symbols classes: {['0','9'], [α,α], [β,β], [γ,γ]} + + items: ["_x0 : \u03b1 •"] +------------------------------------------- +items.(*Item).MoveRegDefId in item.go:333 +items.(*ItemSet).dependentsClosure in itemset.go:195 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 + * moved item: + *ast.LexPattern:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 + *ast.LexAlt:_x {_x0 | (β _digit {_digit}) | γ}; pos 1 + *ast.LexRepPattern:{_x0 | (β _digit {_digit}) | γ}; pos 0 + *ast.LexAlt:_x0; pos 1 + +was: + *ast.LexPattern:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 + *ast.LexAlt:_x {_x0 | (β _digit {_digit}) | γ}; pos 1 + *ast.LexRepPattern:{_x0 | (β _digit {_digit}) | γ}; pos 0 + *ast.LexAlt:_x0; pos 0 +) +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).MoveRegDefId in item.go:334 +items.(*ItemSet).dependentsClosure in itemset.go:195 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +id +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | • (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" +S7: ====> id : _x {_x0 | (\u03b2 _digit {_digit}) | \u03b3} • +S7: ====> id : _x {_x0 | (\u03b2 _digit {_digit}) | • \u03b3} +S7: ====> id : _x {_x0 | (• \u03b2 _digit {_digit}) | \u03b3} +S7: ====> id : _x {• _x0 | (\u03b2 _digit {_digit}) | \u03b3} +------------------------------------------- +items.(*Item).MoveRegDefId in item.go:333 +items.(*ItemSet).dependentsClosure in itemset.go:199 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 + * moved item: + *ast.LexPattern:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 + *ast.LexAlt:_x {_x0 | (β _digit {_digit}) | γ}; pos 1 + *ast.LexRepPattern:{_x0 | (β _digit {_digit}) | γ}; pos 0 + *ast.LexAlt:_x0; pos 1 + +was: + *ast.LexPattern:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 + *ast.LexAlt:_x {_x0 | (β _digit {_digit}) | γ}; pos 1 + *ast.LexRepPattern:{_x0 | (β _digit {_digit}) | γ}; pos 0 + *ast.LexAlt:_x0; pos 0 +) +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).MoveRegDefId in item.go:334 +items.(*ItemSet).dependentsClosure in itemset.go:199 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +id +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | • (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.ItemList.Closure in itemlist.go:80 +items.(*ItemSet).Next in itemset.go:165 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_x0 +*** Item: "_x0 : \\u03b1" + ** emoves: +S7: #0: <"_x0 : \\u03b1 •"> +S7: #1: <"id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •"> +S7: #2: <"id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}"> +S7: #3: <"id : _x {_x0 | (• \\u03b2 _digit {_digit}) | \\u03b3}"> +S7: #4: <"id : _x {• _x0 | (\\u03b2 _digit {_digit}) | \\u03b3}"> +S7: #5: <"_x0 : • \\u03b1"> +S7: rng: "[\\u03b2,\\u03b2]" +------------------------------------------- +items.(*ItemSet).Next in itemset.go:159 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S7:rng="[\\u03b2,\\u03b2]" +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).Move in item.go:311 +items.(*ItemSet).Next in itemset.go:162 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +id + <"id : _x {_x0 | (• \\u03b2 _digit {_digit}) | \\u03b3}">:move("[\\u03b2,\\u03b2]"):["id : _x {_x0 | (\\u03b2 • _digit {_digit}) | \\u03b3}"] +------------------------------------------- +items.(*ItemSet).dependentsClosure in itemset.go:190 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S7:dependentsClosure S7 + actual: { + _digit : '0'-'9' • + _x : (α | (β _digit {_digit})) • + _x : α | (β _digit {• _digit}) + id : _x {_x0 | (β _digit {_digit}) | γ} • + id : _x {_x0 | (β _digit {_digit}) | • γ} + id : _x {_x0 | (• β _digit {_digit}) | γ} + id : _x {• _x0 | (β _digit {_digit}) | γ} + id : • _x {_x0 | (β _digit {_digit}) | γ} + _digit : • '0'-'9' + _x0 : • α +} +Transitions: + ['0','9'] -> S7 + [α,α] -> S4 + [β,β] -> S-1 + [γ,γ] -> S-1 +Symbols classes: {['0','9'], [α,α], [β,β], [γ,γ]} + + items: ["id : _x {_x0 | (\u03b2 • _digit {_digit}) | \u03b3}"] +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.ItemList.Closure in itemlist.go:80 +items.(*ItemSet).Next in itemset.go:165 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_digit +*** Item: "_digit : '0'-'9'" + ** emoves: +S7: #0: <"id : _x {_x0 | (\\u03b2 • _digit {_digit}) | \\u03b3}"> +S7: #1: <"_digit : • '0'-'9'"> +S7: rng: "[\\u03b3,\\u03b3]" +------------------------------------------- +items.(*ItemSet).Next in itemset.go:159 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S7:rng="[\\u03b3,\\u03b3]" +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).Move in item.go:311 +items.(*ItemSet).Next in itemset.go:162 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +id +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | • (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" + <"id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}">:move("[\\u03b3,\\u03b3]"):["id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" "id : _x {_x0 | (• \\u03b2 _digit {_digit}) | \\u03b3}" "id : _x {• _x0 | (\\u03b2 _digit {_digit}) | \\u03b3}"] +------------------------------------------- +items.(*ItemSet).dependentsClosure in itemset.go:190 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S7:dependentsClosure S7 + actual: { + _digit : '0'-'9' • + _x : (α | (β _digit {_digit})) • + _x : α | (β _digit {• _digit}) + id : _x {_x0 | (β _digit {_digit}) | γ} • + id : _x {_x0 | (β _digit {_digit}) | • γ} + id : _x {_x0 | (• β _digit {_digit}) | γ} + id : _x {• _x0 | (β _digit {_digit}) | γ} + id : • _x {_x0 | (β _digit {_digit}) | γ} + _digit : • '0'-'9' + _x0 : • α +} +Transitions: + ['0','9'] -> S7 + [α,α] -> S4 + [β,β] -> S5 + [γ,γ] -> S-1 +Symbols classes: {['0','9'], [α,α], [β,β], [γ,γ]} + + items: ["id : _x {_x0 | (\u03b2 _digit {_digit}) | \u03b3} •" "id : _x {_x0 | (\u03b2 _digit {_digit}) | • \u03b3}" "id : _x {_x0 | (• \u03b2 _digit {_digit}) | \u03b3}" "id : _x {• _x0 | (\u03b2 _digit {_digit}) | \u03b3}"] +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.ItemList.Closure in itemlist.go:80 +items.(*ItemSet).Next in itemset.go:165 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_x0 +*** Item: "_x0 : \\u03b1" + ** emoves: +S7: #0: <"id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •"> +S7: #1: <"id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}"> +S7: #2: <"id : _x {_x0 | (• \\u03b2 _digit {_digit}) | \\u03b3}"> +S7: #3: <"id : _x {• _x0 | (\\u03b2 _digit {_digit}) | \\u03b3}"> +S7: #4: <"_x0 : • \\u03b1"> +S8/9 +S8: rng: "['0','9']" +------------------------------------------- +items.(*ItemSet).Next in itemset.go:159 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S8:rng="['0','9']" +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).Move in item.go:311 +items.(*ItemSet).Next in itemset.go:162 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_digit +*** Item: "_digit : '0'-'9'" + ** emoves: + <"_digit : • '0'-'9'">:move("['0','9']"):["_digit : '0'-'9' •"] +------------------------------------------- +items.(*ItemSet).dependentsClosure in itemset.go:190 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S8:dependentsClosure S8 + actual: { + _digit : '0'-'9' • + id : _x {_x0 | (β _digit {_digit}) | γ} • + id : _x {_x0 | (β _digit {_digit}) | • γ} + id : _x {_x0 | (• β _digit {_digit}) | γ} + id : _x {• _x0 | (β _digit {_digit}) | γ} + id : _x {_x0 | (β _digit {• _digit}) | γ} + _x0 : • α + _digit : • '0'-'9' +} +Transitions: + ['0','9'] -> S-1 + [α,α] -> S-1 + [β,β] -> S-1 + [γ,γ] -> S-1 +Symbols classes: {['0','9'], [α,α], [β,β], [γ,γ]} + + items: ["_digit : '0'-'9' •"] +------------------------------------------- +items.(*Item).MoveRegDefId in item.go:333 +items.(*ItemSet).dependentsClosure in itemset.go:195 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 + * moved item: + *ast.LexPattern:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 + *ast.LexAlt:_x {_x0 | (β _digit {_digit}) | γ}; pos 1 + *ast.LexRepPattern:{_x0 | (β _digit {_digit}) | γ}; pos 1 + *ast.LexAlt:(β _digit {_digit}); pos 0 + *ast.LexGroupPattern:(β _digit {_digit}); pos 0 + *ast.LexAlt:β _digit {_digit}; pos 2 + *ast.LexRepPattern:{_digit}; pos 0 + *ast.LexAlt:_digit; pos 1 + +was: + *ast.LexPattern:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 + *ast.LexAlt:_x {_x0 | (β _digit {_digit}) | γ}; pos 1 + *ast.LexRepPattern:{_x0 | (β _digit {_digit}) | γ}; pos 1 + *ast.LexAlt:(β _digit {_digit}); pos 0 + *ast.LexGroupPattern:(β _digit {_digit}); pos 0 + *ast.LexAlt:β _digit {_digit}; pos 2 + *ast.LexRepPattern:{_digit}; pos 0 + *ast.LexAlt:_digit; pos 0 +) +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).MoveRegDefId in item.go:334 +items.(*ItemSet).dependentsClosure in itemset.go:195 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +id +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | • (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" +S8: ====> id : _x {_x0 | (\u03b2 _digit {_digit}) | \u03b3} • +S8: ====> id : _x {_x0 | (\u03b2 _digit {_digit}) | • \u03b3} +S8: ====> id : _x {_x0 | (• \u03b2 _digit {_digit}) | \u03b3} +S8: ====> id : _x {• _x0 | (\u03b2 _digit {_digit}) | \u03b3} +S8: ====> id : _x {_x0 | (\u03b2 _digit {• _digit}) | \u03b3} +------------------------------------------- +items.(*Item).MoveRegDefId in item.go:333 +items.(*ItemSet).dependentsClosure in itemset.go:199 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 + * moved item: + *ast.LexPattern:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 + *ast.LexAlt:_x {_x0 | (β _digit {_digit}) | γ}; pos 1 + *ast.LexRepPattern:{_x0 | (β _digit {_digit}) | γ}; pos 1 + *ast.LexAlt:(β _digit {_digit}); pos 0 + *ast.LexGroupPattern:(β _digit {_digit}); pos 0 + *ast.LexAlt:β _digit {_digit}; pos 2 + *ast.LexRepPattern:{_digit}; pos 0 + *ast.LexAlt:_digit; pos 1 + +was: + *ast.LexPattern:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 + *ast.LexAlt:_x {_x0 | (β _digit {_digit}) | γ}; pos 1 + *ast.LexRepPattern:{_x0 | (β _digit {_digit}) | γ}; pos 1 + *ast.LexAlt:(β _digit {_digit}); pos 0 + *ast.LexGroupPattern:(β _digit {_digit}); pos 0 + *ast.LexAlt:β _digit {_digit}; pos 2 + *ast.LexRepPattern:{_digit}; pos 0 + *ast.LexAlt:_digit; pos 0 +) +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).MoveRegDefId in item.go:334 +items.(*ItemSet).dependentsClosure in itemset.go:199 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +id +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | • (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.ItemList.Closure in itemlist.go:80 +items.(*ItemSet).Next in itemset.go:165 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_x0 +*** Item: "_x0 : \\u03b1" + ** emoves: +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.ItemList.Closure in itemlist.go:80 +items.(*ItemSet).Next in itemset.go:165 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_digit +*** Item: "_digit : '0'-'9'" + ** emoves: +S8: #0: <"_digit : '0'-'9' •"> +S8: #1: <"id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •"> +S8: #2: <"id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}"> +S8: #3: <"id : _x {_x0 | (• \\u03b2 _digit {_digit}) | \\u03b3}"> +S8: #4: <"id : _x {• _x0 | (\\u03b2 _digit {_digit}) | \\u03b3}"> +S8: #5: <"id : _x {_x0 | (\\u03b2 _digit {• _digit}) | \\u03b3}"> +S8: #6: <"_x0 : • \\u03b1"> +S8: #7: <"_digit : • '0'-'9'"> +S8: rng: "[\\u03b1,\\u03b1]" +------------------------------------------- +items.(*ItemSet).Next in itemset.go:159 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S8:rng="[\\u03b1,\\u03b1]" +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).Move in item.go:311 +items.(*ItemSet).Next in itemset.go:162 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_x0 +*** Item: "_x0 : \\u03b1" + ** emoves: + <"_x0 : • \\u03b1">:move("[\\u03b1,\\u03b1]"):["_x0 : \\u03b1 •"] +------------------------------------------- +items.(*ItemSet).dependentsClosure in itemset.go:190 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S8:dependentsClosure S8 + actual: { + _digit : '0'-'9' • + id : _x {_x0 | (β _digit {_digit}) | γ} • + id : _x {_x0 | (β _digit {_digit}) | • γ} + id : _x {_x0 | (• β _digit {_digit}) | γ} + id : _x {• _x0 | (β _digit {_digit}) | γ} + id : _x {_x0 | (β _digit {• _digit}) | γ} + _x0 : • α + _digit : • '0'-'9' +} +Transitions: + ['0','9'] -> S8 + [α,α] -> S-1 + [β,β] -> S-1 + [γ,γ] -> S-1 +Symbols classes: {['0','9'], [α,α], [β,β], [γ,γ]} + + items: ["_x0 : \u03b1 •"] +------------------------------------------- +items.(*Item).MoveRegDefId in item.go:333 +items.(*ItemSet).dependentsClosure in itemset.go:195 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 + * moved item: + *ast.LexPattern:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 + *ast.LexAlt:_x {_x0 | (β _digit {_digit}) | γ}; pos 1 + *ast.LexRepPattern:{_x0 | (β _digit {_digit}) | γ}; pos 0 + *ast.LexAlt:_x0; pos 1 + +was: + *ast.LexPattern:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 + *ast.LexAlt:_x {_x0 | (β _digit {_digit}) | γ}; pos 1 + *ast.LexRepPattern:{_x0 | (β _digit {_digit}) | γ}; pos 0 + *ast.LexAlt:_x0; pos 0 +) +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).MoveRegDefId in item.go:334 +items.(*ItemSet).dependentsClosure in itemset.go:195 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +id +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | • (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" +S8: ====> id : _x {_x0 | (\u03b2 _digit {_digit}) | \u03b3} • +S8: ====> id : _x {_x0 | (\u03b2 _digit {_digit}) | • \u03b3} +S8: ====> id : _x {_x0 | (• \u03b2 _digit {_digit}) | \u03b3} +S8: ====> id : _x {• _x0 | (\u03b2 _digit {_digit}) | \u03b3} +------------------------------------------- +items.(*Item).MoveRegDefId in item.go:333 +items.(*ItemSet).dependentsClosure in itemset.go:199 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 + * moved item: + *ast.LexPattern:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 + *ast.LexAlt:_x {_x0 | (β _digit {_digit}) | γ}; pos 1 + *ast.LexRepPattern:{_x0 | (β _digit {_digit}) | γ}; pos 0 + *ast.LexAlt:_x0; pos 1 + +was: + *ast.LexPattern:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 + *ast.LexAlt:_x {_x0 | (β _digit {_digit}) | γ}; pos 1 + *ast.LexRepPattern:{_x0 | (β _digit {_digit}) | γ}; pos 0 + *ast.LexAlt:_x0; pos 0 +) +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).MoveRegDefId in item.go:334 +items.(*ItemSet).dependentsClosure in itemset.go:199 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +id +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | • (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.ItemList.Closure in itemlist.go:80 +items.(*ItemSet).Next in itemset.go:165 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_x0 +*** Item: "_x0 : \\u03b1" + ** emoves: +S8: #0: <"_x0 : \\u03b1 •"> +S8: #1: <"id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •"> +S8: #2: <"id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}"> +S8: #3: <"id : _x {_x0 | (• \\u03b2 _digit {_digit}) | \\u03b3}"> +S8: #4: <"id : _x {• _x0 | (\\u03b2 _digit {_digit}) | \\u03b3}"> +S8: #5: <"_x0 : • \\u03b1"> +S8: rng: "[\\u03b2,\\u03b2]" +------------------------------------------- +items.(*ItemSet).Next in itemset.go:159 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S8:rng="[\\u03b2,\\u03b2]" +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).Move in item.go:311 +items.(*ItemSet).Next in itemset.go:162 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +id + <"id : _x {_x0 | (• \\u03b2 _digit {_digit}) | \\u03b3}">:move("[\\u03b2,\\u03b2]"):["id : _x {_x0 | (\\u03b2 • _digit {_digit}) | \\u03b3}"] +------------------------------------------- +items.(*ItemSet).dependentsClosure in itemset.go:190 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S8:dependentsClosure S8 + actual: { + _digit : '0'-'9' • + id : _x {_x0 | (β _digit {_digit}) | γ} • + id : _x {_x0 | (β _digit {_digit}) | • γ} + id : _x {_x0 | (• β _digit {_digit}) | γ} + id : _x {• _x0 | (β _digit {_digit}) | γ} + id : _x {_x0 | (β _digit {• _digit}) | γ} + _x0 : • α + _digit : • '0'-'9' +} +Transitions: + ['0','9'] -> S8 + [α,α] -> S4 + [β,β] -> S-1 + [γ,γ] -> S-1 +Symbols classes: {['0','9'], [α,α], [β,β], [γ,γ]} + + items: ["id : _x {_x0 | (\u03b2 • _digit {_digit}) | \u03b3}"] +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.ItemList.Closure in itemlist.go:80 +items.(*ItemSet).Next in itemset.go:165 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_digit +*** Item: "_digit : '0'-'9'" + ** emoves: +S8: #0: <"id : _x {_x0 | (\\u03b2 • _digit {_digit}) | \\u03b3}"> +S8: #1: <"_digit : • '0'-'9'"> +S8: rng: "[\\u03b3,\\u03b3]" +------------------------------------------- +items.(*ItemSet).Next in itemset.go:159 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S8:rng="[\\u03b3,\\u03b3]" +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.(*Item).Move in item.go:311 +items.(*ItemSet).Next in itemset.go:162 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +id +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: +*** Item: "id : _x {_x0 | • (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" +*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" + ** emoves: + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" + "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" + <"id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}">:move("[\\u03b3,\\u03b3]"):["id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" "id : _x {_x0 | (• \\u03b2 _digit {_digit}) | \\u03b3}" "id : _x {• _x0 | (\\u03b2 _digit {_digit}) | \\u03b3}"] +------------------------------------------- +items.(*ItemSet).dependentsClosure in itemset.go:190 +items.(*ItemSet).Next in itemset.go:164 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +S8:dependentsClosure S8 + actual: { + _digit : '0'-'9' • + id : _x {_x0 | (β _digit {_digit}) | γ} • + id : _x {_x0 | (β _digit {_digit}) | • γ} + id : _x {_x0 | (• β _digit {_digit}) | γ} + id : _x {• _x0 | (β _digit {_digit}) | γ} + id : _x {_x0 | (β _digit {• _digit}) | γ} + _x0 : • α + _digit : • '0'-'9' +} +Transitions: + ['0','9'] -> S8 + [α,α] -> S4 + [β,β] -> S5 + [γ,γ] -> S-1 +Symbols classes: {['0','9'], [α,α], [β,β], [γ,γ]} + + items: ["id : _x {_x0 | (\u03b2 _digit {_digit}) | \u03b3} •" "id : _x {_x0 | (\u03b2 _digit {_digit}) | • \u03b3}" "id : _x {_x0 | (• \u03b2 _digit {_digit}) | \u03b3}" "id : _x {• _x0 | (\u03b2 _digit {_digit}) | \u03b3}"] +------------------------------------------- +items.(*Item).Emoves in item.go:107 +items.ItemList.Closure in itemlist.go:80 +items.(*ItemSet).Next in itemset.go:165 +items.(*ItemSets).Closure in itemsets.go:59 +items.GetItemSets in itemsets.go:41 +_x0 +*** Item: "_x0 : \\u03b1" + ** emoves: +S8: #0: <"id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •"> +S8: #1: <"id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}"> +S8: #2: <"id : _x {_x0 | (• \\u03b2 _digit {_digit}) | \\u03b3}"> +S8: #3: <"id : _x {• _x0 | (\\u03b2 _digit {_digit}) | \\u03b3}"> +S8: #4: <"_x0 : • \\u03b1"> diff --git a/internal/lexer/items/dbg.go b/internal/lexer/items/dbg.go new file mode 100644 index 00000000..2127e2f8 --- /dev/null +++ b/internal/lexer/items/dbg.go @@ -0,0 +1,32 @@ +package items + +import ( + "fmt" + "os" + "regexp" + "runtime/debug" + "strings" +) + +var ( + callerRE = regexp.MustCompile("^\\s*(.*)/([^/]+)(\\(.*\\))$") + sourceRE = regexp.MustCompile("^\\s*(.*)/([^/]+:\\d+)\\s*(.*)$") +) + +func dbg(set int, format string, v ...interface{}) { + if set >= 0 { + fmt.Fprintf(os.Stderr, "S%d:", set) + } + fmt.Fprintf(os.Stderr, format, v...) +} + +func trace(set int, format string, v ...interface{}) { + stack := strings.Split(string(debug.Stack()), "\n") + fmt.Fprintf(os.Stderr, "-------------------------------------------\n") + for ix := 5; ix < len(stack)-3; ix += 2 { + caller := callerRE.ReplaceAllString(stack[ix], "$2") + source := sourceRE.ReplaceAllString(stack[ix+1], "$2") + fmt.Fprintf(os.Stderr, "%s in %s\n", caller, source) + } + dbg(set, format, v...) +} From aab2ab02bee81888fc80836bdf56f7faea8cac3c Mon Sep 17 00:00:00 2001 From: Massimiliano Calandrelli Date: Mon, 21 Oct 2019 17:24:55 +0200 Subject: [PATCH 31/33] ... --- example/astx/ast.grammar/ast/iface/ast.go | 13 + .../ast.grammar/ast/internal/parser/parser.go | 3 +- .../ast/internal/parser/productionstable.go | 40 +- .../ast.grammar/ast/internal/util/rune.go | 101 + .../ast.grammar/ast/main/{main.go => ast.go} | 0 example/astx/ast.grammar/ast/util.go | 25 + .../bools/bools.grammar/bools/iface/bools.go | 13 + .../bools/internal/parser/parser.go | 3 +- .../bools/internal/parser/productionstable.go | 54 +- .../bools/internal/token/token.go | 8 +- .../bools.grammar/bools/internal/util/rune.go | 101 + .../bools/main/{main.go => bools.go} | 0 example/bools/bools.grammar/bools/util.go | 25 + example/calc/calc.bnf | 4 - example/calc/calc.grammar/calc/iface/calc.go | 13 + .../calc/internal/parser/parser.go | 3 +- .../calc/internal/parser/productionstable.go | 47 +- .../calc.grammar/calc/internal/util/rune.go | 101 + .../calc/main/{main.go => calc.go} | 0 example/calc/calc.grammar/calc/util.go | 25 + example/ctx/Makefile | 5 +- example/ctx/ctx.bnf | 2 +- .../ctx => ctx0.grammar/ctx0}/ctx.go | 8 +- .../ctx => ctx0.grammar/ctx0}/iface/ctx.go | 6 +- .../ctx0}/internal/errors/errors.go | 2 +- .../io/stream/internal/stream_impl.go | 0 .../io/stream/internal/stream_public.go | 0 .../ctx0}/internal/io/stream/stream.go | 2 +- .../ctx0/internal/lexer/acttab.go | 71 + .../ctx0.grammar/ctx0/internal/lexer/lexer.go | 174 ++ .../ctx0/internal/lexer/transitiontable.go | 151 + .../ctx0}/internal/parser/action.go | 0 .../ctx0}/internal/parser/actiontable.go | 16 +- .../ctx0}/internal/parser/gototable.go | 0 .../ctx0}/internal/parser/parser.go | 6 +- .../ctx0}/internal/parser/productionstable.go | 8 +- .../ctx0}/internal/token/token.go | 0 .../ctx0}/internal/util/litconv.go | 0 .../ctx0}/internal/util/rune.go | 0 .../ctx0}/log/LR1_sets.txt | 0 .../ctx => ctx0.grammar/ctx0}/log/first.txt | 0 .../ctx/ctx0.grammar/ctx0/log/lexer_sets.txt | 191 ++ .../ctx0}/log/terminals.txt | 0 .../ctx => ctx0.grammar/ctx0}/main/ctx.go | 2 +- .../ctx => ctx0.grammar/ctx0}/util.go | 2 +- example/ctx/ctx0.log | 2454 +--------------- example/ctx/ctx1.bnf | 2 +- .../ctx1/internal/lexer/acttab.go | 12 + .../ctx1.grammar/ctx1/internal/lexer/lexer.go | 2 +- .../ctx1/internal/lexer/transitiontable.go | 38 +- .../ctx1/internal/parser/actiontable.go | 16 +- .../ctx1/internal/parser/productionstable.go | 4 +- .../ctx/ctx1.grammar/ctx1/log/lexer_sets.txt | 56 +- example/ctx/ctx1.log | 2477 +---------------- example/ctx/ctx2.grammar/ctx2/ctx.go | 131 + example/ctx/ctx2.grammar/ctx2/iface/ctx.go | 63 + .../ctx2/internal/errors/errors.go | 56 + .../io/stream/internal/stream_impl.go | 275 ++ .../io/stream/internal/stream_public.go | 101 + .../ctx2/internal/io/stream/stream.go | 39 + .../ctx2}/internal/lexer/acttab.go | 2 +- .../ctx2}/internal/lexer/lexer.go | 6 +- .../ctx2}/internal/lexer/transitiontable.go | 0 .../ctx2/internal/parser/action.go | 51 + .../ctx2/internal/parser/actiontable.go | 97 + .../ctx2/internal/parser/gototable.go | 43 + .../ctx2/internal/parser/parser.go | 359 +++ .../ctx2/internal/parser/productionstable.go | 109 + .../ctx2.grammar/ctx2/internal/token/token.go | 93 + .../ctx2/internal/util/litconv.go | 108 + .../ctx2.grammar/ctx2/internal/util/rune.go | 140 + .../ctx/ctx2.grammar/ctx2/log/LR1_sets.txt | 72 + example/ctx/ctx2.grammar/ctx2/log/first.txt | 12 + .../ctx2}/log/lexer_sets.txt | 0 .../ctx/ctx2.grammar/ctx2/log/terminals.txt | 4 + example/ctx/ctx2.grammar/ctx2/main/ctx.go | 58 + example/ctx/ctx2.grammar/ctx2/util.go | 25 + example/ctx/ctx2.log | 12 + example/ctx/ctx_test.go | 58 +- example/ctx/log | 130 - .../errorrecovery/er.grammar/er/iface/er.go | 13 + .../er.grammar/er/internal/parser/parser.go | 3 +- .../er/internal/parser/productionstable.go | 40 +- .../er.grammar/er/internal/util/rune.go | 101 + .../er.grammar/er/main/{main.go => er.go} | 0 example/errorrecovery/er.grammar/er/util.go | 25 + example/examples.sh | 2 + example/mail/mail.grammar/mail/iface/mail.go | 13 + .../mail/internal/lexer/transitiontable.go | 3 +- .../mail.grammar/mail/internal/util/rune.go | 101 + example/mail/mail.grammar/mail/util.go | 25 + example/nolexer/nolexer.bnf | 15 +- .../nolexer.grammar/nolexer/iface/nolexer.go | 13 + .../nolexer/internal/parser/parser.go | 3 +- .../internal/parser/productionstable.go | 36 +- .../nolexer/internal/util/rune.go | 101 + .../nolexer/nolexer.grammar/nolexer/util.go | 25 + example/rr/rr.grammar/rr/iface/rr.go | 13 + .../rr.grammar/rr/internal/parser/parser.go | 3 +- .../rr/internal/parser/productionstable.go | 34 + .../rr/rr.grammar/rr/internal/util/rune.go | 101 + .../rr/rr.grammar/rr/main/{main.go => rr.go} | 0 example/rr/rr.grammar/rr/util.go | 25 + example/sr/sr.grammar/sr/iface/sr.go | 13 + .../sr.grammar/sr/internal/parser/parser.go | 3 +- .../sr/internal/parser/productionstable.go | 40 +- .../sr/sr.grammar/sr/internal/util/rune.go | 101 + .../sr/sr.grammar/sr/main/{main.go => sr.go} | 0 example/sr/sr.grammar/sr/util.go | 25 + internal/config/config.go | 106 +- internal/frontend/reparsed/log/lexer_sets.txt | 19 + internal/lexer/items/dbg.go | 60 +- internal/lexer/items/item.go | 19 +- internal/lexer/items/itemlist.go | 14 +- internal/lexer/items/itemset.go | 11 +- internal/lexer/items/itemsets.go | 30 +- internal/lexer/items/itemsets_test.go | 4 +- internal/parser/gen/golang/actiontable.go | 9 +- main.go | 41 +- stock/main.go | 2 +- 120 files changed, 4292 insertions(+), 5230 deletions(-) rename example/astx/ast.grammar/ast/main/{main.go => ast.go} (100%) create mode 100644 example/astx/ast.grammar/ast/util.go rename example/bools/bools.grammar/bools/main/{main.go => bools.go} (100%) create mode 100644 example/bools/bools.grammar/bools/util.go rename example/calc/calc.grammar/calc/main/{main.go => calc.go} (100%) create mode 100644 example/calc/calc.grammar/calc/util.go rename example/ctx/{ctx.grammar/ctx => ctx0.grammar/ctx0}/ctx.go (90%) rename example/ctx/{ctx.grammar/ctx => ctx0.grammar/ctx0}/iface/ctx.go (81%) rename example/ctx/{ctx.grammar/ctx => ctx0.grammar/ctx0}/internal/errors/errors.go (94%) rename example/ctx/{ctx.grammar/ctx => ctx0.grammar/ctx0}/internal/io/stream/internal/stream_impl.go (100%) rename example/ctx/{ctx.grammar/ctx => ctx0.grammar/ctx0}/internal/io/stream/internal/stream_public.go (100%) rename example/ctx/{ctx.grammar/ctx => ctx0.grammar/ctx0}/internal/io/stream/stream.go (88%) create mode 100644 example/ctx/ctx0.grammar/ctx0/internal/lexer/acttab.go create mode 100644 example/ctx/ctx0.grammar/ctx0/internal/lexer/lexer.go create mode 100644 example/ctx/ctx0.grammar/ctx0/internal/lexer/transitiontable.go rename example/ctx/{ctx.grammar/ctx => ctx0.grammar/ctx0}/internal/parser/action.go (100%) rename example/ctx/{ctx.grammar/ctx => ctx0.grammar/ctx0}/internal/parser/actiontable.go (84%) rename example/ctx/{ctx.grammar/ctx => ctx0.grammar/ctx0}/internal/parser/gototable.go (100%) rename example/ctx/{ctx.grammar/ctx => ctx0.grammar/ctx0}/internal/parser/parser.go (97%) rename example/ctx/{ctx.grammar/ctx => ctx0.grammar/ctx0}/internal/parser/productionstable.go (90%) rename example/ctx/{ctx.grammar/ctx => ctx0.grammar/ctx0}/internal/token/token.go (100%) rename example/ctx/{ctx.grammar/ctx => ctx0.grammar/ctx0}/internal/util/litconv.go (100%) rename example/ctx/{ctx.grammar/ctx => ctx0.grammar/ctx0}/internal/util/rune.go (100%) rename example/ctx/{ctx.grammar/ctx => ctx0.grammar/ctx0}/log/LR1_sets.txt (100%) rename example/ctx/{ctx.grammar/ctx => ctx0.grammar/ctx0}/log/first.txt (100%) create mode 100644 example/ctx/ctx0.grammar/ctx0/log/lexer_sets.txt rename example/ctx/{ctx.grammar/ctx => ctx0.grammar/ctx0}/log/terminals.txt (100%) rename example/ctx/{ctx.grammar/ctx => ctx0.grammar/ctx0}/main/ctx.go (94%) rename example/ctx/{ctx.grammar/ctx => ctx0.grammar/ctx0}/util.go (83%) create mode 100644 example/ctx/ctx2.grammar/ctx2/ctx.go create mode 100644 example/ctx/ctx2.grammar/ctx2/iface/ctx.go create mode 100644 example/ctx/ctx2.grammar/ctx2/internal/errors/errors.go create mode 100644 example/ctx/ctx2.grammar/ctx2/internal/io/stream/internal/stream_impl.go create mode 100644 example/ctx/ctx2.grammar/ctx2/internal/io/stream/internal/stream_public.go create mode 100644 example/ctx/ctx2.grammar/ctx2/internal/io/stream/stream.go rename example/ctx/{ctx.grammar/ctx => ctx2.grammar/ctx2}/internal/lexer/acttab.go (91%) rename example/ctx/{ctx.grammar/ctx => ctx2.grammar/ctx2}/internal/lexer/lexer.go (93%) rename example/ctx/{ctx.grammar/ctx => ctx2.grammar/ctx2}/internal/lexer/transitiontable.go (100%) create mode 100644 example/ctx/ctx2.grammar/ctx2/internal/parser/action.go create mode 100644 example/ctx/ctx2.grammar/ctx2/internal/parser/actiontable.go create mode 100644 example/ctx/ctx2.grammar/ctx2/internal/parser/gototable.go create mode 100644 example/ctx/ctx2.grammar/ctx2/internal/parser/parser.go create mode 100644 example/ctx/ctx2.grammar/ctx2/internal/parser/productionstable.go create mode 100644 example/ctx/ctx2.grammar/ctx2/internal/token/token.go create mode 100644 example/ctx/ctx2.grammar/ctx2/internal/util/litconv.go create mode 100644 example/ctx/ctx2.grammar/ctx2/internal/util/rune.go create mode 100644 example/ctx/ctx2.grammar/ctx2/log/LR1_sets.txt create mode 100644 example/ctx/ctx2.grammar/ctx2/log/first.txt rename example/ctx/{ctx.grammar/ctx => ctx2.grammar/ctx2}/log/lexer_sets.txt (100%) create mode 100644 example/ctx/ctx2.grammar/ctx2/log/terminals.txt create mode 100644 example/ctx/ctx2.grammar/ctx2/main/ctx.go create mode 100644 example/ctx/ctx2.grammar/ctx2/util.go create mode 100644 example/ctx/ctx2.log delete mode 100644 example/ctx/log rename example/errorrecovery/er.grammar/er/main/{main.go => er.go} (100%) create mode 100644 example/errorrecovery/er.grammar/er/util.go create mode 100755 example/examples.sh create mode 100644 example/mail/mail.grammar/mail/util.go create mode 100644 example/nolexer/nolexer.grammar/nolexer/util.go rename example/rr/rr.grammar/rr/main/{main.go => rr.go} (100%) create mode 100644 example/rr/rr.grammar/rr/util.go rename example/sr/sr.grammar/sr/main/{main.go => sr.go} (100%) create mode 100644 example/sr/sr.grammar/sr/util.go diff --git a/example/astx/ast.grammar/ast/iface/ast.go b/example/astx/ast.grammar/ast/iface/ast.go index 3113c756..d41fb7c5 100644 --- a/example/astx/ast.grammar/ast/iface/ast.go +++ b/example/astx/ast.grammar/ast/iface/ast.go @@ -4,6 +4,7 @@ package iface import ( "github.com/maxcalandrelli/gocc/example/astx/ast.grammar/ast/internal/errors" + "github.com/maxcalandrelli/gocc/example/astx/ast.grammar/ast/internal/io/stream" "github.com/maxcalandrelli/gocc/example/astx/ast.grammar/ast/internal/token" "io" ) @@ -48,3 +49,15 @@ const ( func GetTokenMap() TokenMap { return token.TokMap } + +func NewWindowReaderFromBytes(src []byte) stream.WindowReader { + return stream.NewWindowReaderFromBytes(src) +} + +func NewWindowReader(rdr io.Reader) stream.WindowReader { + return stream.NewWindowReader(rdr) +} + +func NewLimitedWindowReader(rdr io.Reader, sizeMin, sizeMax int) stream.WindowReader { + return stream.NewLimitedWindowReader(rdr, sizeMin, sizeMax) +} diff --git a/example/astx/ast.grammar/ast/internal/parser/parser.go b/example/astx/ast.grammar/ast/internal/parser/parser.go index 609825ae..22bed2cb 100644 --- a/example/astx/ast.grammar/ast/internal/parser/parser.go +++ b/example/astx/ast.grammar/ast/internal/parser/parser.go @@ -280,8 +280,9 @@ func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, er // // If no action, check if we have some context dependent parsing to try // + p.checkPoint = p.checkPoint.Advance(len(p.nextToken.IgnoredPrefix)) for _, cdAction := range parserActions.table[p.stack.top()].cdActions { - p.tokens.GotoCheckPoint(p.checkPoint.Advance(len(p.nextToken.IgnoredPrefix))) + p.tokens.GotoCheckPoint(p.checkPoint) cd_res, cd_err, cd_parsed := cdAction.tokenScanner(p.underlyingStream, p.userContext) if cd_err == nil && len(cd_parsed) > 0 { action = parserActions.table[p.stack.top()].actions[cdAction.tokenIndex] diff --git a/example/astx/ast.grammar/ast/internal/parser/productionstable.go b/example/astx/ast.grammar/ast/internal/parser/productionstable.go index 540f75cc..241d7d56 100644 --- a/example/astx/ast.grammar/ast/internal/parser/productionstable.go +++ b/example/astx/ast.grammar/ast/internal/parser/productionstable.go @@ -4,6 +4,40 @@ package parser import "github.com/maxcalandrelli/gocc/example/astx/ast" +import ( + "fmt" + "github.com/maxcalandrelli/gocc/example/astx/ast.grammar/ast/internal/token" + "github.com/maxcalandrelli/gocc/example/astx/ast.grammar/ast/internal/util" + "strings" +) + +func getString(X Attrib) string { + switch X.(type) { + case *token.Token: + return string(X.(*token.Token).Lit) + case string: + return X.(string) + } + return fmt.Sprintf("%q", X) +} + +func unescape(s string) string { + return util.EscapedString(s).Unescape() +} + +func unquote(s string) string { + r, _, _ := util.EscapedString(s).Unquote() + return r +} + +func lc(s string) string { + return strings.ToLower(s) +} + +func uc(s string) string { + return strings.ToUpper(s) +} + type ( //TODO: change type and variable names to be consistent with other tables ProdTab [numProductions]ProdTabEntry @@ -31,7 +65,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `StmtList : Π << ast.NewStmtList(X[0]) >>`, + String: `StmtList : Π << ast.NewStmtList($0) >>`, Id: "StmtList", NTType: 1, Index: 1, @@ -41,7 +75,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `StmtList : Π Π << ast.AppendStmt(X[0], X[1]) >>`, + String: `StmtList : Π Π << ast.AppendStmt($0, $1) >>`, Id: "StmtList", NTType: 1, Index: 2, @@ -51,7 +85,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `Stmt : id << ast.NewStmt(X[0]) >>`, + String: `Stmt : id << ast.NewStmt($0) >>`, Id: "Stmt", NTType: 2, Index: 3, diff --git a/example/astx/ast.grammar/ast/internal/util/rune.go b/example/astx/ast.grammar/ast/internal/util/rune.go index bd8523a4..788edfde 100644 --- a/example/astx/ast.grammar/ast/internal/util/rune.go +++ b/example/astx/ast.grammar/ast/internal/util/rune.go @@ -1,9 +1,12 @@ // Code generated by gocc; DO NOT EDIT. + package util import ( "fmt" + "unicode" + "unicode/utf8" ) func RuneToString(r rune) string { @@ -37,3 +40,101 @@ func RuneToString(r rune) string { } return fmt.Sprintf("\\U%08x", r) } + +type EscapedString string + +func (str EscapedString) Unquote() (unquoted string, wasQuoted bool, quoteType rune) { + if len(str) > 1 { + r := str[0] + if (r == '"' || r == '\x60' || r == '\'') && r == str[len(str)-1] { + str = str[1 : len(str)-1] + } + return string(str), true, rune(r) + } + return string(str), false, 0 +} + +func (str EscapedString) Unescape() string { + var ( + res string + r rune + size int + ) + for s := 0; s < len(str); s += size { + if str[s] == '\\' { + r, size = str[s+1:].EscapedFirstCharValue() + size++ + } else { + r, size = utf8.DecodeRuneInString(string(str)[s:]) + } + res += string(r) + } + return res +} + +func (str EscapedString) EscapedFirstCharValue() (rune, int) { + var i, base, max uint32 + offset := 0 + switch str[offset] { + case '\'', '"': + return rune(str[offset]), 1 + case 'a': + return '\a', 1 + case 'b': + return '\b', 1 + case 'f': + return '\f', 1 + case 'n': + return '\n', 1 + case 'r': + return '\r', 1 + case 't': + return '\t', 1 + case 'v': + return '\v', 1 + case '\\': + return '\\', 1 + case '0', '1', '2', '3', '4', '5', '6', '7': + i, base, max = 3, 8, 255 + case 'x': + i, base, max = 2, 16, 255 + offset++ + case 'u': + i, base, max = 4, 16, unicode.MaxRune + offset++ + case 'U': + i, base, max = 8, 32, unicode.MaxRune + offset++ + default: + panic(fmt.Sprintf("Error decoding character literal: %s\n", str[offset:])) + } + + var x uint32 + for ; i > 0 && offset < len(str); i-- { + ch, size := utf8.DecodeRuneInString(string(str)[offset:]) + offset += size + d := uint32(HexDigitValue(ch)) + if d >= base { + panic(fmt.Sprintf("charVal(%s): illegal character (%c) in escape sequence. size=%d, offset=%d", str, str[offset], size, offset)) + } + x = x*base + d + } + if x > max || 0xD800 <= x && x < 0xE000 { + panic(fmt.Sprintf("Error decoding escape char value. Lit:%s, offset:%d, escape sequence is invalid Unicode code point\n", str, offset)) + } + + return rune(x), offset +} + +func HexDigitValue(ch rune) int { + switch { + case '0' <= ch && ch <= '9': + return int(ch) - '0' + case 'a' <= ch && ch <= 'f': + return int(ch) - 'a' + 10 + case 'A' <= ch && ch <= 'F': + return int(ch) - 'A' + 10 + } + return 16 // larger than any legal digit val +} + diff --git a/example/astx/ast.grammar/ast/main/main.go b/example/astx/ast.grammar/ast/main/ast.go similarity index 100% rename from example/astx/ast.grammar/ast/main/main.go rename to example/astx/ast.grammar/ast/main/ast.go diff --git a/example/astx/ast.grammar/ast/util.go b/example/astx/ast.grammar/ast/util.go new file mode 100644 index 00000000..69965c9b --- /dev/null +++ b/example/astx/ast.grammar/ast/util.go @@ -0,0 +1,25 @@ +// Code generated by gocc; DO NOT EDIT. + +package ast + +import ( + "github.com/maxcalandrelli/gocc/example/astx/ast.grammar/ast/internal/util" +) + +type EscapedString = util.EscapedString + +func RuneToString(r rune) string { + return util.RuneToString(r) +} + +func HexDigitValue(ch rune) int { + return util.HexDigitValue(ch) +} + +func IntValue(lit []byte) (int64, error) { + return util.IntValue(lit) +} + +func UintValue(lit []byte) (uint64, error) { + return util.UintValue(lit) +} diff --git a/example/bools/bools.grammar/bools/iface/bools.go b/example/bools/bools.grammar/bools/iface/bools.go index ded52d2b..46e8fe25 100644 --- a/example/bools/bools.grammar/bools/iface/bools.go +++ b/example/bools/bools.grammar/bools/iface/bools.go @@ -4,6 +4,7 @@ package iface import ( "github.com/maxcalandrelli/gocc/example/bools/bools.grammar/bools/internal/errors" + "github.com/maxcalandrelli/gocc/example/bools/bools.grammar/bools/internal/io/stream" "github.com/maxcalandrelli/gocc/example/bools/bools.grammar/bools/internal/token" "io" ) @@ -48,3 +49,15 @@ const ( func GetTokenMap() TokenMap { return token.TokMap } + +func NewWindowReaderFromBytes(src []byte) stream.WindowReader { + return stream.NewWindowReaderFromBytes(src) +} + +func NewWindowReader(rdr io.Reader) stream.WindowReader { + return stream.NewWindowReader(rdr) +} + +func NewLimitedWindowReader(rdr io.Reader, sizeMin, sizeMax int) stream.WindowReader { + return stream.NewLimitedWindowReader(rdr, sizeMin, sizeMax) +} diff --git a/example/bools/bools.grammar/bools/internal/parser/parser.go b/example/bools/bools.grammar/bools/internal/parser/parser.go index 55f04cba..5a7b204a 100644 --- a/example/bools/bools.grammar/bools/internal/parser/parser.go +++ b/example/bools/bools.grammar/bools/internal/parser/parser.go @@ -280,8 +280,9 @@ func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, er // // If no action, check if we have some context dependent parsing to try // + p.checkPoint = p.checkPoint.Advance(len(p.nextToken.IgnoredPrefix)) for _, cdAction := range parserActions.table[p.stack.top()].cdActions { - p.tokens.GotoCheckPoint(p.checkPoint.Advance(len(p.nextToken.IgnoredPrefix))) + p.tokens.GotoCheckPoint(p.checkPoint) cd_res, cd_err, cd_parsed := cdAction.tokenScanner(p.underlyingStream, p.userContext) if cd_err == nil && len(cd_parsed) > 0 { action = parserActions.table[p.stack.top()].actions[cdAction.tokenIndex] diff --git a/example/bools/bools.grammar/bools/internal/parser/productionstable.go b/example/bools/bools.grammar/bools/internal/parser/productionstable.go index c6cbaed6..b8825689 100644 --- a/example/bools/bools.grammar/bools/internal/parser/productionstable.go +++ b/example/bools/bools.grammar/bools/internal/parser/productionstable.go @@ -6,6 +6,40 @@ import ( "github.com/maxcalandrelli/gocc/example/bools/ast" ) +import ( + "fmt" + "github.com/maxcalandrelli/gocc/example/bools/bools.grammar/bools/internal/token" + "github.com/maxcalandrelli/gocc/example/bools/bools.grammar/bools/internal/util" + "strings" +) + +func getString(X Attrib) string { + switch X.(type) { + case *token.Token: + return string(X.(*token.Token).Lit) + case string: + return X.(string) + } + return fmt.Sprintf("%q", X) +} + +func unescape(s string) string { + return util.EscapedString(s).Unescape() +} + +func unquote(s string) string { + r, _, _ := util.EscapedString(s).Unquote() + return r +} + +func lc(s string) string { + return strings.ToLower(s) +} + +func uc(s string) string { + return strings.ToUpper(s) +} + type ( //TODO: change type and variable names to be consistent with other tables ProdTab [numProductions]ProdTabEntry @@ -33,7 +67,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `BoolExpr : Π << X[0], nil >>`, + String: `BoolExpr : Π << $0, nil >>`, Id: "BoolExpr", NTType: 1, Index: 1, @@ -43,7 +77,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `BoolExpr1 : Π << X[0], nil >>`, + String: `BoolExpr1 : Π << $0, nil >>`, Id: "BoolExpr1", NTType: 2, Index: 2, @@ -53,7 +87,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `BoolExpr1 : Π Λ<&> Π << ast.NewBoolAndExpr(X[0], X[2]) >>`, + String: `BoolExpr1 : Π Λ<&> Π << ast.NewBoolAndExpr($0, $2) >>`, Id: "BoolExpr1", NTType: 2, Index: 3, @@ -63,7 +97,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `BoolExpr1 : Π Λ<|> Π << ast.NewBoolOrExpr(X[0], X[2]) >>`, + String: `BoolExpr1 : Π Λ<|> Π << ast.NewBoolOrExpr($0, $2) >>`, Id: "BoolExpr1", NTType: 2, Index: 4, @@ -73,7 +107,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `BoolExpr1 : Λ<(> Π Λ<)> << ast.NewBoolGroupExpr(X[1]) >>`, + String: `BoolExpr1 : Λ<(> Π Λ<)> << ast.NewBoolGroupExpr($1) >>`, Id: "BoolExpr1", NTType: 2, Index: 5, @@ -103,7 +137,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `Val : Π << X[0], nil >>`, + String: `Val : Π << $0, nil >>`, Id: "Val", NTType: 3, Index: 8, @@ -113,7 +147,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `Val : Π << X[0], nil >>`, + String: `Val : Π << $0, nil >>`, Id: "Val", NTType: 3, Index: 9, @@ -123,7 +157,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `CompareExpr : int_lit Λ<<> int_lit << ast.NewLessThanExpr(X[0], X[2]) >>`, + String: `CompareExpr : int_lit Λ<<> int_lit << ast.NewLessThanExpr($0, $2) >>`, Id: "CompareExpr", NTType: 4, Index: 10, @@ -133,7 +167,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `CompareExpr : int_lit Λ<>> int_lit << ast.NewLessThanExpr(X[2], X[0]) >>`, + String: `CompareExpr : int_lit Λ<>> int_lit << ast.NewLessThanExpr($2, $0) >>`, Id: "CompareExpr", NTType: 4, Index: 11, @@ -143,7 +177,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `SubStringExpr : string_lit Λ string_lit << ast.NewSubStringExpr(X[0], X[2]) >>`, + String: `SubStringExpr : string_lit Λ string_lit << ast.NewSubStringExpr($0, $2) >>`, Id: "SubStringExpr", NTType: 5, Index: 12, diff --git a/example/bools/bools.grammar/bools/internal/token/token.go b/example/bools/bools.grammar/bools/internal/token/token.go index 636102f0..97d497d8 100644 --- a/example/bools/bools.grammar/bools/internal/token/token.go +++ b/example/bools/bools.grammar/bools/internal/token/token.go @@ -108,14 +108,14 @@ var TokMap = TokenMap{ }, litMap: map[string]Type{ + "&": 2, + "|": 3, "(": 4, + ")": 5, + "true": 6, "false": 7, "<": 9, ">": 10, - "&": 2, - "|": 3, "in": 12, - ")": 5, - "true": 6, }, } diff --git a/example/bools/bools.grammar/bools/internal/util/rune.go b/example/bools/bools.grammar/bools/internal/util/rune.go index bd8523a4..788edfde 100644 --- a/example/bools/bools.grammar/bools/internal/util/rune.go +++ b/example/bools/bools.grammar/bools/internal/util/rune.go @@ -1,9 +1,12 @@ // Code generated by gocc; DO NOT EDIT. + package util import ( "fmt" + "unicode" + "unicode/utf8" ) func RuneToString(r rune) string { @@ -37,3 +40,101 @@ func RuneToString(r rune) string { } return fmt.Sprintf("\\U%08x", r) } + +type EscapedString string + +func (str EscapedString) Unquote() (unquoted string, wasQuoted bool, quoteType rune) { + if len(str) > 1 { + r := str[0] + if (r == '"' || r == '\x60' || r == '\'') && r == str[len(str)-1] { + str = str[1 : len(str)-1] + } + return string(str), true, rune(r) + } + return string(str), false, 0 +} + +func (str EscapedString) Unescape() string { + var ( + res string + r rune + size int + ) + for s := 0; s < len(str); s += size { + if str[s] == '\\' { + r, size = str[s+1:].EscapedFirstCharValue() + size++ + } else { + r, size = utf8.DecodeRuneInString(string(str)[s:]) + } + res += string(r) + } + return res +} + +func (str EscapedString) EscapedFirstCharValue() (rune, int) { + var i, base, max uint32 + offset := 0 + switch str[offset] { + case '\'', '"': + return rune(str[offset]), 1 + case 'a': + return '\a', 1 + case 'b': + return '\b', 1 + case 'f': + return '\f', 1 + case 'n': + return '\n', 1 + case 'r': + return '\r', 1 + case 't': + return '\t', 1 + case 'v': + return '\v', 1 + case '\\': + return '\\', 1 + case '0', '1', '2', '3', '4', '5', '6', '7': + i, base, max = 3, 8, 255 + case 'x': + i, base, max = 2, 16, 255 + offset++ + case 'u': + i, base, max = 4, 16, unicode.MaxRune + offset++ + case 'U': + i, base, max = 8, 32, unicode.MaxRune + offset++ + default: + panic(fmt.Sprintf("Error decoding character literal: %s\n", str[offset:])) + } + + var x uint32 + for ; i > 0 && offset < len(str); i-- { + ch, size := utf8.DecodeRuneInString(string(str)[offset:]) + offset += size + d := uint32(HexDigitValue(ch)) + if d >= base { + panic(fmt.Sprintf("charVal(%s): illegal character (%c) in escape sequence. size=%d, offset=%d", str, str[offset], size, offset)) + } + x = x*base + d + } + if x > max || 0xD800 <= x && x < 0xE000 { + panic(fmt.Sprintf("Error decoding escape char value. Lit:%s, offset:%d, escape sequence is invalid Unicode code point\n", str, offset)) + } + + return rune(x), offset +} + +func HexDigitValue(ch rune) int { + switch { + case '0' <= ch && ch <= '9': + return int(ch) - '0' + case 'a' <= ch && ch <= 'f': + return int(ch) - 'a' + 10 + case 'A' <= ch && ch <= 'F': + return int(ch) - 'A' + 10 + } + return 16 // larger than any legal digit val +} + diff --git a/example/bools/bools.grammar/bools/main/main.go b/example/bools/bools.grammar/bools/main/bools.go similarity index 100% rename from example/bools/bools.grammar/bools/main/main.go rename to example/bools/bools.grammar/bools/main/bools.go diff --git a/example/bools/bools.grammar/bools/util.go b/example/bools/bools.grammar/bools/util.go new file mode 100644 index 00000000..d27bb434 --- /dev/null +++ b/example/bools/bools.grammar/bools/util.go @@ -0,0 +1,25 @@ +// Code generated by gocc; DO NOT EDIT. + +package bools + +import ( + "github.com/maxcalandrelli/gocc/example/bools/bools.grammar/bools/internal/util" +) + +type EscapedString = util.EscapedString + +func RuneToString(r rune) string { + return util.RuneToString(r) +} + +func HexDigitValue(ch rune) int { + return util.HexDigitValue(ch) +} + +func IntValue(lit []byte) (int64, error) { + return util.IntValue(lit) +} + +func UintValue(lit []byte) (uint64, error) { + return util.UintValue(lit) +} diff --git a/example/calc/calc.bnf b/example/calc/calc.bnf index 3b46e981..549858c0 100644 --- a/example/calc/calc.bnf +++ b/example/calc/calc.bnf @@ -9,10 +9,6 @@ int64 : '1'-'9' {_digit} ; /* Syntax part */ << -import( - "github.com/maxcalandrelli/gocc/example/calc/calc.grammar/calc/internal/token" - "github.com/maxcalandrelli/gocc/example/calc/calc.grammar/calc/internal/util" -) >> Calc : Expr; diff --git a/example/calc/calc.grammar/calc/iface/calc.go b/example/calc/calc.grammar/calc/iface/calc.go index 60021543..02547669 100644 --- a/example/calc/calc.grammar/calc/iface/calc.go +++ b/example/calc/calc.grammar/calc/iface/calc.go @@ -4,6 +4,7 @@ package iface import ( "github.com/maxcalandrelli/gocc/example/calc/calc.grammar/calc/internal/errors" + "github.com/maxcalandrelli/gocc/example/calc/calc.grammar/calc/internal/io/stream" "github.com/maxcalandrelli/gocc/example/calc/calc.grammar/calc/internal/token" "io" ) @@ -48,3 +49,15 @@ const ( func GetTokenMap() TokenMap { return token.TokMap } + +func NewWindowReaderFromBytes(src []byte) stream.WindowReader { + return stream.NewWindowReaderFromBytes(src) +} + +func NewWindowReader(rdr io.Reader) stream.WindowReader { + return stream.NewWindowReader(rdr) +} + +func NewLimitedWindowReader(rdr io.Reader, sizeMin, sizeMax int) stream.WindowReader { + return stream.NewLimitedWindowReader(rdr, sizeMin, sizeMax) +} diff --git a/example/calc/calc.grammar/calc/internal/parser/parser.go b/example/calc/calc.grammar/calc/internal/parser/parser.go index ee512b32..4b8a0a94 100644 --- a/example/calc/calc.grammar/calc/internal/parser/parser.go +++ b/example/calc/calc.grammar/calc/internal/parser/parser.go @@ -280,8 +280,9 @@ func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, er // // If no action, check if we have some context dependent parsing to try // + p.checkPoint = p.checkPoint.Advance(len(p.nextToken.IgnoredPrefix)) for _, cdAction := range parserActions.table[p.stack.top()].cdActions { - p.tokens.GotoCheckPoint(p.checkPoint.Advance(len(p.nextToken.IgnoredPrefix))) + p.tokens.GotoCheckPoint(p.checkPoint) cd_res, cd_err, cd_parsed := cdAction.tokenScanner(p.underlyingStream, p.userContext) if cd_err == nil && len(cd_parsed) > 0 { action = parserActions.table[p.stack.top()].actions[cdAction.tokenIndex] diff --git a/example/calc/calc.grammar/calc/internal/parser/productionstable.go b/example/calc/calc.grammar/calc/internal/parser/productionstable.go index 8ceaac98..c64aca0e 100644 --- a/example/calc/calc.grammar/calc/internal/parser/productionstable.go +++ b/example/calc/calc.grammar/calc/internal/parser/productionstable.go @@ -3,10 +3,39 @@ package parser import ( + "fmt" "github.com/maxcalandrelli/gocc/example/calc/calc.grammar/calc/internal/token" "github.com/maxcalandrelli/gocc/example/calc/calc.grammar/calc/internal/util" + "strings" ) +func getString(X Attrib) string { + switch X.(type) { + case *token.Token: + return string(X.(*token.Token).Lit) + case string: + return X.(string) + } + return fmt.Sprintf("%q", X) +} + +func unescape(s string) string { + return util.EscapedString(s).Unescape() +} + +func unquote(s string) string { + r, _, _ := util.EscapedString(s).Unquote() + return r +} + +func lc(s string) string { + return strings.ToLower(s) +} + +func uc(s string) string { + return strings.ToUpper(s) +} + type ( //TODO: change type and variable names to be consistent with other tables ProdTab [numProductions]ProdTabEntry @@ -44,7 +73,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `Expr : Π Λ<+> Π << X[0].(int64) + X[2].(int64), nil >>`, + String: `Expr : Π Λ<+> Π << $0.(int64) + $2.(int64), nil >>`, Id: "Expr", NTType: 2, Index: 2, @@ -54,7 +83,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `Expr : Π Λ<-> Π << X[0].(int64) - X[2].(int64), nil >>`, + String: `Expr : Π Λ<-> Π << $0.(int64) - $2.(int64), nil >>`, Id: "Expr", NTType: 2, Index: 3, @@ -64,7 +93,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `Expr : Λ<-> Π << -X[1].(int64), nil >>`, + String: `Expr : Λ<-> Π << -$1.(int64), nil >>`, Id: "Expr", NTType: 2, Index: 4, @@ -74,7 +103,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `Expr : Π Λ<*> Π << X[0].(int64) * X[2].(int64), nil >>`, + String: `Expr : Π Λ<*> Π << $0.(int64) * $2.(int64), nil >>`, Id: "Expr", NTType: 2, Index: 5, @@ -84,7 +113,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `Expr : Π Λ Π << X[0].(int64) / X[2].(int64), nil >>`, + String: `Expr : Π Λ Π << $0.(int64) / $2.(int64), nil >>`, Id: "Expr", NTType: 2, Index: 6, @@ -94,7 +123,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `Expr : Π << X[0].(int64), nil >>`, + String: `Expr : Π << $0.(int64), nil >>`, Id: "Expr", NTType: 2, Index: 7, @@ -104,7 +133,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `Term : Π Λ<*> Π << X[0].(int64) * X[2].(int64), nil >>`, + String: `Term : Π Λ<*> Π << $0.(int64) * $2.(int64), nil >>`, Id: "Term", NTType: 3, Index: 8, @@ -124,7 +153,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `Factor : Λ<(> Π Λ<)> << X[1], nil >>`, + String: `Factor : Λ<(> Π Λ<)> << $1, nil >>`, Id: "Factor", NTType: 4, Index: 10, @@ -134,7 +163,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `Factor : int64 << util.IntValue(X[0].(*token.Token).Lit) >>`, + String: `Factor : int64 << util.IntValue($0.(*token.Token).Lit) >>`, Id: "Factor", NTType: 4, Index: 11, diff --git a/example/calc/calc.grammar/calc/internal/util/rune.go b/example/calc/calc.grammar/calc/internal/util/rune.go index bd8523a4..788edfde 100644 --- a/example/calc/calc.grammar/calc/internal/util/rune.go +++ b/example/calc/calc.grammar/calc/internal/util/rune.go @@ -1,9 +1,12 @@ // Code generated by gocc; DO NOT EDIT. + package util import ( "fmt" + "unicode" + "unicode/utf8" ) func RuneToString(r rune) string { @@ -37,3 +40,101 @@ func RuneToString(r rune) string { } return fmt.Sprintf("\\U%08x", r) } + +type EscapedString string + +func (str EscapedString) Unquote() (unquoted string, wasQuoted bool, quoteType rune) { + if len(str) > 1 { + r := str[0] + if (r == '"' || r == '\x60' || r == '\'') && r == str[len(str)-1] { + str = str[1 : len(str)-1] + } + return string(str), true, rune(r) + } + return string(str), false, 0 +} + +func (str EscapedString) Unescape() string { + var ( + res string + r rune + size int + ) + for s := 0; s < len(str); s += size { + if str[s] == '\\' { + r, size = str[s+1:].EscapedFirstCharValue() + size++ + } else { + r, size = utf8.DecodeRuneInString(string(str)[s:]) + } + res += string(r) + } + return res +} + +func (str EscapedString) EscapedFirstCharValue() (rune, int) { + var i, base, max uint32 + offset := 0 + switch str[offset] { + case '\'', '"': + return rune(str[offset]), 1 + case 'a': + return '\a', 1 + case 'b': + return '\b', 1 + case 'f': + return '\f', 1 + case 'n': + return '\n', 1 + case 'r': + return '\r', 1 + case 't': + return '\t', 1 + case 'v': + return '\v', 1 + case '\\': + return '\\', 1 + case '0', '1', '2', '3', '4', '5', '6', '7': + i, base, max = 3, 8, 255 + case 'x': + i, base, max = 2, 16, 255 + offset++ + case 'u': + i, base, max = 4, 16, unicode.MaxRune + offset++ + case 'U': + i, base, max = 8, 32, unicode.MaxRune + offset++ + default: + panic(fmt.Sprintf("Error decoding character literal: %s\n", str[offset:])) + } + + var x uint32 + for ; i > 0 && offset < len(str); i-- { + ch, size := utf8.DecodeRuneInString(string(str)[offset:]) + offset += size + d := uint32(HexDigitValue(ch)) + if d >= base { + panic(fmt.Sprintf("charVal(%s): illegal character (%c) in escape sequence. size=%d, offset=%d", str, str[offset], size, offset)) + } + x = x*base + d + } + if x > max || 0xD800 <= x && x < 0xE000 { + panic(fmt.Sprintf("Error decoding escape char value. Lit:%s, offset:%d, escape sequence is invalid Unicode code point\n", str, offset)) + } + + return rune(x), offset +} + +func HexDigitValue(ch rune) int { + switch { + case '0' <= ch && ch <= '9': + return int(ch) - '0' + case 'a' <= ch && ch <= 'f': + return int(ch) - 'a' + 10 + case 'A' <= ch && ch <= 'F': + return int(ch) - 'A' + 10 + } + return 16 // larger than any legal digit val +} + diff --git a/example/calc/calc.grammar/calc/main/main.go b/example/calc/calc.grammar/calc/main/calc.go similarity index 100% rename from example/calc/calc.grammar/calc/main/main.go rename to example/calc/calc.grammar/calc/main/calc.go diff --git a/example/calc/calc.grammar/calc/util.go b/example/calc/calc.grammar/calc/util.go new file mode 100644 index 00000000..0f0ee972 --- /dev/null +++ b/example/calc/calc.grammar/calc/util.go @@ -0,0 +1,25 @@ +// Code generated by gocc; DO NOT EDIT. + +package calc + +import ( + "github.com/maxcalandrelli/gocc/example/calc/calc.grammar/calc/internal/util" +) + +type EscapedString = util.EscapedString + +func RuneToString(r rune) string { + return util.RuneToString(r) +} + +func HexDigitValue(ch rune) int { + return util.HexDigitValue(ch) +} + +func IntValue(lit []byte) (int64, error) { + return util.IntValue(lit) +} + +func UintValue(lit []byte) (uint64, error) { + return util.UintValue(lit) +} diff --git a/example/ctx/Makefile b/example/ctx/Makefile index 5f52dd73..03ef6b15 100644 --- a/example/ctx/Makefile +++ b/example/ctx/Makefile @@ -1,3 +1,4 @@ regenerate: - gocc -a -v ctx.bnf >ctx0.log 2>&1 - gocc -a -v ctx1.bnf >ctx1.log 2>&1 + gocc -a -v -o ctx0.grammar/ctx0 ctx.bnf >ctx0.log 2>&1 + gocc -a -v -o ctx1.grammar/ctx1 ctx1.bnf >ctx1.log 2>&1 + gocc -a -v -o ctx2.grammar/ctx2 -bugs=lexer_regdefs:ignore ctx.bnf >ctx2.log 2>&1 diff --git a/example/ctx/ctx.bnf b/example/ctx/ctx.bnf index 558ee6da..69c6073b 100644 --- a/example/ctx/ctx.bnf +++ b/example/ctx/ctx.bnf @@ -40,6 +40,6 @@ Stmt : id << ast.NewStmt($0e) >> | @ "github.com/maxcalandrelli/gocc/example/calc/calc.grammar/calc" - << ast.CalcResult($2) >> + << ast.CalcResult($1) >> ; diff --git a/example/ctx/ctx.grammar/ctx/ctx.go b/example/ctx/ctx0.grammar/ctx0/ctx.go similarity index 90% rename from example/ctx/ctx.grammar/ctx/ctx.go rename to example/ctx/ctx0.grammar/ctx0/ctx.go index f42ab260..84d88a0f 100644 --- a/example/ctx/ctx.grammar/ctx/ctx.go +++ b/example/ctx/ctx0.grammar/ctx0/ctx.go @@ -5,10 +5,10 @@ package ctx import ( "io" - "github.com/maxcalandrelli/gocc/example/ctx/ctx.grammar/ctx/internal/errors" - "github.com/maxcalandrelli/gocc/example/ctx/ctx.grammar/ctx/internal/lexer" - "github.com/maxcalandrelli/gocc/example/ctx/ctx.grammar/ctx/internal/parser" - "github.com/maxcalandrelli/gocc/example/ctx/ctx.grammar/ctx/internal/token" + "github.com/maxcalandrelli/gocc/example/ctx/ctx0.grammar/ctx0/internal/errors" + "github.com/maxcalandrelli/gocc/example/ctx/ctx0.grammar/ctx0/internal/lexer" + "github.com/maxcalandrelli/gocc/example/ctx/ctx0.grammar/ctx0/internal/parser" + "github.com/maxcalandrelli/gocc/example/ctx/ctx0.grammar/ctx0/internal/token" ) const ( diff --git a/example/ctx/ctx.grammar/ctx/iface/ctx.go b/example/ctx/ctx0.grammar/ctx0/iface/ctx.go similarity index 81% rename from example/ctx/ctx.grammar/ctx/iface/ctx.go rename to example/ctx/ctx0.grammar/ctx0/iface/ctx.go index 989e80a1..4f5c6d67 100644 --- a/example/ctx/ctx.grammar/ctx/iface/ctx.go +++ b/example/ctx/ctx0.grammar/ctx0/iface/ctx.go @@ -3,9 +3,9 @@ package iface import ( - "github.com/maxcalandrelli/gocc/example/ctx/ctx.grammar/ctx/internal/errors" - "github.com/maxcalandrelli/gocc/example/ctx/ctx.grammar/ctx/internal/io/stream" - "github.com/maxcalandrelli/gocc/example/ctx/ctx.grammar/ctx/internal/token" + "github.com/maxcalandrelli/gocc/example/ctx/ctx0.grammar/ctx0/internal/errors" + "github.com/maxcalandrelli/gocc/example/ctx/ctx0.grammar/ctx0/internal/io/stream" + "github.com/maxcalandrelli/gocc/example/ctx/ctx0.grammar/ctx0/internal/token" "io" ) diff --git a/example/ctx/ctx.grammar/ctx/internal/errors/errors.go b/example/ctx/ctx0.grammar/ctx0/internal/errors/errors.go similarity index 94% rename from example/ctx/ctx.grammar/ctx/internal/errors/errors.go rename to example/ctx/ctx0.grammar/ctx0/internal/errors/errors.go index ed3d3028..e3b59c2e 100644 --- a/example/ctx/ctx.grammar/ctx/internal/errors/errors.go +++ b/example/ctx/ctx0.grammar/ctx0/internal/errors/errors.go @@ -6,7 +6,7 @@ import ( "fmt" "strings" - "github.com/maxcalandrelli/gocc/example/ctx/ctx.grammar/ctx/internal/token" + "github.com/maxcalandrelli/gocc/example/ctx/ctx0.grammar/ctx0/internal/token" ) type ErrorSymbol interface { diff --git a/example/ctx/ctx.grammar/ctx/internal/io/stream/internal/stream_impl.go b/example/ctx/ctx0.grammar/ctx0/internal/io/stream/internal/stream_impl.go similarity index 100% rename from example/ctx/ctx.grammar/ctx/internal/io/stream/internal/stream_impl.go rename to example/ctx/ctx0.grammar/ctx0/internal/io/stream/internal/stream_impl.go diff --git a/example/ctx/ctx.grammar/ctx/internal/io/stream/internal/stream_public.go b/example/ctx/ctx0.grammar/ctx0/internal/io/stream/internal/stream_public.go similarity index 100% rename from example/ctx/ctx.grammar/ctx/internal/io/stream/internal/stream_public.go rename to example/ctx/ctx0.grammar/ctx0/internal/io/stream/internal/stream_public.go diff --git a/example/ctx/ctx.grammar/ctx/internal/io/stream/stream.go b/example/ctx/ctx0.grammar/ctx0/internal/io/stream/stream.go similarity index 88% rename from example/ctx/ctx.grammar/ctx/internal/io/stream/stream.go rename to example/ctx/ctx0.grammar/ctx0/internal/io/stream/stream.go index dde77a90..d3d5cbfb 100644 --- a/example/ctx/ctx.grammar/ctx/internal/io/stream/stream.go +++ b/example/ctx/ctx0.grammar/ctx0/internal/io/stream/stream.go @@ -1,7 +1,7 @@ package stream import ( - internal "github.com/maxcalandrelli/gocc/example/ctx/ctx.grammar/ctx/internal/io/stream/internal" + internal "github.com/maxcalandrelli/gocc/example/ctx/ctx0.grammar/ctx0/internal/io/stream/internal" "io" ) diff --git a/example/ctx/ctx0.grammar/ctx0/internal/lexer/acttab.go b/example/ctx/ctx0.grammar/ctx0/internal/lexer/acttab.go new file mode 100644 index 00000000..2199bccf --- /dev/null +++ b/example/ctx/ctx0.grammar/ctx0/internal/lexer/acttab.go @@ -0,0 +1,71 @@ +// Code generated by gocc; DO NOT EDIT. + +package lexer + +import ( + "fmt" + + "github.com/maxcalandrelli/gocc/example/ctx/ctx0.grammar/ctx0/internal/token" +) + +type ActionTable [NumStates]ActionRow + +type ActionRow struct { + Accept token.Type + Ignore string +} + +func (a ActionRow) String() string { + return fmt.Sprintf("Accept=%d, Ignore=%s", a.Accept, a.Ignore) +} + +var ActTab = ActionTable{ + ActionRow{ // S0, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S1, Ignore("!whitespace") + Accept: -1, + Ignore: "!whitespace", + }, + ActionRow{ // S2, Accept("id") + Accept: 2, + Ignore: "", + }, + ActionRow{ // S3, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S4, Accept("id") + Accept: 2, + Ignore: "", + }, + ActionRow{ // S5, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S6, Accept("id") + Accept: 2, + Ignore: "", + }, + ActionRow{ // S7, Accept("id") + Accept: 2, + Ignore: "", + }, + ActionRow{ // S8, Accept("id") + Accept: 2, + Ignore: "", + }, + ActionRow{ // S9, Accept("id") + Accept: 2, + Ignore: "", + }, + ActionRow{ // S10, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S11, Accept("id") + Accept: 2, + Ignore: "", + }, +} diff --git a/example/ctx/ctx0.grammar/ctx0/internal/lexer/lexer.go b/example/ctx/ctx0.grammar/ctx0/internal/lexer/lexer.go new file mode 100644 index 00000000..73eafd3c --- /dev/null +++ b/example/ctx/ctx0.grammar/ctx0/internal/lexer/lexer.go @@ -0,0 +1,174 @@ +// Code generated by gocc; DO NOT EDIT. + +package lexer + +import ( + + "io" + "bytes" + "os" + + + "github.com/maxcalandrelli/gocc/example/ctx/ctx0.grammar/ctx0/iface" + "github.com/maxcalandrelli/gocc/example/ctx/ctx0.grammar/ctx0/internal/token" + "github.com/maxcalandrelli/gocc/example/ctx/ctx0.grammar/ctx0/internal/io/stream" +) + +const ( + NoState = -1 + NumStates = 12 + NumSymbols = 19 + INVALID_RUNE = rune(-1) +) + +type position struct { + token.Pos +} + +type Lexer struct { + position + stream iface.TokenStream + eof bool +} + +func NewLexerBytes(src []byte) *Lexer { + lexer := &Lexer{stream: bytes.NewReader(src)} + lexer.reset() + return lexer +} + +func NewLexerString(src string) *Lexer { + return NewLexerBytes([]byte(src)) +} + +func NewLexerFile(fpath string) (*Lexer, error) { + s, err := os.Open(fpath) + if err != nil { + return nil, err + } + lexer := &Lexer{stream: stream.NewWindowReader(s)} + lexer.reset() + return lexer, nil +} + +func NewLexer(reader io.Reader) (*Lexer, error) { + lexer := &Lexer{} + lexer.reset() + if lexer.stream, _ = reader.(iface.TokenStream); lexer.stream == nil { + lexer.stream = stream.NewWindowReader(reader) + } + return lexer, nil +} + +func (l *Lexer) reset () { + l.position.Reset() +} + +func (l Lexer) GetStream() iface.TokenStream { + return l.stream +} + +type checkPoint int64 + +func (c checkPoint) value () int64 { + return int64(c) +} + +func (c checkPoint) DistanceFrom (o iface.CheckPoint) int { + return int (c.value() - o.(checkPoint).value()) +} + +func (c checkPoint) Advance (o int) iface.CheckPoint { + return checkPoint(c.value() + int64(o)) +} + +func (l *Lexer) GetCheckPoint() iface.CheckPoint { + if l == nil { + return checkPoint(0) + } + pos, _ := l.stream.Seek(0, io.SeekCurrent) + return checkPoint(pos) +} + +func (l Lexer) GotoCheckPoint(cp iface.CheckPoint) { + l.stream.Seek(int64(cp.(checkPoint)), io.SeekStart) +} + +func (l *Lexer) Scan() (tok *token.Token) { + tok = new(token.Token) + tok.Type = token.INVALID + start := l.position + state := 0 + for state != -1 { + savePos := l.position.Pos + curr, size, err := l.stream.ReadRune() + if size < 1 || err != nil { + curr = INVALID_RUNE + } + if size > 0 { + l.position.Pos.Offset += size + } + nextState := -1 + if curr != INVALID_RUNE { + nextState = TransTab[state](curr) + } + state = nextState + if state != -1 { + switch curr { + case '\n': + l.position.Pos.Line++ + l.position.Pos.Column = 1 + case '\r': + l.position.Pos.Column = 1 + case '\t': + l.position.Pos.Column += 4 + default: + l.position.Pos.Column++ + } + switch { + case ActTab[state].Accept != -1: + tok.Type = ActTab[state].Accept + tok.Lit = append(tok.Lit, string(curr)...) + case ActTab[state].Ignore != "": + start = l.position + state = 0 + tok.Lit = []byte{} + tok.IgnoredPrefix=append(tok.IgnoredPrefix,string(curr)...) + } + } else if curr != INVALID_RUNE{ + if len(tok.Lit) == 0 { + tok.Lit = append(tok.Lit, string(curr)...) + } else { + l.stream.UnreadRune() + l.position.Pos = savePos + } + } + if err == io.EOF && len(tok.Lit)==0 { + tok.Type = token.EOF + tok.Pos = start.Pos + return + } + } + tok.Pos = start.Pos + return +} + +func (l *Lexer) Reset() { + l.position.Reset() +} + +func (l Lexer) CurrentPosition() position { + return l.position +} + +func (p *position) Reset() { + p.Offset = 0 + p.Line = 1 + p.Column = 1 +} + +func (p position) StartingFrom(base position) position { + r := p + r.Pos = p.Pos.StartingFrom(base.Pos) + return r +} diff --git a/example/ctx/ctx0.grammar/ctx0/internal/lexer/transitiontable.go b/example/ctx/ctx0.grammar/ctx0/internal/lexer/transitiontable.go new file mode 100644 index 00000000..5a483049 --- /dev/null +++ b/example/ctx/ctx0.grammar/ctx0/internal/lexer/transitiontable.go @@ -0,0 +1,151 @@ +// Code generated by gocc; DO NOT EDIT. + +package lexer + +/* +Let s be the current state +Let r be the current input rune +transitionTable[s](r) returns the next state. +*/ +type TransitionTable [NumStates]func(rune) int + +var TransTab = TransitionTable{ + // S0 + func(r rune) int { + switch { + case r == 9: // ['\t','\t'] + return 1 + case r == 10: // ['\n','\n'] + return 1 + case r == 13: // ['\r','\r'] + return 1 + case r == 32: // [' ',' '] + return 1 + case r == 945: // [\u03b1,\u03b1] + return 2 + case r == 946: // [\u03b2,\u03b2] + return 3 + } + return NoState + }, + // S1 + func(r rune) int { + switch { + } + return NoState + }, + // S2 + func(r rune) int { + switch { + case r == 945: // [\u03b1,\u03b1] + return 4 + case r == 946: // [\u03b2,\u03b2] + return 5 + case r == 947: // [\u03b3,\u03b3] + return 6 + } + return NoState + }, + // S3 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 7 + } + return NoState + }, + // S4 + func(r rune) int { + switch { + case r == 945: // [\u03b1,\u03b1] + return 4 + case r == 946: // [\u03b2,\u03b2] + return 5 + case r == 947: // [\u03b3,\u03b3] + return 6 + } + return NoState + }, + // S5 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 8 + } + return NoState + }, + // S6 + func(r rune) int { + switch { + case r == 945: // [\u03b1,\u03b1] + return 4 + case r == 946: // [\u03b2,\u03b2] + return 5 + case r == 947: // [\u03b3,\u03b3] + return 6 + } + return NoState + }, + // S7 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 7 + case r == 945: // [\u03b1,\u03b1] + return 9 + case r == 946: // [\u03b2,\u03b2] + return 10 + case r == 947: // [\u03b3,\u03b3] + return 6 + } + return NoState + }, + // S8 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 8 + case r == 945: // [\u03b1,\u03b1] + return 4 + case r == 946: // [\u03b2,\u03b2] + return 5 + case r == 947: // [\u03b3,\u03b3] + return 6 + } + return NoState + }, + // S9 + func(r rune) int { + switch { + case r == 945: // [\u03b1,\u03b1] + return 4 + case r == 946: // [\u03b2,\u03b2] + return 5 + case r == 947: // [\u03b3,\u03b3] + return 6 + } + return NoState + }, + // S10 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 11 + } + return NoState + }, + // S11 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 11 + case r == 945: // [\u03b1,\u03b1] + return 9 + case r == 946: // [\u03b2,\u03b2] + return 10 + case r == 947: // [\u03b3,\u03b3] + return 6 + } + return NoState + }, +} diff --git a/example/ctx/ctx.grammar/ctx/internal/parser/action.go b/example/ctx/ctx0.grammar/ctx0/internal/parser/action.go similarity index 100% rename from example/ctx/ctx.grammar/ctx/internal/parser/action.go rename to example/ctx/ctx0.grammar/ctx0/internal/parser/action.go diff --git a/example/ctx/ctx.grammar/ctx/internal/parser/actiontable.go b/example/ctx/ctx0.grammar/ctx0/internal/parser/actiontable.go similarity index 84% rename from example/ctx/ctx.grammar/ctx/internal/parser/actiontable.go rename to example/ctx/ctx0.grammar/ctx0/internal/parser/actiontable.go index c3f71e31..10941d48 100644 --- a/example/ctx/ctx.grammar/ctx/internal/parser/actiontable.go +++ b/example/ctx/ctx0.grammar/ctx0/internal/parser/actiontable.go @@ -53,7 +53,9 @@ var parserActions = actions{ reduce(1), // id, reduce: StmtList reduce(1), // μ, reduce: StmtList }, - cdActions: []cdAction{}, + cdActions: []cdAction{ + cdAction{tokenIndex: 3, tokenScanner: cdFunc_calc_0}, + }, }, actionRow{ // S3 canRecover: false, @@ -63,7 +65,9 @@ var parserActions = actions{ reduce(3), // id, reduce: Stmt reduce(3), // μ, reduce: Stmt }, - cdActions: []cdAction{}, + cdActions: []cdAction{ + cdAction{tokenIndex: 3, tokenScanner: cdFunc_calc_0}, + }, }, actionRow{ // S4 canRecover: false, @@ -73,7 +77,9 @@ var parserActions = actions{ reduce(4), // id, reduce: Stmt reduce(4), // μ, reduce: Stmt }, - cdActions: []cdAction{}, + cdActions: []cdAction{ + cdAction{tokenIndex: 3, tokenScanner: cdFunc_calc_0}, + }, }, actionRow{ // S5 canRecover: false, @@ -83,7 +89,9 @@ var parserActions = actions{ reduce(2), // id, reduce: StmtList reduce(2), // μ, reduce: StmtList }, - cdActions: []cdAction{}, + cdActions: []cdAction{ + cdAction{tokenIndex: 3, tokenScanner: cdFunc_calc_0}, + }, }, }, } diff --git a/example/ctx/ctx.grammar/ctx/internal/parser/gototable.go b/example/ctx/ctx0.grammar/ctx0/internal/parser/gototable.go similarity index 100% rename from example/ctx/ctx.grammar/ctx/internal/parser/gototable.go rename to example/ctx/ctx0.grammar/ctx0/internal/parser/gototable.go diff --git a/example/ctx/ctx.grammar/ctx/internal/parser/parser.go b/example/ctx/ctx0.grammar/ctx0/internal/parser/parser.go similarity index 97% rename from example/ctx/ctx.grammar/ctx/internal/parser/parser.go rename to example/ctx/ctx0.grammar/ctx0/internal/parser/parser.go index 0cc07fd2..a99acc91 100644 --- a/example/ctx/ctx.grammar/ctx/internal/parser/parser.go +++ b/example/ctx/ctx0.grammar/ctx0/internal/parser/parser.go @@ -7,9 +7,9 @@ import ( "fmt" "strings" - "github.com/maxcalandrelli/gocc/example/ctx/ctx.grammar/ctx/iface" - parseError "github.com/maxcalandrelli/gocc/example/ctx/ctx.grammar/ctx/internal/errors" - "github.com/maxcalandrelli/gocc/example/ctx/ctx.grammar/ctx/internal/token" + "github.com/maxcalandrelli/gocc/example/ctx/ctx0.grammar/ctx0/iface" + parseError "github.com/maxcalandrelli/gocc/example/ctx/ctx0.grammar/ctx0/internal/errors" + "github.com/maxcalandrelli/gocc/example/ctx/ctx0.grammar/ctx0/internal/token" calc "github.com/maxcalandrelli/gocc/example/calc/calc.grammar/calc" ) diff --git a/example/ctx/ctx.grammar/ctx/internal/parser/productionstable.go b/example/ctx/ctx0.grammar/ctx0/internal/parser/productionstable.go similarity index 90% rename from example/ctx/ctx.grammar/ctx/internal/parser/productionstable.go rename to example/ctx/ctx0.grammar/ctx0/internal/parser/productionstable.go index 7c637d26..62031511 100644 --- a/example/ctx/ctx.grammar/ctx/internal/parser/productionstable.go +++ b/example/ctx/ctx0.grammar/ctx0/internal/parser/productionstable.go @@ -8,8 +8,8 @@ import ( import ( "fmt" - "github.com/maxcalandrelli/gocc/example/ctx/ctx.grammar/ctx/internal/token" - "github.com/maxcalandrelli/gocc/example/ctx/ctx.grammar/ctx/internal/util" + "github.com/maxcalandrelli/gocc/example/ctx/ctx0.grammar/ctx0/internal/token" + "github.com/maxcalandrelli/gocc/example/ctx/ctx0.grammar/ctx0/internal/util" "strings" ) @@ -97,13 +97,13 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `Stmt : μ << ast.CalcResult($2) >>`, + String: `Stmt : μ << ast.CalcResult($1) >>`, Id: "Stmt", NTType: 2, Index: 4, NumSymbols: 2, ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { - return ast.CalcResult(X[2]) + return ast.CalcResult(X[1]) }, }, } diff --git a/example/ctx/ctx.grammar/ctx/internal/token/token.go b/example/ctx/ctx0.grammar/ctx0/internal/token/token.go similarity index 100% rename from example/ctx/ctx.grammar/ctx/internal/token/token.go rename to example/ctx/ctx0.grammar/ctx0/internal/token/token.go diff --git a/example/ctx/ctx.grammar/ctx/internal/util/litconv.go b/example/ctx/ctx0.grammar/ctx0/internal/util/litconv.go similarity index 100% rename from example/ctx/ctx.grammar/ctx/internal/util/litconv.go rename to example/ctx/ctx0.grammar/ctx0/internal/util/litconv.go diff --git a/example/ctx/ctx.grammar/ctx/internal/util/rune.go b/example/ctx/ctx0.grammar/ctx0/internal/util/rune.go similarity index 100% rename from example/ctx/ctx.grammar/ctx/internal/util/rune.go rename to example/ctx/ctx0.grammar/ctx0/internal/util/rune.go diff --git a/example/ctx/ctx.grammar/ctx/log/LR1_sets.txt b/example/ctx/ctx0.grammar/ctx0/log/LR1_sets.txt similarity index 100% rename from example/ctx/ctx.grammar/ctx/log/LR1_sets.txt rename to example/ctx/ctx0.grammar/ctx0/log/LR1_sets.txt diff --git a/example/ctx/ctx.grammar/ctx/log/first.txt b/example/ctx/ctx0.grammar/ctx0/log/first.txt similarity index 100% rename from example/ctx/ctx.grammar/ctx/log/first.txt rename to example/ctx/ctx0.grammar/ctx0/log/first.txt diff --git a/example/ctx/ctx0.grammar/ctx0/log/lexer_sets.txt b/example/ctx/ctx0.grammar/ctx0/log/lexer_sets.txt new file mode 100644 index 00000000..8043a58f --- /dev/null +++ b/example/ctx/ctx0.grammar/ctx0/log/lexer_sets.txt @@ -0,0 +1,191 @@ +Item sets: +S0{ + !whitespace : ' ' | '\t' | '\n' | • '\r' + !whitespace : ' ' | '\t' | • '\n' | '\r' + !whitespace : ' ' | • '\t' | '\n' | '\r' + !whitespace : • ' ' | '\t' | '\n' | '\r' + _x : \u03b1 | (• \u03b2 _digit {_digit}) + _x : • \u03b1 | (\u03b2 _digit {_digit}) + id : • _x {_x0 | _x1 | \u03b3} +} +Transitions: + ['\t','\t'] -> S1 + ['\n','\n'] -> S1 + ['\r','\r'] -> S1 + [' ',' '] -> S1 + [\u03b1,\u03b1] -> S2 + [\u03b2,\u03b2] -> S3 +Action: nil +Symbols classes: {['\t','\t'], ['\n','\n'], ['\r','\r'], [' ',' '], [\u03b1,\u03b1], [\u03b2,\u03b2]} + +S1{ + !whitespace : (' ' | '\t' | '\n' | '\r') • +} +Transitions: +Action: Ignore("!whitespace") +Symbols classes: {} + +S2{ + _x : (\u03b1 | (\u03b2 _digit {_digit})) • + _x0 : • \u03b1 + _x1 : • \u03b2 _digit {_digit} + id : _x {_x0 | _x1 | \u03b3} • + id : _x {_x0 | _x1 | • \u03b3} + id : _x {_x0 | • _x1 | \u03b3} + id : _x {• _x0 | _x1 | \u03b3} +} +Transitions: + [\u03b1,\u03b1] -> S4 + [\u03b2,\u03b2] -> S5 + [\u03b3,\u03b3] -> S6 +Action: Accept("id") +Symbols classes: {[\u03b1,\u03b1], [\u03b2,\u03b2], [\u03b3,\u03b3]} + +S3{ + _digit : • '0'-'9' + _x : \u03b1 | (\u03b2 • _digit {_digit}) + id : • _x {_x0 | _x1 | \u03b3} +} +Transitions: + ['0','9'] -> S7 +Action: nil +Symbols classes: {['0','9']} + +S4{ + _x0 : \u03b1 • + _x0 : • \u03b1 + _x1 : • \u03b2 _digit {_digit} + id : _x {_x0 | _x1 | \u03b3} • + id : _x {_x0 | _x1 | • \u03b3} + id : _x {_x0 | • _x1 | \u03b3} + id : _x {• _x0 | _x1 | \u03b3} +} +Transitions: + [\u03b1,\u03b1] -> S4 + [\u03b2,\u03b2] -> S5 + [\u03b3,\u03b3] -> S6 +Action: Accept("id") +Symbols classes: {[\u03b1,\u03b1], [\u03b2,\u03b2], [\u03b3,\u03b3]} + +S5{ + _digit : • '0'-'9' + _x1 : \u03b2 • _digit {_digit} + id : _x {_x0 | • _x1 | \u03b3} +} +Transitions: + ['0','9'] -> S8 +Action: nil +Symbols classes: {['0','9']} + +S6{ + _x0 : • \u03b1 + _x1 : • \u03b2 _digit {_digit} + id : _x {_x0 | _x1 | \u03b3} • + id : _x {_x0 | _x1 | • \u03b3} + id : _x {_x0 | • _x1 | \u03b3} + id : _x {• _x0 | _x1 | \u03b3} +} +Transitions: + [\u03b1,\u03b1] -> S4 + [\u03b2,\u03b2] -> S5 + [\u03b3,\u03b3] -> S6 +Action: Accept("id") +Symbols classes: {[\u03b1,\u03b1], [\u03b2,\u03b2], [\u03b3,\u03b3]} + +S7{ + _digit : '0'-'9' • + _digit : • '0'-'9' + _x : (\u03b1 | (\u03b2 _digit {_digit})) • + _x : \u03b1 | (\u03b2 _digit {• _digit}) + _x : \u03b1 | (• \u03b2 _digit {_digit}) + _x : • \u03b1 | (\u03b2 _digit {_digit}) + _x0 : • \u03b1 + _x1 : • \u03b2 _digit {_digit} + id : _x {_x0 | _x1 | \u03b3} • + id : _x {_x0 | _x1 | • \u03b3} + id : _x {_x0 | • _x1 | \u03b3} + id : _x {• _x0 | _x1 | \u03b3} + id : • _x {_x0 | _x1 | \u03b3} +} +Transitions: + ['0','9'] -> S7 + [\u03b1,\u03b1] -> S9 + [\u03b2,\u03b2] -> S10 + [\u03b3,\u03b3] -> S6 +Action: Accept("id") +Symbols classes: {['0','9'], [\u03b1,\u03b1], [\u03b2,\u03b2], [\u03b3,\u03b3]} + +S8{ + _digit : '0'-'9' • + _digit : • '0'-'9' + _x0 : • \u03b1 + _x1 : \u03b2 _digit {_digit} • + _x1 : \u03b2 _digit {• _digit} + _x1 : • \u03b2 _digit {_digit} + id : _x {_x0 | _x1 | \u03b3} • + id : _x {_x0 | _x1 | • \u03b3} + id : _x {_x0 | • _x1 | \u03b3} + id : _x {• _x0 | _x1 | \u03b3} +} +Transitions: + ['0','9'] -> S8 + [\u03b1,\u03b1] -> S4 + [\u03b2,\u03b2] -> S5 + [\u03b3,\u03b3] -> S6 +Action: Accept("id") +Symbols classes: {['0','9'], [\u03b1,\u03b1], [\u03b2,\u03b2], [\u03b3,\u03b3]} + +S9{ + _x : (\u03b1 | (\u03b2 _digit {_digit})) • + _x0 : \u03b1 • + _x0 : • \u03b1 + _x1 : • \u03b2 _digit {_digit} + id : _x {_x0 | _x1 | \u03b3} • + id : _x {_x0 | _x1 | • \u03b3} + id : _x {_x0 | • _x1 | \u03b3} + id : _x {• _x0 | _x1 | \u03b3} +} +Transitions: + [\u03b1,\u03b1] -> S4 + [\u03b2,\u03b2] -> S5 + [\u03b3,\u03b3] -> S6 +Action: Accept("id") +Symbols classes: {[\u03b1,\u03b1], [\u03b2,\u03b2], [\u03b3,\u03b3]} + +S10{ + _digit : • '0'-'9' + _x : \u03b1 | (\u03b2 • _digit {_digit}) + _x1 : \u03b2 • _digit {_digit} + id : _x {_x0 | • _x1 | \u03b3} + id : • _x {_x0 | _x1 | \u03b3} +} +Transitions: + ['0','9'] -> S11 +Action: nil +Symbols classes: {['0','9']} + +S11{ + _digit : '0'-'9' • + _digit : • '0'-'9' + _x : (\u03b1 | (\u03b2 _digit {_digit})) • + _x : \u03b1 | (\u03b2 _digit {• _digit}) + _x : \u03b1 | (• \u03b2 _digit {_digit}) + _x : • \u03b1 | (\u03b2 _digit {_digit}) + _x0 : • \u03b1 + _x1 : \u03b2 _digit {_digit} • + _x1 : \u03b2 _digit {• _digit} + _x1 : • \u03b2 _digit {_digit} + id : _x {_x0 | _x1 | \u03b3} • + id : _x {_x0 | _x1 | • \u03b3} + id : _x {_x0 | • _x1 | \u03b3} + id : _x {• _x0 | _x1 | \u03b3} + id : • _x {_x0 | _x1 | \u03b3} +} +Transitions: + ['0','9'] -> S11 + [\u03b1,\u03b1] -> S9 + [\u03b2,\u03b2] -> S10 + [\u03b3,\u03b3] -> S6 +Action: Accept("id") +Symbols classes: {['0','9'], [\u03b1,\u03b1], [\u03b2,\u03b2], [\u03b3,\u03b3]} + diff --git a/example/ctx/ctx.grammar/ctx/log/terminals.txt b/example/ctx/ctx0.grammar/ctx0/log/terminals.txt similarity index 100% rename from example/ctx/ctx.grammar/ctx/log/terminals.txt rename to example/ctx/ctx0.grammar/ctx0/log/terminals.txt diff --git a/example/ctx/ctx.grammar/ctx/main/ctx.go b/example/ctx/ctx0.grammar/ctx0/main/ctx.go similarity index 94% rename from example/ctx/ctx.grammar/ctx/main/ctx.go rename to example/ctx/ctx0.grammar/ctx0/main/ctx.go index 2bd247b6..2eef3ba5 100644 --- a/example/ctx/ctx.grammar/ctx/main/ctx.go +++ b/example/ctx/ctx0.grammar/ctx0/main/ctx.go @@ -6,7 +6,7 @@ import ( "os" "strings" - ctx "github.com/maxcalandrelli/gocc/example/ctx/ctx.grammar/ctx" + ctx "github.com/maxcalandrelli/gocc/example/ctx/ctx0.grammar/ctx0" ) func showResult(r interface{}, e error, p []byte) { diff --git a/example/ctx/ctx.grammar/ctx/util.go b/example/ctx/ctx0.grammar/ctx0/util.go similarity index 83% rename from example/ctx/ctx.grammar/ctx/util.go rename to example/ctx/ctx0.grammar/ctx0/util.go index 037604ba..4acdc237 100644 --- a/example/ctx/ctx.grammar/ctx/util.go +++ b/example/ctx/ctx0.grammar/ctx0/util.go @@ -3,7 +3,7 @@ package ctx import ( - "github.com/maxcalandrelli/gocc/example/ctx/ctx.grammar/ctx/internal/util" + "github.com/maxcalandrelli/gocc/example/ctx/ctx0.grammar/ctx0/internal/util" ) type EscapedString = util.EscapedString diff --git a/example/ctx/ctx0.log b/example/ctx/ctx0.log index 53655b8e..205fe1de 100644 --- a/example/ctx/ctx0.log +++ b/example/ctx/ctx0.log @@ -1,2458 +1,12 @@ -gocc version 1.3.0001 +gocc version 2.1.0001 -a = true -debug_lexer = false -debug_parser = false -h = false -no_lexer = false --o = /home/max/go/src/github.com/maxcalandrelli/gocc/example/ctx/ctx.grammar/ctx --p = github.com/maxcalandrelli/gocc/example/ctx/ctx.grammar/ctx +-o = /home/max/go/src/github.com/maxcalandrelli/gocc/example/ctx/ctx0.grammar/ctx0 +-p = github.com/maxcalandrelli/gocc/example/ctx/ctx0.grammar/ctx0 -u = false -v = true -internal = internal -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.ItemsSet0 in itemset.go:62 -items.GetItemSets in itemsets.go:39 -id -*** Item: "id : _x {_x0 | _x1 | \\u03b3}" - ** emoves: -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.ItemsSet0 in itemset.go:62 -items.GetItemSets in itemsets.go:39 -!whitespace -*** Item: "!whitespace : ' ' | '\\t' | '\\n' | '\\r'" - ** emoves: -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.ItemList.Closure in itemlist.go:80 -items.NewItemSet in itemset.go:46 -items.(*ItemSets).Add in itemsets.go:49 -items.GetItemSets in itemsets.go:39 -_x -*** Item: "_x : \\u03b1 | (\\u03b2 _digit {_digit})" - ** emoves: -*** Item: "_x : \\u03b1 | • (\\u03b2 _digit {_digit})" - ** emoves: -*** Item: "_x : \\u03b1 | (\\u03b2 _digit {_digit})" - ** emoves: -------------------------------------------- -items.(*ItemSets).Closure in itemsets.go:54 -items.GetItemSets in itemsets.go:41 -S0/1 -S0: rng: "['\\t','\\t']" -------------------------------------------- -items.(*ItemSet).Next in itemset.go:159 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S0:rng="['\\t','\\t']" -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).Move in item.go:311 -items.(*ItemSet).Next in itemset.go:162 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -!whitespace -*** Item: "!whitespace : ' ' | '\\t' | '\\n' | '\\r'" - ** emoves: - <"!whitespace : ' ' | • '\\t' | '\\n' | '\\r'">:move("['\\t','\\t']"):["!whitespace : (' ' | '\\t' | '\\n' | '\\r') •"] -------------------------------------------- -items.(*ItemSet).dependentsClosure in itemset.go:190 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S0:dependentsClosure S0 - actual: { - id : • _x {_x0 | _x1 | γ} - !whitespace : ' ' | ' ' | ' -' | • ' ' - !whitespace : ' ' | ' ' | • ' -' | ' ' - !whitespace : ' ' | • ' ' | ' -' | ' ' - !whitespace : • ' ' | ' ' | ' -' | ' ' - _x : α | (• β _digit {_digit}) - _x : • α | (β _digit {_digit}) -} -Transitions: - [' ',' '] -> S-1 - [' -',' -'] -> S-1 - [' ',' '] -> S-1 - [' ',' '] -> S-1 - [α,α] -> S-1 - [β,β] -> S-1 -Symbols classes: {[' ',' '], [' -',' -'], [' ',' '], [' ',' '], [α,α], [β,β]} - - items: ["!whitespace : (' ' | '\t' | '\n' | '\r') •"] -S0: #0: <"!whitespace : (' ' | '\\t' | '\\n' | '\\r') •"> -S0: rng: "['\\n','\\n']" -------------------------------------------- -items.(*ItemSet).Next in itemset.go:159 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S0:rng="['\\n','\\n']" -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).Move in item.go:311 -items.(*ItemSet).Next in itemset.go:162 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -!whitespace -*** Item: "!whitespace : ' ' | '\\t' | '\\n' | '\\r'" - ** emoves: - <"!whitespace : ' ' | '\\t' | • '\\n' | '\\r'">:move("['\\n','\\n']"):["!whitespace : (' ' | '\\t' | '\\n' | '\\r') •"] -------------------------------------------- -items.(*ItemSet).dependentsClosure in itemset.go:190 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S0:dependentsClosure S0 - actual: { - id : • _x {_x0 | _x1 | γ} - !whitespace : ' ' | ' ' | ' -' | • ' ' - !whitespace : ' ' | ' ' | • ' -' | ' ' - !whitespace : ' ' | • ' ' | ' -' | ' ' - !whitespace : • ' ' | ' ' | ' -' | ' ' - _x : α | (• β _digit {_digit}) - _x : • α | (β _digit {_digit}) -} -Transitions: - [' ',' '] -> S1 - [' -',' -'] -> S-1 - [' ',' '] -> S-1 - [' ',' '] -> S-1 - [α,α] -> S-1 - [β,β] -> S-1 -Symbols classes: {[' ',' '], [' -',' -'], [' ',' '], [' ',' '], [α,α], [β,β]} - - items: ["!whitespace : (' ' | '\t' | '\n' | '\r') •"] -S0: #0: <"!whitespace : (' ' | '\\t' | '\\n' | '\\r') •"> -S0: rng: "['\\r','\\r']" -------------------------------------------- -items.(*ItemSet).Next in itemset.go:159 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S0:rng="['\\r','\\r']" -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).Move in item.go:311 -items.(*ItemSet).Next in itemset.go:162 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -!whitespace -*** Item: "!whitespace : ' ' | '\\t' | '\\n' | '\\r'" - ** emoves: - <"!whitespace : ' ' | '\\t' | '\\n' | • '\\r'">:move("['\\r','\\r']"):["!whitespace : (' ' | '\\t' | '\\n' | '\\r') •"] -------------------------------------------- -items.(*ItemSet).dependentsClosure in itemset.go:190 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S0:dependentsClosure S0 - actual: { - id : • _x {_x0 | _x1 | γ} - !whitespace : ' ' | ' ' | ' -' | • ' ' - !whitespace : ' ' | ' ' | • ' -' | ' ' - !whitespace : ' ' | • ' ' | ' -' | ' ' - !whitespace : • ' ' | ' ' | ' -' | ' ' - _x : α | (• β _digit {_digit}) - _x : • α | (β _digit {_digit}) -} -Transitions: - [' ',' '] -> S1 - [' -',' -'] -> S1 - [' ',' '] -> S-1 - [' ',' '] -> S-1 - [α,α] -> S-1 - [β,β] -> S-1 -Symbols classes: {[' ',' '], [' -',' -'], [' ',' '], [' ',' '], [α,α], [β,β]} - - items: ["!whitespace : (' ' | '\t' | '\n' | '\r') •"] -S0: #0: <"!whitespace : (' ' | '\\t' | '\\n' | '\\r') •"> -S0: rng: "[' ',' ']" -------------------------------------------- -items.(*ItemSet).Next in itemset.go:159 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S0:rng="[' ',' ']" -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).Move in item.go:311 -items.(*ItemSet).Next in itemset.go:162 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -!whitespace -*** Item: "!whitespace : ' ' | '\\t' | '\\n' | '\\r'" - ** emoves: - <"!whitespace : • ' ' | '\\t' | '\\n' | '\\r'">:move("[' ',' ']"):["!whitespace : (' ' | '\\t' | '\\n' | '\\r') •"] -------------------------------------------- -items.(*ItemSet).dependentsClosure in itemset.go:190 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S0:dependentsClosure S0 - actual: { - id : • _x {_x0 | _x1 | γ} - !whitespace : ' ' | ' ' | ' -' | • ' ' - !whitespace : ' ' | ' ' | • ' -' | ' ' - !whitespace : ' ' | • ' ' | ' -' | ' ' - !whitespace : • ' ' | ' ' | ' -' | ' ' - _x : α | (• β _digit {_digit}) - _x : • α | (β _digit {_digit}) -} -Transitions: - [' ',' '] -> S1 - [' -',' -'] -> S1 - [' ',' '] -> S1 - [' ',' '] -> S-1 - [α,α] -> S-1 - [β,β] -> S-1 -Symbols classes: {[' ',' '], [' -',' -'], [' ',' '], [' ',' '], [α,α], [β,β]} - - items: ["!whitespace : (' ' | '\t' | '\n' | '\r') •"] -S0: #0: <"!whitespace : (' ' | '\\t' | '\\n' | '\\r') •"> -S0: rng: "[\\u03b1,\\u03b1]" -------------------------------------------- -items.(*ItemSet).Next in itemset.go:159 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S0:rng="[\\u03b1,\\u03b1]" -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).Move in item.go:311 -items.(*ItemSet).Next in itemset.go:162 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_x -*** Item: "_x : \\u03b1 | (\\u03b2 _digit {_digit})" - ** emoves: - <"_x : • \\u03b1 | (\\u03b2 _digit {_digit})">:move("[\\u03b1,\\u03b1]"):["_x : (\\u03b1 | (\\u03b2 _digit {_digit})) •"] -------------------------------------------- -items.(*ItemSet).dependentsClosure in itemset.go:190 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S0:dependentsClosure S0 - actual: { - id : • _x {_x0 | _x1 | γ} - !whitespace : ' ' | ' ' | ' -' | • ' ' - !whitespace : ' ' | ' ' | • ' -' | ' ' - !whitespace : ' ' | • ' ' | ' -' | ' ' - !whitespace : • ' ' | ' ' | ' -' | ' ' - _x : α | (• β _digit {_digit}) - _x : • α | (β _digit {_digit}) -} -Transitions: - [' ',' '] -> S1 - [' -',' -'] -> S1 - [' ',' '] -> S1 - [' ',' '] -> S1 - [α,α] -> S-1 - [β,β] -> S-1 -Symbols classes: {[' ',' '], [' -',' -'], [' ',' '], [' ',' '], [α,α], [β,β]} - - items: ["_x : (\u03b1 | (\u03b2 _digit {_digit})) •"] -------------------------------------------- -items.(*Item).MoveRegDefId in item.go:333 -items.(*ItemSet).dependentsClosure in itemset.go:195 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 - * moved item: - *ast.LexPattern:_x {_x0 | _x1 | γ}; pos 0 - *ast.LexAlt:_x {_x0 | _x1 | γ}; pos 1 - -was: - *ast.LexPattern:_x {_x0 | _x1 | γ}; pos 0 - *ast.LexAlt:_x {_x0 | _x1 | γ}; pos 0 -) -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).MoveRegDefId in item.go:334 -items.(*ItemSet).dependentsClosure in itemset.go:195 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -id -*** Item: "id : _x • {_x0 | _x1 | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | _x1 | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | _x1 | \\u03b3}" - ** emoves: -S0: ====> id : _x {_x0 | _x1 | \u03b3} • -S0: ====> id : _x {_x0 | _x1 | • \u03b3} -S0: ====> id : _x {_x0 | • _x1 | \u03b3} -S0: ====> id : _x {• _x0 | _x1 | \u03b3} -------------------------------------------- -items.(*Item).MoveRegDefId in item.go:333 -items.(*ItemSet).dependentsClosure in itemset.go:199 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 - * moved item: - *ast.LexPattern:_x {_x0 | _x1 | γ}; pos 0 - *ast.LexAlt:_x {_x0 | _x1 | γ}; pos 1 - -was: - *ast.LexPattern:_x {_x0 | _x1 | γ}; pos 0 - *ast.LexAlt:_x {_x0 | _x1 | γ}; pos 0 -) -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).MoveRegDefId in item.go:334 -items.(*ItemSet).dependentsClosure in itemset.go:199 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -id -*** Item: "id : _x • {_x0 | _x1 | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | _x1 | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | _x1 | \\u03b3}" - ** emoves: -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.ItemList.Closure in itemlist.go:80 -items.(*ItemSet).Next in itemset.go:165 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_x1 -*** Item: "_x1 : \\u03b2 _digit {_digit}" - ** emoves: -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.ItemList.Closure in itemlist.go:80 -items.(*ItemSet).Next in itemset.go:165 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_x0 -*** Item: "_x0 : \\u03b1" - ** emoves: -S0: #0: <"_x : (\\u03b1 | (\\u03b2 _digit {_digit})) •"> -S0: #1: <"id : _x {_x0 | _x1 | \\u03b3} •"> -S0: #2: <"id : _x {_x0 | _x1 | • \\u03b3}"> -S0: #3: <"id : _x {_x0 | • _x1 | \\u03b3}"> -S0: #4: <"id : _x {• _x0 | _x1 | \\u03b3}"> -S0: #5: <"_x1 : • \\u03b2 _digit {_digit}"> -S0: #6: <"_x0 : • \\u03b1"> -S0: rng: "[\\u03b2,\\u03b2]" -------------------------------------------- -items.(*ItemSet).Next in itemset.go:159 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S0:rng="[\\u03b2,\\u03b2]" -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).Move in item.go:311 -items.(*ItemSet).Next in itemset.go:162 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_x - <"_x : \\u03b1 | (• \\u03b2 _digit {_digit})">:move("[\\u03b2,\\u03b2]"):["_x : \\u03b1 | (\\u03b2 • _digit {_digit})"] -------------------------------------------- -items.(*ItemSet).dependentsClosure in itemset.go:190 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S0:dependentsClosure S0 - actual: { - id : • _x {_x0 | _x1 | γ} - !whitespace : ' ' | ' ' | ' -' | • ' ' - !whitespace : ' ' | ' ' | • ' -' | ' ' - !whitespace : ' ' | • ' ' | ' -' | ' ' - !whitespace : • ' ' | ' ' | ' -' | ' ' - _x : α | (• β _digit {_digit}) - _x : • α | (β _digit {_digit}) -} -Transitions: - [' ',' '] -> S1 - [' -',' -'] -> S1 - [' ',' '] -> S1 - [' ',' '] -> S1 - [α,α] -> S2 - [β,β] -> S-1 -Symbols classes: {[' ',' '], [' -',' -'], [' ',' '], [' ',' '], [α,α], [β,β]} - - items: ["_x : \u03b1 | (\u03b2 • _digit {_digit})"] -S0: ==> id : • _x {_x0 | _x1 | \u03b3} -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.ItemList.Closure in itemlist.go:80 -items.(*ItemSet).Next in itemset.go:165 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_digit -*** Item: "_digit : '0'-'9'" - ** emoves: -S0: #0: <"_x : \\u03b1 | (\\u03b2 • _digit {_digit})"> -S0: #1: <"id : • _x {_x0 | _x1 | \\u03b3}"> -S0: #2: <"_digit : • '0'-'9'"> -S1/4 -S2/4 -S2: rng: "[\\u03b1,\\u03b1]" -------------------------------------------- -items.(*ItemSet).Next in itemset.go:159 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S2:rng="[\\u03b1,\\u03b1]" -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).Move in item.go:311 -items.(*ItemSet).Next in itemset.go:162 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_x0 -*** Item: "_x0 : \\u03b1" - ** emoves: - <"_x0 : • \\u03b1">:move("[\\u03b1,\\u03b1]"):["_x0 : \\u03b1 •"] -------------------------------------------- -items.(*ItemSet).dependentsClosure in itemset.go:190 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S2:dependentsClosure S2 - actual: { - _x : (α | (β _digit {_digit})) • - id : _x {_x0 | _x1 | γ} • - id : _x {_x0 | _x1 | • γ} - id : _x {_x0 | • _x1 | γ} - id : _x {• _x0 | _x1 | γ} - _x1 : • β _digit {_digit} - _x0 : • α -} -Transitions: - [α,α] -> S-1 - [β,β] -> S-1 - [γ,γ] -> S-1 -Symbols classes: {[α,α], [β,β], [γ,γ]} - - items: ["_x0 : \u03b1 •"] -------------------------------------------- -items.(*Item).MoveRegDefId in item.go:333 -items.(*ItemSet).dependentsClosure in itemset.go:195 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 - * moved item: - *ast.LexPattern:_x {_x0 | _x1 | γ}; pos 0 - *ast.LexAlt:_x {_x0 | _x1 | γ}; pos 1 - *ast.LexRepPattern:{_x0 | _x1 | γ}; pos 0 - *ast.LexAlt:_x0; pos 1 - -was: - *ast.LexPattern:_x {_x0 | _x1 | γ}; pos 0 - *ast.LexAlt:_x {_x0 | _x1 | γ}; pos 1 - *ast.LexRepPattern:{_x0 | _x1 | γ}; pos 0 - *ast.LexAlt:_x0; pos 0 -) -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).MoveRegDefId in item.go:334 -items.(*ItemSet).dependentsClosure in itemset.go:195 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -id -*** Item: "id : _x {_x0 | _x1 | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | _x1 | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | _x1 | \\u03b3}" - ** emoves: -S2: ====> id : _x {_x0 | _x1 | \u03b3} • -S2: ====> id : _x {_x0 | _x1 | • \u03b3} -S2: ====> id : _x {_x0 | • _x1 | \u03b3} -S2: ====> id : _x {• _x0 | _x1 | \u03b3} -------------------------------------------- -items.(*Item).MoveRegDefId in item.go:333 -items.(*ItemSet).dependentsClosure in itemset.go:199 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 - * moved item: - *ast.LexPattern:_x {_x0 | _x1 | γ}; pos 0 - *ast.LexAlt:_x {_x0 | _x1 | γ}; pos 1 - *ast.LexRepPattern:{_x0 | _x1 | γ}; pos 0 - *ast.LexAlt:_x0; pos 1 - -was: - *ast.LexPattern:_x {_x0 | _x1 | γ}; pos 0 - *ast.LexAlt:_x {_x0 | _x1 | γ}; pos 1 - *ast.LexRepPattern:{_x0 | _x1 | γ}; pos 0 - *ast.LexAlt:_x0; pos 0 -) -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).MoveRegDefId in item.go:334 -items.(*ItemSet).dependentsClosure in itemset.go:199 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -id -*** Item: "id : _x {_x0 | _x1 | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | _x1 | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | _x1 | \\u03b3}" - ** emoves: -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.ItemList.Closure in itemlist.go:80 -items.(*ItemSet).Next in itemset.go:165 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_x1 -*** Item: "_x1 : \\u03b2 _digit {_digit}" - ** emoves: -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.ItemList.Closure in itemlist.go:80 -items.(*ItemSet).Next in itemset.go:165 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_x0 -*** Item: "_x0 : \\u03b1" - ** emoves: -S2: #0: <"_x0 : \\u03b1 •"> -S2: #1: <"id : _x {_x0 | _x1 | \\u03b3} •"> -S2: #2: <"id : _x {_x0 | _x1 | • \\u03b3}"> -S2: #3: <"id : _x {_x0 | • _x1 | \\u03b3}"> -S2: #4: <"id : _x {• _x0 | _x1 | \\u03b3}"> -S2: #5: <"_x1 : • \\u03b2 _digit {_digit}"> -S2: #6: <"_x0 : • \\u03b1"> -S2: rng: "[\\u03b2,\\u03b2]" -------------------------------------------- -items.(*ItemSet).Next in itemset.go:159 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S2:rng="[\\u03b2,\\u03b2]" -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).Move in item.go:311 -items.(*ItemSet).Next in itemset.go:162 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_x1 - <"_x1 : • \\u03b2 _digit {_digit}">:move("[\\u03b2,\\u03b2]"):["_x1 : \\u03b2 • _digit {_digit}"] -------------------------------------------- -items.(*ItemSet).dependentsClosure in itemset.go:190 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S2:dependentsClosure S2 - actual: { - _x : (α | (β _digit {_digit})) • - id : _x {_x0 | _x1 | γ} • - id : _x {_x0 | _x1 | • γ} - id : _x {_x0 | • _x1 | γ} - id : _x {• _x0 | _x1 | γ} - _x1 : • β _digit {_digit} - _x0 : • α -} -Transitions: - [α,α] -> S4 - [β,β] -> S-1 - [γ,γ] -> S-1 -Symbols classes: {[α,α], [β,β], [γ,γ]} - - items: ["_x1 : \u03b2 • _digit {_digit}"] -S2: ==> id : _x {_x0 | • _x1 | \u03b3} -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.ItemList.Closure in itemlist.go:80 -items.(*ItemSet).Next in itemset.go:165 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_digit -*** Item: "_digit : '0'-'9'" - ** emoves: -S2: #0: <"_x1 : \\u03b2 • _digit {_digit}"> -S2: #1: <"id : _x {_x0 | • _x1 | \\u03b3}"> -S2: #2: <"_digit : • '0'-'9'"> -S2: rng: "[\\u03b3,\\u03b3]" -------------------------------------------- -items.(*ItemSet).Next in itemset.go:159 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S2:rng="[\\u03b3,\\u03b3]" -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).Move in item.go:311 -items.(*ItemSet).Next in itemset.go:162 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -id -*** Item: "id : _x {_x0 | _x1 | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | _x1 | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | _x1 | \\u03b3}" - ** emoves: - <"id : _x {_x0 | _x1 | • \\u03b3}">:move("[\\u03b3,\\u03b3]"):["id : _x {_x0 | _x1 | \\u03b3} •" "id : _x {_x0 | _x1 | • \\u03b3}" "id : _x {_x0 | • _x1 | \\u03b3}" "id : _x {• _x0 | _x1 | \\u03b3}"] -------------------------------------------- -items.(*ItemSet).dependentsClosure in itemset.go:190 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S2:dependentsClosure S2 - actual: { - _x : (α | (β _digit {_digit})) • - id : _x {_x0 | _x1 | γ} • - id : _x {_x0 | _x1 | • γ} - id : _x {_x0 | • _x1 | γ} - id : _x {• _x0 | _x1 | γ} - _x1 : • β _digit {_digit} - _x0 : • α -} -Transitions: - [α,α] -> S4 - [β,β] -> S5 - [γ,γ] -> S-1 -Symbols classes: {[α,α], [β,β], [γ,γ]} - - items: ["id : _x {_x0 | _x1 | \u03b3} •" "id : _x {_x0 | _x1 | • \u03b3}" "id : _x {_x0 | • _x1 | \u03b3}" "id : _x {• _x0 | _x1 | \u03b3}"] -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.ItemList.Closure in itemlist.go:80 -items.(*ItemSet).Next in itemset.go:165 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_x1 -*** Item: "_x1 : \\u03b2 _digit {_digit}" - ** emoves: -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.ItemList.Closure in itemlist.go:80 -items.(*ItemSet).Next in itemset.go:165 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_x0 -*** Item: "_x0 : \\u03b1" - ** emoves: -S2: #0: <"id : _x {_x0 | _x1 | \\u03b3} •"> -S2: #1: <"id : _x {_x0 | _x1 | • \\u03b3}"> -S2: #2: <"id : _x {_x0 | • _x1 | \\u03b3}"> -S2: #3: <"id : _x {• _x0 | _x1 | \\u03b3}"> -S2: #4: <"_x1 : • \\u03b2 _digit {_digit}"> -S2: #5: <"_x0 : • \\u03b1"> -S3/7 -S3: rng: "['0','9']" -------------------------------------------- -items.(*ItemSet).Next in itemset.go:159 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S3:rng="['0','9']" -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).Move in item.go:311 -items.(*ItemSet).Next in itemset.go:162 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_digit -*** Item: "_digit : '0'-'9'" - ** emoves: - <"_digit : • '0'-'9'">:move("['0','9']"):["_digit : '0'-'9' •"] -------------------------------------------- -items.(*ItemSet).dependentsClosure in itemset.go:190 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S3:dependentsClosure S3 - actual: { - _x : α | (β • _digit {_digit}) - id : • _x {_x0 | _x1 | γ} - _digit : • '0'-'9' -} -Transitions: - ['0','9'] -> S-1 -Symbols classes: {['0','9']} - - items: ["_digit : '0'-'9' •"] -------------------------------------------- -items.(*Item).MoveRegDefId in item.go:333 -items.(*ItemSet).dependentsClosure in itemset.go:195 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 - * moved item: - *ast.LexPattern:α | (β _digit {_digit}); pos 1 - *ast.LexAlt:(β _digit {_digit}); pos 0 - *ast.LexGroupPattern:(β _digit {_digit}); pos 0 - *ast.LexAlt:β _digit {_digit}; pos 2 - -was: - *ast.LexPattern:α | (β _digit {_digit}); pos 1 - *ast.LexAlt:(β _digit {_digit}); pos 0 - *ast.LexGroupPattern:(β _digit {_digit}); pos 0 - *ast.LexAlt:β _digit {_digit}; pos 1 -) -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).MoveRegDefId in item.go:334 -items.(*ItemSet).dependentsClosure in itemset.go:195 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_x -*** Item: "_x : \\u03b1 | (\\u03b2 _digit • {_digit})" - ** emoves: -*** Item: "_x : \\u03b1 | (\\u03b2 _digit {_digit})" - ** emoves: -*** Item: "_x : \\u03b1 | (\\u03b2 _digit {_digit})" - ** emoves: -*** Item: "_x : \\u03b1 | (\\u03b2 _digit {_digit})" - ** emoves: -*** Item: "_x : \\u03b1 | (\\u03b2 _digit {_digit})" - ** emoves: -S3: ====> _x : (\u03b1 | (\u03b2 _digit {_digit})) • -S3: ====> _x : \u03b1 | (\u03b2 _digit {• _digit}) -------------------------------------------- -items.(*Item).MoveRegDefId in item.go:333 -items.(*ItemSet).dependentsClosure in itemset.go:199 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 - * moved item: - *ast.LexPattern:α | (β _digit {_digit}); pos 1 - *ast.LexAlt:(β _digit {_digit}); pos 0 - *ast.LexGroupPattern:(β _digit {_digit}); pos 0 - *ast.LexAlt:β _digit {_digit}; pos 2 - -was: - *ast.LexPattern:α | (β _digit {_digit}); pos 1 - *ast.LexAlt:(β _digit {_digit}); pos 0 - *ast.LexGroupPattern:(β _digit {_digit}); pos 0 - *ast.LexAlt:β _digit {_digit}; pos 1 -) -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).MoveRegDefId in item.go:334 -items.(*ItemSet).dependentsClosure in itemset.go:199 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_x -*** Item: "_x : \\u03b1 | (\\u03b2 _digit • {_digit})" - ** emoves: -*** Item: "_x : \\u03b1 | (\\u03b2 _digit {_digit})" - ** emoves: -*** Item: "_x : \\u03b1 | (\\u03b2 _digit {_digit})" - ** emoves: -*** Item: "_x : \\u03b1 | (\\u03b2 _digit {_digit})" - ** emoves: -*** Item: "_x : \\u03b1 | (\\u03b2 _digit {_digit})" - ** emoves: -------------------------------------------- -items.(*Item).MoveRegDefId in item.go:333 -items.(*ItemSet).dependentsClosure in itemset.go:195 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 - * moved item: - *ast.LexPattern:_x {_x0 | _x1 | γ}; pos 0 - *ast.LexAlt:_x {_x0 | _x1 | γ}; pos 1 - -was: - *ast.LexPattern:_x {_x0 | _x1 | γ}; pos 0 - *ast.LexAlt:_x {_x0 | _x1 | γ}; pos 0 -) -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).MoveRegDefId in item.go:334 -items.(*ItemSet).dependentsClosure in itemset.go:195 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -id -*** Item: "id : _x • {_x0 | _x1 | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | _x1 | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | _x1 | \\u03b3}" - ** emoves: -S3: ====> id : _x {_x0 | _x1 | \u03b3} • -S3: ====> id : _x {_x0 | _x1 | • \u03b3} -S3: ====> id : _x {_x0 | • _x1 | \u03b3} -S3: ====> id : _x {• _x0 | _x1 | \u03b3} -------------------------------------------- -items.(*Item).MoveRegDefId in item.go:333 -items.(*ItemSet).dependentsClosure in itemset.go:199 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 - * moved item: - *ast.LexPattern:_x {_x0 | _x1 | γ}; pos 0 - *ast.LexAlt:_x {_x0 | _x1 | γ}; pos 1 - -was: - *ast.LexPattern:_x {_x0 | _x1 | γ}; pos 0 - *ast.LexAlt:_x {_x0 | _x1 | γ}; pos 0 -) -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).MoveRegDefId in item.go:334 -items.(*ItemSet).dependentsClosure in itemset.go:199 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -id -*** Item: "id : _x • {_x0 | _x1 | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | _x1 | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | _x1 | \\u03b3}" - ** emoves: -S3: ==> id : • _x {_x0 | _x1 | \u03b3} -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.ItemList.Closure in itemlist.go:80 -items.(*ItemSet).Next in itemset.go:165 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_digit -*** Item: "_digit : '0'-'9'" - ** emoves: -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.ItemList.Closure in itemlist.go:80 -items.(*ItemSet).Next in itemset.go:165 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_x1 -*** Item: "_x1 : \\u03b2 _digit {_digit}" - ** emoves: -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.ItemList.Closure in itemlist.go:80 -items.(*ItemSet).Next in itemset.go:165 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_x0 -*** Item: "_x0 : \\u03b1" - ** emoves: -S3: #0: <"_digit : '0'-'9' •"> -S3: #1: <"_x : (\\u03b1 | (\\u03b2 _digit {_digit})) •"> -S3: #2: <"_x : \\u03b1 | (\\u03b2 _digit {• _digit})"> -S3: #3: <"id : _x {_x0 | _x1 | \\u03b3} •"> -S3: #4: <"id : _x {_x0 | _x1 | • \\u03b3}"> -S3: #5: <"id : _x {_x0 | • _x1 | \\u03b3}"> -S3: #6: <"id : _x {• _x0 | _x1 | \\u03b3}"> -S3: #7: <"id : • _x {_x0 | _x1 | \\u03b3}"> -S3: #8: <"_digit : • '0'-'9'"> -S3: #9: <"_x1 : • \\u03b2 _digit {_digit}"> -S3: #10: <"_x0 : • \\u03b1"> -S4/8 -S4: rng: "[\\u03b1,\\u03b1]" -------------------------------------------- -items.(*ItemSet).Next in itemset.go:159 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S4:rng="[\\u03b1,\\u03b1]" -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).Move in item.go:311 -items.(*ItemSet).Next in itemset.go:162 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_x0 -*** Item: "_x0 : \\u03b1" - ** emoves: - <"_x0 : • \\u03b1">:move("[\\u03b1,\\u03b1]"):["_x0 : \\u03b1 •"] -------------------------------------------- -items.(*ItemSet).dependentsClosure in itemset.go:190 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S4:dependentsClosure S4 - actual: { - _x0 : α • - id : _x {_x0 | _x1 | γ} • - id : _x {_x0 | _x1 | • γ} - id : _x {_x0 | • _x1 | γ} - id : _x {• _x0 | _x1 | γ} - _x1 : • β _digit {_digit} - _x0 : • α -} -Transitions: - [α,α] -> S-1 - [β,β] -> S-1 - [γ,γ] -> S-1 -Symbols classes: {[α,α], [β,β], [γ,γ]} - - items: ["_x0 : \u03b1 •"] -------------------------------------------- -items.(*Item).MoveRegDefId in item.go:333 -items.(*ItemSet).dependentsClosure in itemset.go:195 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 - * moved item: - *ast.LexPattern:_x {_x0 | _x1 | γ}; pos 0 - *ast.LexAlt:_x {_x0 | _x1 | γ}; pos 1 - *ast.LexRepPattern:{_x0 | _x1 | γ}; pos 0 - *ast.LexAlt:_x0; pos 1 - -was: - *ast.LexPattern:_x {_x0 | _x1 | γ}; pos 0 - *ast.LexAlt:_x {_x0 | _x1 | γ}; pos 1 - *ast.LexRepPattern:{_x0 | _x1 | γ}; pos 0 - *ast.LexAlt:_x0; pos 0 -) -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).MoveRegDefId in item.go:334 -items.(*ItemSet).dependentsClosure in itemset.go:195 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -id -*** Item: "id : _x {_x0 | _x1 | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | _x1 | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | _x1 | \\u03b3}" - ** emoves: -S4: ====> id : _x {_x0 | _x1 | \u03b3} • -S4: ====> id : _x {_x0 | _x1 | • \u03b3} -S4: ====> id : _x {_x0 | • _x1 | \u03b3} -S4: ====> id : _x {• _x0 | _x1 | \u03b3} -------------------------------------------- -items.(*Item).MoveRegDefId in item.go:333 -items.(*ItemSet).dependentsClosure in itemset.go:199 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 - * moved item: - *ast.LexPattern:_x {_x0 | _x1 | γ}; pos 0 - *ast.LexAlt:_x {_x0 | _x1 | γ}; pos 1 - *ast.LexRepPattern:{_x0 | _x1 | γ}; pos 0 - *ast.LexAlt:_x0; pos 1 - -was: - *ast.LexPattern:_x {_x0 | _x1 | γ}; pos 0 - *ast.LexAlt:_x {_x0 | _x1 | γ}; pos 1 - *ast.LexRepPattern:{_x0 | _x1 | γ}; pos 0 - *ast.LexAlt:_x0; pos 0 -) -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).MoveRegDefId in item.go:334 -items.(*ItemSet).dependentsClosure in itemset.go:199 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -id -*** Item: "id : _x {_x0 | _x1 | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | _x1 | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | _x1 | \\u03b3}" - ** emoves: -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.ItemList.Closure in itemlist.go:80 -items.(*ItemSet).Next in itemset.go:165 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_x1 -*** Item: "_x1 : \\u03b2 _digit {_digit}" - ** emoves: -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.ItemList.Closure in itemlist.go:80 -items.(*ItemSet).Next in itemset.go:165 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_x0 -*** Item: "_x0 : \\u03b1" - ** emoves: -S4: #0: <"_x0 : \\u03b1 •"> -S4: #1: <"id : _x {_x0 | _x1 | \\u03b3} •"> -S4: #2: <"id : _x {_x0 | _x1 | • \\u03b3}"> -S4: #3: <"id : _x {_x0 | • _x1 | \\u03b3}"> -S4: #4: <"id : _x {• _x0 | _x1 | \\u03b3}"> -S4: #5: <"_x1 : • \\u03b2 _digit {_digit}"> -S4: #6: <"_x0 : • \\u03b1"> -S4: rng: "[\\u03b2,\\u03b2]" -------------------------------------------- -items.(*ItemSet).Next in itemset.go:159 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S4:rng="[\\u03b2,\\u03b2]" -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).Move in item.go:311 -items.(*ItemSet).Next in itemset.go:162 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_x1 - <"_x1 : • \\u03b2 _digit {_digit}">:move("[\\u03b2,\\u03b2]"):["_x1 : \\u03b2 • _digit {_digit}"] -------------------------------------------- -items.(*ItemSet).dependentsClosure in itemset.go:190 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S4:dependentsClosure S4 - actual: { - _x0 : α • - id : _x {_x0 | _x1 | γ} • - id : _x {_x0 | _x1 | • γ} - id : _x {_x0 | • _x1 | γ} - id : _x {• _x0 | _x1 | γ} - _x1 : • β _digit {_digit} - _x0 : • α -} -Transitions: - [α,α] -> S4 - [β,β] -> S-1 - [γ,γ] -> S-1 -Symbols classes: {[α,α], [β,β], [γ,γ]} - - items: ["_x1 : \u03b2 • _digit {_digit}"] -S4: ==> id : _x {_x0 | • _x1 | \u03b3} -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.ItemList.Closure in itemlist.go:80 -items.(*ItemSet).Next in itemset.go:165 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_digit -*** Item: "_digit : '0'-'9'" - ** emoves: -S4: #0: <"_x1 : \\u03b2 • _digit {_digit}"> -S4: #1: <"id : _x {_x0 | • _x1 | \\u03b3}"> -S4: #2: <"_digit : • '0'-'9'"> -S4: rng: "[\\u03b3,\\u03b3]" -------------------------------------------- -items.(*ItemSet).Next in itemset.go:159 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S4:rng="[\\u03b3,\\u03b3]" -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).Move in item.go:311 -items.(*ItemSet).Next in itemset.go:162 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -id -*** Item: "id : _x {_x0 | _x1 | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | _x1 | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | _x1 | \\u03b3}" - ** emoves: - <"id : _x {_x0 | _x1 | • \\u03b3}">:move("[\\u03b3,\\u03b3]"):["id : _x {_x0 | _x1 | \\u03b3} •" "id : _x {_x0 | _x1 | • \\u03b3}" "id : _x {_x0 | • _x1 | \\u03b3}" "id : _x {• _x0 | _x1 | \\u03b3}"] -------------------------------------------- -items.(*ItemSet).dependentsClosure in itemset.go:190 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S4:dependentsClosure S4 - actual: { - _x0 : α • - id : _x {_x0 | _x1 | γ} • - id : _x {_x0 | _x1 | • γ} - id : _x {_x0 | • _x1 | γ} - id : _x {• _x0 | _x1 | γ} - _x1 : • β _digit {_digit} - _x0 : • α -} -Transitions: - [α,α] -> S4 - [β,β] -> S5 - [γ,γ] -> S-1 -Symbols classes: {[α,α], [β,β], [γ,γ]} - - items: ["id : _x {_x0 | _x1 | \u03b3} •" "id : _x {_x0 | _x1 | • \u03b3}" "id : _x {_x0 | • _x1 | \u03b3}" "id : _x {• _x0 | _x1 | \u03b3}"] -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.ItemList.Closure in itemlist.go:80 -items.(*ItemSet).Next in itemset.go:165 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_x1 -*** Item: "_x1 : \\u03b2 _digit {_digit}" - ** emoves: -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.ItemList.Closure in itemlist.go:80 -items.(*ItemSet).Next in itemset.go:165 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_x0 -*** Item: "_x0 : \\u03b1" - ** emoves: -S4: #0: <"id : _x {_x0 | _x1 | \\u03b3} •"> -S4: #1: <"id : _x {_x0 | _x1 | • \\u03b3}"> -S4: #2: <"id : _x {_x0 | • _x1 | \\u03b3}"> -S4: #3: <"id : _x {• _x0 | _x1 | \\u03b3}"> -S4: #4: <"_x1 : • \\u03b2 _digit {_digit}"> -S4: #5: <"_x0 : • \\u03b1"> -S5/8 -S5: rng: "['0','9']" -------------------------------------------- -items.(*ItemSet).Next in itemset.go:159 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S5:rng="['0','9']" -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).Move in item.go:311 -items.(*ItemSet).Next in itemset.go:162 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_digit -*** Item: "_digit : '0'-'9'" - ** emoves: - <"_digit : • '0'-'9'">:move("['0','9']"):["_digit : '0'-'9' •"] -------------------------------------------- -items.(*ItemSet).dependentsClosure in itemset.go:190 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S5:dependentsClosure S5 - actual: { - _x1 : β • _digit {_digit} - id : _x {_x0 | • _x1 | γ} - _digit : • '0'-'9' -} -Transitions: - ['0','9'] -> S-1 -Symbols classes: {['0','9']} - - items: ["_digit : '0'-'9' •"] -------------------------------------------- -items.(*Item).MoveRegDefId in item.go:333 -items.(*ItemSet).dependentsClosure in itemset.go:195 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 - * moved item: - *ast.LexPattern:β _digit {_digit}; pos 0 - *ast.LexAlt:β _digit {_digit}; pos 2 - -was: - *ast.LexPattern:β _digit {_digit}; pos 0 - *ast.LexAlt:β _digit {_digit}; pos 1 -) -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).MoveRegDefId in item.go:334 -items.(*ItemSet).dependentsClosure in itemset.go:195 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_x1 -*** Item: "_x1 : \\u03b2 _digit • {_digit}" - ** emoves: -*** Item: "_x1 : \\u03b2 _digit {_digit}" - ** emoves: -*** Item: "_x1 : \\u03b2 _digit {_digit}" - ** emoves: -S5: ====> _x1 : \u03b2 _digit {_digit} • -S5: ====> _x1 : \u03b2 _digit {• _digit} -------------------------------------------- -items.(*Item).MoveRegDefId in item.go:333 -items.(*ItemSet).dependentsClosure in itemset.go:199 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 - * moved item: - *ast.LexPattern:β _digit {_digit}; pos 0 - *ast.LexAlt:β _digit {_digit}; pos 2 - -was: - *ast.LexPattern:β _digit {_digit}; pos 0 - *ast.LexAlt:β _digit {_digit}; pos 1 -) -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).MoveRegDefId in item.go:334 -items.(*ItemSet).dependentsClosure in itemset.go:199 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_x1 -*** Item: "_x1 : \\u03b2 _digit • {_digit}" - ** emoves: -*** Item: "_x1 : \\u03b2 _digit {_digit}" - ** emoves: -*** Item: "_x1 : \\u03b2 _digit {_digit}" - ** emoves: -------------------------------------------- -items.(*Item).MoveRegDefId in item.go:333 -items.(*ItemSet).dependentsClosure in itemset.go:195 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 - * moved item: - *ast.LexPattern:_x {_x0 | _x1 | γ}; pos 0 - *ast.LexAlt:_x {_x0 | _x1 | γ}; pos 1 - *ast.LexRepPattern:{_x0 | _x1 | γ}; pos 1 - *ast.LexAlt:_x1; pos 1 - -was: - *ast.LexPattern:_x {_x0 | _x1 | γ}; pos 0 - *ast.LexAlt:_x {_x0 | _x1 | γ}; pos 1 - *ast.LexRepPattern:{_x0 | _x1 | γ}; pos 1 - *ast.LexAlt:_x1; pos 0 -) -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).MoveRegDefId in item.go:334 -items.(*ItemSet).dependentsClosure in itemset.go:195 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -id -*** Item: "id : _x {_x0 | _x1 | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | _x1 | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | _x1 | \\u03b3}" - ** emoves: -S5: ====> id : _x {_x0 | _x1 | \u03b3} • -S5: ====> id : _x {_x0 | _x1 | • \u03b3} -S5: ====> id : _x {_x0 | • _x1 | \u03b3} -S5: ====> id : _x {• _x0 | _x1 | \u03b3} -------------------------------------------- -items.(*Item).MoveRegDefId in item.go:333 -items.(*ItemSet).dependentsClosure in itemset.go:199 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 - * moved item: - *ast.LexPattern:_x {_x0 | _x1 | γ}; pos 0 - *ast.LexAlt:_x {_x0 | _x1 | γ}; pos 1 - *ast.LexRepPattern:{_x0 | _x1 | γ}; pos 1 - *ast.LexAlt:_x1; pos 1 - -was: - *ast.LexPattern:_x {_x0 | _x1 | γ}; pos 0 - *ast.LexAlt:_x {_x0 | _x1 | γ}; pos 1 - *ast.LexRepPattern:{_x0 | _x1 | γ}; pos 1 - *ast.LexAlt:_x1; pos 0 -) -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).MoveRegDefId in item.go:334 -items.(*ItemSet).dependentsClosure in itemset.go:199 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -id -*** Item: "id : _x {_x0 | _x1 | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | _x1 | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | _x1 | \\u03b3}" - ** emoves: -S5: ==> id : _x {_x0 | • _x1 | \u03b3} -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.ItemList.Closure in itemlist.go:80 -items.(*ItemSet).Next in itemset.go:165 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_digit -*** Item: "_digit : '0'-'9'" - ** emoves: -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.ItemList.Closure in itemlist.go:80 -items.(*ItemSet).Next in itemset.go:165 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_x0 -*** Item: "_x0 : \\u03b1" - ** emoves: -S5: #0: <"_digit : '0'-'9' •"> -S5: #1: <"_x1 : \\u03b2 _digit {_digit} •"> -S5: #2: <"_x1 : \\u03b2 _digit {• _digit}"> -S5: #3: <"id : _x {_x0 | _x1 | \\u03b3} •"> -S5: #4: <"id : _x {_x0 | _x1 | • \\u03b3}"> -S5: #5: <"id : _x {_x0 | • _x1 | \\u03b3}"> -S5: #6: <"id : _x {• _x0 | _x1 | \\u03b3}"> -S5: #7: <"_digit : • '0'-'9'"> -S5: #8: <"_x0 : • \\u03b1"> -S6/9 -S6: rng: "[\\u03b1,\\u03b1]" -------------------------------------------- -items.(*ItemSet).Next in itemset.go:159 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S6:rng="[\\u03b1,\\u03b1]" -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).Move in item.go:311 -items.(*ItemSet).Next in itemset.go:162 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_x0 -*** Item: "_x0 : \\u03b1" - ** emoves: - <"_x0 : • \\u03b1">:move("[\\u03b1,\\u03b1]"):["_x0 : \\u03b1 •"] -------------------------------------------- -items.(*ItemSet).dependentsClosure in itemset.go:190 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S6:dependentsClosure S6 - actual: { - id : _x {_x0 | _x1 | γ} • - id : _x {_x0 | _x1 | • γ} - id : _x {_x0 | • _x1 | γ} - id : _x {• _x0 | _x1 | γ} - _x1 : • β _digit {_digit} - _x0 : • α -} -Transitions: - [α,α] -> S-1 - [β,β] -> S-1 - [γ,γ] -> S-1 -Symbols classes: {[α,α], [β,β], [γ,γ]} - - items: ["_x0 : \u03b1 •"] -------------------------------------------- -items.(*Item).MoveRegDefId in item.go:333 -items.(*ItemSet).dependentsClosure in itemset.go:195 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 - * moved item: - *ast.LexPattern:_x {_x0 | _x1 | γ}; pos 0 - *ast.LexAlt:_x {_x0 | _x1 | γ}; pos 1 - *ast.LexRepPattern:{_x0 | _x1 | γ}; pos 0 - *ast.LexAlt:_x0; pos 1 - -was: - *ast.LexPattern:_x {_x0 | _x1 | γ}; pos 0 - *ast.LexAlt:_x {_x0 | _x1 | γ}; pos 1 - *ast.LexRepPattern:{_x0 | _x1 | γ}; pos 0 - *ast.LexAlt:_x0; pos 0 -) -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).MoveRegDefId in item.go:334 -items.(*ItemSet).dependentsClosure in itemset.go:195 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -id -*** Item: "id : _x {_x0 | _x1 | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | _x1 | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | _x1 | \\u03b3}" - ** emoves: -S6: ====> id : _x {_x0 | _x1 | \u03b3} • -S6: ====> id : _x {_x0 | _x1 | • \u03b3} -S6: ====> id : _x {_x0 | • _x1 | \u03b3} -S6: ====> id : _x {• _x0 | _x1 | \u03b3} -------------------------------------------- -items.(*Item).MoveRegDefId in item.go:333 -items.(*ItemSet).dependentsClosure in itemset.go:199 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 - * moved item: - *ast.LexPattern:_x {_x0 | _x1 | γ}; pos 0 - *ast.LexAlt:_x {_x0 | _x1 | γ}; pos 1 - *ast.LexRepPattern:{_x0 | _x1 | γ}; pos 0 - *ast.LexAlt:_x0; pos 1 - -was: - *ast.LexPattern:_x {_x0 | _x1 | γ}; pos 0 - *ast.LexAlt:_x {_x0 | _x1 | γ}; pos 1 - *ast.LexRepPattern:{_x0 | _x1 | γ}; pos 0 - *ast.LexAlt:_x0; pos 0 -) -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).MoveRegDefId in item.go:334 -items.(*ItemSet).dependentsClosure in itemset.go:199 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -id -*** Item: "id : _x {_x0 | _x1 | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | _x1 | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | _x1 | \\u03b3}" - ** emoves: -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.ItemList.Closure in itemlist.go:80 -items.(*ItemSet).Next in itemset.go:165 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_x1 -*** Item: "_x1 : \\u03b2 _digit {_digit}" - ** emoves: -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.ItemList.Closure in itemlist.go:80 -items.(*ItemSet).Next in itemset.go:165 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_x0 -*** Item: "_x0 : \\u03b1" - ** emoves: -S6: #0: <"_x0 : \\u03b1 •"> -S6: #1: <"id : _x {_x0 | _x1 | \\u03b3} •"> -S6: #2: <"id : _x {_x0 | _x1 | • \\u03b3}"> -S6: #3: <"id : _x {_x0 | • _x1 | \\u03b3}"> -S6: #4: <"id : _x {• _x0 | _x1 | \\u03b3}"> -S6: #5: <"_x1 : • \\u03b2 _digit {_digit}"> -S6: #6: <"_x0 : • \\u03b1"> -S6: rng: "[\\u03b2,\\u03b2]" -------------------------------------------- -items.(*ItemSet).Next in itemset.go:159 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S6:rng="[\\u03b2,\\u03b2]" -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).Move in item.go:311 -items.(*ItemSet).Next in itemset.go:162 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_x1 - <"_x1 : • \\u03b2 _digit {_digit}">:move("[\\u03b2,\\u03b2]"):["_x1 : \\u03b2 • _digit {_digit}"] -------------------------------------------- -items.(*ItemSet).dependentsClosure in itemset.go:190 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S6:dependentsClosure S6 - actual: { - id : _x {_x0 | _x1 | γ} • - id : _x {_x0 | _x1 | • γ} - id : _x {_x0 | • _x1 | γ} - id : _x {• _x0 | _x1 | γ} - _x1 : • β _digit {_digit} - _x0 : • α -} -Transitions: - [α,α] -> S4 - [β,β] -> S-1 - [γ,γ] -> S-1 -Symbols classes: {[α,α], [β,β], [γ,γ]} - - items: ["_x1 : \u03b2 • _digit {_digit}"] -S6: ==> id : _x {_x0 | • _x1 | \u03b3} -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.ItemList.Closure in itemlist.go:80 -items.(*ItemSet).Next in itemset.go:165 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_digit -*** Item: "_digit : '0'-'9'" - ** emoves: -S6: #0: <"_x1 : \\u03b2 • _digit {_digit}"> -S6: #1: <"id : _x {_x0 | • _x1 | \\u03b3}"> -S6: #2: <"_digit : • '0'-'9'"> -S6: rng: "[\\u03b3,\\u03b3]" -------------------------------------------- -items.(*ItemSet).Next in itemset.go:159 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S6:rng="[\\u03b3,\\u03b3]" -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).Move in item.go:311 -items.(*ItemSet).Next in itemset.go:162 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -id -*** Item: "id : _x {_x0 | _x1 | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | _x1 | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | _x1 | \\u03b3}" - ** emoves: - <"id : _x {_x0 | _x1 | • \\u03b3}">:move("[\\u03b3,\\u03b3]"):["id : _x {_x0 | _x1 | \\u03b3} •" "id : _x {_x0 | _x1 | • \\u03b3}" "id : _x {_x0 | • _x1 | \\u03b3}" "id : _x {• _x0 | _x1 | \\u03b3}"] -------------------------------------------- -items.(*ItemSet).dependentsClosure in itemset.go:190 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S6:dependentsClosure S6 - actual: { - id : _x {_x0 | _x1 | γ} • - id : _x {_x0 | _x1 | • γ} - id : _x {_x0 | • _x1 | γ} - id : _x {• _x0 | _x1 | γ} - _x1 : • β _digit {_digit} - _x0 : • α -} -Transitions: - [α,α] -> S4 - [β,β] -> S5 - [γ,γ] -> S-1 -Symbols classes: {[α,α], [β,β], [γ,γ]} - - items: ["id : _x {_x0 | _x1 | \u03b3} •" "id : _x {_x0 | _x1 | • \u03b3}" "id : _x {_x0 | • _x1 | \u03b3}" "id : _x {• _x0 | _x1 | \u03b3}"] -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.ItemList.Closure in itemlist.go:80 -items.(*ItemSet).Next in itemset.go:165 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_x1 -*** Item: "_x1 : \\u03b2 _digit {_digit}" - ** emoves: -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.ItemList.Closure in itemlist.go:80 -items.(*ItemSet).Next in itemset.go:165 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_x0 -*** Item: "_x0 : \\u03b1" - ** emoves: -S6: #0: <"id : _x {_x0 | _x1 | \\u03b3} •"> -S6: #1: <"id : _x {_x0 | _x1 | • \\u03b3}"> -S6: #2: <"id : _x {_x0 | • _x1 | \\u03b3}"> -S6: #3: <"id : _x {• _x0 | _x1 | \\u03b3}"> -S6: #4: <"_x1 : • \\u03b2 _digit {_digit}"> -S6: #5: <"_x0 : • \\u03b1"> -S7/9 -S7: rng: "['0','9']" -------------------------------------------- -items.(*ItemSet).Next in itemset.go:159 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S7:rng="['0','9']" -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).Move in item.go:311 -items.(*ItemSet).Next in itemset.go:162 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_digit -*** Item: "_digit : '0'-'9'" - ** emoves: - <"_digit : • '0'-'9'">:move("['0','9']"):["_digit : '0'-'9' •"] -------------------------------------------- -items.(*ItemSet).dependentsClosure in itemset.go:190 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S7:dependentsClosure S7 - actual: { - _digit : '0'-'9' • - _x : (α | (β _digit {_digit})) • - _x : α | (β _digit {• _digit}) - id : _x {_x0 | _x1 | γ} • - id : _x {_x0 | _x1 | • γ} - id : _x {_x0 | • _x1 | γ} - id : _x {• _x0 | _x1 | γ} - id : • _x {_x0 | _x1 | γ} - _digit : • '0'-'9' - _x1 : • β _digit {_digit} - _x0 : • α -} -Transitions: - ['0','9'] -> S-1 - [α,α] -> S-1 - [β,β] -> S-1 - [γ,γ] -> S-1 -Symbols classes: {['0','9'], [α,α], [β,β], [γ,γ]} - - items: ["_digit : '0'-'9' •"] -------------------------------------------- -items.(*Item).MoveRegDefId in item.go:333 -items.(*ItemSet).dependentsClosure in itemset.go:195 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 - * moved item: - *ast.LexPattern:α | (β _digit {_digit}); pos 1 - *ast.LexAlt:(β _digit {_digit}); pos 0 - *ast.LexGroupPattern:(β _digit {_digit}); pos 0 - *ast.LexAlt:β _digit {_digit}; pos 2 - *ast.LexRepPattern:{_digit}; pos 0 - *ast.LexAlt:_digit; pos 1 - -was: - *ast.LexPattern:α | (β _digit {_digit}); pos 1 - *ast.LexAlt:(β _digit {_digit}); pos 0 - *ast.LexGroupPattern:(β _digit {_digit}); pos 0 - *ast.LexAlt:β _digit {_digit}; pos 2 - *ast.LexRepPattern:{_digit}; pos 0 - *ast.LexAlt:_digit; pos 0 -) -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).MoveRegDefId in item.go:334 -items.(*ItemSet).dependentsClosure in itemset.go:195 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_x -*** Item: "_x : \\u03b1 | (\\u03b2 _digit {_digit})" - ** emoves: -*** Item: "_x : \\u03b1 | (\\u03b2 _digit {_digit})" - ** emoves: -*** Item: "_x : \\u03b1 | (\\u03b2 _digit {_digit})" - ** emoves: -*** Item: "_x : \\u03b1 | (\\u03b2 _digit {_digit})" - ** emoves: -*** Item: "_x : \\u03b1 | (\\u03b2 _digit {_digit})" - ** emoves: -S7: ====> _x : (\u03b1 | (\u03b2 _digit {_digit})) • -S7: ====> _x : \u03b1 | (\u03b2 _digit {• _digit}) -------------------------------------------- -items.(*Item).MoveRegDefId in item.go:333 -items.(*ItemSet).dependentsClosure in itemset.go:199 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 - * moved item: - *ast.LexPattern:α | (β _digit {_digit}); pos 1 - *ast.LexAlt:(β _digit {_digit}); pos 0 - *ast.LexGroupPattern:(β _digit {_digit}); pos 0 - *ast.LexAlt:β _digit {_digit}; pos 2 - *ast.LexRepPattern:{_digit}; pos 0 - *ast.LexAlt:_digit; pos 1 - -was: - *ast.LexPattern:α | (β _digit {_digit}); pos 1 - *ast.LexAlt:(β _digit {_digit}); pos 0 - *ast.LexGroupPattern:(β _digit {_digit}); pos 0 - *ast.LexAlt:β _digit {_digit}; pos 2 - *ast.LexRepPattern:{_digit}; pos 0 - *ast.LexAlt:_digit; pos 0 -) -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).MoveRegDefId in item.go:334 -items.(*ItemSet).dependentsClosure in itemset.go:199 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_x -*** Item: "_x : \\u03b1 | (\\u03b2 _digit {_digit})" - ** emoves: -*** Item: "_x : \\u03b1 | (\\u03b2 _digit {_digit})" - ** emoves: -*** Item: "_x : \\u03b1 | (\\u03b2 _digit {_digit})" - ** emoves: -*** Item: "_x : \\u03b1 | (\\u03b2 _digit {_digit})" - ** emoves: -*** Item: "_x : \\u03b1 | (\\u03b2 _digit {_digit})" - ** emoves: -------------------------------------------- -items.(*Item).MoveRegDefId in item.go:333 -items.(*ItemSet).dependentsClosure in itemset.go:195 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 - * moved item: - *ast.LexPattern:_x {_x0 | _x1 | γ}; pos 0 - *ast.LexAlt:_x {_x0 | _x1 | γ}; pos 1 - -was: - *ast.LexPattern:_x {_x0 | _x1 | γ}; pos 0 - *ast.LexAlt:_x {_x0 | _x1 | γ}; pos 0 -) -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).MoveRegDefId in item.go:334 -items.(*ItemSet).dependentsClosure in itemset.go:195 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -id -*** Item: "id : _x • {_x0 | _x1 | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | _x1 | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | _x1 | \\u03b3}" - ** emoves: -S7: ====> id : _x {_x0 | _x1 | \u03b3} • -S7: ====> id : _x {_x0 | _x1 | • \u03b3} -S7: ====> id : _x {_x0 | • _x1 | \u03b3} -S7: ====> id : _x {• _x0 | _x1 | \u03b3} -------------------------------------------- -items.(*Item).MoveRegDefId in item.go:333 -items.(*ItemSet).dependentsClosure in itemset.go:199 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 - * moved item: - *ast.LexPattern:_x {_x0 | _x1 | γ}; pos 0 - *ast.LexAlt:_x {_x0 | _x1 | γ}; pos 1 - -was: - *ast.LexPattern:_x {_x0 | _x1 | γ}; pos 0 - *ast.LexAlt:_x {_x0 | _x1 | γ}; pos 0 -) -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).MoveRegDefId in item.go:334 -items.(*ItemSet).dependentsClosure in itemset.go:199 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -id -*** Item: "id : _x • {_x0 | _x1 | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | _x1 | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | _x1 | \\u03b3}" - ** emoves: -S7: ==> id : • _x {_x0 | _x1 | \u03b3} -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.ItemList.Closure in itemlist.go:80 -items.(*ItemSet).Next in itemset.go:165 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_digit -*** Item: "_digit : '0'-'9'" - ** emoves: -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.ItemList.Closure in itemlist.go:80 -items.(*ItemSet).Next in itemset.go:165 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_x1 -*** Item: "_x1 : \\u03b2 _digit {_digit}" - ** emoves: -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.ItemList.Closure in itemlist.go:80 -items.(*ItemSet).Next in itemset.go:165 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_x0 -*** Item: "_x0 : \\u03b1" - ** emoves: -S7: #0: <"_digit : '0'-'9' •"> -S7: #1: <"_x : (\\u03b1 | (\\u03b2 _digit {_digit})) •"> -S7: #2: <"_x : \\u03b1 | (\\u03b2 _digit {• _digit})"> -S7: #3: <"id : _x {_x0 | _x1 | \\u03b3} •"> -S7: #4: <"id : _x {_x0 | _x1 | • \\u03b3}"> -S7: #5: <"id : _x {_x0 | • _x1 | \\u03b3}"> -S7: #6: <"id : _x {• _x0 | _x1 | \\u03b3}"> -S7: #7: <"id : • _x {_x0 | _x1 | \\u03b3}"> -S7: #8: <"_digit : • '0'-'9'"> -S7: #9: <"_x1 : • \\u03b2 _digit {_digit}"> -S7: #10: <"_x0 : • \\u03b1"> -S7: rng: "[\\u03b1,\\u03b1]" -------------------------------------------- -items.(*ItemSet).Next in itemset.go:159 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S7:rng="[\\u03b1,\\u03b1]" -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).Move in item.go:311 -items.(*ItemSet).Next in itemset.go:162 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_x0 -*** Item: "_x0 : \\u03b1" - ** emoves: - <"_x0 : • \\u03b1">:move("[\\u03b1,\\u03b1]"):["_x0 : \\u03b1 •"] -------------------------------------------- -items.(*ItemSet).dependentsClosure in itemset.go:190 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S7:dependentsClosure S7 - actual: { - _digit : '0'-'9' • - _x : (α | (β _digit {_digit})) • - _x : α | (β _digit {• _digit}) - id : _x {_x0 | _x1 | γ} • - id : _x {_x0 | _x1 | • γ} - id : _x {_x0 | • _x1 | γ} - id : _x {• _x0 | _x1 | γ} - id : • _x {_x0 | _x1 | γ} - _digit : • '0'-'9' - _x1 : • β _digit {_digit} - _x0 : • α -} -Transitions: - ['0','9'] -> S7 - [α,α] -> S-1 - [β,β] -> S-1 - [γ,γ] -> S-1 -Symbols classes: {['0','9'], [α,α], [β,β], [γ,γ]} - - items: ["_x0 : \u03b1 •"] -------------------------------------------- -items.(*Item).MoveRegDefId in item.go:333 -items.(*ItemSet).dependentsClosure in itemset.go:195 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 - * moved item: - *ast.LexPattern:_x {_x0 | _x1 | γ}; pos 0 - *ast.LexAlt:_x {_x0 | _x1 | γ}; pos 1 - *ast.LexRepPattern:{_x0 | _x1 | γ}; pos 0 - *ast.LexAlt:_x0; pos 1 - -was: - *ast.LexPattern:_x {_x0 | _x1 | γ}; pos 0 - *ast.LexAlt:_x {_x0 | _x1 | γ}; pos 1 - *ast.LexRepPattern:{_x0 | _x1 | γ}; pos 0 - *ast.LexAlt:_x0; pos 0 -) -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).MoveRegDefId in item.go:334 -items.(*ItemSet).dependentsClosure in itemset.go:195 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -id -*** Item: "id : _x {_x0 | _x1 | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | _x1 | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | _x1 | \\u03b3}" - ** emoves: -S7: ====> id : _x {_x0 | _x1 | \u03b3} • -S7: ====> id : _x {_x0 | _x1 | • \u03b3} -S7: ====> id : _x {_x0 | • _x1 | \u03b3} -S7: ====> id : _x {• _x0 | _x1 | \u03b3} -------------------------------------------- -items.(*Item).MoveRegDefId in item.go:333 -items.(*ItemSet).dependentsClosure in itemset.go:199 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 - * moved item: - *ast.LexPattern:_x {_x0 | _x1 | γ}; pos 0 - *ast.LexAlt:_x {_x0 | _x1 | γ}; pos 1 - *ast.LexRepPattern:{_x0 | _x1 | γ}; pos 0 - *ast.LexAlt:_x0; pos 1 - -was: - *ast.LexPattern:_x {_x0 | _x1 | γ}; pos 0 - *ast.LexAlt:_x {_x0 | _x1 | γ}; pos 1 - *ast.LexRepPattern:{_x0 | _x1 | γ}; pos 0 - *ast.LexAlt:_x0; pos 0 -) -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).MoveRegDefId in item.go:334 -items.(*ItemSet).dependentsClosure in itemset.go:199 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -id -*** Item: "id : _x {_x0 | _x1 | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | _x1 | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | _x1 | \\u03b3}" - ** emoves: -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.ItemList.Closure in itemlist.go:80 -items.(*ItemSet).Next in itemset.go:165 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_x1 -*** Item: "_x1 : \\u03b2 _digit {_digit}" - ** emoves: -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.ItemList.Closure in itemlist.go:80 -items.(*ItemSet).Next in itemset.go:165 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_x0 -*** Item: "_x0 : \\u03b1" - ** emoves: -S7: #0: <"_x0 : \\u03b1 •"> -S7: #1: <"id : _x {_x0 | _x1 | \\u03b3} •"> -S7: #2: <"id : _x {_x0 | _x1 | • \\u03b3}"> -S7: #3: <"id : _x {_x0 | • _x1 | \\u03b3}"> -S7: #4: <"id : _x {• _x0 | _x1 | \\u03b3}"> -S7: #5: <"_x1 : • \\u03b2 _digit {_digit}"> -S7: #6: <"_x0 : • \\u03b1"> -S7: rng: "[\\u03b2,\\u03b2]" -------------------------------------------- -items.(*ItemSet).Next in itemset.go:159 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S7:rng="[\\u03b2,\\u03b2]" -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).Move in item.go:311 -items.(*ItemSet).Next in itemset.go:162 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_x1 - <"_x1 : • \\u03b2 _digit {_digit}">:move("[\\u03b2,\\u03b2]"):["_x1 : \\u03b2 • _digit {_digit}"] -------------------------------------------- -items.(*ItemSet).dependentsClosure in itemset.go:190 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S7:dependentsClosure S7 - actual: { - _digit : '0'-'9' • - _x : (α | (β _digit {_digit})) • - _x : α | (β _digit {• _digit}) - id : _x {_x0 | _x1 | γ} • - id : _x {_x0 | _x1 | • γ} - id : _x {_x0 | • _x1 | γ} - id : _x {• _x0 | _x1 | γ} - id : • _x {_x0 | _x1 | γ} - _digit : • '0'-'9' - _x1 : • β _digit {_digit} - _x0 : • α -} -Transitions: - ['0','9'] -> S7 - [α,α] -> S4 - [β,β] -> S-1 - [γ,γ] -> S-1 -Symbols classes: {['0','9'], [α,α], [β,β], [γ,γ]} - - items: ["_x1 : \u03b2 • _digit {_digit}"] -S7: ==> id : _x {_x0 | • _x1 | \u03b3} -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.ItemList.Closure in itemlist.go:80 -items.(*ItemSet).Next in itemset.go:165 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_digit -*** Item: "_digit : '0'-'9'" - ** emoves: -S7: #0: <"_x1 : \\u03b2 • _digit {_digit}"> -S7: #1: <"id : _x {_x0 | • _x1 | \\u03b3}"> -S7: #2: <"_digit : • '0'-'9'"> -S7: rng: "[\\u03b3,\\u03b3]" -------------------------------------------- -items.(*ItemSet).Next in itemset.go:159 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S7:rng="[\\u03b3,\\u03b3]" -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).Move in item.go:311 -items.(*ItemSet).Next in itemset.go:162 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -id -*** Item: "id : _x {_x0 | _x1 | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | _x1 | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | _x1 | \\u03b3}" - ** emoves: - <"id : _x {_x0 | _x1 | • \\u03b3}">:move("[\\u03b3,\\u03b3]"):["id : _x {_x0 | _x1 | \\u03b3} •" "id : _x {_x0 | _x1 | • \\u03b3}" "id : _x {_x0 | • _x1 | \\u03b3}" "id : _x {• _x0 | _x1 | \\u03b3}"] -------------------------------------------- -items.(*ItemSet).dependentsClosure in itemset.go:190 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S7:dependentsClosure S7 - actual: { - _digit : '0'-'9' • - _x : (α | (β _digit {_digit})) • - _x : α | (β _digit {• _digit}) - id : _x {_x0 | _x1 | γ} • - id : _x {_x0 | _x1 | • γ} - id : _x {_x0 | • _x1 | γ} - id : _x {• _x0 | _x1 | γ} - id : • _x {_x0 | _x1 | γ} - _digit : • '0'-'9' - _x1 : • β _digit {_digit} - _x0 : • α -} -Transitions: - ['0','9'] -> S7 - [α,α] -> S4 - [β,β] -> S5 - [γ,γ] -> S-1 -Symbols classes: {['0','9'], [α,α], [β,β], [γ,γ]} - - items: ["id : _x {_x0 | _x1 | \u03b3} •" "id : _x {_x0 | _x1 | • \u03b3}" "id : _x {_x0 | • _x1 | \u03b3}" "id : _x {• _x0 | _x1 | \u03b3}"] -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.ItemList.Closure in itemlist.go:80 -items.(*ItemSet).Next in itemset.go:165 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_x1 -*** Item: "_x1 : \\u03b2 _digit {_digit}" - ** emoves: -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.ItemList.Closure in itemlist.go:80 -items.(*ItemSet).Next in itemset.go:165 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_x0 -*** Item: "_x0 : \\u03b1" - ** emoves: -S7: #0: <"id : _x {_x0 | _x1 | \\u03b3} •"> -S7: #1: <"id : _x {_x0 | _x1 | • \\u03b3}"> -S7: #2: <"id : _x {_x0 | • _x1 | \\u03b3}"> -S7: #3: <"id : _x {• _x0 | _x1 | \\u03b3}"> -S7: #4: <"_x1 : • \\u03b2 _digit {_digit}"> -S7: #5: <"_x0 : • \\u03b1"> -S8/9 -S8: rng: "['0','9']" -------------------------------------------- -items.(*ItemSet).Next in itemset.go:159 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S8:rng="['0','9']" -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).Move in item.go:311 -items.(*ItemSet).Next in itemset.go:162 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_digit -*** Item: "_digit : '0'-'9'" - ** emoves: - <"_digit : • '0'-'9'">:move("['0','9']"):["_digit : '0'-'9' •"] -------------------------------------------- -items.(*ItemSet).dependentsClosure in itemset.go:190 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S8:dependentsClosure S8 - actual: { - _digit : '0'-'9' • - _x1 : β _digit {_digit} • - _x1 : β _digit {• _digit} - id : _x {_x0 | _x1 | γ} • - id : _x {_x0 | _x1 | • γ} - id : _x {_x0 | • _x1 | γ} - id : _x {• _x0 | _x1 | γ} - _digit : • '0'-'9' - _x0 : • α -} -Transitions: - ['0','9'] -> S-1 - [α,α] -> S-1 - [γ,γ] -> S-1 -Symbols classes: {['0','9'], [α,α], [γ,γ]} - - items: ["_digit : '0'-'9' •"] -------------------------------------------- -items.(*Item).MoveRegDefId in item.go:333 -items.(*ItemSet).dependentsClosure in itemset.go:195 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 - * moved item: - *ast.LexPattern:β _digit {_digit}; pos 0 - *ast.LexAlt:β _digit {_digit}; pos 2 - *ast.LexRepPattern:{_digit}; pos 0 - *ast.LexAlt:_digit; pos 1 - -was: - *ast.LexPattern:β _digit {_digit}; pos 0 - *ast.LexAlt:β _digit {_digit}; pos 2 - *ast.LexRepPattern:{_digit}; pos 0 - *ast.LexAlt:_digit; pos 0 -) -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).MoveRegDefId in item.go:334 -items.(*ItemSet).dependentsClosure in itemset.go:195 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_x1 -*** Item: "_x1 : \\u03b2 _digit {_digit}" - ** emoves: -*** Item: "_x1 : \\u03b2 _digit {_digit}" - ** emoves: -*** Item: "_x1 : \\u03b2 _digit {_digit}" - ** emoves: -S8: ====> _x1 : \u03b2 _digit {_digit} • -S8: ====> _x1 : \u03b2 _digit {• _digit} -------------------------------------------- -items.(*Item).MoveRegDefId in item.go:333 -items.(*ItemSet).dependentsClosure in itemset.go:199 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 - * moved item: - *ast.LexPattern:β _digit {_digit}; pos 0 - *ast.LexAlt:β _digit {_digit}; pos 2 - *ast.LexRepPattern:{_digit}; pos 0 - *ast.LexAlt:_digit; pos 1 - -was: - *ast.LexPattern:β _digit {_digit}; pos 0 - *ast.LexAlt:β _digit {_digit}; pos 2 - *ast.LexRepPattern:{_digit}; pos 0 - *ast.LexAlt:_digit; pos 0 -) -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).MoveRegDefId in item.go:334 -items.(*ItemSet).dependentsClosure in itemset.go:199 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_x1 -*** Item: "_x1 : \\u03b2 _digit {_digit}" - ** emoves: -*** Item: "_x1 : \\u03b2 _digit {_digit}" - ** emoves: -*** Item: "_x1 : \\u03b2 _digit {_digit}" - ** emoves: -------------------------------------------- -items.(*Item).MoveRegDefId in item.go:333 -items.(*ItemSet).dependentsClosure in itemset.go:195 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 - * moved item: - *ast.LexPattern:_x {_x0 | _x1 | γ}; pos 0 - *ast.LexAlt:_x {_x0 | _x1 | γ}; pos 1 - *ast.LexRepPattern:{_x0 | _x1 | γ}; pos 1 - *ast.LexAlt:_x1; pos 1 - -was: - *ast.LexPattern:_x {_x0 | _x1 | γ}; pos 0 - *ast.LexAlt:_x {_x0 | _x1 | γ}; pos 1 - *ast.LexRepPattern:{_x0 | _x1 | γ}; pos 1 - *ast.LexAlt:_x1; pos 0 -) -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).MoveRegDefId in item.go:334 -items.(*ItemSet).dependentsClosure in itemset.go:195 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -id -*** Item: "id : _x {_x0 | _x1 | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | _x1 | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | _x1 | \\u03b3}" - ** emoves: -S8: ====> id : _x {_x0 | _x1 | \u03b3} • -S8: ====> id : _x {_x0 | _x1 | • \u03b3} -S8: ====> id : _x {_x0 | • _x1 | \u03b3} -S8: ====> id : _x {• _x0 | _x1 | \u03b3} -------------------------------------------- -items.(*Item).MoveRegDefId in item.go:333 -items.(*ItemSet).dependentsClosure in itemset.go:199 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 - * moved item: - *ast.LexPattern:_x {_x0 | _x1 | γ}; pos 0 - *ast.LexAlt:_x {_x0 | _x1 | γ}; pos 1 - *ast.LexRepPattern:{_x0 | _x1 | γ}; pos 1 - *ast.LexAlt:_x1; pos 1 - -was: - *ast.LexPattern:_x {_x0 | _x1 | γ}; pos 0 - *ast.LexAlt:_x {_x0 | _x1 | γ}; pos 1 - *ast.LexRepPattern:{_x0 | _x1 | γ}; pos 1 - *ast.LexAlt:_x1; pos 0 -) -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).MoveRegDefId in item.go:334 -items.(*ItemSet).dependentsClosure in itemset.go:199 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -id -*** Item: "id : _x {_x0 | _x1 | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | _x1 | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | _x1 | \\u03b3}" - ** emoves: -S8: ==> id : _x {_x0 | • _x1 | \u03b3} -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.ItemList.Closure in itemlist.go:80 -items.(*ItemSet).Next in itemset.go:165 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_digit -*** Item: "_digit : '0'-'9'" - ** emoves: -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.ItemList.Closure in itemlist.go:80 -items.(*ItemSet).Next in itemset.go:165 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_x0 -*** Item: "_x0 : \\u03b1" - ** emoves: -S8: #0: <"_digit : '0'-'9' •"> -S8: #1: <"_x1 : \\u03b2 _digit {_digit} •"> -S8: #2: <"_x1 : \\u03b2 _digit {• _digit}"> -S8: #3: <"id : _x {_x0 | _x1 | \\u03b3} •"> -S8: #4: <"id : _x {_x0 | _x1 | • \\u03b3}"> -S8: #5: <"id : _x {_x0 | • _x1 | \\u03b3}"> -S8: #6: <"id : _x {• _x0 | _x1 | \\u03b3}"> -S8: #7: <"_digit : • '0'-'9'"> -S8: #8: <"_x0 : • \\u03b1"> -S8: rng: "[\\u03b1,\\u03b1]" -------------------------------------------- -items.(*ItemSet).Next in itemset.go:159 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S8:rng="[\\u03b1,\\u03b1]" -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).Move in item.go:311 -items.(*ItemSet).Next in itemset.go:162 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_x0 -*** Item: "_x0 : \\u03b1" - ** emoves: - <"_x0 : • \\u03b1">:move("[\\u03b1,\\u03b1]"):["_x0 : \\u03b1 •"] -------------------------------------------- -items.(*ItemSet).dependentsClosure in itemset.go:190 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S8:dependentsClosure S8 - actual: { - _digit : '0'-'9' • - _x1 : β _digit {_digit} • - _x1 : β _digit {• _digit} - id : _x {_x0 | _x1 | γ} • - id : _x {_x0 | _x1 | • γ} - id : _x {_x0 | • _x1 | γ} - id : _x {• _x0 | _x1 | γ} - _digit : • '0'-'9' - _x0 : • α -} -Transitions: - ['0','9'] -> S8 - [α,α] -> S-1 - [γ,γ] -> S-1 -Symbols classes: {['0','9'], [α,α], [γ,γ]} - - items: ["_x0 : \u03b1 •"] -------------------------------------------- -items.(*Item).MoveRegDefId in item.go:333 -items.(*ItemSet).dependentsClosure in itemset.go:195 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 - * moved item: - *ast.LexPattern:_x {_x0 | _x1 | γ}; pos 0 - *ast.LexAlt:_x {_x0 | _x1 | γ}; pos 1 - *ast.LexRepPattern:{_x0 | _x1 | γ}; pos 0 - *ast.LexAlt:_x0; pos 1 - -was: - *ast.LexPattern:_x {_x0 | _x1 | γ}; pos 0 - *ast.LexAlt:_x {_x0 | _x1 | γ}; pos 1 - *ast.LexRepPattern:{_x0 | _x1 | γ}; pos 0 - *ast.LexAlt:_x0; pos 0 -) -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).MoveRegDefId in item.go:334 -items.(*ItemSet).dependentsClosure in itemset.go:195 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -id -*** Item: "id : _x {_x0 | _x1 | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | _x1 | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | _x1 | \\u03b3}" - ** emoves: -S8: ====> id : _x {_x0 | _x1 | \u03b3} • -S8: ====> id : _x {_x0 | _x1 | • \u03b3} -S8: ====> id : _x {_x0 | • _x1 | \u03b3} -S8: ====> id : _x {• _x0 | _x1 | \u03b3} -------------------------------------------- -items.(*Item).MoveRegDefId in item.go:333 -items.(*ItemSet).dependentsClosure in itemset.go:199 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 - * moved item: - *ast.LexPattern:_x {_x0 | _x1 | γ}; pos 0 - *ast.LexAlt:_x {_x0 | _x1 | γ}; pos 1 - *ast.LexRepPattern:{_x0 | _x1 | γ}; pos 0 - *ast.LexAlt:_x0; pos 1 - -was: - *ast.LexPattern:_x {_x0 | _x1 | γ}; pos 0 - *ast.LexAlt:_x {_x0 | _x1 | γ}; pos 1 - *ast.LexRepPattern:{_x0 | _x1 | γ}; pos 0 - *ast.LexAlt:_x0; pos 0 -) -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).MoveRegDefId in item.go:334 -items.(*ItemSet).dependentsClosure in itemset.go:199 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -id -*** Item: "id : _x {_x0 | _x1 | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | _x1 | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | _x1 | \\u03b3}" - ** emoves: -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.ItemList.Closure in itemlist.go:80 -items.(*ItemSet).Next in itemset.go:165 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_x1 -*** Item: "_x1 : \\u03b2 _digit {_digit}" - ** emoves: -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.ItemList.Closure in itemlist.go:80 -items.(*ItemSet).Next in itemset.go:165 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_x0 -*** Item: "_x0 : \\u03b1" - ** emoves: -S8: #0: <"_x0 : \\u03b1 •"> -S8: #1: <"id : _x {_x0 | _x1 | \\u03b3} •"> -S8: #2: <"id : _x {_x0 | _x1 | • \\u03b3}"> -S8: #3: <"id : _x {_x0 | • _x1 | \\u03b3}"> -S8: #4: <"id : _x {• _x0 | _x1 | \\u03b3}"> -S8: #5: <"_x1 : • \\u03b2 _digit {_digit}"> -S8: #6: <"_x0 : • \\u03b1"> -S8: rng: "[\\u03b3,\\u03b3]" -------------------------------------------- -items.(*ItemSet).Next in itemset.go:159 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S8:rng="[\\u03b3,\\u03b3]" -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).Move in item.go:311 -items.(*ItemSet).Next in itemset.go:162 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -id -*** Item: "id : _x {_x0 | _x1 | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | _x1 | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | _x1 | \\u03b3}" - ** emoves: - <"id : _x {_x0 | _x1 | • \\u03b3}">:move("[\\u03b3,\\u03b3]"):["id : _x {_x0 | _x1 | \\u03b3} •" "id : _x {_x0 | _x1 | • \\u03b3}" "id : _x {_x0 | • _x1 | \\u03b3}" "id : _x {• _x0 | _x1 | \\u03b3}"] -------------------------------------------- -items.(*ItemSet).dependentsClosure in itemset.go:190 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S8:dependentsClosure S8 - actual: { - _digit : '0'-'9' • - _x1 : β _digit {_digit} • - _x1 : β _digit {• _digit} - id : _x {_x0 | _x1 | γ} • - id : _x {_x0 | _x1 | • γ} - id : _x {_x0 | • _x1 | γ} - id : _x {• _x0 | _x1 | γ} - _digit : • '0'-'9' - _x0 : • α -} -Transitions: - ['0','9'] -> S8 - [α,α] -> S4 - [γ,γ] -> S-1 -Symbols classes: {['0','9'], [α,α], [γ,γ]} - - items: ["id : _x {_x0 | _x1 | \u03b3} •" "id : _x {_x0 | _x1 | • \u03b3}" "id : _x {_x0 | • _x1 | \u03b3}" "id : _x {• _x0 | _x1 | \u03b3}"] -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.ItemList.Closure in itemlist.go:80 -items.(*ItemSet).Next in itemset.go:165 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_x1 -*** Item: "_x1 : \\u03b2 _digit {_digit}" - ** emoves: -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.ItemList.Closure in itemlist.go:80 -items.(*ItemSet).Next in itemset.go:165 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_x0 -*** Item: "_x0 : \\u03b1" - ** emoves: -S8: #0: <"id : _x {_x0 | _x1 | \\u03b3} •"> -S8: #1: <"id : _x {_x0 | _x1 | • \\u03b3}"> -S8: #2: <"id : _x {_x0 | • _x1 | \\u03b3}"> -S8: #3: <"id : _x {• _x0 | _x1 | \\u03b3}"> -S8: #4: <"_x1 : • \\u03b2 _digit {_digit}"> -S8: #5: <"_x0 : • \\u03b1"> +-bugs = lexer_dots:fix,lexer_regdefs:fix diff --git a/example/ctx/ctx1.bnf b/example/ctx/ctx1.bnf index b6a354ed..5ebf3116 100644 --- a/example/ctx/ctx1.bnf +++ b/example/ctx/ctx1.bnf @@ -40,6 +40,6 @@ Stmt : id << ast.NewStmt($0e) >> | @ "github.com/maxcalandrelli/gocc/example/calc/calc.grammar/calc" - << ast.CalcResult($2) >> + << ast.CalcResult($1) >> ; diff --git a/example/ctx/ctx1.grammar/ctx1/internal/lexer/acttab.go b/example/ctx/ctx1.grammar/ctx1/internal/lexer/acttab.go index a6be1878..1fd95a3b 100644 --- a/example/ctx/ctx1.grammar/ctx1/internal/lexer/acttab.go +++ b/example/ctx/ctx1.grammar/ctx1/internal/lexer/acttab.go @@ -56,4 +56,16 @@ var ActTab = ActionTable{ Accept: 2, Ignore: "", }, + ActionRow{ // S9, Accept("id") + Accept: 2, + Ignore: "", + }, + ActionRow{ // S10, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S11, Accept("id") + Accept: 2, + Ignore: "", + }, } diff --git a/example/ctx/ctx1.grammar/ctx1/internal/lexer/lexer.go b/example/ctx/ctx1.grammar/ctx1/internal/lexer/lexer.go index 3d40a8fb..e8534677 100644 --- a/example/ctx/ctx1.grammar/ctx1/internal/lexer/lexer.go +++ b/example/ctx/ctx1.grammar/ctx1/internal/lexer/lexer.go @@ -16,7 +16,7 @@ import ( const ( NoState = -1 - NumStates = 9 + NumStates = 12 NumSymbols = 20 INVALID_RUNE = rune(-1) ) diff --git a/example/ctx/ctx1.grammar/ctx1/internal/lexer/transitiontable.go b/example/ctx/ctx1.grammar/ctx1/internal/lexer/transitiontable.go index dc68141f..5a483049 100644 --- a/example/ctx/ctx1.grammar/ctx1/internal/lexer/transitiontable.go +++ b/example/ctx/ctx1.grammar/ctx1/internal/lexer/transitiontable.go @@ -92,9 +92,9 @@ var TransTab = TransitionTable{ case 48 <= r && r <= 57: // ['0','9'] return 7 case r == 945: // [\u03b1,\u03b1] - return 4 + return 9 case r == 946: // [\u03b2,\u03b2] - return 5 + return 10 case r == 947: // [\u03b3,\u03b3] return 6 } @@ -114,4 +114,38 @@ var TransTab = TransitionTable{ } return NoState }, + // S9 + func(r rune) int { + switch { + case r == 945: // [\u03b1,\u03b1] + return 4 + case r == 946: // [\u03b2,\u03b2] + return 5 + case r == 947: // [\u03b3,\u03b3] + return 6 + } + return NoState + }, + // S10 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 11 + } + return NoState + }, + // S11 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 11 + case r == 945: // [\u03b1,\u03b1] + return 9 + case r == 946: // [\u03b2,\u03b2] + return 10 + case r == 947: // [\u03b3,\u03b3] + return 6 + } + return NoState + }, } diff --git a/example/ctx/ctx1.grammar/ctx1/internal/parser/actiontable.go b/example/ctx/ctx1.grammar/ctx1/internal/parser/actiontable.go index c3f71e31..10941d48 100644 --- a/example/ctx/ctx1.grammar/ctx1/internal/parser/actiontable.go +++ b/example/ctx/ctx1.grammar/ctx1/internal/parser/actiontable.go @@ -53,7 +53,9 @@ var parserActions = actions{ reduce(1), // id, reduce: StmtList reduce(1), // μ, reduce: StmtList }, - cdActions: []cdAction{}, + cdActions: []cdAction{ + cdAction{tokenIndex: 3, tokenScanner: cdFunc_calc_0}, + }, }, actionRow{ // S3 canRecover: false, @@ -63,7 +65,9 @@ var parserActions = actions{ reduce(3), // id, reduce: Stmt reduce(3), // μ, reduce: Stmt }, - cdActions: []cdAction{}, + cdActions: []cdAction{ + cdAction{tokenIndex: 3, tokenScanner: cdFunc_calc_0}, + }, }, actionRow{ // S4 canRecover: false, @@ -73,7 +77,9 @@ var parserActions = actions{ reduce(4), // id, reduce: Stmt reduce(4), // μ, reduce: Stmt }, - cdActions: []cdAction{}, + cdActions: []cdAction{ + cdAction{tokenIndex: 3, tokenScanner: cdFunc_calc_0}, + }, }, actionRow{ // S5 canRecover: false, @@ -83,7 +89,9 @@ var parserActions = actions{ reduce(2), // id, reduce: StmtList reduce(2), // μ, reduce: StmtList }, - cdActions: []cdAction{}, + cdActions: []cdAction{ + cdAction{tokenIndex: 3, tokenScanner: cdFunc_calc_0}, + }, }, }, } diff --git a/example/ctx/ctx1.grammar/ctx1/internal/parser/productionstable.go b/example/ctx/ctx1.grammar/ctx1/internal/parser/productionstable.go index 4426615e..8c41014c 100644 --- a/example/ctx/ctx1.grammar/ctx1/internal/parser/productionstable.go +++ b/example/ctx/ctx1.grammar/ctx1/internal/parser/productionstable.go @@ -97,13 +97,13 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `Stmt : μ << ast.CalcResult($2) >>`, + String: `Stmt : μ << ast.CalcResult($1) >>`, Id: "Stmt", NTType: 2, Index: 4, NumSymbols: 2, ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { - return ast.CalcResult(X[2]) + return ast.CalcResult(X[1]) }, }, } diff --git a/example/ctx/ctx1.grammar/ctx1/log/lexer_sets.txt b/example/ctx/ctx1.grammar/ctx1/log/lexer_sets.txt index 1e59feec..05967fdb 100644 --- a/example/ctx/ctx1.grammar/ctx1/log/lexer_sets.txt +++ b/example/ctx/ctx1.grammar/ctx1/log/lexer_sets.txt @@ -93,6 +93,8 @@ S7{ _digit : • '0'-'9' _x : (\u03b1 | (\u03b2 _digit {_digit})) • _x : \u03b1 | (\u03b2 _digit {• _digit}) + _x : \u03b1 | (• \u03b2 _digit {_digit}) + _x : • \u03b1 | (\u03b2 _digit {_digit}) _x0 : • \u03b1 id : _x {_x0 | (\u03b2 _digit {_digit}) | \u03b3} • id : _x {_x0 | (\u03b2 _digit {_digit}) | • \u03b3} @@ -102,8 +104,8 @@ S7{ } Transitions: ['0','9'] -> S7 - [\u03b1,\u03b1] -> S4 - [\u03b2,\u03b2] -> S5 + [\u03b1,\u03b1] -> S9 + [\u03b2,\u03b2] -> S10 [\u03b3,\u03b3] -> S6 Action: Accept("id") Symbols classes: {['0','9'], [\u03b1,\u03b1], [\u03b2,\u03b2], [\u03b3,\u03b3]} @@ -126,3 +128,53 @@ Transitions: Action: Accept("id") Symbols classes: {['0','9'], [\u03b1,\u03b1], [\u03b2,\u03b2], [\u03b3,\u03b3]} +S9{ + _x : (\u03b1 | (\u03b2 _digit {_digit})) • + _x0 : \u03b1 • + _x0 : • \u03b1 + id : _x {_x0 | (\u03b2 _digit {_digit}) | \u03b3} • + id : _x {_x0 | (\u03b2 _digit {_digit}) | • \u03b3} + id : _x {_x0 | (• \u03b2 _digit {_digit}) | \u03b3} + id : _x {• _x0 | (\u03b2 _digit {_digit}) | \u03b3} +} +Transitions: + [\u03b1,\u03b1] -> S4 + [\u03b2,\u03b2] -> S5 + [\u03b3,\u03b3] -> S6 +Action: Accept("id") +Symbols classes: {[\u03b1,\u03b1], [\u03b2,\u03b2], [\u03b3,\u03b3]} + +S10{ + _digit : • '0'-'9' + _x : \u03b1 | (\u03b2 • _digit {_digit}) + id : _x {_x0 | (\u03b2 • _digit {_digit}) | \u03b3} + id : • _x {_x0 | (\u03b2 _digit {_digit}) | \u03b3} +} +Transitions: + ['0','9'] -> S11 +Action: nil +Symbols classes: {['0','9']} + +S11{ + _digit : '0'-'9' • + _digit : • '0'-'9' + _x : (\u03b1 | (\u03b2 _digit {_digit})) • + _x : \u03b1 | (\u03b2 _digit {• _digit}) + _x : \u03b1 | (• \u03b2 _digit {_digit}) + _x : • \u03b1 | (\u03b2 _digit {_digit}) + _x0 : • \u03b1 + id : _x {_x0 | (\u03b2 _digit {_digit}) | \u03b3} • + id : _x {_x0 | (\u03b2 _digit {_digit}) | • \u03b3} + id : _x {_x0 | (\u03b2 _digit {• _digit}) | \u03b3} + id : _x {_x0 | (• \u03b2 _digit {_digit}) | \u03b3} + id : _x {• _x0 | (\u03b2 _digit {_digit}) | \u03b3} + id : • _x {_x0 | (\u03b2 _digit {_digit}) | \u03b3} +} +Transitions: + ['0','9'] -> S11 + [\u03b1,\u03b1] -> S9 + [\u03b2,\u03b2] -> S10 + [\u03b3,\u03b3] -> S6 +Action: Accept("id") +Symbols classes: {['0','9'], [\u03b1,\u03b1], [\u03b2,\u03b2], [\u03b3,\u03b3]} + diff --git a/example/ctx/ctx1.log b/example/ctx/ctx1.log index 29ece9bf..4e4170a5 100644 --- a/example/ctx/ctx1.log +++ b/example/ctx/ctx1.log @@ -1,4 +1,4 @@ -gocc version 1.3.0001 +gocc version 2.1.0001 -a = true -debug_lexer = false -debug_parser = false @@ -9,2477 +9,4 @@ gocc version 1.3.0001 -u = false -v = true -internal = internal -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.ItemsSet0 in itemset.go:62 -items.GetItemSets in itemsets.go:39 -id -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.ItemsSet0 in itemset.go:62 -items.GetItemSets in itemsets.go:39 -!whitespace -*** Item: "!whitespace : ' ' | '\\t' | '\\n' | '\\r'" - ** emoves: -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.ItemList.Closure in itemlist.go:80 -items.NewItemSet in itemset.go:46 -items.(*ItemSets).Add in itemsets.go:49 -items.GetItemSets in itemsets.go:39 -_x -*** Item: "_x : \\u03b1 | (\\u03b2 _digit {_digit})" - ** emoves: -*** Item: "_x : \\u03b1 | • (\\u03b2 _digit {_digit})" - ** emoves: -*** Item: "_x : \\u03b1 | (\\u03b2 _digit {_digit})" - ** emoves: -------------------------------------------- -items.(*ItemSets).Closure in itemsets.go:54 -items.GetItemSets in itemsets.go:41 -S0/1 -S0: rng: "['\\t','\\t']" -------------------------------------------- -items.(*ItemSet).Next in itemset.go:159 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S0:rng="['\\t','\\t']" -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).Move in item.go:311 -items.(*ItemSet).Next in itemset.go:162 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -!whitespace -*** Item: "!whitespace : ' ' | '\\t' | '\\n' | '\\r'" - ** emoves: - <"!whitespace : ' ' | • '\\t' | '\\n' | '\\r'">:move("['\\t','\\t']"):["!whitespace : (' ' | '\\t' | '\\n' | '\\r') •"] -------------------------------------------- -items.(*ItemSet).dependentsClosure in itemset.go:190 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S0:dependentsClosure S0 - actual: { - id : • _x {_x0 | (β _digit {_digit}) | γ} - !whitespace : ' ' | ' ' | ' -' | • ' ' - !whitespace : ' ' | ' ' | • ' -' | ' ' - !whitespace : ' ' | • ' ' | ' -' | ' ' - !whitespace : • ' ' | ' ' | ' -' | ' ' - _x : α | (• β _digit {_digit}) - _x : • α | (β _digit {_digit}) -} -Transitions: - [' ',' '] -> S-1 - [' -',' -'] -> S-1 - [' ',' '] -> S-1 - [' ',' '] -> S-1 - [α,α] -> S-1 - [β,β] -> S-1 -Symbols classes: {[' ',' '], [' -',' -'], [' ',' '], [' ',' '], [α,α], [β,β]} - - items: ["!whitespace : (' ' | '\t' | '\n' | '\r') •"] -S0: #0: <"!whitespace : (' ' | '\\t' | '\\n' | '\\r') •"> -S0: rng: "['\\n','\\n']" -------------------------------------------- -items.(*ItemSet).Next in itemset.go:159 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S0:rng="['\\n','\\n']" -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).Move in item.go:311 -items.(*ItemSet).Next in itemset.go:162 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -!whitespace -*** Item: "!whitespace : ' ' | '\\t' | '\\n' | '\\r'" - ** emoves: - <"!whitespace : ' ' | '\\t' | • '\\n' | '\\r'">:move("['\\n','\\n']"):["!whitespace : (' ' | '\\t' | '\\n' | '\\r') •"] -------------------------------------------- -items.(*ItemSet).dependentsClosure in itemset.go:190 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S0:dependentsClosure S0 - actual: { - id : • _x {_x0 | (β _digit {_digit}) | γ} - !whitespace : ' ' | ' ' | ' -' | • ' ' - !whitespace : ' ' | ' ' | • ' -' | ' ' - !whitespace : ' ' | • ' ' | ' -' | ' ' - !whitespace : • ' ' | ' ' | ' -' | ' ' - _x : α | (• β _digit {_digit}) - _x : • α | (β _digit {_digit}) -} -Transitions: - [' ',' '] -> S1 - [' -',' -'] -> S-1 - [' ',' '] -> S-1 - [' ',' '] -> S-1 - [α,α] -> S-1 - [β,β] -> S-1 -Symbols classes: {[' ',' '], [' -',' -'], [' ',' '], [' ',' '], [α,α], [β,β]} - - items: ["!whitespace : (' ' | '\t' | '\n' | '\r') •"] -S0: #0: <"!whitespace : (' ' | '\\t' | '\\n' | '\\r') •"> -S0: rng: "['\\r','\\r']" -------------------------------------------- -items.(*ItemSet).Next in itemset.go:159 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S0:rng="['\\r','\\r']" -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).Move in item.go:311 -items.(*ItemSet).Next in itemset.go:162 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -!whitespace -*** Item: "!whitespace : ' ' | '\\t' | '\\n' | '\\r'" - ** emoves: - <"!whitespace : ' ' | '\\t' | '\\n' | • '\\r'">:move("['\\r','\\r']"):["!whitespace : (' ' | '\\t' | '\\n' | '\\r') •"] -------------------------------------------- -items.(*ItemSet).dependentsClosure in itemset.go:190 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S0:dependentsClosure S0 - actual: { - id : • _x {_x0 | (β _digit {_digit}) | γ} - !whitespace : ' ' | ' ' | ' -' | • ' ' - !whitespace : ' ' | ' ' | • ' -' | ' ' - !whitespace : ' ' | • ' ' | ' -' | ' ' - !whitespace : • ' ' | ' ' | ' -' | ' ' - _x : α | (• β _digit {_digit}) - _x : • α | (β _digit {_digit}) -} -Transitions: - [' ',' '] -> S1 - [' -',' -'] -> S1 - [' ',' '] -> S-1 - [' ',' '] -> S-1 - [α,α] -> S-1 - [β,β] -> S-1 -Symbols classes: {[' ',' '], [' -',' -'], [' ',' '], [' ',' '], [α,α], [β,β]} - - items: ["!whitespace : (' ' | '\t' | '\n' | '\r') •"] -S0: #0: <"!whitespace : (' ' | '\\t' | '\\n' | '\\r') •"> -S0: rng: "[' ',' ']" -------------------------------------------- -items.(*ItemSet).Next in itemset.go:159 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S0:rng="[' ',' ']" -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).Move in item.go:311 -items.(*ItemSet).Next in itemset.go:162 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -!whitespace -*** Item: "!whitespace : ' ' | '\\t' | '\\n' | '\\r'" - ** emoves: - <"!whitespace : • ' ' | '\\t' | '\\n' | '\\r'">:move("[' ',' ']"):["!whitespace : (' ' | '\\t' | '\\n' | '\\r') •"] -------------------------------------------- -items.(*ItemSet).dependentsClosure in itemset.go:190 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S0:dependentsClosure S0 - actual: { - id : • _x {_x0 | (β _digit {_digit}) | γ} - !whitespace : ' ' | ' ' | ' -' | • ' ' - !whitespace : ' ' | ' ' | • ' -' | ' ' - !whitespace : ' ' | • ' ' | ' -' | ' ' - !whitespace : • ' ' | ' ' | ' -' | ' ' - _x : α | (• β _digit {_digit}) - _x : • α | (β _digit {_digit}) -} -Transitions: - [' ',' '] -> S1 - [' -',' -'] -> S1 - [' ',' '] -> S1 - [' ',' '] -> S-1 - [α,α] -> S-1 - [β,β] -> S-1 -Symbols classes: {[' ',' '], [' -',' -'], [' ',' '], [' ',' '], [α,α], [β,β]} - - items: ["!whitespace : (' ' | '\t' | '\n' | '\r') •"] -S0: #0: <"!whitespace : (' ' | '\\t' | '\\n' | '\\r') •"> -S0: rng: "[\\u03b1,\\u03b1]" -------------------------------------------- -items.(*ItemSet).Next in itemset.go:159 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S0:rng="[\\u03b1,\\u03b1]" -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).Move in item.go:311 -items.(*ItemSet).Next in itemset.go:162 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_x -*** Item: "_x : \\u03b1 | (\\u03b2 _digit {_digit})" - ** emoves: - <"_x : • \\u03b1 | (\\u03b2 _digit {_digit})">:move("[\\u03b1,\\u03b1]"):["_x : (\\u03b1 | (\\u03b2 _digit {_digit})) •"] -------------------------------------------- -items.(*ItemSet).dependentsClosure in itemset.go:190 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S0:dependentsClosure S0 - actual: { - id : • _x {_x0 | (β _digit {_digit}) | γ} - !whitespace : ' ' | ' ' | ' -' | • ' ' - !whitespace : ' ' | ' ' | • ' -' | ' ' - !whitespace : ' ' | • ' ' | ' -' | ' ' - !whitespace : • ' ' | ' ' | ' -' | ' ' - _x : α | (• β _digit {_digit}) - _x : • α | (β _digit {_digit}) -} -Transitions: - [' ',' '] -> S1 - [' -',' -'] -> S1 - [' ',' '] -> S1 - [' ',' '] -> S1 - [α,α] -> S-1 - [β,β] -> S-1 -Symbols classes: {[' ',' '], [' -',' -'], [' ',' '], [' ',' '], [α,α], [β,β]} - - items: ["_x : (\u03b1 | (\u03b2 _digit {_digit})) •"] -------------------------------------------- -items.(*Item).MoveRegDefId in item.go:333 -items.(*ItemSet).dependentsClosure in itemset.go:195 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 - * moved item: - *ast.LexPattern:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 - *ast.LexAlt:_x {_x0 | (β _digit {_digit}) | γ}; pos 1 - -was: - *ast.LexPattern:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 - *ast.LexAlt:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 -) -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).MoveRegDefId in item.go:334 -items.(*ItemSet).dependentsClosure in itemset.go:195 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -id -*** Item: "id : _x • {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | • (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" -S0: ====> id : _x {_x0 | (\u03b2 _digit {_digit}) | \u03b3} • -S0: ====> id : _x {_x0 | (\u03b2 _digit {_digit}) | • \u03b3} -S0: ====> id : _x {_x0 | (• \u03b2 _digit {_digit}) | \u03b3} -S0: ====> id : _x {• _x0 | (\u03b2 _digit {_digit}) | \u03b3} -------------------------------------------- -items.(*Item).MoveRegDefId in item.go:333 -items.(*ItemSet).dependentsClosure in itemset.go:199 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 - * moved item: - *ast.LexPattern:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 - *ast.LexAlt:_x {_x0 | (β _digit {_digit}) | γ}; pos 1 - -was: - *ast.LexPattern:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 - *ast.LexAlt:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 -) -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).MoveRegDefId in item.go:334 -items.(*ItemSet).dependentsClosure in itemset.go:199 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -id -*** Item: "id : _x • {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | • (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.ItemList.Closure in itemlist.go:80 -items.(*ItemSet).Next in itemset.go:165 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_x0 -*** Item: "_x0 : \\u03b1" - ** emoves: -S0: #0: <"_x : (\\u03b1 | (\\u03b2 _digit {_digit})) •"> -S0: #1: <"id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •"> -S0: #2: <"id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}"> -S0: #3: <"id : _x {_x0 | (• \\u03b2 _digit {_digit}) | \\u03b3}"> -S0: #4: <"id : _x {• _x0 | (\\u03b2 _digit {_digit}) | \\u03b3}"> -S0: #5: <"_x0 : • \\u03b1"> -S0: rng: "[\\u03b2,\\u03b2]" -------------------------------------------- -items.(*ItemSet).Next in itemset.go:159 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S0:rng="[\\u03b2,\\u03b2]" -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).Move in item.go:311 -items.(*ItemSet).Next in itemset.go:162 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_x - <"_x : \\u03b1 | (• \\u03b2 _digit {_digit})">:move("[\\u03b2,\\u03b2]"):["_x : \\u03b1 | (\\u03b2 • _digit {_digit})"] -------------------------------------------- -items.(*ItemSet).dependentsClosure in itemset.go:190 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S0:dependentsClosure S0 - actual: { - id : • _x {_x0 | (β _digit {_digit}) | γ} - !whitespace : ' ' | ' ' | ' -' | • ' ' - !whitespace : ' ' | ' ' | • ' -' | ' ' - !whitespace : ' ' | • ' ' | ' -' | ' ' - !whitespace : • ' ' | ' ' | ' -' | ' ' - _x : α | (• β _digit {_digit}) - _x : • α | (β _digit {_digit}) -} -Transitions: - [' ',' '] -> S1 - [' -',' -'] -> S1 - [' ',' '] -> S1 - [' ',' '] -> S1 - [α,α] -> S2 - [β,β] -> S-1 -Symbols classes: {[' ',' '], [' -',' -'], [' ',' '], [' ',' '], [α,α], [β,β]} - - items: ["_x : \u03b1 | (\u03b2 • _digit {_digit})"] -S0: ==> id : • _x {_x0 | (\u03b2 _digit {_digit}) | \u03b3} -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.ItemList.Closure in itemlist.go:80 -items.(*ItemSet).Next in itemset.go:165 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_digit -*** Item: "_digit : '0'-'9'" - ** emoves: -S0: #0: <"_x : \\u03b1 | (\\u03b2 • _digit {_digit})"> -S0: #1: <"id : • _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}"> -S0: #2: <"_digit : • '0'-'9'"> -S1/4 -S2/4 -S2: rng: "[\\u03b1,\\u03b1]" -------------------------------------------- -items.(*ItemSet).Next in itemset.go:159 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S2:rng="[\\u03b1,\\u03b1]" -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).Move in item.go:311 -items.(*ItemSet).Next in itemset.go:162 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_x0 -*** Item: "_x0 : \\u03b1" - ** emoves: - <"_x0 : • \\u03b1">:move("[\\u03b1,\\u03b1]"):["_x0 : \\u03b1 •"] -------------------------------------------- -items.(*ItemSet).dependentsClosure in itemset.go:190 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S2:dependentsClosure S2 - actual: { - _x : (α | (β _digit {_digit})) • - id : _x {_x0 | (β _digit {_digit}) | γ} • - id : _x {_x0 | (β _digit {_digit}) | • γ} - id : _x {_x0 | (• β _digit {_digit}) | γ} - id : _x {• _x0 | (β _digit {_digit}) | γ} - _x0 : • α -} -Transitions: - [α,α] -> S-1 - [β,β] -> S-1 - [γ,γ] -> S-1 -Symbols classes: {[α,α], [β,β], [γ,γ]} - - items: ["_x0 : \u03b1 •"] -------------------------------------------- -items.(*Item).MoveRegDefId in item.go:333 -items.(*ItemSet).dependentsClosure in itemset.go:195 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 - * moved item: - *ast.LexPattern:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 - *ast.LexAlt:_x {_x0 | (β _digit {_digit}) | γ}; pos 1 - *ast.LexRepPattern:{_x0 | (β _digit {_digit}) | γ}; pos 0 - *ast.LexAlt:_x0; pos 1 - -was: - *ast.LexPattern:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 - *ast.LexAlt:_x {_x0 | (β _digit {_digit}) | γ}; pos 1 - *ast.LexRepPattern:{_x0 | (β _digit {_digit}) | γ}; pos 0 - *ast.LexAlt:_x0; pos 0 -) -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).MoveRegDefId in item.go:334 -items.(*ItemSet).dependentsClosure in itemset.go:195 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -id -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | • (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" -S2: ====> id : _x {_x0 | (\u03b2 _digit {_digit}) | \u03b3} • -S2: ====> id : _x {_x0 | (\u03b2 _digit {_digit}) | • \u03b3} -S2: ====> id : _x {_x0 | (• \u03b2 _digit {_digit}) | \u03b3} -S2: ====> id : _x {• _x0 | (\u03b2 _digit {_digit}) | \u03b3} -------------------------------------------- -items.(*Item).MoveRegDefId in item.go:333 -items.(*ItemSet).dependentsClosure in itemset.go:199 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 - * moved item: - *ast.LexPattern:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 - *ast.LexAlt:_x {_x0 | (β _digit {_digit}) | γ}; pos 1 - *ast.LexRepPattern:{_x0 | (β _digit {_digit}) | γ}; pos 0 - *ast.LexAlt:_x0; pos 1 - -was: - *ast.LexPattern:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 - *ast.LexAlt:_x {_x0 | (β _digit {_digit}) | γ}; pos 1 - *ast.LexRepPattern:{_x0 | (β _digit {_digit}) | γ}; pos 0 - *ast.LexAlt:_x0; pos 0 -) -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).MoveRegDefId in item.go:334 -items.(*ItemSet).dependentsClosure in itemset.go:199 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -id -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | • (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.ItemList.Closure in itemlist.go:80 -items.(*ItemSet).Next in itemset.go:165 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_x0 -*** Item: "_x0 : \\u03b1" - ** emoves: -S2: #0: <"_x0 : \\u03b1 •"> -S2: #1: <"id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •"> -S2: #2: <"id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}"> -S2: #3: <"id : _x {_x0 | (• \\u03b2 _digit {_digit}) | \\u03b3}"> -S2: #4: <"id : _x {• _x0 | (\\u03b2 _digit {_digit}) | \\u03b3}"> -S2: #5: <"_x0 : • \\u03b1"> -S2: rng: "[\\u03b2,\\u03b2]" -------------------------------------------- -items.(*ItemSet).Next in itemset.go:159 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S2:rng="[\\u03b2,\\u03b2]" -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).Move in item.go:311 -items.(*ItemSet).Next in itemset.go:162 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -id - <"id : _x {_x0 | (• \\u03b2 _digit {_digit}) | \\u03b3}">:move("[\\u03b2,\\u03b2]"):["id : _x {_x0 | (\\u03b2 • _digit {_digit}) | \\u03b3}"] -------------------------------------------- -items.(*ItemSet).dependentsClosure in itemset.go:190 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S2:dependentsClosure S2 - actual: { - _x : (α | (β _digit {_digit})) • - id : _x {_x0 | (β _digit {_digit}) | γ} • - id : _x {_x0 | (β _digit {_digit}) | • γ} - id : _x {_x0 | (• β _digit {_digit}) | γ} - id : _x {• _x0 | (β _digit {_digit}) | γ} - _x0 : • α -} -Transitions: - [α,α] -> S4 - [β,β] -> S-1 - [γ,γ] -> S-1 -Symbols classes: {[α,α], [β,β], [γ,γ]} - - items: ["id : _x {_x0 | (\u03b2 • _digit {_digit}) | \u03b3}"] -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.ItemList.Closure in itemlist.go:80 -items.(*ItemSet).Next in itemset.go:165 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_digit -*** Item: "_digit : '0'-'9'" - ** emoves: -S2: #0: <"id : _x {_x0 | (\\u03b2 • _digit {_digit}) | \\u03b3}"> -S2: #1: <"_digit : • '0'-'9'"> -S2: rng: "[\\u03b3,\\u03b3]" -------------------------------------------- -items.(*ItemSet).Next in itemset.go:159 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S2:rng="[\\u03b3,\\u03b3]" -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).Move in item.go:311 -items.(*ItemSet).Next in itemset.go:162 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -id -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | • (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" - <"id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}">:move("[\\u03b3,\\u03b3]"):["id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" "id : _x {_x0 | (• \\u03b2 _digit {_digit}) | \\u03b3}" "id : _x {• _x0 | (\\u03b2 _digit {_digit}) | \\u03b3}"] -------------------------------------------- -items.(*ItemSet).dependentsClosure in itemset.go:190 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S2:dependentsClosure S2 - actual: { - _x : (α | (β _digit {_digit})) • - id : _x {_x0 | (β _digit {_digit}) | γ} • - id : _x {_x0 | (β _digit {_digit}) | • γ} - id : _x {_x0 | (• β _digit {_digit}) | γ} - id : _x {• _x0 | (β _digit {_digit}) | γ} - _x0 : • α -} -Transitions: - [α,α] -> S4 - [β,β] -> S5 - [γ,γ] -> S-1 -Symbols classes: {[α,α], [β,β], [γ,γ]} - - items: ["id : _x {_x0 | (\u03b2 _digit {_digit}) | \u03b3} •" "id : _x {_x0 | (\u03b2 _digit {_digit}) | • \u03b3}" "id : _x {_x0 | (• \u03b2 _digit {_digit}) | \u03b3}" "id : _x {• _x0 | (\u03b2 _digit {_digit}) | \u03b3}"] -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.ItemList.Closure in itemlist.go:80 -items.(*ItemSet).Next in itemset.go:165 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_x0 -*** Item: "_x0 : \\u03b1" - ** emoves: -S2: #0: <"id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •"> -S2: #1: <"id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}"> -S2: #2: <"id : _x {_x0 | (• \\u03b2 _digit {_digit}) | \\u03b3}"> -S2: #3: <"id : _x {• _x0 | (\\u03b2 _digit {_digit}) | \\u03b3}"> -S2: #4: <"_x0 : • \\u03b1"> -S3/7 -S3: rng: "['0','9']" -------------------------------------------- -items.(*ItemSet).Next in itemset.go:159 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S3:rng="['0','9']" -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).Move in item.go:311 -items.(*ItemSet).Next in itemset.go:162 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_digit -*** Item: "_digit : '0'-'9'" - ** emoves: - <"_digit : • '0'-'9'">:move("['0','9']"):["_digit : '0'-'9' •"] -------------------------------------------- -items.(*ItemSet).dependentsClosure in itemset.go:190 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S3:dependentsClosure S3 - actual: { - _x : α | (β • _digit {_digit}) - id : • _x {_x0 | (β _digit {_digit}) | γ} - _digit : • '0'-'9' -} -Transitions: - ['0','9'] -> S-1 -Symbols classes: {['0','9']} - - items: ["_digit : '0'-'9' •"] -------------------------------------------- -items.(*Item).MoveRegDefId in item.go:333 -items.(*ItemSet).dependentsClosure in itemset.go:195 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 - * moved item: - *ast.LexPattern:α | (β _digit {_digit}); pos 1 - *ast.LexAlt:(β _digit {_digit}); pos 0 - *ast.LexGroupPattern:(β _digit {_digit}); pos 0 - *ast.LexAlt:β _digit {_digit}; pos 2 - -was: - *ast.LexPattern:α | (β _digit {_digit}); pos 1 - *ast.LexAlt:(β _digit {_digit}); pos 0 - *ast.LexGroupPattern:(β _digit {_digit}); pos 0 - *ast.LexAlt:β _digit {_digit}; pos 1 -) -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).MoveRegDefId in item.go:334 -items.(*ItemSet).dependentsClosure in itemset.go:195 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_x -*** Item: "_x : \\u03b1 | (\\u03b2 _digit • {_digit})" - ** emoves: -*** Item: "_x : \\u03b1 | (\\u03b2 _digit {_digit})" - ** emoves: -*** Item: "_x : \\u03b1 | (\\u03b2 _digit {_digit})" - ** emoves: -*** Item: "_x : \\u03b1 | (\\u03b2 _digit {_digit})" - ** emoves: -*** Item: "_x : \\u03b1 | (\\u03b2 _digit {_digit})" - ** emoves: -S3: ====> _x : (\u03b1 | (\u03b2 _digit {_digit})) • -S3: ====> _x : \u03b1 | (\u03b2 _digit {• _digit}) -------------------------------------------- -items.(*Item).MoveRegDefId in item.go:333 -items.(*ItemSet).dependentsClosure in itemset.go:199 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 - * moved item: - *ast.LexPattern:α | (β _digit {_digit}); pos 1 - *ast.LexAlt:(β _digit {_digit}); pos 0 - *ast.LexGroupPattern:(β _digit {_digit}); pos 0 - *ast.LexAlt:β _digit {_digit}; pos 2 - -was: - *ast.LexPattern:α | (β _digit {_digit}); pos 1 - *ast.LexAlt:(β _digit {_digit}); pos 0 - *ast.LexGroupPattern:(β _digit {_digit}); pos 0 - *ast.LexAlt:β _digit {_digit}; pos 1 -) -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).MoveRegDefId in item.go:334 -items.(*ItemSet).dependentsClosure in itemset.go:199 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_x -*** Item: "_x : \\u03b1 | (\\u03b2 _digit • {_digit})" - ** emoves: -*** Item: "_x : \\u03b1 | (\\u03b2 _digit {_digit})" - ** emoves: -*** Item: "_x : \\u03b1 | (\\u03b2 _digit {_digit})" - ** emoves: -*** Item: "_x : \\u03b1 | (\\u03b2 _digit {_digit})" - ** emoves: -*** Item: "_x : \\u03b1 | (\\u03b2 _digit {_digit})" - ** emoves: -------------------------------------------- -items.(*Item).MoveRegDefId in item.go:333 -items.(*ItemSet).dependentsClosure in itemset.go:195 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 - * moved item: - *ast.LexPattern:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 - *ast.LexAlt:_x {_x0 | (β _digit {_digit}) | γ}; pos 1 - -was: - *ast.LexPattern:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 - *ast.LexAlt:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 -) -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).MoveRegDefId in item.go:334 -items.(*ItemSet).dependentsClosure in itemset.go:195 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -id -*** Item: "id : _x • {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | • (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" -S3: ====> id : _x {_x0 | (\u03b2 _digit {_digit}) | \u03b3} • -S3: ====> id : _x {_x0 | (\u03b2 _digit {_digit}) | • \u03b3} -S3: ====> id : _x {_x0 | (• \u03b2 _digit {_digit}) | \u03b3} -S3: ====> id : _x {• _x0 | (\u03b2 _digit {_digit}) | \u03b3} -------------------------------------------- -items.(*Item).MoveRegDefId in item.go:333 -items.(*ItemSet).dependentsClosure in itemset.go:199 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 - * moved item: - *ast.LexPattern:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 - *ast.LexAlt:_x {_x0 | (β _digit {_digit}) | γ}; pos 1 - -was: - *ast.LexPattern:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 - *ast.LexAlt:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 -) -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).MoveRegDefId in item.go:334 -items.(*ItemSet).dependentsClosure in itemset.go:199 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -id -*** Item: "id : _x • {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | • (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" -S3: ==> id : • _x {_x0 | (\u03b2 _digit {_digit}) | \u03b3} -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.ItemList.Closure in itemlist.go:80 -items.(*ItemSet).Next in itemset.go:165 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_digit -*** Item: "_digit : '0'-'9'" - ** emoves: -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.ItemList.Closure in itemlist.go:80 -items.(*ItemSet).Next in itemset.go:165 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_x0 -*** Item: "_x0 : \\u03b1" - ** emoves: -S3: #0: <"_digit : '0'-'9' •"> -S3: #1: <"_x : (\\u03b1 | (\\u03b2 _digit {_digit})) •"> -S3: #2: <"_x : \\u03b1 | (\\u03b2 _digit {• _digit})"> -S3: #3: <"id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •"> -S3: #4: <"id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}"> -S3: #5: <"id : _x {_x0 | (• \\u03b2 _digit {_digit}) | \\u03b3}"> -S3: #6: <"id : _x {• _x0 | (\\u03b2 _digit {_digit}) | \\u03b3}"> -S3: #7: <"id : • _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}"> -S3: #8: <"_digit : • '0'-'9'"> -S3: #9: <"_x0 : • \\u03b1"> -S4/8 -S4: rng: "[\\u03b1,\\u03b1]" -------------------------------------------- -items.(*ItemSet).Next in itemset.go:159 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S4:rng="[\\u03b1,\\u03b1]" -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).Move in item.go:311 -items.(*ItemSet).Next in itemset.go:162 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_x0 -*** Item: "_x0 : \\u03b1" - ** emoves: - <"_x0 : • \\u03b1">:move("[\\u03b1,\\u03b1]"):["_x0 : \\u03b1 •"] -------------------------------------------- -items.(*ItemSet).dependentsClosure in itemset.go:190 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S4:dependentsClosure S4 - actual: { - _x0 : α • - id : _x {_x0 | (β _digit {_digit}) | γ} • - id : _x {_x0 | (β _digit {_digit}) | • γ} - id : _x {_x0 | (• β _digit {_digit}) | γ} - id : _x {• _x0 | (β _digit {_digit}) | γ} - _x0 : • α -} -Transitions: - [α,α] -> S-1 - [β,β] -> S-1 - [γ,γ] -> S-1 -Symbols classes: {[α,α], [β,β], [γ,γ]} - - items: ["_x0 : \u03b1 •"] -------------------------------------------- -items.(*Item).MoveRegDefId in item.go:333 -items.(*ItemSet).dependentsClosure in itemset.go:195 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 - * moved item: - *ast.LexPattern:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 - *ast.LexAlt:_x {_x0 | (β _digit {_digit}) | γ}; pos 1 - *ast.LexRepPattern:{_x0 | (β _digit {_digit}) | γ}; pos 0 - *ast.LexAlt:_x0; pos 1 - -was: - *ast.LexPattern:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 - *ast.LexAlt:_x {_x0 | (β _digit {_digit}) | γ}; pos 1 - *ast.LexRepPattern:{_x0 | (β _digit {_digit}) | γ}; pos 0 - *ast.LexAlt:_x0; pos 0 -) -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).MoveRegDefId in item.go:334 -items.(*ItemSet).dependentsClosure in itemset.go:195 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -id -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | • (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" -S4: ====> id : _x {_x0 | (\u03b2 _digit {_digit}) | \u03b3} • -S4: ====> id : _x {_x0 | (\u03b2 _digit {_digit}) | • \u03b3} -S4: ====> id : _x {_x0 | (• \u03b2 _digit {_digit}) | \u03b3} -S4: ====> id : _x {• _x0 | (\u03b2 _digit {_digit}) | \u03b3} -------------------------------------------- -items.(*Item).MoveRegDefId in item.go:333 -items.(*ItemSet).dependentsClosure in itemset.go:199 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 - * moved item: - *ast.LexPattern:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 - *ast.LexAlt:_x {_x0 | (β _digit {_digit}) | γ}; pos 1 - *ast.LexRepPattern:{_x0 | (β _digit {_digit}) | γ}; pos 0 - *ast.LexAlt:_x0; pos 1 - -was: - *ast.LexPattern:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 - *ast.LexAlt:_x {_x0 | (β _digit {_digit}) | γ}; pos 1 - *ast.LexRepPattern:{_x0 | (β _digit {_digit}) | γ}; pos 0 - *ast.LexAlt:_x0; pos 0 -) -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).MoveRegDefId in item.go:334 -items.(*ItemSet).dependentsClosure in itemset.go:199 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -id -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | • (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.ItemList.Closure in itemlist.go:80 -items.(*ItemSet).Next in itemset.go:165 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_x0 -*** Item: "_x0 : \\u03b1" - ** emoves: -S4: #0: <"_x0 : \\u03b1 •"> -S4: #1: <"id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •"> -S4: #2: <"id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}"> -S4: #3: <"id : _x {_x0 | (• \\u03b2 _digit {_digit}) | \\u03b3}"> -S4: #4: <"id : _x {• _x0 | (\\u03b2 _digit {_digit}) | \\u03b3}"> -S4: #5: <"_x0 : • \\u03b1"> -S4: rng: "[\\u03b2,\\u03b2]" -------------------------------------------- -items.(*ItemSet).Next in itemset.go:159 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S4:rng="[\\u03b2,\\u03b2]" -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).Move in item.go:311 -items.(*ItemSet).Next in itemset.go:162 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -id - <"id : _x {_x0 | (• \\u03b2 _digit {_digit}) | \\u03b3}">:move("[\\u03b2,\\u03b2]"):["id : _x {_x0 | (\\u03b2 • _digit {_digit}) | \\u03b3}"] -------------------------------------------- -items.(*ItemSet).dependentsClosure in itemset.go:190 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S4:dependentsClosure S4 - actual: { - _x0 : α • - id : _x {_x0 | (β _digit {_digit}) | γ} • - id : _x {_x0 | (β _digit {_digit}) | • γ} - id : _x {_x0 | (• β _digit {_digit}) | γ} - id : _x {• _x0 | (β _digit {_digit}) | γ} - _x0 : • α -} -Transitions: - [α,α] -> S4 - [β,β] -> S-1 - [γ,γ] -> S-1 -Symbols classes: {[α,α], [β,β], [γ,γ]} - - items: ["id : _x {_x0 | (\u03b2 • _digit {_digit}) | \u03b3}"] -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.ItemList.Closure in itemlist.go:80 -items.(*ItemSet).Next in itemset.go:165 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_digit -*** Item: "_digit : '0'-'9'" - ** emoves: -S4: #0: <"id : _x {_x0 | (\\u03b2 • _digit {_digit}) | \\u03b3}"> -S4: #1: <"_digit : • '0'-'9'"> -S4: rng: "[\\u03b3,\\u03b3]" -------------------------------------------- -items.(*ItemSet).Next in itemset.go:159 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S4:rng="[\\u03b3,\\u03b3]" -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).Move in item.go:311 -items.(*ItemSet).Next in itemset.go:162 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -id -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | • (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" - <"id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}">:move("[\\u03b3,\\u03b3]"):["id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" "id : _x {_x0 | (• \\u03b2 _digit {_digit}) | \\u03b3}" "id : _x {• _x0 | (\\u03b2 _digit {_digit}) | \\u03b3}"] -------------------------------------------- -items.(*ItemSet).dependentsClosure in itemset.go:190 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S4:dependentsClosure S4 - actual: { - _x0 : α • - id : _x {_x0 | (β _digit {_digit}) | γ} • - id : _x {_x0 | (β _digit {_digit}) | • γ} - id : _x {_x0 | (• β _digit {_digit}) | γ} - id : _x {• _x0 | (β _digit {_digit}) | γ} - _x0 : • α -} -Transitions: - [α,α] -> S4 - [β,β] -> S5 - [γ,γ] -> S-1 -Symbols classes: {[α,α], [β,β], [γ,γ]} - - items: ["id : _x {_x0 | (\u03b2 _digit {_digit}) | \u03b3} •" "id : _x {_x0 | (\u03b2 _digit {_digit}) | • \u03b3}" "id : _x {_x0 | (• \u03b2 _digit {_digit}) | \u03b3}" "id : _x {• _x0 | (\u03b2 _digit {_digit}) | \u03b3}"] -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.ItemList.Closure in itemlist.go:80 -items.(*ItemSet).Next in itemset.go:165 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_x0 -*** Item: "_x0 : \\u03b1" - ** emoves: -S4: #0: <"id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •"> -S4: #1: <"id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}"> -S4: #2: <"id : _x {_x0 | (• \\u03b2 _digit {_digit}) | \\u03b3}"> -S4: #3: <"id : _x {• _x0 | (\\u03b2 _digit {_digit}) | \\u03b3}"> -S4: #4: <"_x0 : • \\u03b1"> -S5/8 -S5: rng: "['0','9']" -------------------------------------------- -items.(*ItemSet).Next in itemset.go:159 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S5:rng="['0','9']" -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).Move in item.go:311 -items.(*ItemSet).Next in itemset.go:162 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_digit -*** Item: "_digit : '0'-'9'" - ** emoves: - <"_digit : • '0'-'9'">:move("['0','9']"):["_digit : '0'-'9' •"] -------------------------------------------- -items.(*ItemSet).dependentsClosure in itemset.go:190 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S5:dependentsClosure S5 - actual: { - id : _x {_x0 | (β • _digit {_digit}) | γ} - _digit : • '0'-'9' -} -Transitions: - ['0','9'] -> S-1 -Symbols classes: {['0','9']} - - items: ["_digit : '0'-'9' •"] -------------------------------------------- -items.(*Item).MoveRegDefId in item.go:333 -items.(*ItemSet).dependentsClosure in itemset.go:195 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 - * moved item: - *ast.LexPattern:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 - *ast.LexAlt:_x {_x0 | (β _digit {_digit}) | γ}; pos 1 - *ast.LexRepPattern:{_x0 | (β _digit {_digit}) | γ}; pos 1 - *ast.LexAlt:(β _digit {_digit}); pos 0 - *ast.LexGroupPattern:(β _digit {_digit}); pos 0 - *ast.LexAlt:β _digit {_digit}; pos 2 - -was: - *ast.LexPattern:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 - *ast.LexAlt:_x {_x0 | (β _digit {_digit}) | γ}; pos 1 - *ast.LexRepPattern:{_x0 | (β _digit {_digit}) | γ}; pos 1 - *ast.LexAlt:(β _digit {_digit}); pos 0 - *ast.LexGroupPattern:(β _digit {_digit}); pos 0 - *ast.LexAlt:β _digit {_digit}; pos 1 -) -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).MoveRegDefId in item.go:334 -items.(*ItemSet).dependentsClosure in itemset.go:195 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -id -*** Item: "id : _x {_x0 | (\\u03b2 _digit • {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | • (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" -S5: ====> id : _x {_x0 | (\u03b2 _digit {_digit}) | \u03b3} • -S5: ====> id : _x {_x0 | (\u03b2 _digit {_digit}) | • \u03b3} -S5: ====> id : _x {_x0 | (• \u03b2 _digit {_digit}) | \u03b3} -S5: ====> id : _x {• _x0 | (\u03b2 _digit {_digit}) | \u03b3} -S5: ====> id : _x {_x0 | (\u03b2 _digit {• _digit}) | \u03b3} -------------------------------------------- -items.(*Item).MoveRegDefId in item.go:333 -items.(*ItemSet).dependentsClosure in itemset.go:199 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 - * moved item: - *ast.LexPattern:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 - *ast.LexAlt:_x {_x0 | (β _digit {_digit}) | γ}; pos 1 - *ast.LexRepPattern:{_x0 | (β _digit {_digit}) | γ}; pos 1 - *ast.LexAlt:(β _digit {_digit}); pos 0 - *ast.LexGroupPattern:(β _digit {_digit}); pos 0 - *ast.LexAlt:β _digit {_digit}; pos 2 - -was: - *ast.LexPattern:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 - *ast.LexAlt:_x {_x0 | (β _digit {_digit}) | γ}; pos 1 - *ast.LexRepPattern:{_x0 | (β _digit {_digit}) | γ}; pos 1 - *ast.LexAlt:(β _digit {_digit}); pos 0 - *ast.LexGroupPattern:(β _digit {_digit}); pos 0 - *ast.LexAlt:β _digit {_digit}; pos 1 -) -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).MoveRegDefId in item.go:334 -items.(*ItemSet).dependentsClosure in itemset.go:199 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -id -*** Item: "id : _x {_x0 | (\\u03b2 _digit • {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | • (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.ItemList.Closure in itemlist.go:80 -items.(*ItemSet).Next in itemset.go:165 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_x0 -*** Item: "_x0 : \\u03b1" - ** emoves: -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.ItemList.Closure in itemlist.go:80 -items.(*ItemSet).Next in itemset.go:165 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_digit -*** Item: "_digit : '0'-'9'" - ** emoves: -S5: #0: <"_digit : '0'-'9' •"> -S5: #1: <"id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •"> -S5: #2: <"id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}"> -S5: #3: <"id : _x {_x0 | (• \\u03b2 _digit {_digit}) | \\u03b3}"> -S5: #4: <"id : _x {• _x0 | (\\u03b2 _digit {_digit}) | \\u03b3}"> -S5: #5: <"id : _x {_x0 | (\\u03b2 _digit {• _digit}) | \\u03b3}"> -S5: #6: <"_x0 : • \\u03b1"> -S5: #7: <"_digit : • '0'-'9'"> -S6/9 -S6: rng: "[\\u03b1,\\u03b1]" -------------------------------------------- -items.(*ItemSet).Next in itemset.go:159 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S6:rng="[\\u03b1,\\u03b1]" -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).Move in item.go:311 -items.(*ItemSet).Next in itemset.go:162 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_x0 -*** Item: "_x0 : \\u03b1" - ** emoves: - <"_x0 : • \\u03b1">:move("[\\u03b1,\\u03b1]"):["_x0 : \\u03b1 •"] -------------------------------------------- -items.(*ItemSet).dependentsClosure in itemset.go:190 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S6:dependentsClosure S6 - actual: { - id : _x {_x0 | (β _digit {_digit}) | γ} • - id : _x {_x0 | (β _digit {_digit}) | • γ} - id : _x {_x0 | (• β _digit {_digit}) | γ} - id : _x {• _x0 | (β _digit {_digit}) | γ} - _x0 : • α -} -Transitions: - [α,α] -> S-1 - [β,β] -> S-1 - [γ,γ] -> S-1 -Symbols classes: {[α,α], [β,β], [γ,γ]} - - items: ["_x0 : \u03b1 •"] -------------------------------------------- -items.(*Item).MoveRegDefId in item.go:333 -items.(*ItemSet).dependentsClosure in itemset.go:195 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 - * moved item: - *ast.LexPattern:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 - *ast.LexAlt:_x {_x0 | (β _digit {_digit}) | γ}; pos 1 - *ast.LexRepPattern:{_x0 | (β _digit {_digit}) | γ}; pos 0 - *ast.LexAlt:_x0; pos 1 - -was: - *ast.LexPattern:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 - *ast.LexAlt:_x {_x0 | (β _digit {_digit}) | γ}; pos 1 - *ast.LexRepPattern:{_x0 | (β _digit {_digit}) | γ}; pos 0 - *ast.LexAlt:_x0; pos 0 -) -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).MoveRegDefId in item.go:334 -items.(*ItemSet).dependentsClosure in itemset.go:195 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -id -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | • (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" -S6: ====> id : _x {_x0 | (\u03b2 _digit {_digit}) | \u03b3} • -S6: ====> id : _x {_x0 | (\u03b2 _digit {_digit}) | • \u03b3} -S6: ====> id : _x {_x0 | (• \u03b2 _digit {_digit}) | \u03b3} -S6: ====> id : _x {• _x0 | (\u03b2 _digit {_digit}) | \u03b3} -------------------------------------------- -items.(*Item).MoveRegDefId in item.go:333 -items.(*ItemSet).dependentsClosure in itemset.go:199 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 - * moved item: - *ast.LexPattern:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 - *ast.LexAlt:_x {_x0 | (β _digit {_digit}) | γ}; pos 1 - *ast.LexRepPattern:{_x0 | (β _digit {_digit}) | γ}; pos 0 - *ast.LexAlt:_x0; pos 1 - -was: - *ast.LexPattern:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 - *ast.LexAlt:_x {_x0 | (β _digit {_digit}) | γ}; pos 1 - *ast.LexRepPattern:{_x0 | (β _digit {_digit}) | γ}; pos 0 - *ast.LexAlt:_x0; pos 0 -) -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).MoveRegDefId in item.go:334 -items.(*ItemSet).dependentsClosure in itemset.go:199 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -id -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | • (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.ItemList.Closure in itemlist.go:80 -items.(*ItemSet).Next in itemset.go:165 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_x0 -*** Item: "_x0 : \\u03b1" - ** emoves: -S6: #0: <"_x0 : \\u03b1 •"> -S6: #1: <"id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •"> -S6: #2: <"id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}"> -S6: #3: <"id : _x {_x0 | (• \\u03b2 _digit {_digit}) | \\u03b3}"> -S6: #4: <"id : _x {• _x0 | (\\u03b2 _digit {_digit}) | \\u03b3}"> -S6: #5: <"_x0 : • \\u03b1"> -S6: rng: "[\\u03b2,\\u03b2]" -------------------------------------------- -items.(*ItemSet).Next in itemset.go:159 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S6:rng="[\\u03b2,\\u03b2]" -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).Move in item.go:311 -items.(*ItemSet).Next in itemset.go:162 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -id - <"id : _x {_x0 | (• \\u03b2 _digit {_digit}) | \\u03b3}">:move("[\\u03b2,\\u03b2]"):["id : _x {_x0 | (\\u03b2 • _digit {_digit}) | \\u03b3}"] -------------------------------------------- -items.(*ItemSet).dependentsClosure in itemset.go:190 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S6:dependentsClosure S6 - actual: { - id : _x {_x0 | (β _digit {_digit}) | γ} • - id : _x {_x0 | (β _digit {_digit}) | • γ} - id : _x {_x0 | (• β _digit {_digit}) | γ} - id : _x {• _x0 | (β _digit {_digit}) | γ} - _x0 : • α -} -Transitions: - [α,α] -> S4 - [β,β] -> S-1 - [γ,γ] -> S-1 -Symbols classes: {[α,α], [β,β], [γ,γ]} - - items: ["id : _x {_x0 | (\u03b2 • _digit {_digit}) | \u03b3}"] -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.ItemList.Closure in itemlist.go:80 -items.(*ItemSet).Next in itemset.go:165 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_digit -*** Item: "_digit : '0'-'9'" - ** emoves: -S6: #0: <"id : _x {_x0 | (\\u03b2 • _digit {_digit}) | \\u03b3}"> -S6: #1: <"_digit : • '0'-'9'"> -S6: rng: "[\\u03b3,\\u03b3]" -------------------------------------------- -items.(*ItemSet).Next in itemset.go:159 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S6:rng="[\\u03b3,\\u03b3]" -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).Move in item.go:311 -items.(*ItemSet).Next in itemset.go:162 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -id -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | • (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" - <"id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}">:move("[\\u03b3,\\u03b3]"):["id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" "id : _x {_x0 | (• \\u03b2 _digit {_digit}) | \\u03b3}" "id : _x {• _x0 | (\\u03b2 _digit {_digit}) | \\u03b3}"] -------------------------------------------- -items.(*ItemSet).dependentsClosure in itemset.go:190 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S6:dependentsClosure S6 - actual: { - id : _x {_x0 | (β _digit {_digit}) | γ} • - id : _x {_x0 | (β _digit {_digit}) | • γ} - id : _x {_x0 | (• β _digit {_digit}) | γ} - id : _x {• _x0 | (β _digit {_digit}) | γ} - _x0 : • α -} -Transitions: - [α,α] -> S4 - [β,β] -> S5 - [γ,γ] -> S-1 -Symbols classes: {[α,α], [β,β], [γ,γ]} - - items: ["id : _x {_x0 | (\u03b2 _digit {_digit}) | \u03b3} •" "id : _x {_x0 | (\u03b2 _digit {_digit}) | • \u03b3}" "id : _x {_x0 | (• \u03b2 _digit {_digit}) | \u03b3}" "id : _x {• _x0 | (\u03b2 _digit {_digit}) | \u03b3}"] -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.ItemList.Closure in itemlist.go:80 -items.(*ItemSet).Next in itemset.go:165 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_x0 -*** Item: "_x0 : \\u03b1" - ** emoves: -S6: #0: <"id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •"> -S6: #1: <"id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}"> -S6: #2: <"id : _x {_x0 | (• \\u03b2 _digit {_digit}) | \\u03b3}"> -S6: #3: <"id : _x {• _x0 | (\\u03b2 _digit {_digit}) | \\u03b3}"> -S6: #4: <"_x0 : • \\u03b1"> -S7/9 -S7: rng: "['0','9']" -------------------------------------------- -items.(*ItemSet).Next in itemset.go:159 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S7:rng="['0','9']" -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).Move in item.go:311 -items.(*ItemSet).Next in itemset.go:162 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_digit -*** Item: "_digit : '0'-'9'" - ** emoves: - <"_digit : • '0'-'9'">:move("['0','9']"):["_digit : '0'-'9' •"] -------------------------------------------- -items.(*ItemSet).dependentsClosure in itemset.go:190 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S7:dependentsClosure S7 - actual: { - _digit : '0'-'9' • - _x : (α | (β _digit {_digit})) • - _x : α | (β _digit {• _digit}) - id : _x {_x0 | (β _digit {_digit}) | γ} • - id : _x {_x0 | (β _digit {_digit}) | • γ} - id : _x {_x0 | (• β _digit {_digit}) | γ} - id : _x {• _x0 | (β _digit {_digit}) | γ} - id : • _x {_x0 | (β _digit {_digit}) | γ} - _digit : • '0'-'9' - _x0 : • α -} -Transitions: - ['0','9'] -> S-1 - [α,α] -> S-1 - [β,β] -> S-1 - [γ,γ] -> S-1 -Symbols classes: {['0','9'], [α,α], [β,β], [γ,γ]} - - items: ["_digit : '0'-'9' •"] -------------------------------------------- -items.(*Item).MoveRegDefId in item.go:333 -items.(*ItemSet).dependentsClosure in itemset.go:195 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 - * moved item: - *ast.LexPattern:α | (β _digit {_digit}); pos 1 - *ast.LexAlt:(β _digit {_digit}); pos 0 - *ast.LexGroupPattern:(β _digit {_digit}); pos 0 - *ast.LexAlt:β _digit {_digit}; pos 2 - *ast.LexRepPattern:{_digit}; pos 0 - *ast.LexAlt:_digit; pos 1 - -was: - *ast.LexPattern:α | (β _digit {_digit}); pos 1 - *ast.LexAlt:(β _digit {_digit}); pos 0 - *ast.LexGroupPattern:(β _digit {_digit}); pos 0 - *ast.LexAlt:β _digit {_digit}; pos 2 - *ast.LexRepPattern:{_digit}; pos 0 - *ast.LexAlt:_digit; pos 0 -) -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).MoveRegDefId in item.go:334 -items.(*ItemSet).dependentsClosure in itemset.go:195 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_x -*** Item: "_x : \\u03b1 | (\\u03b2 _digit {_digit})" - ** emoves: -*** Item: "_x : \\u03b1 | (\\u03b2 _digit {_digit})" - ** emoves: -*** Item: "_x : \\u03b1 | (\\u03b2 _digit {_digit})" - ** emoves: -*** Item: "_x : \\u03b1 | (\\u03b2 _digit {_digit})" - ** emoves: -*** Item: "_x : \\u03b1 | (\\u03b2 _digit {_digit})" - ** emoves: -S7: ====> _x : (\u03b1 | (\u03b2 _digit {_digit})) • -S7: ====> _x : \u03b1 | (\u03b2 _digit {• _digit}) -------------------------------------------- -items.(*Item).MoveRegDefId in item.go:333 -items.(*ItemSet).dependentsClosure in itemset.go:199 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 - * moved item: - *ast.LexPattern:α | (β _digit {_digit}); pos 1 - *ast.LexAlt:(β _digit {_digit}); pos 0 - *ast.LexGroupPattern:(β _digit {_digit}); pos 0 - *ast.LexAlt:β _digit {_digit}; pos 2 - *ast.LexRepPattern:{_digit}; pos 0 - *ast.LexAlt:_digit; pos 1 - -was: - *ast.LexPattern:α | (β _digit {_digit}); pos 1 - *ast.LexAlt:(β _digit {_digit}); pos 0 - *ast.LexGroupPattern:(β _digit {_digit}); pos 0 - *ast.LexAlt:β _digit {_digit}; pos 2 - *ast.LexRepPattern:{_digit}; pos 0 - *ast.LexAlt:_digit; pos 0 -) -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).MoveRegDefId in item.go:334 -items.(*ItemSet).dependentsClosure in itemset.go:199 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_x -*** Item: "_x : \\u03b1 | (\\u03b2 _digit {_digit})" - ** emoves: -*** Item: "_x : \\u03b1 | (\\u03b2 _digit {_digit})" - ** emoves: -*** Item: "_x : \\u03b1 | (\\u03b2 _digit {_digit})" - ** emoves: -*** Item: "_x : \\u03b1 | (\\u03b2 _digit {_digit})" - ** emoves: -*** Item: "_x : \\u03b1 | (\\u03b2 _digit {_digit})" - ** emoves: -------------------------------------------- -items.(*Item).MoveRegDefId in item.go:333 -items.(*ItemSet).dependentsClosure in itemset.go:195 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 - * moved item: - *ast.LexPattern:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 - *ast.LexAlt:_x {_x0 | (β _digit {_digit}) | γ}; pos 1 - -was: - *ast.LexPattern:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 - *ast.LexAlt:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 -) -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).MoveRegDefId in item.go:334 -items.(*ItemSet).dependentsClosure in itemset.go:195 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -id -*** Item: "id : _x • {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | • (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" -S7: ====> id : _x {_x0 | (\u03b2 _digit {_digit}) | \u03b3} • -S7: ====> id : _x {_x0 | (\u03b2 _digit {_digit}) | • \u03b3} -S7: ====> id : _x {_x0 | (• \u03b2 _digit {_digit}) | \u03b3} -S7: ====> id : _x {• _x0 | (\u03b2 _digit {_digit}) | \u03b3} -------------------------------------------- -items.(*Item).MoveRegDefId in item.go:333 -items.(*ItemSet).dependentsClosure in itemset.go:199 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 - * moved item: - *ast.LexPattern:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 - *ast.LexAlt:_x {_x0 | (β _digit {_digit}) | γ}; pos 1 - -was: - *ast.LexPattern:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 - *ast.LexAlt:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 -) -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).MoveRegDefId in item.go:334 -items.(*ItemSet).dependentsClosure in itemset.go:199 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -id -*** Item: "id : _x • {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | • (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" -S7: ==> id : • _x {_x0 | (\u03b2 _digit {_digit}) | \u03b3} -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.ItemList.Closure in itemlist.go:80 -items.(*ItemSet).Next in itemset.go:165 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_digit -*** Item: "_digit : '0'-'9'" - ** emoves: -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.ItemList.Closure in itemlist.go:80 -items.(*ItemSet).Next in itemset.go:165 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_x0 -*** Item: "_x0 : \\u03b1" - ** emoves: -S7: #0: <"_digit : '0'-'9' •"> -S7: #1: <"_x : (\\u03b1 | (\\u03b2 _digit {_digit})) •"> -S7: #2: <"_x : \\u03b1 | (\\u03b2 _digit {• _digit})"> -S7: #3: <"id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •"> -S7: #4: <"id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}"> -S7: #5: <"id : _x {_x0 | (• \\u03b2 _digit {_digit}) | \\u03b3}"> -S7: #6: <"id : _x {• _x0 | (\\u03b2 _digit {_digit}) | \\u03b3}"> -S7: #7: <"id : • _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}"> -S7: #8: <"_digit : • '0'-'9'"> -S7: #9: <"_x0 : • \\u03b1"> -S7: rng: "[\\u03b1,\\u03b1]" -------------------------------------------- -items.(*ItemSet).Next in itemset.go:159 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S7:rng="[\\u03b1,\\u03b1]" -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).Move in item.go:311 -items.(*ItemSet).Next in itemset.go:162 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_x0 -*** Item: "_x0 : \\u03b1" - ** emoves: - <"_x0 : • \\u03b1">:move("[\\u03b1,\\u03b1]"):["_x0 : \\u03b1 •"] -------------------------------------------- -items.(*ItemSet).dependentsClosure in itemset.go:190 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S7:dependentsClosure S7 - actual: { - _digit : '0'-'9' • - _x : (α | (β _digit {_digit})) • - _x : α | (β _digit {• _digit}) - id : _x {_x0 | (β _digit {_digit}) | γ} • - id : _x {_x0 | (β _digit {_digit}) | • γ} - id : _x {_x0 | (• β _digit {_digit}) | γ} - id : _x {• _x0 | (β _digit {_digit}) | γ} - id : • _x {_x0 | (β _digit {_digit}) | γ} - _digit : • '0'-'9' - _x0 : • α -} -Transitions: - ['0','9'] -> S7 - [α,α] -> S-1 - [β,β] -> S-1 - [γ,γ] -> S-1 -Symbols classes: {['0','9'], [α,α], [β,β], [γ,γ]} - - items: ["_x0 : \u03b1 •"] -------------------------------------------- -items.(*Item).MoveRegDefId in item.go:333 -items.(*ItemSet).dependentsClosure in itemset.go:195 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 - * moved item: - *ast.LexPattern:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 - *ast.LexAlt:_x {_x0 | (β _digit {_digit}) | γ}; pos 1 - *ast.LexRepPattern:{_x0 | (β _digit {_digit}) | γ}; pos 0 - *ast.LexAlt:_x0; pos 1 - -was: - *ast.LexPattern:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 - *ast.LexAlt:_x {_x0 | (β _digit {_digit}) | γ}; pos 1 - *ast.LexRepPattern:{_x0 | (β _digit {_digit}) | γ}; pos 0 - *ast.LexAlt:_x0; pos 0 -) -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).MoveRegDefId in item.go:334 -items.(*ItemSet).dependentsClosure in itemset.go:195 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -id -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | • (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" -S7: ====> id : _x {_x0 | (\u03b2 _digit {_digit}) | \u03b3} • -S7: ====> id : _x {_x0 | (\u03b2 _digit {_digit}) | • \u03b3} -S7: ====> id : _x {_x0 | (• \u03b2 _digit {_digit}) | \u03b3} -S7: ====> id : _x {• _x0 | (\u03b2 _digit {_digit}) | \u03b3} -------------------------------------------- -items.(*Item).MoveRegDefId in item.go:333 -items.(*ItemSet).dependentsClosure in itemset.go:199 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 - * moved item: - *ast.LexPattern:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 - *ast.LexAlt:_x {_x0 | (β _digit {_digit}) | γ}; pos 1 - *ast.LexRepPattern:{_x0 | (β _digit {_digit}) | γ}; pos 0 - *ast.LexAlt:_x0; pos 1 - -was: - *ast.LexPattern:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 - *ast.LexAlt:_x {_x0 | (β _digit {_digit}) | γ}; pos 1 - *ast.LexRepPattern:{_x0 | (β _digit {_digit}) | γ}; pos 0 - *ast.LexAlt:_x0; pos 0 -) -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).MoveRegDefId in item.go:334 -items.(*ItemSet).dependentsClosure in itemset.go:199 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -id -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | • (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.ItemList.Closure in itemlist.go:80 -items.(*ItemSet).Next in itemset.go:165 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_x0 -*** Item: "_x0 : \\u03b1" - ** emoves: -S7: #0: <"_x0 : \\u03b1 •"> -S7: #1: <"id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •"> -S7: #2: <"id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}"> -S7: #3: <"id : _x {_x0 | (• \\u03b2 _digit {_digit}) | \\u03b3}"> -S7: #4: <"id : _x {• _x0 | (\\u03b2 _digit {_digit}) | \\u03b3}"> -S7: #5: <"_x0 : • \\u03b1"> -S7: rng: "[\\u03b2,\\u03b2]" -------------------------------------------- -items.(*ItemSet).Next in itemset.go:159 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S7:rng="[\\u03b2,\\u03b2]" -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).Move in item.go:311 -items.(*ItemSet).Next in itemset.go:162 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -id - <"id : _x {_x0 | (• \\u03b2 _digit {_digit}) | \\u03b3}">:move("[\\u03b2,\\u03b2]"):["id : _x {_x0 | (\\u03b2 • _digit {_digit}) | \\u03b3}"] -------------------------------------------- -items.(*ItemSet).dependentsClosure in itemset.go:190 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S7:dependentsClosure S7 - actual: { - _digit : '0'-'9' • - _x : (α | (β _digit {_digit})) • - _x : α | (β _digit {• _digit}) - id : _x {_x0 | (β _digit {_digit}) | γ} • - id : _x {_x0 | (β _digit {_digit}) | • γ} - id : _x {_x0 | (• β _digit {_digit}) | γ} - id : _x {• _x0 | (β _digit {_digit}) | γ} - id : • _x {_x0 | (β _digit {_digit}) | γ} - _digit : • '0'-'9' - _x0 : • α -} -Transitions: - ['0','9'] -> S7 - [α,α] -> S4 - [β,β] -> S-1 - [γ,γ] -> S-1 -Symbols classes: {['0','9'], [α,α], [β,β], [γ,γ]} - - items: ["id : _x {_x0 | (\u03b2 • _digit {_digit}) | \u03b3}"] -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.ItemList.Closure in itemlist.go:80 -items.(*ItemSet).Next in itemset.go:165 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_digit -*** Item: "_digit : '0'-'9'" - ** emoves: -S7: #0: <"id : _x {_x0 | (\\u03b2 • _digit {_digit}) | \\u03b3}"> -S7: #1: <"_digit : • '0'-'9'"> -S7: rng: "[\\u03b3,\\u03b3]" -------------------------------------------- -items.(*ItemSet).Next in itemset.go:159 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S7:rng="[\\u03b3,\\u03b3]" -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).Move in item.go:311 -items.(*ItemSet).Next in itemset.go:162 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -id -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | • (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" - <"id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}">:move("[\\u03b3,\\u03b3]"):["id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" "id : _x {_x0 | (• \\u03b2 _digit {_digit}) | \\u03b3}" "id : _x {• _x0 | (\\u03b2 _digit {_digit}) | \\u03b3}"] -------------------------------------------- -items.(*ItemSet).dependentsClosure in itemset.go:190 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S7:dependentsClosure S7 - actual: { - _digit : '0'-'9' • - _x : (α | (β _digit {_digit})) • - _x : α | (β _digit {• _digit}) - id : _x {_x0 | (β _digit {_digit}) | γ} • - id : _x {_x0 | (β _digit {_digit}) | • γ} - id : _x {_x0 | (• β _digit {_digit}) | γ} - id : _x {• _x0 | (β _digit {_digit}) | γ} - id : • _x {_x0 | (β _digit {_digit}) | γ} - _digit : • '0'-'9' - _x0 : • α -} -Transitions: - ['0','9'] -> S7 - [α,α] -> S4 - [β,β] -> S5 - [γ,γ] -> S-1 -Symbols classes: {['0','9'], [α,α], [β,β], [γ,γ]} - - items: ["id : _x {_x0 | (\u03b2 _digit {_digit}) | \u03b3} •" "id : _x {_x0 | (\u03b2 _digit {_digit}) | • \u03b3}" "id : _x {_x0 | (• \u03b2 _digit {_digit}) | \u03b3}" "id : _x {• _x0 | (\u03b2 _digit {_digit}) | \u03b3}"] -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.ItemList.Closure in itemlist.go:80 -items.(*ItemSet).Next in itemset.go:165 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_x0 -*** Item: "_x0 : \\u03b1" - ** emoves: -S7: #0: <"id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •"> -S7: #1: <"id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}"> -S7: #2: <"id : _x {_x0 | (• \\u03b2 _digit {_digit}) | \\u03b3}"> -S7: #3: <"id : _x {• _x0 | (\\u03b2 _digit {_digit}) | \\u03b3}"> -S7: #4: <"_x0 : • \\u03b1"> -S8/9 -S8: rng: "['0','9']" -------------------------------------------- -items.(*ItemSet).Next in itemset.go:159 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S8:rng="['0','9']" -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).Move in item.go:311 -items.(*ItemSet).Next in itemset.go:162 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_digit -*** Item: "_digit : '0'-'9'" - ** emoves: - <"_digit : • '0'-'9'">:move("['0','9']"):["_digit : '0'-'9' •"] -------------------------------------------- -items.(*ItemSet).dependentsClosure in itemset.go:190 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S8:dependentsClosure S8 - actual: { - _digit : '0'-'9' • - id : _x {_x0 | (β _digit {_digit}) | γ} • - id : _x {_x0 | (β _digit {_digit}) | • γ} - id : _x {_x0 | (• β _digit {_digit}) | γ} - id : _x {• _x0 | (β _digit {_digit}) | γ} - id : _x {_x0 | (β _digit {• _digit}) | γ} - _x0 : • α - _digit : • '0'-'9' -} -Transitions: - ['0','9'] -> S-1 - [α,α] -> S-1 - [β,β] -> S-1 - [γ,γ] -> S-1 -Symbols classes: {['0','9'], [α,α], [β,β], [γ,γ]} - - items: ["_digit : '0'-'9' •"] -------------------------------------------- -items.(*Item).MoveRegDefId in item.go:333 -items.(*ItemSet).dependentsClosure in itemset.go:195 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 - * moved item: - *ast.LexPattern:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 - *ast.LexAlt:_x {_x0 | (β _digit {_digit}) | γ}; pos 1 - *ast.LexRepPattern:{_x0 | (β _digit {_digit}) | γ}; pos 1 - *ast.LexAlt:(β _digit {_digit}); pos 0 - *ast.LexGroupPattern:(β _digit {_digit}); pos 0 - *ast.LexAlt:β _digit {_digit}; pos 2 - *ast.LexRepPattern:{_digit}; pos 0 - *ast.LexAlt:_digit; pos 1 - -was: - *ast.LexPattern:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 - *ast.LexAlt:_x {_x0 | (β _digit {_digit}) | γ}; pos 1 - *ast.LexRepPattern:{_x0 | (β _digit {_digit}) | γ}; pos 1 - *ast.LexAlt:(β _digit {_digit}); pos 0 - *ast.LexGroupPattern:(β _digit {_digit}); pos 0 - *ast.LexAlt:β _digit {_digit}; pos 2 - *ast.LexRepPattern:{_digit}; pos 0 - *ast.LexAlt:_digit; pos 0 -) -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).MoveRegDefId in item.go:334 -items.(*ItemSet).dependentsClosure in itemset.go:195 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -id -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | • (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" -S8: ====> id : _x {_x0 | (\u03b2 _digit {_digit}) | \u03b3} • -S8: ====> id : _x {_x0 | (\u03b2 _digit {_digit}) | • \u03b3} -S8: ====> id : _x {_x0 | (• \u03b2 _digit {_digit}) | \u03b3} -S8: ====> id : _x {• _x0 | (\u03b2 _digit {_digit}) | \u03b3} -S8: ====> id : _x {_x0 | (\u03b2 _digit {• _digit}) | \u03b3} -------------------------------------------- -items.(*Item).MoveRegDefId in item.go:333 -items.(*ItemSet).dependentsClosure in itemset.go:199 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 - * moved item: - *ast.LexPattern:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 - *ast.LexAlt:_x {_x0 | (β _digit {_digit}) | γ}; pos 1 - *ast.LexRepPattern:{_x0 | (β _digit {_digit}) | γ}; pos 1 - *ast.LexAlt:(β _digit {_digit}); pos 0 - *ast.LexGroupPattern:(β _digit {_digit}); pos 0 - *ast.LexAlt:β _digit {_digit}; pos 2 - *ast.LexRepPattern:{_digit}; pos 0 - *ast.LexAlt:_digit; pos 1 - -was: - *ast.LexPattern:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 - *ast.LexAlt:_x {_x0 | (β _digit {_digit}) | γ}; pos 1 - *ast.LexRepPattern:{_x0 | (β _digit {_digit}) | γ}; pos 1 - *ast.LexAlt:(β _digit {_digit}); pos 0 - *ast.LexGroupPattern:(β _digit {_digit}); pos 0 - *ast.LexAlt:β _digit {_digit}; pos 2 - *ast.LexRepPattern:{_digit}; pos 0 - *ast.LexAlt:_digit; pos 0 -) -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).MoveRegDefId in item.go:334 -items.(*ItemSet).dependentsClosure in itemset.go:199 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -id -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | • (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.ItemList.Closure in itemlist.go:80 -items.(*ItemSet).Next in itemset.go:165 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_x0 -*** Item: "_x0 : \\u03b1" - ** emoves: -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.ItemList.Closure in itemlist.go:80 -items.(*ItemSet).Next in itemset.go:165 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_digit -*** Item: "_digit : '0'-'9'" - ** emoves: -S8: #0: <"_digit : '0'-'9' •"> -S8: #1: <"id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •"> -S8: #2: <"id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}"> -S8: #3: <"id : _x {_x0 | (• \\u03b2 _digit {_digit}) | \\u03b3}"> -S8: #4: <"id : _x {• _x0 | (\\u03b2 _digit {_digit}) | \\u03b3}"> -S8: #5: <"id : _x {_x0 | (\\u03b2 _digit {• _digit}) | \\u03b3}"> -S8: #6: <"_x0 : • \\u03b1"> -S8: #7: <"_digit : • '0'-'9'"> -S8: rng: "[\\u03b1,\\u03b1]" -------------------------------------------- -items.(*ItemSet).Next in itemset.go:159 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S8:rng="[\\u03b1,\\u03b1]" -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).Move in item.go:311 -items.(*ItemSet).Next in itemset.go:162 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_x0 -*** Item: "_x0 : \\u03b1" - ** emoves: - <"_x0 : • \\u03b1">:move("[\\u03b1,\\u03b1]"):["_x0 : \\u03b1 •"] -------------------------------------------- -items.(*ItemSet).dependentsClosure in itemset.go:190 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S8:dependentsClosure S8 - actual: { - _digit : '0'-'9' • - id : _x {_x0 | (β _digit {_digit}) | γ} • - id : _x {_x0 | (β _digit {_digit}) | • γ} - id : _x {_x0 | (• β _digit {_digit}) | γ} - id : _x {• _x0 | (β _digit {_digit}) | γ} - id : _x {_x0 | (β _digit {• _digit}) | γ} - _x0 : • α - _digit : • '0'-'9' -} -Transitions: - ['0','9'] -> S8 - [α,α] -> S-1 - [β,β] -> S-1 - [γ,γ] -> S-1 -Symbols classes: {['0','9'], [α,α], [β,β], [γ,γ]} - - items: ["_x0 : \u03b1 •"] -------------------------------------------- -items.(*Item).MoveRegDefId in item.go:333 -items.(*ItemSet).dependentsClosure in itemset.go:195 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 - * moved item: - *ast.LexPattern:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 - *ast.LexAlt:_x {_x0 | (β _digit {_digit}) | γ}; pos 1 - *ast.LexRepPattern:{_x0 | (β _digit {_digit}) | γ}; pos 0 - *ast.LexAlt:_x0; pos 1 - -was: - *ast.LexPattern:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 - *ast.LexAlt:_x {_x0 | (β _digit {_digit}) | γ}; pos 1 - *ast.LexRepPattern:{_x0 | (β _digit {_digit}) | γ}; pos 0 - *ast.LexAlt:_x0; pos 0 -) -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).MoveRegDefId in item.go:334 -items.(*ItemSet).dependentsClosure in itemset.go:195 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -id -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | • (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" -S8: ====> id : _x {_x0 | (\u03b2 _digit {_digit}) | \u03b3} • -S8: ====> id : _x {_x0 | (\u03b2 _digit {_digit}) | • \u03b3} -S8: ====> id : _x {_x0 | (• \u03b2 _digit {_digit}) | \u03b3} -S8: ====> id : _x {• _x0 | (\u03b2 _digit {_digit}) | \u03b3} -------------------------------------------- -items.(*Item).MoveRegDefId in item.go:333 -items.(*ItemSet).dependentsClosure in itemset.go:199 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 - * moved item: - *ast.LexPattern:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 - *ast.LexAlt:_x {_x0 | (β _digit {_digit}) | γ}; pos 1 - *ast.LexRepPattern:{_x0 | (β _digit {_digit}) | γ}; pos 0 - *ast.LexAlt:_x0; pos 1 - -was: - *ast.LexPattern:_x {_x0 | (β _digit {_digit}) | γ}; pos 0 - *ast.LexAlt:_x {_x0 | (β _digit {_digit}) | γ}; pos 1 - *ast.LexRepPattern:{_x0 | (β _digit {_digit}) | γ}; pos 0 - *ast.LexAlt:_x0; pos 0 -) -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).MoveRegDefId in item.go:334 -items.(*ItemSet).dependentsClosure in itemset.go:199 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -id -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | • (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.ItemList.Closure in itemlist.go:80 -items.(*ItemSet).Next in itemset.go:165 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_x0 -*** Item: "_x0 : \\u03b1" - ** emoves: -S8: #0: <"_x0 : \\u03b1 •"> -S8: #1: <"id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •"> -S8: #2: <"id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}"> -S8: #3: <"id : _x {_x0 | (• \\u03b2 _digit {_digit}) | \\u03b3}"> -S8: #4: <"id : _x {• _x0 | (\\u03b2 _digit {_digit}) | \\u03b3}"> -S8: #5: <"_x0 : • \\u03b1"> -S8: rng: "[\\u03b2,\\u03b2]" -------------------------------------------- -items.(*ItemSet).Next in itemset.go:159 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S8:rng="[\\u03b2,\\u03b2]" -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).Move in item.go:311 -items.(*ItemSet).Next in itemset.go:162 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -id - <"id : _x {_x0 | (• \\u03b2 _digit {_digit}) | \\u03b3}">:move("[\\u03b2,\\u03b2]"):["id : _x {_x0 | (\\u03b2 • _digit {_digit}) | \\u03b3}"] -------------------------------------------- -items.(*ItemSet).dependentsClosure in itemset.go:190 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S8:dependentsClosure S8 - actual: { - _digit : '0'-'9' • - id : _x {_x0 | (β _digit {_digit}) | γ} • - id : _x {_x0 | (β _digit {_digit}) | • γ} - id : _x {_x0 | (• β _digit {_digit}) | γ} - id : _x {• _x0 | (β _digit {_digit}) | γ} - id : _x {_x0 | (β _digit {• _digit}) | γ} - _x0 : • α - _digit : • '0'-'9' -} -Transitions: - ['0','9'] -> S8 - [α,α] -> S4 - [β,β] -> S-1 - [γ,γ] -> S-1 -Symbols classes: {['0','9'], [α,α], [β,β], [γ,γ]} - - items: ["id : _x {_x0 | (\u03b2 • _digit {_digit}) | \u03b3}"] -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.ItemList.Closure in itemlist.go:80 -items.(*ItemSet).Next in itemset.go:165 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_digit -*** Item: "_digit : '0'-'9'" - ** emoves: -S8: #0: <"id : _x {_x0 | (\\u03b2 • _digit {_digit}) | \\u03b3}"> -S8: #1: <"_digit : • '0'-'9'"> -S8: rng: "[\\u03b3,\\u03b3]" -------------------------------------------- -items.(*ItemSet).Next in itemset.go:159 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S8:rng="[\\u03b3,\\u03b3]" -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.(*Item).Move in item.go:311 -items.(*ItemSet).Next in itemset.go:162 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -id -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: -*** Item: "id : _x {_x0 | • (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" -*** Item: "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3}" - ** emoves: - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" - "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" - <"id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}">:move("[\\u03b3,\\u03b3]"):["id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •" "id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}" "id : _x {_x0 | (• \\u03b2 _digit {_digit}) | \\u03b3}" "id : _x {• _x0 | (\\u03b2 _digit {_digit}) | \\u03b3}"] -------------------------------------------- -items.(*ItemSet).dependentsClosure in itemset.go:190 -items.(*ItemSet).Next in itemset.go:164 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -S8:dependentsClosure S8 - actual: { - _digit : '0'-'9' • - id : _x {_x0 | (β _digit {_digit}) | γ} • - id : _x {_x0 | (β _digit {_digit}) | • γ} - id : _x {_x0 | (• β _digit {_digit}) | γ} - id : _x {• _x0 | (β _digit {_digit}) | γ} - id : _x {_x0 | (β _digit {• _digit}) | γ} - _x0 : • α - _digit : • '0'-'9' -} -Transitions: - ['0','9'] -> S8 - [α,α] -> S4 - [β,β] -> S5 - [γ,γ] -> S-1 -Symbols classes: {['0','9'], [α,α], [β,β], [γ,γ]} - - items: ["id : _x {_x0 | (\u03b2 _digit {_digit}) | \u03b3} •" "id : _x {_x0 | (\u03b2 _digit {_digit}) | • \u03b3}" "id : _x {_x0 | (• \u03b2 _digit {_digit}) | \u03b3}" "id : _x {• _x0 | (\u03b2 _digit {_digit}) | \u03b3}"] -------------------------------------------- -items.(*Item).Emoves in item.go:107 -items.ItemList.Closure in itemlist.go:80 -items.(*ItemSet).Next in itemset.go:165 -items.(*ItemSets).Closure in itemsets.go:59 -items.GetItemSets in itemsets.go:41 -_x0 -*** Item: "_x0 : \\u03b1" - ** emoves: -S8: #0: <"id : _x {_x0 | (\\u03b2 _digit {_digit}) | \\u03b3} •"> -S8: #1: <"id : _x {_x0 | (\\u03b2 _digit {_digit}) | • \\u03b3}"> -S8: #2: <"id : _x {_x0 | (• \\u03b2 _digit {_digit}) | \\u03b3}"> -S8: #3: <"id : _x {• _x0 | (\\u03b2 _digit {_digit}) | \\u03b3}"> -S8: #4: <"_x0 : • \\u03b1"> +-bugs = lexer_dots:fix,lexer_regdefs:fix diff --git a/example/ctx/ctx2.grammar/ctx2/ctx.go b/example/ctx/ctx2.grammar/ctx2/ctx.go new file mode 100644 index 00000000..d7625c2a --- /dev/null +++ b/example/ctx/ctx2.grammar/ctx2/ctx.go @@ -0,0 +1,131 @@ +// Code generated by gocc; DO NOT EDIT. + +package ctx + +import ( + "io" + + "github.com/maxcalandrelli/gocc/example/ctx/ctx2.grammar/ctx2/internal/errors" + "github.com/maxcalandrelli/gocc/example/ctx/ctx2.grammar/ctx2/internal/lexer" + "github.com/maxcalandrelli/gocc/example/ctx/ctx2.grammar/ctx2/internal/parser" + "github.com/maxcalandrelli/gocc/example/ctx/ctx2.grammar/ctx2/internal/token" +) + +const ( + INVALID = token.INVALID + EOF = token.EOF +) + +type ( + Token = token.Token + TokenMap = token.TokenMap + Pos = token.Pos + ErrorSymbol = errors.ErrorSymbol + Error = errors.Error + Lexer = lexer.Lexer + Parser = parser.Parser +) + +func NewParser() *parser.Parser { + return parser.NewParser() +} + +func ParseFile(fpath string) (interface{}, error) { + if lexer, err := NewLexerFile(fpath); err == nil { + return NewParser().Parse(lexer) + } else { + return nil, err + } +} + +func ParseText(text string) (interface{}, error) { + return NewParser().Parse(NewLexerBytes([]byte(text))) +} + +func Parse(stream io.Reader) (interface{}, error) { + lex, err := NewLexer(stream) + if lex == nil { + return nil, err + } + return NewParser().Parse(lex) +} + +func ParseFileWithData(fpath string, userData interface{}) (interface{}, error) { + if lexer, err := NewLexerFile(fpath); err == nil { + return NewParser().SetContext(userData).Parse(lexer) + } else { + return nil, err + } +} + +func ParseTextWithData(text string, userData interface{}) (interface{}, error) { + return NewParser().SetContext(userData).Parse(NewLexerBytes([]byte(text))) +} + +func ParseWithData(stream io.Reader, userData interface{}) (interface{}, error) { + lex, err := NewLexer(stream) + if lex == nil { + return nil, err + } + return NewParser().SetContext(userData).Parse(lex) +} + +func ParseFilePartial(fpath string) (interface{}, error, []byte) { + if lexer, err := NewLexerFile(fpath); err == nil { + return NewParser().ParseLongestPrefix(lexer) + } else { + return nil, err, []byte{} + } +} + +func ParseTextPartial(text string) (interface{}, error, []byte) { + return NewParser().ParseLongestPrefix(NewLexerBytes([]byte(text))) +} + +func ParsePartial(stream io.Reader) (interface{}, error, []byte) { + lex, err := NewLexer(stream) + if lex == nil { + return nil, err, []byte{} + } + return NewParser().ParseLongestPrefix(lex) +} + +func ParseFileWithDataPartial(fpath string, userData interface{}) (interface{}, error, []byte) { + if lexer, err := NewLexerFile(fpath); err == nil { + return NewParser().SetContext(userData).ParseLongestPrefix(lexer) + } else { + return nil, err, []byte{} + } +} + +func ParseTextWithDataPartial(text string, userData interface{}) (interface{}, error, []byte) { + return NewParser().SetContext(userData).ParseLongestPrefix(NewLexerBytes([]byte(text))) +} + +func ParseWithDataPartial(stream io.Reader, userData interface{}) (interface{}, error, []byte) { + lex, err := NewLexer(stream) + if lex == nil { + return nil, err, []byte{} + } + return NewParser().SetContext(userData).ParseLongestPrefix(lex) +} + +func NewLexerBytes(src []byte) *lexer.Lexer { + return lexer.NewLexerBytes(src) +} + +func NewLexerString(src string) *lexer.Lexer { + return lexer.NewLexerBytes([]byte(src)) +} + +func NewLexerFile(fpath string) (*lexer.Lexer, error) { + return lexer.NewLexerFile(fpath) +} + +func NewLexer(reader io.Reader) (*lexer.Lexer, error) { + return lexer.NewLexer(reader) +} + +func GetTokenMap() TokenMap { + return token.TokMap +} diff --git a/example/ctx/ctx2.grammar/ctx2/iface/ctx.go b/example/ctx/ctx2.grammar/ctx2/iface/ctx.go new file mode 100644 index 00000000..c8f03732 --- /dev/null +++ b/example/ctx/ctx2.grammar/ctx2/iface/ctx.go @@ -0,0 +1,63 @@ +// Code generated by gocc; DO NOT EDIT. + +package iface + +import ( + "github.com/maxcalandrelli/gocc/example/ctx/ctx2.grammar/ctx2/internal/errors" + "github.com/maxcalandrelli/gocc/example/ctx/ctx2.grammar/ctx2/internal/io/stream" + "github.com/maxcalandrelli/gocc/example/ctx/ctx2.grammar/ctx2/internal/token" + "io" +) + +type ( + Token = token.Token + TokenMap = token.TokenMap + Pos = token.Pos + ErrorSymbol = errors.ErrorSymbol + Error = errors.Error + + Scanner interface { + Scan() (tok *Token) + } + + StreamScanner interface { + GetStream() TokenStream + } + + CheckPoint interface { + DistanceFrom(CheckPoint) int + Advance(int) CheckPoint + } + + CheckPointable interface { + GetCheckPoint() CheckPoint + GotoCheckPoint(CheckPoint) + } + + TokenStream interface { + io.Reader + io.RuneScanner + io.Seeker + } +) + +const ( + INVALID = token.INVALID + EOF = token.EOF +) + +func GetTokenMap() TokenMap { + return token.TokMap +} + +func NewWindowReaderFromBytes(src []byte) stream.WindowReader { + return stream.NewWindowReaderFromBytes(src) +} + +func NewWindowReader(rdr io.Reader) stream.WindowReader { + return stream.NewWindowReader(rdr) +} + +func NewLimitedWindowReader(rdr io.Reader, sizeMin, sizeMax int) stream.WindowReader { + return stream.NewLimitedWindowReader(rdr, sizeMin, sizeMax) +} diff --git a/example/ctx/ctx2.grammar/ctx2/internal/errors/errors.go b/example/ctx/ctx2.grammar/ctx2/internal/errors/errors.go new file mode 100644 index 00000000..412bfe65 --- /dev/null +++ b/example/ctx/ctx2.grammar/ctx2/internal/errors/errors.go @@ -0,0 +1,56 @@ +// Code generated by gocc; DO NOT EDIT. + +package errors + +import ( + "fmt" + "strings" + + "github.com/maxcalandrelli/gocc/example/ctx/ctx2.grammar/ctx2/internal/token" +) + +type ErrorSymbol interface { +} + +type Error struct { + Err error + ErrorToken *token.Token + ErrorSymbols []ErrorSymbol + ExpectedTokens []string + StackTop int +} + +func (e *Error) String() string { + w := new(strings.Builder) + fmt.Fprintf(w, "Error") + if e.Err != nil { + fmt.Fprintf(w, " %s\n", e.Err) + } else { + fmt.Fprintf(w, "\n") + } + fmt.Fprintf(w, "Token: type=%d, lit=%s\n", e.ErrorToken.Type, e.ErrorToken.Lit) + fmt.Fprintf(w, "Pos: offset=%d, line=%d, column=%d\n", e.ErrorToken.Pos.Offset, e.ErrorToken.Pos.Line, e.ErrorToken.Pos.Column) + fmt.Fprintf(w, "Expected one of: ") + for _, sym := range e.ExpectedTokens { + fmt.Fprintf(w, "%s ", sym) + } + fmt.Fprintf(w, "ErrorSymbol:\n") + for _, sym := range e.ErrorSymbols { + fmt.Fprintf(w, "%v\n", sym) + } + return w.String() +} + +func (e *Error) Error() string { + w := new(strings.Builder) + fmt.Fprintf(w, "Error in S%d: %s, %s", e.StackTop, token.TokMap.TokenString(e.ErrorToken), e.ErrorToken.Pos.String()) + if e.Err != nil { + fmt.Fprintf(w, ": %+v", e.Err) + } else { + fmt.Fprintf(w, ", expected one of: ") + for _, expected := range e.ExpectedTokens { + fmt.Fprintf(w, "%s ", expected) + } + } + return w.String() +} diff --git a/example/ctx/ctx2.grammar/ctx2/internal/io/stream/internal/stream_impl.go b/example/ctx/ctx2.grammar/ctx2/internal/io/stream/internal/stream_impl.go new file mode 100644 index 00000000..358aa160 --- /dev/null +++ b/example/ctx/ctx2.grammar/ctx2/internal/io/stream/internal/stream_impl.go @@ -0,0 +1,275 @@ +package internal + +import ( + "io" + "sync" + "unicode/utf8" +) + +type ( + impl_WindowReader struct { + bufferBlockSize int + maxBufferSize int + buffers [][]byte + available int + absbase int64 + position int + eof bool + rdr io.Reader + lock *sync.Mutex + } +) + +func (s *impl_WindowReader) lockReader() { + if s.lock != nil { + s.lock.Lock() + } +} + +func (s *impl_WindowReader) unlockReader() { + if s.lock != nil { + s.lock.Unlock() + } +} + +func (s *impl_WindowReader) seek(offset int64, whence int) (offs int64, err error) { + switch whence { + case io.SeekStart: + return s.seek(offset-s.ReadPosition(), io.SeekCurrent) + case io.SeekCurrent: + switch { + case offset == 0: + return s.ReadPosition(), nil + case offset < 0: + if -offset > int64(s.maxBackOffset()) { + err = io.ErrShortBuffer + } else { + s.advanceGet(int(offset)) + } + case offset > 0: + for offset > 0 && !s.eof { + available := s.Buffered() + if offset <= int64(available) { + s.advanceGet(int(offset)) + break + } + if available > 0 { + s.advanceGet(available) + offset -= int64(available) + } + read, _ := s.fetchBytes(int(offset)) + s.advanceGet(read) + offset -= int64(read) + } + if s.eof { + err = io.EOF + } + } + case io.SeekEnd: + for !s.eof { + s.seek(int64(s.MaxCap()), io.SeekCurrent) + } + s.seek(int64(s.Buffered()), io.SeekCurrent) + } + if s.eof && err == nil && s.Buffered() > 0 { + s.eof = false + } + return s.ReadPosition(), err +} + +func (s impl_WindowReader) maxBackOffset() int { + r := s.position + if s.absbase > 0 { + r = s.Cap() - s.Buffered() + } + return r +} + +func (s impl_WindowReader) bufferIndex(pos int) int { + if pos < 0 { + panic("negative position") + } + return pos / s.bufferBlockSize +} + +func (s impl_WindowReader) bufferBytes(pos int) []byte { + return s.buffers[s.bufferIndex(pos)] +} + +func (s impl_WindowReader) bufferByteRange(pos int, length int) []byte { + p := s.bufferOffset(pos) + return s.bufferBytes(pos)[p : p+length] +} + +func (s impl_WindowReader) bufferOffset(pos int) int { + return pos % s.bufferBlockSize +} + +func (s *impl_WindowReader) advanceGet(n int) { + sz := s.Cap() + switch { + case n < 0: + if -n > s.maxBackOffset() { + panic("underflow") + } + s.position += n + if s.position < 0 { + s.position += sz + s.absbase -= int64(sz) + } + case n > 0: + if n > s.Buffered() { + panic("overflow") + } + s.position += n + if s.position >= sz { + s.position -= sz + s.absbase += int64(sz) + } + } + s.available -= n +} + +func (s *impl_WindowReader) copy(to []byte, length int) { + for offs, cp := 0, 0; length > 0; length -= cp { + s.position %= s.MaxCap() + p := s.bufferOffset(s.position) + b := s.bufferBytes(s.position) + r := s.bufferBlockSize - p + if length <= r { + cp = copy(to[offs:], b[p:p+length]) + } else { + cp = copy(to[offs:], b[p:]) + } + s.advanceGet(cp) + offs += cp + } +} + +func (s *impl_WindowReader) fetchBytes(n int) (read int, err error) { + if s.rdr == nil { + s.eof = true + return 0, io.EOF + } + for n > 0 && s.Buffered() < s.MaxCap() && err == nil { + readNow := n + putpos := s.position + s.available + r := s.bufferBlockSize - s.bufferOffset(putpos) + if readNow > r { + readNow = r + } + for s.bufferIndex(putpos) >= len(s.buffers) && s.Cap() < s.MaxCap() { + s.buffers = append(s.buffers, make([]byte, s.bufferBlockSize)) + } + putpos %= s.MaxCap() + offs := s.bufferOffset(putpos) + if r, err = s.rdr.Read(s.bufferBytes(putpos)[offs : offs+readNow]); r > 0 { + s.available += r + read += r + n -= r + } + } + if n > 0 && err == nil { + err = io.ErrShortBuffer + } + return +} + +func (s *impl_WindowReader) read(p []byte) (read int, err error) { + if s.eof { + return 0, io.EOF + } + for read < len(p) && err == nil { + available := s.Buffered() + if len(p)-read <= available { + s.copy(p[read:], len(p)-read) + read = len(p) + } else { + if available == 0 { + available, err = s.fetchBytes(len(p) - read) + } + s.copy(p[read:], available) + read += available + switch err { + case io.ErrShortBuffer: + err = nil + case io.EOF: + s.eof = true + } + } + } + return +} + +func (s impl_WindowReader) peekByte() (byte, error) { + if s.Buffered() < 1 { + return 0, io.ErrShortBuffer + } + return s.bufferBytes(s.position)[s.bufferOffset(s.position)], nil +} + +func (s *impl_WindowReader) unreadByte() error { + _, e := s.seek(-1, io.SeekCurrent) + return e +} + +func (s *impl_WindowReader) readRune() (r rune, size int, err error) { + for i := 1; err == nil && i <= 4; i++ { + if s.Buffered() < i { + if _, err = s.fetchBytes(i); err != nil { + return + } + } + t := s.bufferByteRange(s.position, i) + if r, size = utf8.DecodeRune(t); r != utf8.RuneError { + s.advanceGet(size) + return + } + } + return utf8.RuneError, 0, err +} + +func (s *impl_WindowReader) unreadRune() (err error) { + tmps := *s + tmpb := []byte{} + for { + if _, err = tmps.seek(-1, io.SeekCurrent); err == nil { + b, _ := tmps.peekByte() + tmpb = append([]byte{b}, tmpb...) + switch len(tmpb) { + case 1: + if (tmpb[0] & 0xC0) == 0x80 { + continue + } + _, err = s.seek(-int64(len(tmpb)), io.SeekCurrent) + return + case 2: + if (tmpb[0] & 0xC0) == 0x80 { + continue + } + if (tmpb[0] & 0xE0) != 0xC0 { + break + } + _, err = s.seek(-int64(len(tmpb)), io.SeekCurrent) + return + case 3: + if (tmpb[0] & 0xC0) == 0x80 { + continue + } + if (tmpb[0] & 0xF0) != 0xE0 { + break + } + _, err = s.seek(-int64(len(tmpb)), io.SeekCurrent) + return + case 4: + if (tmpb[0] & 0xF8) != 0xF0 { + break + } + _, err = s.seek(-int64(len(tmpb)), io.SeekCurrent) + return + } + } + } + _, err = s.seek(-1, io.SeekCurrent) + return +} diff --git a/example/ctx/ctx2.grammar/ctx2/internal/io/stream/internal/stream_public.go b/example/ctx/ctx2.grammar/ctx2/internal/io/stream/internal/stream_public.go new file mode 100644 index 00000000..20ed7b5e --- /dev/null +++ b/example/ctx/ctx2.grammar/ctx2/internal/io/stream/internal/stream_public.go @@ -0,0 +1,101 @@ +package internal + +import ( + "io" +) + +func NewWindowReader(buf []byte, underlyingReader io.Reader, blksize, smax int, InfoPrefixRoundUp bool) *impl_WindowReader { + if blksize < 0 || smax < blksize { + panic("illegal buffer size") + } + r := &impl_WindowReader{rdr: underlyingReader} + r.bufferBlockSize = blksize + if underlyingReader != nil { + if blksize <= 0 { + r.bufferBlockSize = 1 << 10 + } else if InfoPrefixRoundUp { + for r.bufferBlockSize = 1; blksize > 0; r.bufferBlockSize = r.bufferBlockSize << 1 { + blksize = blksize >> 1 + } + } + if smax > 0 { + r.maxBufferSize = ((smax-1)/r.bufferBlockSize + 1) * r.bufferBlockSize + } + r.buffers = [][]byte{} + } else { + r.buffers = [][]byte{buf} + r.available = len(buf) + r.bufferBlockSize = r.available + r.maxBufferSize = r.available + } + return r +} + +func (s impl_WindowReader) Cap() int { + return len(s.buffers) * s.bufferBlockSize +} + +func (s impl_WindowReader) BlockSize() int { + return s.bufferBlockSize +} + +func (s impl_WindowReader) MaxCap() int { + if s.maxBufferSize > 0 { + return s.maxBufferSize + } + return 1 << 31 +} + +func (s impl_WindowReader) MaxUnreadSize() int { + return s.maxBackOffset() +} + +func (s impl_WindowReader) Buffered() int { + return s.available +} + +func (s impl_WindowReader) ReadPosition() int64 { + return s.absbase + int64(s.position) +} + +func (s *impl_WindowReader) Read(p []byte) (read int, err error) { + s.lockReader() + defer func() { s.unlockReader() }() + return s.read(p) +} + +func (s *impl_WindowReader) Seek(offset int64, whence int) (offs int64, err error) { + s.lockReader() + defer func() { s.unlockReader() }() + return s.seek(offset, whence) +} + +func (s *impl_WindowReader) ReadByte() (byte, error) { + b := []byte{0} + _, err := s.Read(b) + return b[0], err +} + +func (s *impl_WindowReader) PeekByte() (byte, error) { + s.lockReader() + defer func() { s.unlockReader() }() + return s.peekByte() +} + +func (s *impl_WindowReader) UnreadByte() error { + s.lockReader() + defer func() { s.unlockReader() }() + return s.unreadByte() +} + +func (s *impl_WindowReader) ReadRune() (r rune, size int, err error) { + s.lockReader() + defer func() { s.unlockReader() }() + return s.readRune() +} + +func (s *impl_WindowReader) UnreadRune() (err error) { + s.lockReader() + defer func() { s.unlockReader() }() + return s.unreadRune() +} diff --git a/example/ctx/ctx2.grammar/ctx2/internal/io/stream/stream.go b/example/ctx/ctx2.grammar/ctx2/internal/io/stream/stream.go new file mode 100644 index 00000000..b6009b32 --- /dev/null +++ b/example/ctx/ctx2.grammar/ctx2/internal/io/stream/stream.go @@ -0,0 +1,39 @@ +package stream + +import ( + internal "github.com/maxcalandrelli/gocc/example/ctx/ctx2.grammar/ctx2/internal/io/stream/internal" + "io" +) + +type ( + WindowReader interface { + BlockSize() int + Buffered() int + Cap() int + MaxCap() int + Read([]byte) (int, error) + ReadByte() (byte, error) + ReadPosition() int64 + ReadRune() (rune, int, error) + Seek(int64, int) (int64, error) + UnreadByte() error + UnreadRune() error + MaxUnreadSize() int + } +) + +var ( + InfoPrefixRoundUp = false +) + +func NewWindowReaderFromBytes(src []byte) WindowReader { + return internal.NewWindowReader(src, nil, 0, 0, InfoPrefixRoundUp) +} + +func NewWindowReader(rdr io.Reader) WindowReader { + return internal.NewWindowReader(nil, rdr, 0, 0, false) +} + +func NewLimitedWindowReader(rdr io.Reader, sizeMin, sizeMax int) WindowReader { + return internal.NewWindowReader(nil, rdr, sizeMin, sizeMax, InfoPrefixRoundUp) +} diff --git a/example/ctx/ctx.grammar/ctx/internal/lexer/acttab.go b/example/ctx/ctx2.grammar/ctx2/internal/lexer/acttab.go similarity index 91% rename from example/ctx/ctx.grammar/ctx/internal/lexer/acttab.go rename to example/ctx/ctx2.grammar/ctx2/internal/lexer/acttab.go index 7bc5fe8f..826e9f95 100644 --- a/example/ctx/ctx.grammar/ctx/internal/lexer/acttab.go +++ b/example/ctx/ctx2.grammar/ctx2/internal/lexer/acttab.go @@ -5,7 +5,7 @@ package lexer import ( "fmt" - "github.com/maxcalandrelli/gocc/example/ctx/ctx.grammar/ctx/internal/token" + "github.com/maxcalandrelli/gocc/example/ctx/ctx2.grammar/ctx2/internal/token" ) type ActionTable [NumStates]ActionRow diff --git a/example/ctx/ctx.grammar/ctx/internal/lexer/lexer.go b/example/ctx/ctx2.grammar/ctx2/internal/lexer/lexer.go similarity index 93% rename from example/ctx/ctx.grammar/ctx/internal/lexer/lexer.go rename to example/ctx/ctx2.grammar/ctx2/internal/lexer/lexer.go index e8549abc..f5094232 100644 --- a/example/ctx/ctx.grammar/ctx/internal/lexer/lexer.go +++ b/example/ctx/ctx2.grammar/ctx2/internal/lexer/lexer.go @@ -9,9 +9,9 @@ import ( "os" - "github.com/maxcalandrelli/gocc/example/ctx/ctx.grammar/ctx/iface" - "github.com/maxcalandrelli/gocc/example/ctx/ctx.grammar/ctx/internal/token" - "github.com/maxcalandrelli/gocc/example/ctx/ctx.grammar/ctx/internal/io/stream" + "github.com/maxcalandrelli/gocc/example/ctx/ctx2.grammar/ctx2/iface" + "github.com/maxcalandrelli/gocc/example/ctx/ctx2.grammar/ctx2/internal/token" + "github.com/maxcalandrelli/gocc/example/ctx/ctx2.grammar/ctx2/internal/io/stream" ) const ( diff --git a/example/ctx/ctx.grammar/ctx/internal/lexer/transitiontable.go b/example/ctx/ctx2.grammar/ctx2/internal/lexer/transitiontable.go similarity index 100% rename from example/ctx/ctx.grammar/ctx/internal/lexer/transitiontable.go rename to example/ctx/ctx2.grammar/ctx2/internal/lexer/transitiontable.go diff --git a/example/ctx/ctx2.grammar/ctx2/internal/parser/action.go b/example/ctx/ctx2.grammar/ctx2/internal/parser/action.go new file mode 100644 index 00000000..54bc55e9 --- /dev/null +++ b/example/ctx/ctx2.grammar/ctx2/internal/parser/action.go @@ -0,0 +1,51 @@ +// Code generated by gocc; DO NOT EDIT. + +package parser + +import ( + "fmt" +) + +type action interface { + act() + String() string +} + +type ( + accept bool + shift int // value is next state index + reduce int // value is production index +) + +func (this accept) act() {} +func (this shift) act() {} +func (this reduce) act() {} + +func (this accept) Equal(that action) bool { + if _, ok := that.(accept); ok { + return true + } + return false +} + +func (this reduce) Equal(that action) bool { + that1, ok := that.(reduce) + if !ok { + return false + } + return this == that1 +} + +func (this shift) Equal(that action) bool { + that1, ok := that.(shift) + if !ok { + return false + } + return this == that1 +} + +func (this accept) String() string { return "accept(0)" } +func (this shift) String() string { return fmt.Sprintf("shift:%d", this) } +func (this reduce) String() string { + return fmt.Sprintf("reduce:%d(%s)", this, productionsTable[this].String) +} diff --git a/example/ctx/ctx2.grammar/ctx2/internal/parser/actiontable.go b/example/ctx/ctx2.grammar/ctx2/internal/parser/actiontable.go new file mode 100644 index 00000000..10941d48 --- /dev/null +++ b/example/ctx/ctx2.grammar/ctx2/internal/parser/actiontable.go @@ -0,0 +1,97 @@ +// Code generated by gocc; DO NOT EDIT. + +package parser + +type ( + actionTable [numStates]actionRow + cdFunc func(TokenStream, interface{}) (interface{}, error, []byte) + cdAction struct { + tokenIndex int + tokenScanner cdFunc + } + actionRow struct { + canRecover bool + actions [numSymbols]action + cdActions []cdAction + } + actions struct { + table actionTable + } +) + +var parserActions = actions{ + table: actionTable{ + actionRow{ // S0 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + shift(3), // id + shift(4), // μ + }, + cdActions: []cdAction{ + cdAction{tokenIndex: 3, tokenScanner: cdFunc_calc_0}, + }, + }, + actionRow{ // S1 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + accept(true), // Ω + shift(3), // id + shift(4), // μ + }, + cdActions: []cdAction{ + cdAction{tokenIndex: 3, tokenScanner: cdFunc_calc_0}, + }, + }, + actionRow{ // S2 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(1), // Ω, reduce: StmtList + reduce(1), // id, reduce: StmtList + reduce(1), // μ, reduce: StmtList + }, + cdActions: []cdAction{ + cdAction{tokenIndex: 3, tokenScanner: cdFunc_calc_0}, + }, + }, + actionRow{ // S3 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(3), // Ω, reduce: Stmt + reduce(3), // id, reduce: Stmt + reduce(3), // μ, reduce: Stmt + }, + cdActions: []cdAction{ + cdAction{tokenIndex: 3, tokenScanner: cdFunc_calc_0}, + }, + }, + actionRow{ // S4 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(4), // Ω, reduce: Stmt + reduce(4), // id, reduce: Stmt + reduce(4), // μ, reduce: Stmt + }, + cdActions: []cdAction{ + cdAction{tokenIndex: 3, tokenScanner: cdFunc_calc_0}, + }, + }, + actionRow{ // S5 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(2), // Ω, reduce: StmtList + reduce(2), // id, reduce: StmtList + reduce(2), // μ, reduce: StmtList + }, + cdActions: []cdAction{ + cdAction{tokenIndex: 3, tokenScanner: cdFunc_calc_0}, + }, + }, + }, +} diff --git a/example/ctx/ctx2.grammar/ctx2/internal/parser/gototable.go b/example/ctx/ctx2.grammar/ctx2/internal/parser/gototable.go new file mode 100644 index 00000000..443ec029 --- /dev/null +++ b/example/ctx/ctx2.grammar/ctx2/internal/parser/gototable.go @@ -0,0 +1,43 @@ +// Code generated by gocc; DO NOT EDIT. + +package parser + +const numNTSymbols = 3 + +type ( + gotoTable [numStates]gotoRow + gotoRow [numNTSymbols]int +) + +var gotoTab = gotoTable{ + gotoRow{ // S0 + -1, // Π + 1, // Π + 2, // Π + }, + gotoRow{ // S1 + -1, // Π + -1, // Π + 5, // Π + }, + gotoRow{ // S2 + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S3 + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S4 + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S5 + -1, // Π + -1, // Π + -1, // Π + }, +} diff --git a/example/ctx/ctx2.grammar/ctx2/internal/parser/parser.go b/example/ctx/ctx2.grammar/ctx2/internal/parser/parser.go new file mode 100644 index 00000000..5350cd74 --- /dev/null +++ b/example/ctx/ctx2.grammar/ctx2/internal/parser/parser.go @@ -0,0 +1,359 @@ +// Code generated by gocc; DO NOT EDIT. + +package parser + +import ( + "errors" + "fmt" + "strings" + + "github.com/maxcalandrelli/gocc/example/ctx/ctx2.grammar/ctx2/iface" + parseError "github.com/maxcalandrelli/gocc/example/ctx/ctx2.grammar/ctx2/internal/errors" + "github.com/maxcalandrelli/gocc/example/ctx/ctx2.grammar/ctx2/internal/token" + + calc "github.com/maxcalandrelli/gocc/example/calc/calc.grammar/calc" +) + +const ( + numProductions = 5 + numStates = 6 + numSymbols = 7 +) + +// Stack + +type stack struct { + state []int + attrib []Attrib +} + +const INITIAL_STACK_SIZE = 100 + +func newStack() *stack { + return &stack{ + state: make([]int, 0, INITIAL_STACK_SIZE), + attrib: make([]Attrib, 0, INITIAL_STACK_SIZE), + } +} + +func (s *stack) reset() { + s.state = s.state[:0] + s.attrib = s.attrib[:0] +} + +func (s *stack) push(state int, a Attrib) { + s.state = append(s.state, state) + s.attrib = append(s.attrib, a) +} + +func (s *stack) top() int { + return s.state[len(s.state)-1] +} + +func (s *stack) peek(pos int) int { + return s.state[pos] +} + +func (s *stack) topIndex() int { + return len(s.state) - 1 +} + +func (s *stack) popN(items int) []Attrib { + lo, hi := len(s.state)-items, len(s.state) + + attrib := s.attrib[lo:hi] + + s.state = s.state[:lo] + s.attrib = s.attrib[:lo] + + return attrib +} + +func (s *stack) String() string { + w := new(strings.Builder) + fmt.Fprintf(w, "stack:\n") + for i, st := range s.state { + fmt.Fprintf(w, "\t%d: %d , ", i, st) + if s.attrib[i] == nil { + fmt.Fprintf(w, "nil") + } else { + switch attr := s.attrib[i].(type) { + case *token.Token: + fmt.Fprintf(w, "%s", attr.Lit) + default: + fmt.Fprintf(w, "%v", attr) + } + } + fmt.Fprintf(w, "\n") + } + return w.String() +} + +// Parser + +type Parser struct { + stack *stack + nextToken *token.Token + userContext interface{} + + // + // Working data, should be method parameters/locals + // but putting them here simplifies a bit the code + // Useful only for longest prefix partial parsing + // + needsRepositioning bool + isNonDeterministic bool + tokens iface.CheckPointable + afterPos iface.CheckPoint + checkPoint iface.CheckPoint + underlyingStream iface.TokenStream +} + +type TokenStream = iface.TokenStream + +type ( + fakeCp struct{} + fakeCheckPointable struct{} +) + +func (f fakeCheckPointable) GetCheckPoint() iface.CheckPoint { + return fakeCp{} +} + +func (f fakeCp) DistanceFrom(o iface.CheckPoint) int { + return 0 +} + +func (f fakeCp) Advance(o int) iface.CheckPoint { + return fakeCp{} +} + +func (f fakeCheckPointable) GotoCheckPoint(iface.CheckPoint) {} + +func cdFunc_calc_0(Stream TokenStream, Context interface{}) (interface{}, error, []byte) { + return calc.ParseWithDataPartial(Stream, Context) +} + +func NewParser() *Parser { + return NewParserWithContext(nil) +} + +func NewParserWithContext(u interface{}) *Parser { + p := &Parser{stack: newStack(), userContext: u} + p.Reset() + return p +} + +func (p *Parser) Reset() { + p.stack.reset() + p.stack.push(0, nil) +} + +func (p *Parser) SetContext(ctx interface{}) *Parser { + p.userContext = ctx + return p +} + +func (p Parser) GetContext() interface{} { + return p.userContext +} + +func (p *Parser) Error(err error, scanner iface.Scanner) (recovered bool, errorAttrib *parseError.Error) { + errorAttrib = &parseError.Error{ + Err: err, + ErrorToken: p.nextToken, + ErrorSymbols: p.popNonRecoveryStates(), + ExpectedTokens: make([]string, 0, 8), + } + for t, action := range parserActions.table[p.stack.top()].actions { + if action != nil { + errorAttrib.ExpectedTokens = append(errorAttrib.ExpectedTokens, token.TokMap.Id(token.Type(t))) + } + } + + if action := parserActions.table[p.stack.top()].actions[token.TokMap.Type("λ")]; action != nil { + p.stack.push(int(action.(shift)), errorAttrib) // action can only be shift + } else { + return + } + + if action := parserActions.table[p.stack.top()].actions[p.nextToken.Type]; action != nil { + recovered = true + } + for !recovered && p.nextToken.Type != token.EOF { + p.nextToken = scanner.Scan() + if action := parserActions.table[p.stack.top()].actions[p.nextToken.Type]; action != nil { + recovered = true + } + } + + return +} + +func (p *Parser) popNonRecoveryStates() (removedAttribs []parseError.ErrorSymbol) { + if rs, ok := p.firstRecoveryState(); ok { + errorSymbols := p.stack.popN(p.stack.topIndex() - rs) + removedAttribs = make([]parseError.ErrorSymbol, len(errorSymbols)) + for i, e := range errorSymbols { + removedAttribs[i] = e + } + } else { + removedAttribs = []parseError.ErrorSymbol{} + } + return +} + +// recoveryState points to the highest state on the stack, which can recover +func (p *Parser) firstRecoveryState() (recoveryState int, canRecover bool) { + recoveryState, canRecover = p.stack.topIndex(), parserActions.table[p.stack.top()].canRecover + for recoveryState > 0 && !canRecover { + recoveryState-- + canRecover = parserActions.table[p.stack.peek(recoveryState)].canRecover + } + return +} + +func (p *Parser) newError(err error) error { + e := &parseError.Error{ + Err: err, + StackTop: p.stack.top(), + ErrorToken: p.nextToken, + } + actRow := parserActions.table[p.stack.top()] + for i, t := range actRow.actions { + if t != nil { + e.ExpectedTokens = append(e.ExpectedTokens, token.TokMap.Id(token.Type(i))) + } + } + return e +} + +func (p *Parser) prepareParsing(scanner iface.Scanner, longest bool) error { + p.Reset() + p.needsRepositioning = true + p.isNonDeterministic = true + if p.needsRepositioning { + if streamScanner, _ := scanner.(iface.StreamScanner); streamScanner != nil { + p.underlyingStream = streamScanner.GetStream() + } + if p.tokens, _ = scanner.(iface.CheckPointable); p.tokens == nil || p.underlyingStream == nil { + return errNotRepositionable + } + } else { + if p.tokens, _ = scanner.(iface.CheckPointable); p.tokens == nil { + p.tokens = fakeCheckPointable{} + } + } + return nil +} + +func (p *Parser) Parse(scanner iface.Scanner) (res interface{}, err error) { + if err := p.prepareParsing(scanner, false); err != nil { + return nil, err + } + return p.parse(scanner, false) +} + +func (p *Parser) ParseLongestPrefix(scanner iface.Scanner) (res interface{}, err error, parsed []byte) { + if err := p.prepareParsing(scanner, true); err != nil { + return nil, err, []byte{} + } + startPoint := p.tokens.GetCheckPoint() + res, err = p.parse(scanner, true) + if err == nil { + currPoint := p.tokens.GetCheckPoint() + p.tokens.GotoCheckPoint(startPoint) + parsed = make([]byte, currPoint.DistanceFrom(startPoint)) + p.underlyingStream.Read(parsed) + p.tokens.GotoCheckPoint(currPoint) + } + return +} + +var errNotRepositionable = errors.New("scanner not repositionable") + +func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, err error) { + readNextToken := func() { + p.checkPoint = p.tokens.GetCheckPoint() + p.nextToken = scanner.Scan() + p.afterPos = p.tokens.GetCheckPoint() + return + } + readNextToken() + for acc := false; !acc; { + action := parserActions.table[p.stack.top()].actions[p.nextToken.Type] + if action == nil && p.isNonDeterministic { + // + // If no action, check if we have some context dependent parsing to try + // + p.checkPoint = p.checkPoint.Advance(len(p.nextToken.IgnoredPrefix)) + for _, cdAction := range parserActions.table[p.stack.top()].cdActions { + p.tokens.GotoCheckPoint(p.checkPoint) + cd_res, cd_err, cd_parsed := cdAction.tokenScanner(p.underlyingStream, p.userContext) + if cd_err == nil && len(cd_parsed) > 0 { + action = parserActions.table[p.stack.top()].actions[cdAction.tokenIndex] + if action != nil { + p.nextToken.Foreign = true + p.nextToken.ForeignAstNode = cd_res + p.nextToken.Lit = cd_parsed + p.nextToken.Type = token.Type(cdAction.tokenIndex) + break + } + } + } + } + // + // Still no action? If a longest possible parsing is requested in place + // of a full text, we should try to check if an EOF here would have led + // to a successful parsing instead + // Rember that token.EOF is 1, that is the index of SyntaxEof into symbol table + // Dirty, dirty, dirty... but I found it as it is, and I prefer not to touch + // + if action == nil && longest { + p.tokens.GotoCheckPoint(p.checkPoint) + action = parserActions.table[p.stack.top()].actions[token.EOF] + if action == nil { + // + // ok, let's consume the token then + // + p.tokens.GotoCheckPoint(p.afterPos) + } + } + + // + // Well, no action is no action after all... + // + if action == nil { + if recovered, errAttrib := p.Error(nil, scanner); !recovered { + p.nextToken = errAttrib.ErrorToken + return nil, p.newError(nil) + } + if action = parserActions.table[p.stack.top()].actions[p.nextToken.Type]; action == nil { + panic("Error recovery led to invalid action") + } + } + + switch act := action.(type) { + case accept: + res = p.stack.popN(1)[0] + acc = true + case shift: + p.stack.push(int(act), p.nextToken) + if p.nextToken.Foreign { + p.stack.push(int(act), p.nextToken.ForeignAstNode) + } + readNextToken() + case reduce: + prod := productionsTable[int(act)] + attrib, err := prod.ReduceFunc(p.userContext, p.stack.popN(prod.NumSymbols)) + if err != nil { + return nil, p.newError(err) + } else { + p.stack.push(gotoTab[p.stack.top()][prod.NTType], attrib) + } + default: + panic("unknown action: " + action.String()) + } + } + return res, nil +} diff --git a/example/ctx/ctx2.grammar/ctx2/internal/parser/productionstable.go b/example/ctx/ctx2.grammar/ctx2/internal/parser/productionstable.go new file mode 100644 index 00000000..abd67e54 --- /dev/null +++ b/example/ctx/ctx2.grammar/ctx2/internal/parser/productionstable.go @@ -0,0 +1,109 @@ +// Code generated by gocc; DO NOT EDIT. + +package parser + +import ( + "github.com/maxcalandrelli/gocc/example/ctx/ast" +) + +import ( + "fmt" + "github.com/maxcalandrelli/gocc/example/ctx/ctx2.grammar/ctx2/internal/token" + "github.com/maxcalandrelli/gocc/example/ctx/ctx2.grammar/ctx2/internal/util" + "strings" +) + +func getString(X Attrib) string { + switch X.(type) { + case *token.Token: + return string(X.(*token.Token).Lit) + case string: + return X.(string) + } + return fmt.Sprintf("%q", X) +} + +func unescape(s string) string { + return util.EscapedString(s).Unescape() +} + +func unquote(s string) string { + r, _, _ := util.EscapedString(s).Unquote() + return r +} + +func lc(s string) string { + return strings.ToLower(s) +} + +func uc(s string) string { + return strings.ToUpper(s) +} + +type ( + //TODO: change type and variable names to be consistent with other tables + ProdTab [numProductions]ProdTabEntry + ProdTabEntry struct { + String string + Id string + NTType int + Index int + NumSymbols int + ReduceFunc func(interface{}, []Attrib) (Attrib, error) + } + Attrib interface { + } +) + +var productionsTable = ProdTab{ + ProdTabEntry{ + String: `S' : Π << >>`, + Id: "S'", + NTType: 0, + Index: 0, + NumSymbols: 1, + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { + return X[0], nil + }, + }, + ProdTabEntry{ + String: `StmtList : Π << ast.NewStmtList($0s) >>`, + Id: "StmtList", + NTType: 1, + Index: 1, + NumSymbols: 1, + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { + return ast.NewStmtList(getString(X[0])) + }, + }, + ProdTabEntry{ + String: `StmtList : Π Π << ast.AppendStmt($0.(ast.StmtList), $1s) >>`, + Id: "StmtList", + NTType: 1, + Index: 2, + NumSymbols: 2, + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { + return ast.AppendStmt(X[0].(ast.StmtList), getString(X[1])) + }, + }, + ProdTabEntry{ + String: `Stmt : id << ast.NewStmt($0e) >>`, + Id: "Stmt", + NTType: 2, + Index: 3, + NumSymbols: 1, + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { + return ast.NewStmt(unescape(getString(X[0]))) + }, + }, + ProdTabEntry{ + String: `Stmt : μ << ast.CalcResult($1) >>`, + Id: "Stmt", + NTType: 2, + Index: 4, + NumSymbols: 2, + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { + return ast.CalcResult(X[1]) + }, + }, +} diff --git a/example/ctx/ctx2.grammar/ctx2/internal/token/token.go b/example/ctx/ctx2.grammar/ctx2/internal/token/token.go new file mode 100644 index 00000000..90eeb929 --- /dev/null +++ b/example/ctx/ctx2.grammar/ctx2/internal/token/token.go @@ -0,0 +1,93 @@ +// Code generated by gocc; DO NOT EDIT. + +package token + +import ( + "fmt" +) + +type Token struct { + Type + Lit []byte + IgnoredPrefix []byte + Pos + ForeignAstNode interface{} + Foreign bool +} + +type Type int + +const ( + INVALID Type = iota + EOF +) + +type Pos struct { + Offset int + Line int + Column int +} + +func (p Pos) String() string { + return fmt.Sprintf("Pos(offset=%d, line=%d, column=%d)", p.Offset, p.Line, p.Column) +} + +func (p Pos) StartingFrom(base Pos) Pos { + r := base + r.Offset += p.Offset + r.Line += p.Line + r.Column = p.Column + if p.Line > 0 && base.Line > 0 { + r.Line-- + } + if r.Column < 1 { + r.Column = 1 + } + return r +} + +type TokenMap struct { + typeMap []string + idMap map[string]Type + litMap map[string]Type +} + +func (m TokenMap) Id(tok Type) string { + if int(tok) < len(m.typeMap) { + return m.typeMap[tok] + } + return "unknown" +} + +func (m TokenMap) Type(tok string) Type { + if typ, exist := m.idMap[tok]; exist { + return typ + } + return INVALID +} + +func (m TokenMap) TokenString(tok *Token) string { + return fmt.Sprintf("%s(%d,<%s>)", m.Id(tok.Type), tok.Type, tok.Lit) +} + +func (m TokenMap) StringType(typ Type) string { + return fmt.Sprintf("%s(%d)", m.Id(typ), typ) +} + +var TokMap = TokenMap{ + typeMap: []string{ + "INVALID", + "Ω", + "id", + "μ", + }, + + idMap: map[string]Type{ + "INVALID": 0, + "Ω": 1, + "id": 2, + "μ": 3, + }, + + litMap: map[string]Type{}, +} diff --git a/example/ctx/ctx2.grammar/ctx2/internal/util/litconv.go b/example/ctx/ctx2.grammar/ctx2/internal/util/litconv.go new file mode 100644 index 00000000..1aeb6166 --- /dev/null +++ b/example/ctx/ctx2.grammar/ctx2/internal/util/litconv.go @@ -0,0 +1,108 @@ +// Code generated by gocc; DO NOT EDIT. + +package util + +import ( + "fmt" + "strconv" + "unicode" + "unicode/utf8" +) + +/* Interface */ + +/* +Convert the literal value of a scanned token to rune +*/ +func RuneValue(lit []byte) rune { + if lit[1] == '\\' { + return escapeCharVal(lit) + } + r, size := utf8.DecodeRune(lit[1:]) + if size != len(lit)-2 { + panic(fmt.Sprintf("Error decoding rune. Lit: %s, rune: %d, size%d\n", lit, r, size)) + } + return r +} + +/* +Convert the literal value of a scanned token to int64 +*/ +func IntValue(lit []byte) (int64, error) { + return strconv.ParseInt(string(lit), 10, 64) +} + +/* +Convert the literal value of a scanned token to uint64 +*/ +func UintValue(lit []byte) (uint64, error) { + return strconv.ParseUint(string(lit), 10, 64) +} + +/* Util */ + +func escapeCharVal(lit []byte) rune { + var i, base, max uint32 + offset := 2 + switch lit[offset] { + case 'a': + return '\a' + case 'b': + return '\b' + case 'f': + return '\f' + case 'n': + return '\n' + case 'r': + return '\r' + case 't': + return '\t' + case 'v': + return '\v' + case '\\': + return '\\' + case '\'': + return '\'' + case '0', '1', '2', '3', '4', '5', '6', '7': + i, base, max = 3, 8, 255 + case 'x': + i, base, max = 2, 16, 255 + offset++ + case 'u': + i, base, max = 4, 16, unicode.MaxRune + offset++ + case 'U': + i, base, max = 8, 16, unicode.MaxRune + offset++ + default: + panic(fmt.Sprintf("Error decoding character literal: %s\n", lit)) + } + + var x uint32 + for ; i > 0 && offset < len(lit)-1; i-- { + ch, size := utf8.DecodeRune(lit[offset:]) + offset += size + d := uint32(digitVal(ch)) + if d >= base { + panic(fmt.Sprintf("charVal(%s): illegal character (%c) in escape sequence. size=%d, offset=%d", lit, ch, size, offset)) + } + x = x*base + d + } + if x > max || 0xD800 <= x && x < 0xE000 { + panic(fmt.Sprintf("Error decoding escape char value. Lit:%s, offset:%d, escape sequence is invalid Unicode code point\n", lit, offset)) + } + + return rune(x) +} + +func digitVal(ch rune) int { + switch { + case '0' <= ch && ch <= '9': + return int(ch) - '0' + case 'a' <= ch && ch <= 'f': + return int(ch) - 'a' + 10 + case 'A' <= ch && ch <= 'F': + return int(ch) - 'A' + 10 + } + return 16 // larger than any legal digit val +} diff --git a/example/ctx/ctx2.grammar/ctx2/internal/util/rune.go b/example/ctx/ctx2.grammar/ctx2/internal/util/rune.go new file mode 100644 index 00000000..788edfde --- /dev/null +++ b/example/ctx/ctx2.grammar/ctx2/internal/util/rune.go @@ -0,0 +1,140 @@ +// Code generated by gocc; DO NOT EDIT. + + +package util + +import ( + "fmt" + "unicode" + "unicode/utf8" +) + +func RuneToString(r rune) string { + if r >= 0x20 && r < 0x7f { + return fmt.Sprintf("'%c'", r) + } + switch r { + case 0x07: + return "'\\a'" + case 0x08: + return "'\\b'" + case 0x0C: + return "'\\f'" + case 0x0A: + return "'\\n'" + case 0x0D: + return "'\\r'" + case 0x09: + return "'\\t'" + case 0x0b: + return "'\\v'" + case 0x5c: + return "'\\\\\\'" + case 0x27: + return "'\\''" + case 0x22: + return "'\\\"'" + } + if r < 0x10000 { + return fmt.Sprintf("\\u%04x", r) + } + return fmt.Sprintf("\\U%08x", r) +} + +type EscapedString string + +func (str EscapedString) Unquote() (unquoted string, wasQuoted bool, quoteType rune) { + if len(str) > 1 { + r := str[0] + if (r == '"' || r == '\x60' || r == '\'') && r == str[len(str)-1] { + str = str[1 : len(str)-1] + } + return string(str), true, rune(r) + } + return string(str), false, 0 +} + +func (str EscapedString) Unescape() string { + var ( + res string + r rune + size int + ) + for s := 0; s < len(str); s += size { + if str[s] == '\\' { + r, size = str[s+1:].EscapedFirstCharValue() + size++ + } else { + r, size = utf8.DecodeRuneInString(string(str)[s:]) + } + res += string(r) + } + return res +} + +func (str EscapedString) EscapedFirstCharValue() (rune, int) { + var i, base, max uint32 + offset := 0 + switch str[offset] { + case '\'', '"': + return rune(str[offset]), 1 + case 'a': + return '\a', 1 + case 'b': + return '\b', 1 + case 'f': + return '\f', 1 + case 'n': + return '\n', 1 + case 'r': + return '\r', 1 + case 't': + return '\t', 1 + case 'v': + return '\v', 1 + case '\\': + return '\\', 1 + case '0', '1', '2', '3', '4', '5', '6', '7': + i, base, max = 3, 8, 255 + case 'x': + i, base, max = 2, 16, 255 + offset++ + case 'u': + i, base, max = 4, 16, unicode.MaxRune + offset++ + case 'U': + i, base, max = 8, 32, unicode.MaxRune + offset++ + default: + panic(fmt.Sprintf("Error decoding character literal: %s\n", str[offset:])) + } + + var x uint32 + for ; i > 0 && offset < len(str); i-- { + ch, size := utf8.DecodeRuneInString(string(str)[offset:]) + offset += size + d := uint32(HexDigitValue(ch)) + if d >= base { + panic(fmt.Sprintf("charVal(%s): illegal character (%c) in escape sequence. size=%d, offset=%d", str, str[offset], size, offset)) + } + x = x*base + d + } + if x > max || 0xD800 <= x && x < 0xE000 { + panic(fmt.Sprintf("Error decoding escape char value. Lit:%s, offset:%d, escape sequence is invalid Unicode code point\n", str, offset)) + } + + return rune(x), offset +} + +func HexDigitValue(ch rune) int { + switch { + case '0' <= ch && ch <= '9': + return int(ch) - '0' + case 'a' <= ch && ch <= 'f': + return int(ch) - 'a' + 10 + case 'A' <= ch && ch <= 'F': + return int(ch) - 'A' + 10 + } + return 16 // larger than any legal digit val +} + diff --git a/example/ctx/ctx2.grammar/ctx2/log/LR1_sets.txt b/example/ctx/ctx2.grammar/ctx2/log/LR1_sets.txt new file mode 100644 index 00000000..b1d9f119 --- /dev/null +++ b/example/ctx/ctx2.grammar/ctx2/log/LR1_sets.txt @@ -0,0 +1,72 @@ +S0{ + S' : •Π «Ω» + StmtList : •Π «Ω» + StmtList : •Π Π «Ω» + Stmt : •id «Ω» + Stmt : •μ «Ω» + StmtList : •Π «μ» + StmtList : •Π «id» + StmtList : •Π Π «μ» + StmtList : •Π Π «id» + Stmt : •id «μ» + Stmt : •μ «μ» + Stmt : •id «id» + Stmt : •μ «id» +} +Transitions: + Π -> 1 + Π -> 2 + id -> 3 + μ -> 4 + + +S1{ + S' : Π• «Ω» + StmtList : Π •Π «Ω» + StmtList : Π •Π «μ» + StmtList : Π •Π «id» + Stmt : •id «Ω» + Stmt : •μ «Ω» + Stmt : •id «μ» + Stmt : •μ «μ» + Stmt : •id «id» + Stmt : •μ «id» +} +Transitions: + id -> 3 + μ -> 4 + Π -> 5 + + +S2{ + StmtList : Π• «Ω» + StmtList : Π• «μ» + StmtList : Π• «id» +} +Transitions: + + +S3{ + Stmt : id• «Ω» + Stmt : id• «μ» + Stmt : id• «id» +} +Transitions: + + +S4{ + Stmt : μ• «Ω» + Stmt : μ• «μ» + Stmt : μ• «id» +} +Transitions: + + +S5{ + StmtList : Π Π• «Ω» + StmtList : Π Π• «μ» + StmtList : Π Π• «id» +} +Transitions: + + diff --git a/example/ctx/ctx2.grammar/ctx2/log/first.txt b/example/ctx/ctx2.grammar/ctx2/log/first.txt new file mode 100644 index 00000000..e7b13952 --- /dev/null +++ b/example/ctx/ctx2.grammar/ctx2/log/first.txt @@ -0,0 +1,12 @@ +Π: { + id + μ +} +Π: { + id + μ +} +Π: { + id + μ +} diff --git a/example/ctx/ctx.grammar/ctx/log/lexer_sets.txt b/example/ctx/ctx2.grammar/ctx2/log/lexer_sets.txt similarity index 100% rename from example/ctx/ctx.grammar/ctx/log/lexer_sets.txt rename to example/ctx/ctx2.grammar/ctx2/log/lexer_sets.txt diff --git a/example/ctx/ctx2.grammar/ctx2/log/terminals.txt b/example/ctx/ctx2.grammar/ctx2/log/terminals.txt new file mode 100644 index 00000000..bc6b9081 --- /dev/null +++ b/example/ctx/ctx2.grammar/ctx2/log/terminals.txt @@ -0,0 +1,4 @@ +ά +id +μ diff --git a/example/ctx/ctx2.grammar/ctx2/main/ctx.go b/example/ctx/ctx2.grammar/ctx2/main/ctx.go new file mode 100644 index 00000000..a653f83c --- /dev/null +++ b/example/ctx/ctx2.grammar/ctx2/main/ctx.go @@ -0,0 +1,58 @@ +package main + +import ( + "flag" + "fmt" + "os" + "strings" + + ctx "github.com/maxcalandrelli/gocc/example/ctx/ctx2.grammar/ctx2" +) + +func showResult(r interface{}, e error, p []byte) { + if e != nil { + fmt.Fprintf(os.Stderr, "parsing returned the following error: %s\n", e.Error()) + } else { + if len(p) > 0 { + fmt.Printf("r=%#v, (%s)\n", r, string(p)) + } else { + fmt.Printf("r=%#v\n", r) + } + } +} + +var ( + File string + Text string + Longest bool +) + +func parse(longest bool, lex *ctx.Lexer) (res interface{}, err error, parsed []byte) { + if longest { + return ctx.NewParser().ParseLongestPrefix(lex) + } else { + res, err = ctx.NewParser().Parse(lex) + parsed = []byte{} + } + return +} + +func main() { + flag.StringVar(&File, "file", "", "parse also text in file") + flag.StringVar(&Text, "text", "", "parse also text given with flag") + flag.BoolVar(&Longest, "longest", false, "parse longest possible part") + flag.Parse() + if Text > "" { + showResult(parse(Longest, ctx.NewLexerString(Text))) + } + if File > "" { + l, e := ctx.NewLexerFile(File) + if e != nil { + panic(e) + } + showResult(parse(Longest, l)) + } + if str := strings.Join(flag.Args(), " "); str > "" { + showResult(parse(Longest, ctx.NewLexerString(str))) + } +} diff --git a/example/ctx/ctx2.grammar/ctx2/util.go b/example/ctx/ctx2.grammar/ctx2/util.go new file mode 100644 index 00000000..5b0fd71e --- /dev/null +++ b/example/ctx/ctx2.grammar/ctx2/util.go @@ -0,0 +1,25 @@ +// Code generated by gocc; DO NOT EDIT. + +package ctx + +import ( + "github.com/maxcalandrelli/gocc/example/ctx/ctx2.grammar/ctx2/internal/util" +) + +type EscapedString = util.EscapedString + +func RuneToString(r rune) string { + return util.RuneToString(r) +} + +func HexDigitValue(ch rune) int { + return util.HexDigitValue(ch) +} + +func IntValue(lit []byte) (int64, error) { + return util.IntValue(lit) +} + +func UintValue(lit []byte) (uint64, error) { + return util.UintValue(lit) +} diff --git a/example/ctx/ctx2.log b/example/ctx/ctx2.log new file mode 100644 index 00000000..268a96ff --- /dev/null +++ b/example/ctx/ctx2.log @@ -0,0 +1,12 @@ +gocc version 2.1.0001 +-a = true +-debug_lexer = false +-debug_parser = false +-h = false +-no_lexer = false +-o = /home/max/go/src/github.com/maxcalandrelli/gocc/example/ctx/ctx2.grammar/ctx2 +-p = github.com/maxcalandrelli/gocc/example/ctx/ctx2.grammar/ctx2 +-u = false +-v = true +-internal = internal +-bugs = lexer_dots:fix,lexer_regdefs:ignore diff --git a/example/ctx/ctx_test.go b/example/ctx/ctx_test.go index 67f629a4..90eb9c39 100644 --- a/example/ctx/ctx_test.go +++ b/example/ctx/ctx_test.go @@ -5,47 +5,45 @@ import ( "testing" "github.com/maxcalandrelli/gocc/example/ctx/ast" - "github.com/maxcalandrelli/gocc/example/ctx/ctx.grammar/ctx" - "github.com/maxcalandrelli/gocc/example/ctx/ctx1.grammar/ctx1" + ctx0 "github.com/maxcalandrelli/gocc/example/ctx/ctx0.grammar/ctx0" + ctx1 "github.com/maxcalandrelli/gocc/example/ctx/ctx1.grammar/ctx1" + ctx2 "github.com/maxcalandrelli/gocc/example/ctx/ctx2.grammar/ctx2" ) func TestPass(t *testing.T) { //sml, err := test("\\u0022AA\\u0022 other a b c calc 12 * 6 + 4 \\u03b3k\\u03b5 d e \\u03b3_\\u03b5 \\u03b3\\u03b5 f") - sml0, sml1, err0, err1 := test("β1α αβ1α β11β1β11 αβ33 αβ0β9 ") - if err0 != nil { - t.Error(err0.Error()) + sml, err := test("β1α αβ1α 6 + 4 β11β1β11 αβ33 αβ0β9 ") + for _ix := 0; _ix < len(sml); _ix++ { + if err[_ix] != nil { + t.Log(err[_ix].Error()) + t.Fail() + } + fmt.Printf("output #%d: %s\n", _ix+1, sml[_ix]) } - if err1 != nil { - t.Error(err1.Error()) - } - fmt.Printf("output0: %s\n", sml0) - fmt.Printf("output1: %s\n", sml1) } func TestFail(t *testing.T) { - _, _, err0, err1 := test("a b 22 c d e f") - if err0 == nil { - t.Fatal("expected parse error (0)") - } else { - fmt.Printf("Parsing failed as expected (0): %v\n", err0) - } - if err1 == nil { - t.Fatal("expected parse error (1)") - } else { - fmt.Printf("Parsing failed as expected (1): %v\n", err0) + _, err := test("αβ1α β0 22 β9 α a α") + for _ix := 0; _ix < len(err); _ix++ { + if err[_ix] == nil { + t.Fatal("expected parse error") + } else { + fmt.Printf("Parsing failed as expected: %v\n", err[_ix]) + } } } -func test(src string) (astree0, astree1 ast.StmtList, err0, err1 error) { - var a0, a1 interface{} - a0, err0 = ctx.ParseText(src) - a1, err1 = ctx1.ParseText(src) +func test1(src string, astree []ast.StmtList, errors []error, p func(string) (interface{}, error)) ([]ast.StmtList, []error) { + at := ast.StmtList(nil) + a, err := p(src) + at, _ = a.(ast.StmtList) + return append(astree, at), append(errors, err) +} + +func test(src string) (astree []ast.StmtList, err []error) { fmt.Printf("input: %s\n", src) - if err0 == nil { - astree0 = a0.(ast.StmtList) - } - if err1 == nil { - astree1 = a1.(ast.StmtList) - } + astree, err = test1(src, astree, err, ctx0.ParseText) + astree, err = test1(src, astree, err, ctx1.ParseText) + astree, err = test1(src, astree, err, ctx2.ParseText) return } diff --git a/example/ctx/log b/example/ctx/log deleted file mode 100644 index 8d72285c..00000000 --- a/example/ctx/log +++ /dev/null @@ -1,130 +0,0 @@ -gocc ctx.bnf -sdt: -SDT: <$0> => -sdt: -SDT: <$0> => -SDT: <$1> => -sdt: -SDT: <$0> => -sdt: -SDT: <$2> => -panic: 75:31: missing ',' in argument list (and 2 more errors) in -// Code generated by gocc; DO NOT EDIT. - -package parser - -import ( - "github.com/maxcalandrelli/gocc/example/ctx/ast" - ) - -import ( - "fmt" - "strings" - "github.com/maxcalandrelli/gocc/example/ctx/ctx.grammar/ctx/internal/token" - "github.com/maxcalandrelli/gocc/example/ctx/ctx.grammar/ctx/internal/util" -) - -func getString(X Attrib) string { - switch X.(type) { - case *token.Token: return string(X.(*token.Token).Lit) - case string: return X.(string) - } - return fmt.Sprintf("%q", X) -} - -func unescape(s string) string { - return util.EscapedString(s).Unescape() -} - -func unquote(s string) string { - r, _, _ := util.EscapedString(s).Unquote() - return r -} - -func lc(s string) string { - return strings.ToLower(s) -} - -func uc(s string) string { - return strings.ToUpper(s) -} - - -type ( - //TODO: change type and variable names to be consistent with other tables - ProdTab [numProductions]ProdTabEntry - ProdTabEntry struct { - String string - Id string - NTType int - Index int - NumSymbols int - ReduceFunc func(interface{}, []Attrib) (Attrib, error) - } - Attrib interface { - } -) - -var productionsTable = ProdTab{ - ProdTabEntry{ - String: `S' : Π << >>`, - Id: "S'", - NTType: 0, - Index: 0, - NumSymbols: 1, - ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { - return X[0], nil - }, - }, - ProdTabEntry{ - String: `StmtList : Π << ast.NewStmtList($0:s) >>`, - Id: "StmtList", - NTType: 1, - Index: 1, - NumSymbols: 1, - ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { - return ast.NewStmtList(X[0]:s) - }, - }, - ProdTabEntry{ - String: `StmtList : Π Π << ast.AppendStmt($0, $1:s) >>`, - Id: "StmtList", - NTType: 1, - Index: 2, - NumSymbols: 2, - ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { - return ast.AppendStmt(X[0], X[1]:s) - }, - }, - ProdTabEntry{ - String: `Stmt : id << ast.NewStmt($0:s) >>`, - Id: "Stmt", - NTType: 2, - Index: 3, - NumSymbols: 1, - ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { - return ast.NewStmt(X[0]:s) - }, - }, - ProdTabEntry{ - String: `Stmt : Λ μ << ast.CalcResult($2) >>`, - Id: "Stmt", - NTType: 2, - Index: 4, - NumSymbols: 3, - ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { - return ast.CalcResult(X[2]) - }, - }, -} - - -goroutine 1 [running]: -github.com/maxcalandrelli/gocc/internal/parser/gen/golang.GenProductionsTable(0xc000016440, 0x3a, 0xc000022230, 0x4b, 0xc000016500, 0x3e, 0xc000077410, 0x5, 0x6, 0xc00009c3c0, ...) - /home/max/go/src/github.com/maxcalandrelli/gocc/internal/parser/gen/golang/productionstable.go:54 +0x67f -github.com/maxcalandrelli/gocc/internal/parser/gen.Gen(0xc000016440, 0x3a, 0xc000022230, 0x4b, 0xc000016500, 0x3e, 0xc000077410, 0x5, 0x6, 0xc00009c3c0, ...) - /home/max/go/src/github.com/maxcalandrelli/gocc/internal/parser/gen/gen.go:37 +0x346 -main.main() - /home/max/go/src/github.com/maxcalandrelli/gocc/main.go:230 +0x92b -Makefile:2: recipe for target 'regenerate' failed -make: *** [regenerate] Error 2 diff --git a/example/errorrecovery/er.grammar/er/iface/er.go b/example/errorrecovery/er.grammar/er/iface/er.go index 7483136c..a7631a52 100644 --- a/example/errorrecovery/er.grammar/er/iface/er.go +++ b/example/errorrecovery/er.grammar/er/iface/er.go @@ -4,6 +4,7 @@ package iface import ( "github.com/maxcalandrelli/gocc/example/errorrecovery/er.grammar/er/internal/errors" + "github.com/maxcalandrelli/gocc/example/errorrecovery/er.grammar/er/internal/io/stream" "github.com/maxcalandrelli/gocc/example/errorrecovery/er.grammar/er/internal/token" "io" ) @@ -48,3 +49,15 @@ const ( func GetTokenMap() TokenMap { return token.TokMap } + +func NewWindowReaderFromBytes(src []byte) stream.WindowReader { + return stream.NewWindowReaderFromBytes(src) +} + +func NewWindowReader(rdr io.Reader) stream.WindowReader { + return stream.NewWindowReader(rdr) +} + +func NewLimitedWindowReader(rdr io.Reader, sizeMin, sizeMax int) stream.WindowReader { + return stream.NewLimitedWindowReader(rdr, sizeMin, sizeMax) +} diff --git a/example/errorrecovery/er.grammar/er/internal/parser/parser.go b/example/errorrecovery/er.grammar/er/internal/parser/parser.go index 6ea1b2f1..d3c41857 100644 --- a/example/errorrecovery/er.grammar/er/internal/parser/parser.go +++ b/example/errorrecovery/er.grammar/er/internal/parser/parser.go @@ -280,8 +280,9 @@ func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, er // // If no action, check if we have some context dependent parsing to try // + p.checkPoint = p.checkPoint.Advance(len(p.nextToken.IgnoredPrefix)) for _, cdAction := range parserActions.table[p.stack.top()].cdActions { - p.tokens.GotoCheckPoint(p.checkPoint.Advance(len(p.nextToken.IgnoredPrefix))) + p.tokens.GotoCheckPoint(p.checkPoint) cd_res, cd_err, cd_parsed := cdAction.tokenScanner(p.underlyingStream, p.userContext) if cd_err == nil && len(cd_parsed) > 0 { action = parserActions.table[p.stack.top()].actions[cdAction.tokenIndex] diff --git a/example/errorrecovery/er.grammar/er/internal/parser/productionstable.go b/example/errorrecovery/er.grammar/er/internal/parser/productionstable.go index 053d13bb..95517242 100644 --- a/example/errorrecovery/er.grammar/er/internal/parser/productionstable.go +++ b/example/errorrecovery/er.grammar/er/internal/parser/productionstable.go @@ -4,6 +4,40 @@ package parser import "github.com/maxcalandrelli/gocc/example/errorrecovery/ast" +import ( + "fmt" + "github.com/maxcalandrelli/gocc/example/errorrecovery/er.grammar/er/internal/token" + "github.com/maxcalandrelli/gocc/example/errorrecovery/er.grammar/er/internal/util" + "strings" +) + +func getString(X Attrib) string { + switch X.(type) { + case *token.Token: + return string(X.(*token.Token).Lit) + case string: + return X.(string) + } + return fmt.Sprintf("%q", X) +} + +func unescape(s string) string { + return util.EscapedString(s).Unescape() +} + +func unquote(s string) string { + r, _, _ := util.EscapedString(s).Unquote() + return r +} + +func lc(s string) string { + return strings.ToLower(s) +} + +func uc(s string) string { + return strings.ToUpper(s) +} + type ( //TODO: change type and variable names to be consistent with other tables ProdTab [numProductions]ProdTabEntry @@ -31,7 +65,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `StmtList : Π << ast.NewStmtList(X[0]) >>`, + String: `StmtList : Π << ast.NewStmtList($0) >>`, Id: "StmtList", NTType: 1, Index: 1, @@ -41,7 +75,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `StmtList : Π Π << ast.AppendStmt(X[0], X[1]) >>`, + String: `StmtList : Π Π << ast.AppendStmt($0, $1) >>`, Id: "StmtList", NTType: 1, Index: 2, @@ -51,7 +85,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `Stmt : id << ast.NewStmt(X[0]) >>`, + String: `Stmt : id << ast.NewStmt($0) >>`, Id: "Stmt", NTType: 2, Index: 3, diff --git a/example/errorrecovery/er.grammar/er/internal/util/rune.go b/example/errorrecovery/er.grammar/er/internal/util/rune.go index bd8523a4..788edfde 100644 --- a/example/errorrecovery/er.grammar/er/internal/util/rune.go +++ b/example/errorrecovery/er.grammar/er/internal/util/rune.go @@ -1,9 +1,12 @@ // Code generated by gocc; DO NOT EDIT. + package util import ( "fmt" + "unicode" + "unicode/utf8" ) func RuneToString(r rune) string { @@ -37,3 +40,101 @@ func RuneToString(r rune) string { } return fmt.Sprintf("\\U%08x", r) } + +type EscapedString string + +func (str EscapedString) Unquote() (unquoted string, wasQuoted bool, quoteType rune) { + if len(str) > 1 { + r := str[0] + if (r == '"' || r == '\x60' || r == '\'') && r == str[len(str)-1] { + str = str[1 : len(str)-1] + } + return string(str), true, rune(r) + } + return string(str), false, 0 +} + +func (str EscapedString) Unescape() string { + var ( + res string + r rune + size int + ) + for s := 0; s < len(str); s += size { + if str[s] == '\\' { + r, size = str[s+1:].EscapedFirstCharValue() + size++ + } else { + r, size = utf8.DecodeRuneInString(string(str)[s:]) + } + res += string(r) + } + return res +} + +func (str EscapedString) EscapedFirstCharValue() (rune, int) { + var i, base, max uint32 + offset := 0 + switch str[offset] { + case '\'', '"': + return rune(str[offset]), 1 + case 'a': + return '\a', 1 + case 'b': + return '\b', 1 + case 'f': + return '\f', 1 + case 'n': + return '\n', 1 + case 'r': + return '\r', 1 + case 't': + return '\t', 1 + case 'v': + return '\v', 1 + case '\\': + return '\\', 1 + case '0', '1', '2', '3', '4', '5', '6', '7': + i, base, max = 3, 8, 255 + case 'x': + i, base, max = 2, 16, 255 + offset++ + case 'u': + i, base, max = 4, 16, unicode.MaxRune + offset++ + case 'U': + i, base, max = 8, 32, unicode.MaxRune + offset++ + default: + panic(fmt.Sprintf("Error decoding character literal: %s\n", str[offset:])) + } + + var x uint32 + for ; i > 0 && offset < len(str); i-- { + ch, size := utf8.DecodeRuneInString(string(str)[offset:]) + offset += size + d := uint32(HexDigitValue(ch)) + if d >= base { + panic(fmt.Sprintf("charVal(%s): illegal character (%c) in escape sequence. size=%d, offset=%d", str, str[offset], size, offset)) + } + x = x*base + d + } + if x > max || 0xD800 <= x && x < 0xE000 { + panic(fmt.Sprintf("Error decoding escape char value. Lit:%s, offset:%d, escape sequence is invalid Unicode code point\n", str, offset)) + } + + return rune(x), offset +} + +func HexDigitValue(ch rune) int { + switch { + case '0' <= ch && ch <= '9': + return int(ch) - '0' + case 'a' <= ch && ch <= 'f': + return int(ch) - 'a' + 10 + case 'A' <= ch && ch <= 'F': + return int(ch) - 'A' + 10 + } + return 16 // larger than any legal digit val +} + diff --git a/example/errorrecovery/er.grammar/er/main/main.go b/example/errorrecovery/er.grammar/er/main/er.go similarity index 100% rename from example/errorrecovery/er.grammar/er/main/main.go rename to example/errorrecovery/er.grammar/er/main/er.go diff --git a/example/errorrecovery/er.grammar/er/util.go b/example/errorrecovery/er.grammar/er/util.go new file mode 100644 index 00000000..0428d95a --- /dev/null +++ b/example/errorrecovery/er.grammar/er/util.go @@ -0,0 +1,25 @@ +// Code generated by gocc; DO NOT EDIT. + +package er + +import ( + "github.com/maxcalandrelli/gocc/example/errorrecovery/er.grammar/er/internal/util" +) + +type EscapedString = util.EscapedString + +func RuneToString(r rune) string { + return util.RuneToString(r) +} + +func HexDigitValue(ch rune) int { + return util.HexDigitValue(ch) +} + +func IntValue(lit []byte) (int64, error) { + return util.IntValue(lit) +} + +func UintValue(lit []byte) (uint64, error) { + return util.UintValue(lit) +} diff --git a/example/examples.sh b/example/examples.sh new file mode 100755 index 00000000..51998d7a --- /dev/null +++ b/example/examples.sh @@ -0,0 +1,2 @@ +#!/bin/bash +for dir in $(find . -mindepth 1 -maxdepth 1 -type d) ; do ( echo -e "\n\n\n******\nTest: $(basename $dir)\n******" ;cd $dir ; rm -rf *.grammar ; make ; go test -v ) ; done \ No newline at end of file diff --git a/example/mail/mail.grammar/mail/iface/mail.go b/example/mail/mail.grammar/mail/iface/mail.go index dd683a33..8fbde76a 100644 --- a/example/mail/mail.grammar/mail/iface/mail.go +++ b/example/mail/mail.grammar/mail/iface/mail.go @@ -3,6 +3,7 @@ package iface import ( + "github.com/maxcalandrelli/gocc/example/mail/mail.grammar/mail/internal/io/stream" "github.com/maxcalandrelli/gocc/example/mail/mail.grammar/mail/internal/token" "io" ) @@ -45,3 +46,15 @@ const ( func GetTokenMap() TokenMap { return token.TokMap } + +func NewWindowReaderFromBytes(src []byte) stream.WindowReader { + return stream.NewWindowReaderFromBytes(src) +} + +func NewWindowReader(rdr io.Reader) stream.WindowReader { + return stream.NewWindowReader(rdr) +} + +func NewLimitedWindowReader(rdr io.Reader, sizeMin, sizeMax int) stream.WindowReader { + return stream.NewLimitedWindowReader(rdr, sizeMin, sizeMax) +} diff --git a/example/mail/mail.grammar/mail/internal/lexer/transitiontable.go b/example/mail/mail.grammar/mail/internal/lexer/transitiontable.go index d3c1c3a4..349e9ec6 100644 --- a/example/mail/mail.grammar/mail/internal/lexer/transitiontable.go +++ b/example/mail/mail.grammar/mail/internal/lexer/transitiontable.go @@ -391,8 +391,9 @@ var TransTab = TransitionTable{ switch { case r == 64: // ['@','@'] return 5 + default: + return 7 } - return NoState }, // S12 func(r rune) int { diff --git a/example/mail/mail.grammar/mail/internal/util/rune.go b/example/mail/mail.grammar/mail/internal/util/rune.go index bd8523a4..788edfde 100644 --- a/example/mail/mail.grammar/mail/internal/util/rune.go +++ b/example/mail/mail.grammar/mail/internal/util/rune.go @@ -1,9 +1,12 @@ // Code generated by gocc; DO NOT EDIT. + package util import ( "fmt" + "unicode" + "unicode/utf8" ) func RuneToString(r rune) string { @@ -37,3 +40,101 @@ func RuneToString(r rune) string { } return fmt.Sprintf("\\U%08x", r) } + +type EscapedString string + +func (str EscapedString) Unquote() (unquoted string, wasQuoted bool, quoteType rune) { + if len(str) > 1 { + r := str[0] + if (r == '"' || r == '\x60' || r == '\'') && r == str[len(str)-1] { + str = str[1 : len(str)-1] + } + return string(str), true, rune(r) + } + return string(str), false, 0 +} + +func (str EscapedString) Unescape() string { + var ( + res string + r rune + size int + ) + for s := 0; s < len(str); s += size { + if str[s] == '\\' { + r, size = str[s+1:].EscapedFirstCharValue() + size++ + } else { + r, size = utf8.DecodeRuneInString(string(str)[s:]) + } + res += string(r) + } + return res +} + +func (str EscapedString) EscapedFirstCharValue() (rune, int) { + var i, base, max uint32 + offset := 0 + switch str[offset] { + case '\'', '"': + return rune(str[offset]), 1 + case 'a': + return '\a', 1 + case 'b': + return '\b', 1 + case 'f': + return '\f', 1 + case 'n': + return '\n', 1 + case 'r': + return '\r', 1 + case 't': + return '\t', 1 + case 'v': + return '\v', 1 + case '\\': + return '\\', 1 + case '0', '1', '2', '3', '4', '5', '6', '7': + i, base, max = 3, 8, 255 + case 'x': + i, base, max = 2, 16, 255 + offset++ + case 'u': + i, base, max = 4, 16, unicode.MaxRune + offset++ + case 'U': + i, base, max = 8, 32, unicode.MaxRune + offset++ + default: + panic(fmt.Sprintf("Error decoding character literal: %s\n", str[offset:])) + } + + var x uint32 + for ; i > 0 && offset < len(str); i-- { + ch, size := utf8.DecodeRuneInString(string(str)[offset:]) + offset += size + d := uint32(HexDigitValue(ch)) + if d >= base { + panic(fmt.Sprintf("charVal(%s): illegal character (%c) in escape sequence. size=%d, offset=%d", str, str[offset], size, offset)) + } + x = x*base + d + } + if x > max || 0xD800 <= x && x < 0xE000 { + panic(fmt.Sprintf("Error decoding escape char value. Lit:%s, offset:%d, escape sequence is invalid Unicode code point\n", str, offset)) + } + + return rune(x), offset +} + +func HexDigitValue(ch rune) int { + switch { + case '0' <= ch && ch <= '9': + return int(ch) - '0' + case 'a' <= ch && ch <= 'f': + return int(ch) - 'a' + 10 + case 'A' <= ch && ch <= 'F': + return int(ch) - 'A' + 10 + } + return 16 // larger than any legal digit val +} + diff --git a/example/mail/mail.grammar/mail/util.go b/example/mail/mail.grammar/mail/util.go new file mode 100644 index 00000000..789b9dd1 --- /dev/null +++ b/example/mail/mail.grammar/mail/util.go @@ -0,0 +1,25 @@ +// Code generated by gocc; DO NOT EDIT. + +package mail + +import ( + "github.com/maxcalandrelli/gocc/example/mail/mail.grammar/mail/internal/util" +) + +type EscapedString = util.EscapedString + +func RuneToString(r rune) string { + return util.RuneToString(r) +} + +func HexDigitValue(ch rune) int { + return util.HexDigitValue(ch) +} + +func IntValue(lit []byte) (int64, error) { + return util.IntValue(lit) +} + +func UintValue(lit []byte) (uint64, error) { + return util.UintValue(lit) +} diff --git a/example/nolexer/nolexer.bnf b/example/nolexer/nolexer.bnf index b387f0c7..a3b1b1a3 100644 --- a/example/nolexer/nolexer.bnf +++ b/example/nolexer/nolexer.bnf @@ -1,20 +1,15 @@ << -import ( - "fmt" - - "github.com/maxcalandrelli/gocc/example/nolexer/nolexer.grammar/nolexer/internal/token" -) >> Hello : Saying name << func () (Attrib, error) { - fmt.Println(string($1.(*token.Token).Lit)); - return nil, nil} () >> + fmt.Println(string($1.(*token.Token).Lit)); + return nil, nil} () >> ; Saying : "hello" << func () (Attrib, error) { - fmt.Print("hello "); + fmt.Print("hello "); return nil, nil} () >> | "hiya" << func () (Attrib, error) { - fmt.Print("hiya "); + fmt.Print("hiya "); return nil, nil} () >> - ; \ No newline at end of file + ; diff --git a/example/nolexer/nolexer.grammar/nolexer/iface/nolexer.go b/example/nolexer/nolexer.grammar/nolexer/iface/nolexer.go index 652f5536..efd50a4d 100644 --- a/example/nolexer/nolexer.grammar/nolexer/iface/nolexer.go +++ b/example/nolexer/nolexer.grammar/nolexer/iface/nolexer.go @@ -4,6 +4,7 @@ package iface import ( "github.com/maxcalandrelli/gocc/example/nolexer/nolexer.grammar/nolexer/internal/errors" + "github.com/maxcalandrelli/gocc/example/nolexer/nolexer.grammar/nolexer/internal/io/stream" "github.com/maxcalandrelli/gocc/example/nolexer/nolexer.grammar/nolexer/internal/token" "io" ) @@ -48,3 +49,15 @@ const ( func GetTokenMap() TokenMap { return token.TokMap } + +func NewWindowReaderFromBytes(src []byte) stream.WindowReader { + return stream.NewWindowReaderFromBytes(src) +} + +func NewWindowReader(rdr io.Reader) stream.WindowReader { + return stream.NewWindowReader(rdr) +} + +func NewLimitedWindowReader(rdr io.Reader, sizeMin, sizeMax int) stream.WindowReader { + return stream.NewLimitedWindowReader(rdr, sizeMin, sizeMax) +} diff --git a/example/nolexer/nolexer.grammar/nolexer/internal/parser/parser.go b/example/nolexer/nolexer.grammar/nolexer/internal/parser/parser.go index 424e6647..ec5a2636 100644 --- a/example/nolexer/nolexer.grammar/nolexer/internal/parser/parser.go +++ b/example/nolexer/nolexer.grammar/nolexer/internal/parser/parser.go @@ -280,8 +280,9 @@ func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, er // // If no action, check if we have some context dependent parsing to try // + p.checkPoint = p.checkPoint.Advance(len(p.nextToken.IgnoredPrefix)) for _, cdAction := range parserActions.table[p.stack.top()].cdActions { - p.tokens.GotoCheckPoint(p.checkPoint.Advance(len(p.nextToken.IgnoredPrefix))) + p.tokens.GotoCheckPoint(p.checkPoint) cd_res, cd_err, cd_parsed := cdAction.tokenScanner(p.underlyingStream, p.userContext) if cd_err == nil && len(cd_parsed) > 0 { action = parserActions.table[p.stack.top()].actions[cdAction.tokenIndex] diff --git a/example/nolexer/nolexer.grammar/nolexer/internal/parser/productionstable.go b/example/nolexer/nolexer.grammar/nolexer/internal/parser/productionstable.go index 2b85021e..c7b63634 100644 --- a/example/nolexer/nolexer.grammar/nolexer/internal/parser/productionstable.go +++ b/example/nolexer/nolexer.grammar/nolexer/internal/parser/productionstable.go @@ -4,10 +4,38 @@ package parser import ( "fmt" - "github.com/maxcalandrelli/gocc/example/nolexer/nolexer.grammar/nolexer/internal/token" + "github.com/maxcalandrelli/gocc/example/nolexer/nolexer.grammar/nolexer/internal/util" + "strings" ) +func getString(X Attrib) string { + switch X.(type) { + case *token.Token: + return string(X.(*token.Token).Lit) + case string: + return X.(string) + } + return fmt.Sprintf("%q", X) +} + +func unescape(s string) string { + return util.EscapedString(s).Unescape() +} + +func unquote(s string) string { + r, _, _ := util.EscapedString(s).Unquote() + return r +} + +func lc(s string) string { + return strings.ToLower(s) +} + +func uc(s string) string { + return strings.ToUpper(s) +} + type ( //TODO: change type and variable names to be consistent with other tables ProdTab [numProductions]ProdTabEntry @@ -36,7 +64,7 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `Hello : Π name << func () (Attrib, error) { - fmt.Println(string(X[1].(*token.Token).Lit)); + fmt.Println(string($1.(*token.Token).Lit)); return nil, nil} () >>`, Id: "Hello", NTType: 1, @@ -51,7 +79,7 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `Saying : Λ << func () (Attrib, error) { - fmt.Print("hello "); + fmt.Print("hello "); return nil, nil} () >>`, Id: "Saying", NTType: 2, @@ -66,7 +94,7 @@ var productionsTable = ProdTab{ }, ProdTabEntry{ String: `Saying : Λ << func () (Attrib, error) { - fmt.Print("hiya "); + fmt.Print("hiya "); return nil, nil} () >>`, Id: "Saying", NTType: 2, diff --git a/example/nolexer/nolexer.grammar/nolexer/internal/util/rune.go b/example/nolexer/nolexer.grammar/nolexer/internal/util/rune.go index bd8523a4..788edfde 100644 --- a/example/nolexer/nolexer.grammar/nolexer/internal/util/rune.go +++ b/example/nolexer/nolexer.grammar/nolexer/internal/util/rune.go @@ -1,9 +1,12 @@ // Code generated by gocc; DO NOT EDIT. + package util import ( "fmt" + "unicode" + "unicode/utf8" ) func RuneToString(r rune) string { @@ -37,3 +40,101 @@ func RuneToString(r rune) string { } return fmt.Sprintf("\\U%08x", r) } + +type EscapedString string + +func (str EscapedString) Unquote() (unquoted string, wasQuoted bool, quoteType rune) { + if len(str) > 1 { + r := str[0] + if (r == '"' || r == '\x60' || r == '\'') && r == str[len(str)-1] { + str = str[1 : len(str)-1] + } + return string(str), true, rune(r) + } + return string(str), false, 0 +} + +func (str EscapedString) Unescape() string { + var ( + res string + r rune + size int + ) + for s := 0; s < len(str); s += size { + if str[s] == '\\' { + r, size = str[s+1:].EscapedFirstCharValue() + size++ + } else { + r, size = utf8.DecodeRuneInString(string(str)[s:]) + } + res += string(r) + } + return res +} + +func (str EscapedString) EscapedFirstCharValue() (rune, int) { + var i, base, max uint32 + offset := 0 + switch str[offset] { + case '\'', '"': + return rune(str[offset]), 1 + case 'a': + return '\a', 1 + case 'b': + return '\b', 1 + case 'f': + return '\f', 1 + case 'n': + return '\n', 1 + case 'r': + return '\r', 1 + case 't': + return '\t', 1 + case 'v': + return '\v', 1 + case '\\': + return '\\', 1 + case '0', '1', '2', '3', '4', '5', '6', '7': + i, base, max = 3, 8, 255 + case 'x': + i, base, max = 2, 16, 255 + offset++ + case 'u': + i, base, max = 4, 16, unicode.MaxRune + offset++ + case 'U': + i, base, max = 8, 32, unicode.MaxRune + offset++ + default: + panic(fmt.Sprintf("Error decoding character literal: %s\n", str[offset:])) + } + + var x uint32 + for ; i > 0 && offset < len(str); i-- { + ch, size := utf8.DecodeRuneInString(string(str)[offset:]) + offset += size + d := uint32(HexDigitValue(ch)) + if d >= base { + panic(fmt.Sprintf("charVal(%s): illegal character (%c) in escape sequence. size=%d, offset=%d", str, str[offset], size, offset)) + } + x = x*base + d + } + if x > max || 0xD800 <= x && x < 0xE000 { + panic(fmt.Sprintf("Error decoding escape char value. Lit:%s, offset:%d, escape sequence is invalid Unicode code point\n", str, offset)) + } + + return rune(x), offset +} + +func HexDigitValue(ch rune) int { + switch { + case '0' <= ch && ch <= '9': + return int(ch) - '0' + case 'a' <= ch && ch <= 'f': + return int(ch) - 'a' + 10 + case 'A' <= ch && ch <= 'F': + return int(ch) - 'A' + 10 + } + return 16 // larger than any legal digit val +} + diff --git a/example/nolexer/nolexer.grammar/nolexer/util.go b/example/nolexer/nolexer.grammar/nolexer/util.go new file mode 100644 index 00000000..ab8156bf --- /dev/null +++ b/example/nolexer/nolexer.grammar/nolexer/util.go @@ -0,0 +1,25 @@ +// Code generated by gocc; DO NOT EDIT. + +package nolexer + +import ( + "github.com/maxcalandrelli/gocc/example/nolexer/nolexer.grammar/nolexer/internal/util" +) + +type EscapedString = util.EscapedString + +func RuneToString(r rune) string { + return util.RuneToString(r) +} + +func HexDigitValue(ch rune) int { + return util.HexDigitValue(ch) +} + +func IntValue(lit []byte) (int64, error) { + return util.IntValue(lit) +} + +func UintValue(lit []byte) (uint64, error) { + return util.UintValue(lit) +} diff --git a/example/rr/rr.grammar/rr/iface/rr.go b/example/rr/rr.grammar/rr/iface/rr.go index ca4569d1..45264f7a 100644 --- a/example/rr/rr.grammar/rr/iface/rr.go +++ b/example/rr/rr.grammar/rr/iface/rr.go @@ -4,6 +4,7 @@ package iface import ( "github.com/maxcalandrelli/gocc/example/rr/rr.grammar/rr/internal/errors" + "github.com/maxcalandrelli/gocc/example/rr/rr.grammar/rr/internal/io/stream" "github.com/maxcalandrelli/gocc/example/rr/rr.grammar/rr/internal/token" "io" ) @@ -48,3 +49,15 @@ const ( func GetTokenMap() TokenMap { return token.TokMap } + +func NewWindowReaderFromBytes(src []byte) stream.WindowReader { + return stream.NewWindowReaderFromBytes(src) +} + +func NewWindowReader(rdr io.Reader) stream.WindowReader { + return stream.NewWindowReader(rdr) +} + +func NewLimitedWindowReader(rdr io.Reader, sizeMin, sizeMax int) stream.WindowReader { + return stream.NewLimitedWindowReader(rdr, sizeMin, sizeMax) +} diff --git a/example/rr/rr.grammar/rr/internal/parser/parser.go b/example/rr/rr.grammar/rr/internal/parser/parser.go index dc8fabf5..9ef8feaf 100644 --- a/example/rr/rr.grammar/rr/internal/parser/parser.go +++ b/example/rr/rr.grammar/rr/internal/parser/parser.go @@ -280,8 +280,9 @@ func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, er // // If no action, check if we have some context dependent parsing to try // + p.checkPoint = p.checkPoint.Advance(len(p.nextToken.IgnoredPrefix)) for _, cdAction := range parserActions.table[p.stack.top()].cdActions { - p.tokens.GotoCheckPoint(p.checkPoint.Advance(len(p.nextToken.IgnoredPrefix))) + p.tokens.GotoCheckPoint(p.checkPoint) cd_res, cd_err, cd_parsed := cdAction.tokenScanner(p.underlyingStream, p.userContext) if cd_err == nil && len(cd_parsed) > 0 { action = parserActions.table[p.stack.top()].actions[cdAction.tokenIndex] diff --git a/example/rr/rr.grammar/rr/internal/parser/productionstable.go b/example/rr/rr.grammar/rr/internal/parser/productionstable.go index c5bc92c0..229b1b70 100644 --- a/example/rr/rr.grammar/rr/internal/parser/productionstable.go +++ b/example/rr/rr.grammar/rr/internal/parser/productionstable.go @@ -2,6 +2,40 @@ package parser +import ( + "fmt" + "github.com/maxcalandrelli/gocc/example/rr/rr.grammar/rr/internal/token" + "github.com/maxcalandrelli/gocc/example/rr/rr.grammar/rr/internal/util" + "strings" +) + +func getString(X Attrib) string { + switch X.(type) { + case *token.Token: + return string(X.(*token.Token).Lit) + case string: + return X.(string) + } + return fmt.Sprintf("%q", X) +} + +func unescape(s string) string { + return util.EscapedString(s).Unescape() +} + +func unquote(s string) string { + r, _, _ := util.EscapedString(s).Unquote() + return r +} + +func lc(s string) string { + return strings.ToLower(s) +} + +func uc(s string) string { + return strings.ToUpper(s) +} + type ( //TODO: change type and variable names to be consistent with other tables ProdTab [numProductions]ProdTabEntry diff --git a/example/rr/rr.grammar/rr/internal/util/rune.go b/example/rr/rr.grammar/rr/internal/util/rune.go index bd8523a4..788edfde 100644 --- a/example/rr/rr.grammar/rr/internal/util/rune.go +++ b/example/rr/rr.grammar/rr/internal/util/rune.go @@ -1,9 +1,12 @@ // Code generated by gocc; DO NOT EDIT. + package util import ( "fmt" + "unicode" + "unicode/utf8" ) func RuneToString(r rune) string { @@ -37,3 +40,101 @@ func RuneToString(r rune) string { } return fmt.Sprintf("\\U%08x", r) } + +type EscapedString string + +func (str EscapedString) Unquote() (unquoted string, wasQuoted bool, quoteType rune) { + if len(str) > 1 { + r := str[0] + if (r == '"' || r == '\x60' || r == '\'') && r == str[len(str)-1] { + str = str[1 : len(str)-1] + } + return string(str), true, rune(r) + } + return string(str), false, 0 +} + +func (str EscapedString) Unescape() string { + var ( + res string + r rune + size int + ) + for s := 0; s < len(str); s += size { + if str[s] == '\\' { + r, size = str[s+1:].EscapedFirstCharValue() + size++ + } else { + r, size = utf8.DecodeRuneInString(string(str)[s:]) + } + res += string(r) + } + return res +} + +func (str EscapedString) EscapedFirstCharValue() (rune, int) { + var i, base, max uint32 + offset := 0 + switch str[offset] { + case '\'', '"': + return rune(str[offset]), 1 + case 'a': + return '\a', 1 + case 'b': + return '\b', 1 + case 'f': + return '\f', 1 + case 'n': + return '\n', 1 + case 'r': + return '\r', 1 + case 't': + return '\t', 1 + case 'v': + return '\v', 1 + case '\\': + return '\\', 1 + case '0', '1', '2', '3', '4', '5', '6', '7': + i, base, max = 3, 8, 255 + case 'x': + i, base, max = 2, 16, 255 + offset++ + case 'u': + i, base, max = 4, 16, unicode.MaxRune + offset++ + case 'U': + i, base, max = 8, 32, unicode.MaxRune + offset++ + default: + panic(fmt.Sprintf("Error decoding character literal: %s\n", str[offset:])) + } + + var x uint32 + for ; i > 0 && offset < len(str); i-- { + ch, size := utf8.DecodeRuneInString(string(str)[offset:]) + offset += size + d := uint32(HexDigitValue(ch)) + if d >= base { + panic(fmt.Sprintf("charVal(%s): illegal character (%c) in escape sequence. size=%d, offset=%d", str, str[offset], size, offset)) + } + x = x*base + d + } + if x > max || 0xD800 <= x && x < 0xE000 { + panic(fmt.Sprintf("Error decoding escape char value. Lit:%s, offset:%d, escape sequence is invalid Unicode code point\n", str, offset)) + } + + return rune(x), offset +} + +func HexDigitValue(ch rune) int { + switch { + case '0' <= ch && ch <= '9': + return int(ch) - '0' + case 'a' <= ch && ch <= 'f': + return int(ch) - 'a' + 10 + case 'A' <= ch && ch <= 'F': + return int(ch) - 'A' + 10 + } + return 16 // larger than any legal digit val +} + diff --git a/example/rr/rr.grammar/rr/main/main.go b/example/rr/rr.grammar/rr/main/rr.go similarity index 100% rename from example/rr/rr.grammar/rr/main/main.go rename to example/rr/rr.grammar/rr/main/rr.go diff --git a/example/rr/rr.grammar/rr/util.go b/example/rr/rr.grammar/rr/util.go new file mode 100644 index 00000000..7fe4c499 --- /dev/null +++ b/example/rr/rr.grammar/rr/util.go @@ -0,0 +1,25 @@ +// Code generated by gocc; DO NOT EDIT. + +package rr + +import ( + "github.com/maxcalandrelli/gocc/example/rr/rr.grammar/rr/internal/util" +) + +type EscapedString = util.EscapedString + +func RuneToString(r rune) string { + return util.RuneToString(r) +} + +func HexDigitValue(ch rune) int { + return util.HexDigitValue(ch) +} + +func IntValue(lit []byte) (int64, error) { + return util.IntValue(lit) +} + +func UintValue(lit []byte) (uint64, error) { + return util.UintValue(lit) +} diff --git a/example/sr/sr.grammar/sr/iface/sr.go b/example/sr/sr.grammar/sr/iface/sr.go index 14cc67d5..6158aab8 100644 --- a/example/sr/sr.grammar/sr/iface/sr.go +++ b/example/sr/sr.grammar/sr/iface/sr.go @@ -4,6 +4,7 @@ package iface import ( "github.com/maxcalandrelli/gocc/example/sr/sr.grammar/sr/internal/errors" + "github.com/maxcalandrelli/gocc/example/sr/sr.grammar/sr/internal/io/stream" "github.com/maxcalandrelli/gocc/example/sr/sr.grammar/sr/internal/token" "io" ) @@ -48,3 +49,15 @@ const ( func GetTokenMap() TokenMap { return token.TokMap } + +func NewWindowReaderFromBytes(src []byte) stream.WindowReader { + return stream.NewWindowReaderFromBytes(src) +} + +func NewWindowReader(rdr io.Reader) stream.WindowReader { + return stream.NewWindowReader(rdr) +} + +func NewLimitedWindowReader(rdr io.Reader, sizeMin, sizeMax int) stream.WindowReader { + return stream.NewLimitedWindowReader(rdr, sizeMin, sizeMax) +} diff --git a/example/sr/sr.grammar/sr/internal/parser/parser.go b/example/sr/sr.grammar/sr/internal/parser/parser.go index 17895a52..b8734524 100644 --- a/example/sr/sr.grammar/sr/internal/parser/parser.go +++ b/example/sr/sr.grammar/sr/internal/parser/parser.go @@ -280,8 +280,9 @@ func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, er // // If no action, check if we have some context dependent parsing to try // + p.checkPoint = p.checkPoint.Advance(len(p.nextToken.IgnoredPrefix)) for _, cdAction := range parserActions.table[p.stack.top()].cdActions { - p.tokens.GotoCheckPoint(p.checkPoint.Advance(len(p.nextToken.IgnoredPrefix))) + p.tokens.GotoCheckPoint(p.checkPoint) cd_res, cd_err, cd_parsed := cdAction.tokenScanner(p.underlyingStream, p.userContext) if cd_err == nil && len(cd_parsed) > 0 { action = parserActions.table[p.stack.top()].actions[cdAction.tokenIndex] diff --git a/example/sr/sr.grammar/sr/internal/parser/productionstable.go b/example/sr/sr.grammar/sr/internal/parser/productionstable.go index abef01e8..bb6cab6a 100644 --- a/example/sr/sr.grammar/sr/internal/parser/productionstable.go +++ b/example/sr/sr.grammar/sr/internal/parser/productionstable.go @@ -4,6 +4,40 @@ package parser import "github.com/maxcalandrelli/gocc/example/sr/ast" +import ( + "fmt" + "github.com/maxcalandrelli/gocc/example/sr/sr.grammar/sr/internal/token" + "github.com/maxcalandrelli/gocc/example/sr/sr.grammar/sr/internal/util" + "strings" +) + +func getString(X Attrib) string { + switch X.(type) { + case *token.Token: + return string(X.(*token.Token).Lit) + case string: + return X.(string) + } + return fmt.Sprintf("%q", X) +} + +func unescape(s string) string { + return util.EscapedString(s).Unescape() +} + +func unquote(s string) string { + r, _, _ := util.EscapedString(s).Unquote() + return r +} + +func lc(s string) string { + return strings.ToLower(s) +} + +func uc(s string) string { + return strings.ToUpper(s) +} + type ( //TODO: change type and variable names to be consistent with other tables ProdTab [numProductions]ProdTabEntry @@ -31,7 +65,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `Stmt : Λ id Λ Π << ast.NewIf(X[1], X[3]), nil >>`, + String: `Stmt : Λ id Λ Π << ast.NewIf($1, $3), nil >>`, Id: "Stmt", NTType: 1, Index: 1, @@ -41,7 +75,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `Stmt : Λ id Λ Π Λ Π << ast.NewIfElse(X[1], X[3], X[5]), nil >>`, + String: `Stmt : Λ id Λ Π Λ Π << ast.NewIfElse($1, $3, $5), nil >>`, Id: "Stmt", NTType: 1, Index: 2, @@ -51,7 +85,7 @@ var productionsTable = ProdTab{ }, }, ProdTabEntry{ - String: `Stmt : id << ast.NewIdStmt(X[0]), nil >>`, + String: `Stmt : id << ast.NewIdStmt($0), nil >>`, Id: "Stmt", NTType: 1, Index: 3, diff --git a/example/sr/sr.grammar/sr/internal/util/rune.go b/example/sr/sr.grammar/sr/internal/util/rune.go index bd8523a4..788edfde 100644 --- a/example/sr/sr.grammar/sr/internal/util/rune.go +++ b/example/sr/sr.grammar/sr/internal/util/rune.go @@ -1,9 +1,12 @@ // Code generated by gocc; DO NOT EDIT. + package util import ( "fmt" + "unicode" + "unicode/utf8" ) func RuneToString(r rune) string { @@ -37,3 +40,101 @@ func RuneToString(r rune) string { } return fmt.Sprintf("\\U%08x", r) } + +type EscapedString string + +func (str EscapedString) Unquote() (unquoted string, wasQuoted bool, quoteType rune) { + if len(str) > 1 { + r := str[0] + if (r == '"' || r == '\x60' || r == '\'') && r == str[len(str)-1] { + str = str[1 : len(str)-1] + } + return string(str), true, rune(r) + } + return string(str), false, 0 +} + +func (str EscapedString) Unescape() string { + var ( + res string + r rune + size int + ) + for s := 0; s < len(str); s += size { + if str[s] == '\\' { + r, size = str[s+1:].EscapedFirstCharValue() + size++ + } else { + r, size = utf8.DecodeRuneInString(string(str)[s:]) + } + res += string(r) + } + return res +} + +func (str EscapedString) EscapedFirstCharValue() (rune, int) { + var i, base, max uint32 + offset := 0 + switch str[offset] { + case '\'', '"': + return rune(str[offset]), 1 + case 'a': + return '\a', 1 + case 'b': + return '\b', 1 + case 'f': + return '\f', 1 + case 'n': + return '\n', 1 + case 'r': + return '\r', 1 + case 't': + return '\t', 1 + case 'v': + return '\v', 1 + case '\\': + return '\\', 1 + case '0', '1', '2', '3', '4', '5', '6', '7': + i, base, max = 3, 8, 255 + case 'x': + i, base, max = 2, 16, 255 + offset++ + case 'u': + i, base, max = 4, 16, unicode.MaxRune + offset++ + case 'U': + i, base, max = 8, 32, unicode.MaxRune + offset++ + default: + panic(fmt.Sprintf("Error decoding character literal: %s\n", str[offset:])) + } + + var x uint32 + for ; i > 0 && offset < len(str); i-- { + ch, size := utf8.DecodeRuneInString(string(str)[offset:]) + offset += size + d := uint32(HexDigitValue(ch)) + if d >= base { + panic(fmt.Sprintf("charVal(%s): illegal character (%c) in escape sequence. size=%d, offset=%d", str, str[offset], size, offset)) + } + x = x*base + d + } + if x > max || 0xD800 <= x && x < 0xE000 { + panic(fmt.Sprintf("Error decoding escape char value. Lit:%s, offset:%d, escape sequence is invalid Unicode code point\n", str, offset)) + } + + return rune(x), offset +} + +func HexDigitValue(ch rune) int { + switch { + case '0' <= ch && ch <= '9': + return int(ch) - '0' + case 'a' <= ch && ch <= 'f': + return int(ch) - 'a' + 10 + case 'A' <= ch && ch <= 'F': + return int(ch) - 'A' + 10 + } + return 16 // larger than any legal digit val +} + diff --git a/example/sr/sr.grammar/sr/main/main.go b/example/sr/sr.grammar/sr/main/sr.go similarity index 100% rename from example/sr/sr.grammar/sr/main/main.go rename to example/sr/sr.grammar/sr/main/sr.go diff --git a/example/sr/sr.grammar/sr/util.go b/example/sr/sr.grammar/sr/util.go new file mode 100644 index 00000000..216010f9 --- /dev/null +++ b/example/sr/sr.grammar/sr/util.go @@ -0,0 +1,25 @@ +// Code generated by gocc; DO NOT EDIT. + +package sr + +import ( + "github.com/maxcalandrelli/gocc/example/sr/sr.grammar/sr/internal/util" +) + +type EscapedString = util.EscapedString + +func RuneToString(r rune) string { + return util.RuneToString(r) +} + +func HexDigitValue(ch rune) int { + return util.HexDigitValue(ch) +} + +func IntValue(lit []byte) (int64, error) { + return util.IntValue(lit) +} + +func UintValue(lit []byte) (uint64, error) { + return util.UintValue(lit) +} diff --git a/internal/config/config.go b/internal/config/config.go index 2d8b6080..0b0241bc 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -27,7 +27,7 @@ import ( ) const ( - VERSION = "1.3.0001" + VERSION = "2.1.0001" INTERNAL_SYMBOL_EMPTY = "ε" INTERNAL_SYMBOL_ERROR = "λ" // (λάθος) @@ -66,8 +66,13 @@ type ( Package() string PrintParams() + + BugOption(string) bugOption } + bugOption string + bugOptions map[string]bugOption + ConfigRecord struct { workingDir string @@ -82,11 +87,65 @@ type ( srcFile string internal string verbose *bool + bug_options bugOptions } ) +const ( + bugopt_fix = "fix" + bugopt_ignore = "ignore" + bugopt_default = bugopt_fix +) + +func (this bugOption) Fix() bool { + return strings.ToLower(string(this)) != bugopt_ignore +} + +func (this bugOption) Ignore() bool { + return strings.ToLower(string(this)) == bugopt_ignore +} + +func (this bugOptions) String() string { + b := &strings.Builder{} + for k, _ := range bugDescriptions { + v := bugDefaultOption + if _v, _f := this[k]; _f { + v = _v + } + if b.Len() > 0 { + b.WriteByte(',') + } + fmt.Fprintf(b, "%s:%s", k, v) + } + return b.String() +} + +func (this bugOption) Option() string { + return string(this) +} + +func (this bugOptions) Set(s string) error { + for _, s1 := range strings.Split(s, ",") { + s1v := strings.Split(s1, ":") + if len(s1v) < 2 { + s1v = append(s1v, bugopt_default) + } + s1v[0] = strings.ToLower(s1v[0]) + if _, found := bugDescriptions[s1v[0]]; !found { + return errors.New("unknown bug name: " + s1v[0]) + } + this[s1v[0]] = bugOption(strings.Join(s1v[1:], "=")) + } + return nil +} + var ( CurrentConfiguration Config + bugDefaultOption = bugOption(bugopt_default) + bugDescriptions = map[string]string{ + "lexer_dots": "dots handling in regexps like \"--.--\" needs propagation of fallback states", + "lexer_regdefs": "incorrect calculation of symbol classes when both a shift and a reduce item exist for the same regdefid", + } ) func New() (Config, error) { @@ -96,7 +155,8 @@ func New() (Config, error) { } cfg := &ConfigRecord{ - workingDir: wd, + workingDir: wd, + bug_options: map[string]bugOption{}, } if err := cfg.getFlags(); err != nil { @@ -173,6 +233,16 @@ func (this *ConfigRecord) ProjectName() string { return file } +func (this *ConfigRecord) BugOption(name string) bugOption { + if _, exists := bugDescriptions[name]; !exists { + panic("unknown bug name: " + name) + } + if option, exists := this.bug_options[name]; exists { + return option + } + return bugDefaultOption +} + func (this *ConfigRecord) PrintParams() { fmt.Printf("-a = %v\n", *this.autoResolveLRConf) fmt.Printf("-debug_lexer = %v\n", *this.debugLexer) @@ -184,12 +254,41 @@ func (this *ConfigRecord) PrintParams() { fmt.Printf("-u = %v\n", *this.allowUnreachable) fmt.Printf("-v = %v\n", *this.verbose) fmt.Printf("-internal = %v\n", this.internal) + fmt.Printf("-bugs = %v\n", this.bug_options.String()) } /*** Utility routines ***/ +func bugsHelp(pref string) string { + b := &strings.Builder{} + nl := func() { + b.WriteByte('\n') + b.WriteString(pref) + } + nl() + fmt.Fprintf(b, "use if you suspect that bug fixing strategies are causing other problems") + nl() + fmt.Fprintf(b, "use either --bugs= --bugs= or --bugs=, form") + nl() + fmt.Fprintf(b, "each can be specified as or :") + nl() + fmt.Fprintf(b, " can be either 'fix' or 'ignore'; some bugs will also allow more options") + nl() + fmt.Fprintf(b, "the actually fixable bugs are:") + nl() + for name, descr := range bugDescriptions { + nl() + fmt.Fprintf(b, " %-20s %s", name, descr) + } + nl() + nl() + fmt.Fprintf(b, "example: gocc -v -bugs=lexer_dots:ignore myfile.bnf") + nl() + return b.String() +} + func (this *ConfigRecord) getFlags() error { - this.autoResolveLRConf = flag.Bool("a", false, "automatically resolve LR(1) conflicts") + this.autoResolveLRConf = flag.Bool("a", true, "automatically resolve LR(1) conflicts") this.debugLexer = flag.Bool("debug_lexer", false, "enable debug logging in lexer") this.debugParser = flag.Bool("debug_parser", false, "enable debug logging in parser") this.help = flag.Bool("h", false, "help") @@ -197,6 +296,7 @@ func (this *ConfigRecord) getFlags() error { flag.StringVar(&this.outDir, "o", path.Join(this.workingDir, "@f.grammar", "@f"), "output directory format (@f='name' if input file is 'name.bnf')") flag.StringVar(&this.pkg, "p", "", "package, empty defaults to "+defaultPackage(this.outDir)) flag.StringVar(&this.internal, "internal", "internal", "internal subdir name") + flag.Var(this.bug_options, "bugs", "handle bugs in original implementation (default: fix all)"+bugsHelp(" ")) this.allowUnreachable = flag.Bool("u", false, "allow unreachable productions") this.verbose = flag.Bool("v", false, "verbose") flag.Parse() diff --git a/internal/frontend/reparsed/log/lexer_sets.txt b/internal/frontend/reparsed/log/lexer_sets.txt index 94502a6f..d82f4c4e 100644 --- a/internal/frontend/reparsed/log/lexer_sets.txt +++ b/internal/frontend/reparsed/log/lexer_sets.txt @@ -278,6 +278,7 @@ S19{ _lowcase : • 'a'-'z' _tokId : _lowcase {_id_char} • _tokId : _lowcase {• _id_char} + _tokId : • _lowcase {_id_char} _upcase : • 'A'-'Z' tokId : _tokId • tokId : • _tokId @@ -300,6 +301,7 @@ S20{ _lowcase : • 'a'-'z' _tokId : _lowcase {_id_char} • _tokId : _lowcase {• _id_char} + _tokId : • _lowcase {_id_char} _upcase : • 'A'-'Z' tokId : _tokId • tokId : • _tokId @@ -370,6 +372,7 @@ S27{ _lowcase : • 'a'-'z' _tokId : _lowcase {_id_char} • _tokId : _lowcase {• _id_char} + _tokId : • _lowcase {_id_char} _upcase : • 'A'-'Z' ignoredTokId : '!' _tokId • ignoredTokId : '!' • _tokId @@ -728,6 +731,7 @@ S46{ _lowcase : • 'a'-'z' _tokId : _lowcase {_id_char} • _tokId : _lowcase {• _id_char} + _tokId : • _lowcase {_id_char} _upcase : • 'A'-'Z' tokId : _tokId • tokId : • _tokId @@ -750,6 +754,7 @@ S47{ _lowcase : • 'a'-'z' _tokId : _lowcase {_id_char} • _tokId : _lowcase {• _id_char} + _tokId : • _lowcase {_id_char} _upcase : 'A'-'Z' • _upcase : • 'A'-'Z' tokId : _tokId • @@ -773,6 +778,7 @@ S48{ _lowcase : • 'a'-'z' _tokId : _lowcase {_id_char} • _tokId : _lowcase {• _id_char} + _tokId : • _lowcase {_id_char} _upcase : • 'A'-'Z' tokId : _tokId • tokId : • _tokId @@ -796,6 +802,7 @@ S49{ _lowcase : • 'a'-'z' _tokId : _lowcase {_id_char} • _tokId : _lowcase {• _id_char} + _tokId : • _lowcase {_id_char} _upcase : • 'A'-'Z' tokId : _tokId • tokId : • _tokId @@ -819,6 +826,7 @@ S50{ _lowcase : • 'a'-'z' _tokId : _lowcase {_id_char} • _tokId : _lowcase {• _id_char} + _tokId : • _lowcase {_id_char} _upcase : • 'A'-'Z' tokId : _tokId • tokId : • _tokId @@ -845,6 +853,7 @@ S51{ _lowcase : • 'a'-'z' _tokId : _lowcase {_id_char} • _tokId : _lowcase {• _id_char} + _tokId : • _lowcase {_id_char} _upcase : • 'A'-'Z' tokId : _tokId • tokId : • _tokId @@ -871,6 +880,7 @@ S52{ _lowcase : • 'a'-'z' _tokId : _lowcase {_id_char} • _tokId : _lowcase {• _id_char} + _tokId : • _lowcase {_id_char} _upcase : • 'A'-'Z' ignoredTokId : '!' _tokId • ignoredTokId : '!' • _tokId @@ -893,6 +903,7 @@ S53{ _lowcase : • 'a'-'z' _tokId : _lowcase {_id_char} • _tokId : _lowcase {• _id_char} + _tokId : • _lowcase {_id_char} _upcase : 'A'-'Z' • _upcase : • 'A'-'Z' ignoredTokId : '!' _tokId • @@ -916,6 +927,7 @@ S54{ _lowcase : • 'a'-'z' _tokId : _lowcase {_id_char} • _tokId : _lowcase {• _id_char} + _tokId : • _lowcase {_id_char} _upcase : • 'A'-'Z' ignoredTokId : '!' _tokId • ignoredTokId : '!' • _tokId @@ -939,6 +951,7 @@ S55{ _lowcase : • 'a'-'z' _tokId : _lowcase {_id_char} • _tokId : _lowcase {• _id_char} + _tokId : • _lowcase {_id_char} _upcase : • 'A'-'Z' ignoredTokId : '!' _tokId • ignoredTokId : '!' • _tokId @@ -1161,6 +1174,7 @@ S71{ _lowcase : • 'a'-'z' _tokId : _lowcase {_id_char} • _tokId : _lowcase {• _id_char} + _tokId : • _lowcase {_id_char} _upcase : • 'A'-'Z' tokId : _tokId • tokId : • _tokId @@ -1187,6 +1201,7 @@ S72{ _lowcase : • 'a'-'z' _tokId : _lowcase {_id_char} • _tokId : _lowcase {• _id_char} + _tokId : • _lowcase {_id_char} _upcase : • 'A'-'Z' tokId : _tokId • tokId : • _tokId @@ -1361,6 +1376,7 @@ S84{ _lowcase : • 'a'-'z' _tokId : _lowcase {_id_char} • _tokId : _lowcase {• _id_char} + _tokId : • _lowcase {_id_char} _upcase : • 'A'-'Z' tokId : _tokId • tokId : • _tokId @@ -1387,6 +1403,7 @@ S85{ _lowcase : • 'a'-'z' _tokId : _lowcase {_id_char} • _tokId : _lowcase {• _id_char} + _tokId : • _lowcase {_id_char} _upcase : • 'A'-'Z' tokId : _tokId • tokId : • _tokId @@ -1567,6 +1584,7 @@ S96{ _lowcase : • 'a'-'z' _tokId : _lowcase {_id_char} • _tokId : _lowcase {• _id_char} + _tokId : • _lowcase {_id_char} _upcase : • 'A'-'Z' tokId : _tokId • tokId : • _tokId @@ -1591,6 +1609,7 @@ S97{ _lowcase : • 'a'-'z' _tokId : _lowcase {_id_char} • _tokId : _lowcase {• _id_char} + _tokId : • _lowcase {_id_char} _upcase : • 'A'-'Z' tokId : _tokId • tokId : • _tokId diff --git a/internal/lexer/items/dbg.go b/internal/lexer/items/dbg.go index 2127e2f8..906742e4 100644 --- a/internal/lexer/items/dbg.go +++ b/internal/lexer/items/dbg.go @@ -6,6 +6,13 @@ import ( "regexp" "runtime/debug" "strings" + + "github.com/maxcalandrelli/gocc/internal/util" +) + +const ( + debug_wrong_regdef_handling = false + debug_deeply = debug_wrong_regdef_handling ) var ( @@ -13,20 +20,53 @@ var ( sourceRE = regexp.MustCompile("^\\s*(.*)/([^/]+:\\d+)\\s*(.*)$") ) +func dbgr(set int, format string, v ...interface{}) { + if debug_deeply { + if set >= 0 { + fmt.Fprintf(os.Stderr, "S%d:", set) + } + fmt.Fprintf(os.Stderr, format, v...) + } +} + +func printItems(items ItemList) string { + b := strings.Builder{} + for _, i := range items { + b.WriteString(i.String()) + b.WriteByte('\n') + } + return b.String() +} + func dbg(set int, format string, v ...interface{}) { - if set >= 0 { - fmt.Fprintf(os.Stderr, "S%d:", set) + if debug_deeply { + args := make([]interface{}, len(v)) + for _i, _v := range v { + switch _v.(type) { + case string: + _v = util.EscapedString(_v.(string)).Unescape() + case ItemList: + _v = printItems(_v.(ItemList)) + case []*Item: + _v = printItems(ItemList(_v.([]*Item))) + } + args[_i] = _v + } + dbgr(set, format, args...) } - fmt.Fprintf(os.Stderr, format, v...) } func trace(set int, format string, v ...interface{}) { - stack := strings.Split(string(debug.Stack()), "\n") - fmt.Fprintf(os.Stderr, "-------------------------------------------\n") - for ix := 5; ix < len(stack)-3; ix += 2 { - caller := callerRE.ReplaceAllString(stack[ix], "$2") - source := sourceRE.ReplaceAllString(stack[ix+1], "$2") - fmt.Fprintf(os.Stderr, "%s in %s\n", caller, source) + if debug_deeply { + stack := strings.Split(string(debug.Stack()), "\n") + fmt.Fprintf(os.Stderr, "\n") + fmt.Fprintf(os.Stderr, "-------------------------------------------\n") + for ix := 5; ix < len(stack)-3; ix += 2 { + caller := callerRE.ReplaceAllString(stack[ix], "$2") + source := sourceRE.ReplaceAllString(stack[ix+1], "$2") + fmt.Fprintf(os.Stderr, "%s in %s\n", caller, source) + } + fmt.Fprintf(os.Stderr, "-------------------------------------------\n") + dbg(set, format, v...) } - dbg(set, format, v...) } diff --git a/internal/lexer/items/item.go b/internal/lexer/items/item.go index d4d8a67e..b1002a95 100644 --- a/internal/lexer/items/item.go +++ b/internal/lexer/items/item.go @@ -104,7 +104,7 @@ For a general description of dotted items (items) and ℇ-moves of items, see: T : x(...|y•|...)z => T : x(...|y|...)•z */ func (this *Item) Emoves() (items []*Item) { - trace(-1, "%s\n", this.Id) + trace(-1, "computing ε-moves of %s\n", this) newItems := util.NewStack(8).Push(this) for newItems.Len() > 0 { item := newItems.Pop().(*Item) @@ -113,13 +113,7 @@ func (this *Item) Emoves() (items []*Item) { items = append(items, item) continue } - nt, pos := item.pos.top() - - dbg(-1, "*** Item: %q\n ** emoves:\n", item) - for _, e := range items { - dbg(-1, " %q\n", e) - } switch node := nt.(type) { case *ast.LexPattern: newItems.Push(item.eMovesLexPattern(node, pos)...) @@ -139,6 +133,7 @@ func (this *Item) Emoves() (items []*Item) { panic(fmt.Sprintf("Unexpected type in items.Emoves(): %T", nt)) } } + dbg(-1, "ε-moves:{\n%s\n}\n", items) return } @@ -255,9 +250,15 @@ func (this *Item) newLexPatternBasicItems(nt *ast.LexPattern, pos int) []interfa func (this *Item) nextIsTerminal() bool { nt, pos := this.pos.top() + trace(-1, "<%s>: checking that node %s next to pos %d is terminal: ", this.Id, nt.String(), pos) if pos >= nt.Len() { + dbg(-1, "no, pos is after end\n") return false } + if debug_deeply { + nte := nt.Element(pos) + dbg(-1, "%t [%T:%s]\n", nte.LexTerminal(), nte, nte.String()) + } return nt.Element(pos).LexTerminal() } @@ -330,7 +331,9 @@ func (this *Item) MoveRegDefId(id string) []*Item { movedItem := this.Clone() movedItem.pos.inc() movedItem.getHashKey() - trace(-1, " * moved item:\n%s\nwas:\n%s)\n", util.EscapedString(movedItem.pos.String()).Unescape(), util.EscapedString(this.pos.String()).Unescape()) + if debug_deeply { + trace(-1, " * moved item:\n%s\nwas:\n%s)\n", movedItem.pos.String(), this.pos.String()) + } items := movedItem.Emoves() return items } diff --git a/internal/lexer/items/itemlist.go b/internal/lexer/items/itemlist.go index d16dafda..844c5747 100644 --- a/internal/lexer/items/itemlist.go +++ b/internal/lexer/items/itemlist.go @@ -73,10 +73,13 @@ See Algorithm: set.Closure() in package doc */ func (this ItemList) Closure(lexPart *ast.LexPart, symbols *symbols.Symbols) ItemList { closure := this + trace(-1, "calculating closure of <%s>\n", this) for i := 0; i < len(closure); i++ { expSym := closure[i].ExpectedSymbol() if regDefId, isRegDefId := expSym.(*ast.LexRegDefId); isRegDefId { - if !this.ContainShift(expSym.String()) && !symbols.IsImport(regDefId.Id) { + dbg(-1, "found regexp %s examining %s; shift found: %t \n", regDefId.Id, closure[i].String(), this.ContainShift(expSym.String())) + if (!this.ContainShift(expSym.String()) || (fix_regdef_bug && this.ContainReduce(expSym.String()))) && !symbols.IsImport(regDefId.Id) { + dbg(-1, "adding %s to closure with its ε-moves\n", regDefId.Id) closure = closure.AddNoDuplicate(NewItem(regDefId.Id, lexPart, symbols).Emoves()...) } } @@ -102,6 +105,15 @@ func (this ItemList) ContainShift(id string) bool { return false } +func (this ItemList) ContainReduce(id string) bool { + for _, item := range this { + if item.Id == id && item.Reduce() { + return true + } + } + return false +} + func (this ItemList) Equal(that ItemList) bool { if len(this) != len(that) { return false diff --git a/internal/lexer/items/itemset.go b/internal/lexer/items/itemset.go index 0785a929..782e9859 100644 --- a/internal/lexer/items/itemset.go +++ b/internal/lexer/items/itemset.go @@ -18,8 +18,6 @@ import ( "fmt" "strings" - "github.com/maxcalandrelli/gocc/internal/util" - "github.com/maxcalandrelli/gocc/internal/ast" "github.com/maxcalandrelli/gocc/internal/lexer/symbols" ) @@ -41,6 +39,9 @@ type ItemSet struct { } func NewItemSet(setNo int, lexPart *ast.LexPart, symbols *symbols.Symbols, items ItemList) *ItemSet { + if debug_deeply { + trace(setNo, "creating, start items:\n%s", items) + } set := &ItemSet{ setNo: setNo, Items: items.Closure(lexPart, symbols), @@ -50,6 +51,9 @@ func NewItemSet(setNo int, lexPart *ast.LexPart, symbols *symbols.Symbols, items } set.getSymbolClasses(lexPart, symbols) set.newTransitions() + if debug_deeply { + trace(setNo, "created, items:\n%s\nsymbol classes:\n%s", set.Items, set.SymbolClasses) + } return set } @@ -187,7 +191,8 @@ func (this *ItemSet) dependentsClosure(items ItemList) ItemList { if len(items) == 0 { return items } - trace(this.setNo, "dependentsClosure S%d\n actual: %s\n items: %s\n", this.setNo, util.EscapedString(this.String()).Unescape(), util.EscapedString(fmt.Sprintf("%q", items)).Unescape()) + //trace(this.setNo, "dependentsClosure\n actual: %s\n items: %s\n", util.EscapedString(this.String()).Unescape(), util.EscapedString(fmt.Sprintf("%q", items)).Unescape()) + trace(this.setNo, "dependentsClosure\n") for i := 0; i < len(items); i++ { for _, thisItem := range this.Items { if expSym := thisItem.ExpectedSymbol(); expSym != nil && expSym.String() == items[i].Id { diff --git a/internal/lexer/items/itemsets.go b/internal/lexer/items/itemsets.go index 2506f203..45279a46 100644 --- a/internal/lexer/items/itemsets.go +++ b/internal/lexer/items/itemsets.go @@ -29,15 +29,20 @@ type ItemSets struct { symbols *symbols.Symbols } -func GetItemSets(lexPart *ast.LexPart) *ItemSets { +var ( + fix_dots_bug bool + fix_regdef_bug bool +) + +func GetItemSets(lexPart *ast.LexPart, _fix_dots_bug, _fix_regdefs_bug bool) *ItemSets { + fix_dots_bug = _fix_dots_bug + fix_regdef_bug = _fix_regdefs_bug itemSets := &ItemSets{ sets: make([]*ItemSet, 0, 256), lexPart: lexPart, symbols: symbols.NewSymbols(lexPart), } - itemSets.Add(ItemsSet0(lexPart, itemSets.symbols)) - return itemSets.Closure() } @@ -46,19 +51,22 @@ func (this *ItemSets) Add(items ItemList) (setNo int) { return setNo } setNo = this.Size() + if debug_deeply { + trace(setNo, "Calling NewItemSet, items:\n%s", items) + } this.sets = append(this.sets, NewItemSet(setNo, this.lexPart, this.symbols, items)) return setNo } func (this *ItemSets) Closure() *ItemSets { - trace(-1, "") + if debug_deeply { + trace(-1, "calculating closure of %s", this) + } for i := 0; i < len(this.sets); i++ { - dbg(-1, "S%d/%d\n", i, len(this.sets)) for symI, rng := range this.sets[i].SymbolClasses.List() { - dbg(i, " rng: %q\n", rng) if items := this.sets[i].Next(rng); len(items) != 0 { - for _ix, _it := range items { - dbg(i, " #%d: <%q>\n", _ix, _it) + if debug_deeply { + dbg(i, " rng: %q\nitems: %s\n", rng, items) } setNo, nextState := this.Add(items), this.sets[i].Transitions[symI] if nextState != -1 && nextState != setNo { @@ -81,8 +89,10 @@ func (this *ItemSets) Closure() *ItemSets { this.sets[i].DotTransition = setNo } } - for i := 0; i < len(this.sets); i++ { - this.propagateDots(i) + if fix_dots_bug { + for i := 0; i < len(this.sets); i++ { + this.propagateDots(i) + } } return this } diff --git a/internal/lexer/items/itemsets_test.go b/internal/lexer/items/itemsets_test.go index c64cda26..dfe9504f 100644 --- a/internal/lexer/items/itemsets_test.go +++ b/internal/lexer/items/itemsets_test.go @@ -75,7 +75,7 @@ ignoredTokId : '!' _tokId ; func _TestItemSets2(t *testing.T) { g := parse(testItemsets2src, t) - itemSets := GetItemSets(g.LexPart) + itemSets := GetItemSets(g.LexPart, false, false) fmt.Printf("%s\n", itemSets) } @@ -89,7 +89,7 @@ comment : _lineComment | _blockComment ; func _TestItemSets3(t *testing.T) { g := parse(testItemsets3src, t) - itemSets := GetItemSets(g.LexPart) + itemSets := GetItemSets(g.LexPart, false, false) fmt.Printf("%s\n", itemSets) } diff --git a/internal/parser/gen/golang/actiontable.go b/internal/parser/gen/golang/actiontable.go index 6f933092..3c20961e 100644 --- a/internal/parser/gen/golang/actiontable.go +++ b/internal/parser/gen/golang/actiontable.go @@ -99,6 +99,7 @@ func getActionRowData(prods ast.SyntaxProdList, set *items.ItemSet, tokMap *toke if len(symConflicts) > 0 { conflicts[sym] = symConflicts } + checkNonDeterministic := false switch act1 := act.(type) { case action.Accept: data.Actions[i] = fmt.Sprintf("accept(true), // %s", sym) @@ -106,8 +107,14 @@ func getActionRowData(prods ast.SyntaxProdList, set *items.ItemSet, tokMap *toke data.Actions[i] = fmt.Sprintf("nil, // %s", sym) case action.Reduce: data.Actions[i] = fmt.Sprintf("reduce(%d), // %s, reduce: %s", int(act1), sym, prods[int(act1)].Id) + checkNonDeterministic = true case action.Shift: data.Actions[i] = fmt.Sprintf("shift(%d), // %s", int(act1), sym) + checkNonDeterministic = true + default: + panic(fmt.Sprintf("Unknown action type: %T", act1)) + } + if checkNonDeterministic { switch s := sym.(type) { case ast.SyntaxContextDependentTokId, ast.SyntaxSubParser: data.CdActions = append(data.CdActions, cdActionFunc{ @@ -115,8 +122,6 @@ func getActionRowData(prods ast.SyntaxProdList, set *items.ItemSet, tokMap *toke fmt.Sprintf("cdFunc_%s", s.SymbolString()), }) } - default: - panic(fmt.Sprintf("Unknown action type: %T", act1)) } } return diff --git a/main.go b/main.go index 473929f7..5aa94d79 100644 --- a/main.go +++ b/main.go @@ -24,7 +24,7 @@ Changes summary: - 2019-10-14 + 2019-10-21 Many changes, many new features. Streamed parsing, longest prefix parsing, nondeterministic subparsing. - changed all go files using import from @@ -32,10 +32,39 @@ to import from https://github.com/maxcalandrelli/gocc - - fixed a state machine generation bug (hopefully), that prevented a RE like '<' '<' . { . } '>' '>' + - bugfixes: I discovered and (hopefully) fixed two severe bugs in the generated lexical analyzer. Both + fixes are controllable by a command line option, thus leaving intact the possibility of restoring + original behaviour should the fix cause any other problem. These bugs are explained below + + - BUG #1: state machine generation bug that prevented a regular expression like '<' '<' . { . } '>' '>' to recognize a string like "<< a > b >>" (this is done in ItemSets.propagateDots and in the generated lexer/transitiontable.go) + - BUG #2: state machine generation bug that had the following effect: given the following two alternative + sets of lexical productions: + + 1) _digit : '0'-'9' ; + _x0 : 'α' ; + _x1 : 'β' _digit { _digit } ; + _x : 'α' | ( 'β' _digit { _digit } ); + _test : _x { _x | 'γ' } ; + id: _x { _x0 | _x1 | 'γ' } ; + !whitespace : ' ' | '\t' | '\n' | '\r' ; + + and 2) _digit : '0'-'9' ; + _x0 : 'α' ; + _x : 'α' | ( 'β' _digit { _digit } ); + _test : _x { _x | 'γ' } ; + id: _x { _x0 | ( 'β' _digit { _digit } ) | 'γ' } ; + + they should parse identically (since the only difference is that the single occurrence of regdef _x1 in + set #1 has been replaced by its expansion in set #2), while they don't. As an example (you can test it + in the "ctx" folder under example), the string "β11β1β11 αβ33", when parsed with lexical ruleset 1 gives + the three tokens: "β11β1", "β11" and "αβ33". This result is incorrect, and the correct result is the set + of two tokens "β11β1β11" and "αβ33". This is the result we get when parsing with lexical ruleset #2. + This is because ItemList.Closure fails to add the ε-moves to the closure of a set of items when it contains + both a reduce and a shift for the same regdefid. + - eliminated ambiguity between literals and labels of lexical or syntaxical productions; "error" can now be specified as a literal, and a synonym is "λ", while a synonim for "empty" is "ε" @@ -101,7 +130,7 @@ >> in compact form, an import alias can be specified (without changes in stack usage)to avoid naming conflicts; - the following example is totally equivalent to the former: + the following example is equivalent to the former: NumericValue: integer @@ -134,8 +163,8 @@ >> either form of non deterministic parsing pushes two values on the stack: - - the pseudo-token built by taking as literal the longest prefix that the sub-parser rcognized - - the corresponding AST returned by the sun-parser + - the pseudo-token built by taking as literal the longest prefix that the sub-parser recognized + - the corresponding AST returned by the sub-parser @@ -213,7 +242,7 @@ func main() { gSymbols.Add(g.LexPart.TokenIds()...) g.LexPart.UpdateStringLitTokens(gSymbols.ListStringLitSymbols()) - lexSets := lexItems.GetItemSets(g.LexPart) + lexSets := lexItems.GetItemSets(g.LexPart, cfg.BugOption("lexer_dots").Fix(), cfg.BugOption("lexer_regdefs").Fix()) if cfg.Verbose() { io.WriteFileString(path.Join(outdir_log, "lexer_sets.txt"), lexSets.String()) } diff --git a/stock/main.go b/stock/main.go index 7443f47c..533c53af 100644 --- a/stock/main.go +++ b/stock/main.go @@ -97,7 +97,7 @@ func main() { gSymbols.Add(g.LexPart.TokenIds()...) g.LexPart.UpdateStringLitTokens(gSymbols.ListStringLitSymbols()) - lexSets := lexItems.GetItemSets(g.LexPart) + lexSets := lexItems.GetItemSets(g.LexPart, cfg.BugOption("lexer_dots").Fix(), cfg.BugOption("lexer_regdefs").Fix()) if cfg.Verbose() { io.WriteFileString(path.Join(outdir_log, "lexer_sets.txt"), lexSets.String()) } From 4e81e6b12b1ce036fbb9b52f25db675f2597835f Mon Sep 17 00:00:00 2001 From: Massimiliano Calandrelli Date: Tue, 22 Oct 2019 11:00:40 +0200 Subject: [PATCH 32/33] ... --- .../frontend/reparsed/internal/token/token.go | 60 ++++++ main.go | 19 +- main.go.orig | 190 ------------------ 3 files changed, 61 insertions(+), 208 deletions(-) delete mode 100644 main.go.orig diff --git a/internal/frontend/reparsed/internal/token/token.go b/internal/frontend/reparsed/internal/token/token.go index e0d8b555..9a422007 100644 --- a/internal/frontend/reparsed/internal/token/token.go +++ b/internal/frontend/reparsed/internal/token/token.go @@ -4,6 +4,8 @@ package token import ( "fmt" + "strconv" + "unicode/utf8" ) type Token struct { @@ -74,6 +76,64 @@ func (m TokenMap) StringType(typ Type) string { return fmt.Sprintf("%s(%d)", m.Id(typ), typ) } +// CharLiteralValue returns the string value of the char literal. +func (t *Token) CharLiteralValue() string { + return string(t.Lit[1 : len(t.Lit)-1]) +} + +// Float32Value returns the float32 value of the token or an error if the token literal does not +// denote a valid float32. +func (t *Token) Float32Value() (float32, error) { + if v, err := strconv.ParseFloat(string(t.Lit), 32); err != nil { + return 0, err + } else { + return float32(v), nil + } +} + +// Float64Value returns the float64 value of the token or an error if the token literal does not +// denote a valid float64. +func (t *Token) Float64Value() (float64, error) { + return strconv.ParseFloat(string(t.Lit), 64) +} + +// IDValue returns the string representation of an identifier token. +func (t *Token) IDValue() string { + return string(t.Lit) +} + +// Int32Value returns the int32 value of the token or an error if the token literal does not +// denote a valid float64. +func (t *Token) Int32Value() (int32, error) { + if v, err := strconv.ParseInt(string(t.Lit), 10, 64); err != nil { + return 0, err + } else { + return int32(v), nil + } +} + +// Int64Value returns the int64 value of the token or an error if the token literal does not +// denote a valid float64. +func (t *Token) Int64Value() (int64, error) { + return strconv.ParseInt(string(t.Lit), 10, 64) +} + +// UTF8Rune decodes the UTF8 rune in the token literal. It returns utf8.RuneError if +// the token literal contains an invalid rune. +func (t *Token) UTF8Rune() (rune, error) { + r, _ := utf8.DecodeRune(t.Lit) + if r == utf8.RuneError { + err := fmt.Errorf("Invalid rune") + return r, err + } + return r, nil +} + +// StringValue returns the string value of the token literal. +func (t *Token) StringValue() string { + return string(t.Lit[1 : len(t.Lit)-1]) +} + var TokMap = TokenMap{ typeMap: []string{ "INVALID", diff --git a/main.go b/main.go index 91fe1cc1..5aa94d79 100644 --- a/main.go +++ b/main.go @@ -217,7 +217,7 @@ func main() { } config.CurrentConfiguration = cfg - + var ( grammar interface{} ) @@ -272,23 +272,6 @@ func main() { genIo.Gen(cfg.Package(), outdir_base, cfg.InternalSubdir()) } -func getSource(cfg config.Config) []byte { - if strings.HasSuffix(cfg.SourceFile(), ".md") { - str, err := md.GetSource(cfg.SourceFile()) - if err != nil { - fmt.Println(err) - os.Exit(1) - } - return []byte(str) - } - srcBuffer, err := ioutil.ReadFile(cfg.SourceFile()) - if err != nil { - fmt.Println(err) - os.Exit(1) - } - return srcBuffer -} - func usage() { fmt.Fprintf(os.Stderr, "usage: gocc flags bnf_file\n\n") fmt.Fprintf(os.Stderr, " bnf_file: contains the BNF grammar\n\n") diff --git a/main.go.orig b/main.go.orig deleted file mode 100644 index c3bf4d05..00000000 --- a/main.go.orig +++ /dev/null @@ -1,190 +0,0 @@ -//Copyright 2013 Vastech SA (PTY) LTD -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//Gocc is LR1 parser generator for go written in go. The generator uses a BNF with very easy to use SDT rules. -//Please see https://github.com/goccmack/gocc/ for more documentation. -package main - -import ( - "bytes" - "flag" - "fmt" - "io/ioutil" - "os" - "path" - "strings" - - "github.com/goccmack/gocc/internal/ast" - "github.com/goccmack/gocc/internal/config" - "github.com/goccmack/gocc/internal/frontend/parser" - "github.com/goccmack/gocc/internal/frontend/scanner" - "github.com/goccmack/gocc/internal/frontend/token" - "github.com/goccmack/gocc/internal/io" - genLexer "github.com/goccmack/gocc/internal/lexer/gen/golang" - lexItems "github.com/goccmack/gocc/internal/lexer/items" - "github.com/goccmack/gocc/internal/parser/first" - genParser "github.com/goccmack/gocc/internal/parser/gen" - lr1Action "github.com/goccmack/gocc/internal/parser/lr1/action" - lr1Items "github.com/goccmack/gocc/internal/parser/lr1/items" - "github.com/goccmack/gocc/internal/parser/symbols" - outToken "github.com/goccmack/gocc/internal/token" - genToken "github.com/goccmack/gocc/internal/token/gen" - genUtil "github.com/goccmack/gocc/internal/util/gen" -<<<<<<< HEAD - "github.com/goccmack/gocc/internal/util/md" - - // "runtime/pprof" - "time" - - genParser "github.com/goccmack/gocc/internal/parser/gen" -======= ->>>>>>> 7a292ad833c2ba6a29151456d8de06ac9ab2a505 -) - -func main() { - flag.Usage = usage - cfg, err := config.New() - if err != nil { - fmt.Printf("Error reading configuration: %s\n", err) - flag.Usage() - } - - if cfg.Verbose() { - cfg.PrintParams() - } - - if cfg.Help() { - flag.Usage() - } - - scanner := &scanner.Scanner{} - srcBuffer := getSource(cfg) - - scanner.Init(srcBuffer, token.FRONTENDTokens) - parser := parser.NewParser(parser.ActionTable, parser.GotoTable, parser.ProductionsTable, token.FRONTENDTokens) - grammar, err := parser.Parse(scanner) - if err != nil { - fmt.Printf("Parse error: %s\n", err) - os.Exit(1) - } - - g := grammar.(*ast.Grammar) - - gSymbols := symbols.NewSymbols(g) - if cfg.Verbose() { - writeTerminals(gSymbols, cfg) - } - - var tokenMap *outToken.TokenMap - - gSymbols.Add(g.LexPart.TokenIds()...) - g.LexPart.UpdateStringLitTokens(gSymbols.ListStringLitSymbols()) - lexSets := lexItems.GetItemSets(g.LexPart) - if cfg.Verbose() { - io.WriteFileString(path.Join(cfg.OutDir(), "lexer_sets.txt"), lexSets.String()) - } - tokenMap = outToken.NewTokenMap(gSymbols.ListTerminals()) - if !cfg.NoLexer() { - genLexer.Gen(cfg.Package(), cfg.OutDir(), g.LexPart.Header.SDTLit, lexSets, tokenMap, cfg) - } - - if g.SyntaxPart != nil { - firstSets := first.GetFirstSets(g, gSymbols) - if cfg.Verbose() { - io.WriteFileString(path.Join(cfg.OutDir(), "first.txt"), firstSets.String()) - } - - lr1Sets := lr1Items.GetItemSets(g, gSymbols, firstSets) - if cfg.Verbose() { - io.WriteFileString(path.Join(cfg.OutDir(), "LR1_sets.txt"), lr1Sets.String()) - } - - conflicts := genParser.Gen(cfg.Package(), cfg.OutDir(), g.SyntaxPart.Header.SDTLit, g.SyntaxPart.ProdList, gSymbols, lr1Sets, tokenMap, cfg) - handleConflicts(conflicts, lr1Sets.Size(), cfg, g.SyntaxPart.ProdList) - } - - genToken.Gen(cfg.Package(), cfg.OutDir(), tokenMap) - genUtil.Gen(cfg.OutDir()) - -} - -func getSource(cfg config.Config) []byte { - if strings.HasSuffix(cfg.SourceFile(), ".md") { - str, err := md.GetSource(cfg.SourceFile()) - if err != nil { - fmt.Println(err) - os.Exit(1) - } - return []byte(str) - } - srcBuffer, err := ioutil.ReadFile(cfg.SourceFile()) - if err != nil { - fmt.Println(err) - os.Exit(1) - } - return srcBuffer -} - -func usage() { - fmt.Fprintf(os.Stderr, "usage: gocc flags bnf_file\n\n") - fmt.Fprintf(os.Stderr, " bnf_file: contains the BNF grammar\n\n") - fmt.Fprintf(os.Stderr, "Flags:\n") - flag.PrintDefaults() - os.Exit(1) -} - -func handleConflicts(conflicts map[int]lr1Items.RowConflicts, numSets int, cfg config.Config, prods ast.SyntaxProdList) { - if len(conflicts) <= 0 { - return - } - fmt.Printf("%d LR-1 conflicts \n", len(conflicts)) - if cfg.Verbose() { - io.WriteFileString(path.Join(cfg.OutDir(), "LR1_conflicts.txt"), conflictString(conflicts, numSets, prods)) - } - if !cfg.AutoResolveLRConf() { - os.Exit(1) - } -} - -func conflictString(conflicts map[int]lr1Items.RowConflicts, numSets int, prods ast.SyntaxProdList) string { - w := new(strings.Builder) - fmt.Fprintf(w, "%d LR-1 conflicts: \n", len(conflicts)) - for i := 0; i < numSets; i++ { - if cnf, exist := conflicts[i]; exist { - fmt.Fprintf(w, "\tS%d\n", i) - for sym, conflicts := range cnf { - fmt.Fprintf(w, "\t\tsymbol: %s\n", sym) - for _, cflct := range conflicts { - switch c := cflct.(type) { - case lr1Action.Reduce: - fmt.Fprintf(w, "\t\t\tReduce(%d:%s)\n", c, prods[c]) - case lr1Action.Shift: - fmt.Fprintf(w, "\t\t\t%s\n", cflct) - default: - panic(fmt.Sprintf("unexpected type of action: %s", cflct)) - } - } - } - } - } - return w.String() -} - -func writeTerminals(gSymbols *symbols.Symbols, cfg config.Config) { - buf := new(bytes.Buffer) - for _, t := range gSymbols.ListTerminals() { - fmt.Fprintf(buf, "%s\n", t) - } - io.WriteFile(path.Join(cfg.OutDir(), "terminals.txt"), buf.Bytes()) -} From f6aff766588f3a8b02989d0e41a58edccb0f5dfc Mon Sep 17 00:00:00 2001 From: Massimiliano Calandrelli Date: Tue, 22 Oct 2019 18:54:01 +0200 Subject: [PATCH 33/33] added preprocessing --- example/calc/calc.bnf | 2 +- .../calc/internal/lexer/transitiontable.go | 2 +- .../calc.grammar/calc/internal/token/token.go | 60 +++ example/macro/Makefile | 4 + example/macro/macro1.bnf | 73 +++ .../macro1.grammar/macro1/iface/macro1.go | 63 +++ .../macro1/internal/errors/errors.go | 56 ++ .../io/stream/internal/stream_impl.go | 275 ++++++++++ .../io/stream/internal/stream_public.go | 101 ++++ .../macro1/internal/io/stream/stream.go | 39 ++ .../macro1/internal/lexer/acttab.go | 115 +++++ .../macro1/internal/lexer/lexer.go | 174 +++++++ .../macro1/internal/lexer/transitiontable.go | 239 +++++++++ .../macro1/internal/parser/action.go | 51 ++ .../macro1/internal/parser/actiontable.go | 195 +++++++ .../macro1/internal/parser/gototable.go | 97 ++++ .../macro1/internal/parser/parser.go | 359 +++++++++++++ .../internal/parser/productionstable.go | 141 +++++ .../macro1/internal/token/token.go | 166 ++++++ .../macro1/internal/util/litconv.go | 108 ++++ .../macro1/internal/util/rune.go | 140 +++++ .../macro1.grammar/macro1/log/macro1.bnf | 47 ++ example/macro/macro1.grammar/macro1/macro1.go | 131 +++++ .../macro1.grammar/macro1/main/macro1.go | 58 +++ example/macro/macro1.grammar/macro1/util.go | 25 + example/macro/macro2.bnf | 85 ++++ .../macro2.grammar/macro2/iface/macro2.go | 63 +++ .../macro2/internal/errors/errors.go | 56 ++ .../io/stream/internal/stream_impl.go | 275 ++++++++++ .../io/stream/internal/stream_public.go | 101 ++++ .../macro2/internal/io/stream/stream.go | 39 ++ .../macro2/internal/lexer/acttab.go | 115 +++++ .../macro2/internal/lexer/lexer.go | 174 +++++++ .../macro2/internal/lexer/transitiontable.go | 239 +++++++++ .../macro2/internal/parser/action.go | 51 ++ .../macro2/internal/parser/actiontable.go | 195 +++++++ .../macro2/internal/parser/gototable.go | 97 ++++ .../macro2/internal/parser/parser.go | 359 +++++++++++++ .../internal/parser/productionstable.go | 148 ++++++ .../macro2/internal/token/token.go | 166 ++++++ .../macro2/internal/util/litconv.go | 108 ++++ .../macro2/internal/util/rune.go | 140 +++++ .../macro2.grammar/macro2/log/macro2.bnf | 65 +++ example/macro/macro2.grammar/macro2/macro2.go | 131 +++++ .../macro2.grammar/macro2/main/macro2.go | 58 +++ example/macro/macro2.grammar/macro2/util.go | 25 + internal/config/config.go | 14 +- .../reparsed/internal/parser/actiontable.go | 481 ++++++++++-------- .../reparsed/internal/parser/gototable.go | 88 ++-- .../reparsed/internal/parser/parser.go | 4 +- .../internal/parser/productionstable.go | 46 +- internal/frontend/reparsed/log/LR1_sets.txt | 306 +++++------ internal/macro/preprocess.go | 310 +++++++++++ .../parser/gen/golang/productionstable.go | 5 +- main.go | 22 +- spec/gocc2.ebnf | 3 + 56 files changed, 6257 insertions(+), 433 deletions(-) create mode 100644 example/macro/Makefile create mode 100644 example/macro/macro1.bnf create mode 100644 example/macro/macro1.grammar/macro1/iface/macro1.go create mode 100644 example/macro/macro1.grammar/macro1/internal/errors/errors.go create mode 100644 example/macro/macro1.grammar/macro1/internal/io/stream/internal/stream_impl.go create mode 100644 example/macro/macro1.grammar/macro1/internal/io/stream/internal/stream_public.go create mode 100644 example/macro/macro1.grammar/macro1/internal/io/stream/stream.go create mode 100644 example/macro/macro1.grammar/macro1/internal/lexer/acttab.go create mode 100644 example/macro/macro1.grammar/macro1/internal/lexer/lexer.go create mode 100644 example/macro/macro1.grammar/macro1/internal/lexer/transitiontable.go create mode 100644 example/macro/macro1.grammar/macro1/internal/parser/action.go create mode 100644 example/macro/macro1.grammar/macro1/internal/parser/actiontable.go create mode 100644 example/macro/macro1.grammar/macro1/internal/parser/gototable.go create mode 100644 example/macro/macro1.grammar/macro1/internal/parser/parser.go create mode 100644 example/macro/macro1.grammar/macro1/internal/parser/productionstable.go create mode 100644 example/macro/macro1.grammar/macro1/internal/token/token.go create mode 100644 example/macro/macro1.grammar/macro1/internal/util/litconv.go create mode 100644 example/macro/macro1.grammar/macro1/internal/util/rune.go create mode 100644 example/macro/macro1.grammar/macro1/log/macro1.bnf create mode 100644 example/macro/macro1.grammar/macro1/macro1.go create mode 100644 example/macro/macro1.grammar/macro1/main/macro1.go create mode 100644 example/macro/macro1.grammar/macro1/util.go create mode 100644 example/macro/macro2.bnf create mode 100644 example/macro/macro2.grammar/macro2/iface/macro2.go create mode 100644 example/macro/macro2.grammar/macro2/internal/errors/errors.go create mode 100644 example/macro/macro2.grammar/macro2/internal/io/stream/internal/stream_impl.go create mode 100644 example/macro/macro2.grammar/macro2/internal/io/stream/internal/stream_public.go create mode 100644 example/macro/macro2.grammar/macro2/internal/io/stream/stream.go create mode 100644 example/macro/macro2.grammar/macro2/internal/lexer/acttab.go create mode 100644 example/macro/macro2.grammar/macro2/internal/lexer/lexer.go create mode 100644 example/macro/macro2.grammar/macro2/internal/lexer/transitiontable.go create mode 100644 example/macro/macro2.grammar/macro2/internal/parser/action.go create mode 100644 example/macro/macro2.grammar/macro2/internal/parser/actiontable.go create mode 100644 example/macro/macro2.grammar/macro2/internal/parser/gototable.go create mode 100644 example/macro/macro2.grammar/macro2/internal/parser/parser.go create mode 100644 example/macro/macro2.grammar/macro2/internal/parser/productionstable.go create mode 100644 example/macro/macro2.grammar/macro2/internal/token/token.go create mode 100644 example/macro/macro2.grammar/macro2/internal/util/litconv.go create mode 100644 example/macro/macro2.grammar/macro2/internal/util/rune.go create mode 100644 example/macro/macro2.grammar/macro2/log/macro2.bnf create mode 100644 example/macro/macro2.grammar/macro2/macro2.go create mode 100644 example/macro/macro2.grammar/macro2/main/macro2.go create mode 100644 example/macro/macro2.grammar/macro2/util.go create mode 100644 internal/macro/preprocess.go diff --git a/example/calc/calc.bnf b/example/calc/calc.bnf index 549858c0..eac97693 100644 --- a/example/calc/calc.bnf +++ b/example/calc/calc.bnf @@ -2,7 +2,7 @@ _digit : '0'-'9' ; -int64 : '1'-'9' {_digit} ; +int64 : '0'-'9' {_digit} ; !whitespace : ' ' | '\t' | '\n' | '\r' ; diff --git a/example/calc/calc.grammar/calc/internal/lexer/transitiontable.go b/example/calc/calc.grammar/calc/internal/lexer/transitiontable.go index 6d5d2a50..f649e498 100644 --- a/example/calc/calc.grammar/calc/internal/lexer/transitiontable.go +++ b/example/calc/calc.grammar/calc/internal/lexer/transitiontable.go @@ -33,7 +33,7 @@ var TransTab = TransitionTable{ return 6 case r == 47: // ['/','/'] return 7 - case 49 <= r && r <= 57: // ['1','9'] + case 48 <= r && r <= 57: // ['0','9'] return 8 } return NoState diff --git a/example/calc/calc.grammar/calc/internal/token/token.go b/example/calc/calc.grammar/calc/internal/token/token.go index d9589291..263d8e59 100644 --- a/example/calc/calc.grammar/calc/internal/token/token.go +++ b/example/calc/calc.grammar/calc/internal/token/token.go @@ -4,6 +4,8 @@ package token import ( "fmt" + "strconv" + "unicode/utf8" ) type Token struct { @@ -74,6 +76,64 @@ func (m TokenMap) StringType(typ Type) string { return fmt.Sprintf("%s(%d)", m.Id(typ), typ) } +// CharLiteralValue returns the string value of the char literal. +func (t *Token) CharLiteralValue() string { + return string(t.Lit[1 : len(t.Lit)-1]) +} + +// Float32Value returns the float32 value of the token or an error if the token literal does not +// denote a valid float32. +func (t *Token) Float32Value() (float32, error) { + if v, err := strconv.ParseFloat(string(t.Lit), 32); err != nil { + return 0, err + } else { + return float32(v), nil + } +} + +// Float64Value returns the float64 value of the token or an error if the token literal does not +// denote a valid float64. +func (t *Token) Float64Value() (float64, error) { + return strconv.ParseFloat(string(t.Lit), 64) +} + +// IDValue returns the string representation of an identifier token. +func (t *Token) IDValue() string { + return string(t.Lit) +} + +// Int32Value returns the int32 value of the token or an error if the token literal does not +// denote a valid float64. +func (t *Token) Int32Value() (int32, error) { + if v, err := strconv.ParseInt(string(t.Lit), 10, 64); err != nil { + return 0, err + } else { + return int32(v), nil + } +} + +// Int64Value returns the int64 value of the token or an error if the token literal does not +// denote a valid float64. +func (t *Token) Int64Value() (int64, error) { + return strconv.ParseInt(string(t.Lit), 10, 64) +} + +// UTF8Rune decodes the UTF8 rune in the token literal. It returns utf8.RuneError if +// the token literal contains an invalid rune. +func (t *Token) UTF8Rune() (rune, error) { + r, _ := utf8.DecodeRune(t.Lit) + if r == utf8.RuneError { + err := fmt.Errorf("Invalid rune") + return r, err + } + return r, nil +} + +// StringValue returns the string value of the token literal. +func (t *Token) StringValue() string { + return string(t.Lit[1 : len(t.Lit)-1]) +} + var TokMap = TokenMap{ typeMap: []string{ "INVALID", diff --git a/example/macro/Makefile b/example/macro/Makefile new file mode 100644 index 00000000..fb38f7f7 --- /dev/null +++ b/example/macro/Makefile @@ -0,0 +1,4 @@ +regenerate: + gocc -preprocessor="cpp -P @in @out" macro1.bnf + gocc -preprocessor="internal" macro2.bnf + diff --git a/example/macro/macro1.bnf b/example/macro/macro1.bnf new file mode 100644 index 00000000..37702058 --- /dev/null +++ b/example/macro/macro1.bnf @@ -0,0 +1,73 @@ +!whitespace : ' ' | '\t' | '\n' | '\r' ; +_digit : '0'-'9' ; +_letter : 'a'-'z' | 'A'-'Z' | ( '\\' 'u' _hex { _hex } ) ; +_hex : _digit | ( 'a'-'f' ) | ('A' - 'F') ; +_idchar : _letter | _digit | '_'; + +_x0 : 'α' ; +_x1 : 'β' _digit { _digit } ; +_x : 'α' | ( 'β' _digit { _digit } ); + +id: + _x { _x0 | _x1 | 'γ' } +; + +<< + + +func first_one(x string) []string { + fmt.Printf("start with this this one: %s\n", x) + return []string{x} +} + +func add_one(c []string, x string) []string { + fmt.Printf("add to %q that %s\n", c, x) + return append([]string{x},c...) +} + +func summary(v interface{}) string { + return fmt.Sprintf("ok, so we got <%q> as a final result.\n", v) +} + +func definition(deftype, defname string, defval int64) (interface{}, error) { + fmt.Printf("Definition of variable <%s> with '%s' as %d\n", defname, deftype, defval) + return fmt.Sprintf("%s <- %d", defname, defval), nil +} + +>> + +#define DEFREPEATABLE(x, action_1, action_n, type)\ +x##_s : \ + x \ + << action_1($0.(type)),nil >>\ + |\ + x##_s \ + ";"\ + x \ + << action_n($0.([]type),$2.(type)),nil >>\ +;\ + + + +StmtList : + Stmt_s + << + func() (interface{}, error) {fmt.Printf("%s", summary($0)); return 42, nil}() + >> +; + +DEFREPEATABLE(Stmt, first_one, add_one, string) + +StmtPref: + "let"| "define" +; + +Stmt : + StmtPref + id + "=" + @ "github.com/maxcalandrelli/gocc/example/calc/calc.grammar/calc" + << + definition($0s,$1s,$4.(int64)) + >> +; diff --git a/example/macro/macro1.grammar/macro1/iface/macro1.go b/example/macro/macro1.grammar/macro1/iface/macro1.go new file mode 100644 index 00000000..d9a165bc --- /dev/null +++ b/example/macro/macro1.grammar/macro1/iface/macro1.go @@ -0,0 +1,63 @@ +// Code generated by gocc; DO NOT EDIT. + +package iface + +import ( + "github.com/maxcalandrelli/gocc/example/macro/macro1.grammar/macro1/internal/errors" + "github.com/maxcalandrelli/gocc/example/macro/macro1.grammar/macro1/internal/io/stream" + "github.com/maxcalandrelli/gocc/example/macro/macro1.grammar/macro1/internal/token" + "io" +) + +type ( + Token = token.Token + TokenMap = token.TokenMap + Pos = token.Pos + ErrorSymbol = errors.ErrorSymbol + Error = errors.Error + + Scanner interface { + Scan() (tok *Token) + } + + StreamScanner interface { + GetStream() TokenStream + } + + CheckPoint interface { + DistanceFrom(CheckPoint) int + Advance(int) CheckPoint + } + + CheckPointable interface { + GetCheckPoint() CheckPoint + GotoCheckPoint(CheckPoint) + } + + TokenStream interface { + io.Reader + io.RuneScanner + io.Seeker + } +) + +const ( + INVALID = token.INVALID + EOF = token.EOF +) + +func GetTokenMap() TokenMap { + return token.TokMap +} + +func NewWindowReaderFromBytes(src []byte) stream.WindowReader { + return stream.NewWindowReaderFromBytes(src) +} + +func NewWindowReader(rdr io.Reader) stream.WindowReader { + return stream.NewWindowReader(rdr) +} + +func NewLimitedWindowReader(rdr io.Reader, sizeMin, sizeMax int) stream.WindowReader { + return stream.NewLimitedWindowReader(rdr, sizeMin, sizeMax) +} diff --git a/example/macro/macro1.grammar/macro1/internal/errors/errors.go b/example/macro/macro1.grammar/macro1/internal/errors/errors.go new file mode 100644 index 00000000..9e0b23d0 --- /dev/null +++ b/example/macro/macro1.grammar/macro1/internal/errors/errors.go @@ -0,0 +1,56 @@ +// Code generated by gocc; DO NOT EDIT. + +package errors + +import ( + "fmt" + "strings" + + "github.com/maxcalandrelli/gocc/example/macro/macro1.grammar/macro1/internal/token" +) + +type ErrorSymbol interface { +} + +type Error struct { + Err error + ErrorToken *token.Token + ErrorSymbols []ErrorSymbol + ExpectedTokens []string + StackTop int +} + +func (e *Error) String() string { + w := new(strings.Builder) + fmt.Fprintf(w, "Error") + if e.Err != nil { + fmt.Fprintf(w, " %s\n", e.Err) + } else { + fmt.Fprintf(w, "\n") + } + fmt.Fprintf(w, "Token: type=%d, lit=%s\n", e.ErrorToken.Type, e.ErrorToken.Lit) + fmt.Fprintf(w, "Pos: offset=%d, line=%d, column=%d\n", e.ErrorToken.Pos.Offset, e.ErrorToken.Pos.Line, e.ErrorToken.Pos.Column) + fmt.Fprintf(w, "Expected one of: ") + for _, sym := range e.ExpectedTokens { + fmt.Fprintf(w, "%s ", sym) + } + fmt.Fprintf(w, "ErrorSymbol:\n") + for _, sym := range e.ErrorSymbols { + fmt.Fprintf(w, "%v\n", sym) + } + return w.String() +} + +func (e *Error) Error() string { + w := new(strings.Builder) + fmt.Fprintf(w, "Error in S%d: %s, %s", e.StackTop, token.TokMap.TokenString(e.ErrorToken), e.ErrorToken.Pos.String()) + if e.Err != nil { + fmt.Fprintf(w, ": %+v", e.Err) + } else { + fmt.Fprintf(w, ", expected one of: ") + for _, expected := range e.ExpectedTokens { + fmt.Fprintf(w, "%s ", expected) + } + } + return w.String() +} diff --git a/example/macro/macro1.grammar/macro1/internal/io/stream/internal/stream_impl.go b/example/macro/macro1.grammar/macro1/internal/io/stream/internal/stream_impl.go new file mode 100644 index 00000000..358aa160 --- /dev/null +++ b/example/macro/macro1.grammar/macro1/internal/io/stream/internal/stream_impl.go @@ -0,0 +1,275 @@ +package internal + +import ( + "io" + "sync" + "unicode/utf8" +) + +type ( + impl_WindowReader struct { + bufferBlockSize int + maxBufferSize int + buffers [][]byte + available int + absbase int64 + position int + eof bool + rdr io.Reader + lock *sync.Mutex + } +) + +func (s *impl_WindowReader) lockReader() { + if s.lock != nil { + s.lock.Lock() + } +} + +func (s *impl_WindowReader) unlockReader() { + if s.lock != nil { + s.lock.Unlock() + } +} + +func (s *impl_WindowReader) seek(offset int64, whence int) (offs int64, err error) { + switch whence { + case io.SeekStart: + return s.seek(offset-s.ReadPosition(), io.SeekCurrent) + case io.SeekCurrent: + switch { + case offset == 0: + return s.ReadPosition(), nil + case offset < 0: + if -offset > int64(s.maxBackOffset()) { + err = io.ErrShortBuffer + } else { + s.advanceGet(int(offset)) + } + case offset > 0: + for offset > 0 && !s.eof { + available := s.Buffered() + if offset <= int64(available) { + s.advanceGet(int(offset)) + break + } + if available > 0 { + s.advanceGet(available) + offset -= int64(available) + } + read, _ := s.fetchBytes(int(offset)) + s.advanceGet(read) + offset -= int64(read) + } + if s.eof { + err = io.EOF + } + } + case io.SeekEnd: + for !s.eof { + s.seek(int64(s.MaxCap()), io.SeekCurrent) + } + s.seek(int64(s.Buffered()), io.SeekCurrent) + } + if s.eof && err == nil && s.Buffered() > 0 { + s.eof = false + } + return s.ReadPosition(), err +} + +func (s impl_WindowReader) maxBackOffset() int { + r := s.position + if s.absbase > 0 { + r = s.Cap() - s.Buffered() + } + return r +} + +func (s impl_WindowReader) bufferIndex(pos int) int { + if pos < 0 { + panic("negative position") + } + return pos / s.bufferBlockSize +} + +func (s impl_WindowReader) bufferBytes(pos int) []byte { + return s.buffers[s.bufferIndex(pos)] +} + +func (s impl_WindowReader) bufferByteRange(pos int, length int) []byte { + p := s.bufferOffset(pos) + return s.bufferBytes(pos)[p : p+length] +} + +func (s impl_WindowReader) bufferOffset(pos int) int { + return pos % s.bufferBlockSize +} + +func (s *impl_WindowReader) advanceGet(n int) { + sz := s.Cap() + switch { + case n < 0: + if -n > s.maxBackOffset() { + panic("underflow") + } + s.position += n + if s.position < 0 { + s.position += sz + s.absbase -= int64(sz) + } + case n > 0: + if n > s.Buffered() { + panic("overflow") + } + s.position += n + if s.position >= sz { + s.position -= sz + s.absbase += int64(sz) + } + } + s.available -= n +} + +func (s *impl_WindowReader) copy(to []byte, length int) { + for offs, cp := 0, 0; length > 0; length -= cp { + s.position %= s.MaxCap() + p := s.bufferOffset(s.position) + b := s.bufferBytes(s.position) + r := s.bufferBlockSize - p + if length <= r { + cp = copy(to[offs:], b[p:p+length]) + } else { + cp = copy(to[offs:], b[p:]) + } + s.advanceGet(cp) + offs += cp + } +} + +func (s *impl_WindowReader) fetchBytes(n int) (read int, err error) { + if s.rdr == nil { + s.eof = true + return 0, io.EOF + } + for n > 0 && s.Buffered() < s.MaxCap() && err == nil { + readNow := n + putpos := s.position + s.available + r := s.bufferBlockSize - s.bufferOffset(putpos) + if readNow > r { + readNow = r + } + for s.bufferIndex(putpos) >= len(s.buffers) && s.Cap() < s.MaxCap() { + s.buffers = append(s.buffers, make([]byte, s.bufferBlockSize)) + } + putpos %= s.MaxCap() + offs := s.bufferOffset(putpos) + if r, err = s.rdr.Read(s.bufferBytes(putpos)[offs : offs+readNow]); r > 0 { + s.available += r + read += r + n -= r + } + } + if n > 0 && err == nil { + err = io.ErrShortBuffer + } + return +} + +func (s *impl_WindowReader) read(p []byte) (read int, err error) { + if s.eof { + return 0, io.EOF + } + for read < len(p) && err == nil { + available := s.Buffered() + if len(p)-read <= available { + s.copy(p[read:], len(p)-read) + read = len(p) + } else { + if available == 0 { + available, err = s.fetchBytes(len(p) - read) + } + s.copy(p[read:], available) + read += available + switch err { + case io.ErrShortBuffer: + err = nil + case io.EOF: + s.eof = true + } + } + } + return +} + +func (s impl_WindowReader) peekByte() (byte, error) { + if s.Buffered() < 1 { + return 0, io.ErrShortBuffer + } + return s.bufferBytes(s.position)[s.bufferOffset(s.position)], nil +} + +func (s *impl_WindowReader) unreadByte() error { + _, e := s.seek(-1, io.SeekCurrent) + return e +} + +func (s *impl_WindowReader) readRune() (r rune, size int, err error) { + for i := 1; err == nil && i <= 4; i++ { + if s.Buffered() < i { + if _, err = s.fetchBytes(i); err != nil { + return + } + } + t := s.bufferByteRange(s.position, i) + if r, size = utf8.DecodeRune(t); r != utf8.RuneError { + s.advanceGet(size) + return + } + } + return utf8.RuneError, 0, err +} + +func (s *impl_WindowReader) unreadRune() (err error) { + tmps := *s + tmpb := []byte{} + for { + if _, err = tmps.seek(-1, io.SeekCurrent); err == nil { + b, _ := tmps.peekByte() + tmpb = append([]byte{b}, tmpb...) + switch len(tmpb) { + case 1: + if (tmpb[0] & 0xC0) == 0x80 { + continue + } + _, err = s.seek(-int64(len(tmpb)), io.SeekCurrent) + return + case 2: + if (tmpb[0] & 0xC0) == 0x80 { + continue + } + if (tmpb[0] & 0xE0) != 0xC0 { + break + } + _, err = s.seek(-int64(len(tmpb)), io.SeekCurrent) + return + case 3: + if (tmpb[0] & 0xC0) == 0x80 { + continue + } + if (tmpb[0] & 0xF0) != 0xE0 { + break + } + _, err = s.seek(-int64(len(tmpb)), io.SeekCurrent) + return + case 4: + if (tmpb[0] & 0xF8) != 0xF0 { + break + } + _, err = s.seek(-int64(len(tmpb)), io.SeekCurrent) + return + } + } + } + _, err = s.seek(-1, io.SeekCurrent) + return +} diff --git a/example/macro/macro1.grammar/macro1/internal/io/stream/internal/stream_public.go b/example/macro/macro1.grammar/macro1/internal/io/stream/internal/stream_public.go new file mode 100644 index 00000000..20ed7b5e --- /dev/null +++ b/example/macro/macro1.grammar/macro1/internal/io/stream/internal/stream_public.go @@ -0,0 +1,101 @@ +package internal + +import ( + "io" +) + +func NewWindowReader(buf []byte, underlyingReader io.Reader, blksize, smax int, InfoPrefixRoundUp bool) *impl_WindowReader { + if blksize < 0 || smax < blksize { + panic("illegal buffer size") + } + r := &impl_WindowReader{rdr: underlyingReader} + r.bufferBlockSize = blksize + if underlyingReader != nil { + if blksize <= 0 { + r.bufferBlockSize = 1 << 10 + } else if InfoPrefixRoundUp { + for r.bufferBlockSize = 1; blksize > 0; r.bufferBlockSize = r.bufferBlockSize << 1 { + blksize = blksize >> 1 + } + } + if smax > 0 { + r.maxBufferSize = ((smax-1)/r.bufferBlockSize + 1) * r.bufferBlockSize + } + r.buffers = [][]byte{} + } else { + r.buffers = [][]byte{buf} + r.available = len(buf) + r.bufferBlockSize = r.available + r.maxBufferSize = r.available + } + return r +} + +func (s impl_WindowReader) Cap() int { + return len(s.buffers) * s.bufferBlockSize +} + +func (s impl_WindowReader) BlockSize() int { + return s.bufferBlockSize +} + +func (s impl_WindowReader) MaxCap() int { + if s.maxBufferSize > 0 { + return s.maxBufferSize + } + return 1 << 31 +} + +func (s impl_WindowReader) MaxUnreadSize() int { + return s.maxBackOffset() +} + +func (s impl_WindowReader) Buffered() int { + return s.available +} + +func (s impl_WindowReader) ReadPosition() int64 { + return s.absbase + int64(s.position) +} + +func (s *impl_WindowReader) Read(p []byte) (read int, err error) { + s.lockReader() + defer func() { s.unlockReader() }() + return s.read(p) +} + +func (s *impl_WindowReader) Seek(offset int64, whence int) (offs int64, err error) { + s.lockReader() + defer func() { s.unlockReader() }() + return s.seek(offset, whence) +} + +func (s *impl_WindowReader) ReadByte() (byte, error) { + b := []byte{0} + _, err := s.Read(b) + return b[0], err +} + +func (s *impl_WindowReader) PeekByte() (byte, error) { + s.lockReader() + defer func() { s.unlockReader() }() + return s.peekByte() +} + +func (s *impl_WindowReader) UnreadByte() error { + s.lockReader() + defer func() { s.unlockReader() }() + return s.unreadByte() +} + +func (s *impl_WindowReader) ReadRune() (r rune, size int, err error) { + s.lockReader() + defer func() { s.unlockReader() }() + return s.readRune() +} + +func (s *impl_WindowReader) UnreadRune() (err error) { + s.lockReader() + defer func() { s.unlockReader() }() + return s.unreadRune() +} diff --git a/example/macro/macro1.grammar/macro1/internal/io/stream/stream.go b/example/macro/macro1.grammar/macro1/internal/io/stream/stream.go new file mode 100644 index 00000000..5f8e95fa --- /dev/null +++ b/example/macro/macro1.grammar/macro1/internal/io/stream/stream.go @@ -0,0 +1,39 @@ +package stream + +import ( + internal "github.com/maxcalandrelli/gocc/example/macro/macro1.grammar/macro1/internal/io/stream/internal" + "io" +) + +type ( + WindowReader interface { + BlockSize() int + Buffered() int + Cap() int + MaxCap() int + Read([]byte) (int, error) + ReadByte() (byte, error) + ReadPosition() int64 + ReadRune() (rune, int, error) + Seek(int64, int) (int64, error) + UnreadByte() error + UnreadRune() error + MaxUnreadSize() int + } +) + +var ( + InfoPrefixRoundUp = false +) + +func NewWindowReaderFromBytes(src []byte) WindowReader { + return internal.NewWindowReader(src, nil, 0, 0, InfoPrefixRoundUp) +} + +func NewWindowReader(rdr io.Reader) WindowReader { + return internal.NewWindowReader(nil, rdr, 0, 0, false) +} + +func NewLimitedWindowReader(rdr io.Reader, sizeMin, sizeMax int) WindowReader { + return internal.NewWindowReader(nil, rdr, sizeMin, sizeMax, InfoPrefixRoundUp) +} diff --git a/example/macro/macro1.grammar/macro1/internal/lexer/acttab.go b/example/macro/macro1.grammar/macro1/internal/lexer/acttab.go new file mode 100644 index 00000000..326ec40f --- /dev/null +++ b/example/macro/macro1.grammar/macro1/internal/lexer/acttab.go @@ -0,0 +1,115 @@ +// Code generated by gocc; DO NOT EDIT. + +package lexer + +import ( + "fmt" + + "github.com/maxcalandrelli/gocc/example/macro/macro1.grammar/macro1/internal/token" +) + +type ActionTable [NumStates]ActionRow + +type ActionRow struct { + Accept token.Type + Ignore string +} + +func (a ActionRow) String() string { + return fmt.Sprintf("Accept=%d, Ignore=%s", a.Accept, a.Ignore) +} + +var ActTab = ActionTable{ + ActionRow{ // S0, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S1, Ignore("!whitespace") + Accept: -1, + Ignore: "!whitespace", + }, + ActionRow{ // S2, Accept("Λ<;>") + Accept: 2, + Ignore: "", + }, + ActionRow{ // S3, Accept("Λ<=>") + Accept: 6, + Ignore: "", + }, + ActionRow{ // S4, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S5, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S6, Accept("id") + Accept: 5, + Ignore: "", + }, + ActionRow{ // S7, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S8, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S9, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S10, Accept("id") + Accept: 5, + Ignore: "", + }, + ActionRow{ // S11, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S12, Accept("id") + Accept: 5, + Ignore: "", + }, + ActionRow{ // S13, Accept("id") + Accept: 5, + Ignore: "", + }, + ActionRow{ // S14, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S15, Accept("Λ") + Accept: 3, + Ignore: "", + }, + ActionRow{ // S16, Accept("id") + Accept: 5, + Ignore: "", + }, + ActionRow{ // S17, Accept("id") + Accept: 5, + Ignore: "", + }, + ActionRow{ // S18, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S19, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S20, Accept("id") + Accept: 5, + Ignore: "", + }, + ActionRow{ // S21, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S22, Accept("Λ") + Accept: 4, + Ignore: "", + }, +} diff --git a/example/macro/macro1.grammar/macro1/internal/lexer/lexer.go b/example/macro/macro1.grammar/macro1/internal/lexer/lexer.go new file mode 100644 index 00000000..19bb91be --- /dev/null +++ b/example/macro/macro1.grammar/macro1/internal/lexer/lexer.go @@ -0,0 +1,174 @@ +// Code generated by gocc; DO NOT EDIT. + +package lexer + +import ( + + "io" + "bytes" + "os" + + + "github.com/maxcalandrelli/gocc/example/macro/macro1.grammar/macro1/iface" + "github.com/maxcalandrelli/gocc/example/macro/macro1.grammar/macro1/internal/token" + "github.com/maxcalandrelli/gocc/example/macro/macro1.grammar/macro1/internal/io/stream" +) + +const ( + NoState = -1 + NumStates = 23 + NumSymbols = 29 + INVALID_RUNE = rune(-1) +) + +type position struct { + token.Pos +} + +type Lexer struct { + position + stream iface.TokenStream + eof bool +} + +func NewLexerBytes(src []byte) *Lexer { + lexer := &Lexer{stream: bytes.NewReader(src)} + lexer.reset() + return lexer +} + +func NewLexerString(src string) *Lexer { + return NewLexerBytes([]byte(src)) +} + +func NewLexerFile(fpath string) (*Lexer, error) { + s, err := os.Open(fpath) + if err != nil { + return nil, err + } + lexer := &Lexer{stream: stream.NewWindowReader(s)} + lexer.reset() + return lexer, nil +} + +func NewLexer(reader io.Reader) (*Lexer, error) { + lexer := &Lexer{} + lexer.reset() + if lexer.stream, _ = reader.(iface.TokenStream); lexer.stream == nil { + lexer.stream = stream.NewWindowReader(reader) + } + return lexer, nil +} + +func (l *Lexer) reset () { + l.position.Reset() +} + +func (l Lexer) GetStream() iface.TokenStream { + return l.stream +} + +type checkPoint int64 + +func (c checkPoint) value () int64 { + return int64(c) +} + +func (c checkPoint) DistanceFrom (o iface.CheckPoint) int { + return int (c.value() - o.(checkPoint).value()) +} + +func (c checkPoint) Advance (o int) iface.CheckPoint { + return checkPoint(c.value() + int64(o)) +} + +func (l *Lexer) GetCheckPoint() iface.CheckPoint { + if l == nil { + return checkPoint(0) + } + pos, _ := l.stream.Seek(0, io.SeekCurrent) + return checkPoint(pos) +} + +func (l Lexer) GotoCheckPoint(cp iface.CheckPoint) { + l.stream.Seek(int64(cp.(checkPoint)), io.SeekStart) +} + +func (l *Lexer) Scan() (tok *token.Token) { + tok = new(token.Token) + tok.Type = token.INVALID + start := l.position + state := 0 + for state != -1 { + savePos := l.position.Pos + curr, size, err := l.stream.ReadRune() + if size < 1 || err != nil { + curr = INVALID_RUNE + } + if size > 0 { + l.position.Pos.Offset += size + } + nextState := -1 + if curr != INVALID_RUNE { + nextState = TransTab[state](curr) + } + state = nextState + if state != -1 { + switch curr { + case '\n': + l.position.Pos.Line++ + l.position.Pos.Column = 1 + case '\r': + l.position.Pos.Column = 1 + case '\t': + l.position.Pos.Column += 4 + default: + l.position.Pos.Column++ + } + switch { + case ActTab[state].Accept != -1: + tok.Type = ActTab[state].Accept + tok.Lit = append(tok.Lit, string(curr)...) + case ActTab[state].Ignore != "": + start = l.position + state = 0 + tok.Lit = []byte{} + tok.IgnoredPrefix=append(tok.IgnoredPrefix,string(curr)...) + } + } else if curr != INVALID_RUNE{ + if len(tok.Lit) == 0 { + tok.Lit = append(tok.Lit, string(curr)...) + } else { + l.stream.UnreadRune() + l.position.Pos = savePos + } + } + if err == io.EOF && len(tok.Lit)==0 { + tok.Type = token.EOF + tok.Pos = start.Pos + return + } + } + tok.Pos = start.Pos + return +} + +func (l *Lexer) Reset() { + l.position.Reset() +} + +func (l Lexer) CurrentPosition() position { + return l.position +} + +func (p *position) Reset() { + p.Offset = 0 + p.Line = 1 + p.Column = 1 +} + +func (p position) StartingFrom(base position) position { + r := p + r.Pos = p.Pos.StartingFrom(base.Pos) + return r +} diff --git a/example/macro/macro1.grammar/macro1/internal/lexer/transitiontable.go b/example/macro/macro1.grammar/macro1/internal/lexer/transitiontable.go new file mode 100644 index 00000000..c5b6686a --- /dev/null +++ b/example/macro/macro1.grammar/macro1/internal/lexer/transitiontable.go @@ -0,0 +1,239 @@ +// Code generated by gocc; DO NOT EDIT. + +package lexer + +/* +Let s be the current state +Let r be the current input rune +transitionTable[s](r) returns the next state. +*/ +type TransitionTable [NumStates]func(rune) int + +var TransTab = TransitionTable{ + // S0 + func(r rune) int { + switch { + case r == 9: // ['\t','\t'] + return 1 + case r == 10: // ['\n','\n'] + return 1 + case r == 13: // ['\r','\r'] + return 1 + case r == 32: // [' ',' '] + return 1 + case r == 59: // [';',';'] + return 2 + case r == 61: // ['=','='] + return 3 + case r == 100: // ['d','d'] + return 4 + case r == 108: // ['l','l'] + return 5 + case r == 945: // [\u03b1,\u03b1] + return 6 + case r == 946: // [\u03b2,\u03b2] + return 7 + } + return NoState + }, + // S1 + func(r rune) int { + switch { + } + return NoState + }, + // S2 + func(r rune) int { + switch { + } + return NoState + }, + // S3 + func(r rune) int { + switch { + } + return NoState + }, + // S4 + func(r rune) int { + switch { + case r == 101: // ['e','e'] + return 8 + } + return NoState + }, + // S5 + func(r rune) int { + switch { + case r == 101: // ['e','e'] + return 9 + } + return NoState + }, + // S6 + func(r rune) int { + switch { + case r == 945: // [\u03b1,\u03b1] + return 10 + case r == 946: // [\u03b2,\u03b2] + return 11 + case r == 947: // [\u03b3,\u03b3] + return 12 + } + return NoState + }, + // S7 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 13 + } + return NoState + }, + // S8 + func(r rune) int { + switch { + case r == 102: // ['f','f'] + return 14 + } + return NoState + }, + // S9 + func(r rune) int { + switch { + case r == 116: // ['t','t'] + return 15 + } + return NoState + }, + // S10 + func(r rune) int { + switch { + case r == 945: // [\u03b1,\u03b1] + return 10 + case r == 946: // [\u03b2,\u03b2] + return 11 + case r == 947: // [\u03b3,\u03b3] + return 12 + } + return NoState + }, + // S11 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 16 + } + return NoState + }, + // S12 + func(r rune) int { + switch { + case r == 945: // [\u03b1,\u03b1] + return 10 + case r == 946: // [\u03b2,\u03b2] + return 11 + case r == 947: // [\u03b3,\u03b3] + return 12 + } + return NoState + }, + // S13 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 13 + case r == 945: // [\u03b1,\u03b1] + return 17 + case r == 946: // [\u03b2,\u03b2] + return 18 + case r == 947: // [\u03b3,\u03b3] + return 12 + } + return NoState + }, + // S14 + func(r rune) int { + switch { + case r == 105: // ['i','i'] + return 19 + } + return NoState + }, + // S15 + func(r rune) int { + switch { + } + return NoState + }, + // S16 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 16 + case r == 945: // [\u03b1,\u03b1] + return 10 + case r == 946: // [\u03b2,\u03b2] + return 11 + case r == 947: // [\u03b3,\u03b3] + return 12 + } + return NoState + }, + // S17 + func(r rune) int { + switch { + case r == 945: // [\u03b1,\u03b1] + return 10 + case r == 946: // [\u03b2,\u03b2] + return 11 + case r == 947: // [\u03b3,\u03b3] + return 12 + } + return NoState + }, + // S18 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 20 + } + return NoState + }, + // S19 + func(r rune) int { + switch { + case r == 110: // ['n','n'] + return 21 + } + return NoState + }, + // S20 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 20 + case r == 945: // [\u03b1,\u03b1] + return 17 + case r == 946: // [\u03b2,\u03b2] + return 18 + case r == 947: // [\u03b3,\u03b3] + return 12 + } + return NoState + }, + // S21 + func(r rune) int { + switch { + case r == 101: // ['e','e'] + return 22 + } + return NoState + }, + // S22 + func(r rune) int { + switch { + } + return NoState + }, +} diff --git a/example/macro/macro1.grammar/macro1/internal/parser/action.go b/example/macro/macro1.grammar/macro1/internal/parser/action.go new file mode 100644 index 00000000..54bc55e9 --- /dev/null +++ b/example/macro/macro1.grammar/macro1/internal/parser/action.go @@ -0,0 +1,51 @@ +// Code generated by gocc; DO NOT EDIT. + +package parser + +import ( + "fmt" +) + +type action interface { + act() + String() string +} + +type ( + accept bool + shift int // value is next state index + reduce int // value is production index +) + +func (this accept) act() {} +func (this shift) act() {} +func (this reduce) act() {} + +func (this accept) Equal(that action) bool { + if _, ok := that.(accept); ok { + return true + } + return false +} + +func (this reduce) Equal(that action) bool { + that1, ok := that.(reduce) + if !ok { + return false + } + return this == that1 +} + +func (this shift) Equal(that action) bool { + that1, ok := that.(shift) + if !ok { + return false + } + return this == that1 +} + +func (this accept) String() string { return "accept(0)" } +func (this shift) String() string { return fmt.Sprintf("shift:%d", this) } +func (this reduce) String() string { + return fmt.Sprintf("reduce:%d(%s)", this, productionsTable[this].String) +} diff --git a/example/macro/macro1.grammar/macro1/internal/parser/actiontable.go b/example/macro/macro1.grammar/macro1/internal/parser/actiontable.go new file mode 100644 index 00000000..5cf42646 --- /dev/null +++ b/example/macro/macro1.grammar/macro1/internal/parser/actiontable.go @@ -0,0 +1,195 @@ +// Code generated by gocc; DO NOT EDIT. + +package parser + +type ( + actionTable [numStates]actionRow + cdFunc func(TokenStream, interface{}) (interface{}, error, []byte) + cdAction struct { + tokenIndex int + tokenScanner cdFunc + } + actionRow struct { + canRecover bool + actions [numSymbols]action + cdActions []cdAction + } + actions struct { + table actionTable + } +) + +var parserActions = actions{ + table: actionTable{ + actionRow{ // S0 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // ";" + shift(5), // "let" + shift(6), // "define" + nil, // id + nil, // "=" + nil, // μ + }, + cdActions: []cdAction{}, + }, + actionRow{ // S1 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + accept(true), // Ω + nil, // ";" + nil, // "let" + nil, // "define" + nil, // id + nil, // "=" + nil, // μ + }, + cdActions: []cdAction{}, + }, + actionRow{ // S2 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(1), // Ω, reduce: StmtList + shift(7), // ";" + nil, // "let" + nil, // "define" + nil, // id + nil, // "=" + nil, // μ + }, + cdActions: []cdAction{}, + }, + actionRow{ // S3 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(2), // Ω, reduce: Stmt_s + reduce(2), // ";", reduce: Stmt_s + nil, // "let" + nil, // "define" + nil, // id + nil, // "=" + nil, // μ + }, + cdActions: []cdAction{}, + }, + actionRow{ // S4 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // ";" + nil, // "let" + nil, // "define" + shift(8), // id + nil, // "=" + nil, // μ + }, + cdActions: []cdAction{}, + }, + actionRow{ // S5 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // ";" + nil, // "let" + nil, // "define" + reduce(4), // id, reduce: StmtPref + nil, // "=" + nil, // μ + }, + cdActions: []cdAction{}, + }, + actionRow{ // S6 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // ";" + nil, // "let" + nil, // "define" + reduce(5), // id, reduce: StmtPref + nil, // "=" + nil, // μ + }, + cdActions: []cdAction{}, + }, + actionRow{ // S7 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // ";" + shift(5), // "let" + shift(6), // "define" + nil, // id + nil, // "=" + nil, // μ + }, + cdActions: []cdAction{}, + }, + actionRow{ // S8 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // ";" + nil, // "let" + nil, // "define" + nil, // id + shift(10), // "=" + nil, // μ + }, + cdActions: []cdAction{}, + }, + actionRow{ // S9 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(3), // Ω, reduce: Stmt_s + reduce(3), // ";", reduce: Stmt_s + nil, // "let" + nil, // "define" + nil, // id + nil, // "=" + nil, // μ + }, + cdActions: []cdAction{}, + }, + actionRow{ // S10 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // ";" + nil, // "let" + nil, // "define" + nil, // id + nil, // "=" + shift(11), // μ + }, + cdActions: []cdAction{ + cdAction{tokenIndex: 7, tokenScanner: cdFunc_calc_0}, + }, + }, + actionRow{ // S11 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(6), // Ω, reduce: Stmt + reduce(6), // ";", reduce: Stmt + nil, // "let" + nil, // "define" + nil, // id + nil, // "=" + nil, // μ + }, + cdActions: []cdAction{}, + }, + }, +} diff --git a/example/macro/macro1.grammar/macro1/internal/parser/gototable.go b/example/macro/macro1.grammar/macro1/internal/parser/gototable.go new file mode 100644 index 00000000..bb84cbfe --- /dev/null +++ b/example/macro/macro1.grammar/macro1/internal/parser/gototable.go @@ -0,0 +1,97 @@ +// Code generated by gocc; DO NOT EDIT. + +package parser + +const numNTSymbols = 5 + +type ( + gotoTable [numStates]gotoRow + gotoRow [numNTSymbols]int +) + +var gotoTab = gotoTable{ + gotoRow{ // S0 + -1, // Π + 1, // Π + 2, // Π + 3, // Π + 4, // Π + }, + gotoRow{ // S1 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S2 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S3 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S4 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S5 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S6 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S7 + -1, // Π + -1, // Π + -1, // Π + 9, // Π + 4, // Π + }, + gotoRow{ // S8 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S9 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S10 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S11 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, +} diff --git a/example/macro/macro1.grammar/macro1/internal/parser/parser.go b/example/macro/macro1.grammar/macro1/internal/parser/parser.go new file mode 100644 index 00000000..a629f54c --- /dev/null +++ b/example/macro/macro1.grammar/macro1/internal/parser/parser.go @@ -0,0 +1,359 @@ +// Code generated by gocc; DO NOT EDIT. + +package parser + +import ( + "errors" + "fmt" + "strings" + + "github.com/maxcalandrelli/gocc/example/macro/macro1.grammar/macro1/iface" + parseError "github.com/maxcalandrelli/gocc/example/macro/macro1.grammar/macro1/internal/errors" + "github.com/maxcalandrelli/gocc/example/macro/macro1.grammar/macro1/internal/token" + + calc "github.com/maxcalandrelli/gocc/example/calc/calc.grammar/calc" +) + +const ( + numProductions = 7 + numStates = 12 + numSymbols = 13 +) + +// Stack + +type stack struct { + state []int + attrib []Attrib +} + +const INITIAL_STACK_SIZE = 100 + +func newStack() *stack { + return &stack{ + state: make([]int, 0, INITIAL_STACK_SIZE), + attrib: make([]Attrib, 0, INITIAL_STACK_SIZE), + } +} + +func (s *stack) reset() { + s.state = s.state[:0] + s.attrib = s.attrib[:0] +} + +func (s *stack) push(state int, a Attrib) { + s.state = append(s.state, state) + s.attrib = append(s.attrib, a) +} + +func (s *stack) top() int { + return s.state[len(s.state)-1] +} + +func (s *stack) peek(pos int) int { + return s.state[pos] +} + +func (s *stack) topIndex() int { + return len(s.state) - 1 +} + +func (s *stack) popN(items int) []Attrib { + lo, hi := len(s.state)-items, len(s.state) + + attrib := s.attrib[lo:hi] + + s.state = s.state[:lo] + s.attrib = s.attrib[:lo] + + return attrib +} + +func (s *stack) String() string { + w := new(strings.Builder) + fmt.Fprintf(w, "stack:\n") + for i, st := range s.state { + fmt.Fprintf(w, "\t%d: %d , ", i, st) + if s.attrib[i] == nil { + fmt.Fprintf(w, "nil") + } else { + switch attr := s.attrib[i].(type) { + case *token.Token: + fmt.Fprintf(w, "%s", attr.Lit) + default: + fmt.Fprintf(w, "%v", attr) + } + } + fmt.Fprintf(w, "\n") + } + return w.String() +} + +// Parser + +type Parser struct { + stack *stack + nextToken *token.Token + userContext interface{} + + // + // Working data, should be method parameters/locals + // but putting them here simplifies a bit the code + // Useful only for longest prefix partial parsing + // + needsRepositioning bool + isNonDeterministic bool + tokens iface.CheckPointable + afterPos iface.CheckPoint + checkPoint iface.CheckPoint + underlyingStream iface.TokenStream +} + +type TokenStream = iface.TokenStream + +type ( + fakeCp struct{} + fakeCheckPointable struct{} +) + +func (f fakeCheckPointable) GetCheckPoint() iface.CheckPoint { + return fakeCp{} +} + +func (f fakeCp) DistanceFrom(o iface.CheckPoint) int { + return 0 +} + +func (f fakeCp) Advance(o int) iface.CheckPoint { + return fakeCp{} +} + +func (f fakeCheckPointable) GotoCheckPoint(iface.CheckPoint) {} + +func cdFunc_calc_0(Stream TokenStream, Context interface{}) (interface{}, error, []byte) { + return calc.ParseWithDataPartial(Stream, Context) +} + +func NewParser() *Parser { + return NewParserWithContext(nil) +} + +func NewParserWithContext(u interface{}) *Parser { + p := &Parser{stack: newStack(), userContext: u} + p.Reset() + return p +} + +func (p *Parser) Reset() { + p.stack.reset() + p.stack.push(0, nil) +} + +func (p *Parser) SetContext(ctx interface{}) *Parser { + p.userContext = ctx + return p +} + +func (p Parser) GetContext() interface{} { + return p.userContext +} + +func (p *Parser) Error(err error, scanner iface.Scanner) (recovered bool, errorAttrib *parseError.Error) { + errorAttrib = &parseError.Error{ + Err: err, + ErrorToken: p.nextToken, + ErrorSymbols: p.popNonRecoveryStates(), + ExpectedTokens: make([]string, 0, 8), + } + for t, action := range parserActions.table[p.stack.top()].actions { + if action != nil { + errorAttrib.ExpectedTokens = append(errorAttrib.ExpectedTokens, token.TokMap.Id(token.Type(t))) + } + } + + if action := parserActions.table[p.stack.top()].actions[token.TokMap.Type("λ")]; action != nil { + p.stack.push(int(action.(shift)), errorAttrib) // action can only be shift + } else { + return + } + + if action := parserActions.table[p.stack.top()].actions[p.nextToken.Type]; action != nil { + recovered = true + } + for !recovered && p.nextToken.Type != token.EOF { + p.nextToken = scanner.Scan() + if action := parserActions.table[p.stack.top()].actions[p.nextToken.Type]; action != nil { + recovered = true + } + } + + return +} + +func (p *Parser) popNonRecoveryStates() (removedAttribs []parseError.ErrorSymbol) { + if rs, ok := p.firstRecoveryState(); ok { + errorSymbols := p.stack.popN(p.stack.topIndex() - rs) + removedAttribs = make([]parseError.ErrorSymbol, len(errorSymbols)) + for i, e := range errorSymbols { + removedAttribs[i] = e + } + } else { + removedAttribs = []parseError.ErrorSymbol{} + } + return +} + +// recoveryState points to the highest state on the stack, which can recover +func (p *Parser) firstRecoveryState() (recoveryState int, canRecover bool) { + recoveryState, canRecover = p.stack.topIndex(), parserActions.table[p.stack.top()].canRecover + for recoveryState > 0 && !canRecover { + recoveryState-- + canRecover = parserActions.table[p.stack.peek(recoveryState)].canRecover + } + return +} + +func (p *Parser) newError(err error) error { + e := &parseError.Error{ + Err: err, + StackTop: p.stack.top(), + ErrorToken: p.nextToken, + } + actRow := parserActions.table[p.stack.top()] + for i, t := range actRow.actions { + if t != nil { + e.ExpectedTokens = append(e.ExpectedTokens, token.TokMap.Id(token.Type(i))) + } + } + return e +} + +func (p *Parser) prepareParsing(scanner iface.Scanner, longest bool) error { + p.Reset() + p.needsRepositioning = true + p.isNonDeterministic = true + if p.needsRepositioning { + if streamScanner, _ := scanner.(iface.StreamScanner); streamScanner != nil { + p.underlyingStream = streamScanner.GetStream() + } + if p.tokens, _ = scanner.(iface.CheckPointable); p.tokens == nil || p.underlyingStream == nil { + return errNotRepositionable + } + } else { + if p.tokens, _ = scanner.(iface.CheckPointable); p.tokens == nil { + p.tokens = fakeCheckPointable{} + } + } + return nil +} + +func (p *Parser) Parse(scanner iface.Scanner) (res interface{}, err error) { + if err := p.prepareParsing(scanner, false); err != nil { + return nil, err + } + return p.parse(scanner, false) +} + +func (p *Parser) ParseLongestPrefix(scanner iface.Scanner) (res interface{}, err error, parsed []byte) { + if err := p.prepareParsing(scanner, true); err != nil { + return nil, err, []byte{} + } + startPoint := p.tokens.GetCheckPoint() + res, err = p.parse(scanner, true) + if err == nil { + currPoint := p.tokens.GetCheckPoint() + p.tokens.GotoCheckPoint(startPoint) + parsed = make([]byte, currPoint.DistanceFrom(startPoint)) + p.underlyingStream.Read(parsed) + p.tokens.GotoCheckPoint(currPoint) + } + return +} + +var errNotRepositionable = errors.New("scanner not repositionable") + +func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, err error) { + readNextToken := func() { + p.checkPoint = p.tokens.GetCheckPoint() + p.nextToken = scanner.Scan() + p.afterPos = p.tokens.GetCheckPoint() + return + } + readNextToken() + for acc := false; !acc; { + action := parserActions.table[p.stack.top()].actions[p.nextToken.Type] + if action == nil && p.isNonDeterministic { + // + // If no action, check if we have some context dependent parsing to try + // + p.checkPoint = p.checkPoint.Advance(len(p.nextToken.IgnoredPrefix)) + for _, cdAction := range parserActions.table[p.stack.top()].cdActions { + p.tokens.GotoCheckPoint(p.checkPoint) + cd_res, cd_err, cd_parsed := cdAction.tokenScanner(p.underlyingStream, p.userContext) + if cd_err == nil && len(cd_parsed) > 0 { + action = parserActions.table[p.stack.top()].actions[cdAction.tokenIndex] + if action != nil { + p.nextToken.Foreign = true + p.nextToken.ForeignAstNode = cd_res + p.nextToken.Lit = cd_parsed + p.nextToken.Type = token.Type(cdAction.tokenIndex) + break + } + } + } + } + // + // Still no action? If a longest possible parsing is requested in place + // of a full text, we should try to check if an EOF here would have led + // to a successful parsing instead + // Rember that token.EOF is 1, that is the index of SyntaxEof into symbol table + // Dirty, dirty, dirty... but I found it as it is, and I prefer not to touch + // + if action == nil && longest { + p.tokens.GotoCheckPoint(p.checkPoint) + action = parserActions.table[p.stack.top()].actions[token.EOF] + if action == nil { + // + // ok, let's consume the token then + // + p.tokens.GotoCheckPoint(p.afterPos) + } + } + + // + // Well, no action is no action after all... + // + if action == nil { + if recovered, errAttrib := p.Error(nil, scanner); !recovered { + p.nextToken = errAttrib.ErrorToken + return nil, p.newError(nil) + } + if action = parserActions.table[p.stack.top()].actions[p.nextToken.Type]; action == nil { + panic("Error recovery led to invalid action") + } + } + + switch act := action.(type) { + case accept: + res = p.stack.popN(1)[0] + acc = true + case shift: + p.stack.push(int(act), p.nextToken) + if p.nextToken.Foreign { + p.stack.push(int(act), p.nextToken.ForeignAstNode) + } + readNextToken() + case reduce: + prod := productionsTable[int(act)] + attrib, err := prod.ReduceFunc(p.userContext, p.stack.popN(prod.NumSymbols)) + if err != nil { + return nil, p.newError(err) + } else { + p.stack.push(gotoTab[p.stack.top()][prod.NTType], attrib) + } + default: + panic("unknown action: " + action.String()) + } + } + return res, nil +} diff --git a/example/macro/macro1.grammar/macro1/internal/parser/productionstable.go b/example/macro/macro1.grammar/macro1/internal/parser/productionstable.go new file mode 100644 index 00000000..c49ed063 --- /dev/null +++ b/example/macro/macro1.grammar/macro1/internal/parser/productionstable.go @@ -0,0 +1,141 @@ +// Code generated by gocc; DO NOT EDIT. + +package parser + +import ( + "fmt" + "github.com/maxcalandrelli/gocc/example/macro/macro1.grammar/macro1/internal/token" + "github.com/maxcalandrelli/gocc/example/macro/macro1.grammar/macro1/internal/util" + "strings" +) + +func first_one(x string) []string { + fmt.Printf("start with this this one: %s\n", x) + return []string{x} +} +func add_one(c []string, x string) []string { + fmt.Printf("add to %q that %s\n", c, x) + return append([]string{x}, c...) +} +func summary(v interface{}) string { + return fmt.Sprintf("ok, so we got <%q> as a final result.\n", v) +} +func definition(deftype, defname string, defval int64) (interface{}, error) { + fmt.Printf("Definition of variable <%s> with '%s' as %d\n", defname, deftype, defval) + return fmt.Sprintf("%s <- %d", defname, defval), nil +} + +func getString(X Attrib) string { + switch X.(type) { + case *token.Token: + return string(X.(*token.Token).Lit) + case string: + return X.(string) + } + return fmt.Sprintf("%q", X) +} + +func unescape(s string) string { + return util.EscapedString(s).Unescape() +} + +func unquote(s string) string { + r, _, _ := util.EscapedString(s).Unquote() + return r +} + +func lc(s string) string { + return strings.ToLower(s) +} + +func uc(s string) string { + return strings.ToUpper(s) +} + +type ( + //TODO: change type and variable names to be consistent with other tables + ProdTab [numProductions]ProdTabEntry + ProdTabEntry struct { + String string + Id string + NTType int + Index int + NumSymbols int + ReduceFunc func(interface{}, []Attrib) (Attrib, error) + } + Attrib interface { + } +) + +var productionsTable = ProdTab{ + ProdTabEntry{ + String: `S' : Π << >>`, + Id: "S'", + NTType: 0, + Index: 0, + NumSymbols: 1, + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { + return X[0], nil + }, + }, + ProdTabEntry{ + String: `StmtList : Π << func() (interface{}, error) {fmt.Printf("%s", summary($0)); return 42, nil}() >>`, + Id: "StmtList", + NTType: 1, + Index: 1, + NumSymbols: 1, + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { + return func() (interface{}, error) { fmt.Printf("%s", summary(X[0])); return 42, nil }() + }, + }, + ProdTabEntry{ + String: `Stmt_s : Π << first_one($0.(string)),nil >>`, + Id: "Stmt_s", + NTType: 2, + Index: 2, + NumSymbols: 1, + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { + return first_one(X[0].(string)), nil + }, + }, + ProdTabEntry{ + String: `Stmt_s : Π Λ<;> Π << add_one($0.([]string),$2.(string)),nil >>`, + Id: "Stmt_s", + NTType: 2, + Index: 3, + NumSymbols: 3, + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { + return add_one(X[0].([]string), X[2].(string)), nil + }, + }, + ProdTabEntry{ + String: `StmtPref : Λ << >>`, + Id: "StmtPref", + NTType: 4, + Index: 4, + NumSymbols: 1, + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { + return X[0], nil + }, + }, + ProdTabEntry{ + String: `StmtPref : Λ << >>`, + Id: "StmtPref", + NTType: 4, + Index: 5, + NumSymbols: 1, + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { + return X[0], nil + }, + }, + ProdTabEntry{ + String: `Stmt : Π id Λ<=> μ << definition($0s,$1s,$4.(int64)) >>`, + Id: "Stmt", + NTType: 3, + Index: 6, + NumSymbols: 5, + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { + return definition(getString(X[0]), getString(X[1]), X[4].(int64)) + }, + }, +} diff --git a/example/macro/macro1.grammar/macro1/internal/token/token.go b/example/macro/macro1.grammar/macro1/internal/token/token.go new file mode 100644 index 00000000..bd4fc7cf --- /dev/null +++ b/example/macro/macro1.grammar/macro1/internal/token/token.go @@ -0,0 +1,166 @@ +// Code generated by gocc; DO NOT EDIT. + +package token + +import ( + "fmt" + "strconv" + "unicode/utf8" +) + +type Token struct { + Type + Lit []byte + IgnoredPrefix []byte + Pos + ForeignAstNode interface{} + Foreign bool +} + +type Type int + +const ( + INVALID Type = iota + EOF +) + +type Pos struct { + Offset int + Line int + Column int +} + +func (p Pos) String() string { + return fmt.Sprintf("Pos(offset=%d, line=%d, column=%d)", p.Offset, p.Line, p.Column) +} + +func (p Pos) StartingFrom(base Pos) Pos { + r := base + r.Offset += p.Offset + r.Line += p.Line + r.Column = p.Column + if p.Line > 0 && base.Line > 0 { + r.Line-- + } + if r.Column < 1 { + r.Column = 1 + } + return r +} + +type TokenMap struct { + typeMap []string + idMap map[string]Type + litMap map[string]Type +} + +func (m TokenMap) Id(tok Type) string { + if int(tok) < len(m.typeMap) { + return m.typeMap[tok] + } + return "unknown" +} + +func (m TokenMap) Type(tok string) Type { + if typ, exist := m.idMap[tok]; exist { + return typ + } + return INVALID +} + +func (m TokenMap) TokenString(tok *Token) string { + return fmt.Sprintf("%s(%d,<%s>)", m.Id(tok.Type), tok.Type, tok.Lit) +} + +func (m TokenMap) StringType(typ Type) string { + return fmt.Sprintf("%s(%d)", m.Id(typ), typ) +} + +// CharLiteralValue returns the string value of the char literal. +func (t *Token) CharLiteralValue() string { + return string(t.Lit[1 : len(t.Lit)-1]) +} + +// Float32Value returns the float32 value of the token or an error if the token literal does not +// denote a valid float32. +func (t *Token) Float32Value() (float32, error) { + if v, err := strconv.ParseFloat(string(t.Lit), 32); err != nil { + return 0, err + } else { + return float32(v), nil + } +} + +// Float64Value returns the float64 value of the token or an error if the token literal does not +// denote a valid float64. +func (t *Token) Float64Value() (float64, error) { + return strconv.ParseFloat(string(t.Lit), 64) +} + +// IDValue returns the string representation of an identifier token. +func (t *Token) IDValue() string { + return string(t.Lit) +} + +// Int32Value returns the int32 value of the token or an error if the token literal does not +// denote a valid float64. +func (t *Token) Int32Value() (int32, error) { + if v, err := strconv.ParseInt(string(t.Lit), 10, 64); err != nil { + return 0, err + } else { + return int32(v), nil + } +} + +// Int64Value returns the int64 value of the token or an error if the token literal does not +// denote a valid float64. +func (t *Token) Int64Value() (int64, error) { + return strconv.ParseInt(string(t.Lit), 10, 64) +} + +// UTF8Rune decodes the UTF8 rune in the token literal. It returns utf8.RuneError if +// the token literal contains an invalid rune. +func (t *Token) UTF8Rune() (rune, error) { + r, _ := utf8.DecodeRune(t.Lit) + if r == utf8.RuneError { + err := fmt.Errorf("Invalid rune") + return r, err + } + return r, nil +} + +// StringValue returns the string value of the token literal. +func (t *Token) StringValue() string { + return string(t.Lit[1 : len(t.Lit)-1]) +} + +var TokMap = TokenMap{ + typeMap: []string{ + "INVALID", + "Ω", + "Λ<;>", + "Λ", + "Λ", + "id", + "Λ<=>", + "μ", + }, + + idMap: map[string]Type{ + "INVALID": 0, + "Ω": 1, + "Λ<;>": 2, + "Λ": 3, + "Λ": 4, + "id": 5, + "Λ<=>": 6, + "μ": 7, + }, + + litMap: map[string]Type{ + ";": 2, + "let": 3, + "define": 4, + "=": 6, + }, +} diff --git a/example/macro/macro1.grammar/macro1/internal/util/litconv.go b/example/macro/macro1.grammar/macro1/internal/util/litconv.go new file mode 100644 index 00000000..1aeb6166 --- /dev/null +++ b/example/macro/macro1.grammar/macro1/internal/util/litconv.go @@ -0,0 +1,108 @@ +// Code generated by gocc; DO NOT EDIT. + +package util + +import ( + "fmt" + "strconv" + "unicode" + "unicode/utf8" +) + +/* Interface */ + +/* +Convert the literal value of a scanned token to rune +*/ +func RuneValue(lit []byte) rune { + if lit[1] == '\\' { + return escapeCharVal(lit) + } + r, size := utf8.DecodeRune(lit[1:]) + if size != len(lit)-2 { + panic(fmt.Sprintf("Error decoding rune. Lit: %s, rune: %d, size%d\n", lit, r, size)) + } + return r +} + +/* +Convert the literal value of a scanned token to int64 +*/ +func IntValue(lit []byte) (int64, error) { + return strconv.ParseInt(string(lit), 10, 64) +} + +/* +Convert the literal value of a scanned token to uint64 +*/ +func UintValue(lit []byte) (uint64, error) { + return strconv.ParseUint(string(lit), 10, 64) +} + +/* Util */ + +func escapeCharVal(lit []byte) rune { + var i, base, max uint32 + offset := 2 + switch lit[offset] { + case 'a': + return '\a' + case 'b': + return '\b' + case 'f': + return '\f' + case 'n': + return '\n' + case 'r': + return '\r' + case 't': + return '\t' + case 'v': + return '\v' + case '\\': + return '\\' + case '\'': + return '\'' + case '0', '1', '2', '3', '4', '5', '6', '7': + i, base, max = 3, 8, 255 + case 'x': + i, base, max = 2, 16, 255 + offset++ + case 'u': + i, base, max = 4, 16, unicode.MaxRune + offset++ + case 'U': + i, base, max = 8, 16, unicode.MaxRune + offset++ + default: + panic(fmt.Sprintf("Error decoding character literal: %s\n", lit)) + } + + var x uint32 + for ; i > 0 && offset < len(lit)-1; i-- { + ch, size := utf8.DecodeRune(lit[offset:]) + offset += size + d := uint32(digitVal(ch)) + if d >= base { + panic(fmt.Sprintf("charVal(%s): illegal character (%c) in escape sequence. size=%d, offset=%d", lit, ch, size, offset)) + } + x = x*base + d + } + if x > max || 0xD800 <= x && x < 0xE000 { + panic(fmt.Sprintf("Error decoding escape char value. Lit:%s, offset:%d, escape sequence is invalid Unicode code point\n", lit, offset)) + } + + return rune(x) +} + +func digitVal(ch rune) int { + switch { + case '0' <= ch && ch <= '9': + return int(ch) - '0' + case 'a' <= ch && ch <= 'f': + return int(ch) - 'a' + 10 + case 'A' <= ch && ch <= 'F': + return int(ch) - 'A' + 10 + } + return 16 // larger than any legal digit val +} diff --git a/example/macro/macro1.grammar/macro1/internal/util/rune.go b/example/macro/macro1.grammar/macro1/internal/util/rune.go new file mode 100644 index 00000000..788edfde --- /dev/null +++ b/example/macro/macro1.grammar/macro1/internal/util/rune.go @@ -0,0 +1,140 @@ +// Code generated by gocc; DO NOT EDIT. + + +package util + +import ( + "fmt" + "unicode" + "unicode/utf8" +) + +func RuneToString(r rune) string { + if r >= 0x20 && r < 0x7f { + return fmt.Sprintf("'%c'", r) + } + switch r { + case 0x07: + return "'\\a'" + case 0x08: + return "'\\b'" + case 0x0C: + return "'\\f'" + case 0x0A: + return "'\\n'" + case 0x0D: + return "'\\r'" + case 0x09: + return "'\\t'" + case 0x0b: + return "'\\v'" + case 0x5c: + return "'\\\\\\'" + case 0x27: + return "'\\''" + case 0x22: + return "'\\\"'" + } + if r < 0x10000 { + return fmt.Sprintf("\\u%04x", r) + } + return fmt.Sprintf("\\U%08x", r) +} + +type EscapedString string + +func (str EscapedString) Unquote() (unquoted string, wasQuoted bool, quoteType rune) { + if len(str) > 1 { + r := str[0] + if (r == '"' || r == '\x60' || r == '\'') && r == str[len(str)-1] { + str = str[1 : len(str)-1] + } + return string(str), true, rune(r) + } + return string(str), false, 0 +} + +func (str EscapedString) Unescape() string { + var ( + res string + r rune + size int + ) + for s := 0; s < len(str); s += size { + if str[s] == '\\' { + r, size = str[s+1:].EscapedFirstCharValue() + size++ + } else { + r, size = utf8.DecodeRuneInString(string(str)[s:]) + } + res += string(r) + } + return res +} + +func (str EscapedString) EscapedFirstCharValue() (rune, int) { + var i, base, max uint32 + offset := 0 + switch str[offset] { + case '\'', '"': + return rune(str[offset]), 1 + case 'a': + return '\a', 1 + case 'b': + return '\b', 1 + case 'f': + return '\f', 1 + case 'n': + return '\n', 1 + case 'r': + return '\r', 1 + case 't': + return '\t', 1 + case 'v': + return '\v', 1 + case '\\': + return '\\', 1 + case '0', '1', '2', '3', '4', '5', '6', '7': + i, base, max = 3, 8, 255 + case 'x': + i, base, max = 2, 16, 255 + offset++ + case 'u': + i, base, max = 4, 16, unicode.MaxRune + offset++ + case 'U': + i, base, max = 8, 32, unicode.MaxRune + offset++ + default: + panic(fmt.Sprintf("Error decoding character literal: %s\n", str[offset:])) + } + + var x uint32 + for ; i > 0 && offset < len(str); i-- { + ch, size := utf8.DecodeRuneInString(string(str)[offset:]) + offset += size + d := uint32(HexDigitValue(ch)) + if d >= base { + panic(fmt.Sprintf("charVal(%s): illegal character (%c) in escape sequence. size=%d, offset=%d", str, str[offset], size, offset)) + } + x = x*base + d + } + if x > max || 0xD800 <= x && x < 0xE000 { + panic(fmt.Sprintf("Error decoding escape char value. Lit:%s, offset:%d, escape sequence is invalid Unicode code point\n", str, offset)) + } + + return rune(x), offset +} + +func HexDigitValue(ch rune) int { + switch { + case '0' <= ch && ch <= '9': + return int(ch) - '0' + case 'a' <= ch && ch <= 'f': + return int(ch) - 'a' + 10 + case 'A' <= ch && ch <= 'F': + return int(ch) - 'A' + 10 + } + return 16 // larger than any legal digit val +} + diff --git a/example/macro/macro1.grammar/macro1/log/macro1.bnf b/example/macro/macro1.grammar/macro1/log/macro1.bnf new file mode 100644 index 00000000..77886cef --- /dev/null +++ b/example/macro/macro1.grammar/macro1/log/macro1.bnf @@ -0,0 +1,47 @@ +!whitespace : ' ' | '\t' | '\n' | '\r' ; +_digit : '0'-'9' ; +_letter : 'a'-'z' | 'A'-'Z' | ( '\\' 'u' _hex { _hex } ) ; +_hex : _digit | ( 'a'-'f' ) | ('A' - 'F') ; +_idchar : _letter | _digit | '_'; +_x0 : 'α' ; +_x1 : 'β' _digit { _digit } ; +_x : 'α' | ( 'β' _digit { _digit } ); +id: + _x { _x0 | _x1 | 'γ' } +; +<< +func first_one(x string) []string { + fmt.Printf("start with this this one: %s\n", x) + return []string{x} +} +func add_one(c []string, x string) []string { + fmt.Printf("add to %q that %s\n", c, x) + return append([]string{x},c...) +} +func summary(v interface{}) string { + return fmt.Sprintf("ok, so we got <%q> as a final result.\n", v) +} +func definition(deftype, defname string, defval int64) (interface{}, error) { + fmt.Printf("Definition of variable <%s> with '%s' as %d\n", defname, deftype, defval) + return fmt.Sprintf("%s <- %d", defname, defval), nil +} +>> +StmtList : + Stmt_s + << + func() (interface{}, error) {fmt.Printf("%s", summary($0)); return 42, nil}() + >> +; +Stmt_s : Stmt << first_one($0.(string)),nil >> | Stmt_s ";" Stmt << add_one($0.([]string),$2.(string)),nil >>; +StmtPref: + "let"| "define" +; +Stmt : + StmtPref + id + "=" + @ "github.com/maxcalandrelli/gocc/example/calc/calc.grammar/calc" + << + definition($0s,$1s,$4.(int64)) + >> +; diff --git a/example/macro/macro1.grammar/macro1/macro1.go b/example/macro/macro1.grammar/macro1/macro1.go new file mode 100644 index 00000000..1f81f155 --- /dev/null +++ b/example/macro/macro1.grammar/macro1/macro1.go @@ -0,0 +1,131 @@ +// Code generated by gocc; DO NOT EDIT. + +package macro1 + +import ( + "io" + + "github.com/maxcalandrelli/gocc/example/macro/macro1.grammar/macro1/internal/errors" + "github.com/maxcalandrelli/gocc/example/macro/macro1.grammar/macro1/internal/lexer" + "github.com/maxcalandrelli/gocc/example/macro/macro1.grammar/macro1/internal/parser" + "github.com/maxcalandrelli/gocc/example/macro/macro1.grammar/macro1/internal/token" +) + +const ( + INVALID = token.INVALID + EOF = token.EOF +) + +type ( + Token = token.Token + TokenMap = token.TokenMap + Pos = token.Pos + ErrorSymbol = errors.ErrorSymbol + Error = errors.Error + Lexer = lexer.Lexer + Parser = parser.Parser +) + +func NewParser() *parser.Parser { + return parser.NewParser() +} + +func ParseFile(fpath string) (interface{}, error) { + if lexer, err := NewLexerFile(fpath); err == nil { + return NewParser().Parse(lexer) + } else { + return nil, err + } +} + +func ParseText(text string) (interface{}, error) { + return NewParser().Parse(NewLexerBytes([]byte(text))) +} + +func Parse(stream io.Reader) (interface{}, error) { + lex, err := NewLexer(stream) + if lex == nil { + return nil, err + } + return NewParser().Parse(lex) +} + +func ParseFileWithData(fpath string, userData interface{}) (interface{}, error) { + if lexer, err := NewLexerFile(fpath); err == nil { + return NewParser().SetContext(userData).Parse(lexer) + } else { + return nil, err + } +} + +func ParseTextWithData(text string, userData interface{}) (interface{}, error) { + return NewParser().SetContext(userData).Parse(NewLexerBytes([]byte(text))) +} + +func ParseWithData(stream io.Reader, userData interface{}) (interface{}, error) { + lex, err := NewLexer(stream) + if lex == nil { + return nil, err + } + return NewParser().SetContext(userData).Parse(lex) +} + +func ParseFilePartial(fpath string) (interface{}, error, []byte) { + if lexer, err := NewLexerFile(fpath); err == nil { + return NewParser().ParseLongestPrefix(lexer) + } else { + return nil, err, []byte{} + } +} + +func ParseTextPartial(text string) (interface{}, error, []byte) { + return NewParser().ParseLongestPrefix(NewLexerBytes([]byte(text))) +} + +func ParsePartial(stream io.Reader) (interface{}, error, []byte) { + lex, err := NewLexer(stream) + if lex == nil { + return nil, err, []byte{} + } + return NewParser().ParseLongestPrefix(lex) +} + +func ParseFileWithDataPartial(fpath string, userData interface{}) (interface{}, error, []byte) { + if lexer, err := NewLexerFile(fpath); err == nil { + return NewParser().SetContext(userData).ParseLongestPrefix(lexer) + } else { + return nil, err, []byte{} + } +} + +func ParseTextWithDataPartial(text string, userData interface{}) (interface{}, error, []byte) { + return NewParser().SetContext(userData).ParseLongestPrefix(NewLexerBytes([]byte(text))) +} + +func ParseWithDataPartial(stream io.Reader, userData interface{}) (interface{}, error, []byte) { + lex, err := NewLexer(stream) + if lex == nil { + return nil, err, []byte{} + } + return NewParser().SetContext(userData).ParseLongestPrefix(lex) +} + +func NewLexerBytes(src []byte) *lexer.Lexer { + return lexer.NewLexerBytes(src) +} + +func NewLexerString(src string) *lexer.Lexer { + return lexer.NewLexerBytes([]byte(src)) +} + +func NewLexerFile(fpath string) (*lexer.Lexer, error) { + return lexer.NewLexerFile(fpath) +} + +func NewLexer(reader io.Reader) (*lexer.Lexer, error) { + return lexer.NewLexer(reader) +} + +func GetTokenMap() TokenMap { + return token.TokMap +} diff --git a/example/macro/macro1.grammar/macro1/main/macro1.go b/example/macro/macro1.grammar/macro1/main/macro1.go new file mode 100644 index 00000000..162301a1 --- /dev/null +++ b/example/macro/macro1.grammar/macro1/main/macro1.go @@ -0,0 +1,58 @@ +package main + +import ( + "flag" + "fmt" + "os" + "strings" + + macro1 "github.com/maxcalandrelli/gocc/example/macro/macro1.grammar/macro1" +) + +func showResult(r interface{}, e error, p []byte) { + if e != nil { + fmt.Fprintf(os.Stderr, "parsing returned the following error: %s\n", e.Error()) + } else { + if len(p) > 0 { + fmt.Printf("r=%#v, (%s)\n", r, string(p)) + } else { + fmt.Printf("r=%#v\n", r) + } + } +} + +var ( + File string + Text string + Longest bool +) + +func parse(longest bool, lex *macro1.Lexer) (res interface{}, err error, parsed []byte) { + if longest { + return macro1.NewParser().ParseLongestPrefix(lex) + } else { + res, err = macro1.NewParser().Parse(lex) + parsed = []byte{} + } + return +} + +func main() { + flag.StringVar(&File, "file", "", "parse also text in file") + flag.StringVar(&Text, "text", "", "parse also text given with flag") + flag.BoolVar(&Longest, "longest", false, "parse longest possible part") + flag.Parse() + if Text > "" { + showResult(parse(Longest, macro1.NewLexerString(Text))) + } + if File > "" { + l, e := macro1.NewLexerFile(File) + if e != nil { + panic(e) + } + showResult(parse(Longest, l)) + } + if str := strings.Join(flag.Args(), " "); str > "" { + showResult(parse(Longest, macro1.NewLexerString(str))) + } +} diff --git a/example/macro/macro1.grammar/macro1/util.go b/example/macro/macro1.grammar/macro1/util.go new file mode 100644 index 00000000..0af9513c --- /dev/null +++ b/example/macro/macro1.grammar/macro1/util.go @@ -0,0 +1,25 @@ +// Code generated by gocc; DO NOT EDIT. + +package macro1 + +import ( + "github.com/maxcalandrelli/gocc/example/macro/macro1.grammar/macro1/internal/util" +) + +type EscapedString = util.EscapedString + +func RuneToString(r rune) string { + return util.RuneToString(r) +} + +func HexDigitValue(ch rune) int { + return util.HexDigitValue(ch) +} + +func IntValue(lit []byte) (int64, error) { + return util.IntValue(lit) +} + +func UintValue(lit []byte) (uint64, error) { + return util.UintValue(lit) +} diff --git a/example/macro/macro2.bnf b/example/macro/macro2.bnf new file mode 100644 index 00000000..eaa66b7c --- /dev/null +++ b/example/macro/macro2.bnf @@ -0,0 +1,85 @@ +!whitespace : ' ' | '\t' | '\n' | '\r' ; +_digit : '0'-'9' ; +_letter : 'a'-'z' | 'A'-'Z' | ( '\\' 'u' _hex { _hex } ) ; +_hex : _digit | ( 'a'-'f' ) | ('A' - 'F') ; +_idchar : _letter | _digit | '_'; + +_x0 : 'α' ; +_x1 : 'β' _digit { _digit } ; +_x : 'α' | ( 'β' _digit { _digit } ); + +id: + _x { _x0 | _x1 | 'γ' } +; + +<< + + +func first_one(x string) []string { + fmt.Printf("start with this this one: %s\n", x) + return []string{x} +} + +func add_one(c []string, x string) []string { + fmt.Printf("add to %q that %s\n", c, x) + return append([]string{x},c...) +} + +func summary(v interface{}) string { + return fmt.Sprintf("ok, so we got <%q> as a final result.\n", v) +} + +func definition(deftype, defname string, defval int64) (interface{}, error) { + fmt.Printf("Definition of variable <%s> with '%s' as %d\n", defname, deftype, defval) + return fmt.Sprintf("%s <- %d", defname, defval), nil +} + +>> + +MACRO ONEOF(FIRST,VARGS) + {FIRST} + ? VLEN > 0 | + ? VLEN > 0 ONEOF({VARG0},{VARGS}) +ENDMACRO ONEOF + +MACRO DEFREPEATABLE(x, action_1, action_n) +{x}_s : + {x} + << {action_1} >> + | + {x}_s + ";" + {x} + << {action_n} >> +; +ENDMACRO DEFREPEATABLE + +MACRO ACTION(f) +func() (retval interface{}, err error) { + {f} + return +}() +ENDMACRO ACTION + +StmtList : + Stmt_s + << + ACTION(fmt.Printf("%s"<,> summary($0)); retval<,> err = 42<,> nil) + >> +; + +DEFREPEATABLE(Stmt, first_one($0s)<,>nil, add_one($0.([]string)<,>$2s)<,>nil) + +StmtPref: + ONEOF("let", "define") +; + +Stmt : + StmtPref + id + "=" + @ "github.com/maxcalandrelli/gocc/example/calc/calc.grammar/calc" + << + definition($0s,$1s,$4.(int64)) + >> +; diff --git a/example/macro/macro2.grammar/macro2/iface/macro2.go b/example/macro/macro2.grammar/macro2/iface/macro2.go new file mode 100644 index 00000000..1dfe8a9e --- /dev/null +++ b/example/macro/macro2.grammar/macro2/iface/macro2.go @@ -0,0 +1,63 @@ +// Code generated by gocc; DO NOT EDIT. + +package iface + +import ( + "github.com/maxcalandrelli/gocc/example/macro/macro2.grammar/macro2/internal/errors" + "github.com/maxcalandrelli/gocc/example/macro/macro2.grammar/macro2/internal/io/stream" + "github.com/maxcalandrelli/gocc/example/macro/macro2.grammar/macro2/internal/token" + "io" +) + +type ( + Token = token.Token + TokenMap = token.TokenMap + Pos = token.Pos + ErrorSymbol = errors.ErrorSymbol + Error = errors.Error + + Scanner interface { + Scan() (tok *Token) + } + + StreamScanner interface { + GetStream() TokenStream + } + + CheckPoint interface { + DistanceFrom(CheckPoint) int + Advance(int) CheckPoint + } + + CheckPointable interface { + GetCheckPoint() CheckPoint + GotoCheckPoint(CheckPoint) + } + + TokenStream interface { + io.Reader + io.RuneScanner + io.Seeker + } +) + +const ( + INVALID = token.INVALID + EOF = token.EOF +) + +func GetTokenMap() TokenMap { + return token.TokMap +} + +func NewWindowReaderFromBytes(src []byte) stream.WindowReader { + return stream.NewWindowReaderFromBytes(src) +} + +func NewWindowReader(rdr io.Reader) stream.WindowReader { + return stream.NewWindowReader(rdr) +} + +func NewLimitedWindowReader(rdr io.Reader, sizeMin, sizeMax int) stream.WindowReader { + return stream.NewLimitedWindowReader(rdr, sizeMin, sizeMax) +} diff --git a/example/macro/macro2.grammar/macro2/internal/errors/errors.go b/example/macro/macro2.grammar/macro2/internal/errors/errors.go new file mode 100644 index 00000000..4f45cc58 --- /dev/null +++ b/example/macro/macro2.grammar/macro2/internal/errors/errors.go @@ -0,0 +1,56 @@ +// Code generated by gocc; DO NOT EDIT. + +package errors + +import ( + "fmt" + "strings" + + "github.com/maxcalandrelli/gocc/example/macro/macro2.grammar/macro2/internal/token" +) + +type ErrorSymbol interface { +} + +type Error struct { + Err error + ErrorToken *token.Token + ErrorSymbols []ErrorSymbol + ExpectedTokens []string + StackTop int +} + +func (e *Error) String() string { + w := new(strings.Builder) + fmt.Fprintf(w, "Error") + if e.Err != nil { + fmt.Fprintf(w, " %s\n", e.Err) + } else { + fmt.Fprintf(w, "\n") + } + fmt.Fprintf(w, "Token: type=%d, lit=%s\n", e.ErrorToken.Type, e.ErrorToken.Lit) + fmt.Fprintf(w, "Pos: offset=%d, line=%d, column=%d\n", e.ErrorToken.Pos.Offset, e.ErrorToken.Pos.Line, e.ErrorToken.Pos.Column) + fmt.Fprintf(w, "Expected one of: ") + for _, sym := range e.ExpectedTokens { + fmt.Fprintf(w, "%s ", sym) + } + fmt.Fprintf(w, "ErrorSymbol:\n") + for _, sym := range e.ErrorSymbols { + fmt.Fprintf(w, "%v\n", sym) + } + return w.String() +} + +func (e *Error) Error() string { + w := new(strings.Builder) + fmt.Fprintf(w, "Error in S%d: %s, %s", e.StackTop, token.TokMap.TokenString(e.ErrorToken), e.ErrorToken.Pos.String()) + if e.Err != nil { + fmt.Fprintf(w, ": %+v", e.Err) + } else { + fmt.Fprintf(w, ", expected one of: ") + for _, expected := range e.ExpectedTokens { + fmt.Fprintf(w, "%s ", expected) + } + } + return w.String() +} diff --git a/example/macro/macro2.grammar/macro2/internal/io/stream/internal/stream_impl.go b/example/macro/macro2.grammar/macro2/internal/io/stream/internal/stream_impl.go new file mode 100644 index 00000000..358aa160 --- /dev/null +++ b/example/macro/macro2.grammar/macro2/internal/io/stream/internal/stream_impl.go @@ -0,0 +1,275 @@ +package internal + +import ( + "io" + "sync" + "unicode/utf8" +) + +type ( + impl_WindowReader struct { + bufferBlockSize int + maxBufferSize int + buffers [][]byte + available int + absbase int64 + position int + eof bool + rdr io.Reader + lock *sync.Mutex + } +) + +func (s *impl_WindowReader) lockReader() { + if s.lock != nil { + s.lock.Lock() + } +} + +func (s *impl_WindowReader) unlockReader() { + if s.lock != nil { + s.lock.Unlock() + } +} + +func (s *impl_WindowReader) seek(offset int64, whence int) (offs int64, err error) { + switch whence { + case io.SeekStart: + return s.seek(offset-s.ReadPosition(), io.SeekCurrent) + case io.SeekCurrent: + switch { + case offset == 0: + return s.ReadPosition(), nil + case offset < 0: + if -offset > int64(s.maxBackOffset()) { + err = io.ErrShortBuffer + } else { + s.advanceGet(int(offset)) + } + case offset > 0: + for offset > 0 && !s.eof { + available := s.Buffered() + if offset <= int64(available) { + s.advanceGet(int(offset)) + break + } + if available > 0 { + s.advanceGet(available) + offset -= int64(available) + } + read, _ := s.fetchBytes(int(offset)) + s.advanceGet(read) + offset -= int64(read) + } + if s.eof { + err = io.EOF + } + } + case io.SeekEnd: + for !s.eof { + s.seek(int64(s.MaxCap()), io.SeekCurrent) + } + s.seek(int64(s.Buffered()), io.SeekCurrent) + } + if s.eof && err == nil && s.Buffered() > 0 { + s.eof = false + } + return s.ReadPosition(), err +} + +func (s impl_WindowReader) maxBackOffset() int { + r := s.position + if s.absbase > 0 { + r = s.Cap() - s.Buffered() + } + return r +} + +func (s impl_WindowReader) bufferIndex(pos int) int { + if pos < 0 { + panic("negative position") + } + return pos / s.bufferBlockSize +} + +func (s impl_WindowReader) bufferBytes(pos int) []byte { + return s.buffers[s.bufferIndex(pos)] +} + +func (s impl_WindowReader) bufferByteRange(pos int, length int) []byte { + p := s.bufferOffset(pos) + return s.bufferBytes(pos)[p : p+length] +} + +func (s impl_WindowReader) bufferOffset(pos int) int { + return pos % s.bufferBlockSize +} + +func (s *impl_WindowReader) advanceGet(n int) { + sz := s.Cap() + switch { + case n < 0: + if -n > s.maxBackOffset() { + panic("underflow") + } + s.position += n + if s.position < 0 { + s.position += sz + s.absbase -= int64(sz) + } + case n > 0: + if n > s.Buffered() { + panic("overflow") + } + s.position += n + if s.position >= sz { + s.position -= sz + s.absbase += int64(sz) + } + } + s.available -= n +} + +func (s *impl_WindowReader) copy(to []byte, length int) { + for offs, cp := 0, 0; length > 0; length -= cp { + s.position %= s.MaxCap() + p := s.bufferOffset(s.position) + b := s.bufferBytes(s.position) + r := s.bufferBlockSize - p + if length <= r { + cp = copy(to[offs:], b[p:p+length]) + } else { + cp = copy(to[offs:], b[p:]) + } + s.advanceGet(cp) + offs += cp + } +} + +func (s *impl_WindowReader) fetchBytes(n int) (read int, err error) { + if s.rdr == nil { + s.eof = true + return 0, io.EOF + } + for n > 0 && s.Buffered() < s.MaxCap() && err == nil { + readNow := n + putpos := s.position + s.available + r := s.bufferBlockSize - s.bufferOffset(putpos) + if readNow > r { + readNow = r + } + for s.bufferIndex(putpos) >= len(s.buffers) && s.Cap() < s.MaxCap() { + s.buffers = append(s.buffers, make([]byte, s.bufferBlockSize)) + } + putpos %= s.MaxCap() + offs := s.bufferOffset(putpos) + if r, err = s.rdr.Read(s.bufferBytes(putpos)[offs : offs+readNow]); r > 0 { + s.available += r + read += r + n -= r + } + } + if n > 0 && err == nil { + err = io.ErrShortBuffer + } + return +} + +func (s *impl_WindowReader) read(p []byte) (read int, err error) { + if s.eof { + return 0, io.EOF + } + for read < len(p) && err == nil { + available := s.Buffered() + if len(p)-read <= available { + s.copy(p[read:], len(p)-read) + read = len(p) + } else { + if available == 0 { + available, err = s.fetchBytes(len(p) - read) + } + s.copy(p[read:], available) + read += available + switch err { + case io.ErrShortBuffer: + err = nil + case io.EOF: + s.eof = true + } + } + } + return +} + +func (s impl_WindowReader) peekByte() (byte, error) { + if s.Buffered() < 1 { + return 0, io.ErrShortBuffer + } + return s.bufferBytes(s.position)[s.bufferOffset(s.position)], nil +} + +func (s *impl_WindowReader) unreadByte() error { + _, e := s.seek(-1, io.SeekCurrent) + return e +} + +func (s *impl_WindowReader) readRune() (r rune, size int, err error) { + for i := 1; err == nil && i <= 4; i++ { + if s.Buffered() < i { + if _, err = s.fetchBytes(i); err != nil { + return + } + } + t := s.bufferByteRange(s.position, i) + if r, size = utf8.DecodeRune(t); r != utf8.RuneError { + s.advanceGet(size) + return + } + } + return utf8.RuneError, 0, err +} + +func (s *impl_WindowReader) unreadRune() (err error) { + tmps := *s + tmpb := []byte{} + for { + if _, err = tmps.seek(-1, io.SeekCurrent); err == nil { + b, _ := tmps.peekByte() + tmpb = append([]byte{b}, tmpb...) + switch len(tmpb) { + case 1: + if (tmpb[0] & 0xC0) == 0x80 { + continue + } + _, err = s.seek(-int64(len(tmpb)), io.SeekCurrent) + return + case 2: + if (tmpb[0] & 0xC0) == 0x80 { + continue + } + if (tmpb[0] & 0xE0) != 0xC0 { + break + } + _, err = s.seek(-int64(len(tmpb)), io.SeekCurrent) + return + case 3: + if (tmpb[0] & 0xC0) == 0x80 { + continue + } + if (tmpb[0] & 0xF0) != 0xE0 { + break + } + _, err = s.seek(-int64(len(tmpb)), io.SeekCurrent) + return + case 4: + if (tmpb[0] & 0xF8) != 0xF0 { + break + } + _, err = s.seek(-int64(len(tmpb)), io.SeekCurrent) + return + } + } + } + _, err = s.seek(-1, io.SeekCurrent) + return +} diff --git a/example/macro/macro2.grammar/macro2/internal/io/stream/internal/stream_public.go b/example/macro/macro2.grammar/macro2/internal/io/stream/internal/stream_public.go new file mode 100644 index 00000000..20ed7b5e --- /dev/null +++ b/example/macro/macro2.grammar/macro2/internal/io/stream/internal/stream_public.go @@ -0,0 +1,101 @@ +package internal + +import ( + "io" +) + +func NewWindowReader(buf []byte, underlyingReader io.Reader, blksize, smax int, InfoPrefixRoundUp bool) *impl_WindowReader { + if blksize < 0 || smax < blksize { + panic("illegal buffer size") + } + r := &impl_WindowReader{rdr: underlyingReader} + r.bufferBlockSize = blksize + if underlyingReader != nil { + if blksize <= 0 { + r.bufferBlockSize = 1 << 10 + } else if InfoPrefixRoundUp { + for r.bufferBlockSize = 1; blksize > 0; r.bufferBlockSize = r.bufferBlockSize << 1 { + blksize = blksize >> 1 + } + } + if smax > 0 { + r.maxBufferSize = ((smax-1)/r.bufferBlockSize + 1) * r.bufferBlockSize + } + r.buffers = [][]byte{} + } else { + r.buffers = [][]byte{buf} + r.available = len(buf) + r.bufferBlockSize = r.available + r.maxBufferSize = r.available + } + return r +} + +func (s impl_WindowReader) Cap() int { + return len(s.buffers) * s.bufferBlockSize +} + +func (s impl_WindowReader) BlockSize() int { + return s.bufferBlockSize +} + +func (s impl_WindowReader) MaxCap() int { + if s.maxBufferSize > 0 { + return s.maxBufferSize + } + return 1 << 31 +} + +func (s impl_WindowReader) MaxUnreadSize() int { + return s.maxBackOffset() +} + +func (s impl_WindowReader) Buffered() int { + return s.available +} + +func (s impl_WindowReader) ReadPosition() int64 { + return s.absbase + int64(s.position) +} + +func (s *impl_WindowReader) Read(p []byte) (read int, err error) { + s.lockReader() + defer func() { s.unlockReader() }() + return s.read(p) +} + +func (s *impl_WindowReader) Seek(offset int64, whence int) (offs int64, err error) { + s.lockReader() + defer func() { s.unlockReader() }() + return s.seek(offset, whence) +} + +func (s *impl_WindowReader) ReadByte() (byte, error) { + b := []byte{0} + _, err := s.Read(b) + return b[0], err +} + +func (s *impl_WindowReader) PeekByte() (byte, error) { + s.lockReader() + defer func() { s.unlockReader() }() + return s.peekByte() +} + +func (s *impl_WindowReader) UnreadByte() error { + s.lockReader() + defer func() { s.unlockReader() }() + return s.unreadByte() +} + +func (s *impl_WindowReader) ReadRune() (r rune, size int, err error) { + s.lockReader() + defer func() { s.unlockReader() }() + return s.readRune() +} + +func (s *impl_WindowReader) UnreadRune() (err error) { + s.lockReader() + defer func() { s.unlockReader() }() + return s.unreadRune() +} diff --git a/example/macro/macro2.grammar/macro2/internal/io/stream/stream.go b/example/macro/macro2.grammar/macro2/internal/io/stream/stream.go new file mode 100644 index 00000000..b7284551 --- /dev/null +++ b/example/macro/macro2.grammar/macro2/internal/io/stream/stream.go @@ -0,0 +1,39 @@ +package stream + +import ( + internal "github.com/maxcalandrelli/gocc/example/macro/macro2.grammar/macro2/internal/io/stream/internal" + "io" +) + +type ( + WindowReader interface { + BlockSize() int + Buffered() int + Cap() int + MaxCap() int + Read([]byte) (int, error) + ReadByte() (byte, error) + ReadPosition() int64 + ReadRune() (rune, int, error) + Seek(int64, int) (int64, error) + UnreadByte() error + UnreadRune() error + MaxUnreadSize() int + } +) + +var ( + InfoPrefixRoundUp = false +) + +func NewWindowReaderFromBytes(src []byte) WindowReader { + return internal.NewWindowReader(src, nil, 0, 0, InfoPrefixRoundUp) +} + +func NewWindowReader(rdr io.Reader) WindowReader { + return internal.NewWindowReader(nil, rdr, 0, 0, false) +} + +func NewLimitedWindowReader(rdr io.Reader, sizeMin, sizeMax int) WindowReader { + return internal.NewWindowReader(nil, rdr, sizeMin, sizeMax, InfoPrefixRoundUp) +} diff --git a/example/macro/macro2.grammar/macro2/internal/lexer/acttab.go b/example/macro/macro2.grammar/macro2/internal/lexer/acttab.go new file mode 100644 index 00000000..552fbbda --- /dev/null +++ b/example/macro/macro2.grammar/macro2/internal/lexer/acttab.go @@ -0,0 +1,115 @@ +// Code generated by gocc; DO NOT EDIT. + +package lexer + +import ( + "fmt" + + "github.com/maxcalandrelli/gocc/example/macro/macro2.grammar/macro2/internal/token" +) + +type ActionTable [NumStates]ActionRow + +type ActionRow struct { + Accept token.Type + Ignore string +} + +func (a ActionRow) String() string { + return fmt.Sprintf("Accept=%d, Ignore=%s", a.Accept, a.Ignore) +} + +var ActTab = ActionTable{ + ActionRow{ // S0, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S1, Ignore("!whitespace") + Accept: -1, + Ignore: "!whitespace", + }, + ActionRow{ // S2, Accept("Λ<;>") + Accept: 2, + Ignore: "", + }, + ActionRow{ // S3, Accept("Λ<=>") + Accept: 6, + Ignore: "", + }, + ActionRow{ // S4, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S5, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S6, Accept("id") + Accept: 5, + Ignore: "", + }, + ActionRow{ // S7, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S8, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S9, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S10, Accept("id") + Accept: 5, + Ignore: "", + }, + ActionRow{ // S11, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S12, Accept("id") + Accept: 5, + Ignore: "", + }, + ActionRow{ // S13, Accept("id") + Accept: 5, + Ignore: "", + }, + ActionRow{ // S14, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S15, Accept("Λ") + Accept: 3, + Ignore: "", + }, + ActionRow{ // S16, Accept("id") + Accept: 5, + Ignore: "", + }, + ActionRow{ // S17, Accept("id") + Accept: 5, + Ignore: "", + }, + ActionRow{ // S18, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S19, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S20, Accept("id") + Accept: 5, + Ignore: "", + }, + ActionRow{ // S21, + Accept: 0, + Ignore: "", + }, + ActionRow{ // S22, Accept("Λ") + Accept: 4, + Ignore: "", + }, +} diff --git a/example/macro/macro2.grammar/macro2/internal/lexer/lexer.go b/example/macro/macro2.grammar/macro2/internal/lexer/lexer.go new file mode 100644 index 00000000..89635d2e --- /dev/null +++ b/example/macro/macro2.grammar/macro2/internal/lexer/lexer.go @@ -0,0 +1,174 @@ +// Code generated by gocc; DO NOT EDIT. + +package lexer + +import ( + + "io" + "bytes" + "os" + + + "github.com/maxcalandrelli/gocc/example/macro/macro2.grammar/macro2/iface" + "github.com/maxcalandrelli/gocc/example/macro/macro2.grammar/macro2/internal/token" + "github.com/maxcalandrelli/gocc/example/macro/macro2.grammar/macro2/internal/io/stream" +) + +const ( + NoState = -1 + NumStates = 23 + NumSymbols = 29 + INVALID_RUNE = rune(-1) +) + +type position struct { + token.Pos +} + +type Lexer struct { + position + stream iface.TokenStream + eof bool +} + +func NewLexerBytes(src []byte) *Lexer { + lexer := &Lexer{stream: bytes.NewReader(src)} + lexer.reset() + return lexer +} + +func NewLexerString(src string) *Lexer { + return NewLexerBytes([]byte(src)) +} + +func NewLexerFile(fpath string) (*Lexer, error) { + s, err := os.Open(fpath) + if err != nil { + return nil, err + } + lexer := &Lexer{stream: stream.NewWindowReader(s)} + lexer.reset() + return lexer, nil +} + +func NewLexer(reader io.Reader) (*Lexer, error) { + lexer := &Lexer{} + lexer.reset() + if lexer.stream, _ = reader.(iface.TokenStream); lexer.stream == nil { + lexer.stream = stream.NewWindowReader(reader) + } + return lexer, nil +} + +func (l *Lexer) reset () { + l.position.Reset() +} + +func (l Lexer) GetStream() iface.TokenStream { + return l.stream +} + +type checkPoint int64 + +func (c checkPoint) value () int64 { + return int64(c) +} + +func (c checkPoint) DistanceFrom (o iface.CheckPoint) int { + return int (c.value() - o.(checkPoint).value()) +} + +func (c checkPoint) Advance (o int) iface.CheckPoint { + return checkPoint(c.value() + int64(o)) +} + +func (l *Lexer) GetCheckPoint() iface.CheckPoint { + if l == nil { + return checkPoint(0) + } + pos, _ := l.stream.Seek(0, io.SeekCurrent) + return checkPoint(pos) +} + +func (l Lexer) GotoCheckPoint(cp iface.CheckPoint) { + l.stream.Seek(int64(cp.(checkPoint)), io.SeekStart) +} + +func (l *Lexer) Scan() (tok *token.Token) { + tok = new(token.Token) + tok.Type = token.INVALID + start := l.position + state := 0 + for state != -1 { + savePos := l.position.Pos + curr, size, err := l.stream.ReadRune() + if size < 1 || err != nil { + curr = INVALID_RUNE + } + if size > 0 { + l.position.Pos.Offset += size + } + nextState := -1 + if curr != INVALID_RUNE { + nextState = TransTab[state](curr) + } + state = nextState + if state != -1 { + switch curr { + case '\n': + l.position.Pos.Line++ + l.position.Pos.Column = 1 + case '\r': + l.position.Pos.Column = 1 + case '\t': + l.position.Pos.Column += 4 + default: + l.position.Pos.Column++ + } + switch { + case ActTab[state].Accept != -1: + tok.Type = ActTab[state].Accept + tok.Lit = append(tok.Lit, string(curr)...) + case ActTab[state].Ignore != "": + start = l.position + state = 0 + tok.Lit = []byte{} + tok.IgnoredPrefix=append(tok.IgnoredPrefix,string(curr)...) + } + } else if curr != INVALID_RUNE{ + if len(tok.Lit) == 0 { + tok.Lit = append(tok.Lit, string(curr)...) + } else { + l.stream.UnreadRune() + l.position.Pos = savePos + } + } + if err == io.EOF && len(tok.Lit)==0 { + tok.Type = token.EOF + tok.Pos = start.Pos + return + } + } + tok.Pos = start.Pos + return +} + +func (l *Lexer) Reset() { + l.position.Reset() +} + +func (l Lexer) CurrentPosition() position { + return l.position +} + +func (p *position) Reset() { + p.Offset = 0 + p.Line = 1 + p.Column = 1 +} + +func (p position) StartingFrom(base position) position { + r := p + r.Pos = p.Pos.StartingFrom(base.Pos) + return r +} diff --git a/example/macro/macro2.grammar/macro2/internal/lexer/transitiontable.go b/example/macro/macro2.grammar/macro2/internal/lexer/transitiontable.go new file mode 100644 index 00000000..c5b6686a --- /dev/null +++ b/example/macro/macro2.grammar/macro2/internal/lexer/transitiontable.go @@ -0,0 +1,239 @@ +// Code generated by gocc; DO NOT EDIT. + +package lexer + +/* +Let s be the current state +Let r be the current input rune +transitionTable[s](r) returns the next state. +*/ +type TransitionTable [NumStates]func(rune) int + +var TransTab = TransitionTable{ + // S0 + func(r rune) int { + switch { + case r == 9: // ['\t','\t'] + return 1 + case r == 10: // ['\n','\n'] + return 1 + case r == 13: // ['\r','\r'] + return 1 + case r == 32: // [' ',' '] + return 1 + case r == 59: // [';',';'] + return 2 + case r == 61: // ['=','='] + return 3 + case r == 100: // ['d','d'] + return 4 + case r == 108: // ['l','l'] + return 5 + case r == 945: // [\u03b1,\u03b1] + return 6 + case r == 946: // [\u03b2,\u03b2] + return 7 + } + return NoState + }, + // S1 + func(r rune) int { + switch { + } + return NoState + }, + // S2 + func(r rune) int { + switch { + } + return NoState + }, + // S3 + func(r rune) int { + switch { + } + return NoState + }, + // S4 + func(r rune) int { + switch { + case r == 101: // ['e','e'] + return 8 + } + return NoState + }, + // S5 + func(r rune) int { + switch { + case r == 101: // ['e','e'] + return 9 + } + return NoState + }, + // S6 + func(r rune) int { + switch { + case r == 945: // [\u03b1,\u03b1] + return 10 + case r == 946: // [\u03b2,\u03b2] + return 11 + case r == 947: // [\u03b3,\u03b3] + return 12 + } + return NoState + }, + // S7 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 13 + } + return NoState + }, + // S8 + func(r rune) int { + switch { + case r == 102: // ['f','f'] + return 14 + } + return NoState + }, + // S9 + func(r rune) int { + switch { + case r == 116: // ['t','t'] + return 15 + } + return NoState + }, + // S10 + func(r rune) int { + switch { + case r == 945: // [\u03b1,\u03b1] + return 10 + case r == 946: // [\u03b2,\u03b2] + return 11 + case r == 947: // [\u03b3,\u03b3] + return 12 + } + return NoState + }, + // S11 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 16 + } + return NoState + }, + // S12 + func(r rune) int { + switch { + case r == 945: // [\u03b1,\u03b1] + return 10 + case r == 946: // [\u03b2,\u03b2] + return 11 + case r == 947: // [\u03b3,\u03b3] + return 12 + } + return NoState + }, + // S13 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 13 + case r == 945: // [\u03b1,\u03b1] + return 17 + case r == 946: // [\u03b2,\u03b2] + return 18 + case r == 947: // [\u03b3,\u03b3] + return 12 + } + return NoState + }, + // S14 + func(r rune) int { + switch { + case r == 105: // ['i','i'] + return 19 + } + return NoState + }, + // S15 + func(r rune) int { + switch { + } + return NoState + }, + // S16 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 16 + case r == 945: // [\u03b1,\u03b1] + return 10 + case r == 946: // [\u03b2,\u03b2] + return 11 + case r == 947: // [\u03b3,\u03b3] + return 12 + } + return NoState + }, + // S17 + func(r rune) int { + switch { + case r == 945: // [\u03b1,\u03b1] + return 10 + case r == 946: // [\u03b2,\u03b2] + return 11 + case r == 947: // [\u03b3,\u03b3] + return 12 + } + return NoState + }, + // S18 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 20 + } + return NoState + }, + // S19 + func(r rune) int { + switch { + case r == 110: // ['n','n'] + return 21 + } + return NoState + }, + // S20 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 20 + case r == 945: // [\u03b1,\u03b1] + return 17 + case r == 946: // [\u03b2,\u03b2] + return 18 + case r == 947: // [\u03b3,\u03b3] + return 12 + } + return NoState + }, + // S21 + func(r rune) int { + switch { + case r == 101: // ['e','e'] + return 22 + } + return NoState + }, + // S22 + func(r rune) int { + switch { + } + return NoState + }, +} diff --git a/example/macro/macro2.grammar/macro2/internal/parser/action.go b/example/macro/macro2.grammar/macro2/internal/parser/action.go new file mode 100644 index 00000000..54bc55e9 --- /dev/null +++ b/example/macro/macro2.grammar/macro2/internal/parser/action.go @@ -0,0 +1,51 @@ +// Code generated by gocc; DO NOT EDIT. + +package parser + +import ( + "fmt" +) + +type action interface { + act() + String() string +} + +type ( + accept bool + shift int // value is next state index + reduce int // value is production index +) + +func (this accept) act() {} +func (this shift) act() {} +func (this reduce) act() {} + +func (this accept) Equal(that action) bool { + if _, ok := that.(accept); ok { + return true + } + return false +} + +func (this reduce) Equal(that action) bool { + that1, ok := that.(reduce) + if !ok { + return false + } + return this == that1 +} + +func (this shift) Equal(that action) bool { + that1, ok := that.(shift) + if !ok { + return false + } + return this == that1 +} + +func (this accept) String() string { return "accept(0)" } +func (this shift) String() string { return fmt.Sprintf("shift:%d", this) } +func (this reduce) String() string { + return fmt.Sprintf("reduce:%d(%s)", this, productionsTable[this].String) +} diff --git a/example/macro/macro2.grammar/macro2/internal/parser/actiontable.go b/example/macro/macro2.grammar/macro2/internal/parser/actiontable.go new file mode 100644 index 00000000..5cf42646 --- /dev/null +++ b/example/macro/macro2.grammar/macro2/internal/parser/actiontable.go @@ -0,0 +1,195 @@ +// Code generated by gocc; DO NOT EDIT. + +package parser + +type ( + actionTable [numStates]actionRow + cdFunc func(TokenStream, interface{}) (interface{}, error, []byte) + cdAction struct { + tokenIndex int + tokenScanner cdFunc + } + actionRow struct { + canRecover bool + actions [numSymbols]action + cdActions []cdAction + } + actions struct { + table actionTable + } +) + +var parserActions = actions{ + table: actionTable{ + actionRow{ // S0 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // ";" + shift(5), // "let" + shift(6), // "define" + nil, // id + nil, // "=" + nil, // μ + }, + cdActions: []cdAction{}, + }, + actionRow{ // S1 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + accept(true), // Ω + nil, // ";" + nil, // "let" + nil, // "define" + nil, // id + nil, // "=" + nil, // μ + }, + cdActions: []cdAction{}, + }, + actionRow{ // S2 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(1), // Ω, reduce: StmtList + shift(7), // ";" + nil, // "let" + nil, // "define" + nil, // id + nil, // "=" + nil, // μ + }, + cdActions: []cdAction{}, + }, + actionRow{ // S3 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(2), // Ω, reduce: Stmt_s + reduce(2), // ";", reduce: Stmt_s + nil, // "let" + nil, // "define" + nil, // id + nil, // "=" + nil, // μ + }, + cdActions: []cdAction{}, + }, + actionRow{ // S4 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // ";" + nil, // "let" + nil, // "define" + shift(8), // id + nil, // "=" + nil, // μ + }, + cdActions: []cdAction{}, + }, + actionRow{ // S5 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // ";" + nil, // "let" + nil, // "define" + reduce(4), // id, reduce: StmtPref + nil, // "=" + nil, // μ + }, + cdActions: []cdAction{}, + }, + actionRow{ // S6 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // ";" + nil, // "let" + nil, // "define" + reduce(5), // id, reduce: StmtPref + nil, // "=" + nil, // μ + }, + cdActions: []cdAction{}, + }, + actionRow{ // S7 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // ";" + shift(5), // "let" + shift(6), // "define" + nil, // id + nil, // "=" + nil, // μ + }, + cdActions: []cdAction{}, + }, + actionRow{ // S8 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // ";" + nil, // "let" + nil, // "define" + nil, // id + shift(10), // "=" + nil, // μ + }, + cdActions: []cdAction{}, + }, + actionRow{ // S9 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(3), // Ω, reduce: Stmt_s + reduce(3), // ";", reduce: Stmt_s + nil, // "let" + nil, // "define" + nil, // id + nil, // "=" + nil, // μ + }, + cdActions: []cdAction{}, + }, + actionRow{ // S10 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + nil, // ";" + nil, // "let" + nil, // "define" + nil, // id + nil, // "=" + shift(11), // μ + }, + cdActions: []cdAction{ + cdAction{tokenIndex: 7, tokenScanner: cdFunc_calc_0}, + }, + }, + actionRow{ // S11 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + reduce(6), // Ω, reduce: Stmt + reduce(6), // ";", reduce: Stmt + nil, // "let" + nil, // "define" + nil, // id + nil, // "=" + nil, // μ + }, + cdActions: []cdAction{}, + }, + }, +} diff --git a/example/macro/macro2.grammar/macro2/internal/parser/gototable.go b/example/macro/macro2.grammar/macro2/internal/parser/gototable.go new file mode 100644 index 00000000..bb84cbfe --- /dev/null +++ b/example/macro/macro2.grammar/macro2/internal/parser/gototable.go @@ -0,0 +1,97 @@ +// Code generated by gocc; DO NOT EDIT. + +package parser + +const numNTSymbols = 5 + +type ( + gotoTable [numStates]gotoRow + gotoRow [numNTSymbols]int +) + +var gotoTab = gotoTable{ + gotoRow{ // S0 + -1, // Π + 1, // Π + 2, // Π + 3, // Π + 4, // Π + }, + gotoRow{ // S1 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S2 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S3 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S4 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S5 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S6 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S7 + -1, // Π + -1, // Π + -1, // Π + 9, // Π + 4, // Π + }, + gotoRow{ // S8 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S9 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S10 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, + gotoRow{ // S11 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, +} diff --git a/example/macro/macro2.grammar/macro2/internal/parser/parser.go b/example/macro/macro2.grammar/macro2/internal/parser/parser.go new file mode 100644 index 00000000..49e4b6c4 --- /dev/null +++ b/example/macro/macro2.grammar/macro2/internal/parser/parser.go @@ -0,0 +1,359 @@ +// Code generated by gocc; DO NOT EDIT. + +package parser + +import ( + "errors" + "fmt" + "strings" + + "github.com/maxcalandrelli/gocc/example/macro/macro2.grammar/macro2/iface" + parseError "github.com/maxcalandrelli/gocc/example/macro/macro2.grammar/macro2/internal/errors" + "github.com/maxcalandrelli/gocc/example/macro/macro2.grammar/macro2/internal/token" + + calc "github.com/maxcalandrelli/gocc/example/calc/calc.grammar/calc" +) + +const ( + numProductions = 7 + numStates = 12 + numSymbols = 13 +) + +// Stack + +type stack struct { + state []int + attrib []Attrib +} + +const INITIAL_STACK_SIZE = 100 + +func newStack() *stack { + return &stack{ + state: make([]int, 0, INITIAL_STACK_SIZE), + attrib: make([]Attrib, 0, INITIAL_STACK_SIZE), + } +} + +func (s *stack) reset() { + s.state = s.state[:0] + s.attrib = s.attrib[:0] +} + +func (s *stack) push(state int, a Attrib) { + s.state = append(s.state, state) + s.attrib = append(s.attrib, a) +} + +func (s *stack) top() int { + return s.state[len(s.state)-1] +} + +func (s *stack) peek(pos int) int { + return s.state[pos] +} + +func (s *stack) topIndex() int { + return len(s.state) - 1 +} + +func (s *stack) popN(items int) []Attrib { + lo, hi := len(s.state)-items, len(s.state) + + attrib := s.attrib[lo:hi] + + s.state = s.state[:lo] + s.attrib = s.attrib[:lo] + + return attrib +} + +func (s *stack) String() string { + w := new(strings.Builder) + fmt.Fprintf(w, "stack:\n") + for i, st := range s.state { + fmt.Fprintf(w, "\t%d: %d , ", i, st) + if s.attrib[i] == nil { + fmt.Fprintf(w, "nil") + } else { + switch attr := s.attrib[i].(type) { + case *token.Token: + fmt.Fprintf(w, "%s", attr.Lit) + default: + fmt.Fprintf(w, "%v", attr) + } + } + fmt.Fprintf(w, "\n") + } + return w.String() +} + +// Parser + +type Parser struct { + stack *stack + nextToken *token.Token + userContext interface{} + + // + // Working data, should be method parameters/locals + // but putting them here simplifies a bit the code + // Useful only for longest prefix partial parsing + // + needsRepositioning bool + isNonDeterministic bool + tokens iface.CheckPointable + afterPos iface.CheckPoint + checkPoint iface.CheckPoint + underlyingStream iface.TokenStream +} + +type TokenStream = iface.TokenStream + +type ( + fakeCp struct{} + fakeCheckPointable struct{} +) + +func (f fakeCheckPointable) GetCheckPoint() iface.CheckPoint { + return fakeCp{} +} + +func (f fakeCp) DistanceFrom(o iface.CheckPoint) int { + return 0 +} + +func (f fakeCp) Advance(o int) iface.CheckPoint { + return fakeCp{} +} + +func (f fakeCheckPointable) GotoCheckPoint(iface.CheckPoint) {} + +func cdFunc_calc_0(Stream TokenStream, Context interface{}) (interface{}, error, []byte) { + return calc.ParseWithDataPartial(Stream, Context) +} + +func NewParser() *Parser { + return NewParserWithContext(nil) +} + +func NewParserWithContext(u interface{}) *Parser { + p := &Parser{stack: newStack(), userContext: u} + p.Reset() + return p +} + +func (p *Parser) Reset() { + p.stack.reset() + p.stack.push(0, nil) +} + +func (p *Parser) SetContext(ctx interface{}) *Parser { + p.userContext = ctx + return p +} + +func (p Parser) GetContext() interface{} { + return p.userContext +} + +func (p *Parser) Error(err error, scanner iface.Scanner) (recovered bool, errorAttrib *parseError.Error) { + errorAttrib = &parseError.Error{ + Err: err, + ErrorToken: p.nextToken, + ErrorSymbols: p.popNonRecoveryStates(), + ExpectedTokens: make([]string, 0, 8), + } + for t, action := range parserActions.table[p.stack.top()].actions { + if action != nil { + errorAttrib.ExpectedTokens = append(errorAttrib.ExpectedTokens, token.TokMap.Id(token.Type(t))) + } + } + + if action := parserActions.table[p.stack.top()].actions[token.TokMap.Type("λ")]; action != nil { + p.stack.push(int(action.(shift)), errorAttrib) // action can only be shift + } else { + return + } + + if action := parserActions.table[p.stack.top()].actions[p.nextToken.Type]; action != nil { + recovered = true + } + for !recovered && p.nextToken.Type != token.EOF { + p.nextToken = scanner.Scan() + if action := parserActions.table[p.stack.top()].actions[p.nextToken.Type]; action != nil { + recovered = true + } + } + + return +} + +func (p *Parser) popNonRecoveryStates() (removedAttribs []parseError.ErrorSymbol) { + if rs, ok := p.firstRecoveryState(); ok { + errorSymbols := p.stack.popN(p.stack.topIndex() - rs) + removedAttribs = make([]parseError.ErrorSymbol, len(errorSymbols)) + for i, e := range errorSymbols { + removedAttribs[i] = e + } + } else { + removedAttribs = []parseError.ErrorSymbol{} + } + return +} + +// recoveryState points to the highest state on the stack, which can recover +func (p *Parser) firstRecoveryState() (recoveryState int, canRecover bool) { + recoveryState, canRecover = p.stack.topIndex(), parserActions.table[p.stack.top()].canRecover + for recoveryState > 0 && !canRecover { + recoveryState-- + canRecover = parserActions.table[p.stack.peek(recoveryState)].canRecover + } + return +} + +func (p *Parser) newError(err error) error { + e := &parseError.Error{ + Err: err, + StackTop: p.stack.top(), + ErrorToken: p.nextToken, + } + actRow := parserActions.table[p.stack.top()] + for i, t := range actRow.actions { + if t != nil { + e.ExpectedTokens = append(e.ExpectedTokens, token.TokMap.Id(token.Type(i))) + } + } + return e +} + +func (p *Parser) prepareParsing(scanner iface.Scanner, longest bool) error { + p.Reset() + p.needsRepositioning = true + p.isNonDeterministic = true + if p.needsRepositioning { + if streamScanner, _ := scanner.(iface.StreamScanner); streamScanner != nil { + p.underlyingStream = streamScanner.GetStream() + } + if p.tokens, _ = scanner.(iface.CheckPointable); p.tokens == nil || p.underlyingStream == nil { + return errNotRepositionable + } + } else { + if p.tokens, _ = scanner.(iface.CheckPointable); p.tokens == nil { + p.tokens = fakeCheckPointable{} + } + } + return nil +} + +func (p *Parser) Parse(scanner iface.Scanner) (res interface{}, err error) { + if err := p.prepareParsing(scanner, false); err != nil { + return nil, err + } + return p.parse(scanner, false) +} + +func (p *Parser) ParseLongestPrefix(scanner iface.Scanner) (res interface{}, err error, parsed []byte) { + if err := p.prepareParsing(scanner, true); err != nil { + return nil, err, []byte{} + } + startPoint := p.tokens.GetCheckPoint() + res, err = p.parse(scanner, true) + if err == nil { + currPoint := p.tokens.GetCheckPoint() + p.tokens.GotoCheckPoint(startPoint) + parsed = make([]byte, currPoint.DistanceFrom(startPoint)) + p.underlyingStream.Read(parsed) + p.tokens.GotoCheckPoint(currPoint) + } + return +} + +var errNotRepositionable = errors.New("scanner not repositionable") + +func (p *Parser) parse(scanner iface.Scanner, longest bool) (res interface{}, err error) { + readNextToken := func() { + p.checkPoint = p.tokens.GetCheckPoint() + p.nextToken = scanner.Scan() + p.afterPos = p.tokens.GetCheckPoint() + return + } + readNextToken() + for acc := false; !acc; { + action := parserActions.table[p.stack.top()].actions[p.nextToken.Type] + if action == nil && p.isNonDeterministic { + // + // If no action, check if we have some context dependent parsing to try + // + p.checkPoint = p.checkPoint.Advance(len(p.nextToken.IgnoredPrefix)) + for _, cdAction := range parserActions.table[p.stack.top()].cdActions { + p.tokens.GotoCheckPoint(p.checkPoint) + cd_res, cd_err, cd_parsed := cdAction.tokenScanner(p.underlyingStream, p.userContext) + if cd_err == nil && len(cd_parsed) > 0 { + action = parserActions.table[p.stack.top()].actions[cdAction.tokenIndex] + if action != nil { + p.nextToken.Foreign = true + p.nextToken.ForeignAstNode = cd_res + p.nextToken.Lit = cd_parsed + p.nextToken.Type = token.Type(cdAction.tokenIndex) + break + } + } + } + } + // + // Still no action? If a longest possible parsing is requested in place + // of a full text, we should try to check if an EOF here would have led + // to a successful parsing instead + // Rember that token.EOF is 1, that is the index of SyntaxEof into symbol table + // Dirty, dirty, dirty... but I found it as it is, and I prefer not to touch + // + if action == nil && longest { + p.tokens.GotoCheckPoint(p.checkPoint) + action = parserActions.table[p.stack.top()].actions[token.EOF] + if action == nil { + // + // ok, let's consume the token then + // + p.tokens.GotoCheckPoint(p.afterPos) + } + } + + // + // Well, no action is no action after all... + // + if action == nil { + if recovered, errAttrib := p.Error(nil, scanner); !recovered { + p.nextToken = errAttrib.ErrorToken + return nil, p.newError(nil) + } + if action = parserActions.table[p.stack.top()].actions[p.nextToken.Type]; action == nil { + panic("Error recovery led to invalid action") + } + } + + switch act := action.(type) { + case accept: + res = p.stack.popN(1)[0] + acc = true + case shift: + p.stack.push(int(act), p.nextToken) + if p.nextToken.Foreign { + p.stack.push(int(act), p.nextToken.ForeignAstNode) + } + readNextToken() + case reduce: + prod := productionsTable[int(act)] + attrib, err := prod.ReduceFunc(p.userContext, p.stack.popN(prod.NumSymbols)) + if err != nil { + return nil, p.newError(err) + } else { + p.stack.push(gotoTab[p.stack.top()][prod.NTType], attrib) + } + default: + panic("unknown action: " + action.String()) + } + } + return res, nil +} diff --git a/example/macro/macro2.grammar/macro2/internal/parser/productionstable.go b/example/macro/macro2.grammar/macro2/internal/parser/productionstable.go new file mode 100644 index 00000000..61d43b14 --- /dev/null +++ b/example/macro/macro2.grammar/macro2/internal/parser/productionstable.go @@ -0,0 +1,148 @@ +// Code generated by gocc; DO NOT EDIT. + +package parser + +import ( + "fmt" + "github.com/maxcalandrelli/gocc/example/macro/macro2.grammar/macro2/internal/token" + "github.com/maxcalandrelli/gocc/example/macro/macro2.grammar/macro2/internal/util" + "strings" +) + +func first_one(x string) []string { + fmt.Printf("start with this this one: %s\n", x) + return []string{x} +} +func add_one(c []string, x string) []string { + fmt.Printf("add to %q that %s\n", c, x) + return append([]string{x}, c...) +} +func summary(v interface{}) string { + return fmt.Sprintf("ok, so we got <%q> as a final result.\n", v) +} +func definition(deftype, defname string, defval int64) (interface{}, error) { + fmt.Printf("Definition of variable <%s> with '%s' as %d\n", defname, deftype, defval) + return fmt.Sprintf("%s <- %d", defname, defval), nil +} + +func getString(X Attrib) string { + switch X.(type) { + case *token.Token: + return string(X.(*token.Token).Lit) + case string: + return X.(string) + } + return fmt.Sprintf("%q", X) +} + +func unescape(s string) string { + return util.EscapedString(s).Unescape() +} + +func unquote(s string) string { + r, _, _ := util.EscapedString(s).Unquote() + return r +} + +func lc(s string) string { + return strings.ToLower(s) +} + +func uc(s string) string { + return strings.ToUpper(s) +} + +type ( + //TODO: change type and variable names to be consistent with other tables + ProdTab [numProductions]ProdTabEntry + ProdTabEntry struct { + String string + Id string + NTType int + Index int + NumSymbols int + ReduceFunc func(interface{}, []Attrib) (Attrib, error) + } + Attrib interface { + } +) + +var productionsTable = ProdTab{ + ProdTabEntry{ + String: `S' : Π << >>`, + Id: "S'", + NTType: 0, + Index: 0, + NumSymbols: 1, + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { + return X[0], nil + }, + }, + ProdTabEntry{ + String: `StmtList : Π << func() (retval interface{}, err error) { + fmt.Printf("%s", summary($0)); retval, err = 42, nil + return +}() >>`, + Id: "StmtList", + NTType: 1, + Index: 1, + NumSymbols: 1, + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { + return func() (retval interface{}, err error) { + fmt.Printf("%s", summary(X[0])) + retval, err = 42, nil + return + }() + }, + }, + ProdTabEntry{ + String: `Stmt_s : Π << first_one($0s),nil >>`, + Id: "Stmt_s", + NTType: 2, + Index: 2, + NumSymbols: 1, + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { + return first_one(getString(X[0])), nil + }, + }, + ProdTabEntry{ + String: `Stmt_s : Π Λ<;> Π << add_one($0.([]string),$2s),nil >>`, + Id: "Stmt_s", + NTType: 2, + Index: 3, + NumSymbols: 3, + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { + return add_one(X[0].([]string), getString(X[2])), nil + }, + }, + ProdTabEntry{ + String: `StmtPref : Λ << >>`, + Id: "StmtPref", + NTType: 4, + Index: 4, + NumSymbols: 1, + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { + return X[0], nil + }, + }, + ProdTabEntry{ + String: `StmtPref : Λ << >>`, + Id: "StmtPref", + NTType: 4, + Index: 5, + NumSymbols: 1, + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { + return X[0], nil + }, + }, + ProdTabEntry{ + String: `Stmt : Π id Λ<=> μ << definition($0s,$1s,$4.(int64)) >>`, + Id: "Stmt", + NTType: 3, + Index: 6, + NumSymbols: 5, + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { + return definition(getString(X[0]), getString(X[1]), X[4].(int64)) + }, + }, +} diff --git a/example/macro/macro2.grammar/macro2/internal/token/token.go b/example/macro/macro2.grammar/macro2/internal/token/token.go new file mode 100644 index 00000000..bd4fc7cf --- /dev/null +++ b/example/macro/macro2.grammar/macro2/internal/token/token.go @@ -0,0 +1,166 @@ +// Code generated by gocc; DO NOT EDIT. + +package token + +import ( + "fmt" + "strconv" + "unicode/utf8" +) + +type Token struct { + Type + Lit []byte + IgnoredPrefix []byte + Pos + ForeignAstNode interface{} + Foreign bool +} + +type Type int + +const ( + INVALID Type = iota + EOF +) + +type Pos struct { + Offset int + Line int + Column int +} + +func (p Pos) String() string { + return fmt.Sprintf("Pos(offset=%d, line=%d, column=%d)", p.Offset, p.Line, p.Column) +} + +func (p Pos) StartingFrom(base Pos) Pos { + r := base + r.Offset += p.Offset + r.Line += p.Line + r.Column = p.Column + if p.Line > 0 && base.Line > 0 { + r.Line-- + } + if r.Column < 1 { + r.Column = 1 + } + return r +} + +type TokenMap struct { + typeMap []string + idMap map[string]Type + litMap map[string]Type +} + +func (m TokenMap) Id(tok Type) string { + if int(tok) < len(m.typeMap) { + return m.typeMap[tok] + } + return "unknown" +} + +func (m TokenMap) Type(tok string) Type { + if typ, exist := m.idMap[tok]; exist { + return typ + } + return INVALID +} + +func (m TokenMap) TokenString(tok *Token) string { + return fmt.Sprintf("%s(%d,<%s>)", m.Id(tok.Type), tok.Type, tok.Lit) +} + +func (m TokenMap) StringType(typ Type) string { + return fmt.Sprintf("%s(%d)", m.Id(typ), typ) +} + +// CharLiteralValue returns the string value of the char literal. +func (t *Token) CharLiteralValue() string { + return string(t.Lit[1 : len(t.Lit)-1]) +} + +// Float32Value returns the float32 value of the token or an error if the token literal does not +// denote a valid float32. +func (t *Token) Float32Value() (float32, error) { + if v, err := strconv.ParseFloat(string(t.Lit), 32); err != nil { + return 0, err + } else { + return float32(v), nil + } +} + +// Float64Value returns the float64 value of the token or an error if the token literal does not +// denote a valid float64. +func (t *Token) Float64Value() (float64, error) { + return strconv.ParseFloat(string(t.Lit), 64) +} + +// IDValue returns the string representation of an identifier token. +func (t *Token) IDValue() string { + return string(t.Lit) +} + +// Int32Value returns the int32 value of the token or an error if the token literal does not +// denote a valid float64. +func (t *Token) Int32Value() (int32, error) { + if v, err := strconv.ParseInt(string(t.Lit), 10, 64); err != nil { + return 0, err + } else { + return int32(v), nil + } +} + +// Int64Value returns the int64 value of the token or an error if the token literal does not +// denote a valid float64. +func (t *Token) Int64Value() (int64, error) { + return strconv.ParseInt(string(t.Lit), 10, 64) +} + +// UTF8Rune decodes the UTF8 rune in the token literal. It returns utf8.RuneError if +// the token literal contains an invalid rune. +func (t *Token) UTF8Rune() (rune, error) { + r, _ := utf8.DecodeRune(t.Lit) + if r == utf8.RuneError { + err := fmt.Errorf("Invalid rune") + return r, err + } + return r, nil +} + +// StringValue returns the string value of the token literal. +func (t *Token) StringValue() string { + return string(t.Lit[1 : len(t.Lit)-1]) +} + +var TokMap = TokenMap{ + typeMap: []string{ + "INVALID", + "Ω", + "Λ<;>", + "Λ", + "Λ", + "id", + "Λ<=>", + "μ", + }, + + idMap: map[string]Type{ + "INVALID": 0, + "Ω": 1, + "Λ<;>": 2, + "Λ": 3, + "Λ": 4, + "id": 5, + "Λ<=>": 6, + "μ": 7, + }, + + litMap: map[string]Type{ + ";": 2, + "let": 3, + "define": 4, + "=": 6, + }, +} diff --git a/example/macro/macro2.grammar/macro2/internal/util/litconv.go b/example/macro/macro2.grammar/macro2/internal/util/litconv.go new file mode 100644 index 00000000..1aeb6166 --- /dev/null +++ b/example/macro/macro2.grammar/macro2/internal/util/litconv.go @@ -0,0 +1,108 @@ +// Code generated by gocc; DO NOT EDIT. + +package util + +import ( + "fmt" + "strconv" + "unicode" + "unicode/utf8" +) + +/* Interface */ + +/* +Convert the literal value of a scanned token to rune +*/ +func RuneValue(lit []byte) rune { + if lit[1] == '\\' { + return escapeCharVal(lit) + } + r, size := utf8.DecodeRune(lit[1:]) + if size != len(lit)-2 { + panic(fmt.Sprintf("Error decoding rune. Lit: %s, rune: %d, size%d\n", lit, r, size)) + } + return r +} + +/* +Convert the literal value of a scanned token to int64 +*/ +func IntValue(lit []byte) (int64, error) { + return strconv.ParseInt(string(lit), 10, 64) +} + +/* +Convert the literal value of a scanned token to uint64 +*/ +func UintValue(lit []byte) (uint64, error) { + return strconv.ParseUint(string(lit), 10, 64) +} + +/* Util */ + +func escapeCharVal(lit []byte) rune { + var i, base, max uint32 + offset := 2 + switch lit[offset] { + case 'a': + return '\a' + case 'b': + return '\b' + case 'f': + return '\f' + case 'n': + return '\n' + case 'r': + return '\r' + case 't': + return '\t' + case 'v': + return '\v' + case '\\': + return '\\' + case '\'': + return '\'' + case '0', '1', '2', '3', '4', '5', '6', '7': + i, base, max = 3, 8, 255 + case 'x': + i, base, max = 2, 16, 255 + offset++ + case 'u': + i, base, max = 4, 16, unicode.MaxRune + offset++ + case 'U': + i, base, max = 8, 16, unicode.MaxRune + offset++ + default: + panic(fmt.Sprintf("Error decoding character literal: %s\n", lit)) + } + + var x uint32 + for ; i > 0 && offset < len(lit)-1; i-- { + ch, size := utf8.DecodeRune(lit[offset:]) + offset += size + d := uint32(digitVal(ch)) + if d >= base { + panic(fmt.Sprintf("charVal(%s): illegal character (%c) in escape sequence. size=%d, offset=%d", lit, ch, size, offset)) + } + x = x*base + d + } + if x > max || 0xD800 <= x && x < 0xE000 { + panic(fmt.Sprintf("Error decoding escape char value. Lit:%s, offset:%d, escape sequence is invalid Unicode code point\n", lit, offset)) + } + + return rune(x) +} + +func digitVal(ch rune) int { + switch { + case '0' <= ch && ch <= '9': + return int(ch) - '0' + case 'a' <= ch && ch <= 'f': + return int(ch) - 'a' + 10 + case 'A' <= ch && ch <= 'F': + return int(ch) - 'A' + 10 + } + return 16 // larger than any legal digit val +} diff --git a/example/macro/macro2.grammar/macro2/internal/util/rune.go b/example/macro/macro2.grammar/macro2/internal/util/rune.go new file mode 100644 index 00000000..788edfde --- /dev/null +++ b/example/macro/macro2.grammar/macro2/internal/util/rune.go @@ -0,0 +1,140 @@ +// Code generated by gocc; DO NOT EDIT. + + +package util + +import ( + "fmt" + "unicode" + "unicode/utf8" +) + +func RuneToString(r rune) string { + if r >= 0x20 && r < 0x7f { + return fmt.Sprintf("'%c'", r) + } + switch r { + case 0x07: + return "'\\a'" + case 0x08: + return "'\\b'" + case 0x0C: + return "'\\f'" + case 0x0A: + return "'\\n'" + case 0x0D: + return "'\\r'" + case 0x09: + return "'\\t'" + case 0x0b: + return "'\\v'" + case 0x5c: + return "'\\\\\\'" + case 0x27: + return "'\\''" + case 0x22: + return "'\\\"'" + } + if r < 0x10000 { + return fmt.Sprintf("\\u%04x", r) + } + return fmt.Sprintf("\\U%08x", r) +} + +type EscapedString string + +func (str EscapedString) Unquote() (unquoted string, wasQuoted bool, quoteType rune) { + if len(str) > 1 { + r := str[0] + if (r == '"' || r == '\x60' || r == '\'') && r == str[len(str)-1] { + str = str[1 : len(str)-1] + } + return string(str), true, rune(r) + } + return string(str), false, 0 +} + +func (str EscapedString) Unescape() string { + var ( + res string + r rune + size int + ) + for s := 0; s < len(str); s += size { + if str[s] == '\\' { + r, size = str[s+1:].EscapedFirstCharValue() + size++ + } else { + r, size = utf8.DecodeRuneInString(string(str)[s:]) + } + res += string(r) + } + return res +} + +func (str EscapedString) EscapedFirstCharValue() (rune, int) { + var i, base, max uint32 + offset := 0 + switch str[offset] { + case '\'', '"': + return rune(str[offset]), 1 + case 'a': + return '\a', 1 + case 'b': + return '\b', 1 + case 'f': + return '\f', 1 + case 'n': + return '\n', 1 + case 'r': + return '\r', 1 + case 't': + return '\t', 1 + case 'v': + return '\v', 1 + case '\\': + return '\\', 1 + case '0', '1', '2', '3', '4', '5', '6', '7': + i, base, max = 3, 8, 255 + case 'x': + i, base, max = 2, 16, 255 + offset++ + case 'u': + i, base, max = 4, 16, unicode.MaxRune + offset++ + case 'U': + i, base, max = 8, 32, unicode.MaxRune + offset++ + default: + panic(fmt.Sprintf("Error decoding character literal: %s\n", str[offset:])) + } + + var x uint32 + for ; i > 0 && offset < len(str); i-- { + ch, size := utf8.DecodeRuneInString(string(str)[offset:]) + offset += size + d := uint32(HexDigitValue(ch)) + if d >= base { + panic(fmt.Sprintf("charVal(%s): illegal character (%c) in escape sequence. size=%d, offset=%d", str, str[offset], size, offset)) + } + x = x*base + d + } + if x > max || 0xD800 <= x && x < 0xE000 { + panic(fmt.Sprintf("Error decoding escape char value. Lit:%s, offset:%d, escape sequence is invalid Unicode code point\n", str, offset)) + } + + return rune(x), offset +} + +func HexDigitValue(ch rune) int { + switch { + case '0' <= ch && ch <= '9': + return int(ch) - '0' + case 'a' <= ch && ch <= 'f': + return int(ch) - 'a' + 10 + case 'A' <= ch && ch <= 'F': + return int(ch) - 'A' + 10 + } + return 16 // larger than any legal digit val +} + diff --git a/example/macro/macro2.grammar/macro2/log/macro2.bnf b/example/macro/macro2.grammar/macro2/log/macro2.bnf new file mode 100644 index 00000000..dd1f5ce2 --- /dev/null +++ b/example/macro/macro2.grammar/macro2/log/macro2.bnf @@ -0,0 +1,65 @@ +// +// Code generated by gocc preprocessor ; DO NOT EDIT. +// +!whitespace : ' ' | '\t' | '\n' | '\r' ; +_digit : '0'-'9' ; +_letter : 'a'-'z' | 'A'-'Z' | ( '\\' 'u' _hex { _hex } ) ; +_hex : _digit | ( 'a'-'f' ) | ('A' - 'F') ; +_idchar : _letter | _digit | '_'; +_x0 : 'α' ; +_x1 : 'β' _digit { _digit } ; +_x : 'α' | ( 'β' _digit { _digit } ); +id: + _x { _x0 | _x1 | 'γ' } +; +<< +func first_one(x string) []string { + fmt.Printf("start with this this one: %s\n", x) + return []string{x} +} +func add_one(c []string, x string) []string { + fmt.Printf("add to %q that %s\n", c, x) + return append([]string{x},c...) +} +func summary(v interface{}) string { + return fmt.Sprintf("ok, so we got <%q> as a final result.\n", v) +} +func definition(deftype, defname string, defval int64) (interface{}, error) { + fmt.Printf("Definition of variable <%s> with '%s' as %d\n", defname, deftype, defval) + return fmt.Sprintf("%s <- %d", defname, defval), nil +} +>> +StmtList : + Stmt_s + << +func() (retval interface{}, err error) { + fmt.Printf("%s", summary($0)); retval, err = 42, nil + return +}() + + >> +; +Stmt_s : + Stmt + << first_one($0s),nil >> + | + Stmt_s + ";" + Stmt + << add_one($0.([]string),$2s),nil >> +; +StmtPref: + "let" +| + "define" + +; +Stmt : + StmtPref + id + "=" + @ "github.com/maxcalandrelli/gocc/example/calc/calc.grammar/calc" + << + definition($0s,$1s,$4.(int64)) + >> +; diff --git a/example/macro/macro2.grammar/macro2/macro2.go b/example/macro/macro2.grammar/macro2/macro2.go new file mode 100644 index 00000000..25aed95f --- /dev/null +++ b/example/macro/macro2.grammar/macro2/macro2.go @@ -0,0 +1,131 @@ +// Code generated by gocc; DO NOT EDIT. + +package macro2 + +import ( + "io" + + "github.com/maxcalandrelli/gocc/example/macro/macro2.grammar/macro2/internal/errors" + "github.com/maxcalandrelli/gocc/example/macro/macro2.grammar/macro2/internal/lexer" + "github.com/maxcalandrelli/gocc/example/macro/macro2.grammar/macro2/internal/parser" + "github.com/maxcalandrelli/gocc/example/macro/macro2.grammar/macro2/internal/token" +) + +const ( + INVALID = token.INVALID + EOF = token.EOF +) + +type ( + Token = token.Token + TokenMap = token.TokenMap + Pos = token.Pos + ErrorSymbol = errors.ErrorSymbol + Error = errors.Error + Lexer = lexer.Lexer + Parser = parser.Parser +) + +func NewParser() *parser.Parser { + return parser.NewParser() +} + +func ParseFile(fpath string) (interface{}, error) { + if lexer, err := NewLexerFile(fpath); err == nil { + return NewParser().Parse(lexer) + } else { + return nil, err + } +} + +func ParseText(text string) (interface{}, error) { + return NewParser().Parse(NewLexerBytes([]byte(text))) +} + +func Parse(stream io.Reader) (interface{}, error) { + lex, err := NewLexer(stream) + if lex == nil { + return nil, err + } + return NewParser().Parse(lex) +} + +func ParseFileWithData(fpath string, userData interface{}) (interface{}, error) { + if lexer, err := NewLexerFile(fpath); err == nil { + return NewParser().SetContext(userData).Parse(lexer) + } else { + return nil, err + } +} + +func ParseTextWithData(text string, userData interface{}) (interface{}, error) { + return NewParser().SetContext(userData).Parse(NewLexerBytes([]byte(text))) +} + +func ParseWithData(stream io.Reader, userData interface{}) (interface{}, error) { + lex, err := NewLexer(stream) + if lex == nil { + return nil, err + } + return NewParser().SetContext(userData).Parse(lex) +} + +func ParseFilePartial(fpath string) (interface{}, error, []byte) { + if lexer, err := NewLexerFile(fpath); err == nil { + return NewParser().ParseLongestPrefix(lexer) + } else { + return nil, err, []byte{} + } +} + +func ParseTextPartial(text string) (interface{}, error, []byte) { + return NewParser().ParseLongestPrefix(NewLexerBytes([]byte(text))) +} + +func ParsePartial(stream io.Reader) (interface{}, error, []byte) { + lex, err := NewLexer(stream) + if lex == nil { + return nil, err, []byte{} + } + return NewParser().ParseLongestPrefix(lex) +} + +func ParseFileWithDataPartial(fpath string, userData interface{}) (interface{}, error, []byte) { + if lexer, err := NewLexerFile(fpath); err == nil { + return NewParser().SetContext(userData).ParseLongestPrefix(lexer) + } else { + return nil, err, []byte{} + } +} + +func ParseTextWithDataPartial(text string, userData interface{}) (interface{}, error, []byte) { + return NewParser().SetContext(userData).ParseLongestPrefix(NewLexerBytes([]byte(text))) +} + +func ParseWithDataPartial(stream io.Reader, userData interface{}) (interface{}, error, []byte) { + lex, err := NewLexer(stream) + if lex == nil { + return nil, err, []byte{} + } + return NewParser().SetContext(userData).ParseLongestPrefix(lex) +} + +func NewLexerBytes(src []byte) *lexer.Lexer { + return lexer.NewLexerBytes(src) +} + +func NewLexerString(src string) *lexer.Lexer { + return lexer.NewLexerBytes([]byte(src)) +} + +func NewLexerFile(fpath string) (*lexer.Lexer, error) { + return lexer.NewLexerFile(fpath) +} + +func NewLexer(reader io.Reader) (*lexer.Lexer, error) { + return lexer.NewLexer(reader) +} + +func GetTokenMap() TokenMap { + return token.TokMap +} diff --git a/example/macro/macro2.grammar/macro2/main/macro2.go b/example/macro/macro2.grammar/macro2/main/macro2.go new file mode 100644 index 00000000..5d61883d --- /dev/null +++ b/example/macro/macro2.grammar/macro2/main/macro2.go @@ -0,0 +1,58 @@ +package main + +import ( + "flag" + "fmt" + "os" + "strings" + + macro2 "github.com/maxcalandrelli/gocc/example/macro/macro2.grammar/macro2" +) + +func showResult(r interface{}, e error, p []byte) { + if e != nil { + fmt.Fprintf(os.Stderr, "parsing returned the following error: %s\n", e.Error()) + } else { + if len(p) > 0 { + fmt.Printf("r=%#v, (%s)\n", r, string(p)) + } else { + fmt.Printf("r=%#v\n", r) + } + } +} + +var ( + File string + Text string + Longest bool +) + +func parse(longest bool, lex *macro2.Lexer) (res interface{}, err error, parsed []byte) { + if longest { + return macro2.NewParser().ParseLongestPrefix(lex) + } else { + res, err = macro2.NewParser().Parse(lex) + parsed = []byte{} + } + return +} + +func main() { + flag.StringVar(&File, "file", "", "parse also text in file") + flag.StringVar(&Text, "text", "", "parse also text given with flag") + flag.BoolVar(&Longest, "longest", false, "parse longest possible part") + flag.Parse() + if Text > "" { + showResult(parse(Longest, macro2.NewLexerString(Text))) + } + if File > "" { + l, e := macro2.NewLexerFile(File) + if e != nil { + panic(e) + } + showResult(parse(Longest, l)) + } + if str := strings.Join(flag.Args(), " "); str > "" { + showResult(parse(Longest, macro2.NewLexerString(str))) + } +} diff --git a/example/macro/macro2.grammar/macro2/util.go b/example/macro/macro2.grammar/macro2/util.go new file mode 100644 index 00000000..f0697f96 --- /dev/null +++ b/example/macro/macro2.grammar/macro2/util.go @@ -0,0 +1,25 @@ +// Code generated by gocc; DO NOT EDIT. + +package macro2 + +import ( + "github.com/maxcalandrelli/gocc/example/macro/macro2.grammar/macro2/internal/util" +) + +type EscapedString = util.EscapedString + +func RuneToString(r rune) string { + return util.RuneToString(r) +} + +func HexDigitValue(ch rune) int { + return util.HexDigitValue(ch) +} + +func IntValue(lit []byte) (int64, error) { + return util.IntValue(lit) +} + +func UintValue(lit []byte) (uint64, error) { + return util.UintValue(lit) +} diff --git a/internal/config/config.go b/internal/config/config.go index 0b0241bc..4f928db9 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -27,11 +27,11 @@ import ( ) const ( - VERSION = "2.1.0001" + VERSION = "2.1.1001" INTERNAL_SYMBOL_EMPTY = "ε" - INTERNAL_SYMBOL_ERROR = "λ" // (λάθος) - INTERNAL_SYMBOL_INVALID = "INVALID" // (άκυρος) + INTERNAL_SYMBOL_ERROR = "λ" + INTERNAL_SYMBOL_INVALID = "INVALID" INTERNAL_SYMBOL_EOF = "Ω" INTERNAL_SYMBOL_PROD = "Π" INTERNAL_SYMBOL_LIT = "Λ" @@ -64,6 +64,7 @@ type ( ProjectName() string Package() string + PreProcessor() string PrintParams() @@ -88,6 +89,7 @@ type ( internal string verbose *bool bug_options bugOptions + preprocessor string } ) @@ -227,6 +229,10 @@ func (this *ConfigRecord) Package() string { return this.pkg } +func (this *ConfigRecord) PreProcessor() string { + return this.preprocessor +} + func (this *ConfigRecord) ProjectName() string { _, file := path.Split(this.srcFile) file = file[:len(file)-len(path.Ext(file))] @@ -255,6 +261,7 @@ func (this *ConfigRecord) PrintParams() { fmt.Printf("-v = %v\n", *this.verbose) fmt.Printf("-internal = %v\n", this.internal) fmt.Printf("-bugs = %v\n", this.bug_options.String()) + fmt.Printf("-preprocessor = %v\n", this.preprocessor) } /*** Utility routines ***/ @@ -296,6 +303,7 @@ func (this *ConfigRecord) getFlags() error { flag.StringVar(&this.outDir, "o", path.Join(this.workingDir, "@f.grammar", "@f"), "output directory format (@f='name' if input file is 'name.bnf')") flag.StringVar(&this.pkg, "p", "", "package, empty defaults to "+defaultPackage(this.outDir)) flag.StringVar(&this.internal, "internal", "internal", "internal subdir name") + flag.StringVar(&this.preprocessor, "preprocessor", "none", "preprocessor: 'none','internal', or any command string with placeholders @in and @out") flag.Var(this.bug_options, "bugs", "handle bugs in original implementation (default: fix all)"+bugsHelp(" ")) this.allowUnreachable = flag.Bool("u", false, "allow unreachable productions") this.verbose = flag.Bool("v", false, "verbose") diff --git a/internal/frontend/reparsed/internal/parser/actiontable.go b/internal/frontend/reparsed/internal/parser/actiontable.go index 429dd21a..04638d23 100644 --- a/internal/frontend/reparsed/internal/parser/actiontable.go +++ b/internal/frontend/reparsed/internal/parser/actiontable.go @@ -1296,7 +1296,7 @@ var parserActions = actions{ nil, // "]" nil, // "{" nil, // "}" - nil, // g_sdt_lit + shift(92), // g_sdt_lit nil, // prodId nil, // string_lit nil, // g_ctxdep_lit @@ -1313,12 +1313,12 @@ var parserActions = actions{ actions: [numSymbols]action{ nil, // ά nil, // Ω - reduce(38), // tokId, reduce: Symbols + reduce(39), // tokId, reduce: Symbols nil, // ":" - reduce(38), // ";", reduce: Symbols + reduce(39), // ";", reduce: Symbols nil, // regDefId nil, // ignoredTokId - reduce(38), // "|", reduce: Symbols + reduce(39), // "|", reduce: Symbols nil, // "." nil, // char_lit nil, // "-" @@ -1329,11 +1329,11 @@ var parserActions = actions{ nil, // "]" nil, // "{" nil, // "}" - reduce(38), // g_sdt_lit, reduce: Symbols - reduce(38), // prodId, reduce: Symbols - reduce(38), // string_lit, reduce: Symbols + reduce(39), // g_sdt_lit, reduce: Symbols + reduce(39), // prodId, reduce: Symbols + reduce(39), // string_lit, reduce: Symbols nil, // g_ctxdep_lit - reduce(38), // "@", reduce: Symbols + reduce(39), // "@", reduce: Symbols nil, // "error" nil, // "λ" nil, // "empty" @@ -1346,12 +1346,12 @@ var parserActions = actions{ actions: [numSymbols]action{ nil, // ά nil, // Ω - reduce(41), // tokId, reduce: Symbol + reduce(42), // tokId, reduce: Symbol nil, // ":" - reduce(41), // ";", reduce: Symbol + reduce(42), // ";", reduce: Symbol nil, // regDefId nil, // ignoredTokId - reduce(41), // "|", reduce: Symbol + reduce(42), // "|", reduce: Symbol nil, // "." nil, // char_lit nil, // "-" @@ -1362,11 +1362,11 @@ var parserActions = actions{ nil, // "]" nil, // "{" nil, // "}" - reduce(41), // g_sdt_lit, reduce: Symbol - reduce(41), // prodId, reduce: Symbol - reduce(41), // string_lit, reduce: Symbol - shift(92), // g_ctxdep_lit - reduce(41), // "@", reduce: Symbol + reduce(42), // g_sdt_lit, reduce: Symbol + reduce(42), // prodId, reduce: Symbol + reduce(42), // string_lit, reduce: Symbol + shift(93), // g_ctxdep_lit + reduce(42), // "@", reduce: Symbol nil, // "error" nil, // "λ" nil, // "empty" @@ -1379,12 +1379,12 @@ var parserActions = actions{ actions: [numSymbols]action{ nil, // ά nil, // Ω - reduce(40), // tokId, reduce: Symbol + reduce(41), // tokId, reduce: Symbol nil, // ":" - reduce(40), // ";", reduce: Symbol + reduce(41), // ";", reduce: Symbol nil, // regDefId nil, // ignoredTokId - reduce(40), // "|", reduce: Symbol + reduce(41), // "|", reduce: Symbol nil, // "." nil, // char_lit nil, // "-" @@ -1395,11 +1395,11 @@ var parserActions = actions{ nil, // "]" nil, // "{" nil, // "}" - reduce(40), // g_sdt_lit, reduce: Symbol - reduce(40), // prodId, reduce: Symbol - reduce(40), // string_lit, reduce: Symbol + reduce(41), // g_sdt_lit, reduce: Symbol + reduce(41), // prodId, reduce: Symbol + reduce(41), // string_lit, reduce: Symbol nil, // g_ctxdep_lit - reduce(40), // "@", reduce: Symbol + reduce(41), // "@", reduce: Symbol nil, // "error" nil, // "λ" nil, // "empty" @@ -1412,12 +1412,12 @@ var parserActions = actions{ actions: [numSymbols]action{ nil, // ά nil, // Ω - reduce(42), // tokId, reduce: Symbol + reduce(43), // tokId, reduce: Symbol nil, // ":" - reduce(42), // ";", reduce: Symbol + reduce(43), // ";", reduce: Symbol nil, // regDefId nil, // ignoredTokId - reduce(42), // "|", reduce: Symbol + reduce(43), // "|", reduce: Symbol nil, // "." nil, // char_lit nil, // "-" @@ -1428,11 +1428,11 @@ var parserActions = actions{ nil, // "]" nil, // "{" nil, // "}" - reduce(42), // g_sdt_lit, reduce: Symbol - reduce(42), // prodId, reduce: Symbol - reduce(42), // string_lit, reduce: Symbol + reduce(43), // g_sdt_lit, reduce: Symbol + reduce(43), // prodId, reduce: Symbol + reduce(43), // string_lit, reduce: Symbol nil, // g_ctxdep_lit - reduce(42), // "@", reduce: Symbol + reduce(43), // "@", reduce: Symbol nil, // "error" nil, // "λ" nil, // "empty" @@ -1445,7 +1445,7 @@ var parserActions = actions{ actions: [numSymbols]action{ nil, // ά nil, // Ω - shift(93), // tokId + shift(94), // tokId nil, // ":" nil, // ";" nil, // regDefId @@ -1463,7 +1463,7 @@ var parserActions = actions{ nil, // "}" nil, // g_sdt_lit nil, // prodId - shift(94), // string_lit + shift(95), // string_lit nil, // g_ctxdep_lit nil, // "@" nil, // "error" @@ -1478,12 +1478,12 @@ var parserActions = actions{ actions: [numSymbols]action{ nil, // ά nil, // Ω - reduce(46), // tokId, reduce: ErrorSymbol + reduce(47), // tokId, reduce: ErrorSymbol nil, // ":" - reduce(46), // ";", reduce: ErrorSymbol + reduce(47), // ";", reduce: ErrorSymbol nil, // regDefId nil, // ignoredTokId - reduce(46), // "|", reduce: ErrorSymbol + reduce(47), // "|", reduce: ErrorSymbol nil, // "." nil, // char_lit nil, // "-" @@ -1494,11 +1494,11 @@ var parserActions = actions{ nil, // "]" nil, // "{" nil, // "}" - reduce(46), // g_sdt_lit, reduce: ErrorSymbol - reduce(46), // prodId, reduce: ErrorSymbol - reduce(46), // string_lit, reduce: ErrorSymbol + reduce(47), // g_sdt_lit, reduce: ErrorSymbol + reduce(47), // prodId, reduce: ErrorSymbol + reduce(47), // string_lit, reduce: ErrorSymbol nil, // g_ctxdep_lit - reduce(46), // "@", reduce: ErrorSymbol + reduce(47), // "@", reduce: ErrorSymbol nil, // "error" nil, // "λ" nil, // "empty" @@ -1511,12 +1511,12 @@ var parserActions = actions{ actions: [numSymbols]action{ nil, // ά nil, // Ω - reduce(47), // tokId, reduce: ErrorSymbol + reduce(48), // tokId, reduce: ErrorSymbol nil, // ":" - reduce(47), // ";", reduce: ErrorSymbol + reduce(48), // ";", reduce: ErrorSymbol nil, // regDefId nil, // ignoredTokId - reduce(47), // "|", reduce: ErrorSymbol + reduce(48), // "|", reduce: ErrorSymbol nil, // "." nil, // char_lit nil, // "-" @@ -1527,11 +1527,11 @@ var parserActions = actions{ nil, // "]" nil, // "{" nil, // "}" - reduce(47), // g_sdt_lit, reduce: ErrorSymbol - reduce(47), // prodId, reduce: ErrorSymbol - reduce(47), // string_lit, reduce: ErrorSymbol + reduce(48), // g_sdt_lit, reduce: ErrorSymbol + reduce(48), // prodId, reduce: ErrorSymbol + reduce(48), // string_lit, reduce: ErrorSymbol nil, // g_ctxdep_lit - reduce(47), // "@", reduce: ErrorSymbol + reduce(48), // "@", reduce: ErrorSymbol nil, // "error" nil, // "λ" nil, // "empty" @@ -1546,10 +1546,10 @@ var parserActions = actions{ nil, // Ω nil, // tokId nil, // ":" - reduce(48), // ";", reduce: EpsilonSymbol + reduce(49), // ";", reduce: EpsilonSymbol nil, // regDefId nil, // ignoredTokId - reduce(48), // "|", reduce: EpsilonSymbol + reduce(49), // "|", reduce: EpsilonSymbol nil, // "." nil, // char_lit nil, // "-" @@ -1560,7 +1560,7 @@ var parserActions = actions{ nil, // "]" nil, // "{" nil, // "}" - nil, // g_sdt_lit + reduce(49), // g_sdt_lit, reduce: EpsilonSymbol nil, // prodId nil, // string_lit nil, // g_ctxdep_lit @@ -1579,10 +1579,10 @@ var parserActions = actions{ nil, // Ω nil, // tokId nil, // ":" - reduce(49), // ";", reduce: EpsilonSymbol + reduce(50), // ";", reduce: EpsilonSymbol nil, // regDefId nil, // ignoredTokId - reduce(49), // "|", reduce: EpsilonSymbol + reduce(50), // "|", reduce: EpsilonSymbol nil, // "." nil, // char_lit nil, // "-" @@ -1593,7 +1593,7 @@ var parserActions = actions{ nil, // "]" nil, // "{" nil, // "}" - nil, // g_sdt_lit + reduce(50), // g_sdt_lit, reduce: EpsilonSymbol nil, // prodId nil, // string_lit nil, // g_ctxdep_lit @@ -1716,7 +1716,7 @@ var parserActions = actions{ nil, // ignoredTokId nil, // "|" nil, // "." - shift(96), // char_lit + shift(97), // char_lit nil, // "-" nil, // "~" nil, // "(" @@ -1782,7 +1782,7 @@ var parserActions = actions{ nil, // ignoredTokId nil, // "|" nil, // "." - shift(97), // char_lit + shift(98), // char_lit nil, // "-" nil, // "~" nil, // "(" @@ -1806,33 +1806,33 @@ var parserActions = actions{ actionRow{ // S54 canRecover: false, actions: [numSymbols]action{ - nil, // ά - nil, // Ω - nil, // tokId - nil, // ":" - nil, // ";" - nil, // regDefId - nil, // ignoredTokId - shift(98), // "|" - nil, // "." - nil, // char_lit - nil, // "-" - nil, // "~" - nil, // "(" - shift(99), // ")" - nil, // "[" - nil, // "]" - nil, // "{" - nil, // "}" - nil, // g_sdt_lit - nil, // prodId - nil, // string_lit - nil, // g_ctxdep_lit - nil, // "@" - nil, // "error" - nil, // "λ" - nil, // "empty" - nil, // "ε" + nil, // ά + nil, // Ω + nil, // tokId + nil, // ":" + nil, // ";" + nil, // regDefId + nil, // ignoredTokId + shift(99), // "|" + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + shift(100), // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit + nil, // g_ctxdep_lit + nil, // "@" + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" }, cdActions: []cdAction{}, }, @@ -1981,7 +1981,7 @@ var parserActions = actions{ reduce(15), // "|", reduce: LexTerm reduce(15), // ".", reduce: LexTerm reduce(15), // char_lit, reduce: LexTerm - shift(101), // "-" + shift(102), // "-" reduce(15), // "~", reduce: LexTerm reduce(15), // "(", reduce: LexTerm reduce(15), // ")", reduce: LexTerm @@ -2013,10 +2013,10 @@ var parserActions = actions{ nil, // ignoredTokId nil, // "|" nil, // "." - shift(102), // char_lit + shift(103), // char_lit nil, // "-" nil, // "~" - shift(103), // "(" + shift(104), // "(" nil, // ")" nil, // "[" nil, // "]" @@ -2143,7 +2143,7 @@ var parserActions = actions{ nil, // ";" nil, // regDefId nil, // ignoredTokId - shift(107), // "|" + shift(108), // "|" nil, // "." nil, // char_lit nil, // "-" @@ -2151,7 +2151,7 @@ var parserActions = actions{ nil, // "(" nil, // ")" nil, // "[" - shift(108), // "]" + shift(109), // "]" nil, // "{" nil, // "}" nil, // g_sdt_lit @@ -2311,7 +2311,7 @@ var parserActions = actions{ reduce(15), // "|", reduce: LexTerm reduce(15), // ".", reduce: LexTerm reduce(15), // char_lit, reduce: LexTerm - shift(110), // "-" + shift(111), // "-" reduce(15), // "~", reduce: LexTerm reduce(15), // "(", reduce: LexTerm nil, // ")" @@ -2343,10 +2343,10 @@ var parserActions = actions{ nil, // ignoredTokId nil, // "|" nil, // "." - shift(111), // char_lit + shift(112), // char_lit nil, // "-" nil, // "~" - shift(112), // "(" + shift(113), // "(" nil, // ")" nil, // "[" nil, // "]" @@ -2473,7 +2473,7 @@ var parserActions = actions{ nil, // ";" nil, // regDefId nil, // ignoredTokId - shift(116), // "|" + shift(117), // "|" nil, // "." nil, // char_lit nil, // "-" @@ -2483,7 +2483,7 @@ var parserActions = actions{ nil, // "[" nil, // "]" nil, // "{" - shift(117), // "}" + shift(118), // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit @@ -2641,7 +2641,7 @@ var parserActions = actions{ reduce(15), // "|", reduce: LexTerm reduce(15), // ".", reduce: LexTerm reduce(15), // char_lit, reduce: LexTerm - shift(119), // "-" + shift(120), // "-" reduce(15), // "~", reduce: LexTerm reduce(15), // "(", reduce: LexTerm nil, // ")" @@ -2673,10 +2673,10 @@ var parserActions = actions{ nil, // ignoredTokId nil, // "|" nil, // "." - shift(120), // char_lit + shift(121), // char_lit nil, // "-" nil, // "~" - shift(121), // "(" + shift(122), // "(" nil, // ")" nil, // "[" nil, // "]" @@ -2930,12 +2930,12 @@ var parserActions = actions{ actions: [numSymbols]action{ nil, // ά nil, // Ω - reduce(39), // tokId, reduce: Symbols + reduce(40), // tokId, reduce: Symbols nil, // ":" - reduce(39), // ";", reduce: Symbols + reduce(40), // ";", reduce: Symbols nil, // regDefId nil, // ignoredTokId - reduce(39), // "|", reduce: Symbols + reduce(40), // "|", reduce: Symbols nil, // "." nil, // char_lit nil, // "-" @@ -2946,11 +2946,11 @@ var parserActions = actions{ nil, // "]" nil, // "{" nil, // "}" - reduce(39), // g_sdt_lit, reduce: Symbols - reduce(39), // prodId, reduce: Symbols - reduce(39), // string_lit, reduce: Symbols + reduce(40), // g_sdt_lit, reduce: Symbols + reduce(40), // prodId, reduce: Symbols + reduce(40), // string_lit, reduce: Symbols nil, // g_ctxdep_lit - reduce(39), // "@", reduce: Symbols + reduce(40), // "@", reduce: Symbols nil, // "error" nil, // "λ" nil, // "empty" @@ -3012,7 +3012,7 @@ var parserActions = actions{ nil, // "]" nil, // "{" nil, // "}" - shift(126), // g_sdt_lit + shift(127), // g_sdt_lit shift(41), // prodId shift(42), // string_lit nil, // g_ctxdep_lit @@ -3062,12 +3062,12 @@ var parserActions = actions{ actions: [numSymbols]action{ nil, // ά nil, // Ω - reduce(43), // tokId, reduce: Symbol + nil, // tokId nil, // ":" - reduce(43), // ";", reduce: Symbol + reduce(38), // ";", reduce: SyntaxBody nil, // regDefId nil, // ignoredTokId - reduce(43), // "|", reduce: Symbol + reduce(38), // "|", reduce: SyntaxBody nil, // "." nil, // char_lit nil, // "-" @@ -3078,11 +3078,11 @@ var parserActions = actions{ nil, // "]" nil, // "{" nil, // "}" - reduce(43), // g_sdt_lit, reduce: Symbol - reduce(43), // prodId, reduce: Symbol - reduce(43), // string_lit, reduce: Symbol + nil, // g_sdt_lit + nil, // prodId + nil, // string_lit nil, // g_ctxdep_lit - reduce(43), // "@", reduce: Symbol + nil, // "@" nil, // "error" nil, // "λ" nil, // "empty" @@ -3091,6 +3091,39 @@ var parserActions = actions{ cdActions: []cdAction{}, }, actionRow{ // S93 + canRecover: false, + actions: [numSymbols]action{ + nil, // ά + nil, // Ω + reduce(44), // tokId, reduce: Symbol + nil, // ":" + reduce(44), // ";", reduce: Symbol + nil, // regDefId + nil, // ignoredTokId + reduce(44), // "|", reduce: Symbol + nil, // "." + nil, // char_lit + nil, // "-" + nil, // "~" + nil, // "(" + nil, // ")" + nil, // "[" + nil, // "]" + nil, // "{" + nil, // "}" + reduce(44), // g_sdt_lit, reduce: Symbol + reduce(44), // prodId, reduce: Symbol + reduce(44), // string_lit, reduce: Symbol + nil, // g_ctxdep_lit + reduce(44), // "@", reduce: Symbol + nil, // "error" + nil, // "λ" + nil, // "empty" + nil, // "ε" + }, + cdActions: []cdAction{}, + }, + actionRow{ // S94 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3113,7 +3146,7 @@ var parserActions = actions{ nil, // "}" nil, // g_sdt_lit nil, // prodId - shift(127), // string_lit + shift(128), // string_lit nil, // g_ctxdep_lit nil, // "@" nil, // "error" @@ -3123,17 +3156,17 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S94 + actionRow{ // S95 canRecover: false, actions: [numSymbols]action{ nil, // ά nil, // Ω - reduce(45), // tokId, reduce: Symbol + reduce(46), // tokId, reduce: Symbol nil, // ":" - reduce(45), // ";", reduce: Symbol + reduce(46), // ";", reduce: Symbol nil, // regDefId nil, // ignoredTokId - reduce(45), // "|", reduce: Symbol + reduce(46), // "|", reduce: Symbol nil, // "." nil, // char_lit nil, // "-" @@ -3144,11 +3177,11 @@ var parserActions = actions{ nil, // "]" nil, // "{" nil, // "}" - reduce(45), // g_sdt_lit, reduce: Symbol - reduce(45), // prodId, reduce: Symbol - reduce(45), // string_lit, reduce: Symbol + reduce(46), // g_sdt_lit, reduce: Symbol + reduce(46), // prodId, reduce: Symbol + reduce(46), // string_lit, reduce: Symbol nil, // g_ctxdep_lit - reduce(45), // "@", reduce: Symbol + reduce(46), // "@", reduce: Symbol nil, // "error" nil, // "λ" nil, // "empty" @@ -3156,7 +3189,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S95 + actionRow{ // S96 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3189,7 +3222,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S96 + actionRow{ // S97 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3222,7 +3255,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S97 + actionRow{ // S98 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3235,7 +3268,7 @@ var parserActions = actions{ nil, // "|" nil, // "." nil, // char_lit - shift(128), // "-" + shift(129), // "-" nil, // "~" nil, // "(" nil, // ")" @@ -3255,7 +3288,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S98 + actionRow{ // S99 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3288,7 +3321,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S99 + actionRow{ // S100 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3321,7 +3354,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S100 + actionRow{ // S101 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3354,7 +3387,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S101 + actionRow{ // S102 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3366,7 +3399,7 @@ var parserActions = actions{ nil, // ignoredTokId nil, // "|" nil, // "." - shift(130), // char_lit + shift(131), // char_lit nil, // "-" nil, // "~" nil, // "(" @@ -3387,7 +3420,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S102 + actionRow{ // S103 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3420,7 +3453,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S103 + actionRow{ // S104 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3432,7 +3465,7 @@ var parserActions = actions{ nil, // ignoredTokId nil, // "|" nil, // "." - shift(131), // char_lit + shift(132), // char_lit nil, // "-" nil, // "~" nil, // "(" @@ -3453,7 +3486,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S104 + actionRow{ // S105 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3463,13 +3496,13 @@ var parserActions = actions{ nil, // ";" nil, // regDefId nil, // ignoredTokId - shift(98), // "|" + shift(99), // "|" nil, // "." nil, // char_lit nil, // "-" nil, // "~" nil, // "(" - shift(132), // ")" + shift(133), // ")" nil, // "[" nil, // "]" nil, // "{" @@ -3486,7 +3519,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S105 + actionRow{ // S106 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3496,7 +3529,7 @@ var parserActions = actions{ nil, // ";" nil, // regDefId nil, // ignoredTokId - shift(107), // "|" + shift(108), // "|" nil, // "." nil, // char_lit nil, // "-" @@ -3504,7 +3537,7 @@ var parserActions = actions{ nil, // "(" nil, // ")" nil, // "[" - shift(133), // "]" + shift(134), // "]" nil, // "{" nil, // "}" nil, // g_sdt_lit @@ -3519,7 +3552,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S106 + actionRow{ // S107 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3529,7 +3562,7 @@ var parserActions = actions{ nil, // ";" nil, // regDefId nil, // ignoredTokId - shift(116), // "|" + shift(117), // "|" nil, // "." nil, // char_lit nil, // "-" @@ -3539,7 +3572,7 @@ var parserActions = actions{ nil, // "[" nil, // "]" nil, // "{" - shift(134), // "}" + shift(135), // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit @@ -3552,7 +3585,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S107 + actionRow{ // S108 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3585,7 +3618,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S108 + actionRow{ // S109 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3618,7 +3651,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S109 + actionRow{ // S110 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3651,7 +3684,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S110 + actionRow{ // S111 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3663,7 +3696,7 @@ var parserActions = actions{ nil, // ignoredTokId nil, // "|" nil, // "." - shift(136), // char_lit + shift(137), // char_lit nil, // "-" nil, // "~" nil, // "(" @@ -3684,7 +3717,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S111 + actionRow{ // S112 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3717,7 +3750,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S112 + actionRow{ // S113 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3729,7 +3762,7 @@ var parserActions = actions{ nil, // ignoredTokId nil, // "|" nil, // "." - shift(137), // char_lit + shift(138), // char_lit nil, // "-" nil, // "~" nil, // "(" @@ -3750,7 +3783,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S113 + actionRow{ // S114 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3760,13 +3793,13 @@ var parserActions = actions{ nil, // ";" nil, // regDefId nil, // ignoredTokId - shift(98), // "|" + shift(99), // "|" nil, // "." nil, // char_lit nil, // "-" nil, // "~" nil, // "(" - shift(138), // ")" + shift(139), // ")" nil, // "[" nil, // "]" nil, // "{" @@ -3783,7 +3816,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S114 + actionRow{ // S115 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3793,7 +3826,7 @@ var parserActions = actions{ nil, // ";" nil, // regDefId nil, // ignoredTokId - shift(107), // "|" + shift(108), // "|" nil, // "." nil, // char_lit nil, // "-" @@ -3801,7 +3834,7 @@ var parserActions = actions{ nil, // "(" nil, // ")" nil, // "[" - shift(139), // "]" + shift(140), // "]" nil, // "{" nil, // "}" nil, // g_sdt_lit @@ -3816,7 +3849,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S115 + actionRow{ // S116 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3826,7 +3859,7 @@ var parserActions = actions{ nil, // ";" nil, // regDefId nil, // ignoredTokId - shift(116), // "|" + shift(117), // "|" nil, // "." nil, // char_lit nil, // "-" @@ -3836,7 +3869,7 @@ var parserActions = actions{ nil, // "[" nil, // "]" nil, // "{" - shift(140), // "}" + shift(141), // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit @@ -3849,7 +3882,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S116 + actionRow{ // S117 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3882,7 +3915,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S117 + actionRow{ // S118 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3915,7 +3948,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S118 + actionRow{ // S119 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3948,7 +3981,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S119 + actionRow{ // S120 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -3960,7 +3993,7 @@ var parserActions = actions{ nil, // ignoredTokId nil, // "|" nil, // "." - shift(142), // char_lit + shift(143), // char_lit nil, // "-" nil, // "~" nil, // "(" @@ -3981,7 +4014,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S120 + actionRow{ // S121 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -4014,7 +4047,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S121 + actionRow{ // S122 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -4026,7 +4059,7 @@ var parserActions = actions{ nil, // ignoredTokId nil, // "|" nil, // "." - shift(143), // char_lit + shift(144), // char_lit nil, // "-" nil, // "~" nil, // "(" @@ -4047,7 +4080,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S122 + actionRow{ // S123 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -4057,13 +4090,13 @@ var parserActions = actions{ nil, // ";" nil, // regDefId nil, // ignoredTokId - shift(98), // "|" + shift(99), // "|" nil, // "." nil, // char_lit nil, // "-" nil, // "~" nil, // "(" - shift(144), // ")" + shift(145), // ")" nil, // "[" nil, // "]" nil, // "{" @@ -4080,7 +4113,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S123 + actionRow{ // S124 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -4090,7 +4123,7 @@ var parserActions = actions{ nil, // ";" nil, // regDefId nil, // ignoredTokId - shift(107), // "|" + shift(108), // "|" nil, // "." nil, // char_lit nil, // "-" @@ -4098,7 +4131,7 @@ var parserActions = actions{ nil, // "(" nil, // ")" nil, // "[" - shift(145), // "]" + shift(146), // "]" nil, // "{" nil, // "}" nil, // g_sdt_lit @@ -4113,7 +4146,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S124 + actionRow{ // S125 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -4123,7 +4156,7 @@ var parserActions = actions{ nil, // ";" nil, // regDefId nil, // ignoredTokId - shift(116), // "|" + shift(117), // "|" nil, // "." nil, // char_lit nil, // "-" @@ -4133,7 +4166,7 @@ var parserActions = actions{ nil, // "[" nil, // "]" nil, // "{" - shift(146), // "}" + shift(147), // "}" nil, // g_sdt_lit nil, // prodId nil, // string_lit @@ -4146,7 +4179,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S125 + actionRow{ // S126 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -4179,7 +4212,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S126 + actionRow{ // S127 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -4212,17 +4245,17 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S127 + actionRow{ // S128 canRecover: false, actions: [numSymbols]action{ nil, // ά nil, // Ω - reduce(44), // tokId, reduce: Symbol + reduce(45), // tokId, reduce: Symbol nil, // ":" - reduce(44), // ";", reduce: Symbol + reduce(45), // ";", reduce: Symbol nil, // regDefId nil, // ignoredTokId - reduce(44), // "|", reduce: Symbol + reduce(45), // "|", reduce: Symbol nil, // "." nil, // char_lit nil, // "-" @@ -4233,11 +4266,11 @@ var parserActions = actions{ nil, // "]" nil, // "{" nil, // "}" - reduce(44), // g_sdt_lit, reduce: Symbol - reduce(44), // prodId, reduce: Symbol - reduce(44), // string_lit, reduce: Symbol + reduce(45), // g_sdt_lit, reduce: Symbol + reduce(45), // prodId, reduce: Symbol + reduce(45), // string_lit, reduce: Symbol nil, // g_ctxdep_lit - reduce(44), // "@", reduce: Symbol + reduce(45), // "@", reduce: Symbol nil, // "error" nil, // "λ" nil, // "empty" @@ -4245,7 +4278,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S128 + actionRow{ // S129 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -4257,7 +4290,7 @@ var parserActions = actions{ nil, // ignoredTokId nil, // "|" nil, // "." - shift(147), // char_lit + shift(148), // char_lit nil, // "-" nil, // "~" nil, // "(" @@ -4278,7 +4311,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S129 + actionRow{ // S130 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -4311,7 +4344,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S130 + actionRow{ // S131 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -4344,7 +4377,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S131 + actionRow{ // S132 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -4357,7 +4390,7 @@ var parserActions = actions{ nil, // "|" nil, // "." nil, // char_lit - shift(148), // "-" + shift(149), // "-" nil, // "~" nil, // "(" nil, // ")" @@ -4377,7 +4410,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S132 + actionRow{ // S133 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -4410,7 +4443,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S133 + actionRow{ // S134 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -4443,7 +4476,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S134 + actionRow{ // S135 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -4476,7 +4509,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S135 + actionRow{ // S136 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -4509,7 +4542,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S136 + actionRow{ // S137 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -4542,7 +4575,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S137 + actionRow{ // S138 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -4555,7 +4588,7 @@ var parserActions = actions{ nil, // "|" nil, // "." nil, // char_lit - shift(149), // "-" + shift(150), // "-" nil, // "~" nil, // "(" nil, // ")" @@ -4575,7 +4608,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S138 + actionRow{ // S139 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -4608,7 +4641,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S139 + actionRow{ // S140 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -4641,7 +4674,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S140 + actionRow{ // S141 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -4674,7 +4707,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S141 + actionRow{ // S142 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -4707,7 +4740,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S142 + actionRow{ // S143 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -4740,7 +4773,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S143 + actionRow{ // S144 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -4753,7 +4786,7 @@ var parserActions = actions{ nil, // "|" nil, // "." nil, // char_lit - shift(150), // "-" + shift(151), // "-" nil, // "~" nil, // "(" nil, // ")" @@ -4773,7 +4806,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S144 + actionRow{ // S145 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -4806,7 +4839,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S145 + actionRow{ // S146 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -4839,7 +4872,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S146 + actionRow{ // S147 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -4872,7 +4905,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S147 + actionRow{ // S148 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -4888,7 +4921,7 @@ var parserActions = actions{ nil, // "-" nil, // "~" nil, // "(" - shift(151), // ")" + shift(152), // ")" nil, // "[" nil, // "]" nil, // "{" @@ -4905,7 +4938,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S148 + actionRow{ // S149 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -4917,7 +4950,7 @@ var parserActions = actions{ nil, // ignoredTokId nil, // "|" nil, // "." - shift(152), // char_lit + shift(153), // char_lit nil, // "-" nil, // "~" nil, // "(" @@ -4938,7 +4971,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S149 + actionRow{ // S150 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -4950,7 +4983,7 @@ var parserActions = actions{ nil, // ignoredTokId nil, // "|" nil, // "." - shift(153), // char_lit + shift(154), // char_lit nil, // "-" nil, // "~" nil, // "(" @@ -4971,7 +5004,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S150 + actionRow{ // S151 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -4983,7 +5016,7 @@ var parserActions = actions{ nil, // ignoredTokId nil, // "|" nil, // "." - shift(154), // char_lit + shift(155), // char_lit nil, // "-" nil, // "~" nil, // "(" @@ -5004,7 +5037,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S151 + actionRow{ // S152 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -5037,7 +5070,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S152 + actionRow{ // S153 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -5053,7 +5086,7 @@ var parserActions = actions{ nil, // "-" nil, // "~" nil, // "(" - shift(155), // ")" + shift(156), // ")" nil, // "[" nil, // "]" nil, // "{" @@ -5070,7 +5103,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S153 + actionRow{ // S154 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -5086,7 +5119,7 @@ var parserActions = actions{ nil, // "-" nil, // "~" nil, // "(" - shift(156), // ")" + shift(157), // ")" nil, // "[" nil, // "]" nil, // "{" @@ -5103,7 +5136,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S154 + actionRow{ // S155 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -5119,7 +5152,7 @@ var parserActions = actions{ nil, // "-" nil, // "~" nil, // "(" - shift(157), // ")" + shift(158), // ")" nil, // "[" nil, // "]" nil, // "{" @@ -5136,7 +5169,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S155 + actionRow{ // S156 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -5169,7 +5202,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S156 + actionRow{ // S157 canRecover: false, actions: [numSymbols]action{ nil, // ά @@ -5202,7 +5235,7 @@ var parserActions = actions{ }, cdActions: []cdAction{}, }, - actionRow{ // S157 + actionRow{ // S158 canRecover: false, actions: [numSymbols]action{ nil, // ά diff --git a/internal/frontend/reparsed/internal/parser/gototable.go b/internal/frontend/reparsed/internal/parser/gototable.go index bae50df7..2c3f97b4 100644 --- a/internal/frontend/reparsed/internal/parser/gototable.go +++ b/internal/frontend/reparsed/internal/parser/gototable.go @@ -998,7 +998,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 95, // Π + 96, // Π 24, // Π -1, // Π -1, // Π @@ -1119,7 +1119,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 100, // Π + 101, // Π -1, // Π -1, // Π -1, // Π @@ -1237,7 +1237,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 104, // Π + 105, // Π 55, // Π 56, // Π -1, // Π @@ -1257,7 +1257,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 105, // Π + 106, // Π 65, // Π 66, // Π -1, // Π @@ -1277,7 +1277,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 106, // Π + 107, // Π 75, // Π 76, // Π -1, // Π @@ -1319,7 +1319,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 109, // Π + 110, // Π -1, // Π -1, // Π -1, // Π @@ -1437,7 +1437,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 113, // Π + 114, // Π 55, // Π 56, // Π -1, // Π @@ -1457,7 +1457,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 114, // Π + 115, // Π 65, // Π 66, // Π -1, // Π @@ -1477,7 +1477,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 115, // Π + 116, // Π 75, // Π 76, // Π -1, // Π @@ -1519,7 +1519,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 118, // Π + 119, // Π -1, // Π -1, // Π -1, // Π @@ -1637,7 +1637,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 122, // Π + 123, // Π 55, // Π 56, // Π -1, // Π @@ -1657,7 +1657,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 123, // Π + 124, // Π 65, // Π 66, // Π -1, // Π @@ -1677,7 +1677,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 124, // Π + 125, // Π 75, // Π 76, // Π -1, // Π @@ -1764,7 +1764,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 125, // Π + 126, // Π 36, // Π 37, // Π 38, // Π @@ -1919,7 +1919,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 50, // Π + -1, // Π -1, // Π -1, // Π -1, // Π @@ -1939,7 +1939,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - -1, // Π + 50, // Π -1, // Π -1, // Π -1, // Π @@ -1978,8 +1978,8 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 129, // Π - 56, // Π + -1, // Π + -1, // Π -1, // Π -1, // Π -1, // Π @@ -1998,8 +1998,8 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - -1, // Π - -1, // Π + 130, // Π + 56, // Π -1, // Π -1, // Π -1, // Π @@ -2158,8 +2158,8 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 135, // Π - 66, // Π + -1, // Π + -1, // Π -1, // Π -1, // Π -1, // Π @@ -2178,8 +2178,8 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - -1, // Π - -1, // Π + 136, // Π + 66, // Π -1, // Π -1, // Π -1, // Π @@ -2338,8 +2338,8 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 141, // Π - 76, // Π + -1, // Π + -1, // Π -1, // Π -1, // Π -1, // Π @@ -2358,8 +2358,8 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - -1, // Π - -1, // Π + 142, // Π + 76, // Π -1, // Π -1, // Π -1, // Π @@ -2599,7 +2599,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 100, // Π + -1, // Π -1, // Π -1, // Π -1, // Π @@ -2619,7 +2619,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - -1, // Π + 101, // Π -1, // Π -1, // Π -1, // Π @@ -2719,7 +2719,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 109, // Π + -1, // Π -1, // Π -1, // Π -1, // Π @@ -2739,7 +2739,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - -1, // Π + 110, // Π -1, // Π -1, // Π -1, // Π @@ -2839,7 +2839,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - 118, // Π + -1, // Π -1, // Π -1, // Π -1, // Π @@ -2859,7 +2859,7 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π -1, // Π - -1, // Π + 119, // Π -1, // Π -1, // Π -1, // Π @@ -3170,4 +3170,24 @@ var gotoTab = gotoTable{ -1, // Π -1, // Π }, + gotoRow{ // S158 + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + -1, // Π + }, } diff --git a/internal/frontend/reparsed/internal/parser/parser.go b/internal/frontend/reparsed/internal/parser/parser.go index c51b5399..362f3016 100644 --- a/internal/frontend/reparsed/internal/parser/parser.go +++ b/internal/frontend/reparsed/internal/parser/parser.go @@ -13,8 +13,8 @@ import ( ) const ( - numProductions = 50 - numStates = 158 + numProductions = 51 + numStates = 159 numSymbols = 45 ) diff --git a/internal/frontend/reparsed/internal/parser/productionstable.go b/internal/frontend/reparsed/internal/parser/productionstable.go index 457f0307..08e8e729 100644 --- a/internal/frontend/reparsed/internal/parser/productionstable.go +++ b/internal/frontend/reparsed/internal/parser/productionstable.go @@ -2,12 +2,6 @@ package parser -import ( - "github.com/maxcalandrelli/gocc/internal/ast" -) - -// now a > b should work... - import ( "fmt" "github.com/maxcalandrelli/gocc/internal/frontend/reparsed/internal/token" @@ -15,6 +9,12 @@ import ( "strings" ) +import ( + "github.com/maxcalandrelli/gocc/internal/ast" +) + +// now a > b should work... + func getString(X Attrib) string { switch X.(type) { case *token.Token: @@ -438,11 +438,21 @@ var productionsTable = ProdTab{ return ast.NewEmptyBodyGen() }, }, + ProdTabEntry{ + String: `SyntaxBody : Π g_sdt_lit << ast.NewEmptyBodyGen() >>`, + Id: "SyntaxBody", + NTType: 13, + Index: 38, + NumSymbols: 2, + ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { + return ast.NewEmptyBodyGen() + }, + }, ProdTabEntry{ String: `Symbols : Π << ast.NewSyntaxSymbols($0) >>`, Id: "Symbols", NTType: 14, - Index: 38, + Index: 39, NumSymbols: 1, ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { return ast.NewSyntaxSymbols(X[0]) @@ -452,7 +462,7 @@ var productionsTable = ProdTab{ String: `Symbols : Π Π << ast.AddSyntaxSymbol($0, $1) >>`, Id: "Symbols", NTType: 14, - Index: 39, + Index: 40, NumSymbols: 2, ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { return ast.AddSyntaxSymbol(X[0], X[1]) @@ -462,7 +472,7 @@ var productionsTable = ProdTab{ String: `Symbol : prodId << ast.NewSyntaxProdId($0) >>`, Id: "Symbol", NTType: 17, - Index: 40, + Index: 41, NumSymbols: 1, ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { return ast.NewSyntaxProdId(X[0]) @@ -472,7 +482,7 @@ var productionsTable = ProdTab{ String: `Symbol : tokId << ast.NewTokId($0) >>`, Id: "Symbol", NTType: 17, - Index: 41, + Index: 42, NumSymbols: 1, ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { return ast.NewTokId(X[0]) @@ -482,7 +492,7 @@ var productionsTable = ProdTab{ String: `Symbol : string_lit << ast.NewStringLit($0) >>`, Id: "Symbol", NTType: 17, - Index: 42, + Index: 43, NumSymbols: 1, ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { return ast.NewStringLit(X[0]) @@ -492,7 +502,7 @@ var productionsTable = ProdTab{ String: `Symbol : tokId g_ctxdep_lit << ast.NewContextDependentTokId($0,$1) >>`, Id: "Symbol", NTType: 17, - Index: 43, + Index: 44, NumSymbols: 2, ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { return ast.NewContextDependentTokId(X[0], X[1]) @@ -502,7 +512,7 @@ var productionsTable = ProdTab{ String: `Symbol : Λ<@> tokId string_lit << ast.NewAliasedSubParser($1,$2) >>`, Id: "Symbol", NTType: 17, - Index: 44, + Index: 45, NumSymbols: 3, ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { return ast.NewAliasedSubParser(X[1], X[2]) @@ -512,7 +522,7 @@ var productionsTable = ProdTab{ String: `Symbol : Λ<@> string_lit << ast.NewSubParser($1) >>`, Id: "Symbol", NTType: 17, - Index: 45, + Index: 46, NumSymbols: 2, ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { return ast.NewSubParser(X[1]) @@ -522,7 +532,7 @@ var productionsTable = ProdTab{ String: `ErrorSymbol : Λ << >>`, Id: "ErrorSymbol", NTType: 15, - Index: 46, + Index: 47, NumSymbols: 1, ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { return X[0], nil @@ -532,7 +542,7 @@ var productionsTable = ProdTab{ String: `ErrorSymbol : Λ<λ> << >>`, Id: "ErrorSymbol", NTType: 15, - Index: 47, + Index: 48, NumSymbols: 1, ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { return X[0], nil @@ -542,7 +552,7 @@ var productionsTable = ProdTab{ String: `EpsilonSymbol : Λ << >>`, Id: "EpsilonSymbol", NTType: 16, - Index: 48, + Index: 49, NumSymbols: 1, ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { return X[0], nil @@ -552,7 +562,7 @@ var productionsTable = ProdTab{ String: `EpsilonSymbol : Λ<ε> << >>`, Id: "EpsilonSymbol", NTType: 16, - Index: 49, + Index: 50, NumSymbols: 1, ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) { return X[0], nil diff --git a/internal/frontend/reparsed/log/LR1_sets.txt b/internal/frontend/reparsed/log/LR1_sets.txt index 382d4d28..89e5d3ed 100644 --- a/internal/frontend/reparsed/log/LR1_sets.txt +++ b/internal/frontend/reparsed/log/LR1_sets.txt @@ -647,6 +647,7 @@ S21{ SyntaxBody : •Π Π g_sdt_lit «";"» SyntaxBody : •Π g_sdt_lit «";"» SyntaxBody : •Π «";"» + SyntaxBody : •Π g_sdt_lit «";"» Alternatives : •Π «"|"» Alternatives : •Π Λ<|> Π «"|"» Symbols : •Π «";"» @@ -667,6 +668,8 @@ S21{ ErrorSymbol : •Λ<λ> «g_sdt_lit» EpsilonSymbol : •Λ «";"» EpsilonSymbol : •Λ<ε> «";"» + EpsilonSymbol : •Λ «g_sdt_lit» + EpsilonSymbol : •Λ<ε> «g_sdt_lit» SyntaxBody : •Π «"|"» SyntaxBody : •Π g_sdt_lit «"|"» SyntaxBody : •Π «"|"» @@ -674,6 +677,7 @@ S21{ SyntaxBody : •Π Π g_sdt_lit «"|"» SyntaxBody : •Π g_sdt_lit «"|"» SyntaxBody : •Π «"|"» + SyntaxBody : •Π g_sdt_lit «"|"» Symbol : •prodId «";"» Symbol : •tokId «";"» Symbol : •string_lit «";"» @@ -1530,9 +1534,12 @@ Transitions: S38{ SyntaxBody : Π• «";"» + SyntaxBody : Π •g_sdt_lit «";"» SyntaxBody : Π• «"|"» + SyntaxBody : Π •g_sdt_lit «"|"» } Transitions: + g_sdt_lit -> 92 S39{ @@ -1564,7 +1571,7 @@ S40{ Symbol : tokId •g_ctxdep_lit «"|"» } Transitions: - g_ctxdep_lit -> 92 + g_ctxdep_lit -> 93 S41{ @@ -1608,8 +1615,8 @@ S43{ Symbol : Λ<@> •string_lit «"|"» } Transitions: - tokId -> 93 - string_lit -> 94 + tokId -> 94 + string_lit -> 95 S44{ @@ -1638,6 +1645,7 @@ Transitions: S46{ EpsilonSymbol : Λ• «";"» + EpsilonSymbol : Λ• «g_sdt_lit» EpsilonSymbol : Λ• «"|"» } Transitions: @@ -1645,6 +1653,7 @@ Transitions: S47{ EpsilonSymbol : Λ<ε>• «";"» + EpsilonSymbol : Λ<ε>• «g_sdt_lit» EpsilonSymbol : Λ<ε>• «"|"» } Transitions: @@ -1773,7 +1782,7 @@ Transitions: Λ<(> -> 29 Λ<[> -> 30 Λ<{> -> 31 - Π -> 95 + Π -> 96 S50{ @@ -1802,7 +1811,7 @@ S51{ LexTerm : char_lit Λ<-> •char_lit «"|"» } Transitions: - char_lit -> 96 + char_lit -> 97 S52{ @@ -1831,7 +1840,7 @@ S53{ LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «"|"» } Transitions: - char_lit -> 97 + char_lit -> 98 S54{ @@ -1848,8 +1857,8 @@ S54{ LexPattern : Π •Λ<|> Π «"|"» } Transitions: - Λ<|> -> 98 - Λ<)> -> 99 + Λ<|> -> 99 + Λ<)> -> 100 S55{ @@ -1954,7 +1963,7 @@ Transitions: Λ<(> -> 61 Λ<[> -> 62 Λ<{> -> 63 - Π -> 100 + Π -> 101 S56{ @@ -2020,7 +2029,7 @@ S59{ LexTerm : char_lit •Λ<-> char_lit «"|"» } Transitions: - Λ<-> -> 101 + Λ<-> -> 102 S60{ @@ -2044,8 +2053,8 @@ S60{ LexTerm : Λ<~> •Λ<(> char_lit Λ<-> char_lit Λ<)> «"|"» } Transitions: - char_lit -> 102 - Λ<(> -> 103 + char_lit -> 103 + Λ<(> -> 104 S61{ @@ -2172,7 +2181,7 @@ Transitions: Λ<(> -> 61 Λ<[> -> 62 Λ<{> -> 63 - Π -> 104 + Π -> 105 S62{ @@ -2299,7 +2308,7 @@ Transitions: Λ<(> -> 71 Λ<[> -> 72 Λ<{> -> 73 - Π -> 105 + Π -> 106 S63{ @@ -2426,7 +2435,7 @@ Transitions: Λ<(> -> 81 Λ<[> -> 82 Λ<{> -> 83 - Π -> 106 + Π -> 107 S64{ @@ -2443,8 +2452,8 @@ S64{ LexPattern : Π •Λ<|> Π «"|"» } Transitions: - Λ<|> -> 107 - Λ<]> -> 108 + Λ<|> -> 108 + Λ<]> -> 109 S65{ @@ -2549,7 +2558,7 @@ Transitions: Λ<(> -> 71 Λ<[> -> 72 Λ<{> -> 73 - Π -> 109 + Π -> 110 S66{ @@ -2615,7 +2624,7 @@ S69{ LexTerm : char_lit •Λ<-> char_lit «"|"» } Transitions: - Λ<-> -> 110 + Λ<-> -> 111 S70{ @@ -2639,8 +2648,8 @@ S70{ LexTerm : Λ<~> •Λ<(> char_lit Λ<-> char_lit Λ<)> «"|"» } Transitions: - char_lit -> 111 - Λ<(> -> 112 + char_lit -> 112 + Λ<(> -> 113 S71{ @@ -2767,7 +2776,7 @@ Transitions: Λ<(> -> 61 Λ<[> -> 62 Λ<{> -> 63 - Π -> 113 + Π -> 114 S72{ @@ -2894,7 +2903,7 @@ Transitions: Λ<(> -> 71 Λ<[> -> 72 Λ<{> -> 73 - Π -> 114 + Π -> 115 S73{ @@ -3021,7 +3030,7 @@ Transitions: Λ<(> -> 81 Λ<[> -> 82 Λ<{> -> 83 - Π -> 115 + Π -> 116 S74{ @@ -3038,8 +3047,8 @@ S74{ LexPattern : Π •Λ<|> Π «"|"» } Transitions: - Λ<|> -> 116 - Λ<}> -> 117 + Λ<|> -> 117 + Λ<}> -> 118 S75{ @@ -3144,7 +3153,7 @@ Transitions: Λ<(> -> 81 Λ<[> -> 82 Λ<{> -> 83 - Π -> 118 + Π -> 119 S76{ @@ -3210,7 +3219,7 @@ S79{ LexTerm : char_lit •Λ<-> char_lit «"|"» } Transitions: - Λ<-> -> 119 + Λ<-> -> 120 S80{ @@ -3234,8 +3243,8 @@ S80{ LexTerm : Λ<~> •Λ<(> char_lit Λ<-> char_lit Λ<)> «"|"» } Transitions: - char_lit -> 120 - Λ<(> -> 121 + char_lit -> 121 + Λ<(> -> 122 S81{ @@ -3362,7 +3371,7 @@ Transitions: Λ<(> -> 61 Λ<[> -> 62 Λ<{> -> 63 - Π -> 122 + Π -> 123 S82{ @@ -3489,7 +3498,7 @@ Transitions: Λ<(> -> 71 Λ<[> -> 72 Λ<{> -> 73 - Π -> 123 + Π -> 124 S83{ @@ -3616,7 +3625,7 @@ Transitions: Λ<(> -> 81 Λ<[> -> 82 Λ<{> -> 83 - Π -> 124 + Π -> 125 S84{ @@ -3658,6 +3667,7 @@ S87{ SyntaxBody : •Π Π g_sdt_lit «";"» SyntaxBody : •Π g_sdt_lit «";"» SyntaxBody : •Π «";"» + SyntaxBody : •Π g_sdt_lit «";"» SyntaxBody : •Π «"|"» SyntaxBody : •Π g_sdt_lit «"|"» SyntaxBody : •Π «"|"» @@ -3665,6 +3675,7 @@ S87{ SyntaxBody : •Π Π g_sdt_lit «"|"» SyntaxBody : •Π g_sdt_lit «"|"» SyntaxBody : •Π «"|"» + SyntaxBody : •Π g_sdt_lit «"|"» Symbols : •Π «";"» Symbols : •Π Π «";"» Symbols : •Π «g_sdt_lit» @@ -3683,6 +3694,8 @@ S87{ ErrorSymbol : •Λ<λ> «g_sdt_lit» EpsilonSymbol : •Λ «";"» EpsilonSymbol : •Λ<ε> «";"» + EpsilonSymbol : •Λ «g_sdt_lit» + EpsilonSymbol : •Λ<ε> «g_sdt_lit» Symbols : •Π «"|"» Symbols : •Π Π «"|"» ErrorSymbol : •Λ «"|"» @@ -3753,7 +3766,7 @@ Transitions: Λ<λ> -> 45 Λ -> 46 Λ<ε> -> 47 - Π -> 125 + Π -> 126 S88{ @@ -3836,7 +3849,7 @@ Transitions: string_lit -> 42 Λ<@> -> 43 Π -> 88 - g_sdt_lit -> 126 + g_sdt_lit -> 127 S91{ @@ -3847,6 +3860,13 @@ Transitions: S92{ + SyntaxBody : Π g_sdt_lit• «";"» + SyntaxBody : Π g_sdt_lit• «"|"» +} +Transitions: + + +S93{ Symbol : tokId g_ctxdep_lit• «";"» Symbol : tokId g_ctxdep_lit• «g_sdt_lit» Symbol : tokId g_ctxdep_lit• «"@"» @@ -3858,7 +3878,7 @@ S92{ Transitions: -S93{ +S94{ Symbol : Λ<@> tokId •string_lit «";"» Symbol : Λ<@> tokId •string_lit «g_sdt_lit» Symbol : Λ<@> tokId •string_lit «"@"» @@ -3868,10 +3888,10 @@ S93{ Symbol : Λ<@> tokId •string_lit «"|"» } Transitions: - string_lit -> 127 + string_lit -> 128 -S94{ +S95{ Symbol : Λ<@> string_lit• «";"» Symbol : Λ<@> string_lit• «g_sdt_lit» Symbol : Λ<@> string_lit• «"@"» @@ -3883,7 +3903,7 @@ S94{ Transitions: -S95{ +S96{ LexPattern : Π Λ<|> Π• «";"» LexPattern : Π Λ<|> Π• «"|"» LexAlt : Π •Π «";"» @@ -3988,7 +4008,7 @@ Transitions: Π -> 50 -S96{ +S97{ LexTerm : char_lit Λ<-> char_lit• «";"» LexTerm : char_lit Λ<-> char_lit• «"("» LexTerm : char_lit Λ<-> char_lit• «"."» @@ -4002,7 +4022,7 @@ S96{ Transitions: -S97{ +S98{ LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «";"» LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «"("» LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «"."» @@ -4014,10 +4034,10 @@ S97{ LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «"|"» } Transitions: - Λ<-> -> 128 + Λ<-> -> 129 -S98{ +S99{ LexPattern : Π Λ<|> •Π «")"» LexPattern : Π Λ<|> •Π «"|"» LexAlt : •Π «")"» @@ -4129,10 +4149,10 @@ Transitions: Λ<(> -> 61 Λ<[> -> 62 Λ<{> -> 63 - Π -> 129 + Π -> 130 -S99{ +S100{ LexTerm : Λ<(> Π Λ<)>• «";"» LexTerm : Λ<(> Π Λ<)>• «"("» LexTerm : Λ<(> Π Λ<)>• «"."» @@ -4146,7 +4166,7 @@ S99{ Transitions: -S100{ +S101{ LexAlt : Π Π• «")"» LexAlt : Π Π• «"("» LexAlt : Π Π• «"."» @@ -4160,7 +4180,7 @@ S100{ Transitions: -S101{ +S102{ LexTerm : char_lit Λ<-> •char_lit «")"» LexTerm : char_lit Λ<-> •char_lit «"("» LexTerm : char_lit Λ<-> •char_lit «"."» @@ -4172,10 +4192,10 @@ S101{ LexTerm : char_lit Λ<-> •char_lit «"|"» } Transitions: - char_lit -> 130 + char_lit -> 131 -S102{ +S103{ LexTerm : Λ<~> char_lit• «")"» LexTerm : Λ<~> char_lit• «"("» LexTerm : Λ<~> char_lit• «"."» @@ -4189,7 +4209,7 @@ S102{ Transitions: -S103{ +S104{ LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «")"» LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «"("» LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «"."» @@ -4201,10 +4221,10 @@ S103{ LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «"|"» } Transitions: - char_lit -> 131 + char_lit -> 132 -S104{ +S105{ LexTerm : Λ<(> Π •Λ<)> «")"» LexTerm : Λ<(> Π •Λ<)> «"("» LexTerm : Λ<(> Π •Λ<)> «"."» @@ -4218,11 +4238,11 @@ S104{ LexPattern : Π •Λ<|> Π «"|"» } Transitions: - Λ<|> -> 98 - Λ<)> -> 132 + Λ<|> -> 99 + Λ<)> -> 133 -S105{ +S106{ LexTerm : Λ<[> Π •Λ<]> «")"» LexTerm : Λ<[> Π •Λ<]> «"("» LexTerm : Λ<[> Π •Λ<]> «"."» @@ -4236,11 +4256,11 @@ S105{ LexPattern : Π •Λ<|> Π «"|"» } Transitions: - Λ<|> -> 107 - Λ<]> -> 133 + Λ<|> -> 108 + Λ<]> -> 134 -S106{ +S107{ LexTerm : Λ<{> Π •Λ<}> «")"» LexTerm : Λ<{> Π •Λ<}> «"("» LexTerm : Λ<{> Π •Λ<}> «"."» @@ -4254,11 +4274,11 @@ S106{ LexPattern : Π •Λ<|> Π «"|"» } Transitions: - Λ<|> -> 116 - Λ<}> -> 134 + Λ<|> -> 117 + Λ<}> -> 135 -S107{ +S108{ LexPattern : Π Λ<|> •Π «"]"» LexPattern : Π Λ<|> •Π «"|"» LexAlt : •Π «"]"» @@ -4370,10 +4390,10 @@ Transitions: Λ<(> -> 71 Λ<[> -> 72 Λ<{> -> 73 - Π -> 135 + Π -> 136 -S108{ +S109{ LexTerm : Λ<[> Π Λ<]>• «";"» LexTerm : Λ<[> Π Λ<]>• «"("» LexTerm : Λ<[> Π Λ<]>• «"."» @@ -4387,7 +4407,7 @@ S108{ Transitions: -S109{ +S110{ LexAlt : Π Π• «"]"» LexAlt : Π Π• «"("» LexAlt : Π Π• «"."» @@ -4401,7 +4421,7 @@ S109{ Transitions: -S110{ +S111{ LexTerm : char_lit Λ<-> •char_lit «"]"» LexTerm : char_lit Λ<-> •char_lit «"("» LexTerm : char_lit Λ<-> •char_lit «"."» @@ -4413,10 +4433,10 @@ S110{ LexTerm : char_lit Λ<-> •char_lit «"|"» } Transitions: - char_lit -> 136 + char_lit -> 137 -S111{ +S112{ LexTerm : Λ<~> char_lit• «"]"» LexTerm : Λ<~> char_lit• «"("» LexTerm : Λ<~> char_lit• «"."» @@ -4430,7 +4450,7 @@ S111{ Transitions: -S112{ +S113{ LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «"]"» LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «"("» LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «"."» @@ -4442,10 +4462,10 @@ S112{ LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «"|"» } Transitions: - char_lit -> 137 + char_lit -> 138 -S113{ +S114{ LexTerm : Λ<(> Π •Λ<)> «"]"» LexTerm : Λ<(> Π •Λ<)> «"("» LexTerm : Λ<(> Π •Λ<)> «"."» @@ -4459,11 +4479,11 @@ S113{ LexPattern : Π •Λ<|> Π «"|"» } Transitions: - Λ<|> -> 98 - Λ<)> -> 138 + Λ<|> -> 99 + Λ<)> -> 139 -S114{ +S115{ LexTerm : Λ<[> Π •Λ<]> «"]"» LexTerm : Λ<[> Π •Λ<]> «"("» LexTerm : Λ<[> Π •Λ<]> «"."» @@ -4477,11 +4497,11 @@ S114{ LexPattern : Π •Λ<|> Π «"|"» } Transitions: - Λ<|> -> 107 - Λ<]> -> 139 + Λ<|> -> 108 + Λ<]> -> 140 -S115{ +S116{ LexTerm : Λ<{> Π •Λ<}> «"]"» LexTerm : Λ<{> Π •Λ<}> «"("» LexTerm : Λ<{> Π •Λ<}> «"."» @@ -4495,11 +4515,11 @@ S115{ LexPattern : Π •Λ<|> Π «"|"» } Transitions: - Λ<|> -> 116 - Λ<}> -> 140 + Λ<|> -> 117 + Λ<}> -> 141 -S116{ +S117{ LexPattern : Π Λ<|> •Π «"}"» LexPattern : Π Λ<|> •Π «"|"» LexAlt : •Π «"}"» @@ -4611,10 +4631,10 @@ Transitions: Λ<(> -> 81 Λ<[> -> 82 Λ<{> -> 83 - Π -> 141 + Π -> 142 -S117{ +S118{ LexTerm : Λ<{> Π Λ<}>• «";"» LexTerm : Λ<{> Π Λ<}>• «"("» LexTerm : Λ<{> Π Λ<}>• «"."» @@ -4628,7 +4648,7 @@ S117{ Transitions: -S118{ +S119{ LexAlt : Π Π• «"}"» LexAlt : Π Π• «"("» LexAlt : Π Π• «"."» @@ -4642,7 +4662,7 @@ S118{ Transitions: -S119{ +S120{ LexTerm : char_lit Λ<-> •char_lit «"}"» LexTerm : char_lit Λ<-> •char_lit «"("» LexTerm : char_lit Λ<-> •char_lit «"."» @@ -4654,10 +4674,10 @@ S119{ LexTerm : char_lit Λ<-> •char_lit «"|"» } Transitions: - char_lit -> 142 + char_lit -> 143 -S120{ +S121{ LexTerm : Λ<~> char_lit• «"}"» LexTerm : Λ<~> char_lit• «"("» LexTerm : Λ<~> char_lit• «"."» @@ -4671,7 +4691,7 @@ S120{ Transitions: -S121{ +S122{ LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «"}"» LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «"("» LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «"."» @@ -4683,10 +4703,10 @@ S121{ LexTerm : Λ<~> Λ<(> •char_lit Λ<-> char_lit Λ<)> «"|"» } Transitions: - char_lit -> 143 + char_lit -> 144 -S122{ +S123{ LexTerm : Λ<(> Π •Λ<)> «"}"» LexTerm : Λ<(> Π •Λ<)> «"("» LexTerm : Λ<(> Π •Λ<)> «"."» @@ -4700,11 +4720,11 @@ S122{ LexPattern : Π •Λ<|> Π «"|"» } Transitions: - Λ<|> -> 98 - Λ<)> -> 144 + Λ<|> -> 99 + Λ<)> -> 145 -S123{ +S124{ LexTerm : Λ<[> Π •Λ<]> «"}"» LexTerm : Λ<[> Π •Λ<]> «"("» LexTerm : Λ<[> Π •Λ<]> «"."» @@ -4718,11 +4738,11 @@ S123{ LexPattern : Π •Λ<|> Π «"|"» } Transitions: - Λ<|> -> 107 - Λ<]> -> 145 + Λ<|> -> 108 + Λ<]> -> 146 -S124{ +S125{ LexTerm : Λ<{> Π •Λ<}> «"}"» LexTerm : Λ<{> Π •Λ<}> «"("» LexTerm : Λ<{> Π •Λ<}> «"."» @@ -4736,25 +4756,25 @@ S124{ LexPattern : Π •Λ<|> Π «"|"» } Transitions: - Λ<|> -> 116 - Λ<}> -> 146 + Λ<|> -> 117 + Λ<}> -> 147 -S125{ +S126{ Alternatives : Π Λ<|> Π• «";"» Alternatives : Π Λ<|> Π• «"|"» } Transitions: -S126{ +S127{ SyntaxBody : Π Π g_sdt_lit• «";"» SyntaxBody : Π Π g_sdt_lit• «"|"» } Transitions: -S127{ +S128{ Symbol : Λ<@> tokId string_lit• «";"» Symbol : Λ<@> tokId string_lit• «g_sdt_lit» Symbol : Λ<@> tokId string_lit• «"@"» @@ -4766,7 +4786,7 @@ S127{ Transitions: -S128{ +S129{ LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «";"» LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «"("» LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «"."» @@ -4778,10 +4798,10 @@ S128{ LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «"|"» } Transitions: - char_lit -> 147 + char_lit -> 148 -S129{ +S130{ LexPattern : Π Λ<|> Π• «")"» LexPattern : Π Λ<|> Π• «"|"» LexAlt : Π •Π «")"» @@ -4883,10 +4903,10 @@ Transitions: Λ<(> -> 61 Λ<[> -> 62 Λ<{> -> 63 - Π -> 100 + Π -> 101 -S130{ +S131{ LexTerm : char_lit Λ<-> char_lit• «")"» LexTerm : char_lit Λ<-> char_lit• «"("» LexTerm : char_lit Λ<-> char_lit• «"."» @@ -4900,7 +4920,7 @@ S130{ Transitions: -S131{ +S132{ LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «")"» LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «"("» LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «"."» @@ -4912,10 +4932,10 @@ S131{ LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «"|"» } Transitions: - Λ<-> -> 148 + Λ<-> -> 149 -S132{ +S133{ LexTerm : Λ<(> Π Λ<)>• «")"» LexTerm : Λ<(> Π Λ<)>• «"("» LexTerm : Λ<(> Π Λ<)>• «"."» @@ -4929,7 +4949,7 @@ S132{ Transitions: -S133{ +S134{ LexTerm : Λ<[> Π Λ<]>• «")"» LexTerm : Λ<[> Π Λ<]>• «"("» LexTerm : Λ<[> Π Λ<]>• «"."» @@ -4943,7 +4963,7 @@ S133{ Transitions: -S134{ +S135{ LexTerm : Λ<{> Π Λ<}>• «")"» LexTerm : Λ<{> Π Λ<}>• «"("» LexTerm : Λ<{> Π Λ<}>• «"."» @@ -4957,7 +4977,7 @@ S134{ Transitions: -S135{ +S136{ LexPattern : Π Λ<|> Π• «"]"» LexPattern : Π Λ<|> Π• «"|"» LexAlt : Π •Π «"]"» @@ -5059,10 +5079,10 @@ Transitions: Λ<(> -> 71 Λ<[> -> 72 Λ<{> -> 73 - Π -> 109 + Π -> 110 -S136{ +S137{ LexTerm : char_lit Λ<-> char_lit• «"]"» LexTerm : char_lit Λ<-> char_lit• «"("» LexTerm : char_lit Λ<-> char_lit• «"."» @@ -5076,7 +5096,7 @@ S136{ Transitions: -S137{ +S138{ LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «"]"» LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «"("» LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «"."» @@ -5088,10 +5108,10 @@ S137{ LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «"|"» } Transitions: - Λ<-> -> 149 + Λ<-> -> 150 -S138{ +S139{ LexTerm : Λ<(> Π Λ<)>• «"]"» LexTerm : Λ<(> Π Λ<)>• «"("» LexTerm : Λ<(> Π Λ<)>• «"."» @@ -5105,7 +5125,7 @@ S138{ Transitions: -S139{ +S140{ LexTerm : Λ<[> Π Λ<]>• «"]"» LexTerm : Λ<[> Π Λ<]>• «"("» LexTerm : Λ<[> Π Λ<]>• «"."» @@ -5119,7 +5139,7 @@ S139{ Transitions: -S140{ +S141{ LexTerm : Λ<{> Π Λ<}>• «"]"» LexTerm : Λ<{> Π Λ<}>• «"("» LexTerm : Λ<{> Π Λ<}>• «"."» @@ -5133,7 +5153,7 @@ S140{ Transitions: -S141{ +S142{ LexPattern : Π Λ<|> Π• «"}"» LexPattern : Π Λ<|> Π• «"|"» LexAlt : Π •Π «"}"» @@ -5235,10 +5255,10 @@ Transitions: Λ<(> -> 81 Λ<[> -> 82 Λ<{> -> 83 - Π -> 118 + Π -> 119 -S142{ +S143{ LexTerm : char_lit Λ<-> char_lit• «"}"» LexTerm : char_lit Λ<-> char_lit• «"("» LexTerm : char_lit Λ<-> char_lit• «"."» @@ -5252,7 +5272,7 @@ S142{ Transitions: -S143{ +S144{ LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «"}"» LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «"("» LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «"."» @@ -5264,10 +5284,10 @@ S143{ LexTerm : Λ<~> Λ<(> char_lit •Λ<-> char_lit Λ<)> «"|"» } Transitions: - Λ<-> -> 150 + Λ<-> -> 151 -S144{ +S145{ LexTerm : Λ<(> Π Λ<)>• «"}"» LexTerm : Λ<(> Π Λ<)>• «"("» LexTerm : Λ<(> Π Λ<)>• «"."» @@ -5281,7 +5301,7 @@ S144{ Transitions: -S145{ +S146{ LexTerm : Λ<[> Π Λ<]>• «"}"» LexTerm : Λ<[> Π Λ<]>• «"("» LexTerm : Λ<[> Π Λ<]>• «"."» @@ -5295,7 +5315,7 @@ S145{ Transitions: -S146{ +S147{ LexTerm : Λ<{> Π Λ<}>• «"}"» LexTerm : Λ<{> Π Λ<}>• «"("» LexTerm : Λ<{> Π Λ<}>• «"."» @@ -5309,7 +5329,7 @@ S146{ Transitions: -S147{ +S148{ LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «";"» LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «"("» LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «"."» @@ -5321,10 +5341,10 @@ S147{ LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «"|"» } Transitions: - Λ<)> -> 151 + Λ<)> -> 152 -S148{ +S149{ LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «")"» LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «"("» LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «"."» @@ -5336,10 +5356,10 @@ S148{ LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «"|"» } Transitions: - char_lit -> 152 + char_lit -> 153 -S149{ +S150{ LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «"]"» LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «"("» LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «"."» @@ -5351,10 +5371,10 @@ S149{ LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «"|"» } Transitions: - char_lit -> 153 + char_lit -> 154 -S150{ +S151{ LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «"}"» LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «"("» LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «"."» @@ -5366,10 +5386,10 @@ S150{ LexTerm : Λ<~> Λ<(> char_lit Λ<-> •char_lit Λ<)> «"|"» } Transitions: - char_lit -> 154 + char_lit -> 155 -S151{ +S152{ LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)>• «";"» LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)>• «"("» LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)>• «"."» @@ -5383,7 +5403,7 @@ S151{ Transitions: -S152{ +S153{ LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «")"» LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «"("» LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «"."» @@ -5395,10 +5415,10 @@ S152{ LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «"|"» } Transitions: - Λ<)> -> 155 + Λ<)> -> 156 -S153{ +S154{ LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «"]"» LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «"("» LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «"."» @@ -5410,10 +5430,10 @@ S153{ LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «"|"» } Transitions: - Λ<)> -> 156 + Λ<)> -> 157 -S154{ +S155{ LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «"}"» LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «"("» LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «"."» @@ -5425,10 +5445,10 @@ S154{ LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit •Λ<)> «"|"» } Transitions: - Λ<)> -> 157 + Λ<)> -> 158 -S155{ +S156{ LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)>• «")"» LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)>• «"("» LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)>• «"."» @@ -5442,7 +5462,7 @@ S155{ Transitions: -S156{ +S157{ LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)>• «"]"» LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)>• «"("» LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)>• «"."» @@ -5456,7 +5476,7 @@ S156{ Transitions: -S157{ +S158{ LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)>• «"}"» LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)>• «"("» LexTerm : Λ<~> Λ<(> char_lit Λ<-> char_lit Λ<)>• «"."» diff --git a/internal/macro/preprocess.go b/internal/macro/preprocess.go new file mode 100644 index 00000000..71c35278 --- /dev/null +++ b/internal/macro/preprocess.go @@ -0,0 +1,310 @@ +package macro + +import ( + "bufio" + "fmt" + "io" + "os" + "os/exec" + "path/filepath" + "regexp" + "strings" +) + +type ( + Macro struct { + Name string + ParametersMap map[string]int + Text []string + EndDelimiter *regexp.Regexp + HasVarArgs bool + } + void struct{} +) + +var ( + NOTHING void = void{} + S_MACRO_ARGS_SEP = "," + S_MACRO_ESCAPE_SEP = fmt.Sprintf("<%s>", S_MACRO_ARGS_SEP) + S_MACRONOTSEP = fmt.Sprintf("(?:(?:%s)|[^%s])*", S_MACRO_ESCAPE_SEP, S_MACRO_ARGS_SEP) + S_MACROPARAMNAME = "\\b(?:(?:[[:alpha:]](?:[\\w_])*)|(?:VARGS))\\b" + S_MACROPARAMVALUE = "\\s*(" + S_MACRONOTSEP + ")\\s*" + S_MACRONAME = S_MACROPARAMNAME + S_MACROARG = S_MACROPARAMVALUE + S_MACROARGS = fmt.Sprintf("(\\s*%s\\s*(?:%s\\s*%s\\s*)*)", S_MACROPARAMNAME, S_MACRO_ARGS_SEP, S_MACROPARAMNAME) + MACROCONDLINE = regexp.MustCompile(fmt.Sprintf("^\\s*\\?\\s*(%s)\\s*(==|!=|>|<|>=|<=)\\s*([^\\s]+)\\s+(.+)$", S_MACROPARAMNAME)) + _MACROCONDLINE = regexp.MustCompile(fmt.Sprintf("^\\s*\\?")) + MACRONAME = regexp.MustCompile(fmt.Sprintf("(%s)", S_MACRONAME)) + MACROPARAM = regexp.MustCompile(fmt.Sprintf("(%s)", S_MACROPARAMNAME)) + MACROARG = regexp.MustCompile(S_MACROARG) + MACROARGS = regexp.MustCompile(S_MACROARGS) + MACROSTART = regexp.MustCompile(fmt.Sprintf("^\\s*MACRO\\s+(%s)\\s*(?:\\(%s\\))?\\s*$", S_MACRONAME, S_MACROARGS)) + MACROINVOCATION = regexp.MustCompile(fmt.Sprintf("\\b(%s)\\s*\\((%s(%s%s)*)\\)\\s*$", S_MACRONAME, S_MACRONOTSEP, S_MACRO_ARGS_SEP, S_MACRONOTSEP)) + MACROVAREXPANSION = regexp.MustCompile(fmt.Sprintf("{(%s)}", S_MACROPARAMNAME)) + SYNKWD = regexp.MustCompile(fmt.Sprintf("\\bKWD\\((%s)((?:,!?%s)*)\\)(\\s|$)", S_MACROPARAMNAME, S_MACROPARAMNAME)) + KWDGRP = regexp.MustCompile(fmt.Sprintf(",(!?%s)*", S_MACROPARAMNAME)) + + Macros = map[string]*Macro{} + Keywords = map[string]map[string]void{} + KeywordGroups = map[string]map[string]void{"ALL": {}} +) + +func (m *Macro) ArgValue(name string, args []string) (string, error) { + if index, found := m.ParametersMap[name]; found { + if index < len(args) { + return args[index], nil + } else { + return "", nil + } + } + if m.HasVarArgs { + switch name { + case "VLEN": + return fmt.Sprintf("%d", len(args)-len(m.ParametersMap)), nil + case "VARG0": + if len(args) > len(m.ParametersMap) { + return args[len(m.ParametersMap)], nil + } + return "", nil + case "VARGS": + if len(args) > len(m.ParametersMap)+1 { + return strings.Join(args[len(m.ParametersMap)+1:], ","), nil + } + return "", nil + } + } + return "", fmt.Errorf("macro <%s> has no parameter named <%s>", m.Name, name) +} + +func (m *Macro) Expand(args []string, out io.Writer) { + for _, line := range m.Text { + fmt.Fprintln(out, MACROVAREXPANSION.ReplaceAllStringFunc(line, func(match string) string { + match = MACROVAREXPANSION.FindStringSubmatch(match)[1] + //fmt.Printf("args: %q match=<%s> =>%d\n", args, match, m.ParametersMap[match]) + if value, err := m.ArgValue(match, args); err == nil { + return value + } else { + panic(fmt.Errorf("macro <%s> has no parameter named <%s>", m.Name, match)) + } + })) + } +} + +func processEbnfStream(expanding *Macro, expargs []string, in io.Reader, out io.Writer) { + currentMacro := (*Macro)(nil) + lineNumber := 0 + for scanner := bufio.NewScanner(in); scanner.Scan(); { + lineNumber++ + line := scanner.Text() + switch { + case currentMacro != nil: + if currentMacro.EndDelimiter.MatchString(line) { + Macros[currentMacro.Name] = currentMacro + currentMacro = nil + } else { + currentMacro.Text = append(currentMacro.Text, line) + //fmt.Printf("<%s>%03d: %s\n", currentMacro.EndDelimiter.String(), lineNumber, line) + } + case currentMacro == nil: + if cond := MACROCONDLINE.FindStringSubmatch(line); cond != nil { + if expanding == nil { + panic(fmt.Errorf("conditional line out of macro")) + } + name := cond[1] + op := cond[2] + cmp := cond[3] + rest := cond[4] + if cmp == "\"\"" || cmp == "''" { + cmp = "" + } + if value, err := expanding.ArgValue(name, expargs); err != nil { + panic(err) + } else { + if func() bool { + switch op { + case "==": + return value == cmp + case "!=": + return value != cmp + case "<": + return value < cmp + case ">": + return value > cmp + case "<=": + return value <= cmp + case ">=": + return value >= cmp + case "~=": + return regexp.MustCompile(cmp).MatchString(value) + } + return false + }() { + line = rest + } else { + line = "" + continue + } + } + } + if m := MACROSTART.FindStringSubmatch(line); m != nil { + macro_name := m[1] + macro_args := m[2] + if _, found := Macros[macro_name]; found { + panic(fmt.Sprintf("macro %s redefined at line %d\n", macro_name, lineNumber)) + } + currentMacro = &Macro{ + Name: macro_name, + ParametersMap: map[string]int{}, + EndDelimiter: regexp.MustCompile(fmt.Sprintf("^\\s*ENDMACRO\\s*%s\\s*$", macro_name)), + } + for _, s := range MACROPARAM.FindAllStringSubmatch(macro_args, -1) { + name := s[1] + if currentMacro.HasVarArgs { + panic(fmt.Errorf("macro <%s>: varargs can only occur as last formal parameter", currentMacro.Name)) + } + if name == "VARGS" { + currentMacro.HasVarArgs = true + } else { + if _, exists := currentMacro.ParametersMap[name]; exists { + panic(fmt.Sprintf("macro <%s>: parameter <%s> specified twice\n", currentMacro.Name, name)) + } + currentMacro.ParametersMap[name] = len(currentMacro.ParametersMap) + } + } + Macros[currentMacro.Name] = currentMacro + //fmt.Printf("%s parmmap: %q\n", macro_name, currentMacro.ParametersMap) + } else { + line = MACROINVOCATION.ReplaceAllStringFunc(line, func(m string) string { + if vars := MACROINVOCATION.FindStringSubmatch(m); vars != nil { + macro_name := vars[1] + macro_args := vars[2] + if macro, found := Macros[macro_name]; found { + var builder strings.Builder + var args []string + for _, v := range MACROARG.FindAllStringSubmatch(macro_args, -1) { + v[1] = strings.ReplaceAll(v[1], S_MACRO_ESCAPE_SEP, S_MACRO_ARGS_SEP) + //fmt.Printf("macro repl: %s vars=%q, v=%q\n", m, vars, v) + args = append(args, v[1]) + } + for len(args) > len(macro.ParametersMap) && args[len(args)-1] == "" { + args = args[:len(args)-1] + } + if len(args) == len(macro.ParametersMap) || macro.HasVarArgs && len(args) > len(macro.ParametersMap) { + macro.Expand(args, &builder) + processEbnfStream(macro, args, strings.NewReader(builder.String()), out) + //return builder.String() + } else { + panic(fmt.Sprintf("macro <%s> wrong args=<%s> (expected length=%d, actual=%d)\n", macro_name, macro_args, len(macro.ParametersMap), len(args))) + } + } else { + //panic(fmt.Sprintf("unknown macro <%s> in match=<%s>\n", macro_name, m)) + return m + } + } else { + panic(fmt.Sprintf("??? match=<%s>\n", m)) + } + return "" + }) + if match := SYNKWD.FindStringSubmatch(line); match != nil { + kwd := match[1] + if Keywords[kwd] == nil { + Keywords[kwd] = map[string]void{"ALL": NOTHING} + KeywordGroups["ALL"][kwd] = NOTHING + } + for _, grp := range KWDGRP.FindAllStringSubmatch(match[2], -1) { + negate := false + grpname := grp[1] + if negate = (grpname[0] == '!'); negate { + grpname = grpname[1:] + } + if KeywordGroups[grpname] == nil { + KeywordGroups[grpname] = map[string]void{} + } + if negate { + delete(Keywords[kwd], grpname) + delete(KeywordGroups[grpname], kwd) + } else { + Keywords[kwd][grpname] = NOTHING + KeywordGroups[grpname][kwd] = NOTHING + } + } + line = SYNKWD.ReplaceAllString(line, "KWD_"+kwd) + } + if len(line) > 0 { + fmt.Fprintln(out, line) + } + } + } + } +} + +func internalPreProcess(fname, outname string) error { + if outf, err := os.Create(outname); err != nil { + panic(fmt.Sprintf("cannot open <%s>: %s\n", outname, err.Error())) + } else { + defer outf.Close() + if inf, err := os.Open(fname); err != nil { + panic(fmt.Sprintf("cannot open <%s>: %s\n", fname, err.Error())) + } else { + fmt.Fprintf(outf, "//\n// Code generated by gocc preprocessor ; DO NOT EDIT.\n//\n") + processEbnfStream(nil, nil, inf, outf) + inf.Close() + if len(Keywords) > 0 { + for kwd, _ := range Keywords { + fmt.Fprintf(outf, "KWD_%s : \"%s\" ;\n", kwd, kwd) + } + for grp, km := range KeywordGroups { + fmt.Fprintf(outf, + "KGRP_%s:\n%s\n;\n", + grp, + strings.Join( + func() (r []string) { + for kwd, _ := range km { + r = append(r, fmt.Sprintf("\t\tKWD_%s\n", kwd)) + } + return + }(), + "\t|\n"), + ) + } + } + } + } + return nil +} + +func matches(filters []*regexp.Regexp, name string) bool { + for _, re := range filters { + if re.MatchString(name) { + return true + } + } + return false +} + +func createPath(outname string) { + dir, _ := filepath.Split(outname) + if err := os.MkdirAll(dir, 0764); err != nil { + panic(fmt.Sprintf("cannot create directory <%s>\n", dir)) + } +} + +func PreProcess(preprocessor, fname, outname string) error { + switch preprocessor { + case "none": + case "internal": + createPath(outname) + return internalPreProcess(fname, outname) + default: + createPath(outname) + if preprocessCmd := strings.Split(strings.ReplaceAll(strings.ReplaceAll(preprocessor, "@in", fname), "@out", outname), " "); len(preprocessCmd) > 0 { + cmd := exec.Command(preprocessCmd[0], preprocessCmd[1:]...) + cmd.Stdin = os.Stdin + cmd.Stdout = os.Stdout + cmd.Stderr = os.Stderr + return cmd.Run() + } + return fmt.Errorf("cannot run empty preprocessor") + } + return nil +} diff --git a/internal/parser/gen/golang/productionstable.go b/internal/parser/gen/golang/productionstable.go index d27e3a13..91670b99 100644 --- a/internal/parser/gen/golang/productionstable.go +++ b/internal/parser/gen/golang/productionstable.go @@ -141,15 +141,16 @@ const prodsTabSrc = ` package parser -{{.Header}} - import ( + "fmt" "strings" "{{.Config.Package}}/{{.InternalDir}}/token" "{{.Config.Package}}/{{.InternalDir}}/util" ) +{{.Header}} + func getString(X Attrib) string { switch X.(type) { case *token.Token: return string(X.(*token.Token).Lit) diff --git a/main.go b/main.go index 5aa94d79..bc1882a4 100644 --- a/main.go +++ b/main.go @@ -180,6 +180,8 @@ import ( "path" "strings" + "github.com/maxcalandrelli/gocc/internal/macro" + "github.com/maxcalandrelli/gocc/internal/ast" genBase "github.com/maxcalandrelli/gocc/internal/base/gen" "github.com/maxcalandrelli/gocc/internal/config" @@ -222,15 +224,25 @@ func main() { grammar interface{} ) ast.StringGetter = func(v interface{}) string { return string(v.(*altfe.Token).Lit) } - grammar, err = altfe.ParseFile(cfg.SourceFile()) - if err != nil { - fmt.Printf("Parse error: %s\n", err) - os.Exit(1) - } outdir_base := cfg.OutDir() outdir_log := path.Join(outdir_base, "log") outdir_iface := path.Join("iface") + + source := cfg.SourceFile() + if cfg.PreProcessor() != "none" { + tmpsrc := path.Join(outdir_log, path.Base(source)) + if err := macro.PreProcess(cfg.PreProcessor(), source, tmpsrc); err != nil { + fmt.Printf("Preprocessing error: %s\n", err.Error()) + os.Exit(1) + } + source = tmpsrc + } + grammar, err = altfe.ParseFile(source) + if err != nil { + fmt.Printf("Parse error: %s\n", err) + os.Exit(1) + } g := grammar.(*ast.Grammar) gSymbols := symbols.NewSymbols(g) diff --git a/spec/gocc2.ebnf b/spec/gocc2.ebnf index 36c1eb04..ec3b7bdd 100644 --- a/spec/gocc2.ebnf +++ b/spec/gocc2.ebnf @@ -276,6 +276,9 @@ SyntaxBody : | EpsilonSymbol << ast.NewEmptyBodyGen() >> + | + EpsilonSymbol g_sdt_lit + << ast.NewEmptyBodyGen() >> ; Symbols :