feat/schema: additional literal types

This commit is contained in:
mae
2026-01-28 02:08:12 -06:00
parent 11fcbeb31a
commit dc87bef1c2
11 changed files with 7007 additions and 1484 deletions

View File

@@ -2,6 +2,7 @@ package ast
import (
"azalea/schema/token"
"azalea/schema/util"
"strconv"
"strings"
)
@@ -15,26 +16,41 @@ type Expr struct {
}
type ValList []Val
type Val struct {
string string
number string
name string
string *string
rune *rune
int *int64
float *float64
imaginary *complex128
name *string
*Expr
}
func NewExprList(expr any) (ExprList, error) {
return ExprList{expr.(Expr)}, nil
}
func NewStringVal(val *token.Token) (Val, error) {
return Val{string: string(val.Lit)}, nil
s, err := strconv.Unquote(string(val.Lit))
return Val{string: &s}, err
}
func NewRuneVal(val *token.Token) (Val, error) {
r := util.RuneValue(val.Lit)
return Val{rune: &r}, nil
}
func NewIntVal(val *token.Token) (Val, error) {
i, err := strconv.ParseInt(string(val.Lit), 0, 64)
return Val{int: &i}, err
}
func NewNumberVal(val *token.Token) (Val, error) {
return Val{number: string(val.Lit)}, nil
func NewFloatVal(val *token.Token) (Val, error) {
f, err := strconv.ParseFloat(string(val.Lit), 64)
return Val{float: &f}, err
}
func NewComplexVal(val *token.Token) (Val, error) {
c, err := strconv.ParseComplex(string(val.Lit), 128)
return Val{imaginary: &c}, err
}
func NewNameVal(val *token.Token) (Val, error) {
return Val{name: string(val.Lit)}, nil
name := string(val.Lit)
return Val{name: &name}, nil
}
func NewExprVal(val any) (Val, error) {
@@ -42,6 +58,10 @@ func NewExprVal(val any) (Val, error) {
return Val{Expr: &expr}, nil
}
func NewExprList(expr any) (ExprList, error) {
return ExprList{expr.(Expr)}, nil
}
func AppendExpr(exprList, expr any) (ExprList, error) {
return append(exprList.(ExprList), expr.(Expr)), nil
}
@@ -100,15 +120,23 @@ func (e Expr) String() string {
return sb.String()
}
func (v *Val) String() string {
if v.string != "" {
return v.string
if v.string != nil {
return *v.string
}
if v.number != "" {
num, _ := strconv.ParseInt(v.number, 0, 64)
return strconv.FormatInt(num, 10)
if v.rune != nil {
return string(*v.rune)
}
if v.name != "" {
return v.name
if v.int != nil {
return strconv.FormatInt(*v.int, 10)
}
if v.float != nil {
return strconv.FormatFloat(*v.float, 'g', -1, 64)
}
if v.imaginary != nil {
return strconv.FormatComplex(*v.imaginary, 'g', -1, 128)
}
if v.name != nil {
return *v.name
}
if v.Expr != nil {
return v.Expr.String()

View File

@@ -1,15 +1,43 @@
string: '`' {.} '`' | '"' {.} '"';
_raw_string: '`' {.} '`';
_interpreted_string: '"' {.} '"';
string: _raw_string | _interpreted_string;
_unicode_value: . | _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: '\\' _oct_digit _oct_digit _oct_digit;
_hex_byte_value: '\\' 'x' _hex_digit _hex_digit;
rune: '\'' (_unicode_value | _byte_value) '\'';
_bin_digit: '0' - '1';
_bin_digits: _bin_digit {_bin_digit | '_'};
_oct_digit: _bin_digit | '2' - '7';
_oct_digits: _oct_digit {_oct_digit | '_'};
_dec_digit: _oct_digit | '8' - '9';
_dec_digits: _dec_digit {_dec_digit | '_'};
_hex_digit: _dec_digit | 'A' - 'F' | 'a' - 'f';
number: ['-' | '+'] '0' 'b' _bin_digit {_bin_digit | '_'}
| ['-' | '+'] '0' 'o' _oct_digit {_oct_digit | '_'}
| ['-' | '+'] _dec_digit {_dec_digit | '_'}
| ['-' | '+'] '0' 'x' _hex_digit {_hex_digit | '_'};
_hex_digits: _hex_digit {_hex_digit | '_'};
_name_initial: 'A' - 'Z' | 'a' - 'z' | '_' | '~' | '!' | '@' | '#' | '$' | '%' | '^' | '&' | '*' | '-' | '_' | '+' | '=' | '?' | '/' | '.' | '\'';
_int: ['-' | '+'] '0' ('b' | 'B') _bin_digits
| ['-' | '+'] '0' ('o' | 'O') _oct_digits
| ['-' | '+'] _dec_digits
| ['-' | '+'] '0' ('x' | 'X') _hex_digits;
int: _int;
_dec_exponent: ('e' | 'E') ['+' | '-'] _dec_digits;
_dec_float: ['-' | '+'] _dec_digits '.' [_dec_digits] [_dec_exponent]
| _dec_digits _dec_exponent
| '.' _dec_digits [_dec_exponent];
_hex_exponent: ('p' | 'P') ['+' | '-'] _dec_digits;
_hex_mantissa: ['_'] _hex_digits '.' _hex_digits | ['_'] _hex_digits | '.' _hex_digits;
_hex_float: ['-' | '+'] '0' ('x' | 'X') _hex_mantissa _hex_exponent;
_float: _dec_float | _hex_float;
float: _float;
imaginary: (_dec_digits | _int | _float) 'i';
_name_initial: 'A' - 'Z' | 'a' - 'z' | '_' | '~' | '!' | '@' | '#' | '$' | '%' | '^' | '&' | '*' | '-' | '_' | '+' | '=' | '?' | '/' | '.';
_name_char: _name_initial | _dec_digit;
name: _name_initial {_name_char};
@@ -33,7 +61,10 @@ ValList
;
Val
: string <<ast.NewStringVal($T0)>>
| number <<ast.NewNumberVal($T0)>>
| rune <<ast.NewRuneVal($T0)>>
| int <<ast.NewIntVal($T0)>>
| float <<ast.NewFloatVal($T0)>>
| imaginary <<ast.NewComplexVal($T0)>>
| name <<ast.NewNameVal($T0)>>
| Expr <<ast.NewExprVal($0)>>
;

View File

@@ -29,7 +29,7 @@ var ActTab = ActionTable{
Ignore: "!whitespace",
},
ActionRow{ // S2
Accept: 4,
Accept: 7,
Ignore: "",
},
ActionRow{ // S3
@@ -37,15 +37,15 @@ var ActTab = ActionTable{
Ignore: "",
},
ActionRow{ // S4
Accept: 5,
Accept: 0,
Ignore: "",
},
ActionRow{ // S5
Accept: 6,
Accept: 8,
Ignore: "",
},
ActionRow{ // S6
Accept: 4,
Accept: 9,
Ignore: "",
},
ActionRow{ // S7
@@ -53,23 +53,23 @@ var ActTab = ActionTable{
Ignore: "",
},
ActionRow{ // S8
Accept: 3,
Accept: 10,
Ignore: "",
},
ActionRow{ // S9
Accept: 3,
Accept: 4,
Ignore: "",
},
ActionRow{ // S10
Accept: 3,
Accept: 4,
Ignore: "",
},
ActionRow{ // S11
Accept: 3,
Accept: 4,
Ignore: "",
},
ActionRow{ // S12
Accept: 0,
Accept: 4,
Ignore: "",
},
ActionRow{ // S13
@@ -77,123 +77,123 @@ var ActTab = ActionTable{
Ignore: "",
},
ActionRow{ // S14
Accept: 4,
Accept: 0,
Ignore: "",
},
ActionRow{ // S15
Accept: 4,
Accept: 7,
Ignore: "",
},
ActionRow{ // S16
Accept: 4,
Accept: 7,
Ignore: "",
},
ActionRow{ // S17
Accept: 4,
Accept: 7,
Ignore: "",
},
ActionRow{ // S18
Accept: 2,
Accept: 7,
Ignore: "",
},
ActionRow{ // S19
Accept: 3,
Accept: 2,
Ignore: "",
},
ActionRow{ // S20
Accept: 3,
Accept: 0,
Ignore: "",
},
ActionRow{ // S21
Accept: 3,
Accept: 0,
Ignore: "",
},
ActionRow{ // S22
Accept: 3,
Accept: 4,
Ignore: "",
},
ActionRow{ // S23
Accept: 3,
Accept: 4,
Ignore: "",
},
ActionRow{ // S24
Accept: 0,
Accept: 4,
Ignore: "",
},
ActionRow{ // S25
Accept: 0,
Accept: 4,
Ignore: "",
},
ActionRow{ // S26
Accept: 0,
Accept: 5,
Ignore: "",
},
ActionRow{ // S27
Accept: -1,
Ignore: "!comment",
Accept: 5,
Ignore: "",
},
ActionRow{ // S28
Accept: 3,
Accept: 5,
Ignore: "",
},
ActionRow{ // S29
Accept: 4,
Accept: 5,
Ignore: "",
},
ActionRow{ // S30
Accept: 4,
Accept: 0,
Ignore: "",
},
ActionRow{ // S31
Accept: 4,
Accept: 0,
Ignore: "",
},
ActionRow{ // S32
Accept: 3,
Accept: 0,
Ignore: "",
},
ActionRow{ // S33
Accept: 3,
Accept: 0,
Ignore: "",
},
ActionRow{ // S34
Accept: 3,
Accept: 4,
Ignore: "",
},
ActionRow{ // S35
Accept: 3,
Accept: 6,
Ignore: "",
},
ActionRow{ // S36
Accept: 3,
Ignore: "",
Accept: -1,
Ignore: "!comment",
},
ActionRow{ // S37
Accept: 3,
Accept: 2,
Ignore: "",
},
ActionRow{ // S38
Accept: 3,
Accept: 0,
Ignore: "",
},
ActionRow{ // S39
Accept: 3,
Accept: 0,
Ignore: "",
},
ActionRow{ // S40
Accept: 3,
Accept: 0,
Ignore: "",
},
ActionRow{ // S41
Accept: 3,
Accept: 0,
Ignore: "",
},
ActionRow{ // S42
Accept: 3,
Accept: 0,
Ignore: "",
},
ActionRow{ // S43
Accept: 3,
Accept: 0,
Ignore: "",
},
ActionRow{ // S44
@@ -201,31 +201,667 @@ var ActTab = ActionTable{
Ignore: "",
},
ActionRow{ // S45
Accept: 3,
Accept: 5,
Ignore: "",
},
ActionRow{ // S46
Accept: 3,
Accept: 7,
Ignore: "",
},
ActionRow{ // S47
Accept: 3,
Accept: 7,
Ignore: "",
},
ActionRow{ // S48
Accept: 3,
Accept: 7,
Ignore: "",
},
ActionRow{ // S49
Accept: 3,
Accept: 4,
Ignore: "",
},
ActionRow{ // S50
Accept: 3,
Accept: 6,
Ignore: "",
},
ActionRow{ // S51
Accept: 3,
Accept: 7,
Ignore: "",
},
ActionRow{ // S52
Accept: 5,
Ignore: "",
},
ActionRow{ // S53
Accept: 5,
Ignore: "",
},
ActionRow{ // S54
Accept: 5,
Ignore: "",
},
ActionRow{ // S55
Accept: 5,
Ignore: "",
},
ActionRow{ // S56
Accept: 0,
Ignore: "",
},
ActionRow{ // S57
Accept: 4,
Ignore: "",
},
ActionRow{ // S58
Accept: 0,
Ignore: "",
},
ActionRow{ // S59
Accept: 5,
Ignore: "",
},
ActionRow{ // S60
Accept: 5,
Ignore: "",
},
ActionRow{ // S61
Accept: 5,
Ignore: "",
},
ActionRow{ // S62
Accept: 4,
Ignore: "",
},
ActionRow{ // S63
Accept: 4,
Ignore: "",
},
ActionRow{ // S64
Accept: 0,
Ignore: "",
},
ActionRow{ // S65
Accept: 4,
Ignore: "",
},
ActionRow{ // S66
Accept: 4,
Ignore: "",
},
ActionRow{ // S67
Accept: 4,
Ignore: "",
},
ActionRow{ // S68
Accept: 4,
Ignore: "",
},
ActionRow{ // S69
Accept: 0,
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
Accept: 0,
Ignore: "",
},
ActionRow{ // S79
Accept: 0,
Ignore: "",
},
ActionRow{ // S80
Accept: 0,
Ignore: "",
},
ActionRow{ // S81
Accept: 0,
Ignore: "",
},
ActionRow{ // S82
Accept: 0,
Ignore: "",
},
ActionRow{ // S83
Accept: 0,
Ignore: "",
},
ActionRow{ // S84
Accept: 5,
Ignore: "",
},
ActionRow{ // S85
Accept: 5,
Ignore: "",
},
ActionRow{ // S86
Accept: 5,
Ignore: "",
},
ActionRow{ // S87
Accept: 7,
Ignore: "",
},
ActionRow{ // S88
Accept: 4,
Ignore: "",
},
ActionRow{ // S89
Accept: 4,
Ignore: "",
},
ActionRow{ // S90
Accept: 4,
Ignore: "",
},
ActionRow{ // S91
Accept: 7,
Ignore: "",
},
ActionRow{ // S92
Accept: 4,
Ignore: "",
},
ActionRow{ // S93
Accept: 4,
Ignore: "",
},
ActionRow{ // S94
Accept: 4,
Ignore: "",
},
ActionRow{ // S95
Accept: 4,
Ignore: "",
},
ActionRow{ // S96
Accept: 7,
Ignore: "",
},
ActionRow{ // S97
Accept: 7,
Ignore: "",
},
ActionRow{ // S98
Accept: 5,
Ignore: "",
},
ActionRow{ // S99
Accept: 5,
Ignore: "",
},
ActionRow{ // S100
Accept: 5,
Ignore: "",
},
ActionRow{ // S101
Accept: 5,
Ignore: "",
},
ActionRow{ // S102
Accept: 0,
Ignore: "",
},
ActionRow{ // S103
Accept: 5,
Ignore: "",
},
ActionRow{ // S104
Accept: 5,
Ignore: "",
},
ActionRow{ // S105
Accept: 5,
Ignore: "",
},
ActionRow{ // S106
Accept: 4,
Ignore: "",
},
ActionRow{ // S107
Accept: 5,
Ignore: "",
},
ActionRow{ // S108
Accept: 4,
Ignore: "",
},
ActionRow{ // S109
Accept: 0,
Ignore: "",
},
ActionRow{ // S110
Accept: 0,
Ignore: "",
},
ActionRow{ // S111
Accept: 0,
Ignore: "",
},
ActionRow{ // S112
Accept: 0,
Ignore: "",
},
ActionRow{ // S113
Accept: 0,
Ignore: "",
},
ActionRow{ // S114
Accept: 0,
Ignore: "",
},
ActionRow{ // S115
Accept: 4,
Ignore: "",
},
ActionRow{ // S116
Accept: 0,
Ignore: "",
},
ActionRow{ // S117
Accept: 0,
Ignore: "",
},
ActionRow{ // S118
Accept: 0,
Ignore: "",
},
ActionRow{ // S119
Accept: 0,
Ignore: "",
},
ActionRow{ // S120
Accept: 0,
Ignore: "",
},
ActionRow{ // S121
Accept: 0,
Ignore: "",
},
ActionRow{ // S122
Accept: 0,
Ignore: "",
},
ActionRow{ // S123
Accept: 0,
Ignore: "",
},
ActionRow{ // S124
Accept: 0,
Ignore: "",
},
ActionRow{ // S125
Accept: 0,
Ignore: "",
},
ActionRow{ // S126
Accept: 0,
Ignore: "",
},
ActionRow{ // S127
Accept: 0,
Ignore: "",
},
ActionRow{ // S128
Accept: 0,
Ignore: "",
},
ActionRow{ // S129
Accept: 0,
Ignore: "",
},
ActionRow{ // S130
Accept: 0,
Ignore: "",
},
ActionRow{ // S131
Accept: 0,
Ignore: "",
},
ActionRow{ // S132
Accept: 0,
Ignore: "",
},
ActionRow{ // S133
Accept: 0,
Ignore: "",
},
ActionRow{ // S134
Accept: 5,
Ignore: "",
},
ActionRow{ // S135
Accept: 7,
Ignore: "",
},
ActionRow{ // S136
Accept: 5,
Ignore: "",
},
ActionRow{ // S137
Accept: 5,
Ignore: "",
},
ActionRow{ // S138
Accept: 5,
Ignore: "",
},
ActionRow{ // S139
Accept: 4,
Ignore: "",
},
ActionRow{ // S140
Accept: 4,
Ignore: "",
},
ActionRow{ // S141
Accept: 7,
Ignore: "",
},
ActionRow{ // S142
Accept: 7,
Ignore: "",
},
ActionRow{ // S143
Accept: 7,
Ignore: "",
},
ActionRow{ // S144
Accept: 7,
Ignore: "",
},
ActionRow{ // S145
Accept: 7,
Ignore: "",
},
ActionRow{ // S146
Accept: 7,
Ignore: "",
},
ActionRow{ // S147
Accept: 4,
Ignore: "",
},
ActionRow{ // S148
Accept: 7,
Ignore: "",
},
ActionRow{ // S149
Accept: 7,
Ignore: "",
},
ActionRow{ // S150
Accept: 7,
Ignore: "",
},
ActionRow{ // S151
Accept: 7,
Ignore: "",
},
ActionRow{ // S152
Accept: 5,
Ignore: "",
},
ActionRow{ // S153
Accept: 5,
Ignore: "",
},
ActionRow{ // S154
Accept: 0,
Ignore: "",
},
ActionRow{ // S155
Accept: 0,
Ignore: "",
},
ActionRow{ // S156
Accept: 0,
Ignore: "",
},
ActionRow{ // S157
Accept: 0,
Ignore: "",
},
ActionRow{ // S158
Accept: 0,
Ignore: "",
},
ActionRow{ // S159
Accept: 0,
Ignore: "",
},
ActionRow{ // S160
Accept: 5,
Ignore: "",
},
ActionRow{ // S161
Accept: 5,
Ignore: "",
},
ActionRow{ // S162
Accept: 5,
Ignore: "",
},
ActionRow{ // S163
Accept: 0,
Ignore: "",
},
ActionRow{ // S164
Accept: 0,
Ignore: "",
},
ActionRow{ // S165
Accept: 0,
Ignore: "",
},
ActionRow{ // S166
Accept: 0,
Ignore: "",
},
ActionRow{ // S167
Accept: 0,
Ignore: "",
},
ActionRow{ // S168
Accept: 0,
Ignore: "",
},
ActionRow{ // S169
Accept: 0,
Ignore: "",
},
ActionRow{ // S170
Accept: 0,
Ignore: "",
},
ActionRow{ // S171
Accept: 0,
Ignore: "",
},
ActionRow{ // S172
Accept: 5,
Ignore: "",
},
ActionRow{ // S173
Accept: 7,
Ignore: "",
},
ActionRow{ // S174
Accept: 7,
Ignore: "",
},
ActionRow{ // S175
Accept: 7,
Ignore: "",
},
ActionRow{ // S176
Accept: 7,
Ignore: "",
},
ActionRow{ // S177
Accept: 7,
Ignore: "",
},
ActionRow{ // S178
Accept: 7,
Ignore: "",
},
ActionRow{ // S179
Accept: 5,
Ignore: "",
},
ActionRow{ // S180
Accept: 5,
Ignore: "",
},
ActionRow{ // S181
Accept: 5,
Ignore: "",
},
ActionRow{ // S182
Accept: 7,
Ignore: "",
},
ActionRow{ // S183
Accept: 0,
Ignore: "",
},
ActionRow{ // S184
Accept: 5,
Ignore: "",
},
ActionRow{ // S185
Accept: 0,
Ignore: "",
},
ActionRow{ // S186
Accept: 0,
Ignore: "",
},
ActionRow{ // S187
Accept: 0,
Ignore: "",
},
ActionRow{ // S188
Accept: 0,
Ignore: "",
},
ActionRow{ // S189
Accept: 0,
Ignore: "",
},
ActionRow{ // S190
Accept: 0,
Ignore: "",
},
ActionRow{ // S191
Accept: 0,
Ignore: "",
},
ActionRow{ // S192
Accept: 0,
Ignore: "",
},
ActionRow{ // S193
Accept: 7,
Ignore: "",
},
ActionRow{ // S194
Accept: 5,
Ignore: "",
},
ActionRow{ // S195
Accept: 0,
Ignore: "",
},
ActionRow{ // S196
Accept: 0,
Ignore: "",
},
ActionRow{ // S197
Accept: 0,
Ignore: "",
},
ActionRow{ // S198
Accept: 0,
Ignore: "",
},
ActionRow{ // S199
Accept: 0,
Ignore: "",
},
ActionRow{ // S200
Accept: 0,
Ignore: "",
},
ActionRow{ // S201
Accept: 0,
Ignore: "",
},
ActionRow{ // S202
Accept: 0,
Ignore: "",
},
ActionRow{ // S203
Accept: 0,
Ignore: "",
},
ActionRow{ // S204
Accept: 0,
Ignore: "",
},
ActionRow{ // S205
Accept: 0,
Ignore: "",
},
ActionRow{ // S206
Accept: 0,
Ignore: "",
},
ActionRow{ // S207
Accept: 0,
Ignore: "",
},
ActionRow{ // S208
Accept: 0,
Ignore: "",
},
ActionRow{ // S209
Accept: 0,
Ignore: "",
},
ActionRow{ // S210
Accept: 0,
Ignore: "",
},
}

View File

@@ -11,8 +11,8 @@ import (
const (
NoState = -1
NumStates = 52
NumSymbols = 57
NumStates = 211
NumSymbols = 101
)
type Lexer struct {
@@ -129,61 +129,105 @@ func (l *Lexer) Reset() {
/*
Lexer symbols:
0: '`'
1: '`'
2: '"'
3: '"'
4: '-'
5: '+'
6: '0'
7: 'b'
8: '_'
9: '-'
10: '+'
11: '0'
12: 'o'
13: '_'
14: '-'
15: '+'
16: '_'
17: '-'
18: '+'
19: '0'
20: 'x'
21: '_'
22: '('
23: ')'
24: '.'
25: '_'
26: '~'
27: '!'
28: '@'
29: '#'
30: '$'
31: '%'
32: '^'
33: '&'
34: '*'
35: '-'
36: '_'
37: '+'
38: '='
39: '?'
40: '/'
41: '.'
42: '''
43: ' '
44: '\t'
45: '\n'
46: '\r'
47: ';'
48: '\n'
49: '0'-'1'
50: '2'-'7'
51: '8'-'9'
52: 'A'-'F'
53: 'a'-'f'
54: 'A'-'Z'
55: 'a'-'z'
56: .
0: '''
1: '''
2: 'i'
3: '('
4: ')'
5: '.'
6: '`'
7: '`'
8: '"'
9: '"'
10: '\'
11: 'u'
12: '\'
13: 'U'
14: '\'
15: 'a'
16: 'b'
17: 'f'
18: 'n'
19: 'r'
20: 't'
21: 'v'
22: '\'
23: '''
24: '"'
25: '\'
26: '\'
27: 'x'
28: '_'
29: '_'
30: '_'
31: '_'
32: '-'
33: '+'
34: '0'
35: 'b'
36: 'B'
37: '-'
38: '+'
39: '0'
40: 'o'
41: 'O'
42: '-'
43: '+'
44: '-'
45: '+'
46: '0'
47: 'x'
48: 'X'
49: 'e'
50: 'E'
51: '+'
52: '-'
53: '-'
54: '+'
55: '.'
56: '.'
57: 'p'
58: 'P'
59: '+'
60: '-'
61: '_'
62: '.'
63: '_'
64: '.'
65: '-'
66: '+'
67: '0'
68: 'x'
69: 'X'
70: '_'
71: '~'
72: '!'
73: '@'
74: '#'
75: '$'
76: '%'
77: '^'
78: '&'
79: '*'
80: '-'
81: '_'
82: '+'
83: '='
84: '?'
85: '/'
86: '.'
87: ' '
88: '\t'
89: '\n'
90: '\r'
91: ';'
92: '\n'
93: '0'-'1'
94: '2'-'7'
95: '8'-'9'
96: 'A'-'F'
97: 'a'-'f'
98: 'A'-'Z'
99: 'a'-'z'
100: .
*/

File diff suppressed because it is too large Load Diff

View File

@@ -17,7 +17,10 @@ var actionTab = actionTable{
nil, // INVALID
nil, // ␚
nil, // string
nil, // number
nil, // rune
nil, // int
nil, // float
nil, // imaginary
nil, // name
shift(4), // (
nil, // )
@@ -30,7 +33,10 @@ var actionTab = actionTable{
nil, // INVALID
accept(true), // ␚
nil, // string
nil, // number
nil, // rune
nil, // int
nil, // float
nil, // imaginary
nil, // name
nil, // (
nil, // )
@@ -43,7 +49,10 @@ var actionTab = actionTable{
nil, // INVALID
reduce(1), // ␚, reduce: Schema
nil, // string
nil, // number
nil, // rune
nil, // int
nil, // float
nil, // imaginary
nil, // name
shift(4), // (
nil, // )
@@ -56,7 +65,10 @@ var actionTab = actionTable{
nil, // INVALID
reduce(2), // ␚, reduce: ExprList
nil, // string
nil, // number
nil, // rune
nil, // int
nil, // float
nil, // imaginary
nil, // name
reduce(2), // (, reduce: ExprList
nil, // )
@@ -69,7 +81,10 @@ var actionTab = actionTable{
nil, // INVALID
nil, // ␚
nil, // string
nil, // number
nil, // rune
nil, // int
nil, // float
nil, // imaginary
shift(6), // name
nil, // (
nil, // )
@@ -82,7 +97,10 @@ var actionTab = actionTable{
nil, // INVALID
reduce(3), // ␚, reduce: ExprList
nil, // string
nil, // number
nil, // rune
nil, // int
nil, // float
nil, // imaginary
nil, // name
reduce(3), // (, reduce: ExprList
nil, // )
@@ -95,10 +113,13 @@ var actionTab = actionTable{
nil, // INVALID
nil, // ␚
shift(10), // string
shift(11), // number
shift(12), // name
shift(13), // (
shift(14), // )
shift(11), // rune
shift(12), // int
shift(13), // float
shift(14), // imaginary
shift(15), // name
shift(16), // (
shift(17), // )
nil, // .
},
},
@@ -108,9 +129,12 @@ var actionTab = actionTable{
nil, // INVALID
nil, // ␚
shift(10), // string
shift(11), // number
shift(12), // name
shift(13), // (
shift(11), // rune
shift(12), // int
shift(13), // float
shift(14), // imaginary
shift(15), // name
shift(16), // (
nil, // )
nil, // .
},
@@ -118,14 +142,17 @@ var actionTab = actionTable{
actionRow{ // S8
canRecover: false,
actions: [numSymbols]action{
nil, // INVALID
nil, // ␚
reduce(9), // string, reduce: Val
reduce(9), // number, reduce: Val
reduce(9), // name, reduce: Val
reduce(9), // (, reduce: Val
reduce(9), // ), reduce: Val
nil, // .
nil, // INVALID
nil, // ␚
reduce(12), // string, reduce: Val
reduce(12), // rune, reduce: Val
reduce(12), // int, reduce: Val
reduce(12), // float, reduce: Val
reduce(12), // imaginary, reduce: Val
reduce(12), // name, reduce: Val
reduce(12), // (, reduce: Val
reduce(12), // ), reduce: Val
nil, // .
},
},
actionRow{ // S9
@@ -133,11 +160,14 @@ var actionTab = actionTable{
actions: [numSymbols]action{
nil, // INVALID
nil, // ␚
shift(19), // string
shift(20), // number
shift(21), // name
shift(22), // (
shift(23), // )
shift(22), // string
shift(23), // rune
shift(24), // int
shift(25), // float
shift(26), // imaginary
shift(27), // name
shift(28), // (
shift(29), // )
nil, // .
},
},
@@ -147,7 +177,10 @@ var actionTab = actionTable{
nil, // INVALID
nil, // ␚
reduce(6), // string, reduce: Val
reduce(6), // number, reduce: Val
reduce(6), // rune, reduce: Val
reduce(6), // int, reduce: Val
reduce(6), // float, reduce: Val
reduce(6), // imaginary, reduce: Val
reduce(6), // name, reduce: Val
reduce(6), // (, reduce: Val
reduce(6), // ), reduce: Val
@@ -160,7 +193,10 @@ var actionTab = actionTable{
nil, // INVALID
nil, // ␚
reduce(7), // string, reduce: Val
reduce(7), // number, reduce: Val
reduce(7), // rune, reduce: Val
reduce(7), // int, reduce: Val
reduce(7), // float, reduce: Val
reduce(7), // imaginary, reduce: Val
reduce(7), // name, reduce: Val
reduce(7), // (, reduce: Val
reduce(7), // ), reduce: Val
@@ -173,7 +209,10 @@ var actionTab = actionTable{
nil, // INVALID
nil, // ␚
reduce(8), // string, reduce: Val
reduce(8), // number, reduce: Val
reduce(8), // rune, reduce: Val
reduce(8), // int, reduce: Val
reduce(8), // float, reduce: Val
reduce(8), // imaginary, reduce: Val
reduce(8), // name, reduce: Val
reduce(8), // (, reduce: Val
reduce(8), // ), reduce: Val
@@ -185,38 +224,47 @@ var actionTab = actionTable{
actions: [numSymbols]action{
nil, // INVALID
nil, // ␚
nil, // string
nil, // number
shift(24), // name
nil, // (
nil, // )
shift(25), // .
reduce(9), // string, reduce: Val
reduce(9), // rune, reduce: Val
reduce(9), // int, reduce: Val
reduce(9), // float, reduce: Val
reduce(9), // imaginary, reduce: Val
reduce(9), // name, reduce: Val
reduce(9), // (, reduce: Val
reduce(9), // ), reduce: Val
nil, // .
},
},
actionRow{ // S14
canRecover: false,
actions: [numSymbols]action{
nil, // INVALID
reduce(12), // ␚, reduce: Expr
nil, // string
nil, // number
nil, // name
reduce(12), // (, reduce: Expr
nil, // )
nil, // ␚
reduce(10), // string, reduce: Val
reduce(10), // rune, reduce: Val
reduce(10), // int, reduce: Val
reduce(10), // float, reduce: Val
reduce(10), // imaginary, reduce: Val
reduce(10), // name, reduce: Val
reduce(10), // (, reduce: Val
reduce(10), // ), reduce: Val
nil, // .
},
},
actionRow{ // S15
canRecover: false,
actions: [numSymbols]action{
nil, // INVALID
nil, // ␚
shift(10), // string
shift(11), // number
shift(12), // name
shift(13), // (
shift(27), // )
nil, // .
nil, // INVALID
nil, // ␚
reduce(11), // string, reduce: Val
reduce(11), // rune, reduce: Val
reduce(11), // int, reduce: Val
reduce(11), // float, reduce: Val
reduce(11), // imaginary, reduce: Val
reduce(11), // name, reduce: Val
reduce(11), // (, reduce: Val
reduce(11), // ), reduce: Val
nil, // .
},
},
actionRow{ // S16
@@ -224,25 +272,31 @@ var actionTab = actionTable{
actions: [numSymbols]action{
nil, // INVALID
nil, // ␚
reduce(4), // string, reduce: ValList
reduce(4), // number, reduce: ValList
reduce(4), // name, reduce: ValList
reduce(4), // (, reduce: ValList
reduce(4), // ), reduce: ValList
nil, // .
nil, // string
nil, // rune
nil, // int
nil, // float
nil, // imaginary
shift(30), // name
nil, // (
nil, // )
shift(31), // .
},
},
actionRow{ // S17
canRecover: false,
actions: [numSymbols]action{
nil, // INVALID
nil, // ␚
nil, // string
nil, // number
nil, // name
nil, // (
reduce(9), // ), reduce: Val
nil, // .
nil, // INVALID
reduce(15), // ␚, reduce: Expr
nil, // string
nil, // rune
nil, // int
nil, // float
nil, // imaginary
nil, // name
reduce(15), // (, reduce: Expr
nil, // )
nil, // .
},
},
actionRow{ // S18
@@ -250,11 +304,14 @@ var actionTab = actionTable{
actions: [numSymbols]action{
nil, // INVALID
nil, // ␚
nil, // string
nil, // number
nil, // name
nil, // (
shift(28), // )
shift(10), // string
shift(11), // rune
shift(12), // int
shift(13), // float
shift(14), // imaginary
shift(15), // name
shift(16), // (
shift(33), // )
nil, // .
},
},
@@ -263,25 +320,31 @@ var actionTab = actionTable{
actions: [numSymbols]action{
nil, // INVALID
nil, // ␚
nil, // string
nil, // number
nil, // name
nil, // (
reduce(6), // ), reduce: Val
reduce(4), // string, reduce: ValList
reduce(4), // rune, reduce: ValList
reduce(4), // int, reduce: ValList
reduce(4), // float, reduce: ValList
reduce(4), // imaginary, reduce: ValList
reduce(4), // name, reduce: ValList
reduce(4), // (, reduce: ValList
reduce(4), // ), reduce: ValList
nil, // .
},
},
actionRow{ // S20
canRecover: false,
actions: [numSymbols]action{
nil, // INVALID
nil, // ␚
nil, // string
nil, // number
nil, // name
nil, // (
reduce(7), // ), reduce: Val
nil, // .
nil, // INVALID
nil, // ␚
nil, // string
nil, // rune
nil, // int
nil, // float
nil, // imaginary
nil, // name
nil, // (
reduce(12), // ), reduce: Val
nil, // .
},
},
actionRow{ // S21
@@ -290,10 +353,13 @@ var actionTab = actionTable{
nil, // INVALID
nil, // ␚
nil, // string
nil, // number
nil, // rune
nil, // int
nil, // float
nil, // imaginary
nil, // name
nil, // (
reduce(8), // ), reduce: Val
shift(34), // )
nil, // .
},
},
@@ -303,24 +369,30 @@ var actionTab = actionTable{
nil, // INVALID
nil, // ␚
nil, // string
nil, // number
shift(29), // name
nil, // rune
nil, // int
nil, // float
nil, // imaginary
nil, // name
nil, // (
nil, // )
shift(30), // .
reduce(6), // ), reduce: Val
nil, // .
},
},
actionRow{ // S23
canRecover: false,
actions: [numSymbols]action{
nil, // INVALID
reduce(11), // ␚, reduce: Expr
nil, // string
nil, // number
nil, // name
reduce(11), // (, reduce: Expr
nil, // )
nil, // .
nil, // INVALID
nil, // ␚
nil, // string
nil, // rune
nil, // int
nil, // float
nil, // imaginary
nil, // name
nil, // (
reduce(7), // ), reduce: Val
nil, // .
},
},
actionRow{ // S24
@@ -328,11 +400,14 @@ var actionTab = actionTable{
actions: [numSymbols]action{
nil, // INVALID
nil, // ␚
shift(10), // string
shift(11), // number
shift(12), // name
shift(13), // (
shift(32), // )
nil, // string
nil, // rune
nil, // int
nil, // float
nil, // imaginary
nil, // name
nil, // (
reduce(8), // ), reduce: Val
nil, // .
},
},
@@ -341,64 +416,79 @@ var actionTab = actionTable{
actions: [numSymbols]action{
nil, // INVALID
nil, // ␚
shift(10), // string
shift(11), // number
shift(12), // name
shift(13), // (
nil, // )
nil, // string
nil, // rune
nil, // int
nil, // float
nil, // imaginary
nil, // name
nil, // (
reduce(9), // ), reduce: Val
nil, // .
},
},
actionRow{ // S26
canRecover: false,
actions: [numSymbols]action{
nil, // INVALID
nil, // ␚
reduce(5), // string, reduce: ValList
reduce(5), // number, reduce: ValList
reduce(5), // name, reduce: ValList
reduce(5), // (, reduce: ValList
reduce(5), // ), reduce: ValList
nil, // .
nil, // INVALID
nil, // ␚
nil, // string
nil, // rune
nil, // int
nil, // float
nil, // imaginary
nil, // name
nil, // (
reduce(10), // ), reduce: Val
nil, // .
},
},
actionRow{ // S27
canRecover: false,
actions: [numSymbols]action{
nil, // INVALID
reduce(13), // ␚, reduce: Expr
nil, // ␚
nil, // string
nil, // number
nil, // rune
nil, // int
nil, // float
nil, // imaginary
nil, // name
reduce(13), // (, reduce: Expr
nil, // )
nil, // (
reduce(11), // ), reduce: Val
nil, // .
},
},
actionRow{ // S28
canRecover: false,
actions: [numSymbols]action{
nil, // INVALID
reduce(10), // ␚, reduce: Expr
nil, // string
nil, // number
nil, // name
reduce(10), // (, reduce: Expr
nil, // )
nil, // .
nil, // INVALID
nil, // ␚
nil, // string
nil, // rune
nil, // int
nil, // float
nil, // imaginary
shift(35), // name
nil, // (
nil, // )
shift(36), // .
},
},
actionRow{ // S29
canRecover: false,
actions: [numSymbols]action{
nil, // INVALID
nil, // ␚
shift(10), // string
shift(11), // number
shift(12), // name
shift(13), // (
shift(35), // )
nil, // .
nil, // INVALID
reduce(14), // ␚, reduce: Expr
nil, // string
nil, // rune
nil, // int
nil, // float
nil, // imaginary
nil, // name
reduce(14), // (, reduce: Expr
nil, // )
nil, // .
},
},
actionRow{ // S30
@@ -407,10 +497,13 @@ var actionTab = actionTable{
nil, // INVALID
nil, // ␚
shift(10), // string
shift(11), // number
shift(12), // name
shift(13), // (
nil, // )
shift(11), // rune
shift(12), // int
shift(13), // float
shift(14), // imaginary
shift(15), // name
shift(16), // (
shift(38), // )
nil, // .
},
},
@@ -419,64 +512,79 @@ var actionTab = actionTable{
actions: [numSymbols]action{
nil, // INVALID
nil, // ␚
shift(19), // string
shift(20), // number
shift(21), // name
shift(22), // (
shift(38), // )
shift(10), // string
shift(11), // rune
shift(12), // int
shift(13), // float
shift(14), // imaginary
shift(15), // name
shift(16), // (
nil, // )
nil, // .
},
},
actionRow{ // S32
canRecover: false,
actions: [numSymbols]action{
nil, // INVALID
nil, // ␚
reduce(12), // string, reduce: Expr
reduce(12), // number, reduce: Expr
reduce(12), // name, reduce: Expr
reduce(12), // (, reduce: Expr
reduce(12), // ), reduce: Expr
nil, // .
nil, // INVALID
nil, // ␚
reduce(5), // string, reduce: ValList
reduce(5), // rune, reduce: ValList
reduce(5), // int, reduce: ValList
reduce(5), // float, reduce: ValList
reduce(5), // imaginary, reduce: ValList
reduce(5), // name, reduce: ValList
reduce(5), // (, reduce: ValList
reduce(5), // ), reduce: ValList
nil, // .
},
},
actionRow{ // S33
canRecover: false,
actions: [numSymbols]action{
nil, // INVALID
nil, // ␚
shift(10), // string
shift(11), // number
shift(12), // name
shift(13), // (
shift(39), // )
nil, // .
nil, // INVALID
reduce(16), // ␚, reduce: Expr
nil, // string
nil, // rune
nil, // int
nil, // float
nil, // imaginary
nil, // name
reduce(16), // (, reduce: Expr
nil, // )
nil, // .
},
},
actionRow{ // S34
canRecover: false,
actions: [numSymbols]action{
nil, // INVALID
nil, // ␚
shift(19), // string
shift(20), // number
shift(21), // name
shift(22), // (
shift(41), // )
nil, // .
nil, // INVALID
reduce(13), // ␚, reduce: Expr
nil, // string
nil, // rune
nil, // int
nil, // float
nil, // imaginary
nil, // name
reduce(13), // (, reduce: Expr
nil, // )
nil, // .
},
},
actionRow{ // S35
canRecover: false,
actions: [numSymbols]action{
nil, // INVALID
nil, // ␚
nil, // string
nil, // number
nil, // name
nil, // (
reduce(12), // ), reduce: Expr
nil, // .
nil, // INVALID
nil, // ␚
shift(10), // string
shift(11), // rune
shift(12), // int
shift(13), // float
shift(14), // imaginary
shift(15), // name
shift(16), // (
shift(41), // )
nil, // .
},
},
actionRow{ // S36
@@ -485,10 +593,13 @@ var actionTab = actionTable{
nil, // INVALID
nil, // ␚
shift(10), // string
shift(11), // number
shift(12), // name
shift(13), // (
shift(42), // )
shift(11), // rune
shift(12), // int
shift(13), // float
shift(14), // imaginary
shift(15), // name
shift(16), // (
nil, // )
nil, // .
},
},
@@ -497,11 +608,14 @@ var actionTab = actionTable{
actions: [numSymbols]action{
nil, // INVALID
nil, // ␚
nil, // string
nil, // number
nil, // name
nil, // (
shift(43), // )
shift(22), // string
shift(23), // rune
shift(24), // int
shift(25), // float
shift(26), // imaginary
shift(27), // name
shift(28), // (
shift(44), // )
nil, // .
},
},
@@ -510,25 +624,31 @@ var actionTab = actionTable{
actions: [numSymbols]action{
nil, // INVALID
nil, // ␚
reduce(11), // string, reduce: Expr
reduce(11), // number, reduce: Expr
reduce(11), // name, reduce: Expr
reduce(11), // (, reduce: Expr
reduce(11), // ), reduce: Expr
reduce(15), // string, reduce: Expr
reduce(15), // rune, reduce: Expr
reduce(15), // int, reduce: Expr
reduce(15), // float, reduce: Expr
reduce(15), // imaginary, reduce: Expr
reduce(15), // name, reduce: Expr
reduce(15), // (, reduce: Expr
reduce(15), // ), reduce: Expr
nil, // .
},
},
actionRow{ // S39
canRecover: false,
actions: [numSymbols]action{
nil, // INVALID
nil, // ␚
reduce(13), // string, reduce: Expr
reduce(13), // number, reduce: Expr
reduce(13), // name, reduce: Expr
reduce(13), // (, reduce: Expr
reduce(13), // ), reduce: Expr
nil, // .
nil, // INVALID
nil, // ␚
shift(10), // string
shift(11), // rune
shift(12), // int
shift(13), // float
shift(14), // imaginary
shift(15), // name
shift(16), // (
shift(45), // )
nil, // .
},
},
actionRow{ // S40
@@ -536,11 +656,14 @@ var actionTab = actionTable{
actions: [numSymbols]action{
nil, // INVALID
nil, // ␚
nil, // string
nil, // number
nil, // name
nil, // (
shift(44), // )
shift(22), // string
shift(23), // rune
shift(24), // int
shift(25), // float
shift(26), // imaginary
shift(27), // name
shift(28), // (
shift(47), // )
nil, // .
},
},
@@ -550,49 +673,157 @@ var actionTab = actionTable{
nil, // INVALID
nil, // ␚
nil, // string
nil, // number
nil, // rune
nil, // int
nil, // float
nil, // imaginary
nil, // name
nil, // (
reduce(11), // ), reduce: Expr
reduce(15), // ), reduce: Expr
nil, // .
},
},
actionRow{ // S42
canRecover: false,
actions: [numSymbols]action{
nil, // INVALID
nil, // ␚
nil, // string
nil, // number
nil, // name
nil, // (
reduce(13), // ), reduce: Expr
nil, // .
nil, // INVALID
nil, // ␚
shift(10), // string
shift(11), // rune
shift(12), // int
shift(13), // float
shift(14), // imaginary
shift(15), // name
shift(16), // (
shift(48), // )
nil, // .
},
},
actionRow{ // S43
canRecover: false,
actions: [numSymbols]action{
nil, // INVALID
nil, // ␚
reduce(10), // string, reduce: Expr
reduce(10), // number, reduce: Expr
reduce(10), // name, reduce: Expr
reduce(10), // (, reduce: Expr
reduce(10), // ), reduce: Expr
nil, // .
nil, // INVALID
nil, // ␚
nil, // string
nil, // rune
nil, // int
nil, // float
nil, // imaginary
nil, // name
nil, // (
shift(49), // )
nil, // .
},
},
actionRow{ // S44
canRecover: false,
actions: [numSymbols]action{
nil, // INVALID
nil, // ␚
reduce(14), // string, reduce: Expr
reduce(14), // rune, reduce: Expr
reduce(14), // int, reduce: Expr
reduce(14), // float, reduce: Expr
reduce(14), // imaginary, reduce: Expr
reduce(14), // name, reduce: Expr
reduce(14), // (, reduce: Expr
reduce(14), // ), reduce: Expr
nil, // .
},
},
actionRow{ // S45
canRecover: false,
actions: [numSymbols]action{
nil, // INVALID
nil, // ␚
reduce(16), // string, reduce: Expr
reduce(16), // rune, reduce: Expr
reduce(16), // int, reduce: Expr
reduce(16), // float, reduce: Expr
reduce(16), // imaginary, reduce: Expr
reduce(16), // name, reduce: Expr
reduce(16), // (, reduce: Expr
reduce(16), // ), reduce: Expr
nil, // .
},
},
actionRow{ // S46
canRecover: false,
actions: [numSymbols]action{
nil, // INVALID
nil, // ␚
nil, // string
nil, // rune
nil, // int
nil, // float
nil, // imaginary
nil, // name
nil, // (
shift(50), // )
nil, // .
},
},
actionRow{ // S47
canRecover: false,
actions: [numSymbols]action{
nil, // INVALID
nil, // ␚
nil, // string
nil, // number
nil, // rune
nil, // int
nil, // float
nil, // imaginary
nil, // name
nil, // (
reduce(10), // ), reduce: Expr
reduce(14), // ), reduce: Expr
nil, // .
},
},
actionRow{ // S48
canRecover: false,
actions: [numSymbols]action{
nil, // INVALID
nil, // ␚
nil, // string
nil, // rune
nil, // int
nil, // float
nil, // imaginary
nil, // name
nil, // (
reduce(16), // ), reduce: Expr
nil, // .
},
},
actionRow{ // S49
canRecover: false,
actions: [numSymbols]action{
nil, // INVALID
nil, // ␚
reduce(13), // string, reduce: Expr
reduce(13), // rune, reduce: Expr
reduce(13), // int, reduce: Expr
reduce(13), // float, reduce: Expr
reduce(13), // imaginary, reduce: Expr
reduce(13), // name, reduce: Expr
reduce(13), // (, reduce: Expr
reduce(13), // ), reduce: Expr
nil, // .
},
},
actionRow{ // S50
canRecover: false,
actions: [numSymbols]action{
nil, // INVALID
nil, // ␚
nil, // string
nil, // rune
nil, // int
nil, // float
nil, // imaginary
nil, // name
nil, // (
reduce(13), // ), reduce: Expr
nil, // .
},
},

View File

@@ -70,8 +70,8 @@ var gotoTab = gotoTable{
-1, // S'
-1, // Schema
-1, // ExprList
15, // ValList
16, // Val
18, // ValList
19, // Val
8, // Expr
},
gotoRow{ // S8
@@ -87,8 +87,8 @@ var gotoTab = gotoTable{
-1, // Schema
-1, // ExprList
-1, // ValList
18, // Val
17, // Expr
21, // Val
20, // Expr
},
gotoRow{ // S10
-1, // S'
@@ -135,8 +135,8 @@ var gotoTab = gotoTable{
-1, // Schema
-1, // ExprList
-1, // ValList
26, // Val
8, // Expr
-1, // Val
-1, // Expr
},
gotoRow{ // S16
-1, // S'
@@ -159,8 +159,8 @@ var gotoTab = gotoTable{
-1, // Schema
-1, // ExprList
-1, // ValList
-1, // Val
-1, // Expr
32, // Val
8, // Expr
},
gotoRow{ // S19
-1, // S'
@@ -207,16 +207,16 @@ var gotoTab = gotoTable{
-1, // Schema
-1, // ExprList
-1, // ValList
31, // Val
8, // Expr
-1, // Val
-1, // Expr
},
gotoRow{ // S25
-1, // S'
-1, // Schema
-1, // ExprList
33, // ValList
16, // Val
8, // Expr
-1, // ValList
-1, // Val
-1, // Expr
},
gotoRow{ // S26
-1, // S'
@@ -247,24 +247,24 @@ var gotoTab = gotoTable{
-1, // Schema
-1, // ExprList
-1, // ValList
34, // Val
8, // Expr
-1, // Val
-1, // Expr
},
gotoRow{ // S30
-1, // S'
-1, // Schema
-1, // ExprList
36, // ValList
16, // Val
-1, // ValList
37, // Val
8, // Expr
},
gotoRow{ // S31
-1, // S'
-1, // Schema
-1, // ExprList
-1, // ValList
37, // Val
17, // Expr
39, // ValList
19, // Val
8, // Expr
},
gotoRow{ // S32
-1, // S'
@@ -279,18 +279,10 @@ var gotoTab = gotoTable{
-1, // Schema
-1, // ExprList
-1, // ValList
26, // Val
8, // Expr
-1, // Val
-1, // Expr
},
gotoRow{ // S34
-1, // S'
-1, // Schema
-1, // ExprList
-1, // ValList
40, // Val
17, // Expr
},
gotoRow{ // S35
-1, // S'
-1, // Schema
-1, // ExprList
@@ -298,12 +290,20 @@ var gotoTab = gotoTable{
-1, // Val
-1, // Expr
},
gotoRow{ // S36
gotoRow{ // S35
-1, // S'
-1, // Schema
-1, // ExprList
-1, // ValList
26, // Val
40, // Val
8, // Expr
},
gotoRow{ // S36
-1, // S'
-1, // Schema
-1, // ExprList
42, // ValList
19, // Val
8, // Expr
},
gotoRow{ // S37
@@ -311,8 +311,8 @@ var gotoTab = gotoTable{
-1, // Schema
-1, // ExprList
-1, // ValList
-1, // Val
-1, // Expr
43, // Val
20, // Expr
},
gotoRow{ // S38
-1, // S'
@@ -327,16 +327,16 @@ var gotoTab = gotoTable{
-1, // Schema
-1, // ExprList
-1, // ValList
-1, // Val
-1, // Expr
32, // Val
8, // Expr
},
gotoRow{ // S40
-1, // S'
-1, // Schema
-1, // ExprList
-1, // ValList
-1, // Val
-1, // Expr
46, // Val
20, // Expr
},
gotoRow{ // S41
-1, // S'
@@ -351,8 +351,8 @@ var gotoTab = gotoTable{
-1, // Schema
-1, // ExprList
-1, // ValList
-1, // Val
-1, // Expr
32, // Val
8, // Expr
},
gotoRow{ // S43
-1, // S'
@@ -370,4 +370,52 @@ var gotoTab = gotoTable{
-1, // Val
-1, // Expr
},
gotoRow{ // S45
-1, // S'
-1, // Schema
-1, // ExprList
-1, // ValList
-1, // Val
-1, // Expr
},
gotoRow{ // S46
-1, // S'
-1, // Schema
-1, // ExprList
-1, // ValList
-1, // Val
-1, // Expr
},
gotoRow{ // S47
-1, // S'
-1, // Schema
-1, // ExprList
-1, // ValList
-1, // Val
-1, // Expr
},
gotoRow{ // S48
-1, // S'
-1, // Schema
-1, // ExprList
-1, // ValList
-1, // Val
-1, // Expr
},
gotoRow{ // S49
-1, // S'
-1, // Schema
-1, // ExprList
-1, // ValList
-1, // Val
-1, // Expr
},
gotoRow{ // S50
-1, // S'
-1, // Schema
-1, // ExprList
-1, // ValList
-1, // Val
-1, // Expr
},
}

View File

@@ -11,9 +11,9 @@ import (
)
const (
numProductions = 14
numStates = 45
numSymbols = 14
numProductions = 17
numStates = 51
numSymbols = 17
)
// Stack

View File

@@ -93,20 +93,50 @@ var productionsTable = ProdTab{
},
},
ProdTabEntry{
String: `Val : number << ast.NewNumberVal(X[0].(*token.Token)) >>`,
String: `Val : rune << ast.NewRuneVal(X[0].(*token.Token)) >>`,
Id: "Val",
NTType: 4,
Index: 7,
NumSymbols: 1,
ReduceFunc: func(X []Attrib, C interface{}) (Attrib, error) {
return ast.NewNumberVal(X[0].(*token.Token))
return ast.NewRuneVal(X[0].(*token.Token))
},
},
ProdTabEntry{
String: `Val : int << ast.NewIntVal(X[0].(*token.Token)) >>`,
Id: "Val",
NTType: 4,
Index: 8,
NumSymbols: 1,
ReduceFunc: func(X []Attrib, C interface{}) (Attrib, error) {
return ast.NewIntVal(X[0].(*token.Token))
},
},
ProdTabEntry{
String: `Val : float << ast.NewFloatVal(X[0].(*token.Token)) >>`,
Id: "Val",
NTType: 4,
Index: 9,
NumSymbols: 1,
ReduceFunc: func(X []Attrib, C interface{}) (Attrib, error) {
return ast.NewFloatVal(X[0].(*token.Token))
},
},
ProdTabEntry{
String: `Val : imaginary << ast.NewComplexVal(X[0].(*token.Token)) >>`,
Id: "Val",
NTType: 4,
Index: 10,
NumSymbols: 1,
ReduceFunc: func(X []Attrib, C interface{}) (Attrib, error) {
return ast.NewComplexVal(X[0].(*token.Token))
},
},
ProdTabEntry{
String: `Val : name << ast.NewNameVal(X[0].(*token.Token)) >>`,
Id: "Val",
NTType: 4,
Index: 8,
Index: 11,
NumSymbols: 1,
ReduceFunc: func(X []Attrib, C interface{}) (Attrib, error) {
return ast.NewNameVal(X[0].(*token.Token))
@@ -116,7 +146,7 @@ var productionsTable = ProdTab{
String: `Val : Expr << ast.NewExprVal(X[0]) >>`,
Id: "Val",
NTType: 4,
Index: 9,
Index: 12,
NumSymbols: 1,
ReduceFunc: func(X []Attrib, C interface{}) (Attrib, error) {
return ast.NewExprVal(X[0])
@@ -126,7 +156,7 @@ var productionsTable = ProdTab{
String: `Expr : "(" name Val Val ")" << ast.NewExpr(X[1].(*token.Token), X[2], X[3]) >>`,
Id: "Expr",
NTType: 5,
Index: 10,
Index: 13,
NumSymbols: 5,
ReduceFunc: func(X []Attrib, C interface{}) (Attrib, error) {
return ast.NewExpr(X[1].(*token.Token), X[2], X[3])
@@ -136,7 +166,7 @@ var productionsTable = ProdTab{
String: `Expr : "(" name Val ")" << ast.NewExpr(X[1].(*token.Token), X[2], nil) >>`,
Id: "Expr",
NTType: 5,
Index: 11,
Index: 14,
NumSymbols: 4,
ReduceFunc: func(X []Attrib, C interface{}) (Attrib, error) {
return ast.NewExpr(X[1].(*token.Token), X[2], nil)
@@ -146,7 +176,7 @@ var productionsTable = ProdTab{
String: `Expr : "(" name ")" << ast.NewExpr(X[1].(*token.Token), nil, nil) >>`,
Id: "Expr",
NTType: 5,
Index: 12,
Index: 15,
NumSymbols: 3,
ReduceFunc: func(X []Attrib, C interface{}) (Attrib, error) {
return ast.NewExpr(X[1].(*token.Token), nil, nil)
@@ -156,7 +186,7 @@ var productionsTable = ProdTab{
String: `Expr : "(" "." ValList ")" << ast.ListExpr(X[2]) >>`,
Id: "Expr",
NTType: 5,
Index: 13,
Index: 16,
NumSymbols: 4,
ReduceFunc: func(X []Attrib, C interface{}) (Attrib, error) {
return ast.ListExpr(X[2])

View File

@@ -6,13 +6,19 @@ import (
)
func TestParser(t *testing.T) {
test := "(test)" +
"(test a)" +
"(test a b)" +
"(test \"a\" \"b\")" +
"(+ 0b1010 -0xDEAD_BEEF)" +
"(. a b c d e f g)" +
"(test (test1 \"hi\") (test2 \"hi 2\"))" +
"(test (. \"awa\" \"awawa\" \"awawawa\" \"awawawawa\"))"
fmt.Println(CreateSchema(test))
test := "(test)\n ; test comment" +
"(test a)\n" +
"(test a b)\n" +
"(test \"a\" \"b\")\n" +
"(+ 0b1010 -0xDEAD_BEEF)\n" +
"(. a b c d e f g)\n" +
"(test (test1 \"hi\") (test2 \"hi 2\"))\n" +
"(test (. \"awa\" `awawa` \"awawawa\" \"awawawawa\"))\n" +
"(test \n `new\nline`)\n" +
"(test (. 0x0.1Fp1 '\\t' 2i '\\u6767' '\\U0001F600' '\\x23' '\\043'))\n"
schema, err := CreateSchema(test)
if err != nil {
t.Fatal(err)
}
fmt.Println(schema)
}

View File

@@ -139,7 +139,10 @@ var TokMap = TokenMap{
"INVALID",
"␚",
"string",
"number",
"rune",
"int",
"float",
"imaginary",
"name",
"(",
")",
@@ -147,13 +150,16 @@ var TokMap = TokenMap{
},
idMap: map[string]Type{
"INVALID": 0,
"␚": 1,
"string": 2,
"number": 3,
"name": 4,
"(": 5,
")": 6,
".": 7,
"INVALID": 0,
"␚": 1,
"string": 2,
"rune": 3,
"int": 4,
"float": 5,
"imaginary": 6,
"name": 7,
"(": 8,
")": 9,
".": 10,
},
}