mirror of
https://github.com/danog/parser.git
synced 2024-11-30 04:29:13 +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
506 lines
7.1 KiB
Plaintext
506 lines
7.1 KiB
Plaintext
[
|
|
Token {
|
|
kind: OpenTag(
|
|
Full,
|
|
),
|
|
span: (
|
|
1,
|
|
1,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Foreach,
|
|
span: (
|
|
3,
|
|
1,
|
|
),
|
|
},
|
|
Token {
|
|
kind: LeftParen,
|
|
span: (
|
|
3,
|
|
9,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Variable(
|
|
"a",
|
|
),
|
|
span: (
|
|
3,
|
|
10,
|
|
),
|
|
},
|
|
Token {
|
|
kind: As,
|
|
span: (
|
|
3,
|
|
13,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Ampersand,
|
|
span: (
|
|
3,
|
|
16,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Variable(
|
|
"b",
|
|
),
|
|
span: (
|
|
3,
|
|
17,
|
|
),
|
|
},
|
|
Token {
|
|
kind: RightParen,
|
|
span: (
|
|
3,
|
|
19,
|
|
),
|
|
},
|
|
Token {
|
|
kind: LeftBrace,
|
|
span: (
|
|
3,
|
|
21,
|
|
),
|
|
},
|
|
Token {
|
|
kind: RightBrace,
|
|
span: (
|
|
3,
|
|
22,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Foreach,
|
|
span: (
|
|
5,
|
|
1,
|
|
),
|
|
},
|
|
Token {
|
|
kind: LeftParen,
|
|
span: (
|
|
5,
|
|
9,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Variable(
|
|
"a",
|
|
),
|
|
span: (
|
|
5,
|
|
10,
|
|
),
|
|
},
|
|
Token {
|
|
kind: As,
|
|
span: (
|
|
5,
|
|
13,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Variable(
|
|
"b",
|
|
),
|
|
span: (
|
|
5,
|
|
16,
|
|
),
|
|
},
|
|
Token {
|
|
kind: DoubleArrow,
|
|
span: (
|
|
5,
|
|
19,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Ampersand,
|
|
span: (
|
|
5,
|
|
22,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Variable(
|
|
"c",
|
|
),
|
|
span: (
|
|
5,
|
|
23,
|
|
),
|
|
},
|
|
Token {
|
|
kind: RightParen,
|
|
span: (
|
|
5,
|
|
25,
|
|
),
|
|
},
|
|
Token {
|
|
kind: LeftBrace,
|
|
span: (
|
|
5,
|
|
27,
|
|
),
|
|
},
|
|
Token {
|
|
kind: RightBrace,
|
|
span: (
|
|
5,
|
|
28,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Switch,
|
|
span: (
|
|
7,
|
|
1,
|
|
),
|
|
},
|
|
Token {
|
|
kind: LeftParen,
|
|
span: (
|
|
7,
|
|
8,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Variable(
|
|
"a",
|
|
),
|
|
span: (
|
|
7,
|
|
9,
|
|
),
|
|
},
|
|
Token {
|
|
kind: RightParen,
|
|
span: (
|
|
7,
|
|
11,
|
|
),
|
|
},
|
|
Token {
|
|
kind: LeftBrace,
|
|
span: (
|
|
7,
|
|
13,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Case,
|
|
span: (
|
|
8,
|
|
5,
|
|
),
|
|
},
|
|
Token {
|
|
kind: LiteralInteger(
|
|
0,
|
|
),
|
|
span: (
|
|
8,
|
|
10,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Colon,
|
|
span: (
|
|
8,
|
|
11,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Break,
|
|
span: (
|
|
9,
|
|
9,
|
|
),
|
|
},
|
|
Token {
|
|
kind: SemiColon,
|
|
span: (
|
|
9,
|
|
14,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Case,
|
|
span: (
|
|
10,
|
|
5,
|
|
),
|
|
},
|
|
Token {
|
|
kind: LiteralInteger(
|
|
1,
|
|
),
|
|
span: (
|
|
10,
|
|
10,
|
|
),
|
|
},
|
|
Token {
|
|
kind: SemiColon,
|
|
span: (
|
|
10,
|
|
11,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Default,
|
|
span: (
|
|
11,
|
|
5,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Colon,
|
|
span: (
|
|
11,
|
|
12,
|
|
),
|
|
},
|
|
Token {
|
|
kind: RightBrace,
|
|
span: (
|
|
12,
|
|
1,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Foreach,
|
|
span: (
|
|
14,
|
|
1,
|
|
),
|
|
},
|
|
Token {
|
|
kind: LeftParen,
|
|
span: (
|
|
14,
|
|
9,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Variable(
|
|
"foo",
|
|
),
|
|
span: (
|
|
14,
|
|
10,
|
|
),
|
|
},
|
|
Token {
|
|
kind: As,
|
|
span: (
|
|
14,
|
|
15,
|
|
),
|
|
},
|
|
Token {
|
|
kind: LeftBracket,
|
|
span: (
|
|
14,
|
|
18,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Variable(
|
|
"baz",
|
|
),
|
|
span: (
|
|
14,
|
|
19,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Comma,
|
|
span: (
|
|
14,
|
|
23,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Variable(
|
|
"car",
|
|
),
|
|
span: (
|
|
14,
|
|
25,
|
|
),
|
|
},
|
|
Token {
|
|
kind: RightBracket,
|
|
span: (
|
|
14,
|
|
29,
|
|
),
|
|
},
|
|
Token {
|
|
kind: RightParen,
|
|
span: (
|
|
14,
|
|
30,
|
|
),
|
|
},
|
|
Token {
|
|
kind: LeftBrace,
|
|
span: (
|
|
14,
|
|
32,
|
|
),
|
|
},
|
|
Token {
|
|
kind: RightBrace,
|
|
span: (
|
|
14,
|
|
33,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Foreach,
|
|
span: (
|
|
16,
|
|
1,
|
|
),
|
|
},
|
|
Token {
|
|
kind: LeftParen,
|
|
span: (
|
|
16,
|
|
9,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Variable(
|
|
"foo",
|
|
),
|
|
span: (
|
|
16,
|
|
10,
|
|
),
|
|
},
|
|
Token {
|
|
kind: As,
|
|
span: (
|
|
16,
|
|
15,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Variable(
|
|
"bar",
|
|
),
|
|
span: (
|
|
16,
|
|
18,
|
|
),
|
|
},
|
|
Token {
|
|
kind: DoubleArrow,
|
|
span: (
|
|
16,
|
|
23,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Variable(
|
|
"baz",
|
|
),
|
|
span: (
|
|
16,
|
|
26,
|
|
),
|
|
},
|
|
Token {
|
|
kind: RightParen,
|
|
span: (
|
|
16,
|
|
30,
|
|
),
|
|
},
|
|
Token {
|
|
kind: LeftBrace,
|
|
span: (
|
|
16,
|
|
32,
|
|
),
|
|
},
|
|
Token {
|
|
kind: RightBrace,
|
|
span: (
|
|
16,
|
|
33,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Foreach,
|
|
span: (
|
|
18,
|
|
1,
|
|
),
|
|
},
|
|
Token {
|
|
kind: LeftParen,
|
|
span: (
|
|
18,
|
|
9,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Variable(
|
|
"foo",
|
|
),
|
|
span: (
|
|
18,
|
|
10,
|
|
),
|
|
},
|
|
Token {
|
|
kind: As,
|
|
span: (
|
|
18,
|
|
15,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Variable(
|
|
"bar",
|
|
),
|
|
span: (
|
|
18,
|
|
18,
|
|
),
|
|
},
|
|
Token {
|
|
kind: RightParen,
|
|
span: (
|
|
18,
|
|
22,
|
|
),
|
|
},
|
|
Token {
|
|
kind: LeftBrace,
|
|
span: (
|
|
18,
|
|
24,
|
|
),
|
|
},
|
|
Token {
|
|
kind: RightBrace,
|
|
span: (
|
|
18,
|
|
25,
|
|
),
|
|
},
|
|
]
|