mirror of
https://github.com/danog/parser.git
synced 2024-12-03 09:57:45 +01:00
ac42958b4f
- added `prelude` - moved `ast` to `parser` - moved `Lexer` from `crate::lexer::lexer::Lexer` to `crate::lexer::Lexer` - renamed `LexerError` to `SyntaxError` - moved `SyntaxError` to `token::error` - implemented `Display` for `SyntaxError` - add `tokens.txt` to integration tests - removed all unit tests for `Lexer` ( everything is tested in integration tests ) - improved syntax error assertations
1084 lines
16 KiB
Plaintext
1084 lines
16 KiB
Plaintext
[
|
|
Token {
|
|
kind: OpenTag(
|
|
Full,
|
|
),
|
|
span: (
|
|
1,
|
|
1,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Identifier(
|
|
"define",
|
|
),
|
|
span: (
|
|
3,
|
|
1,
|
|
),
|
|
},
|
|
Token {
|
|
kind: LeftParen,
|
|
span: (
|
|
3,
|
|
7,
|
|
),
|
|
},
|
|
Token {
|
|
kind: LiteralString(
|
|
"a",
|
|
),
|
|
span: (
|
|
3,
|
|
8,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Comma,
|
|
span: (
|
|
3,
|
|
11,
|
|
),
|
|
},
|
|
Token {
|
|
kind: LiteralInteger(
|
|
1,
|
|
),
|
|
span: (
|
|
3,
|
|
13,
|
|
),
|
|
},
|
|
Token {
|
|
kind: DoubleEquals,
|
|
span: (
|
|
3,
|
|
15,
|
|
),
|
|
},
|
|
Token {
|
|
kind: LiteralInteger(
|
|
1,
|
|
),
|
|
span: (
|
|
3,
|
|
18,
|
|
),
|
|
},
|
|
Token {
|
|
kind: RightParen,
|
|
span: (
|
|
3,
|
|
19,
|
|
),
|
|
},
|
|
Token {
|
|
kind: SemiColon,
|
|
span: (
|
|
3,
|
|
20,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Identifier(
|
|
"define",
|
|
),
|
|
span: (
|
|
4,
|
|
1,
|
|
),
|
|
},
|
|
Token {
|
|
kind: LeftParen,
|
|
span: (
|
|
4,
|
|
7,
|
|
),
|
|
},
|
|
Token {
|
|
kind: LiteralString(
|
|
"a",
|
|
),
|
|
span: (
|
|
4,
|
|
8,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Comma,
|
|
span: (
|
|
4,
|
|
11,
|
|
),
|
|
},
|
|
Token {
|
|
kind: LiteralInteger(
|
|
1,
|
|
),
|
|
span: (
|
|
4,
|
|
13,
|
|
),
|
|
},
|
|
Token {
|
|
kind: TripleEquals,
|
|
span: (
|
|
4,
|
|
15,
|
|
),
|
|
},
|
|
Token {
|
|
kind: LiteralInteger(
|
|
1,
|
|
),
|
|
span: (
|
|
4,
|
|
19,
|
|
),
|
|
},
|
|
Token {
|
|
kind: RightParen,
|
|
span: (
|
|
4,
|
|
20,
|
|
),
|
|
},
|
|
Token {
|
|
kind: SemiColon,
|
|
span: (
|
|
4,
|
|
21,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Identifier(
|
|
"define",
|
|
),
|
|
span: (
|
|
5,
|
|
1,
|
|
),
|
|
},
|
|
Token {
|
|
kind: LeftParen,
|
|
span: (
|
|
5,
|
|
7,
|
|
),
|
|
},
|
|
Token {
|
|
kind: LiteralString(
|
|
"a",
|
|
),
|
|
span: (
|
|
5,
|
|
8,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Comma,
|
|
span: (
|
|
5,
|
|
11,
|
|
),
|
|
},
|
|
Token {
|
|
kind: LiteralInteger(
|
|
1,
|
|
),
|
|
span: (
|
|
5,
|
|
13,
|
|
),
|
|
},
|
|
Token {
|
|
kind: BangEquals,
|
|
span: (
|
|
5,
|
|
15,
|
|
),
|
|
},
|
|
Token {
|
|
kind: LiteralInteger(
|
|
1,
|
|
),
|
|
span: (
|
|
5,
|
|
18,
|
|
),
|
|
},
|
|
Token {
|
|
kind: RightParen,
|
|
span: (
|
|
5,
|
|
19,
|
|
),
|
|
},
|
|
Token {
|
|
kind: SemiColon,
|
|
span: (
|
|
5,
|
|
20,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Identifier(
|
|
"define",
|
|
),
|
|
span: (
|
|
6,
|
|
1,
|
|
),
|
|
},
|
|
Token {
|
|
kind: LeftParen,
|
|
span: (
|
|
6,
|
|
7,
|
|
),
|
|
},
|
|
Token {
|
|
kind: LiteralString(
|
|
"a",
|
|
),
|
|
span: (
|
|
6,
|
|
8,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Comma,
|
|
span: (
|
|
6,
|
|
11,
|
|
),
|
|
},
|
|
Token {
|
|
kind: LiteralInteger(
|
|
1,
|
|
),
|
|
span: (
|
|
6,
|
|
13,
|
|
),
|
|
},
|
|
Token {
|
|
kind: BangDoubleEquals,
|
|
span: (
|
|
6,
|
|
15,
|
|
),
|
|
},
|
|
Token {
|
|
kind: LiteralInteger(
|
|
1,
|
|
),
|
|
span: (
|
|
6,
|
|
19,
|
|
),
|
|
},
|
|
Token {
|
|
kind: RightParen,
|
|
span: (
|
|
6,
|
|
20,
|
|
),
|
|
},
|
|
Token {
|
|
kind: SemiColon,
|
|
span: (
|
|
6,
|
|
21,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Identifier(
|
|
"define",
|
|
),
|
|
span: (
|
|
7,
|
|
1,
|
|
),
|
|
},
|
|
Token {
|
|
kind: LeftParen,
|
|
span: (
|
|
7,
|
|
7,
|
|
),
|
|
},
|
|
Token {
|
|
kind: LiteralString(
|
|
"a",
|
|
),
|
|
span: (
|
|
7,
|
|
8,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Comma,
|
|
span: (
|
|
7,
|
|
11,
|
|
),
|
|
},
|
|
Token {
|
|
kind: LiteralInteger(
|
|
1,
|
|
),
|
|
span: (
|
|
7,
|
|
13,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Plus,
|
|
span: (
|
|
7,
|
|
15,
|
|
),
|
|
},
|
|
Token {
|
|
kind: LiteralInteger(
|
|
2,
|
|
),
|
|
span: (
|
|
7,
|
|
17,
|
|
),
|
|
},
|
|
Token {
|
|
kind: RightParen,
|
|
span: (
|
|
7,
|
|
18,
|
|
),
|
|
},
|
|
Token {
|
|
kind: SemiColon,
|
|
span: (
|
|
7,
|
|
19,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Identifier(
|
|
"define",
|
|
),
|
|
span: (
|
|
8,
|
|
1,
|
|
),
|
|
},
|
|
Token {
|
|
kind: LeftParen,
|
|
span: (
|
|
8,
|
|
7,
|
|
),
|
|
},
|
|
Token {
|
|
kind: LiteralString(
|
|
"a",
|
|
),
|
|
span: (
|
|
8,
|
|
8,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Comma,
|
|
span: (
|
|
8,
|
|
11,
|
|
),
|
|
},
|
|
Token {
|
|
kind: LiteralInteger(
|
|
1,
|
|
),
|
|
span: (
|
|
8,
|
|
13,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Minus,
|
|
span: (
|
|
8,
|
|
15,
|
|
),
|
|
},
|
|
Token {
|
|
kind: LiteralInteger(
|
|
2,
|
|
),
|
|
span: (
|
|
8,
|
|
17,
|
|
),
|
|
},
|
|
Token {
|
|
kind: RightParen,
|
|
span: (
|
|
8,
|
|
18,
|
|
),
|
|
},
|
|
Token {
|
|
kind: SemiColon,
|
|
span: (
|
|
8,
|
|
19,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Identifier(
|
|
"define",
|
|
),
|
|
span: (
|
|
9,
|
|
1,
|
|
),
|
|
},
|
|
Token {
|
|
kind: LeftParen,
|
|
span: (
|
|
9,
|
|
7,
|
|
),
|
|
},
|
|
Token {
|
|
kind: LiteralString(
|
|
"a",
|
|
),
|
|
span: (
|
|
9,
|
|
8,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Comma,
|
|
span: (
|
|
9,
|
|
11,
|
|
),
|
|
},
|
|
Token {
|
|
kind: LiteralInteger(
|
|
1,
|
|
),
|
|
span: (
|
|
9,
|
|
13,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Slash,
|
|
span: (
|
|
9,
|
|
15,
|
|
),
|
|
},
|
|
Token {
|
|
kind: LiteralInteger(
|
|
2,
|
|
),
|
|
span: (
|
|
9,
|
|
17,
|
|
),
|
|
},
|
|
Token {
|
|
kind: RightParen,
|
|
span: (
|
|
9,
|
|
18,
|
|
),
|
|
},
|
|
Token {
|
|
kind: SemiColon,
|
|
span: (
|
|
9,
|
|
19,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Identifier(
|
|
"define",
|
|
),
|
|
span: (
|
|
10,
|
|
1,
|
|
),
|
|
},
|
|
Token {
|
|
kind: LeftParen,
|
|
span: (
|
|
10,
|
|
7,
|
|
),
|
|
},
|
|
Token {
|
|
kind: LiteralString(
|
|
"a",
|
|
),
|
|
span: (
|
|
10,
|
|
8,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Comma,
|
|
span: (
|
|
10,
|
|
11,
|
|
),
|
|
},
|
|
Token {
|
|
kind: LiteralInteger(
|
|
1,
|
|
),
|
|
span: (
|
|
10,
|
|
13,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Caret,
|
|
span: (
|
|
10,
|
|
15,
|
|
),
|
|
},
|
|
Token {
|
|
kind: LiteralInteger(
|
|
2,
|
|
),
|
|
span: (
|
|
10,
|
|
17,
|
|
),
|
|
},
|
|
Token {
|
|
kind: RightParen,
|
|
span: (
|
|
10,
|
|
18,
|
|
),
|
|
},
|
|
Token {
|
|
kind: SemiColon,
|
|
span: (
|
|
10,
|
|
19,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Identifier(
|
|
"define",
|
|
),
|
|
span: (
|
|
11,
|
|
1,
|
|
),
|
|
},
|
|
Token {
|
|
kind: LeftParen,
|
|
span: (
|
|
11,
|
|
7,
|
|
),
|
|
},
|
|
Token {
|
|
kind: LiteralString(
|
|
"a",
|
|
),
|
|
span: (
|
|
11,
|
|
8,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Comma,
|
|
span: (
|
|
11,
|
|
11,
|
|
),
|
|
},
|
|
Token {
|
|
kind: LiteralInteger(
|
|
1,
|
|
),
|
|
span: (
|
|
11,
|
|
13,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Asterisk,
|
|
span: (
|
|
11,
|
|
15,
|
|
),
|
|
},
|
|
Token {
|
|
kind: LiteralInteger(
|
|
2,
|
|
),
|
|
span: (
|
|
11,
|
|
17,
|
|
),
|
|
},
|
|
Token {
|
|
kind: RightParen,
|
|
span: (
|
|
11,
|
|
18,
|
|
),
|
|
},
|
|
Token {
|
|
kind: SemiColon,
|
|
span: (
|
|
11,
|
|
19,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Identifier(
|
|
"define",
|
|
),
|
|
span: (
|
|
12,
|
|
1,
|
|
),
|
|
},
|
|
Token {
|
|
kind: LeftParen,
|
|
span: (
|
|
12,
|
|
7,
|
|
),
|
|
},
|
|
Token {
|
|
kind: LiteralString(
|
|
"a",
|
|
),
|
|
span: (
|
|
12,
|
|
8,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Comma,
|
|
span: (
|
|
12,
|
|
11,
|
|
),
|
|
},
|
|
Token {
|
|
kind: LiteralInteger(
|
|
1,
|
|
),
|
|
span: (
|
|
12,
|
|
13,
|
|
),
|
|
},
|
|
Token {
|
|
kind: RightShift,
|
|
span: (
|
|
12,
|
|
15,
|
|
),
|
|
},
|
|
Token {
|
|
kind: LiteralInteger(
|
|
2,
|
|
),
|
|
span: (
|
|
12,
|
|
18,
|
|
),
|
|
},
|
|
Token {
|
|
kind: RightParen,
|
|
span: (
|
|
12,
|
|
19,
|
|
),
|
|
},
|
|
Token {
|
|
kind: SemiColon,
|
|
span: (
|
|
12,
|
|
20,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Identifier(
|
|
"define",
|
|
),
|
|
span: (
|
|
13,
|
|
1,
|
|
),
|
|
},
|
|
Token {
|
|
kind: LeftParen,
|
|
span: (
|
|
13,
|
|
7,
|
|
),
|
|
},
|
|
Token {
|
|
kind: LiteralString(
|
|
"a",
|
|
),
|
|
span: (
|
|
13,
|
|
8,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Comma,
|
|
span: (
|
|
13,
|
|
11,
|
|
),
|
|
},
|
|
Token {
|
|
kind: LiteralInteger(
|
|
1,
|
|
),
|
|
span: (
|
|
13,
|
|
13,
|
|
),
|
|
},
|
|
Token {
|
|
kind: LeftShift,
|
|
span: (
|
|
13,
|
|
15,
|
|
),
|
|
},
|
|
Token {
|
|
kind: LiteralInteger(
|
|
2,
|
|
),
|
|
span: (
|
|
13,
|
|
18,
|
|
),
|
|
},
|
|
Token {
|
|
kind: RightParen,
|
|
span: (
|
|
13,
|
|
19,
|
|
),
|
|
},
|
|
Token {
|
|
kind: SemiColon,
|
|
span: (
|
|
13,
|
|
20,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Identifier(
|
|
"define",
|
|
),
|
|
span: (
|
|
14,
|
|
1,
|
|
),
|
|
},
|
|
Token {
|
|
kind: LeftParen,
|
|
span: (
|
|
14,
|
|
7,
|
|
),
|
|
},
|
|
Token {
|
|
kind: LiteralString(
|
|
"a",
|
|
),
|
|
span: (
|
|
14,
|
|
8,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Comma,
|
|
span: (
|
|
14,
|
|
11,
|
|
),
|
|
},
|
|
Token {
|
|
kind: LiteralInteger(
|
|
1,
|
|
),
|
|
span: (
|
|
14,
|
|
13,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Pipe,
|
|
span: (
|
|
14,
|
|
15,
|
|
),
|
|
},
|
|
Token {
|
|
kind: LiteralInteger(
|
|
2,
|
|
),
|
|
span: (
|
|
14,
|
|
17,
|
|
),
|
|
},
|
|
Token {
|
|
kind: RightParen,
|
|
span: (
|
|
14,
|
|
18,
|
|
),
|
|
},
|
|
Token {
|
|
kind: SemiColon,
|
|
span: (
|
|
14,
|
|
19,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Identifier(
|
|
"define",
|
|
),
|
|
span: (
|
|
15,
|
|
1,
|
|
),
|
|
},
|
|
Token {
|
|
kind: LeftParen,
|
|
span: (
|
|
15,
|
|
7,
|
|
),
|
|
},
|
|
Token {
|
|
kind: LiteralString(
|
|
"a",
|
|
),
|
|
span: (
|
|
15,
|
|
8,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Comma,
|
|
span: (
|
|
15,
|
|
11,
|
|
),
|
|
},
|
|
Token {
|
|
kind: LiteralInteger(
|
|
1,
|
|
),
|
|
span: (
|
|
15,
|
|
13,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Ampersand,
|
|
span: (
|
|
15,
|
|
15,
|
|
),
|
|
},
|
|
Token {
|
|
kind: LiteralInteger(
|
|
2,
|
|
),
|
|
span: (
|
|
15,
|
|
17,
|
|
),
|
|
},
|
|
Token {
|
|
kind: RightParen,
|
|
span: (
|
|
15,
|
|
18,
|
|
),
|
|
},
|
|
Token {
|
|
kind: SemiColon,
|
|
span: (
|
|
15,
|
|
19,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Identifier(
|
|
"define",
|
|
),
|
|
span: (
|
|
16,
|
|
1,
|
|
),
|
|
},
|
|
Token {
|
|
kind: LeftParen,
|
|
span: (
|
|
16,
|
|
7,
|
|
),
|
|
},
|
|
Token {
|
|
kind: LiteralString(
|
|
"a",
|
|
),
|
|
span: (
|
|
16,
|
|
8,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Comma,
|
|
span: (
|
|
16,
|
|
11,
|
|
),
|
|
},
|
|
Token {
|
|
kind: BitwiseNot,
|
|
span: (
|
|
16,
|
|
13,
|
|
),
|
|
},
|
|
Token {
|
|
kind: LiteralInteger(
|
|
2,
|
|
),
|
|
span: (
|
|
16,
|
|
14,
|
|
),
|
|
},
|
|
Token {
|
|
kind: RightParen,
|
|
span: (
|
|
16,
|
|
15,
|
|
),
|
|
},
|
|
Token {
|
|
kind: SemiColon,
|
|
span: (
|
|
16,
|
|
16,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Echo,
|
|
span: (
|
|
18,
|
|
1,
|
|
),
|
|
},
|
|
Token {
|
|
kind: LiteralInteger(
|
|
1,
|
|
),
|
|
span: (
|
|
18,
|
|
6,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Plus,
|
|
span: (
|
|
18,
|
|
8,
|
|
),
|
|
},
|
|
Token {
|
|
kind: LiteralInteger(
|
|
2,
|
|
),
|
|
span: (
|
|
18,
|
|
10,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Asterisk,
|
|
span: (
|
|
18,
|
|
12,
|
|
),
|
|
},
|
|
Token {
|
|
kind: LiteralInteger(
|
|
3,
|
|
),
|
|
span: (
|
|
18,
|
|
14,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Slash,
|
|
span: (
|
|
18,
|
|
16,
|
|
),
|
|
},
|
|
Token {
|
|
kind: LiteralInteger(
|
|
4,
|
|
),
|
|
span: (
|
|
18,
|
|
18,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Minus,
|
|
span: (
|
|
18,
|
|
20,
|
|
),
|
|
},
|
|
Token {
|
|
kind: LiteralInteger(
|
|
5,
|
|
),
|
|
span: (
|
|
18,
|
|
22,
|
|
),
|
|
},
|
|
Token {
|
|
kind: SemiColon,
|
|
span: (
|
|
18,
|
|
23,
|
|
),
|
|
},
|
|
]
|