OLD | NEW |
(Empty) | |
| 1 %{ |
| 2 #include <stdio.h> |
| 3 %} |
| 4 %code { |
| 5 if(foo) { |
| 6 |
| 7 } |
| 8 } |
| 9 %% |
| 10 exp: |
| 11 NUM { |
| 12 $$ = f($3, $4); |
| 13 @$.first_column = @1.first_column; |
| 14 $result = $left + $<itype>1; |
| 15 } |
| 16 %% |
| 17 |
| 18 ---------------------------------------------------- |
| 19 |
| 20 [ |
| 21 ["bison", [ |
| 22 ["c", [ |
| 23 ["delimiter", "%{"], |
| 24 ["macro", ["#include ", ["string", "<stdio.h>"]]], |
| 25 ["delimiter", "%}"] |
| 26 ]], |
| 27 ["keyword", "%code"], |
| 28 ["c", [ |
| 29 ["delimiter", "{"], |
| 30 ["keyword", "if"], ["punctuation", "("], "foo", ["punctu
ation", ")"], |
| 31 ["punctuation", "{"], ["punctuation", "}"], |
| 32 ["delimiter", "}"] |
| 33 ]], |
| 34 ["punctuation", "%%"], |
| 35 ["property", "exp"], ["punctuation", ":"], |
| 36 "\r\n\tNUM ", |
| 37 ["c", [ |
| 38 ["delimiter", "{"], |
| 39 ["bison-variable", ["$$"]], ["operator", "="], |
| 40 ["function", "f"], ["punctuation", "("], |
| 41 ["bison-variable", ["$3"]], ["punctuation", ","], |
| 42 ["bison-variable", ["$4"]], ["punctuation", ")"], ["punc
tuation", ";"], |
| 43 ["bison-variable", ["@$"]], ["punctuation", "."], "first
_column ", ["operator", "="], |
| 44 ["bison-variable", ["@1"]], ["punctuation", "."], "first
_column", ["punctuation", ";"], |
| 45 ["bison-variable", ["$result"]], ["operator", "="], |
| 46 ["bison-variable", ["$left"]], ["operator", "+"], |
| 47 ["bison-variable", ["$", ["punctuation", "<"], "itype",
["punctuation", ">"], "1"]], ["punctuation", ";"], |
| 48 ["delimiter", "}"] |
| 49 ]], |
| 50 ["punctuation", "%%"] |
| 51 ]] |
| 52 ] |
| 53 |
| 54 ---------------------------------------------------- |
| 55 |
| 56 Checks for C inside Bison, along with special Bison variables. |
OLD | NEW |