mirror of
https://github.com/danog/parser.git
synced 2024-12-02 09:27:50 +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
453 lines
6.3 KiB
Plaintext
453 lines
6.3 KiB
Plaintext
[
|
|
Token {
|
|
kind: OpenTag(
|
|
Full,
|
|
),
|
|
span: (
|
|
1,
|
|
1,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Function,
|
|
span: (
|
|
3,
|
|
1,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Identifier(
|
|
"foo",
|
|
),
|
|
span: (
|
|
3,
|
|
10,
|
|
),
|
|
},
|
|
Token {
|
|
kind: LeftParen,
|
|
span: (
|
|
3,
|
|
13,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Identifier(
|
|
"string",
|
|
),
|
|
span: (
|
|
3,
|
|
14,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Variable(
|
|
"a",
|
|
),
|
|
span: (
|
|
3,
|
|
21,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Equals,
|
|
span: (
|
|
3,
|
|
24,
|
|
),
|
|
},
|
|
Token {
|
|
kind: LiteralString(
|
|
"",
|
|
),
|
|
span: (
|
|
3,
|
|
26,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Comma,
|
|
span: (
|
|
3,
|
|
28,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Array,
|
|
span: (
|
|
3,
|
|
30,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Variable(
|
|
"b",
|
|
),
|
|
span: (
|
|
3,
|
|
36,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Equals,
|
|
span: (
|
|
3,
|
|
39,
|
|
),
|
|
},
|
|
Token {
|
|
kind: LeftBracket,
|
|
span: (
|
|
3,
|
|
41,
|
|
),
|
|
},
|
|
Token {
|
|
kind: RightBracket,
|
|
span: (
|
|
3,
|
|
42,
|
|
),
|
|
},
|
|
Token {
|
|
kind: RightParen,
|
|
span: (
|
|
3,
|
|
43,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Colon,
|
|
span: (
|
|
3,
|
|
44,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Identifier(
|
|
"never",
|
|
),
|
|
span: (
|
|
3,
|
|
46,
|
|
),
|
|
},
|
|
Token {
|
|
kind: LeftBrace,
|
|
span: (
|
|
3,
|
|
52,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Identifier(
|
|
"exit",
|
|
),
|
|
span: (
|
|
4,
|
|
5,
|
|
),
|
|
},
|
|
Token {
|
|
kind: LeftParen,
|
|
span: (
|
|
4,
|
|
9,
|
|
),
|
|
},
|
|
Token {
|
|
kind: LiteralInteger(
|
|
1,
|
|
),
|
|
span: (
|
|
4,
|
|
10,
|
|
),
|
|
},
|
|
Token {
|
|
kind: RightParen,
|
|
span: (
|
|
4,
|
|
11,
|
|
),
|
|
},
|
|
Token {
|
|
kind: SemiColon,
|
|
span: (
|
|
4,
|
|
12,
|
|
),
|
|
},
|
|
Token {
|
|
kind: RightBrace,
|
|
span: (
|
|
5,
|
|
1,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Function,
|
|
span: (
|
|
7,
|
|
1,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Identifier(
|
|
"bar",
|
|
),
|
|
span: (
|
|
7,
|
|
10,
|
|
),
|
|
},
|
|
Token {
|
|
kind: LeftParen,
|
|
span: (
|
|
7,
|
|
13,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Identifier(
|
|
"int",
|
|
),
|
|
span: (
|
|
7,
|
|
14,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Variable(
|
|
"a",
|
|
),
|
|
span: (
|
|
7,
|
|
18,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Comma,
|
|
span: (
|
|
7,
|
|
20,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Identifier(
|
|
"float",
|
|
),
|
|
span: (
|
|
7,
|
|
22,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Variable(
|
|
"b",
|
|
),
|
|
span: (
|
|
7,
|
|
28,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Comma,
|
|
span: (
|
|
7,
|
|
30,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Identifier(
|
|
"string",
|
|
),
|
|
span: (
|
|
7,
|
|
32,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Variable(
|
|
"c",
|
|
),
|
|
span: (
|
|
7,
|
|
39,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Comma,
|
|
span: (
|
|
7,
|
|
41,
|
|
),
|
|
},
|
|
Token {
|
|
kind: True,
|
|
span: (
|
|
7,
|
|
43,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Variable(
|
|
"d",
|
|
),
|
|
span: (
|
|
7,
|
|
48,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Comma,
|
|
span: (
|
|
7,
|
|
50,
|
|
),
|
|
},
|
|
Token {
|
|
kind: False,
|
|
span: (
|
|
7,
|
|
52,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Variable(
|
|
"e",
|
|
),
|
|
span: (
|
|
7,
|
|
58,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Comma,
|
|
span: (
|
|
7,
|
|
60,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Null,
|
|
span: (
|
|
7,
|
|
62,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Variable(
|
|
"f",
|
|
),
|
|
span: (
|
|
7,
|
|
67,
|
|
),
|
|
},
|
|
Token {
|
|
kind: RightParen,
|
|
span: (
|
|
7,
|
|
69,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Colon,
|
|
span: (
|
|
7,
|
|
70,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Null,
|
|
span: (
|
|
7,
|
|
72,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Pipe,
|
|
span: (
|
|
7,
|
|
76,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Identifier(
|
|
"string",
|
|
),
|
|
span: (
|
|
7,
|
|
77,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Pipe,
|
|
span: (
|
|
7,
|
|
83,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Identifier(
|
|
"int",
|
|
),
|
|
span: (
|
|
7,
|
|
84,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Pipe,
|
|
span: (
|
|
7,
|
|
87,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Identifier(
|
|
"float",
|
|
),
|
|
span: (
|
|
7,
|
|
88,
|
|
),
|
|
},
|
|
Token {
|
|
kind: LeftBrace,
|
|
span: (
|
|
7,
|
|
94,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Return,
|
|
span: (
|
|
8,
|
|
5,
|
|
),
|
|
},
|
|
Token {
|
|
kind: Null,
|
|
span: (
|
|
8,
|
|
12,
|
|
),
|
|
},
|
|
Token {
|
|
kind: SemiColon,
|
|
span: (
|
|
8,
|
|
16,
|
|
),
|
|
},
|
|
Token {
|
|
kind: RightBrace,
|
|
span: (
|
|
9,
|
|
1,
|
|
),
|
|
},
|
|
]
|