56 |
# define YYSTYPE_IS_DECLARED ///< We tell the lexer / parser that we use our own data structure as defined above. |
# define YYSTYPE_IS_DECLARED ///< We tell the lexer / parser that we use our own data structure as defined above. |
57 |
#endif |
#endif |
58 |
|
|
59 |
|
// custom Bison location type to support raw byte positions |
60 |
|
struct _YYLTYPE { |
61 |
|
int first_line; |
62 |
|
int first_column; |
63 |
|
int last_line; |
64 |
|
int last_column; |
65 |
|
int first_byte; |
66 |
|
int length_bytes; |
67 |
|
}; |
68 |
|
#define YYLTYPE _YYLTYPE |
69 |
|
#define YYLTYPE_IS_DECLARED 1 |
70 |
|
|
71 |
|
// override Bison's default location passing to support raw byte positions |
72 |
|
#define YYLLOC_DEFAULT(Cur, Rhs, N) \ |
73 |
|
do \ |
74 |
|
if (N) \ |
75 |
|
{ \ |
76 |
|
(Cur).first_line = YYRHSLOC(Rhs, 1).first_line; \ |
77 |
|
(Cur).first_column = YYRHSLOC(Rhs, 1).first_column; \ |
78 |
|
(Cur).last_line = YYRHSLOC(Rhs, N).last_line; \ |
79 |
|
(Cur).last_column = YYRHSLOC(Rhs, N).last_column; \ |
80 |
|
(Cur).first_byte = YYRHSLOC(Rhs, 1).first_byte; \ |
81 |
|
(Cur).length_bytes = (YYRHSLOC(Rhs, N).first_byte - \ |
82 |
|
YYRHSLOC(Rhs, 1).first_byte) + \ |
83 |
|
YYRHSLOC(Rhs, N).length_bytes; \ |
84 |
|
} \ |
85 |
|
else \ |
86 |
|
{ \ |
87 |
|
(Cur).first_line = (Cur).last_line = \ |
88 |
|
YYRHSLOC(Rhs, 0).last_line; \ |
89 |
|
(Cur).first_column = (Cur).last_column = \ |
90 |
|
YYRHSLOC(Rhs, 0).last_column; \ |
91 |
|
(Cur).first_byte = YYRHSLOC(Rhs, 0).first_byte; \ |
92 |
|
(Cur).length_bytes = YYRHSLOC(Rhs, 0).length_bytes; \ |
93 |
|
} \ |
94 |
|
while (0) |
95 |
|
|
96 |
#endif // LS_INSTRSCRIPTSPARSER_SHARED_H |
#endif // LS_INSTRSCRIPTSPARSER_SHARED_H |