]> git.saurik.com Git - cycript.git/blob - Cycript.l
2467b96fad0cdd371af8af1f8bb3769c2a241c90
[cycript.git] / Cycript.l
1 %{
2 #include "Cycript.tab.hh"
3 typedef cy::parser::token tk;
4 %}
5
6 %option prefix="cy"
7 %option bison-bridge
8 %option bison-locations
9 %option noyywrap
10 %option yylineno
11 %option nounput
12 %option interactive
13
14 delim [ \t]
15 whitesp {delim}+
16 digit [0-9]
17 number [-]?{digit}*[.]?{digit}+
18
19 %%
20
21 "&" return tk::Ampersand;
22 "&&" return tk::AmpersandAmpersand;
23 "&=" return tk::AmpersandEqual;
24 "^" return tk::Carrot;
25 "^=" return tk::CarrotEqual;
26 "=" return tk::Equal;
27 "==" return tk::EqualEqual;
28 "===" return tk::EqualEqualEqual;
29 "!" return tk::Exclamation;
30 "!=" return tk::ExclamationEqual;
31 "!==" return tk::ExclamationEqualEqual;
32 "-" return tk::Hyphen;
33 "-=" return tk::HyphenEqual;
34 "--" return tk::HyphenHyphen;
35 "->" return tk::HyphenRight;
36 "<" return tk::Left;
37 "<=" return tk::LeftEqual;
38 "<<" return tk::LeftLeft;
39 "<<=" return tk::LeftLeftEqual;
40 "%" return tk::Percent;
41 "%=" return tk::PercentEqual;
42 "." return tk::Period;
43 "|" return tk::Pipe;
44 "|=" return tk::PipeEqual;
45 "||" return tk::PipePipe;
46 "+" return tk::Plus;
47 "+=" return tk::PlusEqual;
48 "++" return tk::PlusPlus;
49 ">" return tk::Right;
50 ">=" return tk::RightEqual;
51 ">>" return tk::RightRight;
52 ">>=" return tk::RightRightEqual;
53 ">>>" return tk::RightRightRight;
54 ">>>=" return tk::RightRightRightEqual;
55 "/" return tk::Slash;
56 "/=" return tk::SlashEqual;
57 "*" return tk::Star;
58 "*=" return tk::StarEqual;
59 "~" return tk::Tilde;
60
61 ":" return tk::Colon;
62 "," return tk::Comma;
63 "?" return tk::Question;
64 ";" return tk::SemiColon;
65
66 "(" return tk::OpenParen;
67 ")" return tk::CloseParen;
68 "{" return tk::OpenBrace;
69 "}" return tk::CloseBrace;
70 "[" return tk::OpenBracket;
71 "]" return tk::CloseBracket;
72
73 "break" return tk::Break;
74 "case" return tk::Case;
75 "catch" return tk::Catch;
76 "continue" return tk::Continue;
77 "default" return tk::Default;
78 "delete" return tk::Delete;
79 "do" return tk::Do;
80 "else" return tk::Else;
81 "false" return tk::False;
82 "finally" return tk::Finally;
83 "for" return tk::For;
84 "function" return tk::Function;
85 "if" return tk::If;
86 "in" return tk::In;
87 "instanceof" return tk::InstanceOf;
88 "new" return tk::New;
89 "null" return tk::Null;
90 "return" return tk::Return;
91 "switch" return tk::Switch;
92 "this" return tk::This;
93 "throw" return tk::Throw;
94 "true" return tk::True;
95 "try" return tk::Try;
96 "typeof" return tk::TypeOf;
97 "var" return tk::Var;
98 "void" return tk::Void;
99 "while" return tk::While;
100 "with" return tk::With;
101
102 [a-zA-Z$_][a-zA-Z$_0-9]* return tk::Identifier;
103 [0-9]+ return tk::NumericLiteral;
104
105 [ \t\n] ;