2 #include "Cycript.tab.hh"
3 typedef cy::parser::token tk;
4 #define YY_EXTRA_TYPE CYParser *
9 %option bison-locations
19 number [-]?{digit}*[.]?{digit}+
23 "&" return tk::Ampersand;
24 "&&" return tk::AmpersandAmpersand;
25 "&=" return tk::AmpersandEqual;
26 "^" return tk::Carrot;
27 "^=" return tk::CarrotEqual;
29 "==" return tk::EqualEqual;
30 "===" return tk::EqualEqualEqual;
31 "!" return tk::Exclamation;
32 "!=" return tk::ExclamationEqual;
33 "!==" return tk::ExclamationEqualEqual;
34 "-" return tk::Hyphen;
35 "-=" return tk::HyphenEqual;
36 "--" return tk::HyphenHyphen;
37 "->" return tk::HyphenRight;
39 "<=" return tk::LeftEqual;
40 "<<" return tk::LeftLeft;
41 "<<=" return tk::LeftLeftEqual;
42 "%" return tk::Percent;
43 "%=" return tk::PercentEqual;
44 "." return tk::Period;
46 "|=" return tk::PipeEqual;
47 "||" return tk::PipePipe;
49 "+=" return tk::PlusEqual;
50 "++" return tk::PlusPlus;
52 ">=" return tk::RightEqual;
53 ">>" return tk::RightRight;
54 ">>=" return tk::RightRightEqual;
55 ">>>" return tk::RightRightRight;
56 ">>>=" return tk::RightRightRightEqual;
58 "/=" return tk::SlashEqual;
60 "*=" return tk::StarEqual;
65 "?" return tk::Question;
66 ";" return tk::SemiColon;
68 "(" return tk::OpenParen;
69 ")" return tk::CloseParen;
71 "{" return tk::OpenBrace;
72 "}" return tk::CloseBrace;
74 "[" return tk::OpenBracket;
75 "]" return tk::CloseBracket;
77 "break" return tk::Break;
78 "case" return tk::Case;
79 "catch" return tk::Catch;
80 "continue" return tk::Continue;
81 "default" return tk::Default;
82 "delete" return tk::Delete;
84 "else" return tk::Else;
85 "false" return tk::False;
86 "finally" return tk::Finally;
88 "function" return tk::Function;
91 "instanceof" return tk::InstanceOf;
93 "null" return tk::Null;
94 "return" return tk::Return;
95 "switch" return tk::Switch;
96 "this" return tk::This;
97 "throw" return tk::Throw;
98 "true" return tk::True;
100 "typeof" return tk::TypeOf;
101 "var" return tk::Var;
102 "void" return tk::Void;
103 "while" return tk::While;
104 "with" return tk::With;
106 [a-zA-Z$_][a-zA-Z$_0-9]* return tk::Identifier;
107 [0-9]+ return tk::NumericLiteral;
113 void CYParser::ScannerInit() {
114 cylex_init(&scanner_);
115 cyset_extra(this, scanner_);
118 void CYParser::ScannerDestroy() {
119 cylex_destroy(scanner_);