Skip to content

Commit 9ddb2b5

Browse files
committed
flow type the parser
1 parent 1651039 commit 9ddb2b5

File tree

2 files changed

+82
-70
lines changed

2 files changed

+82
-70
lines changed

src/language/lexer.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ import type { Source } from './source';
1212
import { syntaxError } from '../error';
1313

1414
/**
15-
* A representation of a lexed Token. Value is optional, is it is
16-
* not needed for punctuators like BANG or PAREN_L.
15+
* A representation of a lexed Token. Value only appears for non-punctuation
16+
* tokens: NAME, INT, FLOAT, and STRING.
1717
*/
1818
export type Token = {
1919
kind: number;
@@ -66,10 +66,9 @@ export const TokenKind = {
6666
PIPE: 13,
6767
BRACE_R: 14,
6868
NAME: 15,
69-
VARIABLE: 16,
70-
INT: 17,
71-
FLOAT: 18,
72-
STRING: 19,
69+
INT: 16,
70+
FLOAT: 17,
71+
STRING: 18,
7372
};
7473

7574
/**
@@ -104,7 +103,6 @@ tokenDescription[TokenKind.BRACE_L] = '{';
104103
tokenDescription[TokenKind.PIPE] = '|';
105104
tokenDescription[TokenKind.BRACE_R] = '}';
106105
tokenDescription[TokenKind.NAME] = 'Name';
107-
tokenDescription[TokenKind.VARIABLE] = 'Variable';
108106
tokenDescription[TokenKind.INT] = 'Int';
109107
tokenDescription[TokenKind.FLOAT] = 'Float';
110108
tokenDescription[TokenKind.STRING] = 'String';

0 commit comments

Comments
 (0)