ffi_parser.c 98 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594
  1. /*
  2. +----------------------------------------------------------------------+
  3. | Copyright (c) The PHP Group |
  4. +----------------------------------------------------------------------+
  5. | This source file is subject to version 3.01 of the PHP license, |
  6. | that is bundled with this package in the file LICENSE, and is |
  7. | available through the world-wide-web at the following url: |
  8. | https://www.php.net/license/3_01.txt |
  9. | If you did not receive a copy of the PHP license and are unable to |
  10. | obtain it through the world-wide-web, please send a note to |
  11. | license@php.net so we can mail you a copy immediately. |
  12. +----------------------------------------------------------------------+
  13. | Author: Dmitry Stogov <dmitry@zend.com> |
  14. +----------------------------------------------------------------------+
  15. */
  16. #ifdef HAVE_CONFIG_H
  17. # include "config.h"
  18. #endif
  19. #include "php.h"
  20. #include "php_ffi.h"
  21. #include <stdio.h>
  22. #include <stdlib.h>
  23. #include <string.h>
  24. #define yy_buf FFI_G(buf)
  25. #define yy_end FFI_G(end)
  26. #define yy_pos FFI_G(pos)
  27. #define yy_text FFI_G(text)
  28. #define yy_line FFI_G(line)
  29. /* forward declarations */
  30. static void yy_error(const char *msg);
  31. static void yy_error_sym(const char *msg, int sym);
  32. #define YYPOS cpos
  33. #define YYEND cend
  34. #define YY_EOF 0
  35. #define YY___EXTENSION__ 1
  36. #define YY___ASM__ 2
  37. #define YY__LPAREN 3
  38. #define YY__RPAREN 4
  39. #define YY__COMMA 5
  40. #define YY__SEMICOLON 6
  41. #define YY_TYPEDEF 7
  42. #define YY_EXTERN 8
  43. #define YY_STATIC 9
  44. #define YY_AUTO 10
  45. #define YY_REGISTER 11
  46. #define YY_INLINE 12
  47. #define YY___INLINE 13
  48. #define YY___INLINE__ 14
  49. #define YY__NORETURN 15
  50. #define YY__ALIGNAS 16
  51. #define YY_CONST 17
  52. #define YY___CONST 18
  53. #define YY___CONST__ 19
  54. #define YY_RESTRICT 20
  55. #define YY___RESTRICT 21
  56. #define YY___RESTRICT__ 22
  57. #define YY_VOLATILE 23
  58. #define YY___VOLATILE 24
  59. #define YY___VOLATILE__ 25
  60. #define YY__ATOMIC 26
  61. #define YY_VOID 27
  62. #define YY_CHAR 28
  63. #define YY_SHORT 29
  64. #define YY_INT 30
  65. #define YY_LONG 31
  66. #define YY_FLOAT 32
  67. #define YY_DOUBLE 33
  68. #define YY_SIGNED 34
  69. #define YY_UNSIGNED 35
  70. #define YY__BOOL 36
  71. #define YY__COMPLEX 37
  72. #define YY_COMPLEX 38
  73. #define YY___COMPLEX 39
  74. #define YY___COMPLEX__ 40
  75. #define YY_STRUCT 41
  76. #define YY_UNION 42
  77. #define YY__LBRACE 43
  78. #define YY__RBRACE 44
  79. #define YY__COLON 45
  80. #define YY_ENUM 46
  81. #define YY__EQUAL 47
  82. #define YY__STAR 48
  83. #define YY__LBRACK 49
  84. #define YY__RBRACK 50
  85. #define YY__POINT_POINT_POINT 51
  86. #define YY___ATTRIBUTE 52
  87. #define YY___ATTRIBUTE__ 53
  88. #define YY___DECLSPEC 54
  89. #define YY___CDECL 55
  90. #define YY___STDCALL 56
  91. #define YY___FASTCALL 57
  92. #define YY___THISCALL 58
  93. #define YY___VECTORCALL 59
  94. #define YY__POINT 60
  95. #define YY__QUERY 61
  96. #define YY__BAR_BAR 62
  97. #define YY__AND_AND 63
  98. #define YY__BAR 64
  99. #define YY__UPARROW 65
  100. #define YY__AND 66
  101. #define YY__EQUAL_EQUAL 67
  102. #define YY__BANG_EQUAL 68
  103. #define YY__LESS 69
  104. #define YY__GREATER 70
  105. #define YY__LESS_EQUAL 71
  106. #define YY__GREATER_EQUAL 72
  107. #define YY__LESS_LESS 73
  108. #define YY__GREATER_GREATER 74
  109. #define YY__PLUS 75
  110. #define YY__MINUS 76
  111. #define YY__SLASH 77
  112. #define YY__PERCENT 78
  113. #define YY__MINUS_GREATER 79
  114. #define YY__PLUS_PLUS 80
  115. #define YY__MINUS_MINUS 81
  116. #define YY__TILDE 82
  117. #define YY__BANG 83
  118. #define YY_SIZEOF 84
  119. #define YY__ALIGNOF 85
  120. #define YY___ALIGNOF 86
  121. #define YY___ALIGNOF__ 87
  122. #define YY___RESTICT 88
  123. #define YY_ID 89
  124. #define YY_OCTNUMBER 90
  125. #define YY_DECNUMBER 91
  126. #define YY_HEXNUMBER 92
  127. #define YY_FLOATNUMBER 93
  128. #define YY_STRING 94
  129. #define YY_CHARACTER 95
  130. #define YY_EOL 96
  131. #define YY_WS 97
  132. #define YY_ONE_LINE_COMMENT 98
  133. #define YY_COMMENT 99
  134. static const char * sym_name[] = {
  135. "<EOF>",
  136. "__extension__",
  137. "__asm__",
  138. "(",
  139. ")",
  140. ",",
  141. ";",
  142. "typedef",
  143. "extern",
  144. "static",
  145. "auto",
  146. "register",
  147. "inline",
  148. "__inline",
  149. "__inline__",
  150. "_Noreturn",
  151. "_Alignas",
  152. "const",
  153. "__const",
  154. "__const__",
  155. "restrict",
  156. "__restrict",
  157. "__restrict__",
  158. "volatile",
  159. "__volatile",
  160. "__volatile__",
  161. "_Atomic",
  162. "void",
  163. "char",
  164. "short",
  165. "int",
  166. "long",
  167. "float",
  168. "double",
  169. "signed",
  170. "unsigned",
  171. "_Bool",
  172. "_Complex",
  173. "complex",
  174. "__complex",
  175. "__complex__",
  176. "struct",
  177. "union",
  178. "{",
  179. "}",
  180. ":",
  181. "enum",
  182. "=",
  183. "*",
  184. "[",
  185. "]",
  186. "...",
  187. "__attribute",
  188. "__attribute__",
  189. "__declspec",
  190. "__cdecl",
  191. "__stdcall",
  192. "__fastcall",
  193. "__thiscall",
  194. "__vectorcall",
  195. ".",
  196. "?",
  197. "||",
  198. "&&",
  199. "|",
  200. "^",
  201. "&",
  202. "==",
  203. "!=",
  204. "<",
  205. ">",
  206. "<=",
  207. ">=",
  208. "<<",
  209. ">>",
  210. "+",
  211. "-",
  212. "/",
  213. "%",
  214. "->",
  215. "++",
  216. "--",
  217. "~",
  218. "!",
  219. "sizeof",
  220. "_Alignof",
  221. "__alignof",
  222. "__alignof__",
  223. "__restict",
  224. "<ID>",
  225. "<OCTNUMBER>",
  226. "<DECNUMBER>",
  227. "<HEXNUMBER>",
  228. "<FLOATNUMBER>",
  229. "<STRING>",
  230. "<CHARACTER>",
  231. "<EOL>",
  232. "<WS>",
  233. "<ONE_LINE_COMMENT>",
  234. "<COMMENT>",
  235. NULL
  236. };
  237. #define YY_IN_SET(sym, set, bitset) \
  238. (bitset[sym>>3] & (1 << (sym & 0x7)))
  239. static int skip_EOL(int sym);
  240. static int skip_WS(int sym);
  241. static int skip_ONE_LINE_COMMENT(int sym);
  242. static int skip_COMMENT(int sym);
  243. static int get_sym(void);
  244. static int check_nested_declarator_start(int sym);
  245. static int check_type_name_start(int sym);
  246. static int check_ID(int sym);
  247. static int parse_declarations(int sym);
  248. static int parse_declaration_specifiers(int sym, zend_ffi_dcl *dcl);
  249. static int parse_specifier_qualifier_list(int sym, zend_ffi_dcl *dcl);
  250. static int parse_type_qualifier_list(int sym, zend_ffi_dcl *dcl);
  251. static int parse_type_qualifier(int sym, zend_ffi_dcl *dcl);
  252. static int parse_type_specifier(int sym, zend_ffi_dcl *dcl);
  253. static int parse_struct_or_union_specifier(int sym, zend_ffi_dcl *dcl);
  254. static int parse_struct_contents(int sym, zend_ffi_dcl *dcl);
  255. static int parse_struct_declaration(int sym, zend_ffi_dcl *struct_dcl);
  256. static int parse_struct_declarator(int sym, zend_ffi_dcl *struct_dcl, zend_ffi_dcl *field_dcl);
  257. static int parse_enum_specifier(int sym, zend_ffi_dcl *dcl);
  258. static int parse_enumerator_list(int sym, zend_ffi_dcl *enum_dcl);
  259. static int parse_enumerator(int sym, zend_ffi_dcl *enum_dcl, int64_t *min, int64_t *max, int64_t *last);
  260. static int parse_declarator(int sym, zend_ffi_dcl *dcl, const char **name, size_t *name_len);
  261. static int parse_abstract_declarator(int sym, zend_ffi_dcl *dcl);
  262. static int parse_parameter_declarator(int sym, zend_ffi_dcl *dcl, const char **name, size_t *name_len);
  263. static int parse_pointer(int sym, zend_ffi_dcl *dcl);
  264. static int parse_array_or_function_declarators(int sym, zend_ffi_dcl *dcl, zend_ffi_dcl *nested_dcl);
  265. static int parse_parameter_declaration(int sym, HashTable **args);
  266. static int parse_type_name(int sym, zend_ffi_dcl *dcl);
  267. static int parse_attributes(int sym, zend_ffi_dcl *dcl);
  268. static int parse_attrib(int sym, zend_ffi_dcl *dcl);
  269. static int parse_initializer(int sym);
  270. static int parse_designation(int sym);
  271. static int parse_expr_list(int sym);
  272. static int parse_expression(int sym, zend_ffi_val *val);
  273. static int parse_assignment_expression(int sym, zend_ffi_val *val);
  274. static int parse_constant_expression(int sym, zend_ffi_val *val);
  275. static int parse_conditional_expression(int sym, zend_ffi_val *val);
  276. static int parse_logical_or_expression(int sym, zend_ffi_val *val);
  277. static int parse_logical_and_expression(int sym, zend_ffi_val *val);
  278. static int parse_inclusive_or_expression(int sym, zend_ffi_val *val);
  279. static int parse_exclusive_or_expression(int sym, zend_ffi_val *val);
  280. static int parse_and_expression(int sym, zend_ffi_val *val);
  281. static int parse_equality_expression(int sym, zend_ffi_val *val);
  282. static int parse_relational_expression(int sym, zend_ffi_val *val);
  283. static int parse_shift_expression(int sym, zend_ffi_val *val);
  284. static int parse_additive_expression(int sym, zend_ffi_val *val);
  285. static int parse_multiplicative_expression(int sym, zend_ffi_val *val);
  286. static int parse_cast_expression(int sym, zend_ffi_val *val);
  287. static int parse_unary_expression(int sym, zend_ffi_val *val);
  288. static int parse_ID(int sym, const char **name, size_t *name_len);
  289. static int parse_OCTNUMBER(int sym, zend_ffi_val *val);
  290. static int parse_DECNUMBER(int sym, zend_ffi_val *val);
  291. static int parse_HEXNUMBER(int sym, zend_ffi_val *val);
  292. static int parse_FLOATNUMBER(int sym, zend_ffi_val *val);
  293. static int parse_STRING(int sym, zend_ffi_val *val);
  294. static int parse_CHARACTER(int sym, zend_ffi_val *val);
  295. static int synpred_1(int sym);
  296. static int synpred_2(int sym);
  297. static int synpred_3(int sym);
  298. static int synpred_4(int sym);
  299. static int synpred_5(int sym);
  300. static int synpred_6(int sym);
  301. static int get_skip_sym(void) {
  302. int ch;
  303. int ret;
  304. int accept = -1;
  305. const unsigned char *accept_pos;
  306. const unsigned char *cpos = yy_pos;
  307. const unsigned char *cend = yy_end;
  308. _yy_state_start:
  309. yy_text = YYPOS;
  310. ch = *YYPOS;
  311. switch (ch) {
  312. case '_':
  313. ch = *++YYPOS;
  314. switch (ch) {
  315. case '_':
  316. ch = *++YYPOS;
  317. switch (ch) {
  318. case 'e':
  319. ch = *++YYPOS;
  320. if (ch != 'x') goto _yy_tunnel_9;
  321. ch = *++YYPOS;
  322. if (ch != 't') goto _yy_tunnel_9;
  323. ch = *++YYPOS;
  324. if (ch != 'e') goto _yy_tunnel_9;
  325. ch = *++YYPOS;
  326. if (ch != 'n') goto _yy_tunnel_9;
  327. ch = *++YYPOS;
  328. if (ch != 's') goto _yy_tunnel_9;
  329. ch = *++YYPOS;
  330. if (ch != 'i') goto _yy_tunnel_9;
  331. ch = *++YYPOS;
  332. if (ch != 'o') goto _yy_tunnel_9;
  333. ch = *++YYPOS;
  334. if (ch != 'n') goto _yy_tunnel_9;
  335. ch = *++YYPOS;
  336. if (ch != '_') goto _yy_tunnel_9;
  337. ch = *++YYPOS;
  338. if (ch != '_') goto _yy_tunnel_9;
  339. ret = YY___EXTENSION__;
  340. goto _yy_state_390;
  341. case 'i':
  342. ch = *++YYPOS;
  343. if (ch != 'n') goto _yy_tunnel_9;
  344. ch = *++YYPOS;
  345. if (ch != 'l') goto _yy_tunnel_9;
  346. ch = *++YYPOS;
  347. if (ch != 'i') goto _yy_tunnel_9;
  348. ch = *++YYPOS;
  349. if (ch != 'n') goto _yy_tunnel_9;
  350. ch = *++YYPOS;
  351. if (ch != 'e') goto _yy_tunnel_9;
  352. ch = *++YYPOS;
  353. if (ch != '_') {ret = YY___INLINE; goto _yy_tunnel_390;}
  354. ch = *++YYPOS;
  355. if (ch != '_') goto _yy_tunnel_9;
  356. ret = YY___INLINE__;
  357. goto _yy_state_390;
  358. case 'a':
  359. ch = *++YYPOS;
  360. if (ch == 'l') {
  361. ch = *++YYPOS;
  362. if (ch != 'i') goto _yy_tunnel_9;
  363. ch = *++YYPOS;
  364. if (ch != 'g') goto _yy_tunnel_9;
  365. ch = *++YYPOS;
  366. if (ch != 'n') goto _yy_tunnel_9;
  367. ch = *++YYPOS;
  368. if (ch != 'o') goto _yy_tunnel_9;
  369. ch = *++YYPOS;
  370. if (ch != 'f') goto _yy_tunnel_9;
  371. ch = *++YYPOS;
  372. if (ch != '_') {ret = YY___ALIGNOF; goto _yy_tunnel_390;}
  373. ch = *++YYPOS;
  374. if (ch != '_') goto _yy_tunnel_9;
  375. ret = YY___ALIGNOF__;
  376. goto _yy_state_390;
  377. } else if (ch == 's') {
  378. ch = *++YYPOS;
  379. if (ch != 'm') goto _yy_tunnel_9;
  380. ch = *++YYPOS;
  381. if (ch != '_') goto _yy_tunnel_9;
  382. ch = *++YYPOS;
  383. if (ch != '_') goto _yy_tunnel_9;
  384. ret = YY___ASM__;
  385. goto _yy_state_390;
  386. } else if (ch == 't') {
  387. ch = *++YYPOS;
  388. if (ch != 't') goto _yy_tunnel_9;
  389. ch = *++YYPOS;
  390. if (ch != 'r') goto _yy_tunnel_9;
  391. ch = *++YYPOS;
  392. if (ch != 'i') goto _yy_tunnel_9;
  393. ch = *++YYPOS;
  394. if (ch != 'b') goto _yy_tunnel_9;
  395. ch = *++YYPOS;
  396. if (ch != 'u') goto _yy_tunnel_9;
  397. ch = *++YYPOS;
  398. if (ch != 't') goto _yy_tunnel_9;
  399. ch = *++YYPOS;
  400. if (ch != 'e') goto _yy_tunnel_9;
  401. ch = *++YYPOS;
  402. if (ch != '_') {ret = YY___ATTRIBUTE; goto _yy_tunnel_390;}
  403. ch = *++YYPOS;
  404. if (ch != '_') goto _yy_tunnel_9;
  405. ret = YY___ATTRIBUTE__;
  406. goto _yy_state_390;
  407. } else {
  408. goto _yy_tunnel_9;
  409. }
  410. case 'c':
  411. ch = *++YYPOS;
  412. if (ch == 'd') {
  413. ch = *++YYPOS;
  414. if (ch != 'e') goto _yy_tunnel_9;
  415. ch = *++YYPOS;
  416. if (ch != 'c') goto _yy_tunnel_9;
  417. ch = *++YYPOS;
  418. if (ch != 'l') goto _yy_tunnel_9;
  419. ret = YY___CDECL;
  420. goto _yy_state_390;
  421. } else if (ch == 'o') {
  422. ch = *++YYPOS;
  423. if (ch == 'm') {
  424. ch = *++YYPOS;
  425. if (ch != 'p') goto _yy_tunnel_9;
  426. ch = *++YYPOS;
  427. if (ch != 'l') goto _yy_tunnel_9;
  428. ch = *++YYPOS;
  429. if (ch != 'e') goto _yy_tunnel_9;
  430. ch = *++YYPOS;
  431. if (ch != 'x') goto _yy_tunnel_9;
  432. ch = *++YYPOS;
  433. if (ch != '_') {ret = YY___COMPLEX; goto _yy_tunnel_390;}
  434. ch = *++YYPOS;
  435. if (ch != '_') goto _yy_tunnel_9;
  436. ret = YY___COMPLEX__;
  437. goto _yy_state_390;
  438. } else if (ch == 'n') {
  439. ch = *++YYPOS;
  440. if (ch != 's') goto _yy_tunnel_9;
  441. ch = *++YYPOS;
  442. if (ch != 't') goto _yy_tunnel_9;
  443. ch = *++YYPOS;
  444. if (ch != '_') {ret = YY___CONST; goto _yy_tunnel_390;}
  445. ch = *++YYPOS;
  446. if (ch != '_') goto _yy_tunnel_9;
  447. ret = YY___CONST__;
  448. goto _yy_state_390;
  449. } else {
  450. goto _yy_tunnel_9;
  451. }
  452. } else {
  453. goto _yy_tunnel_9;
  454. }
  455. case 'd':
  456. ch = *++YYPOS;
  457. if (ch != 'e') goto _yy_tunnel_9;
  458. ch = *++YYPOS;
  459. if (ch != 'c') goto _yy_tunnel_9;
  460. ch = *++YYPOS;
  461. if (ch != 'l') goto _yy_tunnel_9;
  462. ch = *++YYPOS;
  463. if (ch != 's') goto _yy_tunnel_9;
  464. ch = *++YYPOS;
  465. if (ch != 'p') goto _yy_tunnel_9;
  466. ch = *++YYPOS;
  467. if (ch != 'e') goto _yy_tunnel_9;
  468. ch = *++YYPOS;
  469. if (ch != 'c') goto _yy_tunnel_9;
  470. ret = YY___DECLSPEC;
  471. goto _yy_state_390;
  472. case 'f':
  473. ch = *++YYPOS;
  474. if (ch != 'a') goto _yy_tunnel_9;
  475. ch = *++YYPOS;
  476. if (ch != 's') goto _yy_tunnel_9;
  477. ch = *++YYPOS;
  478. if (ch != 't') goto _yy_tunnel_9;
  479. ch = *++YYPOS;
  480. if (ch != 'c') goto _yy_tunnel_9;
  481. ch = *++YYPOS;
  482. if (ch != 'a') goto _yy_tunnel_9;
  483. ch = *++YYPOS;
  484. if (ch != 'l') goto _yy_tunnel_9;
  485. ch = *++YYPOS;
  486. if (ch != 'l') goto _yy_tunnel_9;
  487. ret = YY___FASTCALL;
  488. goto _yy_state_390;
  489. case 'r':
  490. ch = *++YYPOS;
  491. if (ch != 'e') goto _yy_tunnel_9;
  492. ch = *++YYPOS;
  493. if (ch != 's') goto _yy_tunnel_9;
  494. ch = *++YYPOS;
  495. if (ch != 't') goto _yy_tunnel_9;
  496. ch = *++YYPOS;
  497. if (ch == 'i') {
  498. ch = *++YYPOS;
  499. if (ch != 'c') goto _yy_tunnel_9;
  500. ch = *++YYPOS;
  501. if (ch != 't') goto _yy_tunnel_9;
  502. ret = YY___RESTICT;
  503. goto _yy_state_390;
  504. } else if (ch == 'r') {
  505. ch = *++YYPOS;
  506. if (ch != 'i') goto _yy_tunnel_9;
  507. ch = *++YYPOS;
  508. if (ch != 'c') goto _yy_tunnel_9;
  509. ch = *++YYPOS;
  510. if (ch != 't') goto _yy_tunnel_9;
  511. ch = *++YYPOS;
  512. if (ch != '_') {ret = YY___RESTRICT; goto _yy_tunnel_390;}
  513. ch = *++YYPOS;
  514. if (ch != '_') goto _yy_tunnel_9;
  515. ret = YY___RESTRICT__;
  516. goto _yy_state_390;
  517. } else {
  518. goto _yy_tunnel_9;
  519. }
  520. case 's':
  521. ch = *++YYPOS;
  522. if (ch != 't') goto _yy_tunnel_9;
  523. ch = *++YYPOS;
  524. if (ch != 'd') goto _yy_tunnel_9;
  525. ch = *++YYPOS;
  526. if (ch != 'c') goto _yy_tunnel_9;
  527. ch = *++YYPOS;
  528. if (ch != 'a') goto _yy_tunnel_9;
  529. ch = *++YYPOS;
  530. if (ch != 'l') goto _yy_tunnel_9;
  531. ch = *++YYPOS;
  532. if (ch != 'l') goto _yy_tunnel_9;
  533. ret = YY___STDCALL;
  534. goto _yy_state_390;
  535. case 't':
  536. ch = *++YYPOS;
  537. if (ch != 'h') goto _yy_tunnel_9;
  538. ch = *++YYPOS;
  539. if (ch != 'i') goto _yy_tunnel_9;
  540. ch = *++YYPOS;
  541. if (ch != 's') goto _yy_tunnel_9;
  542. ch = *++YYPOS;
  543. if (ch != 'c') goto _yy_tunnel_9;
  544. ch = *++YYPOS;
  545. if (ch != 'a') goto _yy_tunnel_9;
  546. ch = *++YYPOS;
  547. if (ch != 'l') goto _yy_tunnel_9;
  548. ch = *++YYPOS;
  549. if (ch != 'l') goto _yy_tunnel_9;
  550. ret = YY___THISCALL;
  551. goto _yy_state_390;
  552. case 'v':
  553. ch = *++YYPOS;
  554. if (ch == 'e') {
  555. ch = *++YYPOS;
  556. if (ch != 'c') goto _yy_tunnel_9;
  557. ch = *++YYPOS;
  558. if (ch != 't') goto _yy_tunnel_9;
  559. ch = *++YYPOS;
  560. if (ch != 'o') goto _yy_tunnel_9;
  561. ch = *++YYPOS;
  562. if (ch != 'r') goto _yy_tunnel_9;
  563. ch = *++YYPOS;
  564. if (ch != 'c') goto _yy_tunnel_9;
  565. ch = *++YYPOS;
  566. if (ch != 'a') goto _yy_tunnel_9;
  567. ch = *++YYPOS;
  568. if (ch != 'l') goto _yy_tunnel_9;
  569. ch = *++YYPOS;
  570. if (ch != 'l') goto _yy_tunnel_9;
  571. ret = YY___VECTORCALL;
  572. goto _yy_state_390;
  573. } else if (ch == 'o') {
  574. ch = *++YYPOS;
  575. if (ch != 'l') goto _yy_tunnel_9;
  576. ch = *++YYPOS;
  577. if (ch != 'a') goto _yy_tunnel_9;
  578. ch = *++YYPOS;
  579. if (ch != 't') goto _yy_tunnel_9;
  580. ch = *++YYPOS;
  581. if (ch != 'i') goto _yy_tunnel_9;
  582. ch = *++YYPOS;
  583. if (ch != 'l') goto _yy_tunnel_9;
  584. ch = *++YYPOS;
  585. if (ch != 'e') goto _yy_tunnel_9;
  586. ch = *++YYPOS;
  587. if (ch != '_') {ret = YY___VOLATILE; goto _yy_tunnel_390;}
  588. ch = *++YYPOS;
  589. if (ch != '_') goto _yy_tunnel_9;
  590. ret = YY___VOLATILE__;
  591. goto _yy_state_390;
  592. } else {
  593. goto _yy_tunnel_9;
  594. }
  595. default:
  596. goto _yy_tunnel_9;
  597. }
  598. case 'N':
  599. ch = *++YYPOS;
  600. if (ch != 'o') goto _yy_tunnel_9;
  601. ch = *++YYPOS;
  602. if (ch != 'r') goto _yy_tunnel_9;
  603. ch = *++YYPOS;
  604. if (ch != 'e') goto _yy_tunnel_9;
  605. ch = *++YYPOS;
  606. if (ch != 't') goto _yy_tunnel_9;
  607. ch = *++YYPOS;
  608. if (ch != 'u') goto _yy_tunnel_9;
  609. ch = *++YYPOS;
  610. if (ch != 'r') goto _yy_tunnel_9;
  611. ch = *++YYPOS;
  612. if (ch != 'n') goto _yy_tunnel_9;
  613. ret = YY__NORETURN;
  614. goto _yy_state_390;
  615. case 'A':
  616. ch = *++YYPOS;
  617. if (ch == 'l') {
  618. ch = *++YYPOS;
  619. if (ch != 'i') goto _yy_tunnel_9;
  620. ch = *++YYPOS;
  621. if (ch != 'g') goto _yy_tunnel_9;
  622. ch = *++YYPOS;
  623. if (ch != 'n') goto _yy_tunnel_9;
  624. ch = *++YYPOS;
  625. if (ch == 'a') {
  626. ch = *++YYPOS;
  627. if (ch != 's') goto _yy_tunnel_9;
  628. ret = YY__ALIGNAS;
  629. goto _yy_state_390;
  630. } else if (ch == 'o') {
  631. ch = *++YYPOS;
  632. if (ch != 'f') goto _yy_tunnel_9;
  633. ret = YY__ALIGNOF;
  634. goto _yy_state_390;
  635. } else {
  636. goto _yy_tunnel_9;
  637. }
  638. } else if (ch == 't') {
  639. ch = *++YYPOS;
  640. if (ch != 'o') goto _yy_tunnel_9;
  641. ch = *++YYPOS;
  642. if (ch != 'm') goto _yy_tunnel_9;
  643. ch = *++YYPOS;
  644. if (ch != 'i') goto _yy_tunnel_9;
  645. ch = *++YYPOS;
  646. if (ch != 'c') goto _yy_tunnel_9;
  647. ret = YY__ATOMIC;
  648. goto _yy_state_390;
  649. } else {
  650. goto _yy_tunnel_9;
  651. }
  652. case 'B':
  653. ch = *++YYPOS;
  654. if (ch != 'o') goto _yy_tunnel_9;
  655. ch = *++YYPOS;
  656. if (ch != 'o') goto _yy_tunnel_9;
  657. ch = *++YYPOS;
  658. if (ch != 'l') goto _yy_tunnel_9;
  659. ret = YY__BOOL;
  660. goto _yy_state_390;
  661. case 'C':
  662. ch = *++YYPOS;
  663. if (ch != 'o') goto _yy_tunnel_9;
  664. ch = *++YYPOS;
  665. if (ch != 'm') goto _yy_tunnel_9;
  666. ch = *++YYPOS;
  667. if (ch != 'p') goto _yy_tunnel_9;
  668. ch = *++YYPOS;
  669. if (ch != 'l') goto _yy_tunnel_9;
  670. ch = *++YYPOS;
  671. if (ch != 'e') goto _yy_tunnel_9;
  672. ch = *++YYPOS;
  673. if (ch != 'x') goto _yy_tunnel_9;
  674. ret = YY__COMPLEX;
  675. goto _yy_state_390;
  676. default:
  677. goto _yy_tunnel_9;
  678. }
  679. case 't':
  680. ch = *++YYPOS;
  681. if (ch != 'y') goto _yy_tunnel_9;
  682. ch = *++YYPOS;
  683. if (ch != 'p') goto _yy_tunnel_9;
  684. ch = *++YYPOS;
  685. if (ch != 'e') goto _yy_tunnel_9;
  686. ch = *++YYPOS;
  687. if (ch != 'd') goto _yy_tunnel_9;
  688. ch = *++YYPOS;
  689. if (ch != 'e') goto _yy_tunnel_9;
  690. ch = *++YYPOS;
  691. if (ch != 'f') goto _yy_tunnel_9;
  692. ret = YY_TYPEDEF;
  693. goto _yy_state_390;
  694. case 'e':
  695. ch = *++YYPOS;
  696. if (ch == 'x') {
  697. ch = *++YYPOS;
  698. if (ch != 't') goto _yy_tunnel_9;
  699. ch = *++YYPOS;
  700. if (ch != 'e') goto _yy_tunnel_9;
  701. ch = *++YYPOS;
  702. if (ch != 'r') goto _yy_tunnel_9;
  703. ch = *++YYPOS;
  704. if (ch != 'n') goto _yy_tunnel_9;
  705. ret = YY_EXTERN;
  706. goto _yy_state_390;
  707. } else if (ch == 'n') {
  708. ch = *++YYPOS;
  709. if (ch != 'u') goto _yy_tunnel_9;
  710. ch = *++YYPOS;
  711. if (ch != 'm') goto _yy_tunnel_9;
  712. ret = YY_ENUM;
  713. goto _yy_state_390;
  714. } else {
  715. goto _yy_tunnel_9;
  716. }
  717. case 's':
  718. ch = *++YYPOS;
  719. if (ch == 't') {
  720. ch = *++YYPOS;
  721. if (ch == 'a') {
  722. ch = *++YYPOS;
  723. if (ch != 't') goto _yy_tunnel_9;
  724. ch = *++YYPOS;
  725. if (ch != 'i') goto _yy_tunnel_9;
  726. ch = *++YYPOS;
  727. if (ch != 'c') goto _yy_tunnel_9;
  728. ret = YY_STATIC;
  729. goto _yy_state_390;
  730. } else if (ch == 'r') {
  731. ch = *++YYPOS;
  732. if (ch != 'u') goto _yy_tunnel_9;
  733. ch = *++YYPOS;
  734. if (ch != 'c') goto _yy_tunnel_9;
  735. ch = *++YYPOS;
  736. if (ch != 't') goto _yy_tunnel_9;
  737. ret = YY_STRUCT;
  738. goto _yy_state_390;
  739. } else {
  740. goto _yy_tunnel_9;
  741. }
  742. } else if (ch == 'h') {
  743. ch = *++YYPOS;
  744. if (ch != 'o') goto _yy_tunnel_9;
  745. ch = *++YYPOS;
  746. if (ch != 'r') goto _yy_tunnel_9;
  747. ch = *++YYPOS;
  748. if (ch != 't') goto _yy_tunnel_9;
  749. ret = YY_SHORT;
  750. goto _yy_state_390;
  751. } else if (ch == 'i') {
  752. ch = *++YYPOS;
  753. if (ch == 'g') {
  754. ch = *++YYPOS;
  755. if (ch != 'n') goto _yy_tunnel_9;
  756. ch = *++YYPOS;
  757. if (ch != 'e') goto _yy_tunnel_9;
  758. ch = *++YYPOS;
  759. if (ch != 'd') goto _yy_tunnel_9;
  760. ret = YY_SIGNED;
  761. goto _yy_state_390;
  762. } else if (ch == 'z') {
  763. ch = *++YYPOS;
  764. if (ch != 'e') goto _yy_tunnel_9;
  765. ch = *++YYPOS;
  766. if (ch != 'o') goto _yy_tunnel_9;
  767. ch = *++YYPOS;
  768. if (ch != 'f') goto _yy_tunnel_9;
  769. ret = YY_SIZEOF;
  770. goto _yy_state_390;
  771. } else {
  772. goto _yy_tunnel_9;
  773. }
  774. } else {
  775. goto _yy_tunnel_9;
  776. }
  777. case 'a':
  778. ch = *++YYPOS;
  779. if (ch != 'u') goto _yy_tunnel_9;
  780. ch = *++YYPOS;
  781. if (ch != 't') goto _yy_tunnel_9;
  782. ch = *++YYPOS;
  783. if (ch != 'o') goto _yy_tunnel_9;
  784. ret = YY_AUTO;
  785. goto _yy_state_390;
  786. case 'r':
  787. ch = *++YYPOS;
  788. if (ch != 'e') goto _yy_tunnel_9;
  789. ch = *++YYPOS;
  790. if (ch == 'g') {
  791. ch = *++YYPOS;
  792. if (ch != 'i') goto _yy_tunnel_9;
  793. ch = *++YYPOS;
  794. if (ch != 's') goto _yy_tunnel_9;
  795. ch = *++YYPOS;
  796. if (ch != 't') goto _yy_tunnel_9;
  797. ch = *++YYPOS;
  798. if (ch != 'e') goto _yy_tunnel_9;
  799. ch = *++YYPOS;
  800. if (ch != 'r') goto _yy_tunnel_9;
  801. ret = YY_REGISTER;
  802. goto _yy_state_390;
  803. } else if (ch == 's') {
  804. ch = *++YYPOS;
  805. if (ch != 't') goto _yy_tunnel_9;
  806. ch = *++YYPOS;
  807. if (ch != 'r') goto _yy_tunnel_9;
  808. ch = *++YYPOS;
  809. if (ch != 'i') goto _yy_tunnel_9;
  810. ch = *++YYPOS;
  811. if (ch != 'c') goto _yy_tunnel_9;
  812. ch = *++YYPOS;
  813. if (ch != 't') goto _yy_tunnel_9;
  814. ret = YY_RESTRICT;
  815. goto _yy_state_390;
  816. } else {
  817. goto _yy_tunnel_9;
  818. }
  819. case 'i':
  820. ch = *++YYPOS;
  821. if (ch != 'n') goto _yy_tunnel_9;
  822. ch = *++YYPOS;
  823. if (ch == 'l') {
  824. ch = *++YYPOS;
  825. if (ch != 'i') goto _yy_tunnel_9;
  826. ch = *++YYPOS;
  827. if (ch != 'n') goto _yy_tunnel_9;
  828. ch = *++YYPOS;
  829. if (ch != 'e') goto _yy_tunnel_9;
  830. ret = YY_INLINE;
  831. goto _yy_state_390;
  832. } else if (ch == 't') {
  833. ret = YY_INT;
  834. goto _yy_state_390;
  835. } else {
  836. goto _yy_tunnel_9;
  837. }
  838. case '(':
  839. YYPOS++;
  840. ret = YY__LPAREN;
  841. goto _yy_fin;
  842. case 'A':
  843. case 'B':
  844. case 'C':
  845. case 'D':
  846. case 'E':
  847. case 'F':
  848. case 'G':
  849. case 'H':
  850. case 'I':
  851. case 'J':
  852. case 'K':
  853. case 'M':
  854. case 'N':
  855. case 'O':
  856. case 'P':
  857. case 'Q':
  858. case 'R':
  859. case 'S':
  860. case 'T':
  861. case 'V':
  862. case 'W':
  863. case 'X':
  864. case 'Y':
  865. case 'Z':
  866. case 'b':
  867. case 'g':
  868. case 'h':
  869. case 'j':
  870. case 'k':
  871. case 'm':
  872. case 'n':
  873. case 'o':
  874. case 'p':
  875. case 'q':
  876. case 'w':
  877. case 'x':
  878. case 'y':
  879. case 'z':
  880. goto _yy_state_9;
  881. case 'L':
  882. case 'U':
  883. ch = *++YYPOS;
  884. if (ch == '"') {
  885. goto _yy_state_27;
  886. } else if (ch == '\'') {
  887. goto _yy_state_28;
  888. } else {
  889. goto _yy_tunnel_9;
  890. }
  891. case 'c':
  892. ch = *++YYPOS;
  893. if (ch == 'h') {
  894. ch = *++YYPOS;
  895. if (ch != 'a') goto _yy_tunnel_9;
  896. ch = *++YYPOS;
  897. if (ch != 'r') goto _yy_tunnel_9;
  898. ret = YY_CHAR;
  899. goto _yy_state_390;
  900. } else if (ch == 'o') {
  901. ch = *++YYPOS;
  902. if (ch == 'm') {
  903. ch = *++YYPOS;
  904. if (ch != 'p') goto _yy_tunnel_9;
  905. ch = *++YYPOS;
  906. if (ch != 'l') goto _yy_tunnel_9;
  907. ch = *++YYPOS;
  908. if (ch != 'e') goto _yy_tunnel_9;
  909. ch = *++YYPOS;
  910. if (ch != 'x') goto _yy_tunnel_9;
  911. ret = YY_COMPLEX;
  912. goto _yy_state_390;
  913. } else if (ch == 'n') {
  914. ch = *++YYPOS;
  915. if (ch != 's') goto _yy_tunnel_9;
  916. ch = *++YYPOS;
  917. if (ch != 't') goto _yy_tunnel_9;
  918. ret = YY_CONST;
  919. goto _yy_state_390;
  920. } else {
  921. goto _yy_tunnel_9;
  922. }
  923. } else {
  924. goto _yy_tunnel_9;
  925. }
  926. case 'd':
  927. ch = *++YYPOS;
  928. if (ch != 'o') goto _yy_tunnel_9;
  929. ch = *++YYPOS;
  930. if (ch != 'u') goto _yy_tunnel_9;
  931. ch = *++YYPOS;
  932. if (ch != 'b') goto _yy_tunnel_9;
  933. ch = *++YYPOS;
  934. if (ch != 'l') goto _yy_tunnel_9;
  935. ch = *++YYPOS;
  936. if (ch != 'e') goto _yy_tunnel_9;
  937. ret = YY_DOUBLE;
  938. goto _yy_state_390;
  939. case 'f':
  940. ch = *++YYPOS;
  941. if (ch != 'l') goto _yy_tunnel_9;
  942. ch = *++YYPOS;
  943. if (ch != 'o') goto _yy_tunnel_9;
  944. ch = *++YYPOS;
  945. if (ch != 'a') goto _yy_tunnel_9;
  946. ch = *++YYPOS;
  947. if (ch != 't') goto _yy_tunnel_9;
  948. ret = YY_FLOAT;
  949. goto _yy_state_390;
  950. case 'l':
  951. ch = *++YYPOS;
  952. if (ch != 'o') goto _yy_tunnel_9;
  953. ch = *++YYPOS;
  954. if (ch != 'n') goto _yy_tunnel_9;
  955. ch = *++YYPOS;
  956. if (ch != 'g') goto _yy_tunnel_9;
  957. ret = YY_LONG;
  958. goto _yy_state_390;
  959. case 'u':
  960. ch = *++YYPOS;
  961. if (ch == 'n') {
  962. ch = *++YYPOS;
  963. if (ch == 'i') {
  964. ch = *++YYPOS;
  965. if (ch != 'o') goto _yy_tunnel_9;
  966. ch = *++YYPOS;
  967. if (ch != 'n') goto _yy_tunnel_9;
  968. ret = YY_UNION;
  969. goto _yy_state_390;
  970. } else if (ch == 's') {
  971. ch = *++YYPOS;
  972. if (ch != 'i') goto _yy_tunnel_9;
  973. ch = *++YYPOS;
  974. if (ch != 'g') goto _yy_tunnel_9;
  975. ch = *++YYPOS;
  976. if (ch != 'n') goto _yy_tunnel_9;
  977. ch = *++YYPOS;
  978. if (ch != 'e') goto _yy_tunnel_9;
  979. ch = *++YYPOS;
  980. if (ch != 'd') goto _yy_tunnel_9;
  981. ret = YY_UNSIGNED;
  982. goto _yy_state_390;
  983. } else {
  984. goto _yy_tunnel_9;
  985. }
  986. } else if (ch == '8') {
  987. ch = *++YYPOS;
  988. if (ch != '"') goto _yy_tunnel_9;
  989. goto _yy_state_27;
  990. } else if (ch == '"') {
  991. goto _yy_state_27;
  992. } else if (ch == '\'') {
  993. goto _yy_state_28;
  994. } else {
  995. goto _yy_tunnel_9;
  996. }
  997. case 'v':
  998. ch = *++YYPOS;
  999. if (ch != 'o') goto _yy_tunnel_9;
  1000. ch = *++YYPOS;
  1001. if (ch == 'i') {
  1002. ch = *++YYPOS;
  1003. if (ch != 'd') goto _yy_tunnel_9;
  1004. ret = YY_VOID;
  1005. goto _yy_state_390;
  1006. } else if (ch == 'l') {
  1007. ch = *++YYPOS;
  1008. if (ch != 'a') goto _yy_tunnel_9;
  1009. ch = *++YYPOS;
  1010. if (ch != 't') goto _yy_tunnel_9;
  1011. ch = *++YYPOS;
  1012. if (ch != 'i') goto _yy_tunnel_9;
  1013. ch = *++YYPOS;
  1014. if (ch != 'l') goto _yy_tunnel_9;
  1015. ch = *++YYPOS;
  1016. if (ch != 'e') goto _yy_tunnel_9;
  1017. ret = YY_VOLATILE;
  1018. goto _yy_state_390;
  1019. } else {
  1020. goto _yy_tunnel_9;
  1021. }
  1022. case ')':
  1023. YYPOS++;
  1024. ret = YY__RPAREN;
  1025. goto _yy_fin;
  1026. case '[':
  1027. YYPOS++;
  1028. ret = YY__LBRACK;
  1029. goto _yy_fin;
  1030. case ',':
  1031. YYPOS++;
  1032. ret = YY__COMMA;
  1033. goto _yy_fin;
  1034. case ']':
  1035. YYPOS++;
  1036. ret = YY__RBRACK;
  1037. goto _yy_fin;
  1038. case '.':
  1039. ch = *++YYPOS;
  1040. accept = YY__POINT;
  1041. accept_pos = yy_pos;
  1042. if ((ch >= '0' && ch <= '9')) {
  1043. goto _yy_state_73;
  1044. } else if (ch == '.') {
  1045. ch = *++YYPOS;
  1046. if (ch == '.') {
  1047. YYPOS++;
  1048. ret = YY__POINT_POINT_POINT;
  1049. goto _yy_fin;
  1050. } else {
  1051. goto _yy_state_error;
  1052. }
  1053. } else {
  1054. ret = YY__POINT;
  1055. goto _yy_fin;
  1056. }
  1057. case '-':
  1058. ch = *++YYPOS;
  1059. if (ch == '>') {
  1060. YYPOS++;
  1061. ret = YY__MINUS_GREATER;
  1062. goto _yy_fin;
  1063. } else if (ch == '-') {
  1064. YYPOS++;
  1065. ret = YY__MINUS_MINUS;
  1066. goto _yy_fin;
  1067. } else {
  1068. ret = YY__MINUS;
  1069. goto _yy_fin;
  1070. }
  1071. case '+':
  1072. ch = *++YYPOS;
  1073. if (ch == '+') {
  1074. YYPOS++;
  1075. ret = YY__PLUS_PLUS;
  1076. goto _yy_fin;
  1077. } else {
  1078. ret = YY__PLUS;
  1079. goto _yy_fin;
  1080. }
  1081. case '0':
  1082. ch = *++YYPOS;
  1083. if (ch != 'X' && ch != 'x') goto _yy_tunnel_78;
  1084. ch = *++YYPOS;
  1085. if ((ch >= '0' && ch <= '9') || (ch >= 'A' && ch <= 'F') || (ch >= 'a' && ch <= 'f')) {
  1086. goto _yy_state_156;
  1087. } else {
  1088. goto _yy_state_error;
  1089. }
  1090. case '1':
  1091. case '2':
  1092. case '3':
  1093. case '4':
  1094. case '5':
  1095. case '6':
  1096. case '7':
  1097. case '8':
  1098. case '9':
  1099. goto _yy_state_26;
  1100. case '"':
  1101. goto _yy_state_27;
  1102. case '\'':
  1103. goto _yy_state_28;
  1104. case '&':
  1105. ch = *++YYPOS;
  1106. if (ch == '&') {
  1107. YYPOS++;
  1108. ret = YY__AND_AND;
  1109. goto _yy_fin;
  1110. } else {
  1111. ret = YY__AND;
  1112. goto _yy_fin;
  1113. }
  1114. case '*':
  1115. YYPOS++;
  1116. ret = YY__STAR;
  1117. goto _yy_fin;
  1118. case '~':
  1119. YYPOS++;
  1120. ret = YY__TILDE;
  1121. goto _yy_fin;
  1122. case '!':
  1123. ch = *++YYPOS;
  1124. if (ch == '=') {
  1125. YYPOS++;
  1126. ret = YY__BANG_EQUAL;
  1127. goto _yy_fin;
  1128. } else {
  1129. ret = YY__BANG;
  1130. goto _yy_fin;
  1131. }
  1132. case '/':
  1133. ch = *++YYPOS;
  1134. accept = YY__SLASH;
  1135. accept_pos = yy_pos;
  1136. if (ch == '*') {
  1137. goto _yy_state_99;
  1138. } else if (ch == '/') {
  1139. goto _yy_state_48;
  1140. } else {
  1141. ret = YY__SLASH;
  1142. goto _yy_fin;
  1143. }
  1144. case '%':
  1145. YYPOS++;
  1146. ret = YY__PERCENT;
  1147. goto _yy_fin;
  1148. case '<':
  1149. ch = *++YYPOS;
  1150. if (ch == '<') {
  1151. YYPOS++;
  1152. ret = YY__LESS_LESS;
  1153. goto _yy_fin;
  1154. } else if (ch == '=') {
  1155. YYPOS++;
  1156. ret = YY__LESS_EQUAL;
  1157. goto _yy_fin;
  1158. } else {
  1159. ret = YY__LESS;
  1160. goto _yy_fin;
  1161. }
  1162. case '>':
  1163. ch = *++YYPOS;
  1164. if (ch == '>') {
  1165. YYPOS++;
  1166. ret = YY__GREATER_GREATER;
  1167. goto _yy_fin;
  1168. } else if (ch == '=') {
  1169. YYPOS++;
  1170. ret = YY__GREATER_EQUAL;
  1171. goto _yy_fin;
  1172. } else {
  1173. ret = YY__GREATER;
  1174. goto _yy_fin;
  1175. }
  1176. case '=':
  1177. ch = *++YYPOS;
  1178. if (ch == '=') {
  1179. YYPOS++;
  1180. ret = YY__EQUAL_EQUAL;
  1181. goto _yy_fin;
  1182. } else {
  1183. ret = YY__EQUAL;
  1184. goto _yy_fin;
  1185. }
  1186. case '^':
  1187. YYPOS++;
  1188. ret = YY__UPARROW;
  1189. goto _yy_fin;
  1190. case '|':
  1191. ch = *++YYPOS;
  1192. if (ch == '|') {
  1193. YYPOS++;
  1194. ret = YY__BAR_BAR;
  1195. goto _yy_fin;
  1196. } else {
  1197. ret = YY__BAR;
  1198. goto _yy_fin;
  1199. }
  1200. case '?':
  1201. YYPOS++;
  1202. ret = YY__QUERY;
  1203. goto _yy_fin;
  1204. case ':':
  1205. YYPOS++;
  1206. ret = YY__COLON;
  1207. goto _yy_fin;
  1208. case '{':
  1209. YYPOS++;
  1210. ret = YY__LBRACE;
  1211. goto _yy_fin;
  1212. case ';':
  1213. YYPOS++;
  1214. ret = YY__SEMICOLON;
  1215. goto _yy_fin;
  1216. case '}':
  1217. YYPOS++;
  1218. ret = YY__RBRACE;
  1219. goto _yy_fin;
  1220. case '\r':
  1221. ch = *++YYPOS;
  1222. if (ch == '\n') {
  1223. yy_line++;
  1224. YYPOS++;
  1225. ret = YY_EOL;
  1226. goto _yy_fin;
  1227. } else {
  1228. ret = YY_EOL;
  1229. goto _yy_fin;
  1230. }
  1231. case '\n':
  1232. yy_line++;
  1233. YYPOS++;
  1234. ret = YY_EOL;
  1235. goto _yy_fin;
  1236. case ' ':
  1237. case '\t':
  1238. case '\f':
  1239. case '\v':
  1240. goto _yy_state_47;
  1241. case '#':
  1242. goto _yy_state_48;
  1243. case '\0':
  1244. if (ch == 0 && YYPOS < YYEND) goto _yy_state_error;
  1245. YYPOS++;
  1246. ret = YY_EOF;
  1247. goto _yy_fin;
  1248. default:
  1249. goto _yy_state_error;
  1250. }
  1251. _yy_state_9:
  1252. ch = *++YYPOS;
  1253. _yy_tunnel_9:
  1254. if ((ch >= '0' && ch <= '9') || (ch >= 'A' && ch <= 'Z') || ch == '_' || (ch >= 'a' && ch <= 'z')) {
  1255. goto _yy_state_9;
  1256. } else {
  1257. ret = YY_ID;
  1258. goto _yy_fin;
  1259. }
  1260. _yy_state_26:
  1261. ch = *++YYPOS;
  1262. accept = YY_DECNUMBER;
  1263. accept_pos = yy_pos;
  1264. switch (ch) {
  1265. case 'U':
  1266. case 'u':
  1267. ch = *++YYPOS;
  1268. if (ch == 'L') {
  1269. ch = *++YYPOS;
  1270. if (ch == 'L') {
  1271. YYPOS++;
  1272. ret = YY_DECNUMBER;
  1273. goto _yy_fin;
  1274. } else {
  1275. ret = YY_DECNUMBER;
  1276. goto _yy_fin;
  1277. }
  1278. } else if (ch == 'l') {
  1279. YYPOS++;
  1280. ret = YY_DECNUMBER;
  1281. goto _yy_fin;
  1282. } else {
  1283. ret = YY_DECNUMBER;
  1284. goto _yy_fin;
  1285. }
  1286. case 'L':
  1287. ch = *++YYPOS;
  1288. accept = YY_DECNUMBER;
  1289. accept_pos = yy_pos;
  1290. if (ch == 'L') {
  1291. goto _yy_state_163;
  1292. } else if (ch == 'U' || ch == 'u') {
  1293. YYPOS++;
  1294. ret = YY_DECNUMBER;
  1295. goto _yy_fin;
  1296. } else {
  1297. ret = YY_DECNUMBER;
  1298. goto _yy_fin;
  1299. }
  1300. case 'l':
  1301. ch = *++YYPOS;
  1302. accept = YY_DECNUMBER;
  1303. accept_pos = yy_pos;
  1304. if (ch == 'U' || ch == 'u') {
  1305. YYPOS++;
  1306. ret = YY_DECNUMBER;
  1307. goto _yy_fin;
  1308. } else if (ch == 'l') {
  1309. goto _yy_state_163;
  1310. } else {
  1311. ret = YY_DECNUMBER;
  1312. goto _yy_fin;
  1313. }
  1314. case 'E':
  1315. case 'e':
  1316. goto _yy_state_85;
  1317. case '0':
  1318. case '1':
  1319. case '2':
  1320. case '3':
  1321. case '4':
  1322. case '5':
  1323. case '6':
  1324. case '7':
  1325. case '8':
  1326. case '9':
  1327. goto _yy_state_26;
  1328. case '.':
  1329. goto _yy_state_73;
  1330. default:
  1331. ret = YY_DECNUMBER;
  1332. goto _yy_fin;
  1333. }
  1334. _yy_state_27:
  1335. ch = *++YYPOS;
  1336. if (ch == '\\') {
  1337. ch = *++YYPOS;
  1338. if (YYPOS < YYEND) {
  1339. if (ch == '\n') {
  1340. yy_line++;
  1341. }
  1342. goto _yy_state_27;
  1343. } else {
  1344. goto _yy_state_error;
  1345. }
  1346. } else if (ch == '"') {
  1347. YYPOS++;
  1348. ret = YY_STRING;
  1349. goto _yy_fin;
  1350. } else if (YYPOS < YYEND && (ch <= '!' || (ch >= '#' && ch <= '[') || ch >= ']')) {
  1351. if (ch == '\n') {
  1352. yy_line++;
  1353. }
  1354. goto _yy_state_27;
  1355. } else {
  1356. goto _yy_state_error;
  1357. }
  1358. _yy_state_28:
  1359. ch = *++YYPOS;
  1360. if (ch == '\\') {
  1361. ch = *++YYPOS;
  1362. if (YYPOS < YYEND) {
  1363. if (ch == '\n') {
  1364. yy_line++;
  1365. }
  1366. goto _yy_state_28;
  1367. } else {
  1368. goto _yy_state_error;
  1369. }
  1370. } else if (ch == '\'') {
  1371. YYPOS++;
  1372. ret = YY_CHARACTER;
  1373. goto _yy_fin;
  1374. } else if (YYPOS < YYEND && (ch <= '&' || (ch >= '(' && ch <= '[') || ch >= ']')) {
  1375. if (ch == '\n') {
  1376. yy_line++;
  1377. }
  1378. goto _yy_state_28;
  1379. } else {
  1380. goto _yy_state_error;
  1381. }
  1382. _yy_state_47:
  1383. ch = *++YYPOS;
  1384. if (ch == '\t' || ch == '\v' || ch == '\f' || ch == ' ') {
  1385. goto _yy_state_47;
  1386. } else {
  1387. ret = YY_WS;
  1388. goto _yy_fin;
  1389. }
  1390. _yy_state_48:
  1391. ch = *++YYPOS;
  1392. if (ch == '\r') {
  1393. ch = *++YYPOS;
  1394. if (ch == '\n') {
  1395. yy_line++;
  1396. YYPOS++;
  1397. ret = YY_ONE_LINE_COMMENT;
  1398. goto _yy_fin;
  1399. } else {
  1400. ret = YY_ONE_LINE_COMMENT;
  1401. goto _yy_fin;
  1402. }
  1403. } else if (ch == '\n') {
  1404. yy_line++;
  1405. YYPOS++;
  1406. ret = YY_ONE_LINE_COMMENT;
  1407. goto _yy_fin;
  1408. } else if (YYPOS < YYEND && (ch <= '\t' || ch == '\v' || ch == '\f' || ch >= '\016')) {
  1409. goto _yy_state_48;
  1410. } else {
  1411. goto _yy_state_error;
  1412. }
  1413. _yy_state_73:
  1414. ch = *++YYPOS;
  1415. accept = YY_FLOATNUMBER;
  1416. accept_pos = yy_pos;
  1417. if ((ch >= '0' && ch <= '9')) {
  1418. goto _yy_state_73;
  1419. } else if (ch == 'F' || ch == 'L' || ch == 'f' || ch == 'l') {
  1420. YYPOS++;
  1421. ret = YY_FLOATNUMBER;
  1422. goto _yy_fin;
  1423. } else if (ch == 'E' || ch == 'e') {
  1424. goto _yy_state_85;
  1425. } else {
  1426. ret = YY_FLOATNUMBER;
  1427. goto _yy_fin;
  1428. }
  1429. _yy_state_78:
  1430. ch = *++YYPOS;
  1431. _yy_tunnel_78:
  1432. accept = YY_OCTNUMBER;
  1433. accept_pos = yy_pos;
  1434. switch (ch) {
  1435. case '0':
  1436. case '1':
  1437. case '2':
  1438. case '3':
  1439. case '4':
  1440. case '5':
  1441. case '6':
  1442. case '7':
  1443. goto _yy_state_78;
  1444. case 'U':
  1445. case 'u':
  1446. ch = *++YYPOS;
  1447. if (ch == 'L') {
  1448. ch = *++YYPOS;
  1449. if (ch == 'L') {
  1450. YYPOS++;
  1451. ret = YY_OCTNUMBER;
  1452. goto _yy_fin;
  1453. } else {
  1454. ret = YY_OCTNUMBER;
  1455. goto _yy_fin;
  1456. }
  1457. } else if (ch == 'l') {
  1458. YYPOS++;
  1459. ret = YY_OCTNUMBER;
  1460. goto _yy_fin;
  1461. } else {
  1462. ret = YY_OCTNUMBER;
  1463. goto _yy_fin;
  1464. }
  1465. case 'L':
  1466. ch = *++YYPOS;
  1467. accept = YY_OCTNUMBER;
  1468. accept_pos = yy_pos;
  1469. if (ch == 'L') {
  1470. goto _yy_state_154;
  1471. } else if (ch == 'U' || ch == 'u') {
  1472. YYPOS++;
  1473. ret = YY_OCTNUMBER;
  1474. goto _yy_fin;
  1475. } else {
  1476. ret = YY_OCTNUMBER;
  1477. goto _yy_fin;
  1478. }
  1479. case 'l':
  1480. ch = *++YYPOS;
  1481. accept = YY_OCTNUMBER;
  1482. accept_pos = yy_pos;
  1483. if (ch == 'l') {
  1484. goto _yy_state_154;
  1485. } else if (ch == 'U' || ch == 'u') {
  1486. YYPOS++;
  1487. ret = YY_OCTNUMBER;
  1488. goto _yy_fin;
  1489. } else {
  1490. ret = YY_OCTNUMBER;
  1491. goto _yy_fin;
  1492. }
  1493. case '8':
  1494. case '9':
  1495. goto _yy_state_83;
  1496. case 'E':
  1497. case 'e':
  1498. goto _yy_state_85;
  1499. case '.':
  1500. goto _yy_state_73;
  1501. default:
  1502. ret = YY_OCTNUMBER;
  1503. goto _yy_fin;
  1504. }
  1505. _yy_state_83:
  1506. ch = *++YYPOS;
  1507. if ((ch >= '0' && ch <= '9')) {
  1508. goto _yy_state_83;
  1509. } else if (ch == 'E' || ch == 'e') {
  1510. goto _yy_state_85;
  1511. } else if (ch == '.') {
  1512. goto _yy_state_73;
  1513. } else {
  1514. goto _yy_state_error;
  1515. }
  1516. _yy_state_85:
  1517. ch = *++YYPOS;
  1518. if (ch == '+' || ch == '-') {
  1519. ch = *++YYPOS;
  1520. if ((ch >= '0' && ch <= '9')) {
  1521. goto _yy_state_159;
  1522. } else {
  1523. goto _yy_state_error;
  1524. }
  1525. } else if ((ch >= '0' && ch <= '9')) {
  1526. goto _yy_state_159;
  1527. } else {
  1528. goto _yy_state_error;
  1529. }
  1530. _yy_state_99:
  1531. ch = *++YYPOS;
  1532. _yy_tunnel_99:
  1533. if (ch == '*') {
  1534. ch = *++YYPOS;
  1535. if (ch != '/') goto _yy_tunnel_99;
  1536. YYPOS++;
  1537. ret = YY_COMMENT;
  1538. goto _yy_fin;
  1539. } else if (YYPOS < YYEND && (ch <= ')' || ch >= '+')) {
  1540. if (ch == '\n') {
  1541. yy_line++;
  1542. }
  1543. goto _yy_state_99;
  1544. } else {
  1545. goto _yy_state_error;
  1546. }
  1547. _yy_state_154:
  1548. ch = *++YYPOS;
  1549. if (ch == 'U' || ch == 'u') {
  1550. YYPOS++;
  1551. ret = YY_OCTNUMBER;
  1552. goto _yy_fin;
  1553. } else {
  1554. goto _yy_state_error;
  1555. }
  1556. _yy_state_156:
  1557. ch = *++YYPOS;
  1558. if (ch == 'U' || ch == 'u') {
  1559. ch = *++YYPOS;
  1560. if (ch == 'L') {
  1561. ch = *++YYPOS;
  1562. if (ch == 'L') {
  1563. YYPOS++;
  1564. ret = YY_HEXNUMBER;
  1565. goto _yy_fin;
  1566. } else {
  1567. ret = YY_HEXNUMBER;
  1568. goto _yy_fin;
  1569. }
  1570. } else if (ch == 'l') {
  1571. YYPOS++;
  1572. ret = YY_HEXNUMBER;
  1573. goto _yy_fin;
  1574. } else {
  1575. ret = YY_HEXNUMBER;
  1576. goto _yy_fin;
  1577. }
  1578. } else if (ch == 'L') {
  1579. ch = *++YYPOS;
  1580. accept = YY_HEXNUMBER;
  1581. accept_pos = yy_pos;
  1582. if (ch == 'L') {
  1583. goto _yy_state_265;
  1584. } else if (ch == 'U' || ch == 'u') {
  1585. YYPOS++;
  1586. ret = YY_HEXNUMBER;
  1587. goto _yy_fin;
  1588. } else {
  1589. ret = YY_HEXNUMBER;
  1590. goto _yy_fin;
  1591. }
  1592. } else if (ch == 'l') {
  1593. ch = *++YYPOS;
  1594. accept = YY_HEXNUMBER;
  1595. accept_pos = yy_pos;
  1596. if (ch == 'U' || ch == 'u') {
  1597. YYPOS++;
  1598. ret = YY_HEXNUMBER;
  1599. goto _yy_fin;
  1600. } else if (ch == 'l') {
  1601. goto _yy_state_265;
  1602. } else {
  1603. ret = YY_HEXNUMBER;
  1604. goto _yy_fin;
  1605. }
  1606. } else if ((ch >= '0' && ch <= '9') || (ch >= 'A' && ch <= 'F') || (ch >= 'a' && ch <= 'f')) {
  1607. goto _yy_state_156;
  1608. } else {
  1609. ret = YY_HEXNUMBER;
  1610. goto _yy_fin;
  1611. }
  1612. _yy_state_159:
  1613. ch = *++YYPOS;
  1614. if ((ch >= '0' && ch <= '9')) {
  1615. goto _yy_state_159;
  1616. } else if (ch == 'F' || ch == 'L' || ch == 'f' || ch == 'l') {
  1617. YYPOS++;
  1618. ret = YY_FLOATNUMBER;
  1619. goto _yy_fin;
  1620. } else {
  1621. ret = YY_FLOATNUMBER;
  1622. goto _yy_fin;
  1623. }
  1624. _yy_state_163:
  1625. ch = *++YYPOS;
  1626. if (ch == 'U' || ch == 'u') {
  1627. YYPOS++;
  1628. ret = YY_DECNUMBER;
  1629. goto _yy_fin;
  1630. } else {
  1631. goto _yy_state_error;
  1632. }
  1633. _yy_state_265:
  1634. ch = *++YYPOS;
  1635. if (ch == 'U' || ch == 'u') {
  1636. YYPOS++;
  1637. ret = YY_HEXNUMBER;
  1638. goto _yy_fin;
  1639. } else {
  1640. goto _yy_state_error;
  1641. }
  1642. _yy_state_390:
  1643. ch = *++YYPOS;
  1644. _yy_tunnel_390:
  1645. if ((ch >= '0' && ch <= '9') || (ch >= 'A' && ch <= 'Z') || ch == '_' || (ch >= 'a' && ch <= 'z')) {
  1646. goto _yy_state_9;
  1647. } else {
  1648. goto _yy_fin;
  1649. }
  1650. _yy_state_error:
  1651. if (accept >= 0) {
  1652. yy_pos = accept_pos;
  1653. return accept;
  1654. }
  1655. if (YYPOS >= YYEND) {
  1656. yy_error("unexpected <EOF>");
  1657. } else if (YYPOS == yy_text) {
  1658. yy_error("unexpected character 'escape_char(ch)'");
  1659. } else {
  1660. yy_error("unexpected sequence 'escape_string(yy_text, 1 + YYPOS - yy_text))'");
  1661. }
  1662. YYPOS++;
  1663. goto _yy_state_start;
  1664. _yy_fin:
  1665. yy_pos = YYPOS;
  1666. return ret;
  1667. }
  1668. static int skip_EOL(int sym) {
  1669. if (sym != YY_EOL) {
  1670. yy_error_sym("<EOL> expected, got", sym);
  1671. }
  1672. sym = get_skip_sym();
  1673. return sym;
  1674. }
  1675. static int skip_WS(int sym) {
  1676. if (sym != YY_WS) {
  1677. yy_error_sym("<WS> expected, got", sym);
  1678. }
  1679. sym = get_skip_sym();
  1680. return sym;
  1681. }
  1682. static int skip_ONE_LINE_COMMENT(int sym) {
  1683. if (sym != YY_ONE_LINE_COMMENT) {
  1684. yy_error_sym("<ONE_LINE_COMMENT> expected, got", sym);
  1685. }
  1686. sym = get_skip_sym();
  1687. return sym;
  1688. }
  1689. static int skip_COMMENT(int sym) {
  1690. if (sym != YY_COMMENT) {
  1691. yy_error_sym("<COMMENT> expected, got", sym);
  1692. }
  1693. sym = get_skip_sym();
  1694. return sym;
  1695. }
  1696. static int get_sym(void) {
  1697. int sym;
  1698. sym = get_skip_sym();
  1699. while (sym == YY_EOL || sym == YY_WS || sym == YY_ONE_LINE_COMMENT || sym == YY_COMMENT) {
  1700. if (sym == YY_EOL) {
  1701. sym = skip_EOL(sym);
  1702. } else if (sym == YY_WS) {
  1703. sym = skip_WS(sym);
  1704. } else if (sym == YY_ONE_LINE_COMMENT) {
  1705. sym = skip_ONE_LINE_COMMENT(sym);
  1706. } else {
  1707. sym = skip_COMMENT(sym);
  1708. }
  1709. }
  1710. return sym;
  1711. }
  1712. static int check_nested_declarator_start(int sym) {
  1713. if (sym != YY__LPAREN) {
  1714. return -1;
  1715. }
  1716. sym = get_sym();
  1717. if ((sym == YY_ID) && (!zend_ffi_is_typedef_name((const char*)yy_text, yy_pos - yy_text))) {
  1718. sym = check_ID(sym);
  1719. if (sym == -1) {
  1720. return -1;
  1721. }
  1722. } else {
  1723. switch (sym) {
  1724. case YY___ATTRIBUTE:
  1725. sym = get_sym();
  1726. break;
  1727. case YY___ATTRIBUTE__:
  1728. sym = get_sym();
  1729. break;
  1730. case YY___DECLSPEC:
  1731. sym = get_sym();
  1732. break;
  1733. case YY__STAR:
  1734. sym = get_sym();
  1735. break;
  1736. case YY__LPAREN:
  1737. sym = get_sym();
  1738. break;
  1739. case YY__LBRACK:
  1740. sym = get_sym();
  1741. break;
  1742. default:
  1743. return -1;
  1744. }
  1745. }
  1746. return sym;
  1747. }
  1748. static int check_type_name_start(int sym) {
  1749. if ((sym == YY_ID) && (zend_ffi_is_typedef_name((const char*)yy_text, yy_pos - yy_text))) {
  1750. sym = check_ID(sym);
  1751. if (sym == -1) {
  1752. return -1;
  1753. }
  1754. } else {
  1755. switch (sym) {
  1756. case YY_VOID:
  1757. sym = get_sym();
  1758. break;
  1759. case YY_CHAR:
  1760. sym = get_sym();
  1761. break;
  1762. case YY_SHORT:
  1763. sym = get_sym();
  1764. break;
  1765. case YY_INT:
  1766. sym = get_sym();
  1767. break;
  1768. case YY_LONG:
  1769. sym = get_sym();
  1770. break;
  1771. case YY_FLOAT:
  1772. sym = get_sym();
  1773. break;
  1774. case YY_DOUBLE:
  1775. sym = get_sym();
  1776. break;
  1777. case YY_SIGNED:
  1778. sym = get_sym();
  1779. break;
  1780. case YY_UNSIGNED:
  1781. sym = get_sym();
  1782. break;
  1783. case YY__BOOL:
  1784. sym = get_sym();
  1785. break;
  1786. case YY__COMPLEX:
  1787. sym = get_sym();
  1788. break;
  1789. case YY_COMPLEX:
  1790. sym = get_sym();
  1791. break;
  1792. case YY___COMPLEX:
  1793. sym = get_sym();
  1794. break;
  1795. case YY___COMPLEX__:
  1796. sym = get_sym();
  1797. break;
  1798. case YY_STRUCT:
  1799. sym = get_sym();
  1800. break;
  1801. case YY_UNION:
  1802. sym = get_sym();
  1803. break;
  1804. case YY_ENUM:
  1805. sym = get_sym();
  1806. break;
  1807. case YY_CONST:
  1808. sym = get_sym();
  1809. break;
  1810. case YY___CONST:
  1811. sym = get_sym();
  1812. break;
  1813. case YY___CONST__:
  1814. sym = get_sym();
  1815. break;
  1816. case YY_RESTRICT:
  1817. sym = get_sym();
  1818. break;
  1819. case YY___RESTICT:
  1820. sym = get_sym();
  1821. break;
  1822. case YY___RESTRICT__:
  1823. sym = get_sym();
  1824. break;
  1825. case YY_VOLATILE:
  1826. sym = get_sym();
  1827. break;
  1828. case YY___VOLATILE:
  1829. sym = get_sym();
  1830. break;
  1831. case YY___VOLATILE__:
  1832. sym = get_sym();
  1833. break;
  1834. case YY__ATOMIC:
  1835. sym = get_sym();
  1836. break;
  1837. case YY___ATTRIBUTE:
  1838. sym = get_sym();
  1839. break;
  1840. case YY___ATTRIBUTE__:
  1841. sym = get_sym();
  1842. break;
  1843. case YY___DECLSPEC:
  1844. sym = get_sym();
  1845. break;
  1846. default:
  1847. return -1;
  1848. }
  1849. }
  1850. return sym;
  1851. }
  1852. static int check_ID(int sym) {
  1853. if (sym != YY_ID) {
  1854. return -1;
  1855. }
  1856. sym = get_sym();
  1857. return sym;
  1858. }
  1859. static int synpred_1(int sym) {
  1860. int ret;
  1861. const unsigned char *save_pos;
  1862. const unsigned char *save_text;
  1863. int save_line;
  1864. save_pos = yy_pos;
  1865. save_text = yy_text;
  1866. save_line = yy_line;
  1867. ret = check_type_name_start(sym) != -1;
  1868. yy_pos = save_pos;
  1869. yy_text = save_text;
  1870. yy_line = save_line;
  1871. return ret;
  1872. }
  1873. static int synpred_2(int sym) {
  1874. int ret;
  1875. const unsigned char *save_pos;
  1876. const unsigned char *save_text;
  1877. int save_line;
  1878. save_pos = yy_pos;
  1879. save_text = yy_text;
  1880. save_line = yy_line;
  1881. ret = check_nested_declarator_start(sym) != -1;
  1882. yy_pos = save_pos;
  1883. yy_text = save_text;
  1884. yy_line = save_line;
  1885. return ret;
  1886. }
  1887. static int synpred_3(int sym) {
  1888. int ret;
  1889. const unsigned char *save_pos;
  1890. const unsigned char *save_text;
  1891. int save_line;
  1892. save_pos = yy_pos;
  1893. save_text = yy_text;
  1894. save_line = yy_line;
  1895. ret = check_nested_declarator_start(sym) != -1;
  1896. yy_pos = save_pos;
  1897. yy_text = save_text;
  1898. yy_line = save_line;
  1899. return ret;
  1900. }
  1901. static int _synpred_4(int sym) {
  1902. if (sym != YY__LPAREN) {
  1903. return -1;
  1904. }
  1905. sym = get_sym();
  1906. sym = check_type_name_start(sym);
  1907. if (sym == -1) {
  1908. return -1;
  1909. }
  1910. return sym;
  1911. }
  1912. static int synpred_4(int sym) {
  1913. int ret;
  1914. const unsigned char *save_pos;
  1915. const unsigned char *save_text;
  1916. int save_line;
  1917. save_pos = yy_pos;
  1918. save_text = yy_text;
  1919. save_line = yy_line;
  1920. ret = _synpred_4(sym) != -1;
  1921. yy_pos = save_pos;
  1922. yy_text = save_text;
  1923. yy_line = save_line;
  1924. return ret;
  1925. }
  1926. static int _synpred_5(int sym) {
  1927. if (sym != YY__LPAREN) {
  1928. return -1;
  1929. }
  1930. sym = get_sym();
  1931. sym = check_type_name_start(sym);
  1932. if (sym == -1) {
  1933. return -1;
  1934. }
  1935. return sym;
  1936. }
  1937. static int synpred_5(int sym) {
  1938. int ret;
  1939. const unsigned char *save_pos;
  1940. const unsigned char *save_text;
  1941. int save_line;
  1942. save_pos = yy_pos;
  1943. save_text = yy_text;
  1944. save_line = yy_line;
  1945. ret = _synpred_5(sym) != -1;
  1946. yy_pos = save_pos;
  1947. yy_text = save_text;
  1948. yy_line = save_line;
  1949. return ret;
  1950. }
  1951. static int _synpred_6(int sym) {
  1952. if (sym != YY__LPAREN) {
  1953. return -1;
  1954. }
  1955. sym = get_sym();
  1956. sym = check_type_name_start(sym);
  1957. if (sym == -1) {
  1958. return -1;
  1959. }
  1960. return sym;
  1961. }
  1962. static int synpred_6(int sym) {
  1963. int ret;
  1964. const unsigned char *save_pos;
  1965. const unsigned char *save_text;
  1966. int save_line;
  1967. save_pos = yy_pos;
  1968. save_text = yy_text;
  1969. save_line = yy_line;
  1970. ret = _synpred_6(sym) != -1;
  1971. yy_pos = save_pos;
  1972. yy_text = save_text;
  1973. yy_line = save_line;
  1974. return ret;
  1975. }
  1976. static int parse_declarations(int sym) {
  1977. while (YY_IN_SET(sym, (YY___EXTENSION__,YY_TYPEDEF,YY_EXTERN,YY_STATIC,YY_AUTO,YY_REGISTER,YY_INLINE,YY___INLINE,YY___INLINE__,YY__NORETURN,YY__ALIGNAS,YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC,YY___CDECL,YY___STDCALL,YY___FASTCALL,YY___THISCALL,YY___VECTORCALL,YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTRICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC,YY_VOID,YY_CHAR,YY_SHORT,YY_INT,YY_LONG,YY_FLOAT,YY_DOUBLE,YY_SIGNED,YY_UNSIGNED,YY__BOOL,YY__COMPLEX,YY_COMPLEX,YY___COMPLEX,YY___COMPLEX__,YY_STRUCT,YY_UNION,YY_ENUM,YY_ID), "\202\377\377\377\377\107\360\017\000\000\000\002\000")) {
  1978. zend_ffi_dcl common_dcl = ZEND_FFI_ATTR_INIT;
  1979. if (sym == YY___EXTENSION__) {
  1980. sym = get_sym();
  1981. }
  1982. sym = parse_declaration_specifiers(sym, &common_dcl);
  1983. if (sym == YY__STAR || sym == YY_ID || sym == YY__LPAREN) {
  1984. const char *name;
  1985. size_t name_len;
  1986. zend_ffi_dcl dcl;
  1987. dcl = common_dcl;
  1988. sym = parse_declarator(sym, &dcl, &name, &name_len);
  1989. if (sym == YY___ASM__) {
  1990. zend_ffi_val asm_str;
  1991. sym = get_sym();
  1992. if (sym != YY__LPAREN) {
  1993. yy_error_sym("'(' expected, got", sym);
  1994. }
  1995. sym = get_sym();
  1996. do {
  1997. sym = parse_STRING(sym, &asm_str);
  1998. } while (sym == YY_STRING);
  1999. if (sym != YY__RPAREN) {
  2000. yy_error_sym("')' expected, got", sym);
  2001. }
  2002. sym = get_sym();
  2003. }
  2004. if (YY_IN_SET(sym, (YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC,YY___CDECL,YY___STDCALL,YY___FASTCALL,YY___THISCALL,YY___VECTORCALL), "\000\000\000\000\000\000\360\017\000\000\000\000\000")) {
  2005. sym = parse_attributes(sym, &dcl);
  2006. }
  2007. if (sym == YY__EQUAL) {
  2008. sym = parse_initializer(sym);
  2009. }
  2010. zend_ffi_declare(name, name_len, &dcl);
  2011. while (sym == YY__COMMA) {
  2012. sym = get_sym();
  2013. dcl = common_dcl;
  2014. sym = parse_declarator(sym, &dcl, &name, &name_len);
  2015. if (YY_IN_SET(sym, (YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC,YY___CDECL,YY___STDCALL,YY___FASTCALL,YY___THISCALL,YY___VECTORCALL), "\000\000\000\000\000\000\360\017\000\000\000\000\000")) {
  2016. sym = parse_attributes(sym, &dcl);
  2017. }
  2018. if (sym == YY__EQUAL) {
  2019. sym = parse_initializer(sym);
  2020. }
  2021. zend_ffi_declare(name, name_len, &dcl);
  2022. }
  2023. }
  2024. if (sym != YY__SEMICOLON) {
  2025. yy_error_sym("';' expected, got", sym);
  2026. }
  2027. sym = get_sym();
  2028. }
  2029. return sym;
  2030. }
  2031. static int parse_declaration_specifiers(int sym, zend_ffi_dcl *dcl) {
  2032. do {
  2033. switch (sym) {
  2034. case YY_TYPEDEF:
  2035. if (dcl->flags & ZEND_FFI_DCL_STORAGE_CLASS) yy_error_sym("unexpected", sym);
  2036. sym = get_sym();
  2037. dcl->flags |= ZEND_FFI_DCL_TYPEDEF;
  2038. break;
  2039. case YY_EXTERN:
  2040. if (dcl->flags & ZEND_FFI_DCL_STORAGE_CLASS) yy_error_sym("unexpected", sym);
  2041. sym = get_sym();
  2042. dcl->flags |= ZEND_FFI_DCL_EXTERN;
  2043. break;
  2044. case YY_STATIC:
  2045. if (dcl->flags & ZEND_FFI_DCL_STORAGE_CLASS) yy_error_sym("unexpected", sym);
  2046. sym = get_sym();
  2047. dcl->flags |= ZEND_FFI_DCL_STATIC;
  2048. break;
  2049. case YY_AUTO:
  2050. if (dcl->flags & ZEND_FFI_DCL_STORAGE_CLASS) yy_error_sym("unexpected", sym);
  2051. sym = get_sym();
  2052. dcl->flags |= ZEND_FFI_DCL_AUTO;
  2053. break;
  2054. case YY_REGISTER:
  2055. if (dcl->flags & ZEND_FFI_DCL_STORAGE_CLASS) yy_error_sym("unexpected", sym);
  2056. sym = get_sym();
  2057. dcl->flags |= ZEND_FFI_DCL_REGISTER;
  2058. break;
  2059. case YY_INLINE:
  2060. case YY___INLINE:
  2061. case YY___INLINE__:
  2062. sym = get_sym();
  2063. dcl->flags |= ZEND_FFI_DCL_INLINE;
  2064. break;
  2065. case YY__NORETURN:
  2066. sym = get_sym();
  2067. dcl->flags |= ZEND_FFI_DCL_NO_RETURN;
  2068. break;
  2069. case YY__ALIGNAS:
  2070. sym = get_sym();
  2071. if (sym != YY__LPAREN) {
  2072. yy_error_sym("'(' expected, got", sym);
  2073. }
  2074. sym = get_sym();
  2075. if ((YY_IN_SET(sym, (YY___EXTENSION__,YY_VOID,YY_CHAR,YY_SHORT,YY_INT,YY_LONG,YY_FLOAT,YY_DOUBLE,YY_SIGNED,YY_UNSIGNED,YY__BOOL,YY__COMPLEX,YY_COMPLEX,YY___COMPLEX,YY___COMPLEX__,YY_STRUCT,YY_UNION,YY_ENUM,YY_ID,YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTRICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC,YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC,YY___CDECL,YY___STDCALL,YY___FASTCALL,YY___THISCALL,YY___VECTORCALL), "\002\000\376\377\377\107\360\017\000\000\000\002\000")) && synpred_1(sym)) {
  2076. zend_ffi_dcl align_dcl = ZEND_FFI_ATTR_INIT;
  2077. sym = parse_type_name(sym, &align_dcl);
  2078. zend_ffi_align_as_type(dcl, &align_dcl);
  2079. } else if (YY_IN_SET(sym, (YY__LPAREN,YY_ID,YY_OCTNUMBER,YY_DECNUMBER,YY_HEXNUMBER,YY_FLOATNUMBER,YY_STRING,YY_CHARACTER,YY__PLUS_PLUS,YY__MINUS_MINUS,YY__AND,YY__STAR,YY__PLUS,YY__MINUS,YY__TILDE,YY__BANG,YY_SIZEOF,YY__ALIGNOF,YY___ALIGNOF,YY___ALIGNOF__), "\010\000\000\000\000\000\001\000\004\030\377\376\000")) {
  2080. zend_ffi_val align_val;
  2081. sym = parse_constant_expression(sym, &align_val);
  2082. zend_ffi_align_as_val(dcl, &align_val);
  2083. } else {
  2084. yy_error_sym("unexpected", sym);
  2085. }
  2086. if (sym != YY__RPAREN) {
  2087. yy_error_sym("')' expected, got", sym);
  2088. }
  2089. sym = get_sym();
  2090. break;
  2091. case YY___ATTRIBUTE:
  2092. case YY___ATTRIBUTE__:
  2093. case YY___DECLSPEC:
  2094. case YY___CDECL:
  2095. case YY___STDCALL:
  2096. case YY___FASTCALL:
  2097. case YY___THISCALL:
  2098. case YY___VECTORCALL:
  2099. sym = parse_attributes(sym, dcl);
  2100. break;
  2101. case YY_CONST:
  2102. case YY___CONST:
  2103. case YY___CONST__:
  2104. case YY_RESTRICT:
  2105. case YY___RESTRICT:
  2106. case YY___RESTRICT__:
  2107. case YY_VOLATILE:
  2108. case YY___VOLATILE:
  2109. case YY___VOLATILE__:
  2110. case YY__ATOMIC:
  2111. sym = parse_type_qualifier(sym, dcl);
  2112. break;
  2113. case YY_VOID:
  2114. case YY_CHAR:
  2115. case YY_SHORT:
  2116. case YY_INT:
  2117. case YY_LONG:
  2118. case YY_FLOAT:
  2119. case YY_DOUBLE:
  2120. case YY_SIGNED:
  2121. case YY_UNSIGNED:
  2122. case YY__BOOL:
  2123. case YY__COMPLEX:
  2124. case YY_COMPLEX:
  2125. case YY___COMPLEX:
  2126. case YY___COMPLEX__:
  2127. case YY_STRUCT:
  2128. case YY_UNION:
  2129. case YY_ENUM:
  2130. case YY_ID:
  2131. sym = parse_type_specifier(sym, dcl);
  2132. break;
  2133. default:
  2134. yy_error_sym("unexpected", sym);
  2135. }
  2136. } while ((YY_IN_SET(sym, (YY_TYPEDEF,YY_EXTERN,YY_STATIC,YY_AUTO,YY_REGISTER,YY_INLINE,YY___INLINE,YY___INLINE__,YY__NORETURN,YY__ALIGNAS,YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC,YY___CDECL,YY___STDCALL,YY___FASTCALL,YY___THISCALL,YY___VECTORCALL,YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTRICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC,YY_VOID,YY_CHAR,YY_SHORT,YY_INT,YY_LONG,YY_FLOAT,YY_DOUBLE,YY_SIGNED,YY_UNSIGNED,YY__BOOL,YY__COMPLEX,YY_COMPLEX,YY___COMPLEX,YY___COMPLEX__,YY_STRUCT,YY_UNION,YY_ENUM,YY_ID), "\200\377\377\377\377\107\360\017\000\000\000\002\000")) && (sym != YY_ID || !(dcl->flags & ZEND_FFI_DCL_TYPE_SPECIFIERS)));
  2137. return sym;
  2138. }
  2139. static int parse_specifier_qualifier_list(int sym, zend_ffi_dcl *dcl) {
  2140. if (sym == YY___EXTENSION__) {
  2141. sym = get_sym();
  2142. }
  2143. do {
  2144. if (YY_IN_SET(sym, (YY_VOID,YY_CHAR,YY_SHORT,YY_INT,YY_LONG,YY_FLOAT,YY_DOUBLE,YY_SIGNED,YY_UNSIGNED,YY__BOOL,YY__COMPLEX,YY_COMPLEX,YY___COMPLEX,YY___COMPLEX__,YY_STRUCT,YY_UNION,YY_ENUM,YY_ID), "\000\000\000\370\377\107\000\000\000\000\000\002\000")) {
  2145. sym = parse_type_specifier(sym, dcl);
  2146. } else if (YY_IN_SET(sym, (YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTRICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC), "\000\000\376\007\000\000\000\000\000\000\000\000\000")) {
  2147. sym = parse_type_qualifier(sym, dcl);
  2148. } else if (YY_IN_SET(sym, (YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC,YY___CDECL,YY___STDCALL,YY___FASTCALL,YY___THISCALL,YY___VECTORCALL), "\000\000\000\000\000\000\360\017\000\000\000\000\000")) {
  2149. sym = parse_attributes(sym, dcl);
  2150. } else {
  2151. yy_error_sym("unexpected", sym);
  2152. }
  2153. } while ((YY_IN_SET(sym, (YY_VOID,YY_CHAR,YY_SHORT,YY_INT,YY_LONG,YY_FLOAT,YY_DOUBLE,YY_SIGNED,YY_UNSIGNED,YY__BOOL,YY__COMPLEX,YY_COMPLEX,YY___COMPLEX,YY___COMPLEX__,YY_STRUCT,YY_UNION,YY_ENUM,YY_ID,YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTRICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC,YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC,YY___CDECL,YY___STDCALL,YY___FASTCALL,YY___THISCALL,YY___VECTORCALL), "\000\000\376\377\377\107\360\017\000\000\000\002\000")) && (sym != YY_ID || zend_ffi_is_typedef_name((const char*)yy_text, yy_pos - yy_text) || (dcl->flags & ZEND_FFI_DCL_TYPE_SPECIFIERS) == 0));
  2154. return sym;
  2155. }
  2156. static int parse_type_qualifier_list(int sym, zend_ffi_dcl *dcl) {
  2157. do {
  2158. if (YY_IN_SET(sym, (YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTRICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC), "\000\000\376\007\000\000\000\000\000\000\000\000\000")) {
  2159. sym = parse_type_qualifier(sym, dcl);
  2160. } else if (YY_IN_SET(sym, (YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC,YY___CDECL,YY___STDCALL,YY___FASTCALL,YY___THISCALL,YY___VECTORCALL), "\000\000\000\000\000\000\360\017\000\000\000\000\000")) {
  2161. sym = parse_attributes(sym, dcl);
  2162. } else {
  2163. yy_error_sym("unexpected", sym);
  2164. }
  2165. } while (YY_IN_SET(sym, (YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTRICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC,YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC,YY___CDECL,YY___STDCALL,YY___FASTCALL,YY___THISCALL,YY___VECTORCALL), "\000\000\376\007\000\000\360\017\000\000\000\000\000"));
  2166. return sym;
  2167. }
  2168. static int parse_type_qualifier(int sym, zend_ffi_dcl *dcl) {
  2169. if (sym == YY_CONST || sym == YY___CONST || sym == YY___CONST__) {
  2170. sym = get_sym();
  2171. dcl->flags |= ZEND_FFI_DCL_CONST;
  2172. dcl->attr |= ZEND_FFI_ATTR_CONST;
  2173. } else if (sym == YY_RESTRICT || sym == YY___RESTRICT || sym == YY___RESTRICT__) {
  2174. sym = get_sym();
  2175. dcl->flags |= ZEND_FFI_DCL_RESTRICT;
  2176. } else if (sym == YY_VOLATILE || sym == YY___VOLATILE || sym == YY___VOLATILE__) {
  2177. sym = get_sym();
  2178. dcl->flags |= ZEND_FFI_DCL_VOLATILE;
  2179. } else if (sym == YY__ATOMIC) {
  2180. sym = get_sym();
  2181. dcl->flags |= ZEND_FFI_DCL_ATOMIC;
  2182. } else {
  2183. yy_error_sym("unexpected", sym);
  2184. }
  2185. return sym;
  2186. }
  2187. static int parse_type_specifier(int sym, zend_ffi_dcl *dcl) {
  2188. const char *name;
  2189. size_t name_len;
  2190. switch (sym) {
  2191. case YY_VOID:
  2192. if (dcl->flags & ZEND_FFI_DCL_TYPE_SPECIFIERS) yy_error_sym("unexpected", sym);
  2193. sym = get_sym();
  2194. dcl->flags |= ZEND_FFI_DCL_VOID;
  2195. break;
  2196. case YY_CHAR:
  2197. if (dcl->flags & (ZEND_FFI_DCL_TYPE_SPECIFIERS-(ZEND_FFI_DCL_SIGNED|ZEND_FFI_DCL_UNSIGNED))) yy_error_sym("unexpected", sym);
  2198. sym = get_sym();
  2199. dcl->flags |= ZEND_FFI_DCL_CHAR;
  2200. break;
  2201. case YY_SHORT:
  2202. if (dcl->flags & (ZEND_FFI_DCL_TYPE_SPECIFIERS-(ZEND_FFI_DCL_SIGNED|ZEND_FFI_DCL_UNSIGNED|ZEND_FFI_DCL_INT))) yy_error_sym("unexpected", sym);
  2203. sym = get_sym();
  2204. dcl->flags |= ZEND_FFI_DCL_SHORT;
  2205. break;
  2206. case YY_INT:
  2207. if (dcl->flags & (ZEND_FFI_DCL_TYPE_SPECIFIERS-(ZEND_FFI_DCL_SIGNED|ZEND_FFI_DCL_UNSIGNED|ZEND_FFI_DCL_SHORT|ZEND_FFI_DCL_LONG|ZEND_FFI_DCL_LONG_LONG))) yy_error_sym("unexpected", sym);
  2208. sym = get_sym();
  2209. dcl->flags |= ZEND_FFI_DCL_INT;
  2210. break;
  2211. case YY_LONG:
  2212. if (dcl->flags & ZEND_FFI_DCL_LONG) {
  2213. if (dcl->flags & (ZEND_FFI_DCL_TYPE_SPECIFIERS-(ZEND_FFI_DCL_LONG|ZEND_FFI_DCL_SIGNED|ZEND_FFI_DCL_UNSIGNED|ZEND_FFI_DCL_INT))) yy_error_sym("unexpected", sym);
  2214. dcl->flags |= ZEND_FFI_DCL_LONG_LONG;
  2215. } else {
  2216. if (dcl->flags & (ZEND_FFI_DCL_TYPE_SPECIFIERS-(ZEND_FFI_DCL_LONG|ZEND_FFI_DCL_SIGNED|ZEND_FFI_DCL_UNSIGNED|ZEND_FFI_DCL_INT|ZEND_FFI_DCL_DOUBLE|ZEND_FFI_DCL_COMPLEX))) yy_error_sym("unexpected", sym);
  2217. dcl->flags |= ZEND_FFI_DCL_LONG;
  2218. }
  2219. sym = get_sym();
  2220. break;
  2221. case YY_FLOAT:
  2222. if (dcl->flags & (ZEND_FFI_DCL_TYPE_SPECIFIERS-(ZEND_FFI_DCL_COMPLEX))) yy_error_sym("unexpected", sym);
  2223. sym = get_sym();
  2224. dcl->flags |= ZEND_FFI_DCL_FLOAT;
  2225. break;
  2226. case YY_DOUBLE:
  2227. if (dcl->flags & (ZEND_FFI_DCL_TYPE_SPECIFIERS-(ZEND_FFI_DCL_LONG|ZEND_FFI_DCL_COMPLEX))) yy_error_sym("unexpected", sym);
  2228. sym = get_sym();
  2229. dcl->flags |= ZEND_FFI_DCL_DOUBLE;
  2230. break;
  2231. case YY_SIGNED:
  2232. if (dcl->flags & (ZEND_FFI_DCL_TYPE_SPECIFIERS-(ZEND_FFI_DCL_CHAR|ZEND_FFI_DCL_SHORT|ZEND_FFI_DCL_LONG|ZEND_FFI_DCL_LONG_LONG|ZEND_FFI_DCL_INT))) yy_error_sym("unexpected", sym);
  2233. sym = get_sym();
  2234. dcl->flags |= ZEND_FFI_DCL_SIGNED;
  2235. break;
  2236. case YY_UNSIGNED:
  2237. if (dcl->flags & (ZEND_FFI_DCL_TYPE_SPECIFIERS-(ZEND_FFI_DCL_CHAR|ZEND_FFI_DCL_SHORT|ZEND_FFI_DCL_LONG|ZEND_FFI_DCL_LONG_LONG|ZEND_FFI_DCL_INT))) yy_error_sym("unexpected", sym);
  2238. sym = get_sym();
  2239. dcl->flags |= ZEND_FFI_DCL_UNSIGNED;
  2240. break;
  2241. case YY__BOOL:
  2242. if (dcl->flags & ZEND_FFI_DCL_TYPE_SPECIFIERS) yy_error_sym("unexpected", sym);
  2243. sym = get_sym();
  2244. dcl->flags |= ZEND_FFI_DCL_BOOL;
  2245. break;
  2246. case YY__COMPLEX:
  2247. case YY_COMPLEX:
  2248. case YY___COMPLEX:
  2249. case YY___COMPLEX__:
  2250. if (dcl->flags & (ZEND_FFI_DCL_TYPE_SPECIFIERS-(ZEND_FFI_DCL_FLOAT|ZEND_FFI_DCL_DOUBLE|ZEND_FFI_DCL_LONG))) yy_error_sym("unexpected", sym);
  2251. sym = get_sym();
  2252. dcl->flags |= ZEND_FFI_DCL_COMPLEX;
  2253. break;
  2254. case YY_STRUCT:
  2255. case YY_UNION:
  2256. if (dcl->flags & ZEND_FFI_DCL_TYPE_SPECIFIERS) yy_error_sym("unexpected", sym);
  2257. sym = parse_struct_or_union_specifier(sym, dcl);
  2258. break;
  2259. case YY_ENUM:
  2260. if (dcl->flags & ZEND_FFI_DCL_TYPE_SPECIFIERS) yy_error_sym("unexpected", sym);
  2261. sym = parse_enum_specifier(sym, dcl);
  2262. break;
  2263. case YY_ID:
  2264. if (dcl->flags & ZEND_FFI_DCL_TYPE_SPECIFIERS) yy_error_sym("unexpected", sym);
  2265. /*redeclaration of '%.*s' ??? */
  2266. sym = parse_ID(sym, &name, &name_len);
  2267. dcl->flags |= ZEND_FFI_DCL_TYPEDEF_NAME;
  2268. zend_ffi_resolve_typedef(name, name_len, dcl);
  2269. break;
  2270. default:
  2271. yy_error_sym("unexpected", sym);
  2272. }
  2273. return sym;
  2274. }
  2275. static int parse_struct_or_union_specifier(int sym, zend_ffi_dcl *dcl) {
  2276. if (sym == YY_STRUCT) {
  2277. sym = get_sym();
  2278. dcl->flags |= ZEND_FFI_DCL_STRUCT;
  2279. } else if (sym == YY_UNION) {
  2280. sym = get_sym();
  2281. dcl->flags |= ZEND_FFI_DCL_UNION;
  2282. } else {
  2283. yy_error_sym("unexpected", sym);
  2284. }
  2285. if (YY_IN_SET(sym, (YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC,YY___CDECL,YY___STDCALL,YY___FASTCALL,YY___THISCALL,YY___VECTORCALL), "\000\000\000\000\000\000\360\017\000\000\000\000\000")) {
  2286. sym = parse_attributes(sym, dcl);
  2287. }
  2288. if (sym == YY_ID) {
  2289. const char *name;
  2290. size_t name_len;
  2291. sym = parse_ID(sym, &name, &name_len);
  2292. zend_ffi_declare_tag(name, name_len, dcl, 1);
  2293. if (sym == YY__LBRACE) {
  2294. sym = parse_struct_contents(sym, dcl);
  2295. zend_ffi_declare_tag(name, name_len, dcl, 0);
  2296. }
  2297. } else if (sym == YY__LBRACE) {
  2298. zend_ffi_make_struct_type(dcl);
  2299. sym = parse_struct_contents(sym, dcl);
  2300. } else {
  2301. yy_error_sym("unexpected", sym);
  2302. }
  2303. return sym;
  2304. }
  2305. static int parse_struct_contents(int sym, zend_ffi_dcl *dcl) {
  2306. int sym2;
  2307. const unsigned char *save_pos;
  2308. const unsigned char *save_text;
  2309. int save_line;
  2310. int alt2;
  2311. if (sym != YY__LBRACE) {
  2312. yy_error_sym("'{' expected, got", sym);
  2313. }
  2314. sym = get_sym();
  2315. if (YY_IN_SET(sym, (YY___EXTENSION__,YY_VOID,YY_CHAR,YY_SHORT,YY_INT,YY_LONG,YY_FLOAT,YY_DOUBLE,YY_SIGNED,YY_UNSIGNED,YY__BOOL,YY__COMPLEX,YY_COMPLEX,YY___COMPLEX,YY___COMPLEX__,YY_STRUCT,YY_UNION,YY_ENUM,YY_ID,YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTRICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC,YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC,YY___CDECL,YY___STDCALL,YY___FASTCALL,YY___THISCALL,YY___VECTORCALL), "\002\000\376\377\377\107\360\017\000\000\000\002\000")) {
  2316. sym = parse_struct_declaration(sym, dcl);
  2317. while (1) {
  2318. save_pos = yy_pos;
  2319. save_text = yy_text;
  2320. save_line = yy_line;
  2321. alt2 = -2;
  2322. sym2 = sym;
  2323. if (sym2 == YY__SEMICOLON) {
  2324. sym2 = get_sym();
  2325. goto _yy_state_2_1;
  2326. } else if (sym2 == YY__RBRACE) {
  2327. alt2 = 6;
  2328. goto _yy_state_2;
  2329. } else {
  2330. yy_error_sym("unexpected", sym2);
  2331. }
  2332. _yy_state_2_1:
  2333. if (YY_IN_SET(sym2, (YY___EXTENSION__,YY_VOID,YY_CHAR,YY_SHORT,YY_INT,YY_LONG,YY_FLOAT,YY_DOUBLE,YY_SIGNED,YY_UNSIGNED,YY__BOOL,YY__COMPLEX,YY_COMPLEX,YY___COMPLEX,YY___COMPLEX__,YY_STRUCT,YY_UNION,YY_ENUM,YY_ID,YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTRICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC,YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC,YY___CDECL,YY___STDCALL,YY___FASTCALL,YY___THISCALL,YY___VECTORCALL), "\002\000\376\377\377\107\360\017\000\000\000\002\000")) {
  2334. alt2 = 3;
  2335. goto _yy_state_2;
  2336. } else if (sym2 == YY__RBRACE) {
  2337. alt2 = 5;
  2338. goto _yy_state_2;
  2339. } else {
  2340. yy_error_sym("unexpected", sym2);
  2341. }
  2342. _yy_state_2:
  2343. yy_pos = save_pos;
  2344. yy_text = save_text;
  2345. yy_line = save_line;
  2346. if (alt2 != 3) {
  2347. break;
  2348. }
  2349. sym = get_sym();
  2350. sym = parse_struct_declaration(sym, dcl);
  2351. }
  2352. if (alt2 == 5) {
  2353. sym = get_sym();
  2354. }
  2355. }
  2356. if (sym != YY__RBRACE) {
  2357. yy_error_sym("'}' expected, got", sym);
  2358. }
  2359. sym = get_sym();
  2360. if (YY_IN_SET(sym, (YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC,YY___CDECL,YY___STDCALL,YY___FASTCALL,YY___THISCALL,YY___VECTORCALL), "\000\000\000\000\000\000\360\017\000\000\000\000\000")) {
  2361. sym = parse_attributes(sym, dcl);
  2362. }
  2363. zend_ffi_adjust_struct_size(dcl);
  2364. return sym;
  2365. }
  2366. static int parse_struct_declaration(int sym, zend_ffi_dcl *struct_dcl) {
  2367. zend_ffi_dcl common_field_dcl = ZEND_FFI_ATTR_INIT;
  2368. sym = parse_specifier_qualifier_list(sym, &common_field_dcl);
  2369. if (sym == YY__SEMICOLON || sym == YY__RBRACE) {
  2370. zend_ffi_add_anonymous_field(struct_dcl, &common_field_dcl);
  2371. } else if (sym == YY__STAR || sym == YY_ID || sym == YY__LPAREN || sym == YY__COLON) {
  2372. sym = parse_struct_declarator(sym, struct_dcl, &common_field_dcl);
  2373. while (sym == YY__COMMA) {
  2374. sym = get_sym();
  2375. zend_ffi_dcl field_dcl = common_field_dcl;
  2376. if (YY_IN_SET(sym, (YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC,YY___CDECL,YY___STDCALL,YY___FASTCALL,YY___THISCALL,YY___VECTORCALL), "\000\000\000\000\000\000\360\017\000\000\000\000\000")) {
  2377. sym = parse_attributes(sym, &field_dcl);
  2378. }
  2379. sym = parse_struct_declarator(sym, struct_dcl, &field_dcl);
  2380. }
  2381. } else {
  2382. yy_error_sym("unexpected", sym);
  2383. }
  2384. return sym;
  2385. }
  2386. static int parse_struct_declarator(int sym, zend_ffi_dcl *struct_dcl, zend_ffi_dcl *field_dcl) {
  2387. const char *name = NULL;
  2388. size_t name_len = 0;
  2389. zend_ffi_val bits;
  2390. if (sym == YY__STAR || sym == YY_ID || sym == YY__LPAREN) {
  2391. sym = parse_declarator(sym, field_dcl, &name, &name_len);
  2392. if (sym == YY__COLON) {
  2393. sym = get_sym();
  2394. sym = parse_constant_expression(sym, &bits);
  2395. if (YY_IN_SET(sym, (YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC,YY___CDECL,YY___STDCALL,YY___FASTCALL,YY___THISCALL,YY___VECTORCALL), "\000\000\000\000\000\000\360\017\000\000\000\000\000")) {
  2396. sym = parse_attributes(sym, field_dcl);
  2397. }
  2398. zend_ffi_add_bit_field(struct_dcl, name, name_len, field_dcl, &bits);
  2399. } else if (YY_IN_SET(sym, (YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC,YY___CDECL,YY___STDCALL,YY___FASTCALL,YY___THISCALL,YY___VECTORCALL,YY__COMMA,YY__SEMICOLON,YY__RBRACE), "\140\000\000\000\000\020\360\017\000\000\000\000\000")) {
  2400. if (YY_IN_SET(sym, (YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC,YY___CDECL,YY___STDCALL,YY___FASTCALL,YY___THISCALL,YY___VECTORCALL), "\000\000\000\000\000\000\360\017\000\000\000\000\000")) {
  2401. sym = parse_attributes(sym, field_dcl);
  2402. }
  2403. zend_ffi_add_field(struct_dcl, name, name_len, field_dcl);
  2404. } else {
  2405. yy_error_sym("unexpected", sym);
  2406. }
  2407. } else if (sym == YY__COLON) {
  2408. sym = get_sym();
  2409. sym = parse_constant_expression(sym, &bits);
  2410. zend_ffi_add_bit_field(struct_dcl, NULL, 0, field_dcl, &bits);
  2411. } else {
  2412. yy_error_sym("unexpected", sym);
  2413. }
  2414. return sym;
  2415. }
  2416. static int parse_enum_specifier(int sym, zend_ffi_dcl *dcl) {
  2417. if (sym != YY_ENUM) {
  2418. yy_error_sym("'enum' expected, got", sym);
  2419. }
  2420. sym = get_sym();
  2421. dcl->flags |= ZEND_FFI_DCL_ENUM;
  2422. if (YY_IN_SET(sym, (YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC,YY___CDECL,YY___STDCALL,YY___FASTCALL,YY___THISCALL,YY___VECTORCALL), "\000\000\000\000\000\000\360\017\000\000\000\000\000")) {
  2423. sym = parse_attributes(sym, dcl);
  2424. }
  2425. if (sym == YY_ID) {
  2426. const char *name;
  2427. size_t name_len;
  2428. sym = parse_ID(sym, &name, &name_len);
  2429. if (sym == YY__LBRACE) {
  2430. zend_ffi_declare_tag(name, name_len, dcl, 0);
  2431. sym = get_sym();
  2432. sym = parse_enumerator_list(sym, dcl);
  2433. if (sym != YY__RBRACE) {
  2434. yy_error_sym("'}' expected, got", sym);
  2435. }
  2436. sym = get_sym();
  2437. if (YY_IN_SET(sym, (YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC,YY___CDECL,YY___STDCALL,YY___FASTCALL,YY___THISCALL,YY___VECTORCALL), "\000\000\000\000\000\000\360\017\000\000\000\000\000")) {
  2438. sym = parse_attributes(sym, dcl);
  2439. }
  2440. } else if (YY_IN_SET(sym, (YY_TYPEDEF,YY_EXTERN,YY_STATIC,YY_AUTO,YY_REGISTER,YY_INLINE,YY___INLINE,YY___INLINE__,YY__NORETURN,YY__ALIGNAS,YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC,YY___CDECL,YY___STDCALL,YY___FASTCALL,YY___THISCALL,YY___VECTORCALL,YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTRICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC,YY_VOID,YY_CHAR,YY_SHORT,YY_INT,YY_LONG,YY_FLOAT,YY_DOUBLE,YY_SIGNED,YY_UNSIGNED,YY__BOOL,YY__COMPLEX,YY_COMPLEX,YY___COMPLEX,YY___COMPLEX__,YY_STRUCT,YY_UNION,YY_ENUM,YY_ID,YY__STAR,YY__LPAREN,YY__SEMICOLON,YY__COLON,YY__LBRACK,YY__RBRACE,YY__COMMA,YY__RPAREN,YY_EOF), "\371\377\377\377\377\167\363\017\000\000\000\002\000")) {
  2441. zend_ffi_declare_tag(name, name_len, dcl, 1);
  2442. } else {
  2443. yy_error_sym("unexpected", sym);
  2444. }
  2445. } else if (sym == YY__LBRACE) {
  2446. sym = get_sym();
  2447. zend_ffi_make_enum_type(dcl);
  2448. sym = parse_enumerator_list(sym, dcl);
  2449. if (sym != YY__RBRACE) {
  2450. yy_error_sym("'}' expected, got", sym);
  2451. }
  2452. sym = get_sym();
  2453. if (YY_IN_SET(sym, (YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC,YY___CDECL,YY___STDCALL,YY___FASTCALL,YY___THISCALL,YY___VECTORCALL), "\000\000\000\000\000\000\360\017\000\000\000\000\000")) {
  2454. sym = parse_attributes(sym, dcl);
  2455. }
  2456. } else {
  2457. yy_error_sym("unexpected", sym);
  2458. }
  2459. return sym;
  2460. }
  2461. static int parse_enumerator_list(int sym, zend_ffi_dcl *enum_dcl) {
  2462. int sym2;
  2463. const unsigned char *save_pos;
  2464. const unsigned char *save_text;
  2465. int save_line;
  2466. int alt250;
  2467. int64_t min = 0, max = 0, last = -1;
  2468. sym = parse_enumerator(sym, enum_dcl, &min, &max, &last);
  2469. while (1) {
  2470. save_pos = yy_pos;
  2471. save_text = yy_text;
  2472. save_line = yy_line;
  2473. alt250 = -2;
  2474. sym2 = sym;
  2475. if (sym2 == YY__COMMA) {
  2476. sym2 = get_sym();
  2477. goto _yy_state_250_1;
  2478. } else if (sym2 == YY__RBRACE) {
  2479. alt250 = -1;
  2480. goto _yy_state_250;
  2481. } else {
  2482. yy_error_sym("unexpected", sym2);
  2483. }
  2484. _yy_state_250_1:
  2485. if (sym2 == YY_ID) {
  2486. alt250 = 251;
  2487. goto _yy_state_250;
  2488. } else if (sym2 == YY__RBRACE) {
  2489. alt250 = 253;
  2490. goto _yy_state_250;
  2491. } else {
  2492. yy_error_sym("unexpected", sym2);
  2493. }
  2494. _yy_state_250:
  2495. yy_pos = save_pos;
  2496. yy_text = save_text;
  2497. yy_line = save_line;
  2498. if (alt250 != 251) {
  2499. break;
  2500. }
  2501. sym = get_sym();
  2502. sym = parse_enumerator(sym, enum_dcl, &min, &max, &last);
  2503. }
  2504. if (alt250 == 253) {
  2505. sym = get_sym();
  2506. }
  2507. return sym;
  2508. }
  2509. static int parse_enumerator(int sym, zend_ffi_dcl *enum_dcl, int64_t *min, int64_t *max, int64_t *last) {
  2510. const char *name;
  2511. size_t name_len;
  2512. zend_ffi_val val = {.kind = ZEND_FFI_VAL_EMPTY};
  2513. sym = parse_ID(sym, &name, &name_len);
  2514. if (sym == YY__EQUAL) {
  2515. sym = get_sym();
  2516. sym = parse_constant_expression(sym, &val);
  2517. }
  2518. zend_ffi_add_enum_val(enum_dcl, name, name_len, &val, min, max, last);
  2519. return sym;
  2520. }
  2521. static int parse_declarator(int sym, zend_ffi_dcl *dcl, const char **name, size_t *name_len) {
  2522. zend_ffi_dcl nested_dcl = {ZEND_FFI_DCL_CHAR, 0, 0, 0, NULL};
  2523. bool nested = 0;
  2524. if (sym == YY__STAR) {
  2525. sym = parse_pointer(sym, dcl);
  2526. }
  2527. if (sym == YY_ID) {
  2528. sym = parse_ID(sym, name, name_len);
  2529. } else if (sym == YY__LPAREN) {
  2530. sym = get_sym();
  2531. if (YY_IN_SET(sym, (YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC,YY___CDECL,YY___STDCALL,YY___FASTCALL,YY___THISCALL,YY___VECTORCALL), "\000\000\000\000\000\000\360\017\000\000\000\000\000")) {
  2532. sym = parse_attributes(sym, &nested_dcl);
  2533. }
  2534. sym = parse_declarator(sym, &nested_dcl, name, name_len);
  2535. if (sym != YY__RPAREN) {
  2536. yy_error_sym("')' expected, got", sym);
  2537. }
  2538. sym = get_sym();
  2539. nested = 1;
  2540. } else {
  2541. yy_error_sym("unexpected", sym);
  2542. }
  2543. if (sym == YY__LBRACK || sym == YY__LPAREN) {
  2544. sym = parse_array_or_function_declarators(sym, dcl, &nested_dcl);
  2545. }
  2546. if (nested) zend_ffi_nested_declaration(dcl, &nested_dcl);
  2547. return sym;
  2548. }
  2549. static int parse_abstract_declarator(int sym, zend_ffi_dcl *dcl) {
  2550. zend_ffi_dcl nested_dcl = {ZEND_FFI_DCL_CHAR, 0, 0, 0, NULL};
  2551. bool nested = 0;
  2552. if (sym == YY__STAR) {
  2553. sym = parse_pointer(sym, dcl);
  2554. }
  2555. if ((sym == YY__LPAREN) && synpred_2(sym)) {
  2556. sym = get_sym();
  2557. if (YY_IN_SET(sym, (YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC,YY___CDECL,YY___STDCALL,YY___FASTCALL,YY___THISCALL,YY___VECTORCALL), "\000\000\000\000\000\000\360\017\000\000\000\000\000")) {
  2558. sym = parse_attributes(sym, &nested_dcl);
  2559. }
  2560. sym = parse_abstract_declarator(sym, &nested_dcl);
  2561. if (sym != YY__RPAREN) {
  2562. yy_error_sym("')' expected, got", sym);
  2563. }
  2564. sym = get_sym();
  2565. nested = 1;
  2566. }
  2567. if (sym == YY__LBRACK || sym == YY__LPAREN) {
  2568. sym = parse_array_or_function_declarators(sym, dcl, &nested_dcl);
  2569. }
  2570. if (nested) zend_ffi_nested_declaration(dcl, &nested_dcl);
  2571. return sym;
  2572. }
  2573. static int parse_parameter_declarator(int sym, zend_ffi_dcl *dcl, const char **name, size_t *name_len) {
  2574. zend_ffi_dcl nested_dcl = {ZEND_FFI_DCL_CHAR, 0, 0, 0, NULL};
  2575. bool nested = 0;
  2576. if (sym == YY__STAR) {
  2577. sym = parse_pointer(sym, dcl);
  2578. }
  2579. if ((sym == YY__LPAREN) && synpred_3(sym)) {
  2580. sym = get_sym();
  2581. if (YY_IN_SET(sym, (YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC,YY___CDECL,YY___STDCALL,YY___FASTCALL,YY___THISCALL,YY___VECTORCALL), "\000\000\000\000\000\000\360\017\000\000\000\000\000")) {
  2582. sym = parse_attributes(sym, &nested_dcl);
  2583. }
  2584. sym = parse_parameter_declarator(sym, &nested_dcl, name, name_len);
  2585. if (sym != YY__RPAREN) {
  2586. yy_error_sym("')' expected, got", sym);
  2587. }
  2588. sym = get_sym();
  2589. nested = 1;
  2590. } else if (sym == YY_ID) {
  2591. sym = parse_ID(sym, name, name_len);
  2592. } else if (sym == YY__LBRACK || sym == YY__LPAREN || sym == YY__RPAREN || sym == YY__COMMA) {
  2593. } else {
  2594. yy_error_sym("unexpected", sym);
  2595. }
  2596. if (sym == YY__LBRACK || sym == YY__LPAREN) {
  2597. sym = parse_array_or_function_declarators(sym, dcl, &nested_dcl);
  2598. }
  2599. if (nested) zend_ffi_nested_declaration(dcl, &nested_dcl);
  2600. return sym;
  2601. }
  2602. static int parse_pointer(int sym, zend_ffi_dcl *dcl) {
  2603. if (sym != YY__STAR) {
  2604. yy_error_sym("'*' expected, got", sym);
  2605. }
  2606. do {
  2607. sym = get_sym();
  2608. zend_ffi_make_pointer_type(dcl);
  2609. if (YY_IN_SET(sym, (YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTRICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC,YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC,YY___CDECL,YY___STDCALL,YY___FASTCALL,YY___THISCALL,YY___VECTORCALL), "\000\000\376\007\000\000\360\017\000\000\000\000\000")) {
  2610. sym = parse_type_qualifier_list(sym, dcl);
  2611. }
  2612. } while (sym == YY__STAR);
  2613. return sym;
  2614. }
  2615. static int parse_array_or_function_declarators(int sym, zend_ffi_dcl *dcl, zend_ffi_dcl *nested_dcl) {
  2616. int sym2;
  2617. const unsigned char *save_pos;
  2618. const unsigned char *save_text;
  2619. int save_line;
  2620. int alt109;
  2621. int alt105;
  2622. int alt119;
  2623. zend_ffi_dcl dummy = ZEND_FFI_ATTR_INIT;
  2624. zend_ffi_val len = {.kind = ZEND_FFI_VAL_EMPTY};
  2625. HashTable *args = NULL;
  2626. uint32_t attr = 0;
  2627. if (sym == YY__LBRACK) {
  2628. sym = get_sym();
  2629. save_pos = yy_pos;
  2630. save_text = yy_text;
  2631. save_line = yy_line;
  2632. alt105 = -2;
  2633. sym2 = sym;
  2634. if (sym2 == YY_STATIC) {
  2635. alt105 = 106;
  2636. goto _yy_state_105;
  2637. } else if (YY_IN_SET(sym2, (YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTRICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC,YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC,YY___CDECL,YY___STDCALL,YY___FASTCALL,YY___THISCALL,YY___VECTORCALL), "\000\000\376\007\000\000\360\017\000\000\000\000\000")) {
  2638. alt105 = 109;
  2639. goto _yy_state_105;
  2640. } else if (sym2 == YY__STAR) {
  2641. sym2 = get_sym();
  2642. goto _yy_state_105_20;
  2643. } else if (YY_IN_SET(sym2, (YY__LPAREN,YY__PLUS_PLUS,YY__MINUS_MINUS,YY__AND,YY__PLUS,YY__MINUS,YY__TILDE,YY__BANG,YY_SIZEOF,YY__ALIGNOF,YY___ALIGNOF,YY___ALIGNOF__,YY_ID,YY_OCTNUMBER,YY_DECNUMBER,YY_HEXNUMBER,YY_FLOATNUMBER,YY_STRING,YY_CHARACTER), "\010\000\000\000\000\000\000\000\004\030\377\376\000")) {
  2644. alt105 = 115;
  2645. goto _yy_state_105;
  2646. } else if (sym2 == YY__RBRACK) {
  2647. alt105 = 116;
  2648. goto _yy_state_105;
  2649. } else {
  2650. yy_error_sym("unexpected", sym2);
  2651. }
  2652. _yy_state_105_20:
  2653. if (sym2 == YY__RBRACK) {
  2654. alt105 = 114;
  2655. goto _yy_state_105;
  2656. } else if (YY_IN_SET(sym2, (YY__LPAREN,YY__PLUS_PLUS,YY__MINUS_MINUS,YY__AND,YY__PLUS,YY__MINUS,YY__TILDE,YY__BANG,YY_SIZEOF,YY__ALIGNOF,YY___ALIGNOF,YY___ALIGNOF__,YY_ID,YY_OCTNUMBER,YY_DECNUMBER,YY_HEXNUMBER,YY_FLOATNUMBER,YY_STRING,YY_CHARACTER,YY__STAR), "\010\000\000\000\000\000\001\000\004\030\377\376\000")) {
  2657. alt105 = 115;
  2658. goto _yy_state_105;
  2659. } else {
  2660. yy_error_sym("unexpected", sym2);
  2661. }
  2662. _yy_state_105:
  2663. yy_pos = save_pos;
  2664. yy_text = save_text;
  2665. yy_line = save_line;
  2666. if (alt105 == 106) {
  2667. sym = get_sym();
  2668. if (YY_IN_SET(sym, (YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTRICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC,YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC,YY___CDECL,YY___STDCALL,YY___FASTCALL,YY___THISCALL,YY___VECTORCALL), "\000\000\376\007\000\000\360\017\000\000\000\000\000")) {
  2669. sym = parse_type_qualifier_list(sym, &dummy);
  2670. }
  2671. sym = parse_assignment_expression(sym, &len);
  2672. } else if (alt105 == 109) {
  2673. sym = parse_type_qualifier_list(sym, &dummy);
  2674. save_pos = yy_pos;
  2675. save_text = yy_text;
  2676. save_line = yy_line;
  2677. alt109 = -2;
  2678. sym2 = sym;
  2679. if (sym2 == YY_STATIC) {
  2680. alt109 = 110;
  2681. goto _yy_state_109;
  2682. } else if (sym2 == YY__STAR) {
  2683. sym2 = get_sym();
  2684. goto _yy_state_109_2;
  2685. } else if (YY_IN_SET(sym2, (YY__LPAREN,YY__PLUS_PLUS,YY__MINUS_MINUS,YY__AND,YY__PLUS,YY__MINUS,YY__TILDE,YY__BANG,YY_SIZEOF,YY__ALIGNOF,YY___ALIGNOF,YY___ALIGNOF__,YY_ID,YY_OCTNUMBER,YY_DECNUMBER,YY_HEXNUMBER,YY_FLOATNUMBER,YY_STRING,YY_CHARACTER), "\010\000\000\000\000\000\000\000\004\030\377\376\000")) {
  2686. alt109 = 113;
  2687. goto _yy_state_109;
  2688. } else if (sym2 == YY__RBRACK) {
  2689. alt109 = 116;
  2690. goto _yy_state_109;
  2691. } else {
  2692. yy_error_sym("unexpected", sym2);
  2693. }
  2694. _yy_state_109_2:
  2695. if (sym2 == YY__RBRACK) {
  2696. alt109 = 112;
  2697. goto _yy_state_109;
  2698. } else if (YY_IN_SET(sym2, (YY__LPAREN,YY__PLUS_PLUS,YY__MINUS_MINUS,YY__AND,YY__PLUS,YY__MINUS,YY__TILDE,YY__BANG,YY_SIZEOF,YY__ALIGNOF,YY___ALIGNOF,YY___ALIGNOF__,YY_ID,YY_OCTNUMBER,YY_DECNUMBER,YY_HEXNUMBER,YY_FLOATNUMBER,YY_STRING,YY_CHARACTER,YY__STAR), "\010\000\000\000\000\000\001\000\004\030\377\376\000")) {
  2699. alt109 = 113;
  2700. goto _yy_state_109;
  2701. } else {
  2702. yy_error_sym("unexpected", sym2);
  2703. }
  2704. _yy_state_109:
  2705. yy_pos = save_pos;
  2706. yy_text = save_text;
  2707. yy_line = save_line;
  2708. if (alt109 == 110) {
  2709. sym = get_sym();
  2710. sym = parse_assignment_expression(sym, &len);
  2711. } else if (alt109 == 116) {
  2712. attr |= ZEND_FFI_ATTR_INCOMPLETE_ARRAY;
  2713. } else if (alt109 == 112) {
  2714. sym = get_sym();
  2715. attr |= ZEND_FFI_ATTR_VLA;
  2716. } else if (alt109 == 113) {
  2717. sym = parse_assignment_expression(sym, &len);
  2718. } else {
  2719. yy_error_sym("unexpected", sym);
  2720. }
  2721. } else if (alt105 == 116 || alt105 == 114 || alt105 == 115) {
  2722. if (alt105 == 116) {
  2723. attr |= ZEND_FFI_ATTR_INCOMPLETE_ARRAY;
  2724. } else if (alt105 == 114) {
  2725. sym = get_sym();
  2726. attr |= ZEND_FFI_ATTR_VLA;
  2727. } else {
  2728. sym = parse_assignment_expression(sym, &len);
  2729. }
  2730. } else {
  2731. yy_error_sym("unexpected", sym);
  2732. }
  2733. if (sym != YY__RBRACK) {
  2734. yy_error_sym("']' expected, got", sym);
  2735. }
  2736. sym = get_sym();
  2737. if (sym == YY__LBRACK || sym == YY__LPAREN) {
  2738. sym = parse_array_or_function_declarators(sym, dcl, nested_dcl);
  2739. }
  2740. dcl->attr |= attr;
  2741. zend_ffi_make_array_type(dcl, &len);
  2742. } else if (sym == YY__LPAREN) {
  2743. sym = get_sym();
  2744. if (YY_IN_SET(sym, (YY___EXTENSION__,YY_VOID,YY_CHAR,YY_SHORT,YY_INT,YY_LONG,YY_FLOAT,YY_DOUBLE,YY_SIGNED,YY_UNSIGNED,YY__BOOL,YY__COMPLEX,YY_COMPLEX,YY___COMPLEX,YY___COMPLEX__,YY_STRUCT,YY_UNION,YY_ENUM,YY_ID,YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTRICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC,YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC,YY___CDECL,YY___STDCALL,YY___FASTCALL,YY___THISCALL,YY___VECTORCALL,YY__POINT_POINT_POINT), "\002\000\376\377\377\107\370\017\000\000\000\002\000")) {
  2745. if (YY_IN_SET(sym, (YY___EXTENSION__,YY_VOID,YY_CHAR,YY_SHORT,YY_INT,YY_LONG,YY_FLOAT,YY_DOUBLE,YY_SIGNED,YY_UNSIGNED,YY__BOOL,YY__COMPLEX,YY_COMPLEX,YY___COMPLEX,YY___COMPLEX__,YY_STRUCT,YY_UNION,YY_ENUM,YY_ID,YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTRICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC,YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC,YY___CDECL,YY___STDCALL,YY___FASTCALL,YY___THISCALL,YY___VECTORCALL), "\002\000\376\377\377\107\360\017\000\000\000\002\000")) {
  2746. sym = parse_parameter_declaration(sym, &args);
  2747. while (1) {
  2748. save_pos = yy_pos;
  2749. save_text = yy_text;
  2750. save_line = yy_line;
  2751. alt119 = -2;
  2752. sym2 = sym;
  2753. if (sym2 == YY__COMMA) {
  2754. sym2 = get_sym();
  2755. goto _yy_state_119_1;
  2756. } else if (sym2 == YY__RPAREN) {
  2757. alt119 = 125;
  2758. goto _yy_state_119;
  2759. } else {
  2760. yy_error_sym("unexpected", sym2);
  2761. }
  2762. _yy_state_119_1:
  2763. if (YY_IN_SET(sym2, (YY___EXTENSION__,YY_VOID,YY_CHAR,YY_SHORT,YY_INT,YY_LONG,YY_FLOAT,YY_DOUBLE,YY_SIGNED,YY_UNSIGNED,YY__BOOL,YY__COMPLEX,YY_COMPLEX,YY___COMPLEX,YY___COMPLEX__,YY_STRUCT,YY_UNION,YY_ENUM,YY_ID,YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTRICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC,YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC,YY___CDECL,YY___STDCALL,YY___FASTCALL,YY___THISCALL,YY___VECTORCALL), "\002\000\376\377\377\107\360\017\000\000\000\002\000")) {
  2764. alt119 = 120;
  2765. goto _yy_state_119;
  2766. } else if (sym2 == YY__POINT_POINT_POINT) {
  2767. alt119 = 122;
  2768. goto _yy_state_119;
  2769. } else {
  2770. yy_error_sym("unexpected", sym2);
  2771. }
  2772. _yy_state_119:
  2773. yy_pos = save_pos;
  2774. yy_text = save_text;
  2775. yy_line = save_line;
  2776. if (alt119 != 120) {
  2777. break;
  2778. }
  2779. sym = get_sym();
  2780. sym = parse_parameter_declaration(sym, &args);
  2781. }
  2782. if (alt119 == 122) {
  2783. sym = get_sym();
  2784. if (sym != YY__POINT_POINT_POINT) {
  2785. yy_error_sym("'...' expected, got", sym);
  2786. }
  2787. sym = get_sym();
  2788. attr |= ZEND_FFI_ATTR_VARIADIC;
  2789. }
  2790. } else {
  2791. sym = get_sym();
  2792. attr |= ZEND_FFI_ATTR_VARIADIC;
  2793. }
  2794. }
  2795. if (sym != YY__RPAREN) {
  2796. yy_error_sym("')' expected, got", sym);
  2797. }
  2798. sym = get_sym();
  2799. if (sym == YY__LBRACK || sym == YY__LPAREN) {
  2800. sym = parse_array_or_function_declarators(sym, dcl, nested_dcl);
  2801. }
  2802. dcl->attr |= attr;
  2803. zend_ffi_make_func_type(dcl, args, nested_dcl);
  2804. } else {
  2805. yy_error_sym("unexpected", sym);
  2806. }
  2807. return sym;
  2808. }
  2809. static int parse_parameter_declaration(int sym, HashTable **args) {
  2810. const char *name = NULL;
  2811. size_t name_len = 0;
  2812. bool old_allow_vla = FFI_G(allow_vla);
  2813. FFI_G(allow_vla) = 1;
  2814. zend_ffi_dcl param_dcl = ZEND_FFI_ATTR_INIT;
  2815. sym = parse_specifier_qualifier_list(sym, &param_dcl);
  2816. sym = parse_parameter_declarator(sym, &param_dcl, &name, &name_len);
  2817. zend_ffi_add_arg(args, name, name_len, &param_dcl);
  2818. FFI_G(allow_vla) = old_allow_vla;
  2819. return sym;
  2820. }
  2821. static int parse_type_name(int sym, zend_ffi_dcl *dcl) {
  2822. sym = parse_specifier_qualifier_list(sym, dcl);
  2823. sym = parse_abstract_declarator(sym, dcl);
  2824. return sym;
  2825. }
  2826. static int parse_attributes(int sym, zend_ffi_dcl *dcl) {
  2827. const char *name;
  2828. size_t name_len;
  2829. zend_ffi_val val;
  2830. do {
  2831. switch (sym) {
  2832. case YY___ATTRIBUTE:
  2833. case YY___ATTRIBUTE__:
  2834. sym = get_sym();
  2835. if (sym != YY__LPAREN) {
  2836. yy_error_sym("'(' expected, got", sym);
  2837. }
  2838. sym = get_sym();
  2839. if (sym != YY__LPAREN) {
  2840. yy_error_sym("'(' expected, got", sym);
  2841. }
  2842. sym = get_sym();
  2843. sym = parse_attrib(sym, dcl);
  2844. while (sym == YY__COMMA) {
  2845. sym = get_sym();
  2846. sym = parse_attrib(sym, dcl);
  2847. }
  2848. if (sym != YY__RPAREN) {
  2849. yy_error_sym("')' expected, got", sym);
  2850. }
  2851. sym = get_sym();
  2852. if (sym != YY__RPAREN) {
  2853. yy_error_sym("')' expected, got", sym);
  2854. }
  2855. sym = get_sym();
  2856. break;
  2857. case YY___DECLSPEC:
  2858. sym = get_sym();
  2859. if (sym != YY__LPAREN) {
  2860. yy_error_sym("'(' expected, got", sym);
  2861. }
  2862. sym = get_sym();
  2863. do {
  2864. sym = parse_ID(sym, &name, &name_len);
  2865. if (sym == YY__LPAREN) {
  2866. sym = get_sym();
  2867. sym = parse_assignment_expression(sym, &val);
  2868. zend_ffi_add_msvc_attribute_value(dcl, name, name_len, &val);
  2869. if (sym != YY__RPAREN) {
  2870. yy_error_sym("')' expected, got", sym);
  2871. }
  2872. sym = get_sym();
  2873. }
  2874. } while (sym == YY_ID);
  2875. if (sym != YY__RPAREN) {
  2876. yy_error_sym("')' expected, got", sym);
  2877. }
  2878. sym = get_sym();
  2879. break;
  2880. case YY___CDECL:
  2881. sym = get_sym();
  2882. zend_ffi_set_abi(dcl, ZEND_FFI_ABI_CDECL);
  2883. break;
  2884. case YY___STDCALL:
  2885. sym = get_sym();
  2886. zend_ffi_set_abi(dcl, ZEND_FFI_ABI_STDCALL);
  2887. break;
  2888. case YY___FASTCALL:
  2889. sym = get_sym();
  2890. zend_ffi_set_abi(dcl, ZEND_FFI_ABI_FASTCALL);
  2891. break;
  2892. case YY___THISCALL:
  2893. sym = get_sym();
  2894. zend_ffi_set_abi(dcl, ZEND_FFI_ABI_THISCALL);
  2895. break;
  2896. case YY___VECTORCALL:
  2897. sym = get_sym();
  2898. zend_ffi_set_abi(dcl, ZEND_FFI_ABI_VECTORCALL);
  2899. break;
  2900. default:
  2901. yy_error_sym("unexpected", sym);
  2902. }
  2903. } while (YY_IN_SET(sym, (YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC,YY___CDECL,YY___STDCALL,YY___FASTCALL,YY___THISCALL,YY___VECTORCALL), "\000\000\000\000\000\000\360\017\000\000\000\000\000"));
  2904. return sym;
  2905. }
  2906. static int parse_attrib(int sym, zend_ffi_dcl *dcl) {
  2907. const char *name;
  2908. size_t name_len;
  2909. int n;
  2910. zend_ffi_val val;
  2911. bool orig_attribute_parsing;
  2912. if (sym == YY_ID || sym == YY_CONST || sym == YY___CONST || sym == YY___CONST__) {
  2913. if (sym == YY_ID) {
  2914. sym = parse_ID(sym, &name, &name_len);
  2915. if (sym == YY__COMMA || sym == YY__RPAREN) {
  2916. zend_ffi_add_attribute(dcl, name, name_len);
  2917. } else if (sym == YY__LPAREN) {
  2918. sym = get_sym();
  2919. orig_attribute_parsing = FFI_G(attribute_parsing);
  2920. FFI_G(attribute_parsing) = 1;
  2921. sym = parse_assignment_expression(sym, &val);
  2922. zend_ffi_add_attribute_value(dcl, name, name_len, 0, &val);
  2923. n = 0;
  2924. while (sym == YY__COMMA) {
  2925. sym = get_sym();
  2926. sym = parse_assignment_expression(sym, &val);
  2927. zend_ffi_add_attribute_value(dcl, name, name_len, ++n, &val);
  2928. }
  2929. FFI_G(attribute_parsing) = orig_attribute_parsing;
  2930. if (sym != YY__RPAREN) {
  2931. yy_error_sym("')' expected, got", sym);
  2932. }
  2933. sym = get_sym();
  2934. } else {
  2935. yy_error_sym("unexpected", sym);
  2936. }
  2937. } else if (sym == YY_CONST) {
  2938. sym = get_sym();
  2939. } else if (sym == YY___CONST) {
  2940. sym = get_sym();
  2941. } else {
  2942. sym = get_sym();
  2943. }
  2944. }
  2945. return sym;
  2946. }
  2947. static int parse_initializer(int sym) {
  2948. int sym2;
  2949. const unsigned char *save_pos;
  2950. const unsigned char *save_text;
  2951. int save_line;
  2952. int alt343;
  2953. zend_ffi_val dummy;
  2954. if (sym != YY__EQUAL) {
  2955. yy_error_sym("'=' expected, got", sym);
  2956. }
  2957. sym = get_sym();
  2958. if (YY_IN_SET(sym, (YY__LPAREN,YY_ID,YY_OCTNUMBER,YY_DECNUMBER,YY_HEXNUMBER,YY_FLOATNUMBER,YY_STRING,YY_CHARACTER,YY__PLUS_PLUS,YY__MINUS_MINUS,YY__AND,YY__STAR,YY__PLUS,YY__MINUS,YY__TILDE,YY__BANG,YY_SIZEOF,YY__ALIGNOF,YY___ALIGNOF,YY___ALIGNOF__), "\010\000\000\000\000\000\001\000\004\030\377\376\000")) {
  2959. sym = parse_assignment_expression(sym, &dummy);
  2960. } else if (sym == YY__LBRACE) {
  2961. sym = get_sym();
  2962. if (sym == YY__LBRACK || sym == YY__POINT) {
  2963. sym = parse_designation(sym);
  2964. }
  2965. sym = parse_initializer(sym);
  2966. while (1) {
  2967. save_pos = yy_pos;
  2968. save_text = yy_text;
  2969. save_line = yy_line;
  2970. alt343 = -2;
  2971. sym2 = sym;
  2972. if (sym2 == YY__COMMA) {
  2973. sym2 = get_sym();
  2974. goto _yy_state_343_1;
  2975. } else if (sym2 == YY__RBRACE) {
  2976. alt343 = 348;
  2977. goto _yy_state_343;
  2978. } else {
  2979. yy_error_sym("unexpected", sym2);
  2980. }
  2981. _yy_state_343_1:
  2982. if (sym2 == YY__LBRACK || sym2 == YY__POINT || sym2 == YY__EQUAL) {
  2983. alt343 = 344;
  2984. goto _yy_state_343;
  2985. } else if (sym2 == YY__RBRACE) {
  2986. alt343 = 347;
  2987. goto _yy_state_343;
  2988. } else {
  2989. yy_error_sym("unexpected", sym2);
  2990. }
  2991. _yy_state_343:
  2992. yy_pos = save_pos;
  2993. yy_text = save_text;
  2994. yy_line = save_line;
  2995. if (alt343 != 344) {
  2996. break;
  2997. }
  2998. sym = get_sym();
  2999. if (sym == YY__LBRACK || sym == YY__POINT) {
  3000. sym = parse_designation(sym);
  3001. }
  3002. sym = parse_initializer(sym);
  3003. }
  3004. if (alt343 == 347) {
  3005. sym = get_sym();
  3006. }
  3007. if (sym != YY__RBRACE) {
  3008. yy_error_sym("'}' expected, got", sym);
  3009. }
  3010. sym = get_sym();
  3011. } else {
  3012. yy_error_sym("unexpected", sym);
  3013. }
  3014. return sym;
  3015. }
  3016. static int parse_designation(int sym) {
  3017. const char *name;
  3018. size_t name_len;
  3019. zend_ffi_val dummy;
  3020. do {
  3021. if (sym == YY__LBRACK) {
  3022. sym = get_sym();
  3023. sym = parse_constant_expression(sym, &dummy);
  3024. if (sym != YY__RBRACK) {
  3025. yy_error_sym("']' expected, got", sym);
  3026. }
  3027. sym = get_sym();
  3028. } else if (sym == YY__POINT) {
  3029. sym = get_sym();
  3030. sym = parse_ID(sym, &name, &name_len);
  3031. } else {
  3032. yy_error_sym("unexpected", sym);
  3033. }
  3034. } while (sym == YY__LBRACK || sym == YY__POINT);
  3035. if (sym != YY__EQUAL) {
  3036. yy_error_sym("'=' expected, got", sym);
  3037. }
  3038. sym = get_sym();
  3039. return sym;
  3040. }
  3041. static int parse_expr_list(int sym) {
  3042. zend_ffi_val dummy;
  3043. sym = parse_assignment_expression(sym, &dummy);
  3044. while (sym == YY__COMMA) {
  3045. sym = get_sym();
  3046. sym = parse_assignment_expression(sym, &dummy);
  3047. }
  3048. return sym;
  3049. }
  3050. static int parse_expression(int sym, zend_ffi_val *val) {
  3051. sym = parse_assignment_expression(sym, val);
  3052. while (sym == YY__COMMA) {
  3053. sym = get_sym();
  3054. sym = parse_assignment_expression(sym, val);
  3055. }
  3056. return sym;
  3057. }
  3058. static int parse_assignment_expression(int sym, zend_ffi_val *val) {
  3059. sym = parse_conditional_expression(sym, val);
  3060. return sym;
  3061. }
  3062. static int parse_constant_expression(int sym, zend_ffi_val *val) {
  3063. sym = parse_conditional_expression(sym, val);
  3064. return sym;
  3065. }
  3066. static int parse_conditional_expression(int sym, zend_ffi_val *val) {
  3067. zend_ffi_val op2, op3;
  3068. sym = parse_logical_or_expression(sym, val);
  3069. if (sym == YY__QUERY) {
  3070. sym = get_sym();
  3071. sym = parse_expression(sym, &op2);
  3072. if (sym != YY__COLON) {
  3073. yy_error_sym("':' expected, got", sym);
  3074. }
  3075. sym = get_sym();
  3076. sym = parse_conditional_expression(sym, &op3);
  3077. zend_ffi_expr_conditional(val, &op2, &op3);
  3078. }
  3079. return sym;
  3080. }
  3081. static int parse_logical_or_expression(int sym, zend_ffi_val *val) {
  3082. zend_ffi_val op2;
  3083. sym = parse_logical_and_expression(sym, val);
  3084. while (sym == YY__BAR_BAR) {
  3085. sym = get_sym();
  3086. sym = parse_logical_and_expression(sym, &op2);
  3087. zend_ffi_expr_bool_or(val, &op2);
  3088. }
  3089. return sym;
  3090. }
  3091. static int parse_logical_and_expression(int sym, zend_ffi_val *val) {
  3092. zend_ffi_val op2;
  3093. sym = parse_inclusive_or_expression(sym, val);
  3094. while (sym == YY__AND_AND) {
  3095. sym = get_sym();
  3096. sym = parse_inclusive_or_expression(sym, &op2);
  3097. zend_ffi_expr_bool_and(val, &op2);
  3098. }
  3099. return sym;
  3100. }
  3101. static int parse_inclusive_or_expression(int sym, zend_ffi_val *val) {
  3102. zend_ffi_val op2;
  3103. sym = parse_exclusive_or_expression(sym, val);
  3104. while (sym == YY__BAR) {
  3105. sym = get_sym();
  3106. sym = parse_exclusive_or_expression(sym, &op2);
  3107. zend_ffi_expr_bw_or(val, &op2);
  3108. }
  3109. return sym;
  3110. }
  3111. static int parse_exclusive_or_expression(int sym, zend_ffi_val *val) {
  3112. zend_ffi_val op2;
  3113. sym = parse_and_expression(sym, val);
  3114. while (sym == YY__UPARROW) {
  3115. sym = get_sym();
  3116. sym = parse_and_expression(sym, &op2);
  3117. zend_ffi_expr_bw_xor(val, &op2);
  3118. }
  3119. return sym;
  3120. }
  3121. static int parse_and_expression(int sym, zend_ffi_val *val) {
  3122. zend_ffi_val op2;
  3123. sym = parse_equality_expression(sym, val);
  3124. while (sym == YY__AND) {
  3125. sym = get_sym();
  3126. sym = parse_equality_expression(sym, &op2);
  3127. zend_ffi_expr_bw_and(val, &op2);
  3128. }
  3129. return sym;
  3130. }
  3131. static int parse_equality_expression(int sym, zend_ffi_val *val) {
  3132. zend_ffi_val op2;
  3133. sym = parse_relational_expression(sym, val);
  3134. while (sym == YY__EQUAL_EQUAL || sym == YY__BANG_EQUAL) {
  3135. if (sym == YY__EQUAL_EQUAL) {
  3136. sym = get_sym();
  3137. sym = parse_relational_expression(sym, &op2);
  3138. zend_ffi_expr_is_equal(val, &op2);
  3139. } else {
  3140. sym = get_sym();
  3141. sym = parse_relational_expression(sym, &op2);
  3142. zend_ffi_expr_is_not_equal(val, &op2);
  3143. }
  3144. }
  3145. return sym;
  3146. }
  3147. static int parse_relational_expression(int sym, zend_ffi_val *val) {
  3148. zend_ffi_val op2;
  3149. sym = parse_shift_expression(sym, val);
  3150. while (sym == YY__LESS || sym == YY__GREATER || sym == YY__LESS_EQUAL || sym == YY__GREATER_EQUAL) {
  3151. if (sym == YY__LESS) {
  3152. sym = get_sym();
  3153. sym = parse_shift_expression(sym, &op2);
  3154. zend_ffi_expr_is_less(val, &op2);
  3155. } else if (sym == YY__GREATER) {
  3156. sym = get_sym();
  3157. sym = parse_shift_expression(sym, &op2);
  3158. zend_ffi_expr_is_greater(val, &op2);
  3159. } else if (sym == YY__LESS_EQUAL) {
  3160. sym = get_sym();
  3161. sym = parse_shift_expression(sym, &op2);
  3162. zend_ffi_expr_is_less_or_equal(val, &op2);
  3163. } else {
  3164. sym = get_sym();
  3165. sym = parse_shift_expression(sym, &op2);
  3166. zend_ffi_expr_is_greater_or_equal(val, &op2);
  3167. }
  3168. }
  3169. return sym;
  3170. }
  3171. static int parse_shift_expression(int sym, zend_ffi_val *val) {
  3172. zend_ffi_val op2;
  3173. sym = parse_additive_expression(sym, val);
  3174. while (sym == YY__LESS_LESS || sym == YY__GREATER_GREATER) {
  3175. if (sym == YY__LESS_LESS) {
  3176. sym = get_sym();
  3177. sym = parse_additive_expression(sym, &op2);
  3178. zend_ffi_expr_shift_left(val, &op2);
  3179. } else {
  3180. sym = get_sym();
  3181. sym = parse_additive_expression(sym, &op2);
  3182. zend_ffi_expr_shift_right(val, &op2);
  3183. }
  3184. }
  3185. return sym;
  3186. }
  3187. static int parse_additive_expression(int sym, zend_ffi_val *val) {
  3188. zend_ffi_val op2;
  3189. sym = parse_multiplicative_expression(sym, val);
  3190. while (sym == YY__PLUS || sym == YY__MINUS) {
  3191. if (sym == YY__PLUS) {
  3192. sym = get_sym();
  3193. sym = parse_multiplicative_expression(sym, &op2);
  3194. zend_ffi_expr_add(val, &op2);
  3195. } else {
  3196. sym = get_sym();
  3197. sym = parse_multiplicative_expression(sym, &op2);
  3198. zend_ffi_expr_sub(val, &op2);
  3199. }
  3200. }
  3201. return sym;
  3202. }
  3203. static int parse_multiplicative_expression(int sym, zend_ffi_val *val) {
  3204. zend_ffi_val op2;
  3205. sym = parse_cast_expression(sym, val);
  3206. while (sym == YY__STAR || sym == YY__SLASH || sym == YY__PERCENT) {
  3207. if (sym == YY__STAR) {
  3208. sym = get_sym();
  3209. sym = parse_cast_expression(sym, &op2);
  3210. zend_ffi_expr_mul(val, &op2);
  3211. } else if (sym == YY__SLASH) {
  3212. sym = get_sym();
  3213. sym = parse_cast_expression(sym, &op2);
  3214. zend_ffi_expr_div(val, &op2);
  3215. } else {
  3216. sym = get_sym();
  3217. sym = parse_cast_expression(sym, &op2);
  3218. zend_ffi_expr_mod(val, &op2);
  3219. }
  3220. }
  3221. return sym;
  3222. }
  3223. static int parse_cast_expression(int sym, zend_ffi_val *val) {
  3224. int do_cast = 0;
  3225. zend_ffi_dcl dcl = ZEND_FFI_ATTR_INIT;
  3226. if ((sym == YY__LPAREN) && synpred_4(sym)) {
  3227. sym = get_sym();
  3228. sym = parse_type_name(sym, &dcl);
  3229. if (sym != YY__RPAREN) {
  3230. yy_error_sym("')' expected, got", sym);
  3231. }
  3232. sym = get_sym();
  3233. do_cast = 1;
  3234. }
  3235. sym = parse_unary_expression(sym, val);
  3236. if (do_cast) zend_ffi_expr_cast(val, &dcl);
  3237. return sym;
  3238. }
  3239. static int parse_unary_expression(int sym, zend_ffi_val *val) {
  3240. const char *name;
  3241. size_t name_len;
  3242. zend_ffi_dcl dcl = ZEND_FFI_ATTR_INIT;
  3243. switch (sym) {
  3244. case YY_ID:
  3245. sym = parse_ID(sym, &name, &name_len);
  3246. zend_ffi_resolve_const(name, name_len, val);
  3247. while (YY_IN_SET(sym, (YY__LBRACK,YY__LPAREN,YY__POINT,YY__MINUS_GREATER,YY__PLUS_PLUS,YY__MINUS_MINUS), "\010\000\000\000\000\000\002\020\000\200\003\000\000")) {
  3248. switch (sym) {
  3249. case YY__LBRACK:
  3250. sym = get_sym();
  3251. sym = parse_expr_list(sym);
  3252. if (sym != YY__RBRACK) {
  3253. yy_error_sym("']' expected, got", sym);
  3254. }
  3255. sym = get_sym();
  3256. break;
  3257. case YY__LPAREN:
  3258. sym = get_sym();
  3259. if (YY_IN_SET(sym, (YY__LPAREN,YY_ID,YY_OCTNUMBER,YY_DECNUMBER,YY_HEXNUMBER,YY_FLOATNUMBER,YY_STRING,YY_CHARACTER,YY__PLUS_PLUS,YY__MINUS_MINUS,YY__AND,YY__STAR,YY__PLUS,YY__MINUS,YY__TILDE,YY__BANG,YY_SIZEOF,YY__ALIGNOF,YY___ALIGNOF,YY___ALIGNOF__), "\010\000\000\000\000\000\001\000\004\030\377\376\000")) {
  3260. sym = parse_expr_list(sym);
  3261. }
  3262. if (sym != YY__RPAREN) {
  3263. yy_error_sym("')' expected, got", sym);
  3264. }
  3265. sym = get_sym();
  3266. break;
  3267. case YY__POINT:
  3268. sym = get_sym();
  3269. sym = parse_ID(sym, &name, &name_len);
  3270. break;
  3271. case YY__MINUS_GREATER:
  3272. sym = get_sym();
  3273. sym = parse_ID(sym, &name, &name_len);
  3274. break;
  3275. case YY__PLUS_PLUS:
  3276. sym = get_sym();
  3277. break;
  3278. default:
  3279. sym = get_sym();
  3280. break;
  3281. }
  3282. zend_ffi_val_error(val);
  3283. }
  3284. break;
  3285. case YY_OCTNUMBER:
  3286. sym = parse_OCTNUMBER(sym, val);
  3287. break;
  3288. case YY_DECNUMBER:
  3289. sym = parse_DECNUMBER(sym, val);
  3290. break;
  3291. case YY_HEXNUMBER:
  3292. sym = parse_HEXNUMBER(sym, val);
  3293. break;
  3294. case YY_FLOATNUMBER:
  3295. sym = parse_FLOATNUMBER(sym, val);
  3296. break;
  3297. case YY_STRING:
  3298. sym = parse_STRING(sym, val);
  3299. break;
  3300. case YY_CHARACTER:
  3301. sym = parse_CHARACTER(sym, val);
  3302. break;
  3303. case YY__LPAREN:
  3304. sym = get_sym();
  3305. sym = parse_expression(sym, val);
  3306. if (sym != YY__RPAREN) {
  3307. yy_error_sym("')' expected, got", sym);
  3308. }
  3309. sym = get_sym();
  3310. break;
  3311. case YY__PLUS_PLUS:
  3312. sym = get_sym();
  3313. sym = parse_unary_expression(sym, val);
  3314. zend_ffi_val_error(val);
  3315. break;
  3316. case YY__MINUS_MINUS:
  3317. sym = get_sym();
  3318. sym = parse_unary_expression(sym, val);
  3319. zend_ffi_val_error(val);
  3320. break;
  3321. case YY__AND:
  3322. sym = get_sym();
  3323. sym = parse_cast_expression(sym, val);
  3324. zend_ffi_val_error(val);
  3325. break;
  3326. case YY__STAR:
  3327. sym = get_sym();
  3328. sym = parse_cast_expression(sym, val);
  3329. zend_ffi_val_error(val);
  3330. break;
  3331. case YY__PLUS:
  3332. sym = get_sym();
  3333. sym = parse_cast_expression(sym, val);
  3334. zend_ffi_expr_plus(val);
  3335. break;
  3336. case YY__MINUS:
  3337. sym = get_sym();
  3338. sym = parse_cast_expression(sym, val);
  3339. zend_ffi_expr_neg(val);
  3340. break;
  3341. case YY__TILDE:
  3342. sym = get_sym();
  3343. sym = parse_cast_expression(sym, val);
  3344. zend_ffi_expr_bw_not(val);
  3345. break;
  3346. case YY__BANG:
  3347. sym = get_sym();
  3348. sym = parse_cast_expression(sym, val);
  3349. zend_ffi_expr_bool_not(val);
  3350. break;
  3351. case YY_SIZEOF:
  3352. sym = get_sym();
  3353. if ((sym == YY__LPAREN) && synpred_5(sym)) {
  3354. sym = get_sym();
  3355. sym = parse_type_name(sym, &dcl);
  3356. if (sym != YY__RPAREN) {
  3357. yy_error_sym("')' expected, got", sym);
  3358. }
  3359. sym = get_sym();
  3360. zend_ffi_expr_sizeof_type(val, &dcl);
  3361. } else if (YY_IN_SET(sym, (YY_ID,YY_OCTNUMBER,YY_DECNUMBER,YY_HEXNUMBER,YY_FLOATNUMBER,YY_STRING,YY_CHARACTER,YY__LPAREN,YY__PLUS_PLUS,YY__MINUS_MINUS,YY__AND,YY__STAR,YY__PLUS,YY__MINUS,YY__TILDE,YY__BANG,YY_SIZEOF,YY__ALIGNOF,YY___ALIGNOF,YY___ALIGNOF__), "\010\000\000\000\000\000\001\000\004\030\377\376\000")) {
  3362. sym = parse_unary_expression(sym, val);
  3363. zend_ffi_expr_sizeof_val(val);
  3364. } else {
  3365. yy_error_sym("unexpected", sym);
  3366. }
  3367. break;
  3368. case YY__ALIGNOF:
  3369. sym = get_sym();
  3370. if (sym != YY__LPAREN) {
  3371. yy_error_sym("'(' expected, got", sym);
  3372. }
  3373. sym = get_sym();
  3374. sym = parse_type_name(sym, &dcl);
  3375. if (sym != YY__RPAREN) {
  3376. yy_error_sym("')' expected, got", sym);
  3377. }
  3378. sym = get_sym();
  3379. zend_ffi_expr_alignof_type(val, &dcl);
  3380. break;
  3381. case YY___ALIGNOF:
  3382. case YY___ALIGNOF__:
  3383. sym = get_sym();
  3384. if ((sym == YY__LPAREN) && synpred_6(sym)) {
  3385. sym = get_sym();
  3386. sym = parse_type_name(sym, &dcl);
  3387. if (sym != YY__RPAREN) {
  3388. yy_error_sym("')' expected, got", sym);
  3389. }
  3390. sym = get_sym();
  3391. zend_ffi_expr_alignof_type(val, &dcl);
  3392. } else if (YY_IN_SET(sym, (YY_ID,YY_OCTNUMBER,YY_DECNUMBER,YY_HEXNUMBER,YY_FLOATNUMBER,YY_STRING,YY_CHARACTER,YY__LPAREN,YY__PLUS_PLUS,YY__MINUS_MINUS,YY__AND,YY__STAR,YY__PLUS,YY__MINUS,YY__TILDE,YY__BANG,YY_SIZEOF,YY__ALIGNOF,YY___ALIGNOF,YY___ALIGNOF__), "\010\000\000\000\000\000\001\000\004\030\377\376\000")) {
  3393. sym = parse_unary_expression(sym, val);
  3394. zend_ffi_expr_alignof_val(val);
  3395. } else {
  3396. yy_error_sym("unexpected", sym);
  3397. }
  3398. break;
  3399. default:
  3400. yy_error_sym("unexpected", sym);
  3401. }
  3402. return sym;
  3403. }
  3404. static int parse_ID(int sym, const char **name, size_t *name_len) {
  3405. if (sym != YY_ID) {
  3406. yy_error_sym("<ID> expected, got", sym);
  3407. }
  3408. *name = (const char*)yy_text; *name_len = yy_pos - yy_text;
  3409. sym = get_sym();
  3410. return sym;
  3411. }
  3412. static int parse_OCTNUMBER(int sym, zend_ffi_val *val) {
  3413. if (sym != YY_OCTNUMBER) {
  3414. yy_error_sym("<OCTNUMBER> expected, got", sym);
  3415. }
  3416. zend_ffi_val_number(val, 8, (const char*)yy_text, yy_pos - yy_text);
  3417. sym = get_sym();
  3418. return sym;
  3419. }
  3420. static int parse_DECNUMBER(int sym, zend_ffi_val *val) {
  3421. if (sym != YY_DECNUMBER) {
  3422. yy_error_sym("<DECNUMBER> expected, got", sym);
  3423. }
  3424. zend_ffi_val_number(val, 10, (const char*)yy_text, yy_pos - yy_text);
  3425. sym = get_sym();
  3426. return sym;
  3427. }
  3428. static int parse_HEXNUMBER(int sym, zend_ffi_val *val) {
  3429. if (sym != YY_HEXNUMBER) {
  3430. yy_error_sym("<HEXNUMBER> expected, got", sym);
  3431. }
  3432. zend_ffi_val_number(val, 16, (const char*)yy_text + 2, yy_pos - yy_text - 2);
  3433. sym = get_sym();
  3434. return sym;
  3435. }
  3436. static int parse_FLOATNUMBER(int sym, zend_ffi_val *val) {
  3437. if (sym != YY_FLOATNUMBER) {
  3438. yy_error_sym("<FLOATNUMBER> expected, got", sym);
  3439. }
  3440. zend_ffi_val_float_number(val, (const char*)yy_text, yy_pos - yy_text);
  3441. sym = get_sym();
  3442. return sym;
  3443. }
  3444. static int parse_STRING(int sym, zend_ffi_val *val) {
  3445. if (sym != YY_STRING) {
  3446. yy_error_sym("<STRING> expected, got", sym);
  3447. }
  3448. zend_ffi_val_string(val, (const char*)yy_text, yy_pos - yy_text);
  3449. sym = get_sym();
  3450. return sym;
  3451. }
  3452. static int parse_CHARACTER(int sym, zend_ffi_val *val) {
  3453. if (sym != YY_CHARACTER) {
  3454. yy_error_sym("<CHARACTER> expected, got", sym);
  3455. }
  3456. zend_ffi_val_character(val, (const char*)yy_text, yy_pos - yy_text);
  3457. sym = get_sym();
  3458. return sym;
  3459. }
  3460. static void parse(void) {
  3461. int sym;
  3462. yy_pos = yy_text = yy_buf;
  3463. yy_line = 1;
  3464. sym = parse_declarations(get_sym());
  3465. if (sym != YY_EOF) {
  3466. yy_error_sym("<EOF> expected, got", sym);
  3467. }
  3468. }
  3469. int zend_ffi_parse_decl(const char *str, size_t len) {
  3470. if (SETJMP(FFI_G(bailout))==0) {
  3471. FFI_G(allow_vla) = 0;
  3472. FFI_G(attribute_parsing) = 0;
  3473. yy_buf = (unsigned char*)str;
  3474. yy_end = yy_buf + len;
  3475. parse();
  3476. return SUCCESS;
  3477. } else {
  3478. return FAILURE;
  3479. }
  3480. }
  3481. int zend_ffi_parse_type(const char *str, size_t len, zend_ffi_dcl *dcl) {
  3482. int sym;
  3483. if (SETJMP(FFI_G(bailout))==0) {
  3484. FFI_G(allow_vla) = 0;
  3485. FFI_G(attribute_parsing) = 0;
  3486. yy_pos = yy_text = yy_buf = (unsigned char*)str;
  3487. yy_end = yy_buf + len;
  3488. yy_line = 1;
  3489. sym = parse_type_name(get_sym(), dcl);
  3490. if (sym != YY_EOF) {
  3491. yy_error_sym("<EOF> expected, got", sym);
  3492. }
  3493. zend_ffi_validate_type_name(dcl);
  3494. return SUCCESS;
  3495. } else {
  3496. return FAILURE;
  3497. };
  3498. }
  3499. static void yy_error(const char *msg) {
  3500. zend_ffi_parser_error("%s at line %d", msg, yy_line);
  3501. }
  3502. static void yy_error_sym(const char *msg, int sym) {
  3503. zend_ffi_parser_error("%s '%s' at line %d", msg, sym_name[sym], yy_line);
  3504. }