]>
Commit | Line | Data |
---|---|---|
1 | %{ | |
2 | #include "Parser.hpp" | |
3 | #include "Cycript.tab.h" | |
4 | void cyerror(YYLTYPE *locp, CYParser *context, const char *msg); | |
5 | int cylex(YYSTYPE *lvalp, YYLTYPE *llocp); | |
6 | %} | |
7 | ||
8 | %pure-parser | |
9 | %name-prefix="cy" | |
10 | %locations | |
11 | %defines | |
12 | %error-verbose | |
13 | ||
14 | %parse-param { CYParser *context } | |
15 | ||
16 | %token CYTokenAmpersand "&" | |
17 | %token CYTokenAmpersandAmpersand "&&" | |
18 | %token CYTokenAmpersandEqual "&=" | |
19 | %token CYTokenCarrot "^" | |
20 | %token CYTokenCarrotEqual "^=" | |
21 | %token CYTokenEqual "=" | |
22 | %token CYTokenEqualEqual "==" | |
23 | %token CYTokenEqualEqualEqual "===" | |
24 | %token CYTokenExclamation "!" | |
25 | %token CYTokenExclamationEqual "!=" | |
26 | %token CYTokenExclamationEqualEqual "!==" | |
27 | %token CYTokenHyphen "-" | |
28 | %token CYTokenHyphenEqual "-=" | |
29 | %token CYTokenHyphenHyphen "--" | |
30 | %token CYTokenHyphenRight "->" | |
31 | %token CYTokenLeft "<" | |
32 | %token CYTokenLeftEqual "<=" | |
33 | %token CYTokenLeftLeft "<<" | |
34 | %token CYTokenLeftLeftEqual "<<=" | |
35 | %token CYTokenPercent "%" | |
36 | %token CYTokenPercentEqual "%=" | |
37 | %token CYTokenPeriod "." | |
38 | %token CYTokenPipe "|" | |
39 | %token CYTokenPipeEqual "|=" | |
40 | %token CYTokenPipePipe "||" | |
41 | %token CYTokenPlus "+" | |
42 | %token CYTokenPlusEqual "+=" | |
43 | %token CYTokenPlusPlus "++" | |
44 | %token CYTokenRight ">" | |
45 | %token CYTokenRightEqual ">=" | |
46 | %token CYTokenRightRight ">>" | |
47 | %token CYTokenRightRightEqual ">>=" | |
48 | %token CYTokenRightRightRight ">>>" | |
49 | %token CYTokenRightRightRightEqual ">>>=" | |
50 | %token CYTokenSlash "/" | |
51 | %token CYTokenSlashEqual "/=" | |
52 | %token CYTokenStar "*" | |
53 | %token CYTokenStarEqual "*=" | |
54 | %token CYTokenTilde "~" | |
55 | ||
56 | %token CYTokenBreak "break" | |
57 | %token CYTokenCase "case" | |
58 | %token CYTokenCatch "catch" | |
59 | %token CYTokenContinue "continue" | |
60 | %token CYTokenDefault "default" | |
61 | %token CYTokenDelete "delete" | |
62 | %token CYTokenDo "do" | |
63 | %token CYTokenElse "else" | |
64 | %token CYTokenFalse "false" | |
65 | %token CYTokenFinally "finally" | |
66 | %token CYTokenFor "for" | |
67 | %token CYTokenFunction "function" | |
68 | %token CYTokenIf "if" | |
69 | %token CYTokenIn "in" | |
70 | %token CYTokenInstanceOf "instanceof" | |
71 | %token CYTokenNew "new" | |
72 | %token CYTokenNull "null" | |
73 | %token CYTokenReturn "return" | |
74 | %token CYTokenSwitch "switch" | |
75 | %token CYTokenThis "this" | |
76 | %token CYTokenThrow "throw" | |
77 | %token CYTokenTrue "true" | |
78 | %token CYTokenTry "try" | |
79 | %token CYTokenTypeOf "typeof" | |
80 | %token CYTokenVar "var" | |
81 | %token CYTokenVoid "void" | |
82 | %token CYTokenWhile "while" | |
83 | %token CYTokenWith "with" | |
84 | ||
85 | %% | |
86 | ||
87 | hello: ; | |
88 | ||
89 | %% | |
90 | ||
91 | #include <stdio.h> | |
92 | ||
93 | void cyerror(YYLTYPE *locp, CYParser *context, const char *msg) { | |
94 | fprintf(stderr, "err:%s\n", msg); | |
95 | } |