shannonwoods@chromium.org | b075716 | 2013-05-30 00:21:27 +0000 | [diff] [blame] | 1 | #line 16 "./Tokenizer.l" |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2 | // |
Jamie Madill | 88f6e94 | 2014-02-19 10:27:53 -0500 | [diff] [blame] | 3 | // Copyright (c) 2011-2014 The ANGLE Project Authors. All rights reserved. |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 4 | // Use of this source code is governed by a BSD-style license that can be |
| 5 | // found in the LICENSE file. |
| 6 | // |
| 7 | |
| 8 | // This file is auto-generated by generate_parser.sh. DO NOT EDIT! |
| 9 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 10 | #define YY_INT_ALIGNED short int |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 11 | |
| 12 | /* A lexical scanner generated by flex */ |
| 13 | |
| 14 | #define FLEX_SCANNER |
| 15 | #define YY_FLEX_MAJOR_VERSION 2 |
Geoff Lang | 93561c3 | 2016-09-20 10:22:55 -0400 | [diff] [blame] | 16 | #define YY_FLEX_MINOR_VERSION 6 |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 17 | #define YY_FLEX_SUBMINOR_VERSION 4 |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 18 | #if YY_FLEX_SUBMINOR_VERSION > 0 |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 19 | # define FLEX_BETA |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 20 | #endif |
| 21 | |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 22 | #ifdef yy_create_buffer |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 23 | # define pp_create_buffer_ALREADY_DEFINED |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 24 | #else |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 25 | # define yy_create_buffer pp_create_buffer |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 26 | #endif |
| 27 | |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 28 | #ifdef yy_delete_buffer |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 29 | # define pp_delete_buffer_ALREADY_DEFINED |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 30 | #else |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 31 | # define yy_delete_buffer pp_delete_buffer |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 32 | #endif |
| 33 | |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 34 | #ifdef yy_scan_buffer |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 35 | # define pp_scan_buffer_ALREADY_DEFINED |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 36 | #else |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 37 | # define yy_scan_buffer pp_scan_buffer |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 38 | #endif |
| 39 | |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 40 | #ifdef yy_scan_string |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 41 | # define pp_scan_string_ALREADY_DEFINED |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 42 | #else |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 43 | # define yy_scan_string pp_scan_string |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 44 | #endif |
| 45 | |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 46 | #ifdef yy_scan_bytes |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 47 | # define pp_scan_bytes_ALREADY_DEFINED |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 48 | #else |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 49 | # define yy_scan_bytes pp_scan_bytes |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 50 | #endif |
| 51 | |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 52 | #ifdef yy_init_buffer |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 53 | # define pp_init_buffer_ALREADY_DEFINED |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 54 | #else |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 55 | # define yy_init_buffer pp_init_buffer |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 56 | #endif |
| 57 | |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 58 | #ifdef yy_flush_buffer |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 59 | # define pp_flush_buffer_ALREADY_DEFINED |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 60 | #else |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 61 | # define yy_flush_buffer pp_flush_buffer |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 62 | #endif |
| 63 | |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 64 | #ifdef yy_load_buffer_state |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 65 | # define pp_load_buffer_state_ALREADY_DEFINED |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 66 | #else |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 67 | # define yy_load_buffer_state pp_load_buffer_state |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 68 | #endif |
| 69 | |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 70 | #ifdef yy_switch_to_buffer |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 71 | # define pp_switch_to_buffer_ALREADY_DEFINED |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 72 | #else |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 73 | # define yy_switch_to_buffer pp_switch_to_buffer |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 74 | #endif |
| 75 | |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 76 | #ifdef yypush_buffer_state |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 77 | # define pppush_buffer_state_ALREADY_DEFINED |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 78 | #else |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 79 | # define yypush_buffer_state pppush_buffer_state |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 80 | #endif |
| 81 | |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 82 | #ifdef yypop_buffer_state |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 83 | # define pppop_buffer_state_ALREADY_DEFINED |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 84 | #else |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 85 | # define yypop_buffer_state pppop_buffer_state |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 86 | #endif |
| 87 | |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 88 | #ifdef yyensure_buffer_stack |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 89 | # define ppensure_buffer_stack_ALREADY_DEFINED |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 90 | #else |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 91 | # define yyensure_buffer_stack ppensure_buffer_stack |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 92 | #endif |
| 93 | |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 94 | #ifdef yylex |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 95 | # define pplex_ALREADY_DEFINED |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 96 | #else |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 97 | # define yylex pplex |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 98 | #endif |
| 99 | |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 100 | #ifdef yyrestart |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 101 | # define pprestart_ALREADY_DEFINED |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 102 | #else |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 103 | # define yyrestart pprestart |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 104 | #endif |
| 105 | |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 106 | #ifdef yylex_init |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 107 | # define pplex_init_ALREADY_DEFINED |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 108 | #else |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 109 | # define yylex_init pplex_init |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 110 | #endif |
| 111 | |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 112 | #ifdef yylex_init_extra |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 113 | # define pplex_init_extra_ALREADY_DEFINED |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 114 | #else |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 115 | # define yylex_init_extra pplex_init_extra |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 116 | #endif |
| 117 | |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 118 | #ifdef yylex_destroy |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 119 | # define pplex_destroy_ALREADY_DEFINED |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 120 | #else |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 121 | # define yylex_destroy pplex_destroy |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 122 | #endif |
| 123 | |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 124 | #ifdef yyget_debug |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 125 | # define ppget_debug_ALREADY_DEFINED |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 126 | #else |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 127 | # define yyget_debug ppget_debug |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 128 | #endif |
| 129 | |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 130 | #ifdef yyset_debug |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 131 | # define ppset_debug_ALREADY_DEFINED |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 132 | #else |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 133 | # define yyset_debug ppset_debug |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 134 | #endif |
| 135 | |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 136 | #ifdef yyget_extra |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 137 | # define ppget_extra_ALREADY_DEFINED |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 138 | #else |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 139 | # define yyget_extra ppget_extra |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 140 | #endif |
| 141 | |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 142 | #ifdef yyset_extra |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 143 | # define ppset_extra_ALREADY_DEFINED |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 144 | #else |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 145 | # define yyset_extra ppset_extra |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 146 | #endif |
| 147 | |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 148 | #ifdef yyget_in |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 149 | # define ppget_in_ALREADY_DEFINED |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 150 | #else |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 151 | # define yyget_in ppget_in |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 152 | #endif |
| 153 | |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 154 | #ifdef yyset_in |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 155 | # define ppset_in_ALREADY_DEFINED |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 156 | #else |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 157 | # define yyset_in ppset_in |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 158 | #endif |
| 159 | |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 160 | #ifdef yyget_out |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 161 | # define ppget_out_ALREADY_DEFINED |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 162 | #else |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 163 | # define yyget_out ppget_out |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 164 | #endif |
| 165 | |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 166 | #ifdef yyset_out |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 167 | # define ppset_out_ALREADY_DEFINED |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 168 | #else |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 169 | # define yyset_out ppset_out |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 170 | #endif |
| 171 | |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 172 | #ifdef yyget_leng |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 173 | # define ppget_leng_ALREADY_DEFINED |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 174 | #else |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 175 | # define yyget_leng ppget_leng |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 176 | #endif |
| 177 | |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 178 | #ifdef yyget_text |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 179 | # define ppget_text_ALREADY_DEFINED |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 180 | #else |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 181 | # define yyget_text ppget_text |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 182 | #endif |
| 183 | |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 184 | #ifdef yyget_lineno |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 185 | # define ppget_lineno_ALREADY_DEFINED |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 186 | #else |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 187 | # define yyget_lineno ppget_lineno |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 188 | #endif |
| 189 | |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 190 | #ifdef yyset_lineno |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 191 | # define ppset_lineno_ALREADY_DEFINED |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 192 | #else |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 193 | # define yyset_lineno ppset_lineno |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 194 | #endif |
| 195 | |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 196 | #ifdef yyget_column |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 197 | # define ppget_column_ALREADY_DEFINED |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 198 | #else |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 199 | # define yyget_column ppget_column |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 200 | #endif |
| 201 | |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 202 | #ifdef yyset_column |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 203 | # define ppset_column_ALREADY_DEFINED |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 204 | #else |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 205 | # define yyset_column ppset_column |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 206 | #endif |
Geoff Lang | 93561c3 | 2016-09-20 10:22:55 -0400 | [diff] [blame] | 207 | |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 208 | #ifdef yywrap |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 209 | # define ppwrap_ALREADY_DEFINED |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 210 | #else |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 211 | # define yywrap ppwrap |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 212 | #endif |
| 213 | |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 214 | #ifdef yyget_lval |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 215 | # define ppget_lval_ALREADY_DEFINED |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 216 | #else |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 217 | # define yyget_lval ppget_lval |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 218 | #endif |
| 219 | |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 220 | #ifdef yyset_lval |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 221 | # define ppset_lval_ALREADY_DEFINED |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 222 | #else |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 223 | # define yyset_lval ppset_lval |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 224 | #endif |
| 225 | |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 226 | #ifdef yyget_lloc |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 227 | # define ppget_lloc_ALREADY_DEFINED |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 228 | #else |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 229 | # define yyget_lloc ppget_lloc |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 230 | #endif |
| 231 | |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 232 | #ifdef yyset_lloc |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 233 | # define ppset_lloc_ALREADY_DEFINED |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 234 | #else |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 235 | # define yyset_lloc ppset_lloc |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 236 | #endif |
| 237 | |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 238 | #ifdef yyalloc |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 239 | # define ppalloc_ALREADY_DEFINED |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 240 | #else |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 241 | # define yyalloc ppalloc |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 242 | #endif |
| 243 | |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 244 | #ifdef yyrealloc |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 245 | # define pprealloc_ALREADY_DEFINED |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 246 | #else |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 247 | # define yyrealloc pprealloc |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 248 | #endif |
| 249 | |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 250 | #ifdef yyfree |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 251 | # define ppfree_ALREADY_DEFINED |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 252 | #else |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 253 | # define yyfree ppfree |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 254 | #endif |
| 255 | |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 256 | /* First, we deal with platform-specific or compiler-specific issues. */ |
| 257 | |
| 258 | /* begin standard C headers. */ |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 259 | #include <errno.h> |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 260 | #include <stdio.h> |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 261 | #include <stdlib.h> |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 262 | #include <string.h> |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 263 | |
| 264 | /* end standard C headers. */ |
| 265 | |
| 266 | /* flex integer type definitions */ |
| 267 | |
| 268 | #ifndef FLEXINT_H |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 269 | # define FLEXINT_H |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 270 | |
| 271 | /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ |
| 272 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 273 | # if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 274 | |
| 275 | /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 276 | * if you want the limit (max/min) macros for int types. |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 277 | */ |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 278 | # ifndef __STDC_LIMIT_MACROS |
| 279 | # define __STDC_LIMIT_MACROS 1 |
| 280 | # endif |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 281 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 282 | # include <inttypes.h> |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 283 | typedef int8_t flex_int8_t; |
| 284 | typedef uint8_t flex_uint8_t; |
| 285 | typedef int16_t flex_int16_t; |
| 286 | typedef uint16_t flex_uint16_t; |
| 287 | typedef int32_t flex_int32_t; |
| 288 | typedef uint32_t flex_uint32_t; |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 289 | # else |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 290 | typedef signed char flex_int8_t; |
| 291 | typedef short int flex_int16_t; |
| 292 | typedef int flex_int32_t; |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 293 | typedef unsigned char flex_uint8_t; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 294 | typedef unsigned short int flex_uint16_t; |
| 295 | typedef unsigned int flex_uint32_t; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 296 | |
| 297 | /* Limits of integral types. */ |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 298 | # ifndef INT8_MIN |
| 299 | # define INT8_MIN (-128) |
| 300 | # endif |
| 301 | # ifndef INT16_MIN |
| 302 | # define INT16_MIN (-32767 - 1) |
| 303 | # endif |
| 304 | # ifndef INT32_MIN |
| 305 | # define INT32_MIN (-2147483647 - 1) |
| 306 | # endif |
| 307 | # ifndef INT8_MAX |
| 308 | # define INT8_MAX (127) |
| 309 | # endif |
| 310 | # ifndef INT16_MAX |
| 311 | # define INT16_MAX (32767) |
| 312 | # endif |
| 313 | # ifndef INT32_MAX |
| 314 | # define INT32_MAX (2147483647) |
| 315 | # endif |
| 316 | # ifndef UINT8_MAX |
| 317 | # define UINT8_MAX (255U) |
| 318 | # endif |
| 319 | # ifndef UINT16_MAX |
| 320 | # define UINT16_MAX (65535U) |
| 321 | # endif |
| 322 | # ifndef UINT32_MAX |
| 323 | # define UINT32_MAX (4294967295U) |
| 324 | # endif |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 325 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 326 | # ifndef SIZE_MAX |
| 327 | # define SIZE_MAX (~(size_t)0) |
| 328 | # endif |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 329 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 330 | # endif /* ! C99 */ |
Zhenyao Mo | f1d723c | 2013-09-23 14:57:07 -0400 | [diff] [blame] | 331 | |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 332 | #endif /* ! FLEXINT_H */ |
| 333 | |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 334 | /* begin standard C++ headers. */ |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 335 | |
Geoff Lang | 93561c3 | 2016-09-20 10:22:55 -0400 | [diff] [blame] | 336 | /* TODO: this is always defined, so inline it */ |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 337 | #define yyconst const |
Geoff Lang | 93561c3 | 2016-09-20 10:22:55 -0400 | [diff] [blame] | 338 | |
| 339 | #if defined(__GNUC__) && __GNUC__ >= 3 |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 340 | # define yynoreturn __attribute__((__noreturn__)) |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 341 | #else |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 342 | # define yynoreturn |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 343 | #endif |
| 344 | |
| 345 | /* Returned upon end-of-file. */ |
| 346 | #define YY_NULL 0 |
| 347 | |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 348 | /* Promotes a possibly negative, possibly signed char to an |
| 349 | * integer in range [0..255] for use as an array index. |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 350 | */ |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 351 | #define YY_SC_TO_UI(c) ((YY_CHAR)(c)) |
Geoff Lang | 93561c3 | 2016-09-20 10:22:55 -0400 | [diff] [blame] | 352 | |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 353 | /* An opaque pointer. */ |
| 354 | #ifndef YY_TYPEDEF_YY_SCANNER_T |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 355 | # define YY_TYPEDEF_YY_SCANNER_T |
| 356 | typedef void *yyscan_t; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 357 | #endif |
| 358 | |
| 359 | /* For convenience, these vars (plus the bison vars far below) |
| 360 | are macros in the reentrant scanner. */ |
| 361 | #define yyin yyg->yyin_r |
| 362 | #define yyout yyg->yyout_r |
| 363 | #define yyextra yyg->yyextra_r |
| 364 | #define yyleng yyg->yyleng_r |
| 365 | #define yytext yyg->yytext_r |
| 366 | #define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno) |
| 367 | #define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column) |
| 368 | #define yy_flex_debug yyg->yy_flex_debug_r |
| 369 | |
| 370 | /* Enter a start condition. This macro really ought to take a parameter, |
| 371 | * but we do it the disgusting crufty way forced on us by the ()-less |
| 372 | * definition of BEGIN. |
| 373 | */ |
| 374 | #define BEGIN yyg->yy_start = 1 + 2 * |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 375 | /* Translate the current start state into a value that can be later handed |
| 376 | * to BEGIN to return to the state. The YYSTATE alias is for lex |
| 377 | * compatibility. |
| 378 | */ |
| 379 | #define YY_START ((yyg->yy_start - 1) / 2) |
| 380 | #define YYSTATE YY_START |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 381 | /* Action number for EOF rule of a given start state. */ |
| 382 | #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 383 | /* Special action meaning "start processing a new file". */ |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 384 | #define YY_NEW_FILE yyrestart(yyin, yyscanner) |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 385 | #define YY_END_OF_BUFFER_CHAR 0 |
| 386 | |
| 387 | /* Size of default input buffer. */ |
| 388 | #ifndef YY_BUF_SIZE |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 389 | # ifdef __ia64__ |
Geoff Lang | 93561c3 | 2016-09-20 10:22:55 -0400 | [diff] [blame] | 390 | /* On IA-64, the buffer size is 16k, not 8k. |
| 391 | * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. |
| 392 | * Ditto for the __ia64__ case accordingly. |
| 393 | */ |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 394 | # define YY_BUF_SIZE 32768 |
| 395 | # else |
| 396 | # define YY_BUF_SIZE 16384 |
| 397 | # endif /* __ia64__ */ |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 398 | #endif |
| 399 | |
| 400 | /* The state buf must be large enough to hold one state per character in the main buffer. |
| 401 | */ |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 402 | #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) |
Geoff Lang | 93561c3 | 2016-09-20 10:22:55 -0400 | [diff] [blame] | 403 | |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 404 | #ifndef YY_TYPEDEF_YY_BUFFER_STATE |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 405 | # define YY_TYPEDEF_YY_BUFFER_STATE |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 406 | typedef struct yy_buffer_state *YY_BUFFER_STATE; |
| 407 | #endif |
| 408 | |
shannonwoods@chromium.org | b075716 | 2013-05-30 00:21:27 +0000 | [diff] [blame] | 409 | #ifndef YY_TYPEDEF_YY_SIZE_T |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 410 | # define YY_TYPEDEF_YY_SIZE_T |
shannonwoods@chromium.org | b075716 | 2013-05-30 00:21:27 +0000 | [diff] [blame] | 411 | typedef size_t yy_size_t; |
| 412 | #endif |
| 413 | |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 414 | #define EOB_ACT_CONTINUE_SCAN 0 |
| 415 | #define EOB_ACT_END_OF_FILE 1 |
| 416 | #define EOB_ACT_LAST_MATCH 2 |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 417 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 418 | #define YY_LESS_LINENO(n) |
| 419 | #define YY_LINENO_REWIND_TO(ptr) |
| 420 | |
| 421 | /* Return all but the first "n" matched characters back to the input stream. */ |
| 422 | #define yyless(n) \ |
| 423 | do \ |
| 424 | { \ |
| 425 | /* Undo effects of setting up yytext. */ \ |
| 426 | int yyless_macro_arg = (n); \ |
| 427 | YY_LESS_LINENO(yyless_macro_arg); \ |
| 428 | *yy_cp = yyg->yy_hold_char; \ |
| 429 | YY_RESTORE_YY_MORE_OFFSET \ |
| 430 | yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ |
| 431 | YY_DO_BEFORE_ACTION; /* set up yytext again */ \ |
| 432 | } while (0) |
| 433 | #define unput(c) yyunput(c, yyg->yytext_ptr, yyscanner) |
Geoff Lang | 93561c3 | 2016-09-20 10:22:55 -0400 | [diff] [blame] | 434 | |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 435 | #ifndef YY_STRUCT_YY_BUFFER_STATE |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 436 | # define YY_STRUCT_YY_BUFFER_STATE |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 437 | struct yy_buffer_state |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 438 | { |
| 439 | FILE *yy_input_file; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 440 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 441 | char *yy_ch_buf; /* input buffer */ |
| 442 | char *yy_buf_pos; /* current position in input buffer */ |
Geoff Lang | 93561c3 | 2016-09-20 10:22:55 -0400 | [diff] [blame] | 443 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 444 | /* Size of input buffer in bytes, not including room for EOB |
| 445 | * characters. |
| 446 | */ |
| 447 | int yy_buf_size; |
Geoff Lang | 93561c3 | 2016-09-20 10:22:55 -0400 | [diff] [blame] | 448 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 449 | /* Number of characters read into yy_ch_buf, not including EOB |
| 450 | * characters. |
| 451 | */ |
| 452 | int yy_n_chars; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 453 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 454 | /* Whether we "own" the buffer - i.e., we know we created it, |
| 455 | * and can realloc() it to grow it, and should free() it to |
| 456 | * delete it. |
| 457 | */ |
| 458 | int yy_is_our_buffer; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 459 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 460 | /* Whether this is an "interactive" input source; if so, and |
| 461 | * if we're using stdio for input, then we want to use getc() |
| 462 | * instead of fread(), to make sure we stop fetching input after |
| 463 | * each newline. |
| 464 | */ |
| 465 | int yy_is_interactive; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 466 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 467 | /* Whether we're considered to be at the beginning of a line. |
| 468 | * If so, '^' rules will be active on the next match, otherwise |
| 469 | * not. |
| 470 | */ |
| 471 | int yy_at_bol; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 472 | |
| 473 | int yy_bs_lineno; /**< The line count. */ |
| 474 | int yy_bs_column; /**< The column count. */ |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 475 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 476 | /* Whether to try to fill the input buffer when we reach the |
| 477 | * end of it. |
| 478 | */ |
| 479 | int yy_fill_buffer; |
Geoff Lang | 93561c3 | 2016-09-20 10:22:55 -0400 | [diff] [blame] | 480 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 481 | int yy_buffer_status; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 482 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 483 | # define YY_BUFFER_NEW 0 |
| 484 | # define YY_BUFFER_NORMAL 1 |
| 485 | /* When an EOF's been seen but there's still some text to process |
| 486 | * then we mark the buffer as YY_EOF_PENDING, to indicate that we |
| 487 | * shouldn't try reading from the input source any more. We might |
| 488 | * still have a bunch of tokens to match, though, because of |
| 489 | * possible backing-up. |
| 490 | * |
| 491 | * When we actually see the EOF, we change the status to "new" |
| 492 | * (via yyrestart()), so that the user can continue scanning by |
| 493 | * just pointing yyin at a new input file. |
| 494 | */ |
| 495 | # define YY_BUFFER_EOF_PENDING 2 |
| 496 | }; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 497 | #endif /* !YY_STRUCT_YY_BUFFER_STATE */ |
| 498 | |
| 499 | /* We provide macros for accessing buffer states in case in the |
| 500 | * future we want to put the buffer states in a more general |
| 501 | * "scanner state". |
| 502 | * |
| 503 | * Returns the top of the stack, or NULL. |
| 504 | */ |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 505 | #define YY_CURRENT_BUFFER \ |
| 506 | (yyg->yy_buffer_stack ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] : NULL) |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 507 | /* Same as previous macro, but useful when we know that the buffer stack is not |
| 508 | * NULL or when we need an lvalue. For internal use only. |
| 509 | */ |
| 510 | #define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] |
| 511 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 512 | void yyrestart(FILE *input_file, yyscan_t yyscanner); |
| 513 | void yy_switch_to_buffer(YY_BUFFER_STATE new_buffer, yyscan_t yyscanner); |
| 514 | YY_BUFFER_STATE yy_create_buffer(FILE *file, int size, yyscan_t yyscanner); |
| 515 | void yy_delete_buffer(YY_BUFFER_STATE b, yyscan_t yyscanner); |
| 516 | void yy_flush_buffer(YY_BUFFER_STATE b, yyscan_t yyscanner); |
| 517 | void yypush_buffer_state(YY_BUFFER_STATE new_buffer, yyscan_t yyscanner); |
| 518 | void yypop_buffer_state(yyscan_t yyscanner); |
Geoff Lang | 93561c3 | 2016-09-20 10:22:55 -0400 | [diff] [blame] | 519 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 520 | static void yyensure_buffer_stack(yyscan_t yyscanner); |
| 521 | static void yy_load_buffer_state(yyscan_t yyscanner); |
| 522 | static void yy_init_buffer(YY_BUFFER_STATE b, FILE *file, yyscan_t yyscanner); |
| 523 | #define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER, yyscanner) |
Geoff Lang | 93561c3 | 2016-09-20 10:22:55 -0400 | [diff] [blame] | 524 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 525 | YY_BUFFER_STATE yy_scan_buffer(char *base, yy_size_t size, yyscan_t yyscanner); |
| 526 | YY_BUFFER_STATE yy_scan_string(const char *yy_str, yyscan_t yyscanner); |
| 527 | YY_BUFFER_STATE yy_scan_bytes(const char *bytes, int len, yyscan_t yyscanner); |
Geoff Lang | 93561c3 | 2016-09-20 10:22:55 -0400 | [diff] [blame] | 528 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 529 | void *yyalloc(yy_size_t, yyscan_t yyscanner); |
| 530 | void *yyrealloc(void *, yy_size_t, yyscan_t yyscanner); |
| 531 | void yyfree(void *, yyscan_t yyscanner); |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 532 | |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 533 | #define yy_new_buffer yy_create_buffer |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 534 | #define yy_set_interactive(is_interactive) \ |
| 535 | { \ |
| 536 | if (!YY_CURRENT_BUFFER) \ |
| 537 | { \ |
| 538 | yyensure_buffer_stack(yyscanner); \ |
| 539 | YY_CURRENT_BUFFER_LVALUE = yy_create_buffer(yyin, YY_BUF_SIZE, yyscanner); \ |
| 540 | } \ |
| 541 | YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ |
| 542 | } |
| 543 | #define yy_set_bol(at_bol) \ |
| 544 | { \ |
| 545 | if (!YY_CURRENT_BUFFER) \ |
| 546 | { \ |
| 547 | yyensure_buffer_stack(yyscanner); \ |
| 548 | YY_CURRENT_BUFFER_LVALUE = yy_create_buffer(yyin, YY_BUF_SIZE, yyscanner); \ |
| 549 | } \ |
| 550 | YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ |
| 551 | } |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 552 | #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) |
| 553 | |
| 554 | /* Begin user sect3 */ |
| 555 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 556 | #define ppwrap(yyscanner) (/*CONSTCOND*/ 1) |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 557 | #define YY_SKIP_YYWRAP |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 558 | typedef flex_uint8_t YY_CHAR; |
Geoff Lang | 93561c3 | 2016-09-20 10:22:55 -0400 | [diff] [blame] | 559 | |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 560 | typedef int yy_state_type; |
| 561 | |
| 562 | #define yytext_ptr yytext_r |
| 563 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 564 | static yy_state_type yy_get_previous_state(yyscan_t yyscanner); |
| 565 | static yy_state_type yy_try_NUL_trans(yy_state_type current_state, yyscan_t yyscanner); |
| 566 | static int yy_get_next_buffer(yyscan_t yyscanner); |
| 567 | static void yynoreturn yy_fatal_error(const char *msg, yyscan_t yyscanner); |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 568 | |
| 569 | /* Done after the current pattern has been matched and before the |
| 570 | * corresponding action - sets up yytext. |
| 571 | */ |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 572 | #define YY_DO_BEFORE_ACTION \ |
| 573 | yyg->yytext_ptr = yy_bp; \ |
| 574 | yyleng = (int)(yy_cp - yy_bp); \ |
| 575 | yyg->yy_hold_char = *yy_cp; \ |
| 576 | *yy_cp = '\0'; \ |
| 577 | yyg->yy_c_buf_p = yy_cp; |
Corentin Wallez | dc0fa46 | 2017-02-01 14:44:43 -0500 | [diff] [blame] | 578 | #define YY_NUM_RULES 37 |
| 579 | #define YY_END_OF_BUFFER 38 |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 580 | /* This struct is not used in this scanner, |
| 581 | but its presence is necessary. */ |
| 582 | struct yy_trans_info |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 583 | { |
| 584 | flex_int32_t yy_verify; |
| 585 | flex_int32_t yy_nxt; |
| 586 | }; |
| 587 | static const flex_int16_t yy_accept[95] = { |
| 588 | 0, 0, 0, 0, 0, 38, 36, 34, 35, 35, 33, 7, 33, 33, 33, 33, 33, 33, 33, 33, 9, 9, 33, 33, |
| 589 | 33, 8, 33, 33, 3, 5, 5, 4, 34, 35, 19, 27, 20, 30, 25, 12, 23, 13, 24, 10, 2, 1, 26, 10, |
| 590 | 9, 11, 11, 11, 9, 11, 9, 9, 14, 16, 18, 17, 15, 8, 31, 21, 32, 22, 3, 5, 6, 11, 10, 11, |
| 591 | 10, 1, 10, 11, 10, 0, 10, 9, 9, 9, 28, 29, 0, 10, 10, 10, 10, 9, 10, 10, 9, 10, 0 |
shannonwoods@chromium.org | 3f83e29 | 2013-05-30 00:21:34 +0000 | [diff] [blame] | 592 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 593 | }; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 594 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 595 | static const YY_CHAR yy_ec[256] = { |
| 596 | 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 2, 2, 4, 1, 1, 1, 1, 1, 1, 1, |
| 597 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 5, 1, 6, 1, 7, 8, 1, 9, 9, |
| 598 | 10, 11, 9, 12, 13, 14, 15, 16, 16, 16, 16, 16, 16, 16, 17, 17, 9, 9, 18, 19, 20, |
| 599 | 9, 1, 21, 21, 21, 21, 22, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, |
| 600 | 24, 25, 24, 24, 26, 24, 24, 9, 1, 9, 27, 24, 1, 21, 21, 21, 21, |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 601 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 602 | 22, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 25, 24, 24, 26, 24, |
| 603 | 24, 9, 28, 9, 9, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 604 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 605 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 606 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 607 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 608 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 609 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 610 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 611 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 612 | static const YY_CHAR yy_meta[29] = {0, 1, 1, 2, 2, 1, 1, 1, 1, 1, 3, 1, 1, 4, 1, |
| 613 | 5, 5, 5, 1, 1, 1, 5, 5, 5, 5, 5, 5, 1, 1}; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 614 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 615 | static const flex_int16_t yy_base[100] = { |
| 616 | 0, 0, 0, 26, 28, 133, 195, 130, 195, 128, 105, 195, 104, 25, 195, 100, 23, |
| 617 | 27, 32, 31, 38, 50, 38, 93, 49, 0, 16, 51, 0, 195, 105, 87, 93, 195, |
| 618 | 195, 195, 195, 195, 195, 195, 195, 195, 195, 67, 195, 0, 195, 81, 55, 84, 98, |
| 619 | 110, 53, 61, 0, 52, 39, 195, 195, 195, 33, 0, 195, 195, 195, 195, 0, 195, |
| 620 | 195, 113, 0, 126, 0, 0, 0, 133, 0, 56, 128, 0, 133, 0, 195, 195, 101, |
| 621 | 141, 143, 145, 0, 15, 154, 195, 0, 195, 195, 177, 32, 182, 187, 189 |
shannon.woods%transgaming.com@gtempaccount.com | bcde56f | 2013-04-13 03:32:12 +0000 | [diff] [blame] | 622 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 623 | }; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 624 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 625 | static const flex_int16_t yy_def[100] = { |
| 626 | 0, 94, 1, 95, 95, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, |
| 627 | 20, 94, 94, 94, 96, 94, 94, 97, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, |
| 628 | 94, 94, 94, 98, 94, 94, 20, 20, 49, 50, 50, 99, 21, 50, 94, 94, 94, 94, 94, 96, 94, |
| 629 | 94, 94, 94, 97, 94, 94, 43, 43, 69, 69, 98, 47, 50, 50, 94, 51, 50, 99, 50, 94, 94, |
| 630 | 94, 71, 75, 94, 50, 50, 94, 94, 50, 94, 0, 94, 94, 94, 94, 94 |
shannon.woods%transgaming.com@gtempaccount.com | bcde56f | 2013-04-13 03:32:12 +0000 | [diff] [blame] | 631 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 632 | }; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 633 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 634 | static const flex_int16_t yy_nxt[224] = { |
| 635 | 0, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 21, 22, 23, 24, 25, 25, |
| 636 | 25, 25, 25, 25, 26, 27, 29, 30, 29, 30, 36, 39, 62, 31, 61, 31, 41, 92, 44, 40, 63, 37, 45, |
| 637 | 42, 43, 43, 43, 46, 47, 83, 48, 48, 49, 56, 57, 82, 50, 51, 50, 50, 52, 53, 54, 54, 54, 59, |
| 638 | 60, 64, 87, 87, 87, 50, 55, 50, 81, 79, 65, 69, 50, 70, 70, 70, 50, 50, 50, 69, 71, 72, 69, |
| 639 | 69, 69, 50, 32, 74, 74, 74, 49, 49, |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 640 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 641 | 68, 50, 75, 76, 50, 50, 50, 67, 50, 50, 50, 58, 50, 50, 50, 90, 90, 90, 38, 50, 77, 77, 35, |
| 642 | 34, 78, 78, 78, 69, 69, 69, 33, 32, 94, 94, 69, 69, 84, 84, 94, 94, 85, 85, 85, 84, 84, 50, |
| 643 | 94, 86, 86, 86, 88, 94, 94, 94, 94, 94, 50, 89, 50, 87, 87, 87, 94, 72, 94, 76, 94, 91, 90, |
| 644 | 90, 90, 94, 94, 94, 94, 94, 93, 28, 28, 28, 28, 28, 66, 94, 94, 66, 66, 73, 94, 73, 73, 73, |
| 645 | 80, 80, 5, 94, 94, 94, 94, 94, |
shannonwoods@chromium.org | c8100b8 | 2013-05-30 00:20:34 +0000 | [diff] [blame] | 646 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 647 | 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94}; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 648 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 649 | static const flex_int16_t yy_chk[224] = { |
| 650 | 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 651 | 1, 1, 1, 1, 1, 1, 3, 3, 4, 4, 13, 16, 26, 3, 96, 4, 17, 89, 19, 16, 26, 13, 19, |
| 652 | 17, 18, 18, 18, 19, 20, 60, 20, 20, 20, 22, 22, 56, 20, 20, 20, 20, 20, 20, 21, 21, 21, 24, |
| 653 | 24, 27, 77, 77, 77, 53, 21, 21, 55, 52, 27, 43, 48, 43, 43, 43, 53, 53, 53, 43, 43, 43, 43, |
| 654 | 43, 43, 47, 32, 47, 47, 47, 49, 49, |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 655 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 656 | 31, 47, 47, 47, 47, 47, 47, 30, 49, 49, 50, 23, 50, 50, 50, 84, 84, 84, 15, 50, 51, 51, 12, |
| 657 | 10, 51, 51, 51, 69, 69, 69, 9, 7, 5, 0, 69, 69, 71, 71, 78, 78, 71, 71, 71, 75, 75, 80, |
| 658 | 0, 75, 75, 75, 78, 85, 85, 86, 86, 0, 80, 80, 80, 87, 87, 87, 0, 85, 0, 86, 0, 87, 90, |
| 659 | 90, 90, 0, 0, 0, 0, 0, 90, 95, 95, 95, 95, 95, 97, 0, 0, 97, 97, 98, 0, 98, 98, 98, |
| 660 | 99, 99, 94, 94, 94, 94, 94, 94, |
shannonwoods@chromium.org | c8100b8 | 2013-05-30 00:20:34 +0000 | [diff] [blame] | 661 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 662 | 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94}; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 663 | |
| 664 | /* The intent behind this definition is that it'll catch |
| 665 | * any uses of REJECT which flex missed. |
| 666 | */ |
| 667 | #define REJECT reject_used_but_not_detected |
| 668 | #define yymore() yymore_used_but_not_detected |
| 669 | #define YY_MORE_ADJ 0 |
| 670 | #define YY_RESTORE_YY_MORE_OFFSET |
| 671 | /* |
| 672 | // |
Jamie Madill | 88f6e94 | 2014-02-19 10:27:53 -0500 | [diff] [blame] | 673 | // Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved. |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 674 | // Use of this source code is governed by a BSD-style license that can be |
| 675 | // found in the LICENSE file. |
| 676 | // |
| 677 | |
| 678 | This file contains the Lex specification for GLSL ES preprocessor. |
| 679 | Based on Microsoft Visual Studio 2010 Preprocessor Grammar: |
| 680 | http://msdn.microsoft.com/en-us/library/2scxys89.aspx |
| 681 | |
| 682 | IF YOU MODIFY THIS FILE YOU ALSO NEED TO RUN generate_parser.sh. |
| 683 | */ |
| 684 | |
Scott Graham | a897542 | 2015-05-01 11:09:12 -0700 | [diff] [blame] | 685 | #if defined(_MSC_VER) |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 686 | # pragma warning(disable : 4005) |
Scott Graham | a897542 | 2015-05-01 11:09:12 -0700 | [diff] [blame] | 687 | #endif |
| 688 | |
Corentin Wallez | 054f7ed | 2016-09-20 17:15:59 -0400 | [diff] [blame] | 689 | #include "compiler/preprocessor/Tokenizer.h" |
alokp@chromium.org | 2c958ee | 2012-05-17 20:35:42 +0000 | [diff] [blame] | 690 | |
Corentin Wallez | 054f7ed | 2016-09-20 17:15:59 -0400 | [diff] [blame] | 691 | #include "compiler/preprocessor/DiagnosticsBase.h" |
| 692 | #include "compiler/preprocessor/Token.h" |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 693 | |
maxvujovic@gmail.com | c6b3b3c | 2012-06-27 22:49:39 +0000 | [diff] [blame] | 694 | #if defined(__GNUC__) |
| 695 | // Triggered by the auto-generated yy_fatal_error function. |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 696 | # pragma GCC diagnostic ignored "-Wmissing-noreturn" |
Minmin Gong | 794e000 | 2015-04-07 18:31:54 -0700 | [diff] [blame] | 697 | #elif defined(_MSC_VER) |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 698 | # pragma warning(disable : 4244) |
maxvujovic@gmail.com | c6b3b3c | 2012-06-27 22:49:39 +0000 | [diff] [blame] | 699 | #endif |
Nico Weber | 41b072b | 2018-02-09 10:01:32 -0500 | [diff] [blame] | 700 | #if defined(__clang__) |
| 701 | // Flex uses `/*FALLTHROUGH*/` instead of dedicated statements. |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 702 | # pragma GCC diagnostic ignored "-Wimplicit-fallthrough" |
Nico Weber | 41b072b | 2018-02-09 10:01:32 -0500 | [diff] [blame] | 703 | #endif |
maxvujovic@gmail.com | c6b3b3c | 2012-06-27 22:49:39 +0000 | [diff] [blame] | 704 | |
Jamie Madill | 2dc8bf8 | 2015-04-30 15:56:52 -0400 | [diff] [blame] | 705 | // Workaround for flex using the register keyword, deprecated in C++11. |
| 706 | #ifdef __cplusplus |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 707 | # if __cplusplus > 199711L |
| 708 | # define register |
| 709 | # endif |
Jamie Madill | 2dc8bf8 | 2015-04-30 15:56:52 -0400 | [diff] [blame] | 710 | #endif |
| 711 | |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 712 | typedef std::string YYSTYPE; |
Geoff Lang | 197d529 | 2018-04-25 14:29:00 -0400 | [diff] [blame] | 713 | typedef angle::pp::SourceLocation YYLTYPE; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 714 | |
| 715 | // Use the unused yycolumn variable to track file (string) number. |
| 716 | #define yyfileno yycolumn |
| 717 | |
| 718 | #define YY_USER_INIT \ |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 719 | do \ |
| 720 | { \ |
| 721 | yyfileno = 0; \ |
| 722 | yylineno = 1; \ |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 723 | yyextra->leadingSpace = false; \ |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 724 | yyextra->lineStart = true; \ |
| 725 | } while (0); |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 726 | |
U-GOOGLE\courtneygo | bab086a | 2018-03-30 16:08:42 -0600 | [diff] [blame] | 727 | #define YY_NO_INPUT |
alokp@chromium.org | 19d7aa6 | 2012-05-31 17:34:05 +0000 | [diff] [blame] | 728 | #define YY_USER_ACTION \ |
| 729 | do \ |
| 730 | { \ |
Geoff Lang | 197d529 | 2018-04-25 14:29:00 -0400 | [diff] [blame] | 731 | angle::pp::Input *input = &yyextra->input; \ |
| 732 | angle::pp::Input::Location *scanLoc = &yyextra->scanLoc; \ |
alokp@chromium.org | 19d7aa6 | 2012-05-31 17:34:05 +0000 | [diff] [blame] | 733 | while ((scanLoc->sIndex < input->count()) && \ |
| 734 | (scanLoc->cIndex >= input->length(scanLoc->sIndex))) \ |
| 735 | { \ |
| 736 | scanLoc->cIndex -= input->length(scanLoc->sIndex++); \ |
Geoff Lang | 197d529 | 2018-04-25 14:29:00 -0400 | [diff] [blame] | 737 | ++yyfileno; \ |
| 738 | yylineno = 1; \ |
alokp@chromium.org | 19d7aa6 | 2012-05-31 17:34:05 +0000 | [diff] [blame] | 739 | } \ |
| 740 | yylloc->file = yyfileno; \ |
| 741 | yylloc->line = yylineno; \ |
| 742 | scanLoc->cIndex += yyleng; \ |
Geoff Lang | 197d529 | 2018-04-25 14:29:00 -0400 | [diff] [blame] | 743 | } while (0); |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 744 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 745 | #define YY_INPUT(buf, result, maxSize) result = yyextra->input.read(buf, maxSize, &yylineno); |
Geoff Lang | 93561c3 | 2016-09-20 10:22:55 -0400 | [diff] [blame] | 746 | |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 747 | #define INITIAL 0 |
| 748 | #define COMMENT 1 |
| 749 | |
Geoff Lang | 197d529 | 2018-04-25 14:29:00 -0400 | [diff] [blame] | 750 | #define YY_EXTRA_TYPE angle::pp::Tokenizer::Context * |
Geoff Lang | 93561c3 | 2016-09-20 10:22:55 -0400 | [diff] [blame] | 751 | |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 752 | /* Holds the entire state of the reentrant scanner. */ |
| 753 | struct yyguts_t |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 754 | { |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 755 | |
| 756 | /* User-defined. Not touched by flex. */ |
| 757 | YY_EXTRA_TYPE yyextra_r; |
| 758 | |
| 759 | /* The rest are the same as the globals declared in the non-reentrant scanner. */ |
| 760 | FILE *yyin_r, *yyout_r; |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 761 | size_t yy_buffer_stack_top; /**< index of top of stack. */ |
| 762 | size_t yy_buffer_stack_max; /**< capacity of stack. */ |
| 763 | YY_BUFFER_STATE *yy_buffer_stack; /**< Stack as an array. */ |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 764 | char yy_hold_char; |
Geoff Lang | 93561c3 | 2016-09-20 10:22:55 -0400 | [diff] [blame] | 765 | int yy_n_chars; |
| 766 | int yyleng_r; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 767 | char *yy_c_buf_p; |
| 768 | int yy_init; |
| 769 | int yy_start; |
| 770 | int yy_did_buffer_switch_on_eof; |
| 771 | int yy_start_stack_ptr; |
| 772 | int yy_start_stack_depth; |
| 773 | int *yy_start_stack; |
| 774 | yy_state_type yy_last_accepting_state; |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 775 | char *yy_last_accepting_cpos; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 776 | |
| 777 | int yylineno_r; |
| 778 | int yy_flex_debug_r; |
| 779 | |
| 780 | char *yytext_r; |
| 781 | int yy_more_flag; |
| 782 | int yy_more_len; |
| 783 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 784 | YYSTYPE *yylval_r; |
Geoff Lang | 93561c3 | 2016-09-20 10:22:55 -0400 | [diff] [blame] | 785 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 786 | YYLTYPE *yylloc_r; |
Geoff Lang | 93561c3 | 2016-09-20 10:22:55 -0400 | [diff] [blame] | 787 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 788 | }; /* end struct yyguts_t */ |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 789 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 790 | static int yy_init_globals(yyscan_t yyscanner); |
Geoff Lang | 93561c3 | 2016-09-20 10:22:55 -0400 | [diff] [blame] | 791 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 792 | /* This must go here because YYSTYPE and YYLTYPE are included |
| 793 | * from bison output in section 1.*/ |
| 794 | #define yylval yyg->yylval_r |
Geoff Lang | 93561c3 | 2016-09-20 10:22:55 -0400 | [diff] [blame] | 795 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 796 | #define yylloc yyg->yylloc_r |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 797 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 798 | int yylex_init(yyscan_t *scanner); |
Geoff Lang | 93561c3 | 2016-09-20 10:22:55 -0400 | [diff] [blame] | 799 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 800 | int yylex_init_extra(YY_EXTRA_TYPE user_defined, yyscan_t *scanner); |
Geoff Lang | 93561c3 | 2016-09-20 10:22:55 -0400 | [diff] [blame] | 801 | |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 802 | /* Accessor methods to globals. |
| 803 | These are made visible to non-reentrant scanners for convenience. */ |
| 804 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 805 | int yylex_destroy(yyscan_t yyscanner); |
Geoff Lang | 93561c3 | 2016-09-20 10:22:55 -0400 | [diff] [blame] | 806 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 807 | int yyget_debug(yyscan_t yyscanner); |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 808 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 809 | void yyset_debug(int debug_flag, yyscan_t yyscanner); |
Geoff Lang | 93561c3 | 2016-09-20 10:22:55 -0400 | [diff] [blame] | 810 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 811 | YY_EXTRA_TYPE yyget_extra(yyscan_t yyscanner); |
Geoff Lang | 93561c3 | 2016-09-20 10:22:55 -0400 | [diff] [blame] | 812 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 813 | void yyset_extra(YY_EXTRA_TYPE user_defined, yyscan_t yyscanner); |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 814 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 815 | FILE *yyget_in(yyscan_t yyscanner); |
Geoff Lang | 93561c3 | 2016-09-20 10:22:55 -0400 | [diff] [blame] | 816 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 817 | void yyset_in(FILE *_in_str, yyscan_t yyscanner); |
Geoff Lang | 93561c3 | 2016-09-20 10:22:55 -0400 | [diff] [blame] | 818 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 819 | FILE *yyget_out(yyscan_t yyscanner); |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 820 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 821 | void yyset_out(FILE *_out_str, yyscan_t yyscanner); |
Geoff Lang | 93561c3 | 2016-09-20 10:22:55 -0400 | [diff] [blame] | 822 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 823 | int yyget_leng(yyscan_t yyscanner); |
Geoff Lang | 93561c3 | 2016-09-20 10:22:55 -0400 | [diff] [blame] | 824 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 825 | char *yyget_text(yyscan_t yyscanner); |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 826 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 827 | int yyget_lineno(yyscan_t yyscanner); |
Geoff Lang | 93561c3 | 2016-09-20 10:22:55 -0400 | [diff] [blame] | 828 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 829 | void yyset_lineno(int _line_number, yyscan_t yyscanner); |
Geoff Lang | 93561c3 | 2016-09-20 10:22:55 -0400 | [diff] [blame] | 830 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 831 | int yyget_column(yyscan_t yyscanner); |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 832 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 833 | void yyset_column(int _column_no, yyscan_t yyscanner); |
Geoff Lang | 93561c3 | 2016-09-20 10:22:55 -0400 | [diff] [blame] | 834 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 835 | YYSTYPE *yyget_lval(yyscan_t yyscanner); |
Geoff Lang | 93561c3 | 2016-09-20 10:22:55 -0400 | [diff] [blame] | 836 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 837 | void yyset_lval(YYSTYPE *yylval_param, yyscan_t yyscanner); |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 838 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 839 | YYLTYPE *yyget_lloc(yyscan_t yyscanner); |
Geoff Lang | 93561c3 | 2016-09-20 10:22:55 -0400 | [diff] [blame] | 840 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 841 | void yyset_lloc(YYLTYPE *yylloc_param, yyscan_t yyscanner); |
Geoff Lang | 93561c3 | 2016-09-20 10:22:55 -0400 | [diff] [blame] | 842 | |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 843 | /* Macros after this point can all be overridden by user definitions in |
| 844 | * section 1. |
| 845 | */ |
| 846 | |
| 847 | #ifndef YY_SKIP_YYWRAP |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 848 | # ifdef __cplusplus |
| 849 | extern "C" int yywrap(yyscan_t yyscanner); |
| 850 | # else |
| 851 | extern int yywrap(yyscan_t yyscanner); |
| 852 | # endif |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 853 | #endif |
| 854 | |
Geoff Lang | 93561c3 | 2016-09-20 10:22:55 -0400 | [diff] [blame] | 855 | #ifndef YY_NO_UNPUT |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 856 | |
Geoff Lang | 93561c3 | 2016-09-20 10:22:55 -0400 | [diff] [blame] | 857 | #endif |
| 858 | |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 859 | #ifndef yytext_ptr |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 860 | static void yy_flex_strncpy(char *, const char *, int, yyscan_t yyscanner); |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 861 | #endif |
| 862 | |
| 863 | #ifdef YY_NEED_STRLEN |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 864 | static int yy_flex_strlen(const char *, yyscan_t yyscanner); |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 865 | #endif |
| 866 | |
| 867 | #ifndef YY_NO_INPUT |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 868 | # ifdef __cplusplus |
| 869 | static int yyinput(yyscan_t yyscanner); |
| 870 | # else |
| 871 | static int input(yyscan_t yyscanner); |
| 872 | # endif |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 873 | |
| 874 | #endif |
| 875 | |
| 876 | /* Amount of stuff to slurp up with each read. */ |
| 877 | #ifndef YY_READ_BUF_SIZE |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 878 | # ifdef __ia64__ |
Geoff Lang | 93561c3 | 2016-09-20 10:22:55 -0400 | [diff] [blame] | 879 | /* On IA-64, the buffer size is 16k, not 8k */ |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 880 | # define YY_READ_BUF_SIZE 16384 |
| 881 | # else |
| 882 | # define YY_READ_BUF_SIZE 8192 |
| 883 | # endif /* __ia64__ */ |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 884 | #endif |
| 885 | |
| 886 | /* Copy whatever the last rule matched to the standard output. */ |
| 887 | #ifndef ECHO |
| 888 | /* This used to be an fputs(), but since the string might contain NUL's, |
| 889 | * we now use fwrite(). |
| 890 | */ |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 891 | # define ECHO \ |
| 892 | do \ |
| 893 | { \ |
| 894 | if (fwrite(yytext, (size_t)yyleng, 1, yyout)) \ |
| 895 | { \ |
| 896 | } \ |
| 897 | } while (0) |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 898 | #endif |
| 899 | |
| 900 | /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, |
| 901 | * is returned in "result". |
| 902 | */ |
| 903 | #ifndef YY_INPUT |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 904 | # define YY_INPUT(buf, result, max_size) \ |
| 905 | if (YY_CURRENT_BUFFER_LVALUE->yy_is_interactive) \ |
| 906 | { \ |
| 907 | int c = '*'; \ |
| 908 | int n; \ |
| 909 | for (n = 0; n < max_size && (c = getc(yyin)) != EOF && c != '\n'; ++n) \ |
| 910 | buf[n] = (char)c; \ |
| 911 | if (c == '\n') \ |
| 912 | buf[n++] = (char)c; \ |
| 913 | if (c == EOF && ferror(yyin)) \ |
| 914 | YY_FATAL_ERROR("input in flex scanner failed"); \ |
| 915 | result = n; \ |
| 916 | } \ |
| 917 | else \ |
| 918 | { \ |
| 919 | errno = 0; \ |
| 920 | while ((result = (int)fread(buf, 1, (yy_size_t)max_size, yyin)) == 0 && ferror(yyin)) \ |
| 921 | { \ |
| 922 | if (errno != EINTR) \ |
| 923 | { \ |
| 924 | YY_FATAL_ERROR("input in flex scanner failed"); \ |
| 925 | break; \ |
| 926 | } \ |
| 927 | errno = 0; \ |
| 928 | clearerr(yyin); \ |
| 929 | } \ |
| 930 | } |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 931 | |
| 932 | #endif |
| 933 | |
| 934 | /* No semi-colon after return; correct usage is to write "yyterminate();" - |
| 935 | * we don't want an extra ';' after the "return" because that will cause |
| 936 | * some compilers to complain about unreachable statements. |
| 937 | */ |
| 938 | #ifndef yyterminate |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 939 | # define yyterminate() return YY_NULL |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 940 | #endif |
| 941 | |
| 942 | /* Number of entries by which start-condition stack grows. */ |
| 943 | #ifndef YY_START_STACK_INCR |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 944 | # define YY_START_STACK_INCR 25 |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 945 | #endif |
| 946 | |
| 947 | /* Report a fatal error. */ |
| 948 | #ifndef YY_FATAL_ERROR |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 949 | # define YY_FATAL_ERROR(msg) yy_fatal_error(msg, yyscanner) |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 950 | #endif |
| 951 | |
| 952 | /* end tables serialization structures and prototypes */ |
| 953 | |
| 954 | /* Default declaration of generated scanner - a define so the user can |
| 955 | * easily add parameters. |
| 956 | */ |
| 957 | #ifndef YY_DECL |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 958 | # define YY_DECL_IS_OURS 1 |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 959 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 960 | extern int yylex(YYSTYPE *yylval_param, YYLTYPE *yylloc_param, yyscan_t yyscanner); |
Luc Ferron | e49f1e9 | 2018-01-24 14:47:55 -0500 | [diff] [blame] | 961 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 962 | # define YY_DECL int yylex(YYSTYPE *yylval_param, YYLTYPE *yylloc_param, yyscan_t yyscanner) |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 963 | #endif /* !YY_DECL */ |
| 964 | |
| 965 | /* Code executed at the beginning of each rule, after yytext and yyleng |
| 966 | * have been set up. |
| 967 | */ |
| 968 | #ifndef YY_USER_ACTION |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 969 | # define YY_USER_ACTION |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 970 | #endif |
| 971 | |
| 972 | /* Code executed at the end of each rule. */ |
| 973 | #ifndef YY_BREAK |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 974 | # define YY_BREAK /*LINTED*/ break; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 975 | #endif |
| 976 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 977 | #define YY_RULE_SETUP YY_USER_ACTION |
Geoff Lang | 93561c3 | 2016-09-20 10:22:55 -0400 | [diff] [blame] | 978 | |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 979 | /** The main scanner function which does all the work. |
| 980 | */ |
| 981 | YY_DECL |
| 982 | { |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 983 | yy_state_type yy_current_state; |
| 984 | char *yy_cp, *yy_bp; |
| 985 | int yy_act; |
| 986 | struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; |
Geoff Lang | 93561c3 | 2016-09-20 10:22:55 -0400 | [diff] [blame] | 987 | |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 988 | yylval = yylval_param; |
| 989 | |
| 990 | yylloc = yylloc_param; |
| 991 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 992 | if (!yyg->yy_init) |
| 993 | { |
| 994 | yyg->yy_init = 1; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 995 | |
| 996 | #ifdef YY_USER_INIT |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 997 | YY_USER_INIT; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 998 | #endif |
| 999 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1000 | if (!yyg->yy_start) |
| 1001 | yyg->yy_start = 1; /* first start state */ |
Geoff Lang | 93561c3 | 2016-09-20 10:22:55 -0400 | [diff] [blame] | 1002 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1003 | if (!yyin) |
| 1004 | yyin = stdin; |
Geoff Lang | 93561c3 | 2016-09-20 10:22:55 -0400 | [diff] [blame] | 1005 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1006 | if (!yyout) |
| 1007 | yyout = stdout; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1008 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1009 | if (!YY_CURRENT_BUFFER) |
| 1010 | { |
| 1011 | yyensure_buffer_stack(yyscanner); |
| 1012 | YY_CURRENT_BUFFER_LVALUE = yy_create_buffer(yyin, YY_BUF_SIZE, yyscanner); |
| 1013 | } |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1014 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1015 | yy_load_buffer_state(yyscanner); |
Corentin Wallez | dc0fa46 | 2017-02-01 14:44:43 -0500 | [diff] [blame] | 1016 | } |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1017 | |
Corentin Wallez | dc0fa46 | 2017-02-01 14:44:43 -0500 | [diff] [blame] | 1018 | { |
alokp@chromium.org | 19d7aa6 | 2012-05-31 17:34:05 +0000 | [diff] [blame] | 1019 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1020 | /* Line comment */ |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1021 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1022 | while (/*CONSTCOND*/ 1) /* loops until end-of-file is reached */ |
| 1023 | { |
| 1024 | yy_cp = yyg->yy_c_buf_p; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1025 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1026 | /* Support of yytext. */ |
| 1027 | *yy_cp = yyg->yy_hold_char; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1028 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1029 | /* yy_bp points to the position in yy_ch_buf of the start of |
| 1030 | * the current run. |
| 1031 | */ |
| 1032 | yy_bp = yy_cp; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1033 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1034 | yy_current_state = yyg->yy_start; |
| 1035 | yy_match: |
| 1036 | do |
| 1037 | { |
| 1038 | YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; |
| 1039 | if (yy_accept[yy_current_state]) |
| 1040 | { |
| 1041 | yyg->yy_last_accepting_state = yy_current_state; |
| 1042 | yyg->yy_last_accepting_cpos = yy_cp; |
| 1043 | } |
| 1044 | while (yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state) |
| 1045 | { |
| 1046 | yy_current_state = (int)yy_def[yy_current_state]; |
| 1047 | if (yy_current_state >= 95) |
| 1048 | yy_c = yy_meta[yy_c]; |
| 1049 | } |
| 1050 | yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; |
| 1051 | ++yy_cp; |
| 1052 | } while (yy_current_state != 94); |
| 1053 | yy_cp = yyg->yy_last_accepting_cpos; |
| 1054 | yy_current_state = yyg->yy_last_accepting_state; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1055 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1056 | yy_find_action: |
| 1057 | yy_act = yy_accept[yy_current_state]; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1058 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1059 | YY_DO_BEFORE_ACTION; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1060 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1061 | do_action: /* This label is used only to access EOF actions. */ |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1062 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1063 | switch (yy_act) |
| 1064 | { /* beginning of action switch */ |
| 1065 | case 0: /* must back up */ |
| 1066 | /* undo the effects of YY_DO_BEFORE_ACTION */ |
| 1067 | *yy_cp = yyg->yy_hold_char; |
| 1068 | yy_cp = yyg->yy_last_accepting_cpos; |
| 1069 | yy_current_state = yyg->yy_last_accepting_state; |
| 1070 | goto yy_find_action; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1071 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1072 | case 1: |
| 1073 | YY_RULE_SETUP |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1074 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1075 | YY_BREAK |
| 1076 | /* Block comment */ |
| 1077 | /* Line breaks are just counted - not returned. */ |
| 1078 | /* The comment is replaced by a single space. */ |
| 1079 | case 2: |
| 1080 | YY_RULE_SETUP { BEGIN(COMMENT); } |
| 1081 | YY_BREAK |
| 1082 | case 3: |
| 1083 | YY_RULE_SETUP |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1084 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1085 | YY_BREAK |
| 1086 | case 4: |
| 1087 | YY_RULE_SETUP |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1088 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1089 | YY_BREAK |
| 1090 | case 5: |
| 1091 | /* rule 5 can match eol */ |
| 1092 | YY_RULE_SETUP |
| 1093 | { |
| 1094 | if (yylineno == INT_MAX) |
| 1095 | { |
| 1096 | *yylval = "Integer overflow on line number"; |
| 1097 | return angle::pp::Token::GOT_ERROR; |
| 1098 | } |
| 1099 | ++yylineno; |
| 1100 | } |
| 1101 | YY_BREAK |
| 1102 | case 6: |
| 1103 | YY_RULE_SETUP |
| 1104 | { |
| 1105 | yyextra->leadingSpace = true; |
| 1106 | BEGIN(INITIAL); |
| 1107 | } |
| 1108 | YY_BREAK |
| 1109 | case 7: |
| 1110 | YY_RULE_SETUP |
| 1111 | { |
| 1112 | // # is only valid at start of line for preprocessor directives. |
| 1113 | yylval->assign(1, yytext[0]); |
| 1114 | return yyextra->lineStart ? angle::pp::Token::PP_HASH |
| 1115 | : angle::pp::Token::PP_OTHER; |
| 1116 | } |
| 1117 | YY_BREAK |
| 1118 | case 8: |
| 1119 | YY_RULE_SETUP |
| 1120 | { |
| 1121 | yylval->assign(yytext, yyleng); |
| 1122 | return angle::pp::Token::IDENTIFIER; |
| 1123 | } |
| 1124 | YY_BREAK |
| 1125 | case 9: |
| 1126 | YY_RULE_SETUP |
| 1127 | { |
| 1128 | yylval->assign(yytext, yyleng); |
| 1129 | return angle::pp::Token::CONST_INT; |
| 1130 | } |
| 1131 | YY_BREAK |
| 1132 | case 10: |
| 1133 | YY_RULE_SETUP |
| 1134 | { |
| 1135 | yylval->assign(yytext, yyleng); |
| 1136 | return angle::pp::Token::CONST_FLOAT; |
| 1137 | } |
| 1138 | YY_BREAK |
| 1139 | /* Anything that starts with a {DIGIT} or .{DIGIT} must be a number. */ |
| 1140 | /* Rule to catch all invalid integers and floats. */ |
| 1141 | case 11: |
| 1142 | YY_RULE_SETUP |
| 1143 | { |
| 1144 | yylval->assign(yytext, yyleng); |
| 1145 | return angle::pp::Token::PP_NUMBER; |
| 1146 | } |
| 1147 | YY_BREAK |
| 1148 | case 12: |
| 1149 | YY_RULE_SETUP |
| 1150 | { |
| 1151 | yylval->assign(yytext, yyleng); |
| 1152 | return angle::pp::Token::OP_INC; |
| 1153 | } |
| 1154 | YY_BREAK |
| 1155 | case 13: |
| 1156 | YY_RULE_SETUP |
| 1157 | { |
| 1158 | yylval->assign(yytext, yyleng); |
| 1159 | return angle::pp::Token::OP_DEC; |
| 1160 | } |
| 1161 | YY_BREAK |
| 1162 | case 14: |
| 1163 | YY_RULE_SETUP |
| 1164 | { |
| 1165 | yylval->assign(yytext, yyleng); |
| 1166 | return angle::pp::Token::OP_LEFT; |
| 1167 | } |
| 1168 | YY_BREAK |
| 1169 | case 15: |
| 1170 | YY_RULE_SETUP |
| 1171 | { |
| 1172 | yylval->assign(yytext, yyleng); |
| 1173 | return angle::pp::Token::OP_RIGHT; |
| 1174 | } |
| 1175 | YY_BREAK |
| 1176 | case 16: |
| 1177 | YY_RULE_SETUP |
| 1178 | { |
| 1179 | yylval->assign(yytext, yyleng); |
| 1180 | return angle::pp::Token::OP_LE; |
| 1181 | } |
| 1182 | YY_BREAK |
| 1183 | case 17: |
| 1184 | YY_RULE_SETUP |
| 1185 | { |
| 1186 | yylval->assign(yytext, yyleng); |
| 1187 | return angle::pp::Token::OP_GE; |
| 1188 | } |
| 1189 | YY_BREAK |
| 1190 | case 18: |
| 1191 | YY_RULE_SETUP |
| 1192 | { |
| 1193 | yylval->assign(yytext, yyleng); |
| 1194 | return angle::pp::Token::OP_EQ; |
| 1195 | } |
| 1196 | YY_BREAK |
| 1197 | case 19: |
| 1198 | YY_RULE_SETUP |
| 1199 | { |
| 1200 | yylval->assign(yytext, yyleng); |
| 1201 | return angle::pp::Token::OP_NE; |
| 1202 | } |
| 1203 | YY_BREAK |
| 1204 | case 20: |
| 1205 | YY_RULE_SETUP |
| 1206 | { |
| 1207 | yylval->assign(yytext, yyleng); |
| 1208 | return angle::pp::Token::OP_AND; |
| 1209 | } |
| 1210 | YY_BREAK |
| 1211 | case 21: |
| 1212 | YY_RULE_SETUP |
| 1213 | { |
| 1214 | yylval->assign(yytext, yyleng); |
| 1215 | return angle::pp::Token::OP_XOR; |
| 1216 | } |
| 1217 | YY_BREAK |
| 1218 | case 22: |
| 1219 | YY_RULE_SETUP |
| 1220 | { |
| 1221 | yylval->assign(yytext, yyleng); |
| 1222 | return angle::pp::Token::OP_OR; |
| 1223 | } |
| 1224 | YY_BREAK |
| 1225 | case 23: |
| 1226 | YY_RULE_SETUP |
| 1227 | { |
| 1228 | yylval->assign(yytext, yyleng); |
| 1229 | return angle::pp::Token::OP_ADD_ASSIGN; |
| 1230 | } |
| 1231 | YY_BREAK |
| 1232 | case 24: |
| 1233 | YY_RULE_SETUP |
| 1234 | { |
| 1235 | yylval->assign(yytext, yyleng); |
| 1236 | return angle::pp::Token::OP_SUB_ASSIGN; |
| 1237 | } |
| 1238 | YY_BREAK |
| 1239 | case 25: |
| 1240 | YY_RULE_SETUP |
| 1241 | { |
| 1242 | yylval->assign(yytext, yyleng); |
| 1243 | return angle::pp::Token::OP_MUL_ASSIGN; |
| 1244 | } |
| 1245 | YY_BREAK |
| 1246 | case 26: |
| 1247 | YY_RULE_SETUP |
| 1248 | { |
| 1249 | yylval->assign(yytext, yyleng); |
| 1250 | return angle::pp::Token::OP_DIV_ASSIGN; |
| 1251 | } |
| 1252 | YY_BREAK |
| 1253 | case 27: |
| 1254 | YY_RULE_SETUP |
| 1255 | { |
| 1256 | yylval->assign(yytext, yyleng); |
| 1257 | return angle::pp::Token::OP_MOD_ASSIGN; |
| 1258 | } |
| 1259 | YY_BREAK |
| 1260 | case 28: |
| 1261 | YY_RULE_SETUP |
| 1262 | { |
| 1263 | yylval->assign(yytext, yyleng); |
| 1264 | return angle::pp::Token::OP_LEFT_ASSIGN; |
| 1265 | } |
| 1266 | YY_BREAK |
| 1267 | case 29: |
| 1268 | YY_RULE_SETUP |
| 1269 | { |
| 1270 | yylval->assign(yytext, yyleng); |
| 1271 | return angle::pp::Token::OP_RIGHT_ASSIGN; |
| 1272 | } |
| 1273 | YY_BREAK |
| 1274 | case 30: |
| 1275 | YY_RULE_SETUP |
| 1276 | { |
| 1277 | yylval->assign(yytext, yyleng); |
| 1278 | return angle::pp::Token::OP_AND_ASSIGN; |
| 1279 | } |
| 1280 | YY_BREAK |
| 1281 | case 31: |
| 1282 | YY_RULE_SETUP |
| 1283 | { |
| 1284 | yylval->assign(yytext, yyleng); |
| 1285 | return angle::pp::Token::OP_XOR_ASSIGN; |
| 1286 | } |
| 1287 | YY_BREAK |
| 1288 | case 32: |
| 1289 | YY_RULE_SETUP |
| 1290 | { |
| 1291 | yylval->assign(yytext, yyleng); |
| 1292 | return angle::pp::Token::OP_OR_ASSIGN; |
| 1293 | } |
| 1294 | YY_BREAK |
| 1295 | case 33: |
| 1296 | YY_RULE_SETUP |
| 1297 | { |
| 1298 | yylval->assign(1, yytext[0]); |
| 1299 | return yytext[0]; |
| 1300 | } |
| 1301 | YY_BREAK |
| 1302 | case 34: |
| 1303 | YY_RULE_SETUP { yyextra->leadingSpace = true; } |
| 1304 | YY_BREAK |
| 1305 | case 35: |
| 1306 | /* rule 35 can match eol */ |
| 1307 | YY_RULE_SETUP |
| 1308 | { |
| 1309 | if (yylineno == INT_MAX) |
| 1310 | { |
| 1311 | *yylval = "Integer overflow on line number"; |
| 1312 | return angle::pp::Token::GOT_ERROR; |
| 1313 | } |
| 1314 | ++yylineno; |
| 1315 | yylval->assign(1, '\n'); |
| 1316 | return '\n'; |
| 1317 | } |
| 1318 | YY_BREAK |
| 1319 | case 36: |
| 1320 | YY_RULE_SETUP |
| 1321 | { |
| 1322 | yylval->assign(1, yytext[0]); |
| 1323 | return angle::pp::Token::PP_OTHER; |
| 1324 | } |
| 1325 | YY_BREAK |
| 1326 | case YY_STATE_EOF(INITIAL): |
| 1327 | case YY_STATE_EOF(COMMENT): |
| 1328 | { |
| 1329 | // YY_USER_ACTION is not invoked for handling EOF. |
| 1330 | // Set the location for EOF token manually. |
| 1331 | angle::pp::Input *input = &yyextra->input; |
| 1332 | angle::pp::Input::Location *scanLoc = &yyextra->scanLoc; |
| 1333 | yy_size_t sIndexMax = input->count() ? input->count() - 1 : 0; |
| 1334 | if (scanLoc->sIndex != sIndexMax) |
| 1335 | { |
| 1336 | // We can only reach here if there are empty strings at the |
| 1337 | // end of the input. |
| 1338 | scanLoc->sIndex = sIndexMax; |
| 1339 | scanLoc->cIndex = 0; |
| 1340 | // FIXME: this is not 64-bit clean. |
| 1341 | yyfileno = static_cast<int>(sIndexMax); |
| 1342 | yylineno = 1; |
| 1343 | } |
| 1344 | yylloc->file = yyfileno; |
| 1345 | yylloc->line = yylineno; |
| 1346 | yylval->clear(); |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1347 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1348 | // Line number overflows fake EOFs to exit early, check for this case. |
| 1349 | if (yylineno == INT_MAX) |
| 1350 | { |
| 1351 | yyextra->diagnostics->report(angle::pp::Diagnostics::PP_TOKENIZER_ERROR, |
| 1352 | angle::pp::SourceLocation(yyfileno, yylineno), |
| 1353 | "Integer overflow on line number"); |
| 1354 | } |
| 1355 | else if (YY_START == COMMENT) |
| 1356 | { |
| 1357 | yyextra->diagnostics->report(angle::pp::Diagnostics::PP_EOF_IN_COMMENT, |
| 1358 | angle::pp::SourceLocation(yyfileno, yylineno), |
| 1359 | "EOF while in a comment"); |
| 1360 | } |
| 1361 | yyterminate(); |
| 1362 | } |
| 1363 | YY_BREAK |
| 1364 | case 37: |
| 1365 | YY_RULE_SETUP |
| 1366 | ECHO; |
| 1367 | YY_BREAK |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1368 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1369 | case YY_END_OF_BUFFER: |
| 1370 | { |
| 1371 | /* Amount of text matched not including the EOB char. */ |
| 1372 | int yy_amount_of_matched_text = (int)(yy_cp - yyg->yytext_ptr) - 1; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1373 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1374 | /* Undo the effects of YY_DO_BEFORE_ACTION. */ |
| 1375 | *yy_cp = yyg->yy_hold_char; |
| 1376 | YY_RESTORE_YY_MORE_OFFSET |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1377 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1378 | if (YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW) |
| 1379 | { |
| 1380 | /* We're scanning a new file or input source. It's |
| 1381 | * possible that this happened because the user |
| 1382 | * just pointed yyin at a new source and called |
| 1383 | * yylex(). If so, then we have to assure |
| 1384 | * consistency between YY_CURRENT_BUFFER and our |
| 1385 | * globals. Here is the right place to do so, because |
| 1386 | * this is the first action (other than possibly a |
| 1387 | * back-up) that will match for the new input source. |
| 1388 | */ |
| 1389 | yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; |
| 1390 | YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; |
| 1391 | YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; |
| 1392 | } |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1393 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1394 | /* Note that here we test for yy_c_buf_p "<=" to the position |
| 1395 | * of the first EOB in the buffer, since yy_c_buf_p will |
| 1396 | * already have been incremented past the NUL character |
| 1397 | * (since all states make transitions on EOB to the |
| 1398 | * end-of-buffer state). Contrast this with the test |
| 1399 | * in input(). |
| 1400 | */ |
| 1401 | if (yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars]) |
| 1402 | { /* This was really a NUL. */ |
| 1403 | yy_state_type yy_next_state; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1404 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1405 | yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1406 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1407 | yy_current_state = yy_get_previous_state(yyscanner); |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1408 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1409 | /* Okay, we're now positioned to make the NUL |
| 1410 | * transition. We couldn't have |
| 1411 | * yy_get_previous_state() go ahead and do it |
| 1412 | * for us because it doesn't know how to deal |
| 1413 | * with the possibility of jamming (and we don't |
| 1414 | * want to build jamming into it because then it |
| 1415 | * will run more slowly). |
| 1416 | */ |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1417 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1418 | yy_next_state = yy_try_NUL_trans(yy_current_state, yyscanner); |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1419 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1420 | yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; |
| 1421 | |
| 1422 | if (yy_next_state) |
| 1423 | { |
| 1424 | /* Consume the NUL. */ |
| 1425 | yy_cp = ++yyg->yy_c_buf_p; |
| 1426 | yy_current_state = yy_next_state; |
| 1427 | goto yy_match; |
| 1428 | } |
| 1429 | |
| 1430 | else |
| 1431 | { |
| 1432 | yy_cp = yyg->yy_last_accepting_cpos; |
| 1433 | yy_current_state = yyg->yy_last_accepting_state; |
| 1434 | goto yy_find_action; |
| 1435 | } |
| 1436 | } |
| 1437 | |
| 1438 | else |
| 1439 | switch (yy_get_next_buffer(yyscanner)) |
| 1440 | { |
| 1441 | case EOB_ACT_END_OF_FILE: |
| 1442 | { |
| 1443 | yyg->yy_did_buffer_switch_on_eof = 0; |
| 1444 | |
| 1445 | if (yywrap(yyscanner)) |
| 1446 | { |
| 1447 | /* Note: because we've taken care in |
| 1448 | * yy_get_next_buffer() to have set up |
| 1449 | * yytext, we can now set up |
| 1450 | * yy_c_buf_p so that if some total |
| 1451 | * hoser (like flex itself) wants to |
| 1452 | * call the scanner after we return the |
| 1453 | * YY_NULL, it'll still work - another |
| 1454 | * YY_NULL will get returned. |
| 1455 | */ |
| 1456 | yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ; |
| 1457 | |
| 1458 | yy_act = YY_STATE_EOF(YY_START); |
| 1459 | goto do_action; |
| 1460 | } |
| 1461 | |
| 1462 | else |
| 1463 | { |
| 1464 | if (!yyg->yy_did_buffer_switch_on_eof) |
| 1465 | YY_NEW_FILE; |
| 1466 | } |
| 1467 | break; |
| 1468 | } |
| 1469 | |
| 1470 | case EOB_ACT_CONTINUE_SCAN: |
| 1471 | yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text; |
| 1472 | |
| 1473 | yy_current_state = yy_get_previous_state(yyscanner); |
| 1474 | |
| 1475 | yy_cp = yyg->yy_c_buf_p; |
| 1476 | yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; |
| 1477 | goto yy_match; |
| 1478 | |
| 1479 | case EOB_ACT_LAST_MATCH: |
| 1480 | yyg->yy_c_buf_p = |
| 1481 | &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars]; |
| 1482 | |
| 1483 | yy_current_state = yy_get_previous_state(yyscanner); |
| 1484 | |
| 1485 | yy_cp = yyg->yy_c_buf_p; |
| 1486 | yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; |
| 1487 | goto yy_find_action; |
| 1488 | } |
| 1489 | break; |
| 1490 | } |
| 1491 | |
| 1492 | default: |
| 1493 | YY_FATAL_ERROR("fatal flex scanner internal error--no action found"); |
| 1494 | } /* end of action switch */ |
| 1495 | } /* end of scanning one token */ |
| 1496 | } /* end of user's declarations */ |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 1497 | } /* end of yylex */ |
Geoff Lang | 93561c3 | 2016-09-20 10:22:55 -0400 | [diff] [blame] | 1498 | |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1499 | /* yy_get_next_buffer - try to read in a new buffer |
| 1500 | * |
| 1501 | * Returns a code representing an action: |
| 1502 | * EOB_ACT_LAST_MATCH - |
| 1503 | * EOB_ACT_CONTINUE_SCAN - continue scanning from current position |
| 1504 | * EOB_ACT_END_OF_FILE - end of file |
| 1505 | */ |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1506 | static int yy_get_next_buffer(yyscan_t yyscanner) |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1507 | { |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1508 | struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; |
| 1509 | char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; |
| 1510 | char *source = yyg->yytext_ptr; |
| 1511 | int number_to_move, i; |
| 1512 | int ret_val; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1513 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1514 | if (yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1]) |
| 1515 | YY_FATAL_ERROR("fatal flex scanner internal error--end of buffer missed"); |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1516 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1517 | if (YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0) |
| 1518 | { /* Don't try to fill the buffer, so this is an EOF. */ |
| 1519 | if (yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1) |
| 1520 | { |
| 1521 | /* We matched a single character, the EOB, so |
| 1522 | * treat this as a final EOF. |
| 1523 | */ |
| 1524 | return EOB_ACT_END_OF_FILE; |
| 1525 | } |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1526 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1527 | else |
| 1528 | { |
| 1529 | /* We matched some text prior to the EOB, first |
| 1530 | * process it. |
| 1531 | */ |
| 1532 | return EOB_ACT_LAST_MATCH; |
| 1533 | } |
| 1534 | } |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1535 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1536 | /* Try to read more data. */ |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1537 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1538 | /* First move last chars to start of buffer. */ |
| 1539 | number_to_move = (int)(yyg->yy_c_buf_p - yyg->yytext_ptr - 1); |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1540 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1541 | for (i = 0; i < number_to_move; ++i) |
| 1542 | *(dest++) = *(source++); |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1543 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1544 | if (YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING) |
| 1545 | /* don't do the read, it's not guaranteed to return an EOF, |
| 1546 | * just force an EOF |
| 1547 | */ |
| 1548 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1549 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1550 | else |
| 1551 | { |
| 1552 | int num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1553 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1554 | while (num_to_read <= 0) |
| 1555 | { /* Not enough room in the buffer - grow it. */ |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1556 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1557 | /* just a shorter name for the current buffer */ |
| 1558 | YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1559 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1560 | int yy_c_buf_p_offset = (int)(yyg->yy_c_buf_p - b->yy_ch_buf); |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1561 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1562 | if (b->yy_is_our_buffer) |
| 1563 | { |
| 1564 | int new_size = b->yy_buf_size * 2; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1565 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1566 | if (new_size <= 0) |
| 1567 | b->yy_buf_size += b->yy_buf_size / 8; |
| 1568 | else |
| 1569 | b->yy_buf_size *= 2; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1570 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1571 | b->yy_ch_buf = (char *) |
| 1572 | /* Include room in for 2 EOB chars. */ |
| 1573 | yyrealloc((void *)b->yy_ch_buf, (yy_size_t)(b->yy_buf_size + 2), yyscanner); |
| 1574 | } |
| 1575 | else |
| 1576 | /* Can't grow it, we don't own it. */ |
| 1577 | b->yy_ch_buf = NULL; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1578 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1579 | if (!b->yy_ch_buf) |
| 1580 | YY_FATAL_ERROR("fatal error - scanner input buffer overflow"); |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1581 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1582 | yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1583 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1584 | num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; |
| 1585 | } |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1586 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1587 | if (num_to_read > YY_READ_BUF_SIZE) |
| 1588 | num_to_read = YY_READ_BUF_SIZE; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1589 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1590 | /* Read in more data. */ |
| 1591 | yy_size_t ret = 0; |
| 1592 | YY_INPUT((&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), ret, num_to_read); |
| 1593 | yyg->yy_n_chars = static_cast<int>(ret); |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1594 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1595 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; |
| 1596 | } |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1597 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1598 | if (yyg->yy_n_chars == 0) |
| 1599 | { |
| 1600 | if (number_to_move == YY_MORE_ADJ) |
| 1601 | { |
| 1602 | ret_val = EOB_ACT_END_OF_FILE; |
| 1603 | yyrestart(yyin, yyscanner); |
| 1604 | } |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1605 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1606 | else |
| 1607 | { |
| 1608 | ret_val = EOB_ACT_LAST_MATCH; |
| 1609 | YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_EOF_PENDING; |
| 1610 | } |
| 1611 | } |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1612 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1613 | else |
| 1614 | ret_val = EOB_ACT_CONTINUE_SCAN; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1615 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1616 | if ((yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) |
| 1617 | { |
| 1618 | /* Extend the array by 50%, plus the number we really need. */ |
| 1619 | int new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1); |
| 1620 | YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *)yyrealloc( |
| 1621 | (void *)YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t)new_size, yyscanner); |
| 1622 | if (!YY_CURRENT_BUFFER_LVALUE->yy_ch_buf) |
| 1623 | YY_FATAL_ERROR("out of dynamic memory in yy_get_next_buffer()"); |
| 1624 | /* "- 2" to take care of EOB's */ |
| 1625 | YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int)(new_size - 2); |
| 1626 | } |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1627 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1628 | yyg->yy_n_chars += number_to_move; |
| 1629 | YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR; |
| 1630 | YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1631 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1632 | yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1633 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1634 | return ret_val; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1635 | } |
| 1636 | |
| 1637 | /* yy_get_previous_state - get the state just before the EOB char was reached */ |
| 1638 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1639 | static yy_state_type yy_get_previous_state(yyscan_t yyscanner) |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1640 | { |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1641 | yy_state_type yy_current_state; |
| 1642 | char *yy_cp; |
| 1643 | struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1644 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1645 | yy_current_state = yyg->yy_start; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1646 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1647 | for (yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp) |
| 1648 | { |
| 1649 | YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); |
| 1650 | if (yy_accept[yy_current_state]) |
| 1651 | { |
| 1652 | yyg->yy_last_accepting_state = yy_current_state; |
| 1653 | yyg->yy_last_accepting_cpos = yy_cp; |
| 1654 | } |
| 1655 | while (yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state) |
| 1656 | { |
| 1657 | yy_current_state = (int)yy_def[yy_current_state]; |
| 1658 | if (yy_current_state >= 95) |
| 1659 | yy_c = yy_meta[yy_c]; |
| 1660 | } |
| 1661 | yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; |
| 1662 | } |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1663 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1664 | return yy_current_state; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1665 | } |
| 1666 | |
| 1667 | /* yy_try_NUL_trans - try to make a transition on the NUL character |
| 1668 | * |
| 1669 | * synopsis |
| 1670 | * next_state = yy_try_NUL_trans( current_state ); |
| 1671 | */ |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1672 | static yy_state_type yy_try_NUL_trans(yy_state_type yy_current_state, yyscan_t yyscanner) |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1673 | { |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1674 | int yy_is_jam; |
| 1675 | struct yyguts_t *yyg = |
| 1676 | (struct yyguts_t *)yyscanner; /* This var may be unused depending upon options. */ |
| 1677 | char *yy_cp = yyg->yy_c_buf_p; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1678 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1679 | YY_CHAR yy_c = 1; |
| 1680 | if (yy_accept[yy_current_state]) |
| 1681 | { |
| 1682 | yyg->yy_last_accepting_state = yy_current_state; |
| 1683 | yyg->yy_last_accepting_cpos = yy_cp; |
| 1684 | } |
| 1685 | while (yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state) |
| 1686 | { |
| 1687 | yy_current_state = (int)yy_def[yy_current_state]; |
| 1688 | if (yy_current_state >= 95) |
| 1689 | yy_c = yy_meta[yy_c]; |
| 1690 | } |
| 1691 | yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; |
| 1692 | yy_is_jam = (yy_current_state == 94); |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1693 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1694 | (void)yyg; |
| 1695 | return yy_is_jam ? 0 : yy_current_state; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1696 | } |
| 1697 | |
Geoff Lang | 93561c3 | 2016-09-20 10:22:55 -0400 | [diff] [blame] | 1698 | #ifndef YY_NO_UNPUT |
| 1699 | |
| 1700 | #endif |
| 1701 | |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1702 | #ifndef YY_NO_INPUT |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1703 | # ifdef __cplusplus |
| 1704 | static int yyinput(yyscan_t yyscanner) |
| 1705 | # else |
| 1706 | static int input(yyscan_t yyscanner) |
| 1707 | # endif |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1708 | |
| 1709 | { |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1710 | int c; |
| 1711 | struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1712 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1713 | *yyg->yy_c_buf_p = yyg->yy_hold_char; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1714 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1715 | if (*yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR) |
| 1716 | { |
| 1717 | /* yy_c_buf_p now points to the character we want to return. |
| 1718 | * If this occurs *before* the EOB characters, then it's a |
| 1719 | * valid NUL; if not, then we've hit the end of the buffer. |
| 1720 | */ |
| 1721 | if (yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars]) |
| 1722 | /* This was really a NUL. */ |
| 1723 | *yyg->yy_c_buf_p = '\0'; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1724 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1725 | else |
| 1726 | { /* need more input */ |
| 1727 | int offset = (int)(yyg->yy_c_buf_p - yyg->yytext_ptr); |
| 1728 | ++yyg->yy_c_buf_p; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1729 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1730 | switch (yy_get_next_buffer(yyscanner)) |
| 1731 | { |
| 1732 | case EOB_ACT_LAST_MATCH: |
| 1733 | /* This happens because yy_g_n_b() |
| 1734 | * sees that we've accumulated a |
| 1735 | * token and flags that we need to |
| 1736 | * try matching the token before |
| 1737 | * proceeding. But for input(), |
| 1738 | * there's no matching to consider. |
| 1739 | * So convert the EOB_ACT_LAST_MATCH |
| 1740 | * to EOB_ACT_END_OF_FILE. |
| 1741 | */ |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1742 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1743 | /* Reset buffer status. */ |
| 1744 | yyrestart(yyin, yyscanner); |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1745 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1746 | /*FALLTHROUGH*/ |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1747 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1748 | case EOB_ACT_END_OF_FILE: |
| 1749 | { |
| 1750 | if (yywrap(yyscanner)) |
| 1751 | return 0; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1752 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1753 | if (!yyg->yy_did_buffer_switch_on_eof) |
| 1754 | YY_NEW_FILE; |
| 1755 | # ifdef __cplusplus |
| 1756 | return yyinput(yyscanner); |
| 1757 | # else |
| 1758 | return input(yyscanner); |
| 1759 | # endif |
| 1760 | } |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1761 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1762 | case EOB_ACT_CONTINUE_SCAN: |
| 1763 | yyg->yy_c_buf_p = yyg->yytext_ptr + offset; |
| 1764 | break; |
| 1765 | } |
| 1766 | } |
| 1767 | } |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1768 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1769 | c = *(unsigned char *)yyg->yy_c_buf_p; /* cast for 8-bit char's */ |
| 1770 | *yyg->yy_c_buf_p = '\0'; /* preserve yytext */ |
| 1771 | yyg->yy_hold_char = *++yyg->yy_c_buf_p; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1772 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1773 | return c; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1774 | } |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1775 | #endif /* ifndef YY_NO_INPUT */ |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1776 | |
| 1777 | /** Immediately switch to a different input stream. |
| 1778 | * @param input_file A readable stream. |
| 1779 | * @param yyscanner The scanner object. |
| 1780 | * @note This function does not reset the start condition to @c INITIAL . |
| 1781 | */ |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1782 | void yyrestart(FILE *input_file, yyscan_t yyscanner) |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1783 | { |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1784 | struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1785 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1786 | if (!YY_CURRENT_BUFFER) |
| 1787 | { |
| 1788 | yyensure_buffer_stack(yyscanner); |
| 1789 | YY_CURRENT_BUFFER_LVALUE = yy_create_buffer(yyin, YY_BUF_SIZE, yyscanner); |
| 1790 | } |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1791 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1792 | yy_init_buffer(YY_CURRENT_BUFFER, input_file, yyscanner); |
| 1793 | yy_load_buffer_state(yyscanner); |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1794 | } |
| 1795 | |
| 1796 | /** Switch to a different input buffer. |
| 1797 | * @param new_buffer The new input buffer. |
| 1798 | * @param yyscanner The scanner object. |
| 1799 | */ |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1800 | void yy_switch_to_buffer(YY_BUFFER_STATE new_buffer, yyscan_t yyscanner) |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1801 | { |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1802 | struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1803 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1804 | /* TODO. We should be able to replace this entire function body |
| 1805 | * with |
| 1806 | * yypop_buffer_state(); |
| 1807 | * yypush_buffer_state(new_buffer); |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1808 | */ |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1809 | yyensure_buffer_stack(yyscanner); |
| 1810 | if (YY_CURRENT_BUFFER == new_buffer) |
| 1811 | return; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1812 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1813 | if (YY_CURRENT_BUFFER) |
| 1814 | { |
| 1815 | /* Flush out information for old buffer. */ |
| 1816 | *yyg->yy_c_buf_p = yyg->yy_hold_char; |
| 1817 | YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; |
| 1818 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; |
| 1819 | } |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1820 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1821 | YY_CURRENT_BUFFER_LVALUE = new_buffer; |
| 1822 | yy_load_buffer_state(yyscanner); |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1823 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1824 | /* We don't actually know whether we did this switch during |
| 1825 | * EOF (yywrap()) processing, but the only time this flag |
| 1826 | * is looked at is after yywrap() is called, so it's safe |
| 1827 | * to go ahead and always set it. |
| 1828 | */ |
| 1829 | yyg->yy_did_buffer_switch_on_eof = 1; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1830 | } |
| 1831 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1832 | static void yy_load_buffer_state(yyscan_t yyscanner) |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1833 | { |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1834 | struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; |
| 1835 | yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; |
| 1836 | yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; |
| 1837 | yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; |
| 1838 | yyg->yy_hold_char = *yyg->yy_c_buf_p; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1839 | } |
| 1840 | |
| 1841 | /** Allocate and initialize an input buffer state. |
| 1842 | * @param file A readable stream. |
| 1843 | * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. |
| 1844 | * @param yyscanner The scanner object. |
| 1845 | * @return the allocated buffer state. |
| 1846 | */ |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1847 | YY_BUFFER_STATE yy_create_buffer(FILE *file, int size, yyscan_t yyscanner) |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1848 | { |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1849 | YY_BUFFER_STATE b; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1850 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1851 | b = (YY_BUFFER_STATE)yyalloc(sizeof(struct yy_buffer_state), yyscanner); |
| 1852 | if (!b) |
| 1853 | YY_FATAL_ERROR("out of dynamic memory in yy_create_buffer()"); |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1854 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1855 | b->yy_buf_size = size; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1856 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1857 | /* yy_ch_buf has to be 2 characters longer than the size given because |
| 1858 | * we need to put in 2 end-of-buffer characters. |
| 1859 | */ |
| 1860 | b->yy_ch_buf = (char *)yyalloc((yy_size_t)(b->yy_buf_size + 2), yyscanner); |
| 1861 | if (!b->yy_ch_buf) |
| 1862 | YY_FATAL_ERROR("out of dynamic memory in yy_create_buffer()"); |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1863 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1864 | b->yy_is_our_buffer = 1; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1865 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1866 | yy_init_buffer(b, file, yyscanner); |
| 1867 | |
| 1868 | return b; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1869 | } |
| 1870 | |
| 1871 | /** Destroy the buffer. |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 1872 | * @param b a buffer created with yy_create_buffer() |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1873 | * @param yyscanner The scanner object. |
| 1874 | */ |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1875 | void yy_delete_buffer(YY_BUFFER_STATE b, yyscan_t yyscanner) |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1876 | { |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1877 | struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1878 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1879 | if (!b) |
| 1880 | return; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1881 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1882 | if (b == YY_CURRENT_BUFFER) /* Not sure if we should pop here. */ |
| 1883 | YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE)0; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1884 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1885 | if (b->yy_is_our_buffer) |
| 1886 | yyfree((void *)b->yy_ch_buf, yyscanner); |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1887 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1888 | yyfree((void *)b, yyscanner); |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1889 | } |
| 1890 | |
| 1891 | /* Initializes or reinitializes a buffer. |
| 1892 | * This function is sometimes called more than once on the same buffer, |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 1893 | * such as during a yyrestart() or at EOF. |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1894 | */ |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1895 | static void yy_init_buffer(YY_BUFFER_STATE b, FILE *file, yyscan_t yyscanner) |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1896 | |
| 1897 | { |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1898 | int oerrno = errno; |
| 1899 | struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1900 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1901 | yy_flush_buffer(b, yyscanner); |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1902 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1903 | b->yy_input_file = file; |
| 1904 | b->yy_fill_buffer = 1; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1905 | |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 1906 | /* If b is the current buffer, then yy_init_buffer was _probably_ |
| 1907 | * called from yyrestart() or through yy_get_next_buffer. |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1908 | * In that case, we don't want to reset the lineno or column. |
| 1909 | */ |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1910 | if (b != YY_CURRENT_BUFFER) |
| 1911 | { |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1912 | b->yy_bs_lineno = 1; |
| 1913 | b->yy_bs_column = 0; |
| 1914 | } |
| 1915 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1916 | b->yy_is_interactive = 0; |
Geoff Lang | 93561c3 | 2016-09-20 10:22:55 -0400 | [diff] [blame] | 1917 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1918 | errno = oerrno; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1919 | } |
| 1920 | |
| 1921 | /** Discard all buffered characters. On the next scan, YY_INPUT will be called. |
| 1922 | * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. |
| 1923 | * @param yyscanner The scanner object. |
| 1924 | */ |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1925 | void yy_flush_buffer(YY_BUFFER_STATE b, yyscan_t yyscanner) |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1926 | { |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1927 | struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; |
| 1928 | if (!b) |
| 1929 | return; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1930 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1931 | b->yy_n_chars = 0; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1932 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1933 | /* We always need two end-of-buffer characters. The first causes |
| 1934 | * a transition to the end-of-buffer state. The second causes |
| 1935 | * a jam in that state. |
| 1936 | */ |
| 1937 | b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; |
| 1938 | b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1939 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1940 | b->yy_buf_pos = &b->yy_ch_buf[0]; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1941 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1942 | b->yy_at_bol = 1; |
| 1943 | b->yy_buffer_status = YY_BUFFER_NEW; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1944 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1945 | if (b == YY_CURRENT_BUFFER) |
| 1946 | yy_load_buffer_state(yyscanner); |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1947 | } |
| 1948 | |
| 1949 | /** Pushes the new state onto the stack. The new state becomes |
| 1950 | * the current state. This function will allocate the stack |
| 1951 | * if necessary. |
| 1952 | * @param new_buffer The new state. |
| 1953 | * @param yyscanner The scanner object. |
| 1954 | */ |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1955 | void yypush_buffer_state(YY_BUFFER_STATE new_buffer, yyscan_t yyscanner) |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1956 | { |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1957 | struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; |
| 1958 | if (new_buffer == NULL) |
| 1959 | return; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1960 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1961 | yyensure_buffer_stack(yyscanner); |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1962 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1963 | /* This block is copied from yy_switch_to_buffer. */ |
| 1964 | if (YY_CURRENT_BUFFER) |
| 1965 | { |
| 1966 | /* Flush out information for old buffer. */ |
| 1967 | *yyg->yy_c_buf_p = yyg->yy_hold_char; |
| 1968 | YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; |
| 1969 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; |
| 1970 | } |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1971 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1972 | /* Only push if top exists. Otherwise, replace top. */ |
| 1973 | if (YY_CURRENT_BUFFER) |
| 1974 | yyg->yy_buffer_stack_top++; |
| 1975 | YY_CURRENT_BUFFER_LVALUE = new_buffer; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1976 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1977 | /* copied from yy_switch_to_buffer. */ |
| 1978 | yy_load_buffer_state(yyscanner); |
| 1979 | yyg->yy_did_buffer_switch_on_eof = 1; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1980 | } |
| 1981 | |
| 1982 | /** Removes and deletes the top of the stack, if present. |
| 1983 | * The next element becomes the new top. |
| 1984 | * @param yyscanner The scanner object. |
| 1985 | */ |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1986 | void yypop_buffer_state(yyscan_t yyscanner) |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1987 | { |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1988 | struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; |
| 1989 | if (!YY_CURRENT_BUFFER) |
| 1990 | return; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1991 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1992 | yy_delete_buffer(YY_CURRENT_BUFFER, yyscanner); |
| 1993 | YY_CURRENT_BUFFER_LVALUE = NULL; |
| 1994 | if (yyg->yy_buffer_stack_top > 0) |
| 1995 | --yyg->yy_buffer_stack_top; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 1996 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 1997 | if (YY_CURRENT_BUFFER) |
| 1998 | { |
| 1999 | yy_load_buffer_state(yyscanner); |
| 2000 | yyg->yy_did_buffer_switch_on_eof = 1; |
| 2001 | } |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2002 | } |
| 2003 | |
| 2004 | /* Allocates the stack if it does not exist. |
| 2005 | * Guarantees space for at least one push. |
| 2006 | */ |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2007 | static void yyensure_buffer_stack(yyscan_t yyscanner) |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2008 | { |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2009 | yy_size_t num_to_alloc; |
| 2010 | struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2011 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2012 | if (!yyg->yy_buffer_stack) |
| 2013 | { |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2014 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2015 | /* First allocation is just for 2 elements, since we don't know if this |
| 2016 | * scanner will even need a stack. We use 2 instead of 1 to avoid an |
| 2017 | * immediate realloc on the next call. |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2018 | */ |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2019 | num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */ |
| 2020 | yyg->yy_buffer_stack = (struct yy_buffer_state **)yyalloc( |
| 2021 | num_to_alloc * sizeof(struct yy_buffer_state *), yyscanner); |
| 2022 | if (!yyg->yy_buffer_stack) |
| 2023 | YY_FATAL_ERROR("out of dynamic memory in yyensure_buffer_stack()"); |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 2024 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2025 | memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state *)); |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 2026 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2027 | yyg->yy_buffer_stack_max = num_to_alloc; |
| 2028 | yyg->yy_buffer_stack_top = 0; |
| 2029 | return; |
| 2030 | } |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 2031 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2032 | if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1) |
| 2033 | { |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2034 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2035 | /* Increase the buffer to prepare for a possible push. */ |
| 2036 | yy_size_t grow_size = 8 /* arbitrary grow size */; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2037 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2038 | num_to_alloc = yyg->yy_buffer_stack_max + grow_size; |
| 2039 | yyg->yy_buffer_stack = (struct yy_buffer_state **)yyrealloc( |
| 2040 | yyg->yy_buffer_stack, num_to_alloc * sizeof(struct yy_buffer_state *), yyscanner); |
| 2041 | if (!yyg->yy_buffer_stack) |
| 2042 | YY_FATAL_ERROR("out of dynamic memory in yyensure_buffer_stack()"); |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2043 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2044 | /* zero only the new slots.*/ |
| 2045 | memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, |
| 2046 | grow_size * sizeof(struct yy_buffer_state *)); |
| 2047 | yyg->yy_buffer_stack_max = num_to_alloc; |
| 2048 | } |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2049 | } |
| 2050 | |
| 2051 | /** Setup the input buffer state to scan directly from a user-specified character buffer. |
| 2052 | * @param base the character buffer |
| 2053 | * @param size the size in bytes of the character buffer |
| 2054 | * @param yyscanner The scanner object. |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 2055 | * @return the newly allocated buffer state object. |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2056 | */ |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2057 | YY_BUFFER_STATE yy_scan_buffer(char *base, yy_size_t size, yyscan_t yyscanner) |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2058 | { |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2059 | YY_BUFFER_STATE b; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2060 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2061 | if (size < 2 || base[size - 2] != YY_END_OF_BUFFER_CHAR || |
| 2062 | base[size - 1] != YY_END_OF_BUFFER_CHAR) |
| 2063 | /* They forgot to leave room for the EOB's. */ |
| 2064 | return NULL; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2065 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2066 | b = (YY_BUFFER_STATE)yyalloc(sizeof(struct yy_buffer_state), yyscanner); |
| 2067 | if (!b) |
| 2068 | YY_FATAL_ERROR("out of dynamic memory in yy_scan_buffer()"); |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2069 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2070 | b->yy_buf_size = (int)(size - 2); /* "- 2" to take care of EOB's */ |
| 2071 | b->yy_buf_pos = b->yy_ch_buf = base; |
| 2072 | b->yy_is_our_buffer = 0; |
| 2073 | b->yy_input_file = NULL; |
| 2074 | b->yy_n_chars = b->yy_buf_size; |
| 2075 | b->yy_is_interactive = 0; |
| 2076 | b->yy_at_bol = 1; |
| 2077 | b->yy_fill_buffer = 0; |
| 2078 | b->yy_buffer_status = YY_BUFFER_NEW; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2079 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2080 | yy_switch_to_buffer(b, yyscanner); |
| 2081 | |
| 2082 | return b; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2083 | } |
| 2084 | |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 2085 | /** Setup the input buffer state to scan a string. The next call to yylex() will |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2086 | * scan from a @e copy of @a str. |
| 2087 | * @param yystr a NUL-terminated string to scan |
| 2088 | * @param yyscanner The scanner object. |
| 2089 | * @return the newly allocated buffer state object. |
| 2090 | * @note If you want to scan bytes that may contain NUL values, then use |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 2091 | * yy_scan_bytes() instead. |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2092 | */ |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2093 | YY_BUFFER_STATE yy_scan_string(const char *yystr, yyscan_t yyscanner) |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2094 | { |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2095 | |
| 2096 | return yy_scan_bytes(yystr, (int)strlen(yystr), yyscanner); |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2097 | } |
| 2098 | |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 2099 | /** Setup the input buffer state to scan the given bytes. The next call to yylex() will |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2100 | * scan from a @e copy of @a bytes. |
Zhenyao Mo | f1d723c | 2013-09-23 14:57:07 -0400 | [diff] [blame] | 2101 | * @param yybytes the byte buffer to scan |
| 2102 | * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2103 | * @param yyscanner The scanner object. |
| 2104 | * @return the newly allocated buffer state object. |
| 2105 | */ |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2106 | YY_BUFFER_STATE yy_scan_bytes(const char *yybytes, int _yybytes_len, yyscan_t yyscanner) |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2107 | { |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2108 | YY_BUFFER_STATE b; |
| 2109 | char *buf; |
| 2110 | yy_size_t n; |
| 2111 | int i; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2112 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2113 | /* Get memory for full buffer, including space for trailing EOB's. */ |
| 2114 | n = (yy_size_t)(_yybytes_len + 2); |
| 2115 | buf = (char *)yyalloc(n, yyscanner); |
| 2116 | if (!buf) |
| 2117 | YY_FATAL_ERROR("out of dynamic memory in yy_scan_bytes()"); |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2118 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2119 | for (i = 0; i < _yybytes_len; ++i) |
| 2120 | buf[i] = yybytes[i]; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2121 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2122 | buf[_yybytes_len] = buf[_yybytes_len + 1] = YY_END_OF_BUFFER_CHAR; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2123 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2124 | b = yy_scan_buffer(buf, n, yyscanner); |
| 2125 | if (!b) |
| 2126 | YY_FATAL_ERROR("bad buffer in yy_scan_bytes()"); |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2127 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2128 | /* It's okay to grow etc. this buffer, and we should throw it |
| 2129 | * away when we're done. |
| 2130 | */ |
| 2131 | b->yy_is_our_buffer = 1; |
| 2132 | |
| 2133 | return b; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2134 | } |
| 2135 | |
| 2136 | #ifndef YY_EXIT_FAILURE |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2137 | # define YY_EXIT_FAILURE 2 |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2138 | #endif |
| 2139 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2140 | static void yynoreturn yy_fatal_error(const char *msg, yyscan_t yyscanner) |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2141 | { |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2142 | struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; |
| 2143 | (void)yyg; |
| 2144 | fprintf(stderr, "%s\n", msg); |
| 2145 | exit(YY_EXIT_FAILURE); |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2146 | } |
| 2147 | |
| 2148 | /* Redefine yyless() so it works in section 3 code. */ |
| 2149 | |
| 2150 | #undef yyless |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2151 | #define yyless(n) \ |
| 2152 | do \ |
| 2153 | { \ |
| 2154 | /* Undo effects of setting up yytext. */ \ |
| 2155 | int yyless_macro_arg = (n); \ |
| 2156 | YY_LESS_LINENO(yyless_macro_arg); \ |
| 2157 | yytext[yyleng] = yyg->yy_hold_char; \ |
| 2158 | yyg->yy_c_buf_p = yytext + yyless_macro_arg; \ |
| 2159 | yyg->yy_hold_char = *yyg->yy_c_buf_p; \ |
| 2160 | *yyg->yy_c_buf_p = '\0'; \ |
| 2161 | yyleng = yyless_macro_arg; \ |
| 2162 | } while (0) |
Geoff Lang | 93561c3 | 2016-09-20 10:22:55 -0400 | [diff] [blame] | 2163 | |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2164 | /* Accessor methods (get/set functions) to struct members. */ |
| 2165 | |
| 2166 | /** Get the user-defined data for this scanner. |
| 2167 | * @param yyscanner The scanner object. |
| 2168 | */ |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2169 | YY_EXTRA_TYPE yyget_extra(yyscan_t yyscanner) |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2170 | { |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2171 | struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2172 | return yyextra; |
| 2173 | } |
| 2174 | |
| 2175 | /** Get the current line number. |
| 2176 | * @param yyscanner The scanner object. |
| 2177 | */ |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2178 | int yyget_lineno(yyscan_t yyscanner) |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2179 | { |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2180 | struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 2181 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2182 | if (!YY_CURRENT_BUFFER) |
| 2183 | return 0; |
| 2184 | |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2185 | return yylineno; |
| 2186 | } |
| 2187 | |
| 2188 | /** Get the current column number. |
| 2189 | * @param yyscanner The scanner object. |
| 2190 | */ |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2191 | int yyget_column(yyscan_t yyscanner) |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2192 | { |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2193 | struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 2194 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2195 | if (!YY_CURRENT_BUFFER) |
| 2196 | return 0; |
| 2197 | |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2198 | return yycolumn; |
| 2199 | } |
| 2200 | |
| 2201 | /** Get the input stream. |
| 2202 | * @param yyscanner The scanner object. |
| 2203 | */ |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2204 | FILE *yyget_in(yyscan_t yyscanner) |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2205 | { |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2206 | struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2207 | return yyin; |
| 2208 | } |
| 2209 | |
| 2210 | /** Get the output stream. |
| 2211 | * @param yyscanner The scanner object. |
| 2212 | */ |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2213 | FILE *yyget_out(yyscan_t yyscanner) |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2214 | { |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2215 | struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2216 | return yyout; |
| 2217 | } |
| 2218 | |
| 2219 | /** Get the length of the current token. |
| 2220 | * @param yyscanner The scanner object. |
| 2221 | */ |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2222 | int yyget_leng(yyscan_t yyscanner) |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2223 | { |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2224 | struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2225 | return yyleng; |
| 2226 | } |
| 2227 | |
| 2228 | /** Get the current token. |
| 2229 | * @param yyscanner The scanner object. |
| 2230 | */ |
| 2231 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2232 | char *yyget_text(yyscan_t yyscanner) |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2233 | { |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2234 | struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2235 | return yytext; |
| 2236 | } |
| 2237 | |
| 2238 | /** Set the user-defined data. This data is never touched by the scanner. |
| 2239 | * @param user_defined The data to be associated with this scanner. |
| 2240 | * @param yyscanner The scanner object. |
| 2241 | */ |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2242 | void yyset_extra(YY_EXTRA_TYPE user_defined, yyscan_t yyscanner) |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2243 | { |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2244 | struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; |
| 2245 | yyextra = user_defined; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2246 | } |
| 2247 | |
| 2248 | /** Set the current line number. |
Geoff Lang | 93561c3 | 2016-09-20 10:22:55 -0400 | [diff] [blame] | 2249 | * @param _line_number line number |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2250 | * @param yyscanner The scanner object. |
| 2251 | */ |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2252 | void yyset_lineno(int _line_number, yyscan_t yyscanner) |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2253 | { |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2254 | struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2255 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2256 | /* lineno is only valid if an input buffer exists. */ |
| 2257 | if (!YY_CURRENT_BUFFER) |
| 2258 | YY_FATAL_ERROR("yyset_lineno called with no buffer"); |
| 2259 | |
Geoff Lang | 93561c3 | 2016-09-20 10:22:55 -0400 | [diff] [blame] | 2260 | yylineno = _line_number; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2261 | } |
| 2262 | |
| 2263 | /** Set the current column. |
Geoff Lang | 93561c3 | 2016-09-20 10:22:55 -0400 | [diff] [blame] | 2264 | * @param _column_no column number |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2265 | * @param yyscanner The scanner object. |
| 2266 | */ |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2267 | void yyset_column(int _column_no, yyscan_t yyscanner) |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2268 | { |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2269 | struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2270 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2271 | /* column is only valid if an input buffer exists. */ |
| 2272 | if (!YY_CURRENT_BUFFER) |
| 2273 | YY_FATAL_ERROR("yyset_column called with no buffer"); |
| 2274 | |
Geoff Lang | 93561c3 | 2016-09-20 10:22:55 -0400 | [diff] [blame] | 2275 | yycolumn = _column_no; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2276 | } |
| 2277 | |
| 2278 | /** Set the input stream. This does not discard the current |
| 2279 | * input buffer. |
Geoff Lang | 93561c3 | 2016-09-20 10:22:55 -0400 | [diff] [blame] | 2280 | * @param _in_str A readable stream. |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2281 | * @param yyscanner The scanner object. |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 2282 | * @see yy_switch_to_buffer |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2283 | */ |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2284 | void yyset_in(FILE *_in_str, yyscan_t yyscanner) |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2285 | { |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2286 | struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; |
| 2287 | yyin = _in_str; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2288 | } |
| 2289 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2290 | void yyset_out(FILE *_out_str, yyscan_t yyscanner) |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2291 | { |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2292 | struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; |
| 2293 | yyout = _out_str; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2294 | } |
| 2295 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2296 | int yyget_debug(yyscan_t yyscanner) |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2297 | { |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2298 | struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2299 | return yy_flex_debug; |
| 2300 | } |
| 2301 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2302 | void yyset_debug(int _bdebug, yyscan_t yyscanner) |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2303 | { |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2304 | struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; |
| 2305 | yy_flex_debug = _bdebug; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2306 | } |
| 2307 | |
| 2308 | /* Accessor methods for yylval and yylloc */ |
| 2309 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2310 | YYSTYPE *yyget_lval(yyscan_t yyscanner) |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2311 | { |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2312 | struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2313 | return yylval; |
| 2314 | } |
| 2315 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2316 | void yyset_lval(YYSTYPE *yylval_param, yyscan_t yyscanner) |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2317 | { |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2318 | struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; |
| 2319 | yylval = yylval_param; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2320 | } |
| 2321 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2322 | YYLTYPE *yyget_lloc(yyscan_t yyscanner) |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2323 | { |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2324 | struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2325 | return yylloc; |
| 2326 | } |
Geoff Lang | 93561c3 | 2016-09-20 10:22:55 -0400 | [diff] [blame] | 2327 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2328 | void yyset_lloc(YYLTYPE *yylloc_param, yyscan_t yyscanner) |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2329 | { |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2330 | struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; |
| 2331 | yylloc = yylloc_param; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2332 | } |
Geoff Lang | 93561c3 | 2016-09-20 10:22:55 -0400 | [diff] [blame] | 2333 | |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2334 | /* User-visible API */ |
| 2335 | |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 2336 | /* yylex_init is special because it creates the scanner itself, so it is |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2337 | * the ONLY reentrant function that doesn't take the scanner as the last argument. |
| 2338 | * That's why we explicitly handle the declaration, instead of using our macros. |
| 2339 | */ |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2340 | int yylex_init(yyscan_t *ptr_yy_globals) |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2341 | { |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2342 | if (ptr_yy_globals == NULL) |
| 2343 | { |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2344 | errno = EINVAL; |
| 2345 | return 1; |
| 2346 | } |
| 2347 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2348 | *ptr_yy_globals = (yyscan_t)yyalloc(sizeof(struct yyguts_t), NULL); |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2349 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2350 | if (*ptr_yy_globals == NULL) |
| 2351 | { |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2352 | errno = ENOMEM; |
| 2353 | return 1; |
| 2354 | } |
| 2355 | |
| 2356 | /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */ |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2357 | memset(*ptr_yy_globals, 0x00, sizeof(struct yyguts_t)); |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2358 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2359 | return yy_init_globals(*ptr_yy_globals); |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2360 | } |
| 2361 | |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 2362 | /* yylex_init_extra has the same functionality as yylex_init, but follows the |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2363 | * convention of taking the scanner as the last argument. Note however, that |
| 2364 | * this is a *pointer* to a scanner, as it will be allocated by this call (and |
| 2365 | * is the reason, too, why this function also must handle its own declaration). |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 2366 | * The user defined value in the first argument will be available to yyalloc in |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2367 | * the yyextra field. |
| 2368 | */ |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2369 | int yylex_init_extra(YY_EXTRA_TYPE yy_user_defined, yyscan_t *ptr_yy_globals) |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2370 | { |
| 2371 | struct yyguts_t dummy_yyguts; |
| 2372 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2373 | yyset_extra(yy_user_defined, &dummy_yyguts); |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2374 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2375 | if (ptr_yy_globals == NULL) |
| 2376 | { |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2377 | errno = EINVAL; |
| 2378 | return 1; |
| 2379 | } |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 2380 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2381 | *ptr_yy_globals = (yyscan_t)yyalloc(sizeof(struct yyguts_t), &dummy_yyguts); |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 2382 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2383 | if (*ptr_yy_globals == NULL) |
| 2384 | { |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2385 | errno = ENOMEM; |
| 2386 | return 1; |
| 2387 | } |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 2388 | |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2389 | /* By setting to 0xAA, we expose bugs in |
| 2390 | yy_init_globals. Leave at 0x00 for releases. */ |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2391 | memset(*ptr_yy_globals, 0x00, sizeof(struct yyguts_t)); |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 2392 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2393 | yyset_extra(yy_user_defined, *ptr_yy_globals); |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 2394 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2395 | return yy_init_globals(*ptr_yy_globals); |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2396 | } |
| 2397 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2398 | static int yy_init_globals(yyscan_t yyscanner) |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2399 | { |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2400 | struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2401 | /* Initialization is the same as for the non-reentrant scanner. |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 2402 | * This function is called from yylex_destroy(), so don't allocate here. |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2403 | */ |
| 2404 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2405 | yyg->yy_buffer_stack = NULL; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2406 | yyg->yy_buffer_stack_top = 0; |
| 2407 | yyg->yy_buffer_stack_max = 0; |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2408 | yyg->yy_c_buf_p = NULL; |
| 2409 | yyg->yy_init = 0; |
| 2410 | yyg->yy_start = 0; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2411 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2412 | yyg->yy_start_stack_ptr = 0; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2413 | yyg->yy_start_stack_depth = 0; |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2414 | yyg->yy_start_stack = NULL; |
Geoff Lang | 93561c3 | 2016-09-20 10:22:55 -0400 | [diff] [blame] | 2415 | |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2416 | /* Defined in main.c */ |
| 2417 | #ifdef YY_STDINIT |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2418 | yyin = stdin; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2419 | yyout = stdout; |
| 2420 | #else |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2421 | yyin = NULL; |
Luc Ferron | e49f1e9 | 2018-01-24 14:47:55 -0500 | [diff] [blame] | 2422 | yyout = NULL; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2423 | #endif |
| 2424 | |
| 2425 | /* For future reference: Set errno on error, since we are called by |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 2426 | * yylex_init() |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2427 | */ |
| 2428 | return 0; |
| 2429 | } |
| 2430 | |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 2431 | /* yylex_destroy is for both reentrant and non-reentrant scanners. */ |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2432 | int yylex_destroy(yyscan_t yyscanner) |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2433 | { |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2434 | struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2435 | |
| 2436 | /* Pop the buffer stack, destroying each element. */ |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2437 | while (YY_CURRENT_BUFFER) |
| 2438 | { |
| 2439 | yy_delete_buffer(YY_CURRENT_BUFFER, yyscanner); |
| 2440 | YY_CURRENT_BUFFER_LVALUE = NULL; |
| 2441 | yypop_buffer_state(yyscanner); |
| 2442 | } |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2443 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2444 | /* Destroy the stack itself. */ |
| 2445 | yyfree(yyg->yy_buffer_stack, yyscanner); |
| 2446 | yyg->yy_buffer_stack = NULL; |
Luc Ferron | e49f1e9 | 2018-01-24 14:47:55 -0500 | [diff] [blame] | 2447 | |
| 2448 | /* Destroy the start condition stack. */ |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2449 | yyfree(yyg->yy_start_stack, yyscanner); |
| 2450 | yyg->yy_start_stack = NULL; |
Luc Ferron | e49f1e9 | 2018-01-24 14:47:55 -0500 | [diff] [blame] | 2451 | |
| 2452 | /* Reset the globals. This is important in a non-reentrant scanner so the next time |
| 2453 | * yylex() is called, initialization will occur. */ |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2454 | yy_init_globals(yyscanner); |
Luc Ferron | e49f1e9 | 2018-01-24 14:47:55 -0500 | [diff] [blame] | 2455 | |
| 2456 | /* Destroy the main struct (reentrant only). */ |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2457 | yyfree(yyscanner, yyscanner); |
Luc Ferron | e49f1e9 | 2018-01-24 14:47:55 -0500 | [diff] [blame] | 2458 | yyscanner = NULL; |
| 2459 | return 0; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2460 | } |
| 2461 | |
| 2462 | /* |
| 2463 | * Internal utility routines. |
| 2464 | */ |
| 2465 | |
| 2466 | #ifndef yytext_ptr |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2467 | static void yy_flex_strncpy(char *s1, const char *s2, int n, yyscan_t yyscanner) |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2468 | { |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2469 | struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; |
| 2470 | (void)yyg; |
Geoff Lang | 93561c3 | 2016-09-20 10:22:55 -0400 | [diff] [blame] | 2471 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2472 | int i; |
| 2473 | for (i = 0; i < n; ++i) |
| 2474 | s1[i] = s2[i]; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2475 | } |
| 2476 | #endif |
| 2477 | |
| 2478 | #ifdef YY_NEED_STRLEN |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2479 | static int yy_flex_strlen(const char *s, yyscan_t yyscanner) |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2480 | { |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2481 | int n; |
| 2482 | for (n = 0; s[n]; ++n) |
| 2483 | ; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2484 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2485 | return n; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2486 | } |
| 2487 | #endif |
| 2488 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2489 | void *yyalloc(yy_size_t size, yyscan_t yyscanner) |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2490 | { |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2491 | struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; |
| 2492 | (void)yyg; |
| 2493 | return malloc(size); |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2494 | } |
| 2495 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2496 | void *yyrealloc(void *ptr, yy_size_t size, yyscan_t yyscanner) |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2497 | { |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2498 | struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; |
| 2499 | (void)yyg; |
Geoff Lang | 93561c3 | 2016-09-20 10:22:55 -0400 | [diff] [blame] | 2500 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2501 | /* The cast to (char *) in the following accommodates both |
| 2502 | * implementations that use char* generic pointers, and those |
| 2503 | * that use void* generic pointers. It works with the latter |
| 2504 | * because both ANSI C and C++ allow castless assignment from |
| 2505 | * any pointer type to void*, and deal with argument conversions |
| 2506 | * as though doing an assignment. |
| 2507 | */ |
| 2508 | return realloc(ptr, size); |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2509 | } |
| 2510 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2511 | void yyfree(void *ptr, yyscan_t yyscanner) |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2512 | { |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2513 | struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; |
| 2514 | (void)yyg; |
| 2515 | free((char *)ptr); /* see yyrealloc() for (char *) cast */ |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2516 | } |
| 2517 | |
| 2518 | #define YYTABLES_NAME "yytables" |
| 2519 | |
Geoff Lang | 197d529 | 2018-04-25 14:29:00 -0400 | [diff] [blame] | 2520 | namespace angle |
| 2521 | { |
Geoff Lang | 93561c3 | 2016-09-20 10:22:55 -0400 | [diff] [blame] | 2522 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2523 | namespace pp |
| 2524 | { |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2525 | |
Corentin Wallez | 054f7ed | 2016-09-20 17:15:59 -0400 | [diff] [blame] | 2526 | Tokenizer::Tokenizer(Diagnostics *diagnostics) : mHandle(nullptr), mMaxTokenSize(256) |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2527 | { |
alokp@chromium.org | 2c958ee | 2012-05-17 20:35:42 +0000 | [diff] [blame] | 2528 | mContext.diagnostics = diagnostics; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2529 | } |
| 2530 | |
| 2531 | Tokenizer::~Tokenizer() |
| 2532 | { |
| 2533 | destroyScanner(); |
| 2534 | } |
| 2535 | |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2536 | bool Tokenizer::init(size_t count, const char *const string[], const int length[]) |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2537 | { |
Zhenyao Mo | d526f98 | 2014-05-13 14:51:19 -0700 | [diff] [blame] | 2538 | if ((count > 0) && (string == 0)) |
| 2539 | return false; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2540 | |
| 2541 | mContext.input = Input(count, string, length); |
| 2542 | return initScanner(); |
| 2543 | } |
| 2544 | |
alokp@chromium.org | 46aa13d | 2012-06-15 15:40:27 +0000 | [diff] [blame] | 2545 | void Tokenizer::setFileNumber(int file) |
| 2546 | { |
| 2547 | // We use column number as file number. |
| 2548 | // See macro yyfileno. |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 2549 | yyset_column(file, mHandle); |
alokp@chromium.org | 46aa13d | 2012-06-15 15:40:27 +0000 | [diff] [blame] | 2550 | } |
| 2551 | |
| 2552 | void Tokenizer::setLineNumber(int line) |
| 2553 | { |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 2554 | yyset_lineno(line, mHandle); |
alokp@chromium.org | 46aa13d | 2012-06-15 15:40:27 +0000 | [diff] [blame] | 2555 | } |
| 2556 | |
Jamie Madill | 5508f39 | 2014-02-20 13:31:36 -0500 | [diff] [blame] | 2557 | void Tokenizer::setMaxTokenSize(size_t maxTokenSize) |
| 2558 | { |
| 2559 | mMaxTokenSize = maxTokenSize; |
| 2560 | } |
| 2561 | |
Zhenyao Mo | d526f98 | 2014-05-13 14:51:19 -0700 | [diff] [blame] | 2562 | void Tokenizer::lex(Token *token) |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2563 | { |
Corentin Wallez | dc0fa46 | 2017-02-01 14:44:43 -0500 | [diff] [blame] | 2564 | int tokenType = yylex(&token->text, &token->location, mHandle); |
| 2565 | |
| 2566 | if (tokenType == Token::GOT_ERROR) |
| 2567 | { |
| 2568 | mContext.diagnostics->report(Diagnostics::PP_TOKENIZER_ERROR, token->location, token->text); |
| 2569 | token->type = Token::LAST; |
| 2570 | } |
| 2571 | else |
| 2572 | { |
| 2573 | token->type = tokenType; |
| 2574 | } |
| 2575 | |
Jamie Madill | 5508f39 | 2014-02-20 13:31:36 -0500 | [diff] [blame] | 2576 | if (token->text.size() > mMaxTokenSize) |
alokp@chromium.org | c022c3a | 2012-07-09 15:56:42 +0000 | [diff] [blame] | 2577 | { |
Jamie Madill | b980c56 | 2018-11-27 11:34:27 -0500 | [diff] [blame] | 2578 | mContext.diagnostics->report(Diagnostics::PP_TOKEN_TOO_LONG, token->location, token->text); |
Jamie Madill | 5508f39 | 2014-02-20 13:31:36 -0500 | [diff] [blame] | 2579 | token->text.erase(mMaxTokenSize); |
alokp@chromium.org | c022c3a | 2012-07-09 15:56:42 +0000 | [diff] [blame] | 2580 | } |
| 2581 | |
alokp@chromium.org | 7fc38dd | 2012-06-14 18:23:23 +0000 | [diff] [blame] | 2582 | token->flags = 0; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2583 | |
alokp@chromium.org | 19d7aa6 | 2012-05-31 17:34:05 +0000 | [diff] [blame] | 2584 | token->setAtStartOfLine(mContext.lineStart); |
| 2585 | mContext.lineStart = token->type == '\n'; |
| 2586 | |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2587 | token->setHasLeadingSpace(mContext.leadingSpace); |
| 2588 | mContext.leadingSpace = false; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2589 | } |
| 2590 | |
| 2591 | bool Tokenizer::initScanner() |
| 2592 | { |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 2593 | if ((mHandle == nullptr) && yylex_init_extra(&mContext, &mHandle)) |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2594 | return false; |
| 2595 | |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 2596 | yyrestart(0, mHandle); |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2597 | return true; |
| 2598 | } |
| 2599 | |
| 2600 | void Tokenizer::destroyScanner() |
| 2601 | { |
Corentin Wallez | 054f7ed | 2016-09-20 17:15:59 -0400 | [diff] [blame] | 2602 | if (mHandle == nullptr) |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2603 | return; |
| 2604 | |
Corentin Wallez | 168d5e8 | 2017-02-01 12:18:56 -0800 | [diff] [blame] | 2605 | yylex_destroy(mHandle); |
Corentin Wallez | 054f7ed | 2016-09-20 17:15:59 -0400 | [diff] [blame] | 2606 | mHandle = nullptr; |
alokp@chromium.org | 04d7d22 | 2012-05-16 19:24:07 +0000 | [diff] [blame] | 2607 | } |
| 2608 | |
| 2609 | } // namespace pp |
| 2610 | |
Geoff Lang | 197d529 | 2018-04-25 14:29:00 -0400 | [diff] [blame] | 2611 | } // namespace angle |