-
Notifications
You must be signed in to change notification settings - Fork 2
/
lexer.l
28 lines (21 loc) · 833 Bytes
/
lexer.l
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
%{
#include "parser.h"
%}
%option reentrant
%option noyywrap
%option noinput
%option nounput
%%
"null" return NUL;
"true" return TRUE;
"false" return FALSE;
"{" return LBRACE;
"}" return RBRACE;
"[" return LBRACKET;
"]" return RBRACKET;
"," return COMMA;
":" return COLON;
\"([^"\\]|\\.)*\" return STRING;
-?(0|[1-9][0-9]*)(\.[0-9]+)?([eE][+-]?[0-9]+)? return NUMBER;
[ \t\n]+ ;
%%